no message
This commit is contained in:
parent
2af51a18d2
commit
5b28cc8032
|
@ -18,6 +18,13 @@
|
|||
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<auto-complete class="full-width" placeholder="{{'DMP-EDITOR.FIELDS.PROJECT' | translate}}"
|
||||
[configuration]="projectAutoCompleteConfiguration"
|
||||
titleKey="label"
|
||||
[control]="formGroup.get('project')"
|
||||
[required]="true">
|
||||
</auto-complete>
|
||||
|
||||
<td-chips color="accent" [items]="filteredProfiles" formControlName="profiles" placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}"
|
||||
(inputChange)="filterProfiles($event)" requireMatch>
|
||||
<ng-template td-chip let-chip="chip">
|
||||
|
|
|
@ -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<ProjectCriteria> = 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;
|
||||
|
|
|
@ -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<DataManagementPlanModel> {
|
||||
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<DataManagementPlanM
|
|||
baseContext.validation.push({ key: 'id', validators: [ BackendErrorValidator(this.errorModel, 'id')] });
|
||||
baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'label')] });
|
||||
baseContext.validation.push({ key: 'previous', validators: [BackendErrorValidator(this.errorModel, 'previous')] });
|
||||
baseContext.validation.push({ key: 'version', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'version')] });
|
||||
baseContext.validation.push({ key: 'version', validators: [BackendErrorValidator(this.errorModel, 'version')] });
|
||||
baseContext.validation.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'status')] });
|
||||
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'description')] });
|
||||
baseContext.validation.push({ key: 'project', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'project')] });
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
},
|
||||
"FIELDS": {
|
||||
"NAME": "Name",
|
||||
"PROJECT": "Project",
|
||||
"DESCRIPTION": "Description",
|
||||
"ORGANISATIONS": "Organisations",
|
||||
"RESEARCHERS": "Researchers",
|
||||
|
|
Loading…
Reference in New Issue