no message

This commit is contained in:
Ioannis Kalyvas 2018-07-24 15:53:34 +03:00
parent 32eff9b523
commit 46db0d4184
5 changed files with 2423 additions and 2505 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,5 @@
<div class="project-editor">
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
<!-- <mat-card>
<mat-card-title *ngIf="isNew">{{'DATASET-EDITOR.TITLE.NEW' | translate}}</mat-card-title>
<mat-card-title *ngIf="!isNew">{{'DATASET-EDITOR.TITLE.EDIT' | translate}} {{dataset.label}}</mat-card-title>
<mat-card-content> -->
<mat-form-field class="full-width">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label"
@ -18,30 +14,6 @@
<mat-error *ngIf="formGroup.get('uri').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- <table class="input-table full-width">
<tr>
<td>
<mat-form-field>
<input matInput (focus)="startDate.open()" (click)="startDate.open()" placeholder="{{'DMP-EDITOR.FIELDS.START' | translate}}"
class="table-input" [matDatepicker]="startDate" formControlName="startDate" required>
<mat-datepicker-toggle matSuffix [for]="startDate"></mat-datepicker-toggle>
<mat-datepicker #startDate></mat-datepicker>
<mat-error *ngIf="formGroup.get('startDate').errors?.backendError">{{baseErrorModel.startDate}}</mat-error>
<mat-error *ngIf="formGroup.get('startDate').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</td>
<td>
<mat-form-field>
<input matInput (focus)="endDate.open()" (click)="endDate.open()" placeholder="{{'DMP-EDITOR.FIELDS.END' | translate}}"
class="table-input" [matDatepicker]="endDate" formControlName="endDate" required>
<mat-datepicker-toggle matSuffix [for]="endDate"></mat-datepicker-toggle>
<mat-datepicker #endDate></mat-datepicker>
<mat-error *ngIf="formGroup.get('endDate').errors?.backendError">{{baseErrorModel.endDate}}</mat-error>
<mat-error *ngIf="formGroup.get('endDate').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</td>
</tr>
</table> -->
<mat-form-field class="full-width">
<textarea matInput class="description-area" placeholder="{{'DATASET-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"></textarea>
@ -49,50 +21,7 @@
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- <td-chips color="accent" [items]="filtereddataRepositories" formControlName="dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}"
(inputChange)="filterdataRepositories($event)" requireMatch>
<ng-template td-chip let-chip="chip">
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.name.substring(0, 1).toUpperCase()}}</div>
{{chip.name}}
</ng-template>
<ng-template td-autocomplete-option let-option="option">
<div layout="row" layout-align="start center">
{{option.name}}
</div>
</ng-template>
<mat-progress-bar [style.height.px]="2" *ngIf="filtereddataRepositoriesAsync" mode="indeterminate"></mat-progress-bar>
</td-chips>
<td-chips color="accent" [items]="filteredRegistries" formControlName="registries" placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}"
(inputChange)="filterRegistries($event)" requireMatch>
<ng-template td-chip let-chip="chip">
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.label.substring(0, 1).toUpperCase()}}</div>
{{chip.name}}
</ng-template>
<ng-template td-autocomplete-option let-option="option">
<div layout="row" layout-align="start center">
{{option.name}}
</div>
</ng-template>
<mat-progress-bar [style.height.px]="2" *ngIf="filteredRegistriesAsync" mode="indeterminate"></mat-progress-bar>
</td-chips>
<td-chips color="accent" [items]="filteredServices" formControlName="services" placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}"
(inputChange)="filterServices($event)" requireMatch>
<ng-template td-chip let-chip="chip">
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.label.substring(0, 1).toUpperCase()}}</div>
{{chip.name}}
</ng-template>
<ng-template td-autocomplete-option let-option="option">
<div layout="row" layout-align="start center">
{{option.name}}
</div>
</ng-template>
<mat-progress-bar [style.height.px]="2" *ngIf="filteringResearchersAsync" mode="indeterminate"></mat-progress-bar>
</td-chips> -->
<!-- </mat-card-content>
</mat-card> -->
</form>
<!-- <div *ngIf="formGroup"> {{ formGroup.value | json }}</div> -->
</div>

