From a6e79e3551105516f7b24ad8106c43a50a3d775d Mon Sep 17 00:00:00 2001 From: "CITE\\dtziotzios" Date: Wed, 17 Jan 2018 13:57:41 +0200 Subject: [PATCH] no message --- dmp-frontend/src/app/app-routing.module.ts | 3 +- dmp-frontend/src/app/app.constants.ts | 2 +- .../dataset-wizard.component.html | 88 ++++++++-- .../dataset-wizard.component.scss | 14 +- .../dataset-wizard.component.ts | 153 +++++++++++++++--- .../editor/dataset-editor.component.html | 12 +- .../editor/dataset-editor.component.ts | 90 +++++------ .../src/app/dmps/dmp-listing.component.html | 2 + .../src/app/dmps/dmp-listing.component.ts | 8 + .../dataset-profile/DatasetProfileCriteria.ts | 6 +- .../datasetprofile/DatasetProfileModel.ts | 2 + .../app/models/datasets/DatasetWizardModel.ts | 18 ++- .../dataset-wizard/dataset-wizard.service.ts | 5 +- .../external-sources.service.ts | 4 + dmp-frontend/src/assets/lang/en.json | 13 +- 15 files changed, 316 insertions(+), 104 deletions(-) diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index 490152415..d318d00bc 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -27,7 +27,8 @@ const appRoutes: Routes = [ { path: 'dmp/:id', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] }, { path: 'dmps/new', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] }, { path: 'datasets', component: DatasetListingComponent, canActivate: [AuthGuard] }, - { path: 'dataset/new', component: DatasetWizardComponent, canActivate: [AuthGuard] }, + //{ path: 'dataset/new', component: DatasetWizardComponent, canActivate: [AuthGuard] }, + { path: 'dataset/new/:dmpId', component: DatasetWizardComponent, canActivate: [AuthGuard] }, { path: 'dataset/:id', component: DatasetWizardComponent, canActivate: [AuthGuard] }, { path: 'datasets/new', component: DatasetWizardComponent, canActivate: [AuthGuard] }, { path: 'invitation/:id', component: InvitationAcceptedComponent}, diff --git a/dmp-frontend/src/app/app.constants.ts b/dmp-frontend/src/app/app.constants.ts index 0392c05a9..2387d782e 100644 --- a/dmp-frontend/src/app/app.constants.ts +++ b/dmp-frontend/src/app/app.constants.ts @@ -1,5 +1,5 @@ export const HostConfiguration = { - Server: 'http://localhost:4200/', + Server: 'http://192.168.32.73:8080/', App: 'http://localhost:4200/' //CASHost: 'https://login-devel.uoa.gr/login', //Service: 'http://elkefinman/login' diff --git a/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.html index 2c8881414..38a27ab5d 100644 --- a/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.html +++ b/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.html @@ -1,33 +1,97 @@ -
+
{{'DATASET-WIZARD.FIRST-STEP.TITLE' | translate}} - - - --> + + + + + {{profile.label}} + + + {{baseErrorModel['Criteria.status']}} + + +
{{'DATASET-WIZARD.SECOND-STEP.TITLE' | translate}} - -
+ + +
{{chip.name.substring(0, 1).toUpperCase()}}
+ {{chip.name}} +
+ +
+ {{option.name}} +
+
+ +
+ + + +
{{chip.label.substring(0, 1).toUpperCase()}}
+ {{chip.name}} +
+ +
+ {{option.name}} +
+
+ +
+ + + +
{{chip.label.substring(0, 1).toUpperCase()}}
+ {{chip.name}} +
+ +
+ {{option.name}} +
+
+ +
+ + + +
{{chip.label.substring(0, 1).toUpperCase()}}
+ {{chip.name}} +
+ +
+ {{option.name}} +
+
+ +
+ + {{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}} - -
+ + diff --git a/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.scss b/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.scss index 5913cd17c..90db00ca7 100644 --- a/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.scss +++ b/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.scss @@ -10,15 +10,23 @@ background: rgba(0, 0, 0, 0.32); } -.data-management-plan-editor { - .mat-form-field-full-width{ +.dataset-wizard { + .full-width { + width: 100%; + } mat-form-field { width: 100%; padding: 3px; } - } + td-chips { + margin-top: 20px; + } + .navigation-buttons-container { + margin-top: 20px; + } + .mat-card { margin: 16px 0; } diff --git a/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.ts index f4df96e26..6f980c25d 100644 --- a/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.ts @@ -17,21 +17,37 @@ import { Observable } from "rxjs/Observable"; import { RequestItem } from "../models/criteria/RequestItem"; import { MatPaginator, MatSort, MatSnackBar } from "@angular/material"; import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component"; +import { ExternalSourcesItemModel } from '@app/models/external-sources/ExternalSourcesItemModel'; +import { ExternalSourcesService } from '@app/services/external-sources/external-sources.service'; +import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileModel'; @Component({ selector: 'app-dataset-wizard-component', templateUrl: 'dataset-wizard.component.html', styleUrls: ['./dataset-wizard.component.scss'], - providers: [DatasetWizardService], + providers: [DatasetWizardService, ExternalSourcesService, DataManagementPlanService], encapsulation: ViewEncapsulation.None }) export class DatasetWizardComponent implements AfterViewInit { - dmpAutoCompleteConfiguration: AutoCompleteConfiguration; - datasetProfileAutoCompleteConfiguration: AutoCompleteConfiguration; + //dmpAutoCompleteConfiguration: AutoCompleteConfiguration; + //datasetProfileAutoCompleteConfiguration: AutoCompleteConfiguration; datasetWizardModel: DatasetWizardModel; isNew = true; formGroup: FormGroup; + + availableProfiles: DatasetProfileModel[] = []; + + filtereddataRepositoriesAsync: boolean = false; + filteredRegistriesAsync: boolean = false; + filteredServicesAsync: boolean = false; + filteredExternalDatasetsAsync: boolean = false; + + filtereddataRepositories: ExternalSourcesItemModel[]; + filteredRegistries: ExternalSourcesItemModel[]; + filteredServices: ExternalSourcesItemModel[]; + filteredExternalDatasets: ExternalSourcesItemModel[]; + constructor( private datasetWizardService: DatasetWizardService, private formBuilder: FormBuilder, @@ -40,6 +56,8 @@ export class DatasetWizardComponent implements AfterViewInit { public snackBar: MatSnackBar, public router: Router, public language: TranslateService, + public externalSourcesService: ExternalSourcesService, + public dataManagementPlanService: DataManagementPlanService ) { } @@ -51,40 +69,65 @@ export class DatasetWizardComponent implements AfterViewInit { ngOnInit() { let dmpRequestItem: RequestItem = new RequestItem(); dmpRequestItem.criteria = new DataManagementPlanCriteria(); - this.dmpAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.userDmps.bind(this.datasetWizardService), dmpRequestItem); + //this.dmpAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.userDmps.bind(this.datasetWizardService), dmpRequestItem); + - let datasetProfileRequestItem: RequestItem = new RequestItem(); - datasetProfileRequestItem.criteria = new DatasetProfileCriteria(); this.route.params.subscribe((params: Params) => { const itemId = params['id']; + const dmpId = params['dmpId']; if (itemId != null) { this.isNew = false; this.datasetWizardService.getSingle(itemId).map(data => data as DatasetWizardModel) .subscribe(data => { this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel); this.formGroup = this.datasetWizardModel.buildForm(); - this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem); - this.formGroup.get("dmp").valueChanges.subscribe(change => { - this.formGroup.get('profile').setValue(null, { emitEvent: false }); - this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id + //this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem); + // this.formGroup.get("dmp").valueChanges.subscribe(change => { + // this.formGroup.get('profile').setValue(null, { emitEvent: false }); + // //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id + // }); + }); + } else if (dmpId != null) { + this.isNew = true; + this.dataManagementPlanService.getSingle(dmpId).map(data => data as DataManagementPlanModel) + .subscribe(data => { + this.datasetWizardModel = new DatasetWizardModel(); + setTimeout(() => { + this.formGroup = this.datasetWizardModel.buildForm(); + this.datasetWizardModel.dmp = data; + this.loadDatasetProfiles(); + //this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem); + // this.formGroup.get("dmp").valueChanges.subscribe(change => { + // this.formGroup.get('profile').setValue(null, { emitEvent: false }); + // //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id + // }); }); + + // this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel); + // this.formGroup = this.datasetWizardModel.buildForm(); + //this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem); + // this.formGroup.get("dmp").valueChanges.subscribe(change => { + // this.formGroup.get('profile').setValue(null, { emitEvent: false }); + + // //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id + // }); }); } else { - this.datasetWizardModel = new DatasetWizardModel(); - setTimeout(() => { - this.formGroup = this.datasetWizardModel.buildForm(); - this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem); - this.formGroup.get("dmp").valueChanges.subscribe(change => { - this.formGroup.get('profile').setValue(null, { emitEvent: false }); - this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id - }); - }); + } }); } + loadDatasetProfiles() { + let datasetProfileRequestItem: RequestItem = new RequestItem(); + datasetProfileRequestItem.criteria = new DatasetProfileCriteria(); + datasetProfileRequestItem.criteria.id = this.datasetWizardModel.dmp.id; + this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem).subscribe(items => { + this.availableProfiles = items; + }); + } ngAfterViewInit() { // this.route.params.subscribe((params: Params) => { // const itemId = params['id']; @@ -154,4 +197,76 @@ export class DatasetWizardComponent implements AfterViewInit { }) } + filterdataRepositories(value: string): void { + + this.filtereddataRepositories = undefined; + if (value) { + this.filtereddataRepositoriesAsync = true; + + this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => { + this.filtereddataRepositories = items; + this.filtereddataRepositoriesAsync = false; + + // this.filteredOrganisations = items.filter((filteredObj: any) => { + // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; + // }); + + }); + } + } + + filterRegistries(value: string): void { + + this.filteredRegistries = undefined; + if (value) { + this.filteredRegistriesAsync = true; + + this.externalSourcesService.searchDMPResearchers(value).subscribe(items => { + this.filteredRegistries = items; + this.filteredRegistriesAsync = false; + + // this.filteredOrganisations = items.filter((filteredObj: any) => { + // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; + // }); + + }); + } + } + + filterServices(value: string): void { + + this.filteredServices = undefined; + if (value) { + this.filteredServicesAsync = true; + + this.externalSourcesService.searchDatasetService(value).subscribe(items => { + this.filteredServices = items; + this.filteredServicesAsync = false; + + // this.filteredOrganisations = items.filter((filteredObj: any) => { + // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; + // }); + + }); + } + } + + + filterExternalDatasets(value: string): void { + + this.filteredExternalDatasets = undefined; + if (value) { + this.filteredExternalDatasetsAsync = true; + + this.externalSourcesService.searchDatasetSExternalDatasetservice(value).subscribe(items => { + this.filteredExternalDatasets = items; + this.filteredExternalDatasetsAsync = false; + + // this.filteredOrganisations = items.filter((filteredObj: any) => { + // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; + // }); + + }); + } + } } \ No newline at end of file diff --git a/dmp-frontend/src/app/datasets/editor/dataset-editor.component.html b/dmp-frontend/src/app/datasets/editor/dataset-editor.component.html index c5015ea9e..12e14b714 100644 --- a/dmp-frontend/src/app/datasets/editor/dataset-editor.component.html +++ b/dmp-frontend/src/app/datasets/editor/dataset-editor.component.html @@ -1,9 +1,9 @@
- + {{'GENERAL.VALIDATION.REQUIRED' | translate}} -
{{chip.name.substring(0, 1).toUpperCase()}}
@@ -90,10 +90,10 @@
- + --> - - +
\ No newline at end of file diff --git a/dmp-frontend/src/app/datasets/editor/dataset-editor.component.ts b/dmp-frontend/src/app/datasets/editor/dataset-editor.component.ts index ef3b7ad29..4e369f0fa 100644 --- a/dmp-frontend/src/app/datasets/editor/dataset-editor.component.ts +++ b/dmp-frontend/src/app/datasets/editor/dataset-editor.component.ts @@ -28,13 +28,13 @@ export class DatasetEditorComponent implements AfterViewInit { dataset: DatasetModel; @Input() formGroup: FormGroup = null; - filtereddataRepositoriesAsync: boolean = false; - filteredRegistriesAsync: boolean = false; - filteredServicesAsync: boolean = false; + // filtereddataRepositoriesAsync: boolean = false; + // filteredRegistriesAsync: boolean = false; + // filteredServicesAsync: boolean = false; - filtereddataRepositories: ExternalSourcesItemModel[]; - filteredRegistries: ExternalSourcesItemModel[]; - filteredServices: ExternalSourcesItemModel[]; + // filtereddataRepositories: ExternalSourcesItemModel[]; + // filteredRegistries: ExternalSourcesItemModel[]; + // filteredServices: ExternalSourcesItemModel[]; constructor( private datasetService: DatasetService, @@ -72,57 +72,57 @@ export class DatasetEditorComponent implements AfterViewInit { this.router.navigate(['/datasets']); } - filterdataRepositories(value: string): void { + // filterdataRepositories(value: string): void { - this.filtereddataRepositories = undefined; - if (value) { - this.filtereddataRepositoriesAsync = true; + // this.filtereddataRepositories = undefined; + // if (value) { + // this.filtereddataRepositoriesAsync = true; - this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => { - this.filtereddataRepositories = items; - this.filtereddataRepositoriesAsync = false; + // this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => { + // this.filtereddataRepositories = items; + // this.filtereddataRepositoriesAsync = false; - // this.filteredOrganisations = items.filter((filteredObj: any) => { - // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; - // }); + // // this.filteredOrganisations = items.filter((filteredObj: any) => { + // // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; + // // }); - }); - } - } + // }); + // } + // } - filterRegistries(value: string): void { + // filterRegistries(value: string): void { - this.filteredRegistries = undefined; - if (value) { - this.filteredRegistriesAsync = true; + // this.filteredRegistries = undefined; + // if (value) { + // this.filteredRegistriesAsync = true; - this.externalSourcesService.searchDMPResearchers(value).subscribe(items => { - this.filteredRegistries = items; - this.filteredRegistriesAsync = false; + // this.externalSourcesService.searchDMPResearchers(value).subscribe(items => { + // this.filteredRegistries = items; + // this.filteredRegistriesAsync = false; - // this.filteredOrganisations = items.filter((filteredObj: any) => { - // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; - // }); + // // this.filteredOrganisations = items.filter((filteredObj: any) => { + // // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; + // // }); - }); - } - } + // }); + // } + // } - filterServices(value: string): void { + // filterServices(value: string): void { - this.filteredServices = undefined; - if (value) { - this.filteredServicesAsync = true; + // this.filteredServices = undefined; + // if (value) { + // this.filteredServicesAsync = true; - this.externalSourcesService.searchDatasetService(value).subscribe(items => { - this.filteredServices = items; - this.filteredServicesAsync = false; + // this.externalSourcesService.searchDatasetService(value).subscribe(items => { + // this.filteredServices = items; + // this.filteredServicesAsync = false; - // this.filteredOrganisations = items.filter((filteredObj: any) => { - // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; - // }); + // // this.filteredOrganisations = items.filter((filteredObj: any) => { + // // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; + // // }); - }); - } - } + // }); + // } + // } } \ No newline at end of file diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.html b/dmp-frontend/src/app/dmps/dmp-listing.component.html index 85d7f6129..a912f8660 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.html +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.html @@ -51,6 +51,8 @@ + +