no message

This commit is contained in:
Diamantis Tziotzios 2018-01-17 13:57:41 +02:00
parent eab18999ec
commit a6e79e3551
15 changed files with 316 additions and 104 deletions

View File

@ -27,7 +27,8 @@ const appRoutes: Routes = [
{ path: 'dmp/:id', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] }, { path: 'dmp/:id', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] },
{ path: 'dmps/new', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] }, { path: 'dmps/new', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] },
{ path: 'datasets', component: DatasetListingComponent, canActivate: [AuthGuard] }, { path: 'datasets', component: DatasetListingComponent, canActivate: [AuthGuard] },
{ path: 'dataset/new', component: DatasetWizardComponent, canActivate: [AuthGuard] }, //{ path: 'dataset/new', component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: 'dataset/new/:dmpId', component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: 'dataset/:id', component: DatasetWizardComponent, canActivate: [AuthGuard] }, { path: 'dataset/:id', component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: 'datasets/new', component: DatasetWizardComponent, canActivate: [AuthGuard] }, { path: 'datasets/new', component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: 'invitation/:id', component: InvitationAcceptedComponent}, { path: 'invitation/:id', component: InvitationAcceptedComponent},

View File

@ -1,5 +1,5 @@
export const HostConfiguration = { export const HostConfiguration = {
Server: 'http://localhost:4200/', Server: 'http://192.168.32.73:8080/',
App: 'http://localhost:4200/' App: 'http://localhost:4200/'
//CASHost: 'https://login-devel.uoa.gr/login', //CASHost: 'https://login-devel.uoa.gr/login',
//Service: 'http://elkefinman/login' //Service: 'http://elkefinman/login'

View File

@ -1,33 +1,97 @@
<div class="data-management-plan-editor"> <div class="dataset-wizard">
<mat-horizontal-stepper [linear]="isLinear"> <mat-horizontal-stepper [linear]="isLinear">
<mat-step [stepControl]="formGroup"> <mat-step [stepControl]="formGroup">
<form *ngIf="formGroup" [formGroup]="formGroup"> <form *ngIf="formGroup" [formGroup]="formGroup">
<ng-template matStepLabel>{{'DATASET-WIZARD.FIRST-STEP.TITLE' | translate}}</ng-template> <ng-template matStepLabel>{{'DATASET-WIZARD.FIRST-STEP.TITLE' | translate}}</ng-template>
<auto-complete class="mat-form-field-full-width" placeholder="{{'DATASET-WIZARD.FIRST-STEP.DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration" <!-- <auto-complete class="mat-form-field-full-width" placeholder="{{'DATASET-WIZARD.FIRST-STEP.DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration"
titleKey="label" [control]="formGroup.get('dmp')" [required]="true"> titleKey="label" [control]="formGroup.get('dmp')" [required]="true">
</auto-complete> </auto-complete> -->
<auto-complete class="mat-form-field-full-width" placeholder="{{'DATASET-WIZARD.FIRST-STEP.PROFILE' | translate}}" [configuration]="datasetProfileAutoCompleteConfiguration" <!-- <auto-complete class="mat-form-field-full-width" placeholder="{{'DATASET-WIZARD.FIRST-STEP.PROFILE' | translate}}" [configuration]="datasetProfileAutoCompleteConfiguration"
titleKey="label" [control]="formGroup.get('profile')" [required]="true" [disabled]="!formGroup.get('dmp').value"> titleKey="label" [control]="formGroup.get('profile')" [required]="true" [disabled]="!formGroup.get('dmp').value">
</auto-complete> </auto-complete> -->
<div> <mat-form-field>
<button matStepperNext mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' | translate}}</button> <mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" formControlName="profile">
<mat-option *ngFor="let profile of availableProfiles" [value]="profile">
{{profile.label}}
</mat-option>
</mat-select>
<mat-error *ngIf="baseErrorModel?.status">{{baseErrorModel['Criteria.status']}}</mat-error>
</mat-form-field>
<app-dataset-editor-component [formGroup]="formGroup"></app-dataset-editor-component>
<div class="navigation-buttons-container">
<button matStepperNext mat-raised-button style="float:right;" color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' | translate}}</button>
</div> </div>
</form> </form>
</mat-step> </mat-step>
<mat-step [stepControl]="formGroup"> <mat-step [stepControl]="formGroup">
<form *ngIf="formGroup" [formGroup]="formGroup"> <form *ngIf="formGroup" [formGroup]="formGroup">
<ng-template matStepLabel>{{'DATASET-WIZARD.SECOND-STEP.TITLE' | translate}}</ng-template> <ng-template matStepLabel>{{'DATASET-WIZARD.SECOND-STEP.TITLE' | translate}}</ng-template>
<app-dataset-editor-component [formGroup]="formGroup"></app-dataset-editor-component> <td-chips color="accent" [items]="filtereddataRepositories" formControlName="dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}"
<div> (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="filteringServicesAsync" mode="indeterminate"></mat-progress-bar>
</td-chips>
<td-chips color="accent" [items]="filteredExternalDatasets" formControlName="externalDatasets" placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}"
(inputChange)="filterExternalDatasets($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="filteringExternalDatasetsAsync" mode="indeterminate"></mat-progress-bar>
</td-chips>
<div class="navigation-buttons-container">
<button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button> <button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button>
<button matStepperNext mat-raised-button color="primary" (click)="formSubmit()">{{'DATASET-WIZARD.ACTIONS.NEXT' | translate}}</button> <button matStepperNext mat-raised-button color="primary" style="float:right;" (click)="formSubmit()">{{'DATASET-WIZARD.ACTIONS.NEXT' | translate}}</button>
</div> </div>
</form> </form>
</mat-step> </mat-step>
<mat-step> <mat-step>
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template> <ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
<dynamic-form class="mat-form-field-full-width" *ngIf="datasetWizardModel && datasetWizardModel.id" [dataModel]="datasetWizardModel"></dynamic-form> <dynamic-form class="full-width" *ngIf="datasetWizardModel && datasetWizardModel.id" [dataModel]="datasetWizardModel"></dynamic-form>
<div> <div class="navigation-buttons-container">
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button> <button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button>
</div> </div>
</mat-step> </mat-step>

View File

@ -10,14 +10,22 @@
background: rgba(0, 0, 0, 0.32); background: rgba(0, 0, 0, 0.32);
} }
.data-management-plan-editor { .dataset-wizard {
.mat-form-field-full-width{ .full-width {
width: 100%;
}
mat-form-field { mat-form-field {
width: 100%; width: 100%;
padding: 3px; padding: 3px;
} }
}
td-chips {
margin-top: 20px;
}
.navigation-buttons-container {
margin-top: 20px;
}
.mat-card { .mat-card {
margin: 16px 0; margin: 16px 0;

View File

@ -17,21 +17,37 @@ import { Observable } from "rxjs/Observable";
import { RequestItem } from "../models/criteria/RequestItem"; import { RequestItem } from "../models/criteria/RequestItem";
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material"; import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component"; import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
import { ExternalSourcesItemModel } from '@app/models/external-sources/ExternalSourcesItemModel';
import { ExternalSourcesService } from '@app/services/external-sources/external-sources.service';
import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileModel';
@Component({ @Component({
selector: 'app-dataset-wizard-component', selector: 'app-dataset-wizard-component',
templateUrl: 'dataset-wizard.component.html', templateUrl: 'dataset-wizard.component.html',
styleUrls: ['./dataset-wizard.component.scss'], styleUrls: ['./dataset-wizard.component.scss'],
providers: [DatasetWizardService], providers: [DatasetWizardService, ExternalSourcesService, DataManagementPlanService],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class DatasetWizardComponent implements AfterViewInit { export class DatasetWizardComponent implements AfterViewInit {
dmpAutoCompleteConfiguration: AutoCompleteConfiguration; //dmpAutoCompleteConfiguration: AutoCompleteConfiguration;
datasetProfileAutoCompleteConfiguration: AutoCompleteConfiguration; //datasetProfileAutoCompleteConfiguration: AutoCompleteConfiguration;
datasetWizardModel: DatasetWizardModel; datasetWizardModel: DatasetWizardModel;
isNew = true; isNew = true;
formGroup: FormGroup; formGroup: FormGroup;
availableProfiles: DatasetProfileModel[] = [];
filtereddataRepositoriesAsync: boolean = false;
filteredRegistriesAsync: boolean = false;
filteredServicesAsync: boolean = false;
filteredExternalDatasetsAsync: boolean = false;
filtereddataRepositories: ExternalSourcesItemModel[];
filteredRegistries: ExternalSourcesItemModel[];
filteredServices: ExternalSourcesItemModel[];
filteredExternalDatasets: ExternalSourcesItemModel[];
constructor( constructor(
private datasetWizardService: DatasetWizardService, private datasetWizardService: DatasetWizardService,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
@ -40,6 +56,8 @@ export class DatasetWizardComponent implements AfterViewInit {
public snackBar: MatSnackBar, public snackBar: MatSnackBar,
public router: Router, public router: Router,
public language: TranslateService, public language: TranslateService,
public externalSourcesService: ExternalSourcesService,
public dataManagementPlanService: DataManagementPlanService
) { ) {
} }
@ -51,40 +69,65 @@ export class DatasetWizardComponent implements AfterViewInit {
ngOnInit() { ngOnInit() {
let dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem(); let dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem();
dmpRequestItem.criteria = new DataManagementPlanCriteria(); dmpRequestItem.criteria = new DataManagementPlanCriteria();
this.dmpAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.userDmps.bind(this.datasetWizardService), dmpRequestItem); //this.dmpAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.userDmps.bind(this.datasetWizardService), dmpRequestItem);
let datasetProfileRequestItem: RequestItem<DatasetProfileCriteria> = new RequestItem();
datasetProfileRequestItem.criteria = new DatasetProfileCriteria();
this.route.params.subscribe((params: Params) => { this.route.params.subscribe((params: Params) => {
const itemId = params['id']; const itemId = params['id'];
const dmpId = params['dmpId'];
if (itemId != null) { if (itemId != null) {
this.isNew = false; this.isNew = false;
this.datasetWizardService.getSingle(itemId).map(data => data as DatasetWizardModel) this.datasetWizardService.getSingle(itemId).map(data => data as DatasetWizardModel)
.subscribe(data => { .subscribe(data => {
this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel); this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel);
this.formGroup = this.datasetWizardModel.buildForm(); this.formGroup = this.datasetWizardModel.buildForm();
this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem); //this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem);
this.formGroup.get("dmp").valueChanges.subscribe(change => { // this.formGroup.get("dmp").valueChanges.subscribe(change => {
this.formGroup.get('profile').setValue(null, { emitEvent: false }); // this.formGroup.get('profile').setValue(null, { emitEvent: false });
this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id // //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id
// });
});
} else if (dmpId != null) {
this.isNew = true;
this.dataManagementPlanService.getSingle(dmpId).map(data => data as DataManagementPlanModel)
.subscribe(data => {
this.datasetWizardModel = new DatasetWizardModel();
setTimeout(() => {
this.formGroup = this.datasetWizardModel.buildForm();
this.datasetWizardModel.dmp = data;
this.loadDatasetProfiles();
//this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem);
// this.formGroup.get("dmp").valueChanges.subscribe(change => {
// this.formGroup.get('profile').setValue(null, { emitEvent: false });
// //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id
// });
}); });
// this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel);
// this.formGroup = this.datasetWizardModel.buildForm();
//this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem);
// this.formGroup.get("dmp").valueChanges.subscribe(change => {
// this.formGroup.get('profile').setValue(null, { emitEvent: false });
// //this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id
// });
}); });
} else { } else {
this.datasetWizardModel = new DatasetWizardModel();
setTimeout(() => {
this.formGroup = this.datasetWizardModel.buildForm();
this.datasetProfileAutoCompleteConfiguration = new AutoCompleteConfiguration(this.datasetWizardService.getAvailableProfiles.bind(this.datasetWizardService), datasetProfileRequestItem);
this.formGroup.get("dmp").valueChanges.subscribe(change => {
this.formGroup.get('profile').setValue(null, { emitEvent: false });
this.datasetProfileAutoCompleteConfiguration.requestItem.criteria.id = change.id
});
});
} }
}); });
} }
loadDatasetProfiles() {
let datasetProfileRequestItem: RequestItem<DatasetProfileCriteria> = new RequestItem();
datasetProfileRequestItem.criteria = new DatasetProfileCriteria();
datasetProfileRequestItem.criteria.id = this.datasetWizardModel.dmp.id;
this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem).subscribe(items => {
this.availableProfiles = items;
});
}
ngAfterViewInit() { ngAfterViewInit() {
// this.route.params.subscribe((params: Params) => { // this.route.params.subscribe((params: Params) => {
// const itemId = params['id']; // const itemId = params['id'];
@ -154,4 +197,76 @@ export class DatasetWizardComponent implements AfterViewInit {
}) })
} }
filterdataRepositories(value: string): void {
this.filtereddataRepositories = undefined;
if (value) {
this.filtereddataRepositoriesAsync = true;
this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => {
this.filtereddataRepositories = items;
this.filtereddataRepositoriesAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// });
});
}
}
filterRegistries(value: string): void {
this.filteredRegistries = undefined;
if (value) {
this.filteredRegistriesAsync = true;
this.externalSourcesService.searchDMPResearchers(value).subscribe(items => {
this.filteredRegistries = items;
this.filteredRegistriesAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// });
});
}
}
filterServices(value: string): void {
this.filteredServices = undefined;
if (value) {
this.filteredServicesAsync = true;
this.externalSourcesService.searchDatasetService(value).subscribe(items => {
this.filteredServices = items;
this.filteredServicesAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// });
});
}
}
filterExternalDatasets(value: string): void {
this.filteredExternalDatasets = undefined;
if (value) {
this.filteredExternalDatasetsAsync = true;
this.externalSourcesService.searchDatasetSExternalDatasetservice(value).subscribe(items => {
this.filteredExternalDatasets = items;
this.filteredExternalDatasetsAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// });
});
}
}
} }

View File

@ -1,9 +1,9 @@
<div class="project-editor"> <div class="project-editor">
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup"> <form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
<mat-card> <!-- <mat-card>
<mat-card-title *ngIf="isNew">{{'DATASET-EDITOR.TITLE.NEW' | translate}}</mat-card-title> <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-title *ngIf="!isNew">{{'DATASET-EDITOR.TITLE.EDIT' | translate}} {{dataset.label}}</mat-card-title>
<mat-card-content> <mat-card-content> -->
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" <input matInput placeholder="{{'DATASET-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label"
@ -50,7 +50,7 @@
<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>
<td-chips color="accent" [items]="filtereddataRepositories" formControlName="dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}" <!-- <td-chips color="accent" [items]="filtereddataRepositories" formControlName="dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}"
(inputChange)="filterdataRepositories($event)" requireMatch> (inputChange)="filterdataRepositories($event)" requireMatch>
<ng-template td-chip let-chip="chip"> <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> <div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.name.substring(0, 1).toUpperCase()}}</div>
@ -90,10 +90,10 @@
</div> </div>
</ng-template> </ng-template>
<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-card-content> <!-- </mat-card-content>
</mat-card> </mat-card> -->
</form> </form>
<!-- <div *ngIf="formGroup"> {{ formGroup.value | json }}</div> --> <!-- <div *ngIf="formGroup"> {{ formGroup.value | json }}</div> -->
</div> </div>

View File

@ -28,13 +28,13 @@ export class DatasetEditorComponent implements AfterViewInit {
dataset: DatasetModel; dataset: DatasetModel;
@Input() formGroup: FormGroup = null; @Input() formGroup: FormGroup = null;
filtereddataRepositoriesAsync: boolean = false; // filtereddataRepositoriesAsync: boolean = false;
filteredRegistriesAsync: boolean = false; // filteredRegistriesAsync: boolean = false;
filteredServicesAsync: boolean = false; // filteredServicesAsync: boolean = false;
filtereddataRepositories: ExternalSourcesItemModel[]; // filtereddataRepositories: ExternalSourcesItemModel[];
filteredRegistries: ExternalSourcesItemModel[]; // filteredRegistries: ExternalSourcesItemModel[];
filteredServices: ExternalSourcesItemModel[]; // filteredServices: ExternalSourcesItemModel[];
constructor( constructor(
private datasetService: DatasetService, private datasetService: DatasetService,
@ -72,57 +72,57 @@ export class DatasetEditorComponent implements AfterViewInit {
this.router.navigate(['/datasets']); this.router.navigate(['/datasets']);
} }
filterdataRepositories(value: string): void { // filterdataRepositories(value: string): void {
this.filtereddataRepositories = undefined; // this.filtereddataRepositories = undefined;
if (value) { // if (value) {
this.filtereddataRepositoriesAsync = true; // this.filtereddataRepositoriesAsync = true;
this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => { // this.externalSourcesService.searchDMPOrganizations(value).subscribe(items => {
this.filtereddataRepositories = items; // this.filtereddataRepositories = items;
this.filtereddataRepositoriesAsync = false; // this.filtereddataRepositoriesAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => { // // this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; // // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// }); // // });
}); // });
} // }
} // }
filterRegistries(value: string): void { // filterRegistries(value: string): void {
this.filteredRegistries = undefined; // this.filteredRegistries = undefined;
if (value) { // if (value) {
this.filteredRegistriesAsync = true; // this.filteredRegistriesAsync = true;
this.externalSourcesService.searchDMPResearchers(value).subscribe(items => { // this.externalSourcesService.searchDMPResearchers(value).subscribe(items => {
this.filteredRegistries = items; // this.filteredRegistries = items;
this.filteredRegistriesAsync = false; // this.filteredRegistriesAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => { // // this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; // // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// }); // // });
}); // });
} // }
} // }
filterServices(value: string): void { // filterServices(value: string): void {
this.filteredServices = undefined; // this.filteredServices = undefined;
if (value) { // if (value) {
this.filteredServicesAsync = true; // this.filteredServicesAsync = true;
this.externalSourcesService.searchDatasetService(value).subscribe(items => { // this.externalSourcesService.searchDatasetService(value).subscribe(items => {
this.filteredServices = items; // this.filteredServices = items;
this.filteredServicesAsync = false; // this.filteredServicesAsync = false;
// this.filteredOrganisations = items.filter((filteredObj: any) => { // // this.filteredOrganisations = items.filter((filteredObj: any) => {
// return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; // // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true;
// }); // // });
}); // });
} // }
} // }
} }