View File

@ -101,17 +101,17 @@
<input matInput placeholder="Version" disabled [value]="formGroup.get('version').value== undefined ?0 :formGroup.get('version').value">
</mat-form-field>
<mat-list *ngIf="associatedUsers?.length" role="list" class="col-md-12">
<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>
<div class="col-md-12">
<mat-list *ngIf="associatedUsers?.length" role="list" class="col-md-12">
<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>
</div>
<div class="col-md-12 float-right">
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}</button>
<!-- <button *ngIf="!isNew" mat-raised-button color="primary" (click)="invite()" type="button">{{'DMP-EDITOR.ACTIONS.INVITE' | translate}}</button> -->
<button mat-raised-button color="primary" type="submit">{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}</button>

View File

@ -17,52 +17,48 @@
</mat-form-field>
<app-single-auto-complete [reactiveFormControl]="formGroup.get('project')" placeholder="{{this.languageResolverService.getBy('dmpEditor') | translate}}"
[configuration]="projectAutoCompleteConfiguration">
</app-single-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">
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.label.substring(0, 1).toUpperCase()}}</div>
{{chip.label}}
</ng-template>
<ng-template td-autocomplete-option let-option="option">
<div layout="row" layout-align="start center">
{{option.label}}
</div>
</ng-template>
<mat-progress-bar [style.height.px]="2" *ngIf="filteredProfilesAsync" mode="indeterminate"></mat-progress-bar>
<mat-error style="font-size:10.5px" *ngIf="formGroup.get('profiles').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</td-chips>
<td-chips color="accent" [items]="filteredOrganisations" formControlName="organisations" placeholder="{{'DMP-EDITOR.FIELDS.ORGANISATIONS' | translate}}"
(inputChange)="filterOrganisations($event)" requireMatch>
<ng-template td-chip let-chip="chip">
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.name.substring(0, 1).toUpperCase()}}</div>
{{chip.name}}
</ng-template>
<ng-template td-autocomplete-option let-option="option">
<div layout="row" layout-align="start center">
{{option.name}}
<div class="col-md-6">
<app-single-auto-complete [reactiveFormControl]="formGroup.get('project')" placeholder="{{this.languageResolverService.getBy('dmpEditor') | translate}}"
[configuration]="projectAutoCompleteConfiguration">
</app-single-auto-complete>
</div>
<!-- <app-dynamic-fields-project [formGroup]="formGroup"></app-dynamic-fields-project> -->
<div class="col-md-6">
<div class="row">
<app-multiple-auto-complete class="col-md-10" [reactiveFormControl]="formGroup.get('profiles')" placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}"
[configuration]="profilesAutoCompleteConfiguration">
</app-multiple-auto-complete>
<div class="col-md-2">
<button mat-icon-button type="button" (click)="availableProfiles()">
<mat-icon>view_list</mat-icon>
</button>
</div>
</ng-template>
<mat-progress-bar [style.height.px]="2" *ngIf="filteringOrganisationsAsync" mode="indeterminate"></mat-progress-bar>
</td-chips>
</div>
</div>
<!-- <button mat-button (click)="availableProfiles()">View All</button> -->
<td-chips style="margin-bottom:25px;" color="accent" [items]="filteredResearchers" formControlName="researchers" placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}"
(inputChange)="filterResearchers($event)" requireMatch>
<ng-template td-chip let-chip="chip">
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.name.substring(0, 1).toUpperCase()}}</div>
{{chip.name}}
</ng-template>
<ng-template td-autocomplete-option let-option="option">
<div layout="row" layout-align="start center">
{{option.name}}
<div class="col-md-6">
<app-multiple-auto-complete [reactiveFormControl]="formGroup.get('organisations')" placeholder="{{'DMP-EDITOR.FIELDS.ORGANISATIONS' | translate}}"
[configuration]="organisationsAutoCompleteConfiguration">
</app-multiple-auto-complete>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-10">
<app-multiple-auto-complete [reactiveFormControl]="formGroup.get('researchers')" placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}"
[configuration]="researchersAutoCompleteConfiguration">
</app-multiple-auto-complete>
</div>
</ng-template>
<mat-progress-bar [style.height.px]="2" *ngIf="filteringResearchersAsync" mode="indeterminate"></mat-progress-bar>
</td-chips>
<div class="col-md-2">
<button mat-icon-button type="button" (click)="addResearcher()">
<mat-icon>add_circle</mat-icon>
</button>
</div>
</div>
</div>
<mat-form-field class="full-width">
<input matInput placeholder="Version" formControlName="version">

