diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index 70e2a6879..8a922332e 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -24,7 +24,8 @@ const appRoutes: Routes = [ { path: 'project/:id', component: ProjectEditorComponent, canActivate: [AuthGuard] }, { path: 'projects/new', component: ProjectEditorComponent, canActivate: [AuthGuard] }, { path: 'dmps', component: DataManagementPlanListingComponent, canActivate: [AuthGuard] }, - { path: 'dmp/:id', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] }, + { path: 'dmp/:id', component: DataManagementPlanEditorComponent,canActivate: [AuthGuard] }, + { path: 'dmp/:id/new_version', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] }, { path: 'dmps/new', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] }, { path: 'datasets', component: DatasetListingComponent, canActivate: [AuthGuard] }, //{ path: 'dataset/new', component: DatasetWizardComponent, canActivate: [AuthGuard] }, diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.ts b/dmp-frontend/src/app/dmps/dmp-listing.component.ts index 391125ace..81942fcba 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.ts +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.ts @@ -62,7 +62,7 @@ export class DataManagementPlanListingComponent implements OnInit { } newVersion(rowId: String) { - //this.router.navigate(['/datasets/' + rowId]); + this.router.navigate(['/dmp/' + rowId+ '/new_version'],{queryParams:{clone: 'true'}}); } getDefaultCriteria(): DataManagementPlanCriteria { diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html index 43c2a1e24..fcab0ad9c 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html @@ -67,6 +67,15 @@ + +

Associated Users

+ + person +
{{user.name}}
+
+
+ +
diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts index 82b3e8049..b52dd50eb 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts @@ -44,6 +44,8 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { filteredProfiles: DatasetProfileModel[]; projectAutoCompleteConfiguration: AutoCompleteConfiguration; + createNewVersion; + associatedUsers = [{name:"Ioannis Kalyvas"}]; constructor( private dataManagementPlanService: DataManagementPlanService, @@ -80,6 +82,11 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { }); } }); + this.route + .queryParams + .subscribe(params => { + this.createNewVersion = params["clone"]; + }); } formSubmit(): void { @@ -92,11 +99,19 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { return this.formGroup.valid; } - onSubmit(): void { - this.dataManagementPlanService.createDataManagementPlan(this.formGroup.value).subscribe( - complete => this.onCallbackSuccess(), - error => this.onCallbackError(error) - ); + onSubmit(): void {debugger; + if(this.createNewVersion =="true"){ + this.formGroup.value.id = null; + this.dataManagementPlanService.createDataManagementPlanClone(this.formGroup.value, this.formGroup.get("id").value).subscribe( + complete => this.onCallbackSuccess(), + error => this.onCallbackError(error) + ); + } + else + this.dataManagementPlanService.createDataManagementPlan(this.formGroup.value).subscribe( + complete => this.onCallbackSuccess(), + error => this.onCallbackError(error) + ); } onCallbackSuccess(): void { diff --git a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts index 59610030d..2f6b7e96b 100644 --- a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts +++ b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts @@ -48,4 +48,8 @@ export class DataManagementPlanService { searchDMPProfiles(dataSetProfileRequest: RequestItem): Observable { return this.http.post(this.actionUrl + "datasetprofiles/get", dataSetProfileRequest, { headers: this.headers }); } + + createDataManagementPlanClone(dataManagementPlanModel: DataManagementPlanModel, id:String): Observable { + return this.http.post(this.actionUrl + 'clone/' + id , dataManagementPlanModel, { headers: this.headers }); + } } diff --git a/dmp-frontend/src/app/shared/material/material.module.ts b/dmp-frontend/src/app/shared/material/material.module.ts index 8ad5b2e9b..d3968338f 100644 --- a/dmp-frontend/src/app/shared/material/material.module.ts +++ b/dmp-frontend/src/app/shared/material/material.module.ts @@ -26,7 +26,8 @@ import { MatTabsModule, MatStepperModule, MatRadioModule, - MatMenuModule + MatMenuModule, + MatListModule } from '@angular/material'; import { CdkTableModule } from '@angular/cdk/table'; import { SnackBarNotificationComponent } from '../components/notificaiton/snack-bar-notification.component'; @@ -66,7 +67,8 @@ import { CovalentLayoutModule, CovalentChipsModule, CovalentDialogsModule } from CovalentDialogsModule, MatStepperModule, MatRadioModule, - MatMenuModule + MatMenuModule, + MatListModule ], providers: [ diff --git a/dmp-frontend/src/assets/lang/en.json b/dmp-frontend/src/assets/lang/en.json index 0f21c7123..6111b9e86 100644 --- a/dmp-frontend/src/assets/lang/en.json +++ b/dmp-frontend/src/assets/lang/en.json @@ -43,7 +43,8 @@ "RESEARCHERS": "Researchers", "ORGANISATIONS": "Organisations", "VERSION": "Version", - "ACTIONS": "Actions" + "ACTIONS": "Actions", + "DATASETS":"Datasets" }, "ACTIONS": { "EDIT": "Edit", @@ -88,7 +89,8 @@ }, "ACTIONS": { "EDIT": "Edit", - "MAKE-IT-PUBLIC": "Make it public" + "MAKE-IT-PUBLIC": "Make it public", + "VIEW": "View" } }, "PROJECT-EDITOR": {