Adds missing breadcrumbs.

This commit is contained in:
gkolokythas 2019-05-23 12:40:24 +03:00
parent 4f727e5f2e
commit fadaa9bbcb
18 changed files with 405 additions and 327 deletions

View File

@ -17,6 +17,8 @@ import { DatasetProfileEditorModel } from './dataset-profile-editor-model';
import { ConfirmationDialogComponent } from '../../../../library/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '../../../../library/confirmation-dialog/confirmation-dialog.component';
import { DatasetProfileEnum } from '../../../../core/common/enum/dataset-profile'; import { DatasetProfileEnum } from '../../../../core/common/enum/dataset-profile';
import * as FileSaver from 'file-saver'; 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'; //import * as data from 'src/assets/resources/skipDisable.json';
const skipDisable: any[] = require('../../../../../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; private datasetProfileId: string;
newVersionId: string; newVersionId: string;
dataWizardModel: DatasetWizardModel; dataWizardModel: DatasetWizardModel;
breadCrumbs: Observable<BreadcrumbItem[]>;
@ViewChild('stepper') stepper: MatHorizontalStepper; @ViewChild('stepper') stepper: MatHorizontalStepper;
viewOnly = false; viewOnly = false;
@ -82,6 +85,11 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
}, },
error => this.onCallbackError(error) 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) { } else if (cloneId != null) {
this.datasetProfileService.clone(cloneId) this.datasetProfileService.clone(cloneId)
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed)) .pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))

View File