View File

@ -51,6 +51,8 @@
<mat-menu #actionsMenu="matMenu"> <mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="rowClick(row.id)"><mat-icon>mode_edit</mat-icon>{{'DMP-LISTING.ACTIONS.EDIT' | translate}}</button> <button mat-menu-item (click)="rowClick(row.id)"><mat-icon>mode_edit</mat-icon>{{'DMP-LISTING.ACTIONS.EDIT' | translate}}</button>
<button mat-menu-item (click)="openShareDialog(row.id,row.label)"><mat-icon>insert_invitation</mat-icon>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}</button> <button mat-menu-item (click)="openShareDialog(row.id,row.label)"><mat-icon>insert_invitation</mat-icon>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}</button>
<button mat-menu-item (click)="addDataset(row.id)"><mat-icon>insert_invitation</mat-icon>{{'DMP-LISTING.ACTIONS.ADD-DATASET' | translate}}</button>
<button mat-menu-item (click)="showDatasets(row.id)"><mat-icon>insert_invitation</mat-icon>{{'DMP-LISTING.ACTIONS.DATASETS' | translate}}</button>
</mat-menu> </mat-menu>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>

View File

@ -53,6 +53,14 @@ export class DataManagementPlanListingComponent implements OnInit {
this.router.navigate(['/dmp/' + rowId]); this.router.navigate(['/dmp/' + rowId]);
} }
addDataset(rowId: String) {
this.router.navigate(['/dataset/new/' + rowId]);
}
showDatasets(rowId: String) {
this.router.navigate(['/dataset/new/' + rowId]);
}
getDefaultCriteria(): DataManagementPlanCriteria { getDefaultCriteria(): DataManagementPlanCriteria {
const defaultCriteria = new DataManagementPlanCriteria(); const defaultCriteria = new DataManagementPlanCriteria();
return defaultCriteria; return defaultCriteria;

View File

@ -1,4 +1,4 @@
import { BaseCriteria } from '../BaseCriteria'; import { BaseCriteria } from '../BaseCriteria';
export class DatasetProfileCriteria extends BaseCriteria{ export class DatasetProfileCriteria extends BaseCriteria {
public id:string; public id: String;
} }

View File

@ -6,10 +6,12 @@ import { Serializable } from "../Serializable";
export class DatasetProfileModel implements Serializable<DatasetProfileModel> { export class DatasetProfileModel implements Serializable<DatasetProfileModel> {
public id: String; public id: String;
public label: String;
public errorModel: BaseErrorModel = new BaseErrorModel(); public errorModel: BaseErrorModel = new BaseErrorModel();
fromJSONObject(item: any): DatasetProfileModel { fromJSONObject(item: any): DatasetProfileModel {
this.id = item.id; this.id = item.id;
this.label = item.label;
return this; return this;
} }

View File

@ -11,6 +11,7 @@ import { ServiceModel } from "../services/ServiceModel";
import { JsonSerializer } from "../../utilities/JsonSerializer"; import { JsonSerializer } from "../../utilities/JsonSerializer";
import { RegisterModel } from "../registers/RegisterModel"; import { RegisterModel } from "../registers/RegisterModel";
import { DataRepositoryModel } from "../dataRepositories/DataRepositoryModel"; import { DataRepositoryModel } from "../dataRepositories/DataRepositoryModel";
import { ExternalDatasetModel } from '@app/models/external-dataset/ExternalDatasetModel';
export class DatasetWizardModel implements Serializable<DatasetWizardModel> { export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
public id: String; public id: String;
@ -22,7 +23,8 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
public services: ServiceModel[] = []; public services: ServiceModel[] = [];
public registries: RegisterModel[] = []; public registries: RegisterModel[] = [];
public dataRepositories: DataRepositoryModel[] = []; public dataRepositories: DataRepositoryModel[] = [];
public dmp:DataManagementPlanModel = new DataManagementPlanModel(); public externalDatasets: ExternalDatasetModel[] = [];
public dmp: DataManagementPlanModel = new DataManagementPlanModel();
public datasetProfileDefinition = new DatasetProfileDefinitionModel(); public datasetProfileDefinition = new DatasetProfileDefinitionModel();
public errorModel: BaseErrorModel = new BaseErrorModel(); public errorModel: BaseErrorModel = new BaseErrorModel();
@ -36,7 +38,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
this.services = JsonSerializer.fromJSONArray(item.services, ServiceModel); this.services = JsonSerializer.fromJSONArray(item.services, ServiceModel);
this.registries = JsonSerializer.fromJSONArray(item.registries, RegisterModel); this.registries = JsonSerializer.fromJSONArray(item.registries, RegisterModel);
this.dataRepositories = JsonSerializer.fromJSONArray(item.dataRepositories, DataRepositoryModel); this.dataRepositories = JsonSerializer.fromJSONArray(item.dataRepositories, DataRepositoryModel);
this.dmp = JsonSerializer.fromJSONObject(item.dmp, DataManagementPlanModel); this.dmp = JsonSerializer.fromJSONObject(item.dmp, DataManagementPlanModel);
this.profile = JsonSerializer.fromJSONObject(item.profile, DatasetWizardModel); this.profile = JsonSerializer.fromJSONObject(item.profile, DatasetWizardModel);
this.datasetProfileDefinition = JsonSerializer.fromJSONObject(item.datasetProfileDefinition, DatasetProfileDefinitionModel); this.datasetProfileDefinition = JsonSerializer.fromJSONObject(item.datasetProfileDefinition, DatasetProfileDefinitionModel);
return this; return this;
@ -53,6 +55,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators], services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators],
registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators], registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators],
dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators], dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators],
externalDatasets: [{ value: this.externalDatasets, disabled: disabled }, context.getValidation('externalDatasets').validators],
dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators], dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators],
profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators], profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators],
@ -65,11 +68,12 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
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: 'profile', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'profile')] }); baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'profile')] });
baseContext.validation.push({ key: 'uri', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'uri')] }); baseContext.validation.push({ key: 'uri', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'uri')] });
baseContext.validation.push({ key: 'status', validators: [ BackendErrorValidator(this.errorModel, 'status')] }); baseContext.validation.push({ key: 'status', validators: [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: 'services', validators: [ BackendErrorValidator(this.errorModel, 'services')] }); baseContext.validation.push({ key: 'services', validators: [BackendErrorValidator(this.errorModel, 'services')] });
baseContext.validation.push({ key: 'registries', validators: [ BackendErrorValidator(this.errorModel, 'registries')] }); baseContext.validation.push({ key: 'registries', validators: [BackendErrorValidator(this.errorModel, 'registries')] });
baseContext.validation.push({ key: 'dataRepositories', validators: [BackendErrorValidator(this.errorModel, 'dataRepositories')] }); baseContext.validation.push({ key: 'dataRepositories', validators: [BackendErrorValidator(this.errorModel, 'dataRepositories')] });
baseContext.validation.push({ key: 'externalDatasets', validators: [BackendErrorValidator(this.errorModel, 'externalDatasets')] });
baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.errorModel, 'dmp')] }); //TODO baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.errorModel, 'dmp')] }); //TODO
return baseContext; return baseContext;
} }

