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-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</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}}"
|
<td-chips color="accent" [items]="filteredProfiles" formControlName="profiles" placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}"
|
||||||
(inputChange)="filterProfiles($event)" requireMatch>
|
(inputChange)="filterProfiles($event)" requireMatch>
|
||||||
<ng-template td-chip let-chip="chip">
|
<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 { DatasetProfileCriteria } from "../../models/criteria/dataset/DatasetProfileCriteria";
|
||||||
import { DataManagementPlanCriteriaComponent } from "../../shared/components/criteria/data-management-plan/dmp-criteria.component";
|
import { DataManagementPlanCriteriaComponent } from "../../shared/components/criteria/data-management-plan/dmp-criteria.component";
|
||||||
import { DatasetProfileModel } from "../../models/datasets/DatasetProfileModel";
|
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',
|
selector: 'app-dmp-editor-component',
|
||||||
templateUrl: 'dmp-editor.component.html',
|
templateUrl: 'dmp-editor.component.html',
|
||||||
styleUrls: ['./dmp-editor.component.scss'],
|
styleUrls: ['./dmp-editor.component.scss'],
|
||||||
providers: [DataManagementPlanService, ExternalSourcesService],
|
providers: [DataManagementPlanService, ExternalSourcesService, ProjectService],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class DataManagementPlanEditorComponent implements AfterViewInit {
|
export class DataManagementPlanEditorComponent implements AfterViewInit {
|
||||||
|
@ -40,8 +43,11 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
|
||||||
filteredResearchers: ExternalSourcesItemModel[];
|
filteredResearchers: ExternalSourcesItemModel[];
|
||||||
filteredProfiles: DatasetProfileModel[];
|
filteredProfiles: DatasetProfileModel[];
|
||||||
|
|
||||||
|
projectAutoCompleteConfiguration: AutoCompleteConfiguration;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dataManagementPlanService: DataManagementPlanService,
|
private dataManagementPlanService: DataManagementPlanService,
|
||||||
|
private projectService: ProjectService,
|
||||||
private externalSourcesService: ExternalSourcesService,
|
private externalSourcesService: ExternalSourcesService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
public snackBar: MatSnackBar,
|
public snackBar: MatSnackBar,
|
||||||
|
@ -56,6 +62,10 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
|
||||||
this.route.params.subscribe((params: Params) => {
|
this.route.params.subscribe((params: Params) => {
|
||||||
const itemId = params['id'];
|
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) {
|
if (itemId != null) {
|
||||||
this.isNew = false;
|
this.isNew = false;
|
||||||
this.dataManagementPlanService.getSingle(itemId).map(data => data as DataManagementPlanModel)
|
this.dataManagementPlanService.getSingle(itemId).map(data => data as DataManagementPlanModel)
|
||||||
|
|
|
@ -9,13 +9,14 @@ import { OrganisationModel } from "../organisation/OrganisationModel";
|
||||||
import { ResearcherModel } from "../researcher/ResearcherModel";
|
import { ResearcherModel } from "../researcher/ResearcherModel";
|
||||||
import { JsonSerializer } from "../../utilities/JsonSerializer";
|
import { JsonSerializer } from "../../utilities/JsonSerializer";
|
||||||
import { ProfileModel } from "../profile/ProfileModel";
|
import { ProfileModel } from "../profile/ProfileModel";
|
||||||
|
import { Status } from "../Status";
|
||||||
|
|
||||||
export class DataManagementPlanModel implements Serializable<DataManagementPlanModel> {
|
export class DataManagementPlanModel implements Serializable<DataManagementPlanModel> {
|
||||||
public id: String;
|
public id: String;
|
||||||
public label: String;
|
public label: String;
|
||||||
public previous: String;
|
public previous: String;
|
||||||
public version: number;
|
public version: number;
|
||||||
public status: String;
|
public status: Status = Status.Active;
|
||||||
public description: String;
|
public description: String;
|
||||||
public project: ProjectModel;
|
public project: ProjectModel;
|
||||||
public organisations: OrganisationModel[] = [];
|
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: 'id', validators: [ BackendErrorValidator(this.errorModel, 'id')] });
|
||||||
baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'label')] });
|
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: '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: 'status', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'status')] });
|
||||||
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'description')] });
|
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'description')] });
|
||||||
baseContext.validation.push({ key: 'project', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'project')] });
|
baseContext.validation.push({ key: 'project', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'project')] });
|
||||||
|
|
|
@ -87,6 +87,7 @@
|
||||||
},
|
},
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
"NAME": "Name",
|
"NAME": "Name",
|
||||||
|
"PROJECT": "Project",
|
||||||
"DESCRIPTION": "Description",
|
"DESCRIPTION": "Description",
|
||||||
"ORGANISATIONS": "Organisations",
|
"ORGANISATIONS": "Organisations",
|
||||||
"RESEARCHERS": "Researchers",
|
"RESEARCHERS": "Researchers",
|
||||||
|
|
Loading…
Reference in New Issue