@ -15,6 +15,7 @@ import { DatasetProfileCriteriaComponent } from './criteria/dataset-profile.comp
import { error } from 'selenium-webdriver'; import { error } from 'selenium-webdriver';
import { UiNotificationService, SnackBarNotificationLevel } from '../../../../core/services/notification/ui-notification-service'; import { UiNotificationService, SnackBarNotificationLevel } from '../../../../core/services/notification/ui-notification-service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
@Component({ @Component({
selector: 'app-dataset-profile-listing-component', selector: 'app-dataset-profile-listing-component',
@ -27,6 +28,7 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
@ViewChild(DatasetProfileCriteriaComponent) criteria: DatasetProfileCriteriaComponent; @ViewChild(DatasetProfileCriteriaComponent) criteria: DatasetProfileCriteriaComponent;
breadCrumbs: Observable<BreadcrumbItem[]>;
dataSource: DatasetDataSource | null; dataSource: DatasetDataSource | null;
displayedColumns: String[] = ['label', 'description', 'created', 'actions']; displayedColumns: String[] = ['label', 'description', 'created', 'actions'];
pageEvent: PageEvent; pageEvent: PageEvent;
@ -55,16 +57,24 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
this.criteria.setCriteria(this.getDefaultCriteria()); this.criteria.setCriteria(this.getDefaultCriteria());
this.refresh(); this.refresh();
this.criteria.setRefreshCallback(() => 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 { } else {
this.itemId = params['groupId']; this.itemId = params['groupId'];
if (this.itemId) { if (this.itemId) {
const datasetProfileLabel = this.route.snapshot.queryParams.groupLabel; const datasetProfileLabel = this.route.snapshot.queryParams.groupLabel;
} }
this.criteria.setCriteria(this.getDefaultCriteria()); this.criteria.setCriteria(this.getDefaultCriteria());
this.refresh(); this.refresh();
this.criteria.setRefreshCallback(() => 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 => { .subscribe(data => {
this.titlePrefix = data.label; this.titlePrefix = data.label;
} }
); );
} }
refresh() { refresh() {

View File

@ -15,6 +15,8 @@ import { DmpProfileService } from '../../../../core/services/dmp/dmp-profile.ser
import { SnackBarNotificationLevel, UiNotificationService } from '../../../../core/services/notification/ui-notification-service'; import { SnackBarNotificationLevel, UiNotificationService } from '../../../../core/services/notification/ui-notification-service';
import { EnumUtils } from '../../../../core/services/utilities/enum-utils.service'; import { EnumUtils } from '../../../../core/services/utilities/enum-utils.service';
import { DmpProfileEditorModel, DmpProfileFieldEditorModel } from './dmp-profile-editor.model'; import { DmpProfileEditorModel, DmpProfileFieldEditorModel } from './dmp-profile-editor.model';
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
import { Observable } from 'rxjs';
@Component({ @Component({
selector: 'app-dmp-profile-editor-component', selector: 'app-dmp-profile-editor-component',
@ -29,6 +31,7 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
formGroup: FormGroup = null; formGroup: FormGroup = null;
host = environment.Server; host = environment.Server;
dmpProfileId: string; dmpProfileId: string;
breadCrumbs: Observable<BreadcrumbItem[]>;
constructor( constructor(
private dmpProfileService: DmpProfileService, private dmpProfileService: DmpProfileService,
@ -58,12 +61,22 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
this.formGroup.disable(); this.formGroup.disable();
this.viewOnly = true this.viewOnly = true
} }
this.breadCrumbs = Observable.of([{
parentComponentName: 'DmpProfileListingComponent',
label: this.language.instant('NAV-BAR.TEMPLATE'),
url: '/dmp-profiles/' + this.dmpProfileId
}]);
}); });
} else { } else {
this.dmpProfileModel = new DmpProfileEditorModel(); this.dmpProfileModel = new DmpProfileEditorModel();
setTimeout(() => { setTimeout(() => {
this.formGroup = this.dmpProfileModel.buildForm(); 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) this.dmpProfileService.createDmp(this.formGroup.value)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => this.onCallbackSuccess(), complete => this.onCallbackSuccess(),
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );
} }
@ -185,8 +198,8 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
this.dmpProfileService.createDmp(this.formGroup.value) this.dmpProfileService.createDmp(this.formGroup.value)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => this.onCallbackSuccess(), complete => this.onCallbackSuccess(),
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );
} }

View File

@ -11,6 +11,7 @@ import { DmpProfileCriteria } from '../../../../core/query/dmp/dmp-profile-crite
import { DmpProfileService } from '../../../../core/services/dmp/dmp-profile.service'; import { DmpProfileService } from '../../../../core/services/dmp/dmp-profile.service';
import { DataTableRequest } from '../../../../core/model/data-table/data-table-request'; import { DataTableRequest } from '../../../../core/model/data-table/data-table-request';
import { DmpProfileCriteriaComponent } from './criteria/dmp-profile-criteria.component'; import { DmpProfileCriteriaComponent } from './criteria/dmp-profile-criteria.component';
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
@Component({ @Component({
selector: 'app-dmp-profile-listing-component', selector: 'app-dmp-profile-listing-component',
@ -28,6 +29,7 @@ export class DmpProfileListingComponent extends BaseComponent implements OnInit
pageEvent: PageEvent; pageEvent: PageEvent;
titlePrefix: String; titlePrefix: String;
dmpId: String; dmpId: String;
breadCrumbs: Observable<BreadcrumbItem[]>;
statuses = [ statuses = [
{ value: '0', viewValue: 'Active' }, { value: '0', viewValue: 'Active' },
@ -44,7 +46,6 @@ export class DmpProfileListingComponent extends BaseComponent implements OnInit
super(); super();
} }
ngOnInit() { ngOnInit() {
this.route.params this.route.params
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
@ -53,6 +54,11 @@ export class DmpProfileListingComponent extends BaseComponent implements OnInit
this.criteria.setCriteria(this.getDefaultCriteria()); this.criteria.setCriteria(this.getDefaultCriteria());
this.refresh(); this.refresh();
this.criteria.setRefreshCallback(() => 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; // debugger;
// this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe(); // this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe();
// } // }
} }
export class DatasetDataSource extends DataSource<DmpProfileListing> { export class DatasetDataSource extends DataSource<DmpProfileListing> {
@ -96,7 +101,6 @@ export class DatasetDataSource extends DataSource<DmpProfileListing> {
//this._sort.matSortChange //this._sort.matSortChange
]; ];
return Observable.merge(...displayDataChanges) return Observable.merge(...displayDataChanges)
.startWith(null) .startWith(null)
.switchMap(() => { .switchMap(() => {

View File

@ -9,6 +9,7 @@ import { UserService } from '../../../../core/services/user/user.service';
import { SnackBarNotificationComponent } from '../../../../library/notification/snack-bar/snack-bar-notification.component'; import { SnackBarNotificationComponent } from '../../../../library/notification/snack-bar/snack-bar-notification.component';
import { DataTableRequest } from '../../../../core/model/data-table/data-table-request'; import { DataTableRequest } from '../../../../core/model/data-table/data-table-request';
import { UserCriteriaComponent } from './criteria/user-criteria.component'; import { UserCriteriaComponent } from './criteria/user-criteria.component';
import { BreadcrumbItem } from '../../../misc/breadcrumb/definition/breadcrumb-item';
export class UsersDataSource extends DataSource<UserListingModel> { export class UsersDataSource extends DataSource<UserListingModel> {
@ -93,6 +94,7 @@ export class UserListingComponent implements OnInit, AfterViewInit {
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
@ViewChild(UserCriteriaComponent) criteria: UserCriteriaComponent; @ViewChild(UserCriteriaComponent) criteria: UserCriteriaComponent;
breadCrumbs: Observable<BreadcrumbItem[]>;
dataSource: UsersDataSource | null; dataSource: UsersDataSource | null;
displayedColumns: String[] = ['name', 'email', 'lastloggedin', 'roles']; displayedColumns: String[] = ['name', 'email', 'lastloggedin', 'roles'];
@ -105,6 +107,11 @@ export class UserListingComponent implements OnInit, AfterViewInit {
} }
ngOnInit() { 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 //this.refresh(); //called on ngAfterViewInit with default criteria
} }

View File

@ -47,7 +47,7 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit, IBread
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: 'Dashboard', parentComponentName: 'Dashboard',
label: 'Dataset description wizard', label: this.language.instant('NAV-BAR.DATASET-DESCRIPTION-WIZARD'),
url: '/datasetcreatewizard' url: '/datasetcreatewizard'
}] }]
); );

View File

@ -136,7 +136,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: null, parentComponentName: null,
label: 'Datasets', label: this.language.instant('NAV-BAR.DATASETS'),
url: '/datasets', url: '/datasets',
notFoundResolver: [ notFoundResolver: [
{ {
@ -178,7 +178,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: null, parentComponentName: null,
label: 'Datasets', label: this.language.instant('NAV-BAR.DATASETS'),
url: '/datasets', url: '/datasets',
notFoundResolver: [ notFoundResolver: [
{ {
@ -214,7 +214,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: null, parentComponentName: null,
label: 'Datasets', label: this.language.instant('NAV-BAR.DATASETS'),
url: '/datasets', url: '/datasets',
notFoundResolver: [ notFoundResolver: [
{ {
@ -260,7 +260,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: null, parentComponentName: null,
label: 'Datasets', label: this.language.instant('NAV-BAR.DATASETS'),
url: '/datasets', url: '/datasets',
notFoundResolver: [ notFoundResolver: [
{ {
@ -286,7 +286,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: null, parentComponentName: null,
label: 'Datasets', label: this.language.instant('NAV-BAR.DATASETS'),
url: '/datasets', url: '/datasets',
notFoundResolver: [ notFoundResolver: [
{ {

View File

@ -12,6 +12,7 @@ import { DmpService } from '../../../core/services/dmp/dmp.service';
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item'; import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent'; import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
import { DatasetCriteriaComponent } from './criteria/dataset-criteria.component'; import { DatasetCriteriaComponent } from './criteria/dataset-criteria.component';
import { TranslateService } from '@ngx-translate/core';
@Component({ @Component({
selector: 'app-dataset-listing-component', selector: 'app-dataset-listing-component',
@ -38,6 +39,7 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private dmpService: DmpService, private dmpService: DmpService,
private language: TranslateService,
) { ) {
super(); super();
} }
@ -56,7 +58,11 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
this.criteria.setCriteria(this.getDefaultCriteria(dmp)); this.criteria.setCriteria(this.getDefaultCriteria(dmp));
this.refresh(); this.refresh();
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); 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) { if (params['dmpLabel'] !== undefined) {
this.titlePrefix = 'for ' + params['dmpLabel']; this.titlePrefix = 'for ' + params['dmpLabel'];
} }
@ -64,7 +70,11 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
this.criteria.setCriteria(this.getDefaultCriteria()); this.criteria.setCriteria(this.getDefaultCriteria());
this.refresh(); this.refresh();
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); 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) { if (this.status != null && this.status == 0) {

View File

@ -155,7 +155,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
if (this.isAuthenticated) { if (this.isAuthenticated) {
// if (!this.isAuthenticated) { // if (!this.isAuthenticated) {
const breadCrumbs = []; 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(); 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( breadCrumbs.push(
{ {
@ -196,7 +200,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: 'DmpListingComponent', parentComponentName: 'DmpListingComponent',
label: 'DMPs', label: this.language.instant('NAV-BAR.DMPS'),
url: 'plans', url: 'plans',
notFoundResolver: [await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()] 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([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: 'DmpListingComponent', parentComponentName: 'DmpListingComponent',
label: 'DMPs', label: this.language.instant('NAV-BAR.DMPS'),
url: 'plans', url: 'plans',
} }
]); ]);
@ -280,8 +284,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
this.dmpService.createDmp(this.formGroup.getRawValue()) this.dmpService.createDmp(this.formGroup.getRawValue())
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => this.onCallbackSuccess(), complete => this.onCallbackSuccess(),
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );
} }
@ -373,8 +377,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
this.dmpService.delete(this.dmp.id) this.dmpService.delete(this.dmp.id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => { this.onCallbackSuccess() }, complete => { this.onCallbackSuccess() },
error => this.onDeleteCallbackError(error) error => this.onDeleteCallbackError(error)
); );
} }
}); });

View File

@ -14,6 +14,7 @@ import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent'; import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
import { DmpInvitationDialogComponent } from '../invitation/dmp-invitation.component'; import { DmpInvitationDialogComponent } from '../invitation/dmp-invitation.component';
import { DmpCriteriaComponent } from './criteria/dmp-criteria.component'; import { DmpCriteriaComponent } from './criteria/dmp-criteria.component';
import { TranslateService } from '@ngx-translate/core';
@Component({ @Component({
selector: 'app-dmp-listing-component', selector: 'app-dmp-listing-component',
@ -39,7 +40,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private dialog: MatDialog, private dialog: MatDialog,
public enumUtils: EnumUtils public enumUtils: EnumUtils,
private language: TranslateService,
) { ) {
super(); super();
} }
@ -67,13 +69,18 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
if (this.itemId) { if (this.itemId) {
const dmplabel = this.route.snapshot.queryParams.groupLabel; const dmplabel = this.route.snapshot.queryParams.groupLabel;
breadCrumbs.push( breadCrumbs.push({
{ parentComponentName: null, label: 'DMPs', url: '/plans' }, 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.breadCrumbs = Observable.of(breadCrumbs);
this.criteria.setCriteria(this.getDefaultCriteria()); this.criteria.setCriteria(this.getDefaultCriteria());
this.refresh(); this.refresh();
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));

View File

@ -10,6 +10,7 @@ import { DatasetService } from '../../core/services/dataset/dataset.service';
import { IBreadCrumbComponent } from '../misc/breadcrumb/definition/IBreadCrumbComponent'; import { IBreadCrumbComponent } from '../misc/breadcrumb/definition/IBreadCrumbComponent';
import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item'; import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
@Component({ @Component({
@ -30,6 +31,7 @@ export class ExploreDatasetListingComponent extends BaseComponent implements OnI
constructor( constructor(
private datasetService: DatasetService, private datasetService: DatasetService,
private router: Router, private router: Router,
private language: TranslateService,
) { ) {
super(); super();
} }
@ -38,7 +40,11 @@ export class ExploreDatasetListingComponent extends BaseComponent implements OnI
this.refresh(); this.refresh();
const breadCrumbs = []; 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); this.breadCrumbs = Observable.of(breadCrumbs);
} }

View File

@ -10,6 +10,7 @@ import { DmpService } from "../../core/services/dmp/dmp.service";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { IBreadCrumbComponent } from "../misc/breadcrumb/definition/IBreadCrumbComponent"; import { IBreadCrumbComponent } from "../misc/breadcrumb/definition/IBreadCrumbComponent";
import { BreadcrumbItem } from "../misc/breadcrumb/definition/breadcrumb-item"; import { BreadcrumbItem } from "../misc/breadcrumb/definition/breadcrumb-item";
import { TranslateService } from "@ngx-translate/core";
@Component({ @Component({
selector: 'app-explore-dmp-listing-component', selector: 'app-explore-dmp-listing-component',
@ -29,7 +30,8 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
constructor( constructor(
private dmpService: DmpService, private dmpService: DmpService,
private router: Router private router: Router,
private language: TranslateService,
) { ) {
super(); super();
} }
@ -38,7 +40,11 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
this.refresh(); this.refresh();
const breadCrumbs = []; 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); this.breadCrumbs = Observable.of(breadCrumbs);
} }

View File

@ -6,6 +6,7 @@ import { BreadCrumbResolverService } from './service/breadcrumb.service';
import { DashboardService } from '../../../core/services/dashboard/dashboard.service'; import { DashboardService } from '../../../core/services/dashboard/dashboard.service';
import { assertDataInRangeInternal } from '@angular/core/src/render3/util'; import { assertDataInRangeInternal } from '@angular/core/src/render3/util';
import { url } from 'inspector'; import { url } from 'inspector';
import { TranslateService } from '@ngx-translate/core';
@Component({ @Component({
selector: 'app-breadcrumb', selector: 'app-breadcrumb',
@ -22,19 +23,22 @@ export class BreadcrumbComponent implements OnInit {
constructor( constructor(
public activatedRoute: ActivatedRoute, public activatedRoute: ActivatedRoute,
private router: Router, private router: Router,
private breadCrumbService: BreadCrumbResolverService private breadCrumbService: BreadCrumbResolverService,
private language: TranslateService,
) { ) {
} }
ngOnInit() { ngOnInit() {
} }
buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> { buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> {
if (this.breadCrumbService.resolve(route)) { if (this.breadCrumbService.resolve(route)) {
return this.breadCrumbService.resolve(route).map(x => { 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([]); return Observable.of([]);

View File

@ -60,14 +60,18 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
.subscribe(data => { .subscribe(data => {
this.project = new ProjectEditorModel().fromModel(data); this.project = new ProjectEditorModel().fromModel(data);
this.formGroup = this.project.buildForm(null, this.project.type === ProjectType.External || !this.editMode); this.formGroup = this.project.buildForm(null, this.project.type === ProjectType.External || !this.editMode);
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([{
{ parentComponentName: 'ProjectListingComponent', label: 'Projects', url: '/projects' }, parentComponentName: 'ProjectListingComponent',
]); label: this.language.instant('NAV-BAR.PROJECTS'),
url: '/projects'
}]);
}); });
} else { } else {
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([{
{ parentComponentName: 'ProjectListingComponent', label: 'Projects', url: '/projects' }, parentComponentName: 'ProjectListingComponent',
]); label: this.language.instant('NAV-BAR.PROJECTS'),
url: '/projects'
}]);
this.project = new ProjectEditorModel(); this.project = new ProjectEditorModel();
setTimeout(() => { setTimeout(() => {
this.formGroup = this.project.buildForm(); this.formGroup = this.project.buildForm();
@ -178,8 +182,8 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
this.formGroup.disable(); this.formGroup.disable();
} }
public imgEnable():boolean{ public imgEnable(): boolean {
if(this.isNew || this.editMode){ if (this.isNew || this.editMode) {
return true; return true;
} }
return false; 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. const size: number = event.target.files[0].size; // Get file size.
this.sizeError = size > this.maxFileSize; // Checks if file size is valid. this.sizeError = size > this.maxFileSize; // Checks if file size is valid.
const formdata: FormData = new FormData(); const formdata: FormData = new FormData();
if (!this.sizeError){ if (!this.sizeError) {
if (fileList instanceof FileList) { if (fileList instanceof FileList) {
for (let i = 0; i < fileList.length; i++) { for (let i = 0; i < fileList.length; i++) {
formdata.append('file', fileList[i]); formdata.append('file', fileList[i]);
@ -207,8 +211,8 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
formdata.append('file', fileList); formdata.append('file', fileList);
} }
this.projectFileUploadService.uploadFile(formdata) this.projectFileUploadService.uploadFile(formdata)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(files => this.formGroup.get('files').patchValue(files)); .subscribe(files => this.formGroup.get('files').patchValue(files));
} }
} }
} }

View File

@ -18,148 +18,142 @@ import { DmpEditorWizardModel } from './dmp-editor-wizard-model';
@Component({ @Component({
selector: 'app-quick-wizard-dmp-editor-component', selector: 'app-quick-wizard-dmp-editor-component',
templateUrl: 'dmp-editor-wizard.component.html', templateUrl: 'dmp-editor-wizard.component.html',
styleUrls: ['./dmp-editor-wizard.component.scss'] styleUrls: ['./dmp-editor-wizard.component.scss']
}) })
export class DmpEditorWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent { export class DmpEditorWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]); breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
isNew = true; isNew = true;
dmp: DmpEditorWizardModel; dmp: DmpEditorWizardModel;
@Input() formGroup: FormGroup; @Input() formGroup: FormGroup;
@Input() dmpLabel: string; @Input() dmpLabel: string;
@Input() datasetFormGroup: FormGroup; @Input() datasetFormGroup: FormGroup;
//formGroup: FormGroup = null; //formGroup: FormGroup = null;
private uiNotificationService: UiNotificationService private uiNotificationService: UiNotificationService
profilesAutoCompleteConfiguration: SingleAutoCompleteConfiguration; profilesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
filteredProfiles: DatasetProfileModel[]; filteredProfiles: DatasetProfileModel[];
filteredProfilesAsync = false; filteredProfilesAsync = false;
constructor( constructor(
public snackBar: MatSnackBar, public snackBar: MatSnackBar,
public router: Router, public router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private _service: DmpService, private _service: DmpService,
public language: TranslateService public language: TranslateService
) { ) {
super(); super();
} }
ngOnInit(): void { ngOnInit(): void {
this.profilesAutoCompleteConfiguration = { this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this), filterFn: this.filterProfiles.bind(this),
initialItems: (extraData) => this.filterProfiles(''), initialItems: (extraData) => this.filterProfiles(''),
displayFn: (item) => item['label'], displayFn: (item) => item['label'],
titleFn: (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) { onCallbackSuccess(): void {
this.dmp = new DmpEditorWizardModel(); this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.formGroup = this.dmp.buildForm(); this.router.navigate(['/dmp']);
} }
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([ onCallbackError(errorResponse: any) {
{ this.setErrorModel(errorResponse.error.payload);
parentComponentName: 'project', this.validateAllFormFields(this.formGroup);
label: 'Dmp', }
url: '/quick-wizard/dmp'
}]
);
} public setErrorModel(validationErrorModel: ValidationErrorModel) {
Object.keys(validationErrorModel).forEach(item => {
(<any>this.dmp.validationErrorModel)[item] = (<any>validationErrorModel)[item];
});
}
formSubmit(): void { public validateAllFormFields(formControl: AbstractControl) {
this.touchAllFormFields(this.formGroup); if (formControl instanceof FormControl) {
if (!this.isFormValid()) { return; } formControl.updateValueAndValidity({ emitEvent: false });
this.onSubmit(); } 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() { filterProfiles(value: string): Observable<DatasetProfileModel[]> {
return this.formGroup.valid;
}
public touchAllFormFields(formControl: AbstractControl) { this.filteredProfiles = undefined;
if (formControl instanceof FormControl) { this.filteredProfilesAsync = true;
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;
}
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;
}
} }

View File

@ -17,164 +17,156 @@ import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCru
import { ProjectEditorWizardModel } from './project-editor-wizard-model'; import { ProjectEditorWizardModel } from './project-editor-wizard-model';
@Component({ @Component({
selector: 'app-quick-wizard-project-editor-component', selector: 'app-quick-wizard-project-editor-component',
templateUrl: 'project-editor-wizard.component.html', templateUrl: 'project-editor-wizard.component.html',
styleUrls: ['./project-editor-wizard.component.scss'] styleUrls: ['./project-editor-wizard.component.scss']
}) })
export class ProjectEditorWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent { export class ProjectEditorWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]); breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
isNew = false; isNew = false;
project: ProjectEditorWizardModel; project: ProjectEditorWizardModel;
@Input() formGroup: FormGroup; @Input() formGroup: FormGroup;
//formGroup: FormGroup = null; //formGroup: FormGroup = null;
private uiNotificationService: UiNotificationService private uiNotificationService: UiNotificationService
projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration; projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
constructor( constructor(
public snackBar: MatSnackBar, public snackBar: MatSnackBar,
private route: ActivatedRoute, private route: ActivatedRoute,
public router: Router, public router: Router,
public language: TranslateService, public language: TranslateService,
private projectService: ProjectService, private projectService: ProjectService,
public languageResolverService: LanguageResolverService, public languageResolverService: LanguageResolverService,
) { ) {
super(); super();
} }
ngOnInit() { ngOnInit() {
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([{
{ parentComponentName: 'QuickCreate',
parentComponentName: 'QuickCreate', label: this.language.instant('NAV-BAR.PROJECT'),
label: 'Project', url: '/quick-wizard/project'
url: '/quick-wizard/project' }]);
}]
);
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem(); const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria(); projectRequestItem.criteria = new ProjectCriteria();
this.projectAutoCompleteConfiguration = { this.projectAutoCompleteConfiguration = {
filterFn: this.searchProject.bind(this), filterFn: this.searchProject.bind(this),
initialItems: (extraData) => this.searchProject(''), initialItems: (extraData) => this.searchProject(''),
displayFn: (item) => item['label'], displayFn: (item) => item['label'],
titleFn: (item) => item['label'] titleFn: (item) => item['label']
}; };
if (!this.formGroup) { if (!this.formGroup) {
this.project = new ProjectEditorWizardModel(); this.project = new ProjectEditorWizardModel();
this.formGroup = this.project.buildForm(); this.formGroup = this.project.buildForm();
} }
this.formGroup.get('existProject').enable(); this.formGroup.get('existProject').enable();
this.formGroup.get('label').disable(); this.formGroup.get('label').disable();
this.formGroup.get('description').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 public touchAllFormFields(formControl: AbstractControl) {
// .pipe(takeUntil(this._destroyed)) if (formControl instanceof FormControl) {
// .subscribe((params: Params) => { formControl.markAsTouched();
// const itemId = params['id']; } 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) { onCallbackSuccess(): void {
// this.isNew = false; this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
// this.projectService.getSingle(itemId).map(data => data as ProjectListingModel) this.router.navigate(['/project']);
// .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();
// });
// }
// });
}
onCallbackError(errorResponse: any) {
this.setErrorModel(errorResponse.error.payload);
this.validateAllFormFields(this.formGroup);
}
public isFormValid() { public setErrorModel(validationErrorModel: ValidationErrorModel) {
return this.formGroup.valid; Object.keys(validationErrorModel).forEach(item => {
} (<any>this.project.validationErrorModel)[item] = (<any>validationErrorModel)[item];
});
}
public touchAllFormFields(formControl: AbstractControl) { public validateAllFormFields(formControl: AbstractControl) {
if (formControl instanceof FormControl) { if (formControl instanceof FormControl) {
formControl.markAsTouched(); formControl.updateValueAndValidity({ emitEvent: false });
} else if (formControl instanceof FormGroup) { } else if (formControl instanceof FormGroup) {
Object.keys(formControl.controls).forEach(item => { Object.keys(formControl.controls).forEach(item => {
const control = formControl.get(item); const control = formControl.get(item);
this.touchAllFormFields(control); this.validateAllFormFields(control);
}); });
} else if (formControl instanceof FormArray) { } else if (formControl instanceof FormArray) {
formControl.controls.forEach(item => { formControl.controls.forEach(item => {
this.touchAllFormFields(item); this.validateAllFormFields(item);
}); });
} }
} }
onCallbackSuccess(): void { searchProject(query: string) {
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
this.router.navigate(['/project']); projectRequestItem.criteria = new ProjectCriteria();
} projectRequestItem.criteria.like = query;
return this.projectService.getWithExternal(projectRequestItem);
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();
}
}
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();
}
}
} }

View File

@ -47,14 +47,11 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
this.quickWizard = new QuickWizardEditorWizardModel(); this.quickWizard = new QuickWizardEditorWizardModel();
this.quickWizard.project = new ProjectEditorWizardModel(); this.quickWizard.project = new ProjectEditorWizardModel();
this.formGroup = this.quickWizard.buildForm(); this.formGroup = this.quickWizard.buildForm();
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([{
{ parentComponentName: 'Dashboard',
parentComponentName: 'Dashboard', label: this.language.instant('NAV-BAR.DMP-WIZARD'),
label: 'DMP Wizard', url: '/quick-wizard'
url: '/quick-wizard' }]);
}]
);
} }
isActive(step: string): boolean { isActive(step: string): boolean {

View File

@ -51,13 +51,25 @@
"BREADCRUMB-ROOT": "Dashboard", "BREADCRUMB-ROOT": "Dashboard",
"TITLE": "OpenDMP", "TITLE": "OpenDMP",
"PROJECTS": "Projects", "PROJECTS": "Projects",
"PROJECT": "Project",
"DMP": "Dmp",
"DMPS": "DMPs", "DMPS": "DMPs",
"DATASETS": "Datasets", "DATASETS": "Datasets",
"PUBLIC-DATASETS": "Explore OpenDMP", "PUBLIC-DATASETS": "Explore OpenDMP",
"USERS": "Users", "USERS": "Users",
"DATASETS-ADMIN": "Dataset Profiles", "DATASETS-ADMIN": "Dataset Profiles",
"DMP-PROFILES": "DMP 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": { "SIDE-BAR": {
"GENERAL": "GENERAL", "GENERAL": "GENERAL",