dmp associated users

This commit is contained in:
annampak 2018-01-23 15:46:38 +02:00
parent 46479118e7
commit 4bd70ffdfb
4 changed files with 31 additions and 8 deletions

View File

@ -67,7 +67,7 @@
<mat-progress-bar [style.height.px]="2" *ngIf="filteringResearchersAsync" mode="indeterminate"></mat-progress-bar> <mat-progress-bar [style.height.px]="2" *ngIf="filteringResearchersAsync" mode="indeterminate"></mat-progress-bar>
</td-chips> </td-chips>
<mat-list role="list"> <mat-list *ngIf="associatedUsers.length" role="list">
<h3 mat-subheader>Associated Users</h3> <h3 mat-subheader>Associated Users</h3>
<mat-list-item role="listitem" *ngFor="let user of associatedUsers"> <mat-list-item role="listitem" *ngFor="let user of associatedUsers">
<mat-icon mat-list-icon>person</mat-icon> <mat-icon mat-list-icon>person</mat-icon>

View File

@ -19,6 +19,7 @@ import { DatasetProfileModel } from "../../models/datasets/DatasetProfileModel";
import { AutoCompleteConfiguration } from "../../shared/components/autocomplete/AutoCompleteConfiguration"; import { AutoCompleteConfiguration } from "../../shared/components/autocomplete/AutoCompleteConfiguration";
import { ProjectCriteria } from "../../models/criteria/project/ProjectCriteria"; import { ProjectCriteria } from "../../models/criteria/project/ProjectCriteria";
import { ProjectService } from "../../services/project/project.service"; import { ProjectService } from "../../services/project/project.service";
import { DmpUsersModel } from "@app/models/dmpUsers/DmpUsersModel";
@ -45,7 +46,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
projectAutoCompleteConfiguration: AutoCompleteConfiguration; projectAutoCompleteConfiguration: AutoCompleteConfiguration;
createNewVersion; createNewVersion;
associatedUsers = [{name:"Ioannis Kalyvas"}]; associatedUsers: Array<DmpUsersModel>
constructor( constructor(
private dataManagementPlanService: DataManagementPlanService, private dataManagementPlanService: DataManagementPlanService,
@ -74,6 +75,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
.subscribe(data => { .subscribe(data => {
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel); this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
this.formGroup = this.dataManagementPlan.buildForm(); this.formGroup = this.dataManagementPlan.buildForm();
this.associatedUsers = data.associatedUsers;
}); });
} else { } else {
this.dataManagementPlan = new DataManagementPlanModel(); this.dataManagementPlan = new DataManagementPlanModel();

View File

@ -10,6 +10,7 @@ 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"; import { Status } from "../Status";
import { DmpUsersModel } from "@app/models/dmpUsers/DmpUsersModel";
export class DataManagementPlanModel implements Serializable<DataManagementPlanModel> { export class DataManagementPlanModel implements Serializable<DataManagementPlanModel> {
public id: String; public id: String;
@ -22,6 +23,7 @@ export class DataManagementPlanModel implements Serializable<DataManagementPlanM
public organisations: OrganisationModel[] = []; public organisations: OrganisationModel[] = [];
public researchers: ResearcherModel[] = []; public researchers: ResearcherModel[] = [];
public profiles: ProfileModel[] = []; public profiles: ProfileModel[] = [];
public associatedUsers: DmpUsersModel[] = [];
public errorModel: BaseErrorModel = new BaseErrorModel(); public errorModel: BaseErrorModel = new BaseErrorModel();
@ -36,6 +38,7 @@ export class DataManagementPlanModel implements Serializable<DataManagementPlanM
this.organisations = JsonSerializer.fromJSONArray(item.organisations, OrganisationModel); this.organisations = JsonSerializer.fromJSONArray(item.organisations, OrganisationModel);
this.researchers = JsonSerializer.fromJSONArray(item.researchers, ResearcherModel); this.researchers = JsonSerializer.fromJSONArray(item.researchers, ResearcherModel);
this.profiles = JsonSerializer.fromJSONArray(item.profiles, ProfileModel); this.profiles = JsonSerializer.fromJSONArray(item.profiles, ProfileModel);
this.associatedUsers = JsonSerializer.fromJSONArray(item.associatedUsers, DmpUsersModel);
return this; return this;
} }
@ -53,7 +56,8 @@ export class DataManagementPlanModel implements Serializable<DataManagementPlanM
project: [{ value: this.project, disabled: disabled }, context.getValidation('project').validators], project: [{ value: this.project, disabled: disabled }, context.getValidation('project').validators],
organisations: [{ value: this.organisations, disabled: disabled }, context.getValidation('organisations').validators], organisations: [{ value: this.organisations, disabled: disabled }, context.getValidation('organisations').validators],
researchers: [{ value: this.researchers, disabled: disabled }, context.getValidation('researchers').validators], researchers: [{ value: this.researchers, disabled: disabled }, context.getValidation('researchers').validators],
profiles: [{ value: this.profiles, disabled: disabled }, context.getValidation('profiles').validators] profiles: [{ value: this.profiles, disabled: disabled }, context.getValidation('profiles').validators],
associatedUsers: [{ value: this.associatedUsers, disabled: disabled }, context.getValidation('associatedUsers').validators]
}); });
return formGroup; return formGroup;
@ -71,6 +75,7 @@ export class DataManagementPlanModel implements Serializable<DataManagementPlanM
baseContext.validation.push({ key: 'organisations', validators: [BackendErrorValidator(this.errorModel, 'organisations')] }); baseContext.validation.push({ key: 'organisations', validators: [BackendErrorValidator(this.errorModel, 'organisations')] });
baseContext.validation.push({ key: 'researchers', validators: [BackendErrorValidator(this.errorModel, 'researchers')] }); baseContext.validation.push({ key: 'researchers', validators: [BackendErrorValidator(this.errorModel, 'researchers')] });
baseContext.validation.push({ key: 'profiles', validators: [BackendErrorValidator(this.errorModel, 'profiles')] }); baseContext.validation.push({ key: 'profiles', validators: [BackendErrorValidator(this.errorModel, 'profiles')] });
baseContext.validation.push({ key: 'associatedUsers', validators: [BackendErrorValidator(this.errorModel, 'associatedUsers')] });
return baseContext; return baseContext;
} }

View File

@ -0,0 +1,16 @@
import { Serializable } from "../Serializable";
export class DmpUsersModel implements Serializable<DmpUsersModel> {
public id: String;
public email: String;
public name: String;
fromJSONObject(item: any): DmpUsersModel {
this.id = item.id;
this.email = item.label;
this.name = item.abbreviation;
return this;
}
}