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

View File

@ -19,6 +19,7 @@ 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";
import { DmpUsersModel } from "@app/models/dmpUsers/DmpUsersModel";
@ -45,7 +46,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
projectAutoCompleteConfiguration: AutoCompleteConfiguration;
createNewVersion;
associatedUsers = [{name:"Ioannis Kalyvas"}];
associatedUsers: Array<DmpUsersModel>
constructor(
private dataManagementPlanService: DataManagementPlanService,
@ -74,6 +75,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
.subscribe(data => {
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
this.formGroup = this.dataManagementPlan.buildForm();
this.associatedUsers = data.associatedUsers;
});
} else {
this.dataManagementPlan = new DataManagementPlanModel();

View File

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