Adds missing breadcrumbs.
This commit is contained in:
parent
4f727e5f2e
commit
fadaa9bbcb
|
@ -17,6 +17,8 @@ import { DatasetProfileEditorModel } from './dataset-profile-editor-model';
|
|||
import { ConfirmationDialogComponent } from '../../../../library/confirmation-dialog/confirmation-dialog.component';
|
||||
import { DatasetProfileEnum } from '../../../../core/common/enum/dataset-profile';
|
||||
import * as FileSaver from 'file-saver';
|
||||
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { Observable } from 'rxjs';
|
||||
//import * as data from 'src/assets/resources/skipDisable.json';
|
||||
|
||||
const skipDisable: any[] = require('../../../../../assets/resources/skipDisable.json');
|
||||
|
@ -36,6 +38,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
private datasetProfileId: string;
|
||||
newVersionId: string;
|
||||
dataWizardModel: DatasetWizardModel;
|
||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||
@ViewChild('stepper') stepper: MatHorizontalStepper;
|
||||
viewOnly = false;
|
||||
|
||||
|
@ -82,6 +85,11 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
},
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'DatasetProfileListingComponent',
|
||||
label: this.language.instant('NAV-BAR.TEMPLATE'),
|
||||
url: '/dataset-profiles/' + this.datasetProfileId
|
||||
}]);
|
||||
} else if (cloneId != null) {
|
||||
this.datasetProfileService.clone(cloneId)
|
||||
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
||||
|
|
|
@ -15,6 +15,7 @@ import { DatasetProfileCriteriaComponent } from './criteria/dataset-profile.comp
|
|||
import { error } from 'selenium-webdriver';
|
||||
import { UiNotificationService, SnackBarNotificationLevel } from '../../../../core/services/notification/ui-notification-service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-profile-listing-component',
|
||||
|
@ -27,6 +28,7 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
|||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ViewChild(DatasetProfileCriteriaComponent) criteria: DatasetProfileCriteriaComponent;
|
||||
|
||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||
dataSource: DatasetDataSource | null;
|
||||
displayedColumns: String[] = ['label', 'description', 'created', 'actions'];
|
||||
pageEvent: PageEvent;
|
||||
|
@ -55,16 +57,24 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
|||
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback(() => this.refresh());
|
||||
// this.breadCrumbs = Observable.of([{
|
||||
// parentComponentName: null,
|
||||
// label: this.language.instant('NAV-BAR.DATASET-TEMPLATES'),
|
||||
// url: 'plans/edit/' + this.dmpId
|
||||
// }]);
|
||||
} else {
|
||||
this.itemId = params['groupId'];
|
||||
|
||||
if (this.itemId) {
|
||||
const datasetProfileLabel = this.route.snapshot.queryParams.groupLabel;
|
||||
}
|
||||
|
||||
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback(() => this.refresh());
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: null,
|
||||
label: this.language.instant('NAV-BAR.DATASET-TEMPLATES'),
|
||||
url: '/dataset-profiles'
|
||||
}]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -75,7 +85,7 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
|||
.subscribe(data => {
|
||||
this.titlePrefix = data.label;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
|
|
|
@ -15,6 +15,8 @@ import { DmpProfileService } from '../../../../core/services/dmp/dmp-profile.ser
|
|||
import { SnackBarNotificationLevel, UiNotificationService } from '../../../../core/services/notification/ui-notification-service';
|
||||
import { EnumUtils } from '../../../../core/services/utilities/enum-utils.service';
|
||||
import { DmpProfileEditorModel, DmpProfileFieldEditorModel } from './dmp-profile-editor.model';
|
||||
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-profile-editor-component',
|
||||
|
@ -29,6 +31,7 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
|||
formGroup: FormGroup = null;
|
||||
host = environment.Server;
|
||||
dmpProfileId: string;
|
||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||
|
||||
constructor(
|
||||
private dmpProfileService: DmpProfileService,
|
||||
|
@ -58,12 +61,22 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
|||
this.formGroup.disable();
|
||||
this.viewOnly = true
|
||||
}
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'DmpProfileListingComponent',
|
||||
label: this.language.instant('NAV-BAR.TEMPLATE'),
|
||||
url: '/dmp-profiles/' + this.dmpProfileId
|
||||
}]);
|
||||
});
|
||||
} else {
|
||||
this.dmpProfileModel = new DmpProfileEditorModel();
|
||||
setTimeout(() => {
|
||||
this.formGroup = this.dmpProfileModel.buildForm();
|
||||
});
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'DmpProfileListingComponent',
|
||||
label: this.language.instant('NAV-BAR.TEMPLATE'),
|
||||
url: '/dmp-profiles/' + this.dmpProfileId
|
||||
}]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -82,8 +95,8 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
|||
this.dmpProfileService.createDmp(this.formGroup.value)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -185,8 +198,8 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
|||
this.dmpProfileService.createDmp(this.formGroup.value)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import { DmpProfileCriteria } from '../../../../core/query/dmp/dmp-profile-crite
|
|||
import { DmpProfileService } from '../../../../core/services/dmp/dmp-profile.service';
|
||||
import { DataTableRequest } from '../../../../core/model/data-table/data-table-request';
|
||||
import { DmpProfileCriteriaComponent } from './criteria/dmp-profile-criteria.component';
|
||||
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-profile-listing-component',
|
||||
|
@ -28,6 +29,7 @@ export class DmpProfileListingComponent extends BaseComponent implements OnInit
|
|||
pageEvent: PageEvent;
|
||||
titlePrefix: String;
|
||||
dmpId: String;
|
||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||
|
||||
statuses = [
|
||||
{ value: '0', viewValue: 'Active' },
|
||||
|
@ -44,7 +46,6 @@ export class DmpProfileListingComponent extends BaseComponent implements OnInit
|
|||
super();
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
|
@ -53,6 +54,11 @@ export class DmpProfileListingComponent extends BaseComponent implements OnInit
|
|||
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback(() => this.refresh());
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: null,
|
||||
label: this.languageService.instant('NAV-BAR.DMP-TEMPLATES'),
|
||||
url: '/dmp-profiles'
|
||||
}]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -73,7 +79,6 @@ export class DmpProfileListingComponent extends BaseComponent implements OnInit
|
|||
// debugger;
|
||||
// this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
export class DatasetDataSource extends DataSource<DmpProfileListing> {
|
||||
|
@ -96,7 +101,6 @@ export class DatasetDataSource extends DataSource<DmpProfileListing> {
|
|||
//this._sort.matSortChange
|
||||
];
|
||||
|
||||
|
||||
return Observable.merge(...displayDataChanges)
|
||||
.startWith(null)
|
||||
.switchMap(() => {
|
||||
|
|
|
@ -9,6 +9,7 @@ import { UserService } from '../../../../core/services/user/user.service';
|
|||
import { SnackBarNotificationComponent } from '../../../../library/notification/snack-bar/snack-bar-notification.component';
|
||||
import { DataTableRequest } from '../../../../core/model/data-table/data-table-request';
|
||||
import { UserCriteriaComponent } from './criteria/user-criteria.component';
|
||||
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
|
||||
export class UsersDataSource extends DataSource<UserListingModel> {
|
||||
|
||||
|
@ -93,6 +94,7 @@ export class UserListingComponent implements OnInit, AfterViewInit {
|
|||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ViewChild(UserCriteriaComponent) criteria: UserCriteriaComponent;
|
||||
|
||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||
dataSource: UsersDataSource | null;
|
||||
displayedColumns: String[] = ['name', 'email', 'lastloggedin', 'roles'];
|
||||
|
||||
|
@ -105,6 +107,11 @@ export class UserListingComponent implements OnInit, AfterViewInit {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: null,
|
||||
label: this.languageService.instant('NAV-BAR.USERS-BREADCRUMB'),
|
||||
url: "/users"
|
||||
}]);
|
||||
//this.refresh(); //called on ngAfterViewInit with default criteria
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit, IBread
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: 'Dashboard',
|
||||
label: 'Dataset description wizard',
|
||||
label: this.language.instant('NAV-BAR.DATASET-DESCRIPTION-WIZARD'),
|
||||
url: '/datasetcreatewizard'
|
||||
}]
|
||||
);
|
||||
|
|
|
@ -136,7 +136,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: null,
|
||||
label: 'Datasets',
|
||||
label: this.language.instant('NAV-BAR.DATASETS'),
|
||||
url: '/datasets',
|
||||
notFoundResolver: [
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: null,
|
||||
label: 'Datasets',
|
||||
label: this.language.instant('NAV-BAR.DATASETS'),
|
||||
url: '/datasets',
|
||||
notFoundResolver: [
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: null,
|
||||
label: 'Datasets',
|
||||
label: this.language.instant('NAV-BAR.DATASETS'),
|
||||
url: '/datasets',
|
||||
notFoundResolver: [
|
||||
{
|
||||
|
@ -260,7 +260,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: null,
|
||||
label: 'Datasets',
|
||||
label: this.language.instant('NAV-BAR.DATASETS'),
|
||||
url: '/datasets',
|
||||
notFoundResolver: [
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: null,
|
||||
label: 'Datasets',
|
||||
label: this.language.instant('NAV-BAR.DATASETS'),
|
||||
url: '/datasets',
|
||||
notFoundResolver: [
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ import { DmpService } from '../../../core/services/dmp/dmp.service';
|
|||
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||
import { DatasetCriteriaComponent } from './criteria/dataset-criteria.component';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-listing-component',
|
||||
|
@ -38,6 +39,7 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
|||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private dmpService: DmpService,
|
||||
private language: TranslateService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -56,7 +58,11 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
|||
this.criteria.setCriteria(this.getDefaultCriteria(dmp));
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
this.breadCrumbs = Observable.of([{ parentComponentName: 'DmpEditorComponent', label: dmp.label, url: 'plans/edit/' + this.dmpId }]);
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'DmpEditorComponent',
|
||||
label: dmp.label,
|
||||
url: '/plans/edit/' + this.dmpId
|
||||
}]);
|
||||
if (params['dmpLabel'] !== undefined) {
|
||||
this.titlePrefix = 'for ' + params['dmpLabel'];
|
||||
}
|
||||
|
@ -64,7 +70,11 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
|||
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
this.breadCrumbs = Observable.of([]);
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: null,
|
||||
label: this.language.instant('NAV-BAR.DATASET-DESCRIPTIONS'),
|
||||
url: "/datasets"
|
||||
}]);
|
||||
}
|
||||
|
||||
if (this.status != null && this.status == 0) {
|
||||
|
|
|
@ -155,7 +155,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
if (this.isAuthenticated) {
|
||||
// if (!this.isAuthenticated) {
|
||||
const breadCrumbs = [];
|
||||
breadCrumbs.push({ parentComponentName: null, label: 'DMPs', url: "/plans" });
|
||||
breadCrumbs.push({
|
||||
parentComponentName: null,
|
||||
label: this.language.instant('NAV-BAR.DMPS'),
|
||||
url: "/plans"
|
||||
});
|
||||
const breadcrumb = await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise();
|
||||
breadCrumbs.push(
|
||||
{
|
||||
|
@ -196,7 +200,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: 'DmpListingComponent',
|
||||
label: 'DMPs',
|
||||
label: this.language.instant('NAV-BAR.DMPS'),
|
||||
url: 'plans',
|
||||
notFoundResolver: [await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()]
|
||||
}]
|
||||
|
@ -246,7 +250,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: 'DmpListingComponent',
|
||||
label: 'DMPs',
|
||||
label: this.language.instant('NAV-BAR.DMPS'),
|
||||
url: 'plans',
|
||||
}
|
||||
]);
|
||||
|
@ -280,8 +284,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
this.dmpService.createDmp(this.formGroup.getRawValue())
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
complete => this.onCallbackSuccess(),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -373,8 +377,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
this.dmpService.delete(this.dmp.id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => { this.onCallbackSuccess() },
|
||||
error => this.onDeleteCallbackError(error)
|
||||
complete => { this.onCallbackSuccess() },
|
||||
error => this.onDeleteCallbackError(error)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -14,6 +14,7 @@ import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item
|
|||
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||
import { DmpInvitationDialogComponent } from '../invitation/dmp-invitation.component';
|
||||
import { DmpCriteriaComponent } from './criteria/dmp-criteria.component';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-listing-component',
|
||||
|
@ -39,7 +40,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private dialog: MatDialog,
|
||||
public enumUtils: EnumUtils
|
||||
public enumUtils: EnumUtils,
|
||||
private language: TranslateService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -67,13 +69,18 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
|
||||
if (this.itemId) {
|
||||
const dmplabel = this.route.snapshot.queryParams.groupLabel;
|
||||
breadCrumbs.push(
|
||||
{ parentComponentName: null, label: 'DMPs', url: '/plans' },
|
||||
);
|
||||
breadCrumbs.push({
|
||||
parentComponentName: null,
|
||||
label: this.language.instant('NAV-BAR.DMPS'),
|
||||
url: '/plans'
|
||||
});
|
||||
}
|
||||
else breadCrumbs.push({ parentComponentName: null, label: 'DMPs', url: "/plans" })
|
||||
else breadCrumbs.push({
|
||||
parentComponentName: null,
|
||||
label: this.language.instant('NAV-BAR.DMPS'),
|
||||
url: "/plans"
|
||||
})
|
||||
this.breadCrumbs = Observable.of(breadCrumbs);
|
||||
|
||||
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
|
|
|
@ -10,6 +10,7 @@ import { DatasetService } from '../../core/services/dataset/dataset.service';
|
|||
import { IBreadCrumbComponent } from '../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||
import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { Observable } from 'rxjs';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -30,6 +31,7 @@ export class ExploreDatasetListingComponent extends BaseComponent implements OnI
|
|||
constructor(
|
||||
private datasetService: DatasetService,
|
||||
private router: Router,
|
||||
private language: TranslateService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -38,7 +40,11 @@ export class ExploreDatasetListingComponent extends BaseComponent implements OnI
|
|||
this.refresh();
|
||||
|
||||
const breadCrumbs = [];
|
||||
breadCrumbs.push({ parentComponentName: null, label: 'PUBLIC DATASETS', url: "/explore" })
|
||||
breadCrumbs.push({
|
||||
parentComponentName: null,
|
||||
label: this.language.instant('NAV-BAR.PUBLIC DATASETS'),
|
||||
url: "/explore"
|
||||
})
|
||||
this.breadCrumbs = Observable.of(breadCrumbs);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import { DmpService } from "../../core/services/dmp/dmp.service";
|
|||
import { Observable } from "rxjs";
|
||||
import { IBreadCrumbComponent } from "../misc/breadcrumb/definition/IBreadCrumbComponent";
|
||||
import { BreadcrumbItem } from "../misc/breadcrumb/definition/breadcrumb-item";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
|
||||
@Component({
|
||||
selector: 'app-explore-dmp-listing-component',
|
||||
|
@ -29,7 +30,8 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
|
|||
|
||||
constructor(
|
||||
private dmpService: DmpService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
private language: TranslateService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -38,7 +40,11 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
|
|||
this.refresh();
|
||||
|
||||
const breadCrumbs = [];
|
||||
breadCrumbs.push({ parentComponentName: null, label: 'PUBLIC DMPS', url: "/explore-plans" })
|
||||
breadCrumbs.push({
|
||||
parentComponentName: null,
|
||||
label: this.language.instant('NAV-BAR.PUBLIC DMPS'),
|
||||
url: "/explore-plans"
|
||||
})
|
||||
this.breadCrumbs = Observable.of(breadCrumbs);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import { BreadCrumbResolverService } from './service/breadcrumb.service';
|
|||
import { DashboardService } from '../../../core/services/dashboard/dashboard.service';
|
||||
import { assertDataInRangeInternal } from '@angular/core/src/render3/util';
|
||||
import { url } from 'inspector';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-breadcrumb',
|
||||
|
@ -22,19 +23,22 @@ export class BreadcrumbComponent implements OnInit {
|
|||
constructor(
|
||||
public activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private breadCrumbService: BreadCrumbResolverService
|
||||
private breadCrumbService: BreadCrumbResolverService,
|
||||
private language: TranslateService,
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> {
|
||||
if (this.breadCrumbService.resolve(route)) {
|
||||
return this.breadCrumbService.resolve(route).map(x => {
|
||||
x.unshift({ label: 'HOME', url: '/home', icon: 'dashboard' }); return x;
|
||||
x.unshift({
|
||||
label: this.language.instant('NAV-BAR.HOME'),
|
||||
url: '/home',
|
||||
icon: 'dashboard'
|
||||
}); return x;
|
||||
});
|
||||
}
|
||||
return Observable.of([]);
|
||||
|
|
|
@ -60,14 +60,18 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
|
|||
.subscribe(data => {
|
||||
this.project = new ProjectEditorModel().fromModel(data);
|
||||
this.formGroup = this.project.buildForm(null, this.project.type === ProjectType.External || !this.editMode);
|
||||
this.breadCrumbs = Observable.of([
|
||||
{ parentComponentName: 'ProjectListingComponent', label: 'Projects', url: '/projects' },
|
||||
]);
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'ProjectListingComponent',
|
||||
label: this.language.instant('NAV-BAR.PROJECTS'),
|
||||
url: '/projects'
|
||||
}]);
|
||||
});
|
||||
} else {
|
||||
this.breadCrumbs = Observable.of([
|
||||
{ parentComponentName: 'ProjectListingComponent', label: 'Projects', url: '/projects' },
|
||||
]);
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'ProjectListingComponent',
|
||||
label: this.language.instant('NAV-BAR.PROJECTS'),
|
||||
url: '/projects'
|
||||
}]);
|
||||
this.project = new ProjectEditorModel();
|
||||
setTimeout(() => {
|
||||
this.formGroup = this.project.buildForm();
|
||||
|
@ -178,8 +182,8 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
|
|||
this.formGroup.disable();
|
||||
}
|
||||
|
||||
public imgEnable():boolean{
|
||||
if(this.isNew || this.editMode){
|
||||
public imgEnable(): boolean {
|
||||
if (this.isNew || this.editMode) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -198,7 +202,7 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
|
|||
const size: number = event.target.files[0].size; // Get file size.
|
||||
this.sizeError = size > this.maxFileSize; // Checks if file size is valid.
|
||||
const formdata: FormData = new FormData();
|
||||
if (!this.sizeError){
|
||||
if (!this.sizeError) {
|
||||
if (fileList instanceof FileList) {
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
formdata.append('file', fileList[i]);
|
||||
|
@ -207,8 +211,8 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
|
|||
formdata.append('file', fileList);
|
||||
}
|
||||
this.projectFileUploadService.uploadFile(formdata)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(files => this.formGroup.get('files').patchValue(files));
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(files => this.formGroup.get('files').patchValue(files));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,148 +18,142 @@ import { DmpEditorWizardModel } from './dmp-editor-wizard-model';
|
|||
|
||||
|
||||
@Component({
|
||||
selector: 'app-quick-wizard-dmp-editor-component',
|
||||
templateUrl: 'dmp-editor-wizard.component.html',
|
||||
styleUrls: ['./dmp-editor-wizard.component.scss']
|
||||
selector: 'app-quick-wizard-dmp-editor-component',
|
||||
templateUrl: 'dmp-editor-wizard.component.html',
|
||||
styleUrls: ['./dmp-editor-wizard.component.scss']
|
||||
})
|
||||
export class DmpEditorWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
||||
|
||||
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
|
||||
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
|
||||
|
||||
isNew = true;
|
||||
dmp: DmpEditorWizardModel;
|
||||
@Input() formGroup: FormGroup;
|
||||
@Input() dmpLabel: string;
|
||||
@Input() datasetFormGroup: FormGroup;
|
||||
//formGroup: FormGroup = null;
|
||||
private uiNotificationService: UiNotificationService
|
||||
isNew = true;
|
||||
dmp: DmpEditorWizardModel;
|
||||
@Input() formGroup: FormGroup;
|
||||
@Input() dmpLabel: string;
|
||||
@Input() datasetFormGroup: FormGroup;
|
||||
//formGroup: FormGroup = null;
|
||||
private uiNotificationService: UiNotificationService
|
||||
|
||||
profilesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
filteredProfiles: DatasetProfileModel[];
|
||||
filteredProfilesAsync = false;
|
||||
profilesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
filteredProfiles: DatasetProfileModel[];
|
||||
filteredProfilesAsync = false;
|
||||
|
||||
|
||||
constructor(
|
||||
public snackBar: MatSnackBar,
|
||||
public router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private _service: DmpService,
|
||||
public language: TranslateService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
constructor(
|
||||
public snackBar: MatSnackBar,
|
||||
public router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private _service: DmpService,
|
||||
public language: TranslateService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
ngOnInit(): void {
|
||||
|
||||
this.profilesAutoCompleteConfiguration = {
|
||||
filterFn: this.filterProfiles.bind(this),
|
||||
initialItems: (extraData) => this.filterProfiles(''),
|
||||
displayFn: (item) => item['label'],
|
||||
titleFn: (item) => item['label']
|
||||
};
|
||||
this.profilesAutoCompleteConfiguration = {
|
||||
filterFn: this.filterProfiles.bind(this),
|
||||
initialItems: (extraData) => this.filterProfiles(''),
|
||||
displayFn: (item) => item['label'],
|
||||
titleFn: (item) => item['label']
|
||||
};
|
||||
|
||||
if (this.formGroup == null) {
|
||||
this.dmp = new DmpEditorWizardModel();
|
||||
this.formGroup = this.dmp.buildForm();
|
||||
}
|
||||
this.formGroup.get('label').setValue(this.language.instant('QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.DMP-NAME') + this.dmpLabel);
|
||||
this.formGroup.get('label').setValue(this.language.instant('QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.DMP-NAME') + this.dmpLabel);
|
||||
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'project',
|
||||
label: this.language.instant('NAV-BAR.DMP'),
|
||||
url: '/quick-wizard/dmp'
|
||||
}]);
|
||||
}
|
||||
|
||||
formSubmit(): void {
|
||||
this.touchAllFormFields(this.formGroup);
|
||||
if (!this.isFormValid()) { return; }
|
||||
this.onSubmit();
|
||||
}
|
||||
|
||||
public isFormValid() {
|
||||
return this.formGroup.valid;
|
||||
}
|
||||
|
||||
public touchAllFormFields(formControl: AbstractControl) {
|
||||
if (formControl instanceof FormControl) {
|
||||
formControl.markAsTouched();
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
this.touchAllFormFields(control);
|
||||
});
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
this.touchAllFormFields(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit(): void {
|
||||
// this.projectService.createProject(this.formGroup.value)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(
|
||||
// complete => this.onCallbackSuccess(),
|
||||
// error => this.onCallbackError(error)
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
if (this.formGroup == null) {
|
||||
this.dmp = new DmpEditorWizardModel();
|
||||
this.formGroup = this.dmp.buildForm();
|
||||
}
|
||||
this.formGroup.get('label').setValue(this.language.instant('QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.DMP-NAME') + this.dmpLabel);
|
||||
this.formGroup.get('label').setValue(this.language.instant('QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.DMP-NAME') + this.dmpLabel);
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/dmp']);
|
||||
}
|
||||
|
||||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: 'project',
|
||||
label: 'Dmp',
|
||||
url: '/quick-wizard/dmp'
|
||||
}]
|
||||
);
|
||||
onCallbackError(errorResponse: any) {
|
||||
this.setErrorModel(errorResponse.error.payload);
|
||||
this.validateAllFormFields(this.formGroup);
|
||||
}
|
||||
|
||||
}
|
||||
public setErrorModel(validationErrorModel: ValidationErrorModel) {
|
||||
Object.keys(validationErrorModel).forEach(item => {
|
||||
(<any>this.dmp.validationErrorModel)[item] = (<any>validationErrorModel)[item];
|
||||
});
|
||||
}
|
||||
|
||||
formSubmit(): void {
|
||||
this.touchAllFormFields(this.formGroup);
|
||||
if (!this.isFormValid()) { return; }
|
||||
this.onSubmit();
|
||||
}
|
||||
public validateAllFormFields(formControl: AbstractControl) {
|
||||
if (formControl instanceof FormControl) {
|
||||
formControl.updateValueAndValidity({ emitEvent: false });
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
this.validateAllFormFields(control);
|
||||
});
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
this.validateAllFormFields(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public isFormValid() {
|
||||
return this.formGroup.valid;
|
||||
}
|
||||
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
|
||||
|
||||
public touchAllFormFields(formControl: AbstractControl) {
|
||||
if (formControl instanceof FormControl) {
|
||||
formControl.markAsTouched();
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
this.touchAllFormFields(control);
|
||||
});
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
this.touchAllFormFields(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit(): void {
|
||||
// this.projectService.createProject(this.formGroup.value)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(
|
||||
// complete => this.onCallbackSuccess(),
|
||||
// error => this.onCallbackError(error)
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/dmp']);
|
||||
}
|
||||
|
||||
onCallbackError(errorResponse: any) {
|
||||
this.setErrorModel(errorResponse.error.payload);
|
||||
this.validateAllFormFields(this.formGroup);
|
||||
}
|
||||
|
||||
public setErrorModel(validationErrorModel: ValidationErrorModel) {
|
||||
Object.keys(validationErrorModel).forEach(item => {
|
||||
(<any>this.dmp.validationErrorModel)[item] = (<any>validationErrorModel)[item];
|
||||
});
|
||||
}
|
||||
|
||||
public validateAllFormFields(formControl: AbstractControl) {
|
||||
if (formControl instanceof FormControl) {
|
||||
formControl.updateValueAndValidity({ emitEvent: false });
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
this.validateAllFormFields(control);
|
||||
});
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
this.validateAllFormFields(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
|
||||
|
||||
this.filteredProfiles = undefined;
|
||||
this.filteredProfilesAsync = true;
|
||||
|
||||
const request = new RequestItem<DatasetProfileCriteria>();
|
||||
const criteria = new DatasetProfileCriteria();
|
||||
criteria.like = value;
|
||||
request.criteria = criteria;
|
||||
return this._service.searchDMPProfiles(request);
|
||||
}
|
||||
|
||||
datasetIsEmpty() {
|
||||
if (this.datasetFormGroup && this.datasetFormGroup.get('datasetsList') && (this.datasetFormGroup.get('datasetsList') as FormArray).length != 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
this.filteredProfiles = undefined;
|
||||
this.filteredProfilesAsync = true;
|
||||
|
||||
const request = new RequestItem<DatasetProfileCriteria>();
|
||||
const criteria = new DatasetProfileCriteria();
|
||||
criteria.like = value;
|
||||
request.criteria = criteria;
|
||||
return this._service.searchDMPProfiles(request);
|
||||
}
|
||||
|
||||
datasetIsEmpty() {
|
||||
if (this.datasetFormGroup && this.datasetFormGroup.get('datasetsList') && (this.datasetFormGroup.get('datasetsList') as FormArray).length != 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -17,164 +17,156 @@ import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCru
|
|||
import { ProjectEditorWizardModel } from './project-editor-wizard-model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-quick-wizard-project-editor-component',
|
||||
templateUrl: 'project-editor-wizard.component.html',
|
||||
styleUrls: ['./project-editor-wizard.component.scss']
|
||||
selector: 'app-quick-wizard-project-editor-component',
|
||||
templateUrl: 'project-editor-wizard.component.html',
|
||||
styleUrls: ['./project-editor-wizard.component.scss']
|
||||
})
|
||||
export class ProjectEditorWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
||||
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
|
||||
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
|
||||
|
||||
isNew = false;
|
||||
project: ProjectEditorWizardModel;
|
||||
@Input() formGroup: FormGroup;
|
||||
//formGroup: FormGroup = null;
|
||||
private uiNotificationService: UiNotificationService
|
||||
isNew = false;
|
||||
project: ProjectEditorWizardModel;
|
||||
@Input() formGroup: FormGroup;
|
||||
//formGroup: FormGroup = null;
|
||||
private uiNotificationService: UiNotificationService
|
||||
|
||||
projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
|
||||
constructor(
|
||||
public snackBar: MatSnackBar,
|
||||
private route: ActivatedRoute,
|
||||
public router: Router,
|
||||
public language: TranslateService,
|
||||
private projectService: ProjectService,
|
||||
public languageResolverService: LanguageResolverService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
constructor(
|
||||
public snackBar: MatSnackBar,
|
||||
private route: ActivatedRoute,
|
||||
public router: Router,
|
||||
public language: TranslateService,
|
||||
private projectService: ProjectService,
|
||||
public languageResolverService: LanguageResolverService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: 'QuickCreate',
|
||||
label: 'Project',
|
||||
url: '/quick-wizard/project'
|
||||
}]
|
||||
);
|
||||
ngOnInit() {
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'QuickCreate',
|
||||
label: this.language.instant('NAV-BAR.PROJECT'),
|
||||
url: '/quick-wizard/project'
|
||||
}]);
|
||||
|
||||
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||
projectRequestItem.criteria = new ProjectCriteria();
|
||||
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||
projectRequestItem.criteria = new ProjectCriteria();
|
||||
|
||||
this.projectAutoCompleteConfiguration = {
|
||||
filterFn: this.searchProject.bind(this),
|
||||
initialItems: (extraData) => this.searchProject(''),
|
||||
displayFn: (item) => item['label'],
|
||||
titleFn: (item) => item['label']
|
||||
};
|
||||
this.projectAutoCompleteConfiguration = {
|
||||
filterFn: this.searchProject.bind(this),
|
||||
initialItems: (extraData) => this.searchProject(''),
|
||||
displayFn: (item) => item['label'],
|
||||
titleFn: (item) => item['label']
|
||||
};
|
||||
|
||||
if (!this.formGroup) {
|
||||
this.project = new ProjectEditorWizardModel();
|
||||
this.formGroup = this.project.buildForm();
|
||||
}
|
||||
if (!this.formGroup) {
|
||||
this.project = new ProjectEditorWizardModel();
|
||||
this.formGroup = this.project.buildForm();
|
||||
}
|
||||
|
||||
this.formGroup.get('existProject').enable();
|
||||
this.formGroup.get('label').disable();
|
||||
this.formGroup.get('description').disable();
|
||||
this.formGroup.get('existProject').enable();
|
||||
this.formGroup.get('label').disable();
|
||||
this.formGroup.get('description').disable();
|
||||
|
||||
// this.route.params
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe((params: Params) => {
|
||||
// const itemId = params['id'];
|
||||
|
||||
// if (itemId != null) {
|
||||
// this.isNew = false;
|
||||
// this.projectService.getSingle(itemId).map(data => data as ProjectListingModel)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(data => {
|
||||
// this.project = new ProjectEditorModel().fromModel(data);
|
||||
// this.formGroup = this.project.buildForm(null, this.project.type === ProjectType.External || !this.editMode);
|
||||
// this.breadCrumbs = Observable.of([
|
||||
// { parentComponentName: 'ProjectListingComponent', label: 'Projects', url: '/projects' },
|
||||
// ]);
|
||||
// });
|
||||
// } else {
|
||||
// this.breadCrumbs = Observable.of([
|
||||
// { parentComponentName: 'QuickWizardComponent', label: 'Projects', url: '/projects' },
|
||||
// ]);
|
||||
// this.project = new ProjectEditorWizardModel();
|
||||
// setTimeout(() => {
|
||||
// this.formGroup = this.project.buildForm();
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public isFormValid() {
|
||||
return this.formGroup.valid;
|
||||
}
|
||||
|
||||
// this.route.params
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe((params: Params) => {
|
||||
// const itemId = params['id'];
|
||||
public touchAllFormFields(formControl: AbstractControl) {
|
||||
if (formControl instanceof FormControl) {
|
||||
formControl.markAsTouched();
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
this.touchAllFormFields(control);
|
||||
});
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
this.touchAllFormFields(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// if (itemId != null) {
|
||||
// this.isNew = false;
|
||||
// this.projectService.getSingle(itemId).map(data => data as ProjectListingModel)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(data => {
|
||||
// this.project = new ProjectEditorModel().fromModel(data);
|
||||
// this.formGroup = this.project.buildForm(null, this.project.type === ProjectType.External || !this.editMode);
|
||||
// this.breadCrumbs = Observable.of([
|
||||
// { parentComponentName: 'ProjectListingComponent', label: 'Projects', url: '/projects' },
|
||||
// ]);
|
||||
// });
|
||||
// } else {
|
||||
// this.breadCrumbs = Observable.of([
|
||||
// { parentComponentName: 'QuickWizardComponent', label: 'Projects', url: '/projects' },
|
||||
// ]);
|
||||
// this.project = new ProjectEditorWizardModel();
|
||||
// setTimeout(() => {
|
||||
// this.formGroup = this.project.buildForm();
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
}
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/project']);
|
||||
}
|
||||
|
||||
onCallbackError(errorResponse: any) {
|
||||
this.setErrorModel(errorResponse.error.payload);
|
||||
this.validateAllFormFields(this.formGroup);
|
||||
}
|
||||
|
||||
public isFormValid() {
|
||||
return this.formGroup.valid;
|
||||
}
|
||||
public setErrorModel(validationErrorModel: ValidationErrorModel) {
|
||||
Object.keys(validationErrorModel).forEach(item => {
|
||||
(<any>this.project.validationErrorModel)[item] = (<any>validationErrorModel)[item];
|
||||
});
|
||||
}
|
||||
|
||||
public touchAllFormFields(formControl: AbstractControl) {
|
||||
if (formControl instanceof FormControl) {
|
||||
formControl.markAsTouched();
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
this.touchAllFormFields(control);
|
||||
});
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
this.touchAllFormFields(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
public validateAllFormFields(formControl: AbstractControl) {
|
||||
if (formControl instanceof FormControl) {
|
||||
formControl.updateValueAndValidity({ emitEvent: false });
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
this.validateAllFormFields(control);
|
||||
});
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
this.validateAllFormFields(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/project']);
|
||||
}
|
||||
|
||||
onCallbackError(errorResponse: any) {
|
||||
this.setErrorModel(errorResponse.error.payload);
|
||||
this.validateAllFormFields(this.formGroup);
|
||||
}
|
||||
|
||||
public setErrorModel(validationErrorModel: ValidationErrorModel) {
|
||||
Object.keys(validationErrorModel).forEach(item => {
|
||||
(<any>this.project.validationErrorModel)[item] = (<any>validationErrorModel)[item];
|
||||
});
|
||||
}
|
||||
|
||||
public validateAllFormFields(formControl: AbstractControl) {
|
||||
if (formControl instanceof FormControl) {
|
||||
formControl.updateValueAndValidity({ emitEvent: false });
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
this.validateAllFormFields(control);
|
||||
});
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
this.validateAllFormFields(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
searchProject(query: string) {
|
||||
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||
projectRequestItem.criteria = new ProjectCriteria();
|
||||
projectRequestItem.criteria.like = query;
|
||||
return this.projectService.getWithExternal(projectRequestItem);
|
||||
}
|
||||
|
||||
create() {
|
||||
this.isNew = !this.isNew;
|
||||
if (this.isNew) {
|
||||
this.formGroup.get('existProject').disable();
|
||||
this.formGroup.get('existProject').reset();
|
||||
this.formGroup.get('label').enable();
|
||||
this.formGroup.get('description').enable();
|
||||
} else {
|
||||
this.formGroup.get('existProject').enable();
|
||||
this.formGroup.get('label').disable();
|
||||
this.formGroup.get('label').reset();
|
||||
this.formGroup.get('description').disable();
|
||||
this.formGroup.get('description').reset();
|
||||
}
|
||||
}
|
||||
searchProject(query: string) {
|
||||
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||
projectRequestItem.criteria = new ProjectCriteria();
|
||||
projectRequestItem.criteria.like = query;
|
||||
return this.projectService.getWithExternal(projectRequestItem);
|
||||
}
|
||||
|
||||
create() {
|
||||
this.isNew = !this.isNew;
|
||||
if (this.isNew) {
|
||||
this.formGroup.get('existProject').disable();
|
||||
this.formGroup.get('existProject').reset();
|
||||
this.formGroup.get('label').enable();
|
||||
this.formGroup.get('description').enable();
|
||||
} else {
|
||||
this.formGroup.get('existProject').enable();
|
||||
this.formGroup.get('label').disable();
|
||||
this.formGroup.get('label').reset();
|
||||
this.formGroup.get('description').disable();
|
||||
this.formGroup.get('description').reset();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,14 +47,11 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
|||
this.quickWizard = new QuickWizardEditorWizardModel();
|
||||
this.quickWizard.project = new ProjectEditorWizardModel();
|
||||
this.formGroup = this.quickWizard.buildForm();
|
||||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: 'Dashboard',
|
||||
label: 'DMP Wizard',
|
||||
url: '/quick-wizard'
|
||||
}]
|
||||
);
|
||||
|
||||
this.breadCrumbs = Observable.of([{
|
||||
parentComponentName: 'Dashboard',
|
||||
label: this.language.instant('NAV-BAR.DMP-WIZARD'),
|
||||
url: '/quick-wizard'
|
||||
}]);
|
||||
}
|
||||
|
||||
isActive(step: string): boolean {
|
||||
|
|
|
@ -51,13 +51,25 @@
|
|||
"BREADCRUMB-ROOT": "Dashboard",
|
||||
"TITLE": "OpenDMP",
|
||||
"PROJECTS": "Projects",
|
||||
"PROJECT": "Project",
|
||||
"DMP": "Dmp",
|
||||
"DMPS": "DMPs",
|
||||
"DATASETS": "Datasets",
|
||||
"PUBLIC-DATASETS": "Explore OpenDMP",
|
||||
"USERS": "Users",
|
||||
"DATASETS-ADMIN": "Dataset Profiles",
|
||||
"DMP-PROFILES": "DMP Profiles",
|
||||
"ABOUT": "About"
|
||||
"ABOUT": "About",
|
||||
"DATASET-DESCRIPTIONS": "DATASET DESCRIPTIONS",
|
||||
"DATASET-DESCRIPTION-WIZARD": "Dataset description wizard",
|
||||
"PUBLIC DATASETS": "PUBLIC DATASETS",
|
||||
"PUBLIC DMPS": "PUBLIC DMPS",
|
||||
"HOME": "HOME",
|
||||
"DMP-WIZARD": "DMP Wizard",
|
||||
"DATASET-TEMPLATES": "DATASET TEMPLATES",
|
||||
"TEMPLATE": "TEMPLATE",
|
||||
"DMP-TEMPLATES": "DMP TEMPLATES",
|
||||
"USERS-BREADCRUMB": "USERS"
|
||||
},
|
||||
"SIDE-BAR": {
|
||||
"GENERAL": "GENERAL",
|
||||
|
|
Loading…
Reference in New Issue