View File

@ -9,6 +9,7 @@ import { Observable } from 'rxjs/Observable';
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel'; import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria'; import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria';
import { RequestItem } from '../../models/criteria/RequestItem'; import { RequestItem } from '../../models/criteria/RequestItem';
import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileModel';
@Injectable() @Injectable()
@ -30,8 +31,8 @@ export class DatasetWizardService {
return this.http.post<DataManagementPlanModel[]>(this.actionUrl + 'userDmps', criteria, { headers: this.headers }); return this.http.post<DataManagementPlanModel[]>(this.actionUrl + 'userDmps', criteria, { headers: this.headers });
} }
public getAvailableProfiles(criteria: RequestItem<DatasetProfileCriteria>): Observable<DataManagementPlanModel[]> { public getAvailableProfiles(criteria: RequestItem<DatasetProfileCriteria>): Observable<DatasetProfileModel[]> {
return this.http.post<DataManagementPlanModel[]>(this.actionUrl + 'getAvailableProfiles/', criteria, { headers: this.headers }); return this.http.post<DatasetProfileModel[]>(this.actionUrl + 'getAvailableProfiles/', criteria, { headers: this.headers });
} }
public getSingle(id:String): Observable<DatasetWizardModel> { public getSingle(id:String): Observable<DatasetWizardModel> {

View File

@ -34,6 +34,10 @@ export class ExternalSourcesService {
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "services" + "?query=" + like, { headers: this.headers }); return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "services" + "?query=" + like, { headers: this.headers });
} }
public searchDatasetSExternalDatasetservice(like: string): Observable<ExternalSourcesItemModel[]> {
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datasets" + "?query=" + like, { headers: this.headers });
}
public searchDMPResearchers(like: string): Observable<ExternalSourcesItemModel[]> { public searchDMPResearchers(like: string): Observable<ExternalSourcesItemModel[]> {
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "researchers" + "?query=" + like, { headers: this.headers }); return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "researchers" + "?query=" + like, { headers: this.headers });
} }

