From 5b28cc8032060d023981dc3bfe1125571cc6fac2 Mon Sep 17 00:00:00 2001 From: Diamadis Tziotzios Date: Thu, 21 Dec 2017 11:39:17 +0200 Subject: [PATCH] no message --- .../app/dmps/editor/dmp-editor.component.html | 7 +++++ .../app/dmps/editor/dmp-editor.component.ts | 26 +++++++++++++------ .../DataManagementPlanModel.ts | 5 ++-- dmp-frontend/src/assets/lang/en.json | 1 + 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html index b178ece07..d204ac625 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html @@ -18,6 +18,13 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts index 1a7d8af2b..9a77e19ab 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts @@ -16,6 +16,9 @@ import { RequestItem } from "../../models/criteria/RequestItem"; import { DatasetProfileCriteria } from "../../models/criteria/dataset/DatasetProfileCriteria"; import { DataManagementPlanCriteriaComponent } from "../../shared/components/criteria/data-management-plan/dmp-criteria.component"; import { DatasetProfileModel } from "../../models/datasets/DatasetProfileModel"; +import { AutoCompleteConfiguration } from "../../shared/components/autocomplete/AutoCompleteConfiguration"; +import { ProjectCriteria } from "../../models/criteria/project/ProjectCriteria"; +import { ProjectService } from "../../services/project/project.service"; @@ -23,7 +26,7 @@ import { DatasetProfileModel } from "../../models/datasets/DatasetProfileModel"; selector: 'app-dmp-editor-component', templateUrl: 'dmp-editor.component.html', styleUrls: ['./dmp-editor.component.scss'], - providers: [DataManagementPlanService, ExternalSourcesService], + providers: [DataManagementPlanService, ExternalSourcesService, ProjectService], encapsulation: ViewEncapsulation.None }) export class DataManagementPlanEditorComponent implements AfterViewInit { @@ -40,8 +43,11 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { filteredResearchers: ExternalSourcesItemModel[]; filteredProfiles: DatasetProfileModel[]; + projectAutoCompleteConfiguration: AutoCompleteConfiguration; + constructor( private dataManagementPlanService: DataManagementPlanService, + private projectService: ProjectService, private externalSourcesService: ExternalSourcesService, private route: ActivatedRoute, public snackBar: MatSnackBar, @@ -56,6 +62,10 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { this.route.params.subscribe((params: Params) => { const itemId = params['id']; + let projectRequestItem: RequestItem = new RequestItem(); + projectRequestItem.criteria = new ProjectCriteria(); + this.projectAutoCompleteConfiguration = new AutoCompleteConfiguration(this.projectService.get.bind(this.projectService), projectRequestItem); + if (itemId != null) { this.isNew = false; this.dataManagementPlanService.getSingle(itemId).map(data => data as DataManagementPlanModel) @@ -114,11 +124,11 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { } filterOrganisations(value: string): void { - + this.filteredOrganisations = undefined; if (value) { this.filteringOrganisationsAsync = true; - + this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => { this.filteredOrganisations = items; this.filteringOrganisationsAsync = false; @@ -128,16 +138,16 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { // }); }); - + } } filterResearchers(value: string): void { - + this.filteredResearchers = undefined; if (value) { this.filteringResearchersAsync = true; - + this.externalSourcesService.searchDMPResearchers(value).subscribe(items => { this.filteredResearchers = items; this.filteringResearchersAsync = false; @@ -151,11 +161,11 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { } filterProfiles(value: string): void { - + this.filteredProfiles = undefined; if (value) { this.filteredProfilesAsync = true; - + // this.externalSourcesService.searchDMPProfiles(value).subscribe(items => { // this.filteredProfiles = items; // this.filteredProfilesAsync = false; diff --git a/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts index b52463f67..795ed42a0 100644 --- a/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts +++ b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts @@ -9,13 +9,14 @@ import { OrganisationModel } from "../organisation/OrganisationModel"; import { ResearcherModel } from "../researcher/ResearcherModel"; import { JsonSerializer } from "../../utilities/JsonSerializer"; import { ProfileModel } from "../profile/ProfileModel"; +import { Status } from "../Status"; export class DataManagementPlanModel implements Serializable { public id: String; public label: String; public previous: String; public version: number; - public status: String; + public status: Status = Status.Active; public description: String; public project: ProjectModel; public organisations: OrganisationModel[] = []; @@ -63,7 +64,7 @@ export class DataManagementPlanModel implements Serializable