View File

@ -21,6 +21,7 @@ import { FormGroup } from '@angular/forms';
import { BaseCriteria } from '../../../models/criteria/BaseCriteria';
import { SingleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/single/single-auto-complete-configuration';
import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service';
import { MultipleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/multiple/multiple-auto-complete-configuration';
@Component({
@ -43,6 +44,9 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
filteredProfiles: DatasetProfileModel[];
projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
profilesAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
createNewVersion;
associatedUsers: Array<DmpUsersModel>
labelDisabled: boolean = false;
@ -61,7 +65,7 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
}
ngAfterViewInit() {
ngOnInit() {
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
@ -74,6 +78,31 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
loadDataOnStart: true
};
this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["label"],
titleFn: (item) => item["label"],
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
loadDataOnStart: true
};
this.organisationsAutoCompleteConfiguration = {
filterFn: this.filterOrganisations.bind(this),
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["name"],
titleFn: (item) => item["name"],
loadDataOnStart: true
};
this.researchersAutoCompleteConfiguration = {
filterFn: this.filterResearchers.bind(this),
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["name"],
titleFn: (item) => item["name"],
loadDataOnStart: true
};
let organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
organisationRequestItem.criteria = new BaseCriteria();
@ -132,68 +161,32 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
this.router.navigate(['/dmps']);
}
filterOrganisations(value: string): void {
filterOrganisations(value: string): Observable<ExternalSourcesItemModel[]> {
this.filteredOrganisations = undefined;
if (value) {
this.filteringOrganisationsAsync = true;
this.filteringOrganisationsAsync = true;
this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => {
this.filteredOrganisations = items;
this.filteringOrganisationsAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// });
});
}
return this.externalSourcesService.searchDMPOrganizations(value)
}
filterResearchers(value: string): void {
filterResearchers(value: string): Observable<ExternalSourcesItemModel[]> {
this.filteredResearchers = undefined;
if (value) {
this.filteringResearchersAsync = true;
this.filteringResearchersAsync = true;
this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } }).subscribe(items => {
this.filteredResearchers = items;
this.filteringResearchersAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// });
});
}
return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } })
}
filterProfiles(value: string): void {
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
this.filteredProfiles = undefined;
if (value) {
this.filteredProfilesAsync = true;
this.filteredProfilesAsync = true;
// this.externalSourcesService.searchDMPProfiles(value).subscribe(items => {
// this.filteredProfiles = items;
// this.filteredProfilesAsync = false;
// // this.filteredOrganisations = items.filter((filteredObj: any) => {
// // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// // });
// });
const request = new RequestItem<DatasetProfileCriteria>();
let criteria = new DatasetProfileCriteria();
criteria.like = value;
request.criteria = criteria;
this._service.searchDMPProfiles(request).subscribe(items => {
this.filteredProfiles = items;
this.filteredProfilesAsync = false;
});
}
const request = new RequestItem<DatasetProfileCriteria>();
let criteria = new DatasetProfileCriteria();
criteria.like = value;
request.criteria = criteria;
return this._service.searchDMPProfiles(request)
}
}