View File

@ -46,17 +46,19 @@
}, },
"ACTIONS":{ "ACTIONS":{
"EDIT":"Edit", "EDIT":"Edit",
"INVITE":"Invite" "INVITE":"Invite",
"ADD-DATASET":"Add Dataset",
"DATASETS":"Datasets"
} }
}, },
"DATASET-WIZARD": { "DATASET-WIZARD": {
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "Plan Information", "TITLE": "Dataset Information",
"DMP": "Data Management Plan", "DMP": "Data Management Plan",
"PROFILE": "Profile" "PROFILE": "Dataset Profile"
}, },
"SECOND-STEP": { "SECOND-STEP": {
"TITLE": "Dataset Information" "TITLE": "External Sources"
}, },
"THIRD-STEP": { "THIRD-STEP": {
"TITLE": "Definition" "TITLE": "Definition"
@ -150,7 +152,8 @@
"URI": "Uri", "URI": "Uri",
"DATAREPOSITORIES": "Data Repositories", "DATAREPOSITORIES": "Data Repositories",
"REGISTRIES": "Registries", "REGISTRIES": "Registries",
"SERVICES": "Services" "SERVICES": "Services",
"EXTERNAL-DATASETS": "External Datasets"
}, },
"ACTIONS": { "ACTIONS": {
"SAVE": "Save", "SAVE": "Save",