Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
# Conflicts: # dmp-frontend/src/app/dmps/dmps.module.ts
This commit is contained in:
commit
ca1593d5a7
|
@ -0,0 +1,19 @@
|
|||
<form *ngIf="formGroup" [formGroup]="formGroup">
|
||||
<h1 mat-dialog-title>{{'ADDRESEARCHERS-EDITOR.TITLE' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="firstName" placeholder="{{'ADDRESEARCHERS-EDITOR.FIRST_NAME' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('firstName').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="lastName" placeholder="{{'ADDRESEARCHERS-EDITOR.LAST_NAME' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('lastName').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<div layout="row" class="full-width text-right" align="end">
|
||||
<button mat-raised-button color="primary" (click)="send()" type="button">Save</button>
|
||||
<button mat-button mat-dialog-close mat-raised-button color="primary">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,39 @@
|
|||
import { JsonSerializer } from '../utilities/JsonSerializer';
|
||||
import { RequestItem } from '../models/criteria/RequestItem';
|
||||
import { Component, OnInit, Inject } from "@angular/core";
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Params, ActivatedRoute, Router } from '@angular/router';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||
import { ResearcherModel } from '@app/models/researcher/ResearcherModel';
|
||||
import { ResearcherService } from '@app/services/researchers/researchers.service';
|
||||
|
||||
@Component({
|
||||
selector: 'add-researchers-component',
|
||||
templateUrl: 'add-researchers.component.html',
|
||||
providers: [ResearcherService]
|
||||
|
||||
})
|
||||
export class AddResearchersComponent implements OnInit {
|
||||
|
||||
private formGroup: FormGroup;
|
||||
|
||||
constructor(
|
||||
private researcherService: ResearcherService,
|
||||
private route: ActivatedRoute,
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<AddResearchersComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
let researcher = new ResearcherModel();
|
||||
this.formGroup = researcher.buildForm();
|
||||
}
|
||||
|
||||
|
||||
send(value: any) {
|
||||
this.researcherService.createResearcher(this.formGroup.value).subscribe(
|
||||
null, null, () => this.dialogRef.close()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ const appRoutes: Routes = [
|
|||
{ path: '', redirectTo: '/welcome', pathMatch: 'full' },
|
||||
{ path: "unauthorized", loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule' },
|
||||
{ path: "users", loadChildren: './users/users.module#UsersModule' },
|
||||
{ path: "datasetsProfiles", loadChildren: './datasets-admin-listing/dataset-admin.module#DatasetAdminModule' },
|
||||
{ path: "welcome", component: WelcomepageComponent }
|
||||
];
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FigurecardComponent } from './shared/components/figurecard/figurecard.component';
|
||||
import { InvitationAcceptedComponent } from './invitation-accepted/invitation-accepted.component';
|
||||
import { InvitationComponent } from './invitation/invitation.component';
|
||||
import { HomepageComponent } from './homepage/homepage.component';
|
||||
import { PageNotFoundComponent } from './not-found.component';
|
||||
import { AppComponent } from './app.component';
|
||||
|
@ -33,7 +32,6 @@ import { NgModule } from "@angular/core";
|
|||
import { DatasetProfileModule } from './dataset-profile-form/dataset-profile.module';
|
||||
import { WelcomepageComponent } from '@app/welcomepage/welcomepage.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
|
|
@ -2,7 +2,6 @@ import { RouterModule, Routes } from '@angular/router';
|
|||
import { FormComponent } from 'app/dataset-profile-form/form/form.component';
|
||||
|
||||
export const DatasetProfileRoutes: Routes = [
|
||||
//{ path: "new/:dmpId", component: DatasetWizardComponent, canActivate: [AuthGuard] }
|
||||
{
|
||||
path: ':id',
|
||||
component: FormComponent
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
<div class="container-fluid">
|
||||
<h3>{{titlePrefix}} {{'DATASET-LISTING.TITLE' | translate}}</h3>
|
||||
|
||||
|
||||
<app-datasets-criteria-component></app-datasets-criteria-component>
|
||||
<mat-card class="mat-card">
|
||||
<mat-card-header>
|
||||
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
||||
</mat-card-header>
|
||||
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
|
||||
|
||||
<!-- Column Definition: Name -->
|
||||
<ng-container cdkColumnDef="label">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: Dmp -->
|
||||
<ng-container cdkColumnDef="dmp">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: Profile -->
|
||||
<ng-container cdkColumnDef="profile">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: DataRepositories -->
|
||||
<ng-container cdkColumnDef="dataRepositories">
|
||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DATAREPOSITORIES' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.dataRepositories}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: DataRepositories -->
|
||||
<ng-container cdkColumnDef="registries">
|
||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.REGISTRIES' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.registries}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: DataRepositories -->
|
||||
<ng-container cdkColumnDef="services">
|
||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.SERVICES' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.services}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: Status -->
|
||||
<!-- <ng-container cdkColumnDef="status">
|
||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.status}}
|
||||
</mat-cell>
|
||||
</ng-container> -->
|
||||
|
||||
<!-- Column Definition: Description -->
|
||||
<ng-container cdkColumnDef="description">
|
||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.description}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: Created -->
|
||||
<ng-container cdkColumnDef="created">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: Submission Time -->
|
||||
<ng-container cdkColumnDef="actions">
|
||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">
|
||||
<mat-menu #actionsMenu="matMenu">
|
||||
<button mat-menu-item (click)="rowClick(row.id)"><mat-icon>mode_edit</mat-icon>{{'DATASET-LISTING.ACTIONS.EDIT' | translate}}</button>
|
||||
<!-- <button *ngIf="row.status==1" mat-menu-item (click)="rowClick(row.id)"><mat-icon>visibility</mat-icon>{{'DATASET-LISTING.ACTIONS.VIEW' | translate}}</button>
|
||||
<button *ngIf="row.status==1" mat-menu-item (click)="makeItPublic(row.id)"><mat-icon>people_outline</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button> -->
|
||||
</mat-menu>
|
||||
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
||||
<!-- (click)="rowClick(row.id)" -->
|
||||
|
||||
</mat-table>
|
||||
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
|
||||
</mat-paginator>
|
||||
</mat-card>
|
||||
|
||||
<button mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/form'] ">
|
||||
<mat-icon class="mat-24">add</mat-icon>
|
||||
</button>
|
||||
</div>
|
|
@ -0,0 +1,35 @@
|
|||
.mat-table {
|
||||
margin: 24px;
|
||||
}
|
||||
|
||||
.mat-fab-bottom-right {
|
||||
top: auto !important;
|
||||
right: 20px !important;
|
||||
bottom: 10px !important;
|
||||
left: auto !important;
|
||||
position: fixed !important;
|
||||
}
|
||||
|
||||
.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mat-card {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.mat-row {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
mat-row:hover {
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
// mat-row:nth-child(even){
|
||||
// background-color:red;
|
||||
// }
|
||||
|
||||
mat-row:nth-child(odd){
|
||||
background-color:#eef0fb;
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
import { DataTableRequest } from '../models/data-table/DataTableRequest';
|
||||
import { DatasetListingModel } from '../models/datasets/DatasetListingModel';
|
||||
import { DatasetCriteria } from '../models/criteria/dataset/DatasetCriteria';
|
||||
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
|
||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
||||
import { Router, Params, ActivatedRoute } from "@angular/router";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { DataSource } from "@angular/cdk/table";
|
||||
|
||||
import { Observable } from "rxjs/Observable";
|
||||
import { PageEvent } from '@angular/material';
|
||||
import { DataManagementPlanService } from "@app/services/data-management-plan/data-management-plan.service";
|
||||
import { DataManagementPlanModel } from "@app/models/data-managemnt-plans/DataManagementPlanModel";
|
||||
import { DatasetCriteriaComponent } from '@app/shared/components/criteria/datasets/datasets-criteria.component';
|
||||
import { DatasetProfileAdmin } from '@app/services/datasetProfileAdmin/datasetProfileAfmin.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-admin-listing-component',
|
||||
templateUrl: 'dataset-admin-listing.component.html',
|
||||
styleUrls: ['./dataset-admin-listing.component.scss'],
|
||||
providers: [DatasetProfileAdmin, DataManagementPlanService]
|
||||
})
|
||||
export class DatasetAdminListingComponent implements OnInit {
|
||||
|
||||
@ViewChild(MatPaginator) _paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ViewChild(DatasetCriteriaComponent) criteria: DatasetCriteriaComponent;
|
||||
|
||||
|
||||
dataSource: DatasetDataSource | null;
|
||||
displayedColumns: String[] = ['label', 'dmp', 'profile', 'dataRepositories', 'registries', 'services', 'description', 'created', 'actions'];
|
||||
pageEvent: PageEvent;
|
||||
titlePrefix: String;
|
||||
dmpId: String;
|
||||
|
||||
statuses = [
|
||||
{ value: '0', viewValue: 'Active' },
|
||||
{ value: '1', viewValue: 'Inactive' }
|
||||
];
|
||||
|
||||
constructor(
|
||||
private datasetService: DatasetProfileAdmin,
|
||||
private router: Router,
|
||||
private languageService: TranslateService,
|
||||
public snackBar: MatSnackBar,
|
||||
public route: ActivatedRoute,
|
||||
public dataManagementPlanService: DataManagementPlanService
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe((params: Params) => {
|
||||
this.dmpId = params['dmpId'];
|
||||
if (this.dmpId != null) this.setDmpTitle(this.dmpId);
|
||||
this.criteria.setCriteria(this.getDefaultCriteria(this.dmpId));
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback(() => this.refresh());
|
||||
});
|
||||
}
|
||||
|
||||
setDmpTitle(dmpId: String) {
|
||||
this.dataManagementPlanService.getSingle(dmpId).map(data => data as DataManagementPlanModel)
|
||||
.subscribe(data => {
|
||||
this.titlePrefix = data.label;
|
||||
});
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.dataSource = new DatasetDataSource(this.datasetService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria);
|
||||
}
|
||||
|
||||
rowClick(rowId: String) {
|
||||
this.router.navigate(['form/' + rowId]);
|
||||
}
|
||||
|
||||
getDefaultCriteria(dmpId: String): DatasetCriteria {
|
||||
const defaultCriteria = new DatasetCriteria();
|
||||
if (dmpId != null) {
|
||||
defaultCriteria.dmpIds.push(dmpId);
|
||||
}
|
||||
return defaultCriteria;
|
||||
}
|
||||
|
||||
// makeItPublic(id: String) {
|
||||
// debugger;
|
||||
// this.datasetService.makeDatasetPublic(id).subscribe();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||
|
||||
totalCount = 0;
|
||||
isLoadingResults = false;
|
||||
|
||||
constructor(
|
||||
private _service: DatasetProfileAdmin,
|
||||
private _paginator: MatPaginator,
|
||||
private _sort: MatSort,
|
||||
private _languageService: TranslateService,
|
||||
private _snackBar: MatSnackBar,
|
||||
private _criteria: DatasetCriteriaComponent
|
||||
) {
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
connect(): Observable<DatasetListingModel[]> {
|
||||
const displayDataChanges = [
|
||||
this._paginator.page
|
||||
//this._sort.matSortChange
|
||||
];
|
||||
|
||||
|
||||
return Observable.merge(...displayDataChanges)
|
||||
.startWith(null)
|
||||
.switchMap(() => {
|
||||
setTimeout(() => {
|
||||
this.isLoadingResults = true;
|
||||
});
|
||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||
let fields: Array<string> = new Array()
|
||||
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||
request.criteria = this._criteria.criteria;
|
||||
return this._service.getPaged(request);
|
||||
})
|
||||
/*.catch((error: any) => {
|
||||
this._snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||
data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService },
|
||||
duration: 3000,
|
||||
extraClasses: ['snackbar-warning']
|
||||
});
|
||||
//this._criteria.criteria.onCallbackError(error);
|
||||
return Observable.of(null);
|
||||
})*/
|
||||
.map(result => {
|
||||
setTimeout(() => {
|
||||
this.isLoadingResults = false;
|
||||
});
|
||||
return result;
|
||||
})
|
||||
.map(result => {
|
||||
if (!result) { return []; }
|
||||
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
||||
return result.data;
|
||||
});
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
// No-op
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
import { RouterModule } from '@angular/router';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
import { DatasetService } from '../services/dataset/dataset.service';
|
||||
import { DynamicFormModule } from '../form/dynamic-form.module';
|
||||
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { DatasetAdminRoutes } from './dataset-admin.routes';
|
||||
import { DatasetAdminListingComponent } from './dataset-admin-listing.component';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
import { SharedModule } from '../shared/shared.module'
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
SharedModule,
|
||||
RouterModule.forChild(DatasetAdminRoutes),
|
||||
ReactiveFormsModule,
|
||||
DynamicFormModule,
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useFactory: HttpLoaderFactory,
|
||||
deps: [HttpClient]
|
||||
}
|
||||
}),
|
||||
],
|
||||
|
||||
declarations: [
|
||||
DatasetAdminListingComponent,
|
||||
],
|
||||
|
||||
exports: [
|
||||
DatasetAdminListingComponent,
|
||||
RouterModule
|
||||
],
|
||||
providers: [
|
||||
DatasetService
|
||||
]
|
||||
})
|
||||
|
||||
export class DatasetAdminModule {
|
||||
constructor(private translate: TranslateService) {
|
||||
translate.setDefaultLang('en');
|
||||
translate.use('en');
|
||||
}
|
||||
}
|
||||
|
||||
export function HttpLoaderFactory(httpClient: HttpClient) {
|
||||
return new TranslateHttpLoader(httpClient, 'assets/lang/', '.json');
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import { AuthGuard } from '../guards/auth.guard';
|
||||
import { DatasetAdminListingComponent } from './dataset-admin-listing.component';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
export const DatasetAdminRoutes: Routes = [
|
||||
{ path: '', component: DatasetAdminListingComponent, canActivate: [AuthGuard] },
|
||||
];
|
|
@ -1,3 +1,4 @@
|
|||
import { AddResearchersComponent } from '../add-researchers/add-researchers.component';
|
||||
import { DatasetWizardListingComponent } from './wizard/listing/dataset-wizard-listing.component';
|
||||
import { DataManagementPlanWizardEditorComponent } from './wizard/editor/dmp-wizard-editor.component';
|
||||
import { DataManagementPlanWizardComponent } from './wizard/dmp-wizard.component';
|
||||
|
@ -12,10 +13,11 @@ import { DataManagementPlanRoutes } from './dmps.routes';
|
|||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { CovalentDialogsModule } from '@covalent/core';
|
||||
|
||||
import { SharedModule } from '../shared/shared.module'
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
|
@ -31,6 +33,7 @@ import { NgModule } from '@angular/core';
|
|||
deps: [HttpClient]
|
||||
}
|
||||
}),
|
||||
CovalentDialogsModule
|
||||
],
|
||||
|
||||
declarations: [
|
||||
|
@ -40,7 +43,8 @@ import { NgModule } from '@angular/core';
|
|||
InvitationAcceptedComponent,
|
||||
DataManagementPlanWizardComponent,
|
||||
DataManagementPlanWizardEditorComponent,
|
||||
DatasetWizardListingComponent
|
||||
DatasetWizardListingComponent,
|
||||
AddResearchersComponent
|
||||
],
|
||||
|
||||
exports: [
|
||||
|
@ -50,10 +54,13 @@ import { NgModule } from '@angular/core';
|
|||
InvitationAcceptedComponent,
|
||||
DataManagementPlanWizardComponent,
|
||||
DataManagementPlanWizardEditorComponent,
|
||||
DatasetWizardListingComponent
|
||||
DatasetWizardListingComponent,
|
||||
AddResearchersComponent
|
||||
|
||||
],
|
||||
entryComponents: [
|
||||
InvitationComponent
|
||||
InvitationComponent,
|
||||
AddResearchersComponent
|
||||
],
|
||||
providers: [
|
||||
BaseHttpService
|
||||
|
|
|
@ -18,15 +18,12 @@
|
|||
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<auto-complete class="mat-form-field-full-width" placeholder="{{'DMP-EDITOR.FIELDS.PROJECT' | translate}}"
|
||||
[configuration]="projectAutoCompleteConfiguration"
|
||||
titleKey="label"
|
||||
[control]="formGroup.get('project')"
|
||||
[required]="true">
|
||||
<auto-complete class="mat-form-field-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}}"
|
||||
(inputChange)="filterProfiles($event)" requireMatch>
|
||||
(inputChange)="filterProfiles($event)" requireMatch required>
|
||||
<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}}
|
||||
|
@ -37,7 +34,9 @@
|
|||
</div>
|
||||
</ng-template>
|
||||
<mat-progress-bar [style.height.px]="2" *ngIf="filteredProfilesAsync" mode="indeterminate"></mat-progress-bar>
|
||||
<span *ngIf="formGroup.get('profiles').touched || !formGroup.get('profiles').pristine">
|
||||
<mat-error style="font-size:10.5px" *ngIf="formGroup.get('profiles').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</span>
|
||||
</td-chips>
|
||||
|
||||
|
||||
|
@ -55,7 +54,8 @@
|
|||
<mat-progress-bar [style.height.px]="2" *ngIf="filteringOrganisationsAsync" mode="indeterminate"></mat-progress-bar>
|
||||
</td-chips>
|
||||
|
||||
<td-chips style ="margin-bottom:25px;" color="accent" [items]="filteredResearchers" formControlName="researchers" placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}"
|
||||
<div layout="row" layout-align="start center">
|
||||
<td-chips style="margin-bottom:25px; display:inline-block; width:90%" 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>
|
||||
|
@ -69,6 +69,12 @@
|
|||
<mat-progress-bar [style.height.px]="2" *ngIf="filteringResearchersAsync" mode="indeterminate"></mat-progress-bar>
|
||||
</td-chips>
|
||||
|
||||
<button style="display:inline-block;" mat-icon-button (click) ="addResearcher()">
|
||||
<mat-icon aria-label="Example icon-button with a heart icon">add_circle</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<mat-list *ngIf="associatedUsers?.length" role="list">
|
||||
<h3 mat-subheader>Associated Users</h3>
|
||||
<mat-list-item role="listitem" *ngFor="let user of associatedUsers">
|
||||
|
@ -82,7 +88,7 @@
|
|||
<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>
|
||||
<button *ngIf="!isNew" mat-raised-button color="primary" type="submit" (click)="delete()">{{'DMP-EDITOR.ACTIONS.DELETE' | translate}}</button>
|
||||
<button *ngIf="!isNew" mat-raised-button color="primary" type="button" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)">{{'DMP-EDITOR.ACTIONS.DELETE' | translate}}</button>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from "@angular/core";
|
||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
||||
import { MatPaginator, MatSort, MatSnackBar, MatDialog } from "@angular/material";
|
||||
import { Router, ActivatedRoute, Params } from "@angular/router";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { DataSource } from "@angular/cdk/table";
|
||||
|
@ -20,7 +20,9 @@ import { AutoCompleteConfiguration } from "../../shared/components/autocomplete/
|
|||
import { ProjectCriteria } from "../../models/criteria/project/ProjectCriteria";
|
||||
import { ProjectService } from "../../services/project/project.service";
|
||||
import { DmpUsersModel } from "@app/models/dmpUsers/DmpUsersModel";
|
||||
|
||||
import { AddResearchersComponent } from "@app/add-researchers/add-researchers.component";
|
||||
import { ViewContainerRef } from '@angular/core';
|
||||
import { TdDialogService } from '@covalent/core';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -56,7 +58,10 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
|
|||
public snackBar: MatSnackBar,
|
||||
public router: Router,
|
||||
public language: TranslateService,
|
||||
private _service: DataManagementPlanService
|
||||
private _service: DataManagementPlanService,
|
||||
public dialog: MatDialog,
|
||||
private _dialogService: TdDialogService,
|
||||
private _viewContainerRef: ViewContainerRef
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -202,4 +207,35 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
|
|||
}
|
||||
}
|
||||
|
||||
addResearcher(rowId: any, rowName: any) {
|
||||
let dialogRef = this.dialog.open(AddResearchersComponent, {
|
||||
height: '255px',
|
||||
width: '700px',
|
||||
data: {
|
||||
dmpId: rowId,
|
||||
dmpName: rowName
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
openConfirm(dmpLabel, id): void {
|
||||
this._dialogService.openConfirm({
|
||||
message: 'Are you sure you want to delete the "' + dmpLabel +'"',
|
||||
disableClose: true || false, // defaults to false
|
||||
viewContainerRef: this._viewContainerRef, //OPTIONAL
|
||||
title: 'Confirm', //OPTIONAL, hides if not provided
|
||||
cancelButton: 'No', //OPTIONAL, defaults to 'CANCEL'
|
||||
acceptButton: 'Yes' //OPTIONAL, defaults to 'ACCEPT'
|
||||
// width: '500px', //OPTIONAL, defaults to 400px
|
||||
}).afterClosed().subscribe((accept: boolean) => {
|
||||
if (accept) {
|
||||
this.dataManagementPlanService.delete(id).subscribe(()=>{
|
||||
this.router.navigate(['/dmps'])
|
||||
});
|
||||
} else {
|
||||
// DO SOMETHING ELSE
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
<!-- Column Definition: Version -->
|
||||
<ng-container cdkColumnDef="version">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header="version">{{'DMP-LISTING.COLUMNS.VERSION' | translate}}</mat-header-cell>
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header="version">{{'DMP-LISTING.COLUMNS.LATEST_VERSION' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { Serializable } from "../Serializable";
|
||||
import { FormGroup, FormBuilder } from '@angular/forms';
|
||||
|
||||
export class ResearcherModel implements Serializable<ResearcherModel> {
|
||||
public id: String;
|
||||
public name: String;
|
||||
public lastName: String;
|
||||
public uri: String;
|
||||
public email: String;
|
||||
|
||||
|
@ -14,4 +16,14 @@ export class ResearcherModel implements Serializable<ResearcherModel> {
|
|||
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(): FormGroup {
|
||||
let formGroup = new FormBuilder().group({
|
||||
firstName:[this.name],
|
||||
lastName:[this.lastName]
|
||||
})
|
||||
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
}
|
|
@ -52,4 +52,8 @@ export class DataManagementPlanService {
|
|||
newVersion(dataManagementPlanModel: DataManagementPlanModel, id:String): Observable<DataManagementPlanModel> {
|
||||
return this.http.post<DataManagementPlanModel>(this.actionUrl + 'new/' + id , dataManagementPlanModel, { headers: this.headers });
|
||||
}
|
||||
|
||||
delete(id: String): Observable<DataManagementPlanModel> {
|
||||
return this.http.delete<DataManagementPlanModel>(this.actionUrl + 'delete/' + id, { headers: this.headers });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import { DatasetModel } from '../../models/datasets/DatasetModel';
|
|||
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
||||
|
||||
import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin';
|
||||
import { DatasetListingModel } from '@app/models/datasets/DatasetListingModel';
|
||||
|
||||
|
||||
@Injectable()
|
||||
|
@ -36,12 +37,9 @@ export class DatasetProfileAdmin {
|
|||
getDatasetProfileById(datasetProfileID){
|
||||
return this.http.get<DatasetProfileModelAdmin>(this.actionUrl + 'get/' + datasetProfileID, { headers: this.headers })
|
||||
}
|
||||
// getPaged(dataTableRequest: DataTableRequest<DatasetCriteria>): Observable<DataTableData<DatasetListingModel>> {
|
||||
// return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers });
|
||||
// }
|
||||
|
||||
// makeDatasetPublic(id: String){
|
||||
// return this.http.get(this.actionUrl + 'makepublic/' + id, { headers: this.headers })
|
||||
// }
|
||||
getPaged(dataTableRequest: DataTableRequest<DatasetCriteria>): Observable<DataTableData<DatasetListingModel>> {
|
||||
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'datasetprofiles/getPaged', dataTableRequest, { headers: this.headers });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
import { Invitation } from '../../models/invitation/Invitation';
|
||||
import { UserInvitationCriteria } from '../../models/criteria/invitation/UserInvitationCriteria';
|
||||
import { User } from '../../models/invitation/User';
|
||||
import { HostConfiguration } from '../../app.constants';
|
||||
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { RequestItem } from '../../models/criteria/RequestItem';
|
||||
import { ResearcherModel } from '@app/models/researcher/ResearcherModel';
|
||||
|
||||
@Injectable()
|
||||
export class ResearcherService {
|
||||
|
||||
private actionUrl: string;
|
||||
private headers: HttpHeaders;
|
||||
|
||||
constructor(private http: BaseHttpService) {
|
||||
|
||||
this.actionUrl = HostConfiguration.Server + 'researchers/';
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('Content-Type', 'application/json');
|
||||
this.headers = this.headers.set('Accept', 'application/json');
|
||||
}
|
||||
|
||||
public createResearcher(researcher: ResearcherModel) {
|
||||
return this.http.post(this.actionUrl + "create", researcher, { headers: this.headers });
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@
|
|||
<button mat-button class="navbar-button" routerLink="/dmps">{{'NAV-BAR.DMPS' | translate}}</button>
|
||||
<button mat-button class="navbar-button" routerLink="/datasets">{{'NAV-BAR.DATASETS' | translate}}</button>
|
||||
<button *ngIf="isAdmin()" mat-button class="navbar-button" routerLink="/users">{{'NAV-BAR.USERS' | translate}}</button>
|
||||
<button *ngIf="isAdmin()" mat-button class="navbar-button" routerLink="/datasetsProfiles">{{'NAV-BAR.DATASETS(ADMIN)' | translate}}</button>
|
||||
</div>
|
||||
<span class="navbar-spacer"></span>
|
||||
<div *ngIf="isAuthenticated();else loginoption">
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
"PROJECTS": "Projects",
|
||||
"DMPS": "Plans",
|
||||
"DATASETS": "Datasets",
|
||||
"USERS": "Users"
|
||||
"USERS": "Users",
|
||||
"DATASETS(ADMIN)":"Datasets (Admin)"
|
||||
|
||||
},
|
||||
"PROJECT-LISTING": {
|
||||
|
@ -47,7 +48,7 @@
|
|||
"PROFILE": "Profile",
|
||||
"CREATION-TIME": "Creation Time",
|
||||
"ORGANISATIONS": "Organisations",
|
||||
"VERSION": "Version",
|
||||
"LATEST_VERSION": "Latest Version",
|
||||
"ACTIONS": "Actions",
|
||||
"DATASETS":"Datasets"
|
||||
},
|
||||
|
@ -199,5 +200,14 @@
|
|||
"USER": "User",
|
||||
"MANAGER": "Manager"
|
||||
}
|
||||
},
|
||||
"ADDRESEARCHERS-EDITOR": {
|
||||
"TITLE": "Add a Researcher",
|
||||
"FIRST_NAME": "First Name",
|
||||
"LAST_NAME": "Last Name",
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save",
|
||||
"CANCEL": "Cancel"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue