From 2a22a1e77c948219d12a0c48575a9889b29a1561 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 11:59:27 +0200 Subject: [PATCH 01/24] - --- dmp-frontend/src/app/datasets/dataset.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmp-frontend/src/app/datasets/dataset.html b/dmp-frontend/src/app/datasets/dataset.html index 4211506fe..4ec60ff6c 100644 --- a/dmp-frontend/src/app/datasets/dataset.html +++ b/dmp-frontend/src/app/datasets/dataset.html @@ -62,7 +62,7 @@ {{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}} {{dataset?.status | statusToString }} - + From eabb3b702232f6be7ec9fd918ad2018fab032f29 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 12:10:51 +0200 Subject: [PATCH 02/24] disable editing if form submitted --- dmp-frontend/src/app/datasets/dataset.component.css | 4 ++++ dmp-frontend/src/app/datasets/dataset.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dmp-frontend/src/app/datasets/dataset.component.css b/dmp-frontend/src/app/datasets/dataset.component.css index 2279ed4e1..44ba4eb62 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.css +++ b/dmp-frontend/src/app/datasets/dataset.component.css @@ -40,4 +40,8 @@ tr.hover:hover > * { .cursor-hand{ cursor: pointer; +} + +.hidden-keepspace{ + visibility: hidden; } \ No newline at end of file diff --git a/dmp-frontend/src/app/datasets/dataset.html b/dmp-frontend/src/app/datasets/dataset.html index 4ec60ff6c..373718601 100644 --- a/dmp-frontend/src/app/datasets/dataset.html +++ b/dmp-frontend/src/app/datasets/dataset.html @@ -62,7 +62,7 @@ {{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}} {{dataset?.status | statusToString }} - + From 596705077c16aa18fc163c3fe5d622eeaaed06f6 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 11:34:42 +0100 Subject: [PATCH 03/24] Update DataManagementPlanDB.sql --- dmp-db-scema/DataManagementPlanDB.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/dmp-db-scema/DataManagementPlanDB.sql b/dmp-db-scema/DataManagementPlanDB.sql index 8d0ce0a6c..15d640f21 100644 --- a/dmp-db-scema/DataManagementPlanDB.sql +++ b/dmp-db-scema/DataManagementPlanDB.sql @@ -214,6 +214,7 @@ CREATE TABLE "Project" ( "Abbreviation" character varying(50), "Reference" xml, "Uri" character varying(250), + "CreationUser" uuid not null, "Status" smallint not null default 0, "Created" timestamp not null default NOW(), "Modified" timestamp not null default NOW(), From 14280f0a2dff1eb9d1f7e49648cdc337edf26aee Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 14:36:16 +0200 Subject: [PATCH 04/24] Projects are now fetched for all, plus the option to filter for current user --- dmp-frontend/src/app/app.component.html | 2 +- .../app/pipes/project-table-filter.pipe.ts | 19 ++++++++++--------- dmp-frontend/src/app/projects/project.html | 11 ++++++++--- .../src/app/projects/projects.component.ts | 17 +++++++++++++++-- .../src/app/services/server.service.ts | 5 ++++- .../breadcrumb/breadcrumb.component.ts | 2 +- 6 files changed, 39 insertions(+), 17 deletions(-) diff --git a/dmp-frontend/src/app/app.component.html b/dmp-frontend/src/app/app.component.html index 4ee6d4ad0..d74ab8bae 100644 --- a/dmp-frontend/src/app/app.component.html +++ b/dmp-frontend/src/app/app.component.html @@ -22,7 +22,7 @@ diff --git a/dmp-frontend/src/app/pipes/project-table-filter.pipe.ts b/dmp-frontend/src/app/pipes/project-table-filter.pipe.ts index 5e721ccf9..4ce000575 100644 --- a/dmp-frontend/src/app/pipes/project-table-filter.pipe.ts +++ b/dmp-frontend/src/app/pipes/project-table-filter.pipe.ts @@ -6,22 +6,23 @@ import {Pipe, PipeTransform} from "@angular/core"; }) export class ProjectTableFilterPipe implements PipeTransform { - transform(array: any[], query: string): any { + transform(array: any[], query: string, userid : string, onlyMyProjects : boolean): any { - if (query) { + if (query || userid) { return _.filter(array, row => { - - return ( - - row.label.indexOf(query) > -1 - //|| row.version == query - //|| row.id.indexOf(query) > -1 - ) + if(onlyMyProjects){ + return (row.label.indexOf(query) > -1) && (row.creationUser==userid); + } + else{ + return row.label.indexOf(query) > -1; + } + }); } return array; } + } \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/project.html b/dmp-frontend/src/app/projects/project.html index 5b5bb2ec4..3e382057a 100644 --- a/dmp-frontend/src/app/projects/project.html +++ b/dmp-frontend/src/app/projects/project.html @@ -1,16 +1,21 @@ - - + diff --git a/dmp-frontend/src/app/projects/projects.component.ts b/dmp-frontend/src/app/projects/projects.component.ts index 92899c1c3..bab4aacf8 100644 --- a/dmp-frontend/src/app/projects/projects.component.ts +++ b/dmp-frontend/src/app/projects/projects.component.ts @@ -59,6 +59,8 @@ export class ProjectsComponent implements OnInit{ project: any; + whoami: any; + onlyMyProjects : boolean = false; options: DatepickerOptions = { minYear: 1900, @@ -101,11 +103,22 @@ getEmptyProject(){ this.getProjects(); + this.serverService.whoami().subscribe( + response => { + this.whoami = response; + console.log(this.whoami) + }, + err => { + simple_notifier("danger",null,"Could not retrieve user config"); + } + ); + } - + getProjects(muted? : boolean){ - this.serverService.getProjectsOfUser().subscribe( + //this.serverService.getProjectsOfUser().subscribe( + this.serverService.getAllProjects().subscribe( response => { this.tableData = response; if(muted && muted!=true) diff --git a/dmp-frontend/src/app/services/server.service.ts b/dmp-frontend/src/app/services/server.service.ts index d89518072..c3744c62a 100644 --- a/dmp-frontend/src/app/services/server.service.ts +++ b/dmp-frontend/src/app/services/server.service.ts @@ -99,7 +99,6 @@ export class ServerService { return this.restBase.get("dmp/getofuser"); } - public createDmpForCurrentUser(data:any){ return this.restBase.post("dmp/createofuser", data); } @@ -140,6 +139,10 @@ public deleteDataset(dataset: any){ return this.restBase.post("dataset/softdelete", dataset); } +public whoami(){ + return this.restBase.get("user/whoami"); +} + /* logOut() { diff --git a/dmp-frontend/src/app/widgets/breadcrumb/breadcrumb.component.ts b/dmp-frontend/src/app/widgets/breadcrumb/breadcrumb.component.ts index 5c8868191..a86f3bff2 100644 --- a/dmp-frontend/src/app/widgets/breadcrumb/breadcrumb.component.ts +++ b/dmp-frontend/src/app/widgets/breadcrumb/breadcrumb.component.ts @@ -55,7 +55,7 @@ export class BreadcrumbComponent implements OnInit { let label = null; if(componentName == "ProjectsComponent") { - label = "My Projects"; + label = "Projects"; } if(componentName == "DmpComponent"){ label = "My Data Management Plans"; From 1ed5d95a77615c23375a71aefcb2279f8bf55c72 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 15:21:57 +0200 Subject: [PATCH 05/24] minor fixes --- dmp-frontend/src/app/app.module.ts | 5 +++-- dmp-frontend/src/app/projects/project.css | 12 +++++++++++- dmp-frontend/src/app/projects/project.html | 16 ++++++++++++---- .../dmp-detailed/dmp-detailed.component.css | 0 .../dmp-detailed/dmp-detailed.component.html | 3 +++ .../dmp-detailed/dmp-detailed.component.ts | 15 +++++++++++++++ 6 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.css create mode 100644 dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.html create mode 100644 dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index 182a7ba77..3579bfa61 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -69,7 +69,8 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen import { AutocompleteRemoteComponent } from './form/fields/autocomplete-remote/autocomplete-remote.component'; import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner'; -import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component'; +import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component'; +import { DmpDetailedComponent } from './viewers/src/app/viewers/dmp-detailed/dmp-detailed.component'; @@ -101,7 +102,7 @@ import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component'; DatasetTableFilterPipe, DatasetStatusFilterPipe, StatusToString, - BreadcrumbComponent + BreadcrumbComponent, DmpDetailedComponent ], imports: [ BrowserModule, diff --git a/dmp-frontend/src/app/projects/project.css b/dmp-frontend/src/app/projects/project.css index f643122ce..2c6b2c7e6 100644 --- a/dmp-frontend/src/app/projects/project.css +++ b/dmp-frontend/src/app/projects/project.css @@ -49,4 +49,14 @@ tr.hover:hover > * { background-color:#337ab7; color:white; margin-top:15px; -} \ No newline at end of file +} + +a{ + cursor: pointer; +} +.not-active { + pointer-events: none; + cursor:not-allowed; + opacity: 0.5; + filter: alpha(opacity=50); /* For IE8 and earlier */ + } \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/project.html b/dmp-frontend/src/app/projects/project.html index 3e382057a..e79dab8f5 100644 --- a/dmp-frontend/src/app/projects/project.html +++ b/dmp-frontend/src/app/projects/project.html @@ -29,10 +29,10 @@ Αbbreviation - + diff --git a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.css b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.html b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.html new file mode 100644 index 000000000..28d54915a --- /dev/null +++ b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.html @@ -0,0 +1,3 @@ +

+ dmp-detailed works! +

diff --git a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts new file mode 100644 index 000000000..8976abfb9 --- /dev/null +++ b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-dmp-detailed', + templateUrl: './dmp-detailed.component.html', + styleUrls: ['./dmp-detailed.component.css'] +}) +export class DmpDetailedComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} From 42eff3de8b510536138516ae268596153bfbafe1 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 15:22:24 +0200 Subject: [PATCH 06/24] - --- dmp-frontend/src/app/app.module.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index 3579bfa61..db039f912 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -69,8 +69,8 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen import { AutocompleteRemoteComponent } from './form/fields/autocomplete-remote/autocomplete-remote.component'; import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner'; -import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component'; -import { DmpDetailedComponent } from './viewers/src/app/viewers/dmp-detailed/dmp-detailed.component'; +import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component'; +import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component'; From 48a7cb06068586a95956c18e409d94a2bd5b8a9f Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 16:16:09 +0200 Subject: [PATCH 07/24] Adding Detailed DMP --- dmp-frontend/src/app/app-routing.module.ts | 3 +++ dmp-frontend/src/app/dmps/dmp.component.css | 5 +++++ dmp-frontend/src/app/dmps/dmp.component.ts | 5 +++++ dmp-frontend/src/app/dmps/dmps.html | 2 +- .../src/app/form/dynamic-form.component.html | 2 +- .../viewers/dmp-detailed/dmp-detailed.component.ts | 3 ++- .../app/widgets/breadcrumb/breadcrumb.component.ts | 14 ++++++++++---- 7 files changed, 27 insertions(+), 7 deletions(-) diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index 1a43546f1..b111ec368 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -10,6 +10,8 @@ import { DmpComponent } from './dmps/dmp.component'; import { AppComponent } from './app.component'; import { UserWorkspaceComponent } from './user-workspace/user-workspace.component'; import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component'; +import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component'; + const appRoutes: Routes = [ //{ path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] }, @@ -18,6 +20,7 @@ const appRoutes: Routes = [ { path: 'login', component: MainSignInComponent}, { path: 'projects', component: ProjectsComponent}, { path: 'dmps', component: DmpComponent}, + { path: 'dmp', component: DmpDetailedComponent }, { path: 'workspace', component: UserWorkspaceComponent}, { path: 'welcome', component: EmptyComponent}, { path: '', redirectTo: '/login', pathMatch: 'full' }, diff --git a/dmp-frontend/src/app/dmps/dmp.component.css b/dmp-frontend/src/app/dmps/dmp.component.css index 0e7b1daa7..f158a1bec 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.css +++ b/dmp-frontend/src/app/dmps/dmp.component.css @@ -61,4 +61,9 @@ tr.hover:hover > * { .centered-text{ text-align: center; +} + +.url-like{ + color: #0645AD; + cursor: pointer; } \ No newline at end of file diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts index d078346c0..7d0b32889 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.ts +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -264,6 +264,11 @@ export class DmpComponent implements OnInit{ this.router.navigate(['/dataset'], { queryParams: { "dmpid":item.id , "label":item.label}}); } + viewDetailedDMP(dmp){ + console.log(dmp) + this.router.navigate(['/dmp'], { queryParams: { "dmpid":dmp.id, "label":dmp.label }}); + } + } diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html index 0a547677a..7118ba627 100644 --- a/dmp-frontend/src/app/dmps/dmps.html +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -65,7 +65,7 @@ - + diff --git a/dmp-frontend/src/app/form/dynamic-form.component.html b/dmp-frontend/src/app/form/dynamic-form.component.html index 55541df34..311dee99e 100644 --- a/dmp-frontend/src/app/form/dynamic-form.component.html +++ b/dmp-frontend/src/app/form/dynamic-form.component.html @@ -44,7 +44,7 @@
-
+
diff --git a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts index 8976abfb9..6173c090d 100644 --- a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts +++ b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'app-dmp-detailed', + selector: 'dmp-detailed', templateUrl: './dmp-detailed.component.html', styleUrls: ['./dmp-detailed.component.css'] }) @@ -10,6 +10,7 @@ export class DmpDetailedComponent implements OnInit { constructor() { } ngOnInit() { + } } diff --git a/dmp-frontend/src/app/widgets/breadcrumb/breadcrumb.component.ts b/dmp-frontend/src/app/widgets/breadcrumb/breadcrumb.component.ts index a86f3bff2..d7e5f3612 100644 --- a/dmp-frontend/src/app/widgets/breadcrumb/breadcrumb.component.ts +++ b/dmp-frontend/src/app/widgets/breadcrumb/breadcrumb.component.ts @@ -33,10 +33,7 @@ export class BreadcrumbComponent implements OnInit { //this.breadcrumbData.length = 0; this.route.children.forEach( child => { let menuItem : MenuItem = this.guessMenuItemFromActivatedRoute(child, event); - if(menuItem != null) { - this.adaptBreadcrumbByMenuItem(menuItem); - //this.breadcrumbData.push(menuItem); - } + this.adaptBreadcrumbByMenuItem(menuItem); }) } @@ -69,6 +66,10 @@ export class BreadcrumbComponent implements OnInit { label = "Form of dataset '"+params["label"]+"'"; } + if(componentName == "DmpDetailedComponent"){ + label = "Details of DMP '"+params["label"]+"'"; + } + if(label != null) menuItem = {"label": label, "routerLink": url, "queryParams" : params }; @@ -81,6 +82,11 @@ export class BreadcrumbComponent implements OnInit { adaptBreadcrumbByMenuItem(menuItem : MenuItem){ + if(menuItem==null){ + this.breadcrumbData.length = 0; + return; + } + let breadcrumbDataNew: MenuItem[] = new Array(); for(var i=0; i Date: Thu, 16 Nov 2017 16:27:40 +0200 Subject: [PATCH 08/24] changed empty component to homecomponent --- dmp-frontend/src/app/app-routing.module.ts | 4 ++-- dmp-frontend/src/app/app.module.ts | 4 ++-- dmp-frontend/src/app/empty.component.ts | 6 ------ dmp-frontend/src/app/homepage/homepage.component.css | 0 dmp-frontend/src/app/homepage/homepage.component.html | 3 +++ dmp-frontend/src/app/homepage/homepage.component.ts | 9 +++++++++ 6 files changed, 16 insertions(+), 10 deletions(-) delete mode 100644 dmp-frontend/src/app/empty.component.ts create mode 100644 dmp-frontend/src/app/homepage/homepage.component.css create mode 100644 dmp-frontend/src/app/homepage/homepage.component.html create mode 100644 dmp-frontend/src/app/homepage/homepage.component.ts diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index b111ec368..ff0a98692 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { PageNotFoundComponent } from './not-found.component'; -import { EmptyComponent } from './empty.component'; +import { HomepageComponent } from './homepage/homepage.component'; import { DynamicFormComponent } from './form/dynamic-form.component'; import { AuthGuard } from './guards/auth.guard'; import { ProjectsComponent } from './projects/projects.component'; @@ -22,7 +22,7 @@ const appRoutes: Routes = [ { path: 'dmps', component: DmpComponent}, { path: 'dmp', component: DmpDetailedComponent }, { path: 'workspace', component: UserWorkspaceComponent}, - { path: 'welcome', component: EmptyComponent}, + { path: 'welcome', component: HomepageComponent}, { path: '', redirectTo: '/login', pathMatch: 'full' }, { path: '**', component: PageNotFoundComponent }, /* diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index db039f912..5305ecb6f 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -22,7 +22,7 @@ import { DynamicFormGroupComponent } from './form/dynamic-form-group/dynamic-for import { AppRoutingModule } from './app-routing.module'; import { AuthGuard } from './guards/auth.guard'; import { PageNotFoundComponent } from './not-found.component'; -import { EmptyComponent } from './empty.component'; +import { HomepageComponent } from './homepage/homepage.component'; import { TocComponent } from './form/tableOfContents/toc.component'; import { ConfirmationComponent } from './widgets/confirmation/confirmation.component'; @@ -85,7 +85,7 @@ import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.compon GooggleSignInComponent, MainSignInComponent, PageNotFoundComponent, - EmptyComponent, + HomepageComponent, ModalComponent, ProjectDetailComponent, ProjectsComponent, diff --git a/dmp-frontend/src/app/empty.component.ts b/dmp-frontend/src/app/empty.component.ts deleted file mode 100644 index 71d44023b..000000000 --- a/dmp-frontend/src/app/empty.component.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - template: '' -}) -export class EmptyComponent {} \ No newline at end of file diff --git a/dmp-frontend/src/app/homepage/homepage.component.css b/dmp-frontend/src/app/homepage/homepage.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/dmp-frontend/src/app/homepage/homepage.component.html b/dmp-frontend/src/app/homepage/homepage.component.html new file mode 100644 index 000000000..30d22cf68 --- /dev/null +++ b/dmp-frontend/src/app/homepage/homepage.component.html @@ -0,0 +1,3 @@ +

+ Works +

\ No newline at end of file diff --git a/dmp-frontend/src/app/homepage/homepage.component.ts b/dmp-frontend/src/app/homepage/homepage.component.ts new file mode 100644 index 000000000..894f16749 --- /dev/null +++ b/dmp-frontend/src/app/homepage/homepage.component.ts @@ -0,0 +1,9 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'homepage', + templateUrl: './homepage.component.html', + styleUrls: ['./homepage.component.css'], + providers: [] +}) +export class HomepageComponent {} \ No newline at end of file From 48ed8ac46914e135a116067a481f019c2b7a79ba Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 17:43:17 +0200 Subject: [PATCH 09/24] Altered fetching logic for users and dmps --- .../main/java/dao/entities/UserInfoDao.java | 8 +++- .../java/dao/entities/UserInfoDaoImpl.java | 40 +++++++++++++++++-- dmp-backend/src/main/java/entities/DMP.java | 2 +- .../src/main/java/entities/Project.java | 15 ++++++- .../src/main/java/entities/UserInfo.java | 3 +- .../src/main/java/rest/entities/DMPs.java | 7 +--- .../src/main/java/rest/entities/Projects.java | 1 + .../src/main/java/rest/entities/Users.java | 35 ++++++++++++++++ dmp-backend/src/test/java/TestRest.java | 39 +++++++++++++++++- 9 files changed, 136 insertions(+), 14 deletions(-) diff --git a/dmp-backend/src/main/java/dao/entities/UserInfoDao.java b/dmp-backend/src/main/java/dao/entities/UserInfoDao.java index d97fbbb38..29ee3d138 100644 --- a/dmp-backend/src/main/java/dao/entities/UserInfoDao.java +++ b/dmp-backend/src/main/java/dao/entities/UserInfoDao.java @@ -1,13 +1,17 @@ package dao.entities; +import java.util.List; import java.util.UUID; import dao.Dao; +import entities.DMP; import entities.UserInfo; public interface UserInfoDao extends Dao { - public UserInfo getByIdAndMail(String identification, String email); + public UserInfo getUserInfo(String userID); + + public UserInfo getByIdAndMail(String id, String email); public UserInfo getByMail(String email); @@ -15,4 +19,6 @@ public interface UserInfoDao extends Dao { public UserInfo getByUsername(String username); + public List getDmpsOfUser(String userID); + } \ No newline at end of file diff --git a/dmp-backend/src/main/java/dao/entities/UserInfoDaoImpl.java b/dmp-backend/src/main/java/dao/entities/UserInfoDaoImpl.java index 6a1a76b17..305bbde6c 100644 --- a/dmp-backend/src/main/java/dao/entities/UserInfoDaoImpl.java +++ b/dmp-backend/src/main/java/dao/entities/UserInfoDaoImpl.java @@ -1,12 +1,14 @@ package dao.entities; import java.util.List; +import java.util.Set; import java.util.UUID; import javax.persistence.NoResultException; import javax.persistence.TypedQuery; import dao.JpaDao; +import entities.DMP; import entities.UserInfo; import entities.security.UserAuth; @@ -21,10 +23,25 @@ public class UserInfoDaoImpl extends JpaDao implements UserInfoD @Override - public UserInfo getByIdAndMail(String identification, String email) { - String queryString = "FROM UserInfo userInfo where userInfo.identification = :userInfoID and userInfo.email = :userInfoEmail"; + public UserInfo getUserInfo(String userID) { + String queryString = "FROM UserInfo userInfo where userInfo.id = :userInfoID"; TypedQuery typedQuery = entityManager.createQuery(queryString, UserInfo.class); - typedQuery.setParameter("userInfoID", identification); + typedQuery.setParameter("userInfoID", UUID.fromString(userID)); + try { + return typedQuery.getSingleResult(); + } + catch(NoResultException ex) { + return null; + } + } + + + + @Override + public UserInfo getByIdAndMail(String id, String email) { + String queryString = "FROM UserInfo userInfo where userInfo.id = :userInfoID and userInfo.email = :userInfoEmail"; + TypedQuery typedQuery = entityManager.createQuery(queryString, UserInfo.class); + typedQuery.setParameter("userInfoID", UUID.fromString(id)); typedQuery.setParameter("userInfoEmail", email); try { return typedQuery.getSingleResult(); @@ -80,6 +97,23 @@ public class UserInfoDaoImpl extends JpaDao implements UserInfoD } } + @Override + public List getDmpsOfUser(String userID) { + + String queryString = "select dmp from DMP dmp join dmp.users user where user.id=:userid and dmp.status >= 0"; + TypedQuery typedQuery = entityManager.createQuery(queryString, DMP.class); + typedQuery.setParameter("userid", UUID.fromString(userID)); + try { + return typedQuery.getResultList(); + } + catch(Exception ex) { //no need to distinguish between exceptions for the moment + ex.printStackTrace(); + return null; + } + + } + + diff --git a/dmp-backend/src/main/java/entities/DMP.java b/dmp-backend/src/main/java/entities/DMP.java index 9e56fcb5e..0932e6666 100644 --- a/dmp-backend/src/main/java/entities/DMP.java +++ b/dmp-backend/src/main/java/entities/DMP.java @@ -36,7 +36,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @Entity @Table(name="\"DMP\"") -@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id", scope = DMP.class) public class DMP implements Serializable { diff --git a/dmp-backend/src/main/java/entities/Project.java b/dmp-backend/src/main/java/entities/Project.java index 90919e81f..ff5bbebae 100644 --- a/dmp-backend/src/main/java/entities/Project.java +++ b/dmp-backend/src/main/java/entities/Project.java @@ -80,6 +80,9 @@ public class Project implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; + @Type(type="org.hibernate.type.PostgresUUIDType") + @Column(name = "\"CreationUser\"") + private UUID creationUser; @Column(name = "\"Created\"") private Date created = null; @@ -210,7 +213,17 @@ public class Project implements Serializable { - public String toString() { + public UUID getCreationUser() { + return creationUser; + } + + + public void setCreationUser(UUID creationUser) { + this.creationUser = creationUser; + } + + + public String toString() { try { return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this).replace("\"", """); } catch (JsonProcessingException e) { diff --git a/dmp-backend/src/main/java/entities/UserInfo.java b/dmp-backend/src/main/java/entities/UserInfo.java index 8b107660f..3910d160e 100644 --- a/dmp-backend/src/main/java/entities/UserInfo.java +++ b/dmp-backend/src/main/java/entities/UserInfo.java @@ -85,10 +85,11 @@ public class UserInfo implements Serializable{ private Set dmps; - + /* public Set getDmpsNonDeleted(){ return getDmps().parallelStream().filter(dmp -> dmp.getStatus()>=0).collect(Collectors.toSet()); } + */ public Set getDmps() { return dmps; diff --git a/dmp-backend/src/main/java/rest/entities/DMPs.java b/dmp-backend/src/main/java/rest/entities/DMPs.java index 0d594172d..f7f4abc95 100644 --- a/dmp-backend/src/main/java/rest/entities/DMPs.java +++ b/dmp-backend/src/main/java/rest/entities/DMPs.java @@ -232,13 +232,8 @@ public class DMPs { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here"); } - UserInfo userInfo = userInfoDao.read(UUID.fromString(userID)); - - if(userInfo==null) //this should normally never happer - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here"); - try { - Set nonDeleted = userInfo.getDmpsNonDeleted(); + List nonDeleted = userInfoDao.getDmpsOfUser(userID); return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(nonDeleted)); } catch(Exception ex) { diff --git a/dmp-backend/src/main/java/rest/entities/Projects.java b/dmp-backend/src/main/java/rest/entities/Projects.java index 2990c5d2b..4405fafa7 100644 --- a/dmp-backend/src/main/java/rest/entities/Projects.java +++ b/dmp-backend/src/main/java/rest/entities/Projects.java @@ -257,6 +257,7 @@ public class Projects { project.setId(null); project.setStatus(new Short("0")); + project.setCreationUser(userInfo.getId()); project.setCreated(new Date()); project.setModified(new Date()); diff --git a/dmp-backend/src/main/java/rest/entities/Users.java b/dmp-backend/src/main/java/rest/entities/Users.java index 0a611c286..9b97ee93b 100644 --- a/dmp-backend/src/main/java/rest/entities/Users.java +++ b/dmp-backend/src/main/java/rest/entities/Users.java @@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PathVariable; @@ -36,6 +37,7 @@ import dao.entities.ProjectDao; import dao.entities.RegistryDao; import dao.entities.ResearcherDao; import dao.entities.ServiceDao; +import dao.entities.UserInfoDao; import entities.DMP; import entities.DMPProfile; import entities.DataRepository; @@ -47,6 +49,7 @@ import entities.Project; import entities.Registry; import entities.Researcher; import entities.Service; +import entities.UserInfo; import helpers.SerializerProvider; import helpers.Transformers; import responses.RestResponse; @@ -68,6 +71,38 @@ public class Users { @Autowired private RegistryDao registryDao; @Autowired private ResearcherDao researcherDao; @Autowired private ServiceDao serviceDao; + @Autowired private UserInfoDao userInfoDao; + + + + @RequestMapping(method = RequestMethod.GET, value = { "/user/whoami" }, produces="application/json") + public @ResponseBody ResponseEntity whoami(){ + + + String userID = null; + try { + userID = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString(); + } catch(NullPointerException ex) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here"); + } + + UserInfo userInfo = userInfoDao.getUserInfo(userID); + + + if(userInfo==null) //this should normally never happer + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here"); + + + try { + + return new ResponseEntity(SerializerProvider.toJson(userInfo), HttpStatus.OK); + } + catch(Exception ex) { + ex.printStackTrace(); + return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); + } + } + diff --git a/dmp-backend/src/test/java/TestRest.java b/dmp-backend/src/test/java/TestRest.java index 9b9701dc7..b2fbcefaa 100644 --- a/dmp-backend/src/test/java/TestRest.java +++ b/dmp-backend/src/test/java/TestRest.java @@ -3,6 +3,7 @@ import static org.junit.Assert.*; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.UUID; import org.junit.Before; @@ -17,6 +18,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.CollectionType; import com.fasterxml.jackson.databind.type.TypeFactory; @@ -201,7 +203,7 @@ public class TestRest { } - @Test + //@Test public void testDmpClone() { System.out.println(dmpsService.getDmpsOfUser().getBody()); @@ -266,5 +268,40 @@ public class TestRest { } + @Test + public void testProject2() { + + +// String a = null; +// try { +// //a = (String)dmpsService.getDmpsOfUser().getBody(); +// +// Set dmps = new ObjectMapper().readValue(dmpsService.getDmpsOfUser().getBody().toString(), new TypeReference>(){}); +// System.out.println(dmps); +// +//// Set dmps = SerializerProvider.fromJson((String)dmpsService.getDmpsOfUser().getBody(), new TypeReference>(){}); +// } catch (Exception e) { +// +// e.printStackTrace(); +// } + + + CollectionType typeReference = TypeFactory.defaultInstance().constructCollectionType(List.class, DMP.class); + List dmps = null; + try { + dmps = SerializerProvider.fromJson(dmpsService.getDmpsOfUser().getBody().toString(), typeReference) ; + System.out.println(dmps); + } catch (Exception e) { + e.printStackTrace(); + fail("Should not have thrown any exception"); + } + + + assertEquals("aaa", "aaa"); + + } + + + } From 624eec5ba27064729f1efad13a02b2a339581ac7 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 19:07:27 +0200 Subject: [PATCH 10/24] minor changes --- dmp-frontend/src/app/dmps/dmp.component.ts | 16 ++++------- dmp-frontend/src/app/dmps/dmps.html | 18 ++++++------- .../src/app/homepage/homepage.component.html | 15 ++++++++--- .../src/app/homepage/homepage.component.ts | 27 +++++++++++++++++-- dmp-frontend/src/app/projects/project.html | 4 +-- .../dmp-detailed/dmp-detailed.component.ts | 8 +++--- 6 files changed, 57 insertions(+), 31 deletions(-) diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts index 7d0b32889..c0e75f764 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.ts +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -45,7 +45,7 @@ export class DmpComponent implements OnInit{ showIDs : boolean = false; - dmp : any = null; + dmp : any; @Input() projectsDropDown:DropdownField; @Input() statusDropDown: DropdownField; @@ -60,10 +60,9 @@ export class DmpComponent implements OnInit{ this.projectsDropDown = new DropdownField(); this.projectsDropDown.options = []; this.statusDropDown = new DropdownField(); - this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}, {key:'2', value:"Submitted"}, {key:'3', value:"Cancel"}] + this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}] //this.projects = []; - this.dmp = this.clearDmp(); } @@ -101,17 +100,12 @@ export class DmpComponent implements OnInit{ } ) - } + this.clearDmp(); - showDMPDetails(dmp) { - console.log("Showing details for dmp : " + JSON.stringify(dmp)); - // TODO: Add here code to show details of dmp. - //1. hide dmp table and show component for detailed dmp - //2. also edit the breadcrumb + } - getDmps(muted? : boolean){ this.serverService.getDmpOfUser().subscribe( response => { @@ -198,7 +192,7 @@ export class DmpComponent implements OnInit{ newDmpForm(item){ - this.dmp = this.clearDmp(); + this.clearDmp(); $("#newDmpModal").modal("show"); } diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html index 7118ba627..28eded532 100644 --- a/dmp-frontend/src/app/dmps/dmps.html +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -65,11 +65,11 @@
- + - - + + - + - +
+ + + +
+ +
- Start Date + Start Date - End Date + End Date Status @@ -59,8 +59,16 @@ {{project?.enddate | date:'yyyy-MM-dd HH:mm:ss Z'}} {{project?.status | statusToString}} {{project?.description}} - + + + + +
{{dmp?.id}}{{dmp?.label}} {{dmp?.version}} {{dmp?.previous}} {{dmp?.project?.label}}
{{dmp?.id}} {{dmp?.version}} {{dmp?.previous}}{{dmp?.project?.label}}{{(dmp?.description?.length > 20) ? (dmp?.description | slice:0:20)+'...':(dmp?.description) }}{{(dmp?.project?.label?.length > 40) ? (dmp?.project?.label | slice:0:40)+'...':(dmp?.project?.label) }}{{(dmp?.description?.length > 40) ? (dmp?.description | slice:0:40)+'...':(dmp?.description) }} {{dmp?.created | date:'yyyy-MM-dd HH:mm:ss Z'}} {{dmp?.status | statusToString }} @@ -111,14 +111,14 @@ @@ -229,5 +229,3 @@ - - diff --git a/dmp-frontend/src/app/homepage/homepage.component.html b/dmp-frontend/src/app/homepage/homepage.component.html index 30d22cf68..64cebdff9 100644 --- a/dmp-frontend/src/app/homepage/homepage.component.html +++ b/dmp-frontend/src/app/homepage/homepage.component.html @@ -1,3 +1,12 @@ -

- Works -

\ No newline at end of file + +
+

Hello {{ userInfo?.name!=null ? userInfo?.name : userInfo?.email }}

+

Welcome {{ userInfo?.created != userInfo?.lastloggedin ? "back" : "" }} to the Data Management Plans application.

+ +
+ + \ No newline at end of file diff --git a/dmp-frontend/src/app/homepage/homepage.component.ts b/dmp-frontend/src/app/homepage/homepage.component.ts index 894f16749..c8d1ea827 100644 --- a/dmp-frontend/src/app/homepage/homepage.component.ts +++ b/dmp-frontend/src/app/homepage/homepage.component.ts @@ -1,4 +1,6 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import { ServerService } from '../../app/services/server.service'; @Component({ selector: 'homepage', @@ -6,4 +8,25 @@ import { Component } from '@angular/core'; styleUrls: ['./homepage.component.css'], providers: [] }) -export class HomepageComponent {} \ No newline at end of file +export class HomepageComponent implements OnInit{ + + private userInfo: any; + + constructor(private serverService: ServerService, private route: ActivatedRoute, private router: Router){ + + } + + + ngOnInit() { + this.serverService.whoami().subscribe( + userInfo => { + this.userInfo = userInfo; + }, + error => { + + } + ); + } + + +} \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/project.html b/dmp-frontend/src/app/projects/project.html index e79dab8f5..3685db049 100644 --- a/dmp-frontend/src/app/projects/project.html +++ b/dmp-frontend/src/app/projects/project.html @@ -53,12 +53,12 @@
{{project?.id}}{{project?.label}}{{(project?.label?.length > 40) ? (project?.label | slice:0:40)+'...':(project?.label) }} {{project?.abbreviation}} {{project?.startdate | date:'yyyy-MM-dd HH:mm:ss Z' }} {{project?.enddate | date:'yyyy-MM-dd HH:mm:ss Z'}} {{project?.status | statusToString}}{{project?.description}}{{(project?.description?.length > 40) ? (project?.description | slice:0:40)+'...':(project?.description) }} diff --git a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts index 6173c090d..eb79350d2 100644 --- a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts +++ b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.ts @@ -7,10 +7,12 @@ import { Component, OnInit } from '@angular/core'; }) export class DmpDetailedComponent implements OnInit { - constructor() { } - - ngOnInit() { + constructor() { } + ngOnInit() { + + } + } From 0ddf29c2ae69803edeb30719089fcf7c515b8a93 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 19:08:49 +0200 Subject: [PATCH 11/24] - --- .../src/app/viewers/dmp-detailed/dmp-detailed.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.html b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.html index 28d54915a..607724c94 100644 --- a/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.html +++ b/dmp-frontend/src/app/viewers/dmp-detailed/dmp-detailed.component.html @@ -1,3 +1,3 @@

- dmp-detailed works! +Under construction

From e981d9c92ea3062f35f9d5bdc76edf990d730b21 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 19:24:05 +0200 Subject: [PATCH 12/24] - --- .../src/main/java/rest/entities/Projects.java | 26 +++++++------- .../src/main/java/rest/entities/Users.java | 3 +- dmp-backend/src/main/webapp/WEB-INF/web.xml | 35 ++++++++++++++----- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/dmp-backend/src/main/java/rest/entities/Projects.java b/dmp-backend/src/main/java/rest/entities/Projects.java index 4405fafa7..2679270ba 100644 --- a/dmp-backend/src/main/java/rest/entities/Projects.java +++ b/dmp-backend/src/main/java/rest/entities/Projects.java @@ -263,19 +263,19 @@ public class Projects { Project newproj = projectDao.create(project); - DMP newdmp = new DMP(); - newdmp.setId(null); - newdmp.setLabel("Auto-Generated"); - newdmp.setCreated(new Date()); - newdmp.setVersion(1); - newdmp.setStatus(new Short("0")); - newdmp.setProject(newproj); - - Set users = new HashSet(); - users.add(userInfo); - newdmp.setUsers(users); - - newdmp = dMPDao.create(newdmp); +// DMP newdmp = new DMP(); +// newdmp.setId(null); +// newdmp.setLabel("Auto-Generated"); +// newdmp.setCreated(new Date()); +// newdmp.setVersion(1); +// newdmp.setStatus(new Short("0")); +// newdmp.setProject(newproj); +// +// Set users = new HashSet(); +// users.add(userInfo); +// newdmp.setUsers(users); +// +// newdmp = dMPDao.create(newdmp); return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(newproj)); } diff --git a/dmp-backend/src/main/java/rest/entities/Users.java b/dmp-backend/src/main/java/rest/entities/Users.java index 9b97ee93b..4360c68d8 100644 --- a/dmp-backend/src/main/java/rest/entities/Users.java +++ b/dmp-backend/src/main/java/rest/entities/Users.java @@ -75,7 +75,7 @@ public class Users { - @RequestMapping(method = RequestMethod.GET, value = { "/user/whoami" }, produces="application/json") + @RequestMapping(method = RequestMethod.GET, value = { "/user/whoami" }, produces="application/json;charset=UTF-8") public @ResponseBody ResponseEntity whoami(){ @@ -88,6 +88,7 @@ public class Users { UserInfo userInfo = userInfoDao.getUserInfo(userID); + System.out.println(userInfo.getName()); if(userInfo==null) //this should normally never happer return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here"); diff --git a/dmp-backend/src/main/webapp/WEB-INF/web.xml b/dmp-backend/src/main/webapp/WEB-INF/web.xml index 6de4a1563..8cc95c48c 100644 --- a/dmp-backend/src/main/webapp/WEB-INF/web.xml +++ b/dmp-backend/src/main/webapp/WEB-INF/web.xml @@ -65,16 +65,16 @@ - - contextConfigLocation - /WEB-INF/applicationContext.xml,/WEB-INF/spring-security.xml - - - - 30 - + + + contextConfigLocation + /WEB-INF/applicationContext.xml,/WEB-INF/spring-security.xml + + + + 30 + - springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy @@ -85,6 +85,23 @@ + + + encodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + forceEncoding + true + + + + encodingFilter + /* + \ No newline at end of file From 4f39bc9172c82b54399f5a2f4ced7186058d36e1 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 19:32:44 +0200 Subject: [PATCH 13/24] -- --- dmp-frontend/src/app/services/rest-base.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/dmp-frontend/src/app/services/rest-base.ts b/dmp-frontend/src/app/services/rest-base.ts index 005359f3b..eec546b56 100644 --- a/dmp-frontend/src/app/services/rest-base.ts +++ b/dmp-frontend/src/app/services/rest-base.ts @@ -19,18 +19,17 @@ export class RestBase { - /* protocol: string = "http"; - hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";// - port: number = 8080;//8080;// - webappname: string = "dmp-backend";//"dmp-backend-new";//*/ + /* + protocol: string = "http"; + hostname: string ="dl010.madgik.di.uoa.gr" + port: number = 8080; + webappname: string = "dmp-backend"; + */ - - - - protocol: string = "http"; - hostname: string = "dionysus.di.uoa.gr" ; - port: number = 7070; - webappname: string = "dmp-backend"; + protocol: string = "http"; + hostname: string = "dionysus.di.uoa.gr" ; + port: number = 7070; + webappname: string = "dmp-backend"; From 25b47fd03d83a0c06e8dd74afe810475cac4cdc5 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 19:34:06 +0200 Subject: [PATCH 14/24] -- --- dmp-backend/src/main/java/rest/entities/Users.java | 1 - 1 file changed, 1 deletion(-) diff --git a/dmp-backend/src/main/java/rest/entities/Users.java b/dmp-backend/src/main/java/rest/entities/Users.java index 4360c68d8..1424d5086 100644 --- a/dmp-backend/src/main/java/rest/entities/Users.java +++ b/dmp-backend/src/main/java/rest/entities/Users.java @@ -88,7 +88,6 @@ public class Users { UserInfo userInfo = userInfoDao.getUserInfo(userID); - System.out.println(userInfo.getName()); if(userInfo==null) //this should normally never happer return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here"); From 464610b068ff21e6535a8e43f9222b8da564e200 Mon Sep 17 00:00:00 2001 From: satyr Date: Fri, 17 Nov 2017 00:03:02 +0200 Subject: [PATCH 15/24] - --- dmp-backend/src/main/resources/dmp.properties | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 dmp-backend/src/main/resources/dmp.properties diff --git a/dmp-backend/src/main/resources/dmp.properties b/dmp-backend/src/main/resources/dmp.properties new file mode 100644 index 000000000..ddd3aa620 --- /dev/null +++ b/dmp-backend/src/main/resources/dmp.properties @@ -0,0 +1,48 @@ +##########################Security########################################## +#security.portmapping.http = 7081 +#security.portmapping.https = 7444 +##########################/Security######################################## + +##########################Persistence########################################## +persistence.jdbc.driver = org.postgresql.Driver +persistence.jdbc.url = jdbc:postgresql://HOST:PORT/DB +persistence.dbusername = USER +persistence.dbpassword = PASS +##########################/Persistence########################################## + +###################Allowed Proxy Service Host ############################ +proxy.allowed.host = https://eestore.paas2.uninett.no +####################################################### + +########################Persistence/Hibernate Generic############################# +persistence.hibernate.show_sql = false +persistence.hibernate.hbm2dll = validate +persistence.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect +#persistence.hibernate.dialect = org.hibernate.spatial.dialect.postgis.PostgisDialect +########################Persistence/Hibernate Generic############################# + + +########################Persistence/Hibernate/Batch############################## +persistence.hibernate.jdbc.batch_size = 30 +persistence.hibernate.order_inserts = true +persistence.hibernate.order_updates = true +persistence.hibernate.batch_versioned_data = true +persistence.hibernate.jdbc.batch_versioned_data = DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION +########################Persistence/Hibernate/Batch############################## + + +########################Persistence/Hibernate/Connection pool#################### +persistence.hibernate.connectionpool.provider_class = org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider +persistence.hibernate.connectionpool.c3p0.min_size = 5 +persistence.hibernate.connectionpool.c3p0.max_size = 100 +persistence.hibernate.connectionpool.c3p0.timeout = 0 +persistence.hibernate.connectionpool.c3p0.max_statements = 50 +persistence.hibernate.connectionpool.c3p0.acquire_retry_attempts = 30 +persistence.hibernate.connectionpool.c3p0.acquire_retry_delay = 1000 +persistence.hibernate.connectionpool.c3p0.idle_test_period = 3000 +persistence.hibernate.connectionpool.c3p0.break_after_acquire_failure = false +persistence.hibernate.connectionpool.c3p0.idle_connection_test_period = 3600 +persistence.hibernate.connectionpool.c3p0.test_connection_on_checkin = true +persistence.hibernate.connectionpool.c3p0.test_connection_on_checkout = false +persistence.hibernate.connectionpool.c3p0.preferred_test_query = select 1 +########################Persistence/Hibernate/Connection pool#################### \ No newline at end of file From 6b72242c2eb7dd0957d3adadb4248aa0c3075c8f Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 16 Nov 2017 23:27:23 +0100 Subject: [PATCH 16/24] added Creator column on {DMP, DATASET and PROJECT} --- dmp-db-scema/DataManagementPlanDB.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dmp-db-scema/DataManagementPlanDB.sql b/dmp-db-scema/DataManagementPlanDB.sql index 15d640f21..7b69f63c5 100644 --- a/dmp-db-scema/DataManagementPlanDB.sql +++ b/dmp-db-scema/DataManagementPlanDB.sql @@ -50,6 +50,7 @@ CREATE TABLE "DMP" ( "Version" integer NOT NULL, "Project" uuid NOT NULL, "ProfileData" xml, + "Creator" uuid not null, "Status" smallint not null default 0, "Created" timestamp not null default NOW(), "Modified" timestamp not null default NOW(), @@ -116,6 +117,7 @@ CREATE TABLE "Dataset" ( "Uri" character varying(250), "Properties" xml, "Reference" xml, + "Creator" uuid not null, "Status" smallint not null default 0, "Created" timestamp not null default NOW(), "Modified" timestamp not null default NOW(), From 67d95de255b68921006b654ecd6bc171a8e3c549 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Fri, 17 Nov 2017 00:13:39 +0100 Subject: [PATCH 17/24] added foreign keys --- dmp-db-scema/DataManagementPlanDB.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dmp-db-scema/DataManagementPlanDB.sql b/dmp-db-scema/DataManagementPlanDB.sql index 7b69f63c5..7c49dfbb8 100644 --- a/dmp-db-scema/DataManagementPlanDB.sql +++ b/dmp-db-scema/DataManagementPlanDB.sql @@ -537,6 +537,12 @@ ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_user FOREIGN KEY (usr) REFEREN ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_dmp FOREIGN KEY (dmp) REFERENCES "DMP"("ID"); +ALTER TABLE "DMP" ADD CONSTRAINT fk_dmp_creator FOREIGN KEY ("Creator") REFERENCES "UserInfo"(id); +ALTER TABLE "Dataset" ADD CONSTRAINT fk_dataset_creator FOREIGN KEY ("Creator") REFERENCES "UserInfo"(id); +ALTER TABLE "Project" ADD CONSTRAINT fk_project_creator FOREIGN KEY ("CreationUser") REFERENCES "UserInfo"(id); + + + ALTER TABLE "UserInfo" OWNER TO dmptool; ALTER TABLE "UserAuth" OWNER TO dmptool; ALTER TABLE "UserDMP" OWNER TO dmptool; From 946a626789a89aa017eb64b6d5bb9b5cae31878c Mon Sep 17 00:00:00 2001 From: satyr Date: Fri, 17 Nov 2017 02:43:16 +0200 Subject: [PATCH 18/24] - --- .../src/main/java/dao/entities/DMPDao.java | 2 +- .../main/java/dao/entities/DMPDaoImpl.java | 18 ++++++++++++++++ .../main/java/dao/entities/ProjectDao.java | 2 ++ .../java/dao/entities/ProjectDaoImpl.java | 20 ++++++++++++++++++ dmp-backend/src/main/java/entities/DMP.java | 16 +++++++++++++- .../src/main/java/entities/Dataset.java | 15 +++++++++++-- .../src/main/java/entities/Project.java | 17 ++++++++------- .../src/main/java/rest/entities/DMPs.java | 7 +++++-- .../src/main/java/rest/entities/Datasets.java | 21 +++++++++++++++++++ .../src/main/java/rest/entities/Projects.java | 14 ++++++++++++- 10 files changed, 117 insertions(+), 15 deletions(-) diff --git a/dmp-backend/src/main/java/dao/entities/DMPDao.java b/dmp-backend/src/main/java/dao/entities/DMPDao.java index 07b533143..1bc531e8b 100644 --- a/dmp-backend/src/main/java/dao/entities/DMPDao.java +++ b/dmp-backend/src/main/java/dao/entities/DMPDao.java @@ -15,6 +15,6 @@ public interface DMPDao extends Dao { List listAllIDsLabels(); - + List getDMPsOfUser(String userID); } \ No newline at end of file diff --git a/dmp-backend/src/main/java/dao/entities/DMPDaoImpl.java b/dmp-backend/src/main/java/dao/entities/DMPDaoImpl.java index 7553b7cd5..c3b1b83a7 100644 --- a/dmp-backend/src/main/java/dao/entities/DMPDaoImpl.java +++ b/dmp-backend/src/main/java/dao/entities/DMPDaoImpl.java @@ -41,6 +41,24 @@ public class DMPDaoImpl extends JpaDao implements DMPDao { .collect(Collectors.toList()); } + @Override + public List getDMPsOfUser(String userID) { + + String queryString = "select dmp from DMP dmp where dmp.creator.id=:userid and dmp.status >= 0"; + TypedQuery typedQuery = entityManager.createQuery(queryString, DMP.class); + typedQuery.setParameter("userid", UUID.fromString(userID)); + try { + return typedQuery.getResultList(); + } + catch(Exception ex) { //no need to distinguish between exceptions for the moment + ex.printStackTrace(); + return null; + } + + + } + + } diff --git a/dmp-backend/src/main/java/dao/entities/ProjectDao.java b/dmp-backend/src/main/java/dao/entities/ProjectDao.java index 5591c76d2..376a38c0c 100644 --- a/dmp-backend/src/main/java/dao/entities/ProjectDao.java +++ b/dmp-backend/src/main/java/dao/entities/ProjectDao.java @@ -13,4 +13,6 @@ public interface ProjectDao extends Dao { public List listAllIDsLabels(); + public List getProjectsOfUser(String userID); + } \ No newline at end of file diff --git a/dmp-backend/src/main/java/dao/entities/ProjectDaoImpl.java b/dmp-backend/src/main/java/dao/entities/ProjectDaoImpl.java index 6aa4f394d..bdd2ce37c 100644 --- a/dmp-backend/src/main/java/dao/entities/ProjectDaoImpl.java +++ b/dmp-backend/src/main/java/dao/entities/ProjectDaoImpl.java @@ -9,6 +9,7 @@ import javax.persistence.TypedQuery; import org.hibernate.query.Query; import dao.JpaDao; +import entities.DMP; import entities.Project; import entities.responses.IDLabelPair; @@ -38,5 +39,24 @@ public class ProjectDaoImpl extends JpaDao implements ProjectDao .collect(Collectors.toList()); } + + public List getProjectsOfUser(String userID){ + + String queryString = "select p from Project p where p.creationUser.id=:userid and project.status >= 0"; + TypedQuery typedQuery = entityManager.createQuery(queryString, Project.class); + typedQuery.setParameter("userid", UUID.fromString(userID)); + try { + return typedQuery.getResultList(); + } + catch(Exception ex) { //no need to distinguish between exceptions for the moment + ex.printStackTrace(); + return null; + } + + } + + + + } diff --git a/dmp-backend/src/main/java/entities/DMP.java b/dmp-backend/src/main/java/entities/DMP.java index 0932e6666..561555644 100644 --- a/dmp-backend/src/main/java/entities/DMP.java +++ b/dmp-backend/src/main/java/entities/DMP.java @@ -77,6 +77,11 @@ public class DMP implements Serializable { private DMPProfile profile; + @OneToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "\"Creator\"", nullable = true) + private UserInfo creator; + + @OneToMany(fetch = FetchType.LAZY) @JoinTable(name="\"DMPOrganisation\"", joinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}, @@ -125,7 +130,16 @@ public class DMP implements Serializable { this.description = description; } - + + public UserInfo getCreator() { + return creator; + } + + + public void setCreator(UserInfo creator) { + this.creator = creator; + } + public Short getStatus() { return status; diff --git a/dmp-backend/src/main/java/entities/Dataset.java b/dmp-backend/src/main/java/entities/Dataset.java index 71b439ad8..dd55f1457 100644 --- a/dmp-backend/src/main/java/entities/Dataset.java +++ b/dmp-backend/src/main/java/entities/Dataset.java @@ -106,6 +106,10 @@ public class Dataset implements Serializable { @Column(name = "\"Modified\"") private Date modified = new Date(); + @OneToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "\"Creator\"", nullable = true) + private UserInfo creator; + @Column(name = "\"Description\"") private String description; @@ -113,13 +117,20 @@ public class Dataset implements Serializable { public String getDescription() { return description; } - - + public void setDescription(String description) { this.description = description; } + public UserInfo getCreator() { + return creator; + } + + public void setCreator(UserInfo creator) { + this.creator = creator; + } + public Short getStatus() { return status; } diff --git a/dmp-backend/src/main/java/entities/Project.java b/dmp-backend/src/main/java/entities/Project.java index ff5bbebae..e79ce8792 100644 --- a/dmp-backend/src/main/java/entities/Project.java +++ b/dmp-backend/src/main/java/entities/Project.java @@ -80,9 +80,11 @@ public class Project implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Type(type="org.hibernate.type.PostgresUUIDType") - @Column(name = "\"CreationUser\"") - private UUID creationUser; + + @OneToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "\"CreationUser\"", nullable = true) + private UserInfo creationUser; + @Column(name = "\"Created\"") private Date created = null; @@ -210,15 +212,14 @@ public class Project implements Serializable { public void setDmps(Set dmps) { this.dmps = dmps; } - - - - public UUID getCreationUser() { + + + public UserInfo getCreationUser() { return creationUser; } - public void setCreationUser(UUID creationUser) { + public void setCreationUser(UserInfo creationUser) { this.creationUser = creationUser; } diff --git a/dmp-backend/src/main/java/rest/entities/DMPs.java b/dmp-backend/src/main/java/rest/entities/DMPs.java index f7f4abc95..0ad83aa16 100644 --- a/dmp-backend/src/main/java/rest/entities/DMPs.java +++ b/dmp-backend/src/main/java/rest/entities/DMPs.java @@ -153,7 +153,6 @@ public class DMPs { addNullAndForeignElems(previousDmp, dmp); - try { DMP updatedDMP = dMPDao.update(dmp); return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(updatedDMP)); @@ -233,7 +232,8 @@ public class DMPs { } try { - List nonDeleted = userInfoDao.getDmpsOfUser(userID); + //List nonDeleted = userInfoDao.getDmpsOfUser(userID); + List nonDeleted = dMPDao.getDMPsOfUser(userID); return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(nonDeleted)); } catch(Exception ex) { @@ -262,6 +262,8 @@ public class DMPs { dmp.setId(null); + dmp.setCreator(userInfo); + Set users = new HashSet(); users.add(userInfo); dmp.setUsers(users); @@ -269,6 +271,7 @@ public class DMPs { dmp.setCreated(new Date()); dmp.setModified(new Date()); dmp.setStatus(new Short("0")); + dmp.setProfileData(null); DMP newdmp = dMPDao.create(dmp); diff --git a/dmp-backend/src/main/java/rest/entities/Datasets.java b/dmp-backend/src/main/java/rest/entities/Datasets.java index 3bc26d569..c5818b6a6 100644 --- a/dmp-backend/src/main/java/rest/entities/Datasets.java +++ b/dmp-backend/src/main/java/rest/entities/Datasets.java @@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PathVariable; @@ -43,6 +44,7 @@ import dao.entities.ProjectDao; import dao.entities.RegistryDao; import dao.entities.ResearcherDao; import dao.entities.ServiceDao; +import dao.entities.UserInfoDao; import entities.DMP; import entities.DMPProfile; import entities.Dataset; @@ -51,6 +53,7 @@ import entities.DatasetProfileRuleset; import entities.DatasetProfileViewstyle; import entities.Organisation; import entities.Project; +import entities.UserInfo; import helpers.SafeCleanAttribs; import helpers.SerializerProvider; import helpers.Transformers; @@ -73,6 +76,7 @@ public class Datasets { @Autowired private RegistryDao registryDao; @Autowired private ResearcherDao researcherDao; @Autowired private ServiceDao serviceDao; + @Autowired private UserInfoDao userInfoDao; // FETCH BY DATASET(S) @@ -124,10 +128,27 @@ public class Datasets { @RequestMapping(method = RequestMethod.POST, value = { "/dataset/create" }, consumes = "application/json", produces="application/json") public @ResponseBody ResponseEntity createDataset(@RequestBody Dataset dataset) { + + + String userID = null; + try { + userID = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString(); + } catch(NullPointerException ex) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here"); + } + + UserInfo userInfo = userInfoDao.read(UUID.fromString(userID)); + + if(userInfo==null) //this should normally never happer + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here"); + + + dataset.setId(null); dataset.setCreated(new Date()); dataset.setModified(new Date()); dataset.setStatus(new Short("0")); + dataset.setCreator(userInfo); try { dataset = datasetDao.create(dataset); return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(dataset)); diff --git a/dmp-backend/src/main/java/rest/entities/Projects.java b/dmp-backend/src/main/java/rest/entities/Projects.java index 2679270ba..80bec6518 100644 --- a/dmp-backend/src/main/java/rest/entities/Projects.java +++ b/dmp-backend/src/main/java/rest/entities/Projects.java @@ -219,6 +219,17 @@ public class Projects { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here"); + try { + List userProjects = projectDao.getProjectsOfUser(userID); + return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(userProjects)); + } + catch(Exception ex) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage()); + } + + + /* + * OLD ONE Map userProjects = new HashMap(); userInfo.getDmps().forEach( dmp -> { @@ -232,6 +243,7 @@ public class Projects { catch(Exception ex) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage()); } + */ } @@ -257,7 +269,7 @@ public class Projects { project.setId(null); project.setStatus(new Short("0")); - project.setCreationUser(userInfo.getId()); + project.setCreationUser(userInfo); project.setCreated(new Date()); project.setModified(new Date()); From c2fc7a6fe8de37ccaadd667304f6235efc957b2b Mon Sep 17 00:00:00 2001 From: satyr Date: Fri, 17 Nov 2017 02:48:09 +0200 Subject: [PATCH 19/24] - --- dmp-backend/src/main/java/rest/entities/DMPs.java | 1 - 1 file changed, 1 deletion(-) diff --git a/dmp-backend/src/main/java/rest/entities/DMPs.java b/dmp-backend/src/main/java/rest/entities/DMPs.java index 0ad83aa16..254dbf304 100644 --- a/dmp-backend/src/main/java/rest/entities/DMPs.java +++ b/dmp-backend/src/main/java/rest/entities/DMPs.java @@ -271,7 +271,6 @@ public class DMPs { dmp.setCreated(new Date()); dmp.setModified(new Date()); dmp.setStatus(new Short("0")); - dmp.setProfileData(null); DMP newdmp = dMPDao.create(dmp); From 0c424db7cfc7cb2e4ebe3827161d65e668b1b956 Mon Sep 17 00:00:00 2001 From: satyr Date: Fri, 17 Nov 2017 03:15:09 +0200 Subject: [PATCH 20/24] -- --- .../src/app/datasets/dataset.component.ts | 16 +++++++++++++--- dmp-frontend/src/app/dmps/dmp.component.ts | 9 +++++++-- .../src/app/pipes/project-table-filter.pipe.ts | 2 +- dmp-frontend/src/app/projects/project.html | 2 +- dmp-frontend/src/app/services/rest-base.ts | 9 +++++++-- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts index fd8746660..84f26198e 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.ts +++ b/dmp-frontend/src/app/datasets/dataset.component.ts @@ -140,8 +140,11 @@ export class DatasetsComponent implements OnInit { } else{ - this.dataset.dmp = { "id": this.dmpIdforDatasets } - this.dataset.profile = { "id": this.dataset.profile } + + this.dataset.dmp = { "id": this.dmpIdforDatasets }; + this.dataset.profile = { "id": this.dataset.profile }; + this.dataset.creator = {"id" : this.dataset.creator }; + this.serverService.updateDatsetsProfile(this.dataset).subscribe( response => { simple_notifier("success",null,"Dataset edited"); @@ -203,6 +206,7 @@ export class DatasetsComponent implements OnInit { //this.dataset.dmp = item.dmp; this.dataset.profile = item.profile==null ? null : item.profile.id; this.dataset.id = item.id; + this.dataset.creator = item.creator; $("#newDatasetModal").modal("show"); } else if(event.toElement.id == "describeDataset"){ @@ -245,7 +249,13 @@ export class DatasetsComponent implements OnInit { this.getDatasets(); }, err => { - simple_notifier("danger",null,"Could not delete the dataset"); + + if(err.status>=200 && err.status<300) + simple_notifier("success",null,"Deleted dataset"); + else + simple_notifier("danger",null,"Could not delete the dataset"); + this.getDatasets(); + } ); } diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts index c0e75f764..904a66c79 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.ts +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -73,7 +73,7 @@ export class DmpComponent implements OnInit{ label: '', previous:'', version:'', - profileData:'', + //profileData:'', //project: '', //profile:{} } @@ -140,6 +140,7 @@ export class DmpComponent implements OnInit{ updateDMP(){ this.dmp.project = {"id":this.dmp.project}; + this.dmp.creator = {"id": this.dmp.creator}; this.serverService.updateDmp(this.dmp) .subscribe( @@ -216,7 +217,11 @@ export class DmpComponent implements OnInit{ this.getDmps(); }, (err: HttpErrorResponse) => { - simple_notifier("danger",null,"Failed to delete the DMP"); + if(err.status>=200 && err.status<300) + simple_notifier("success",null,"Successfully deleted the DMP"); + else + simple_notifier("danger",null,"Failed to delete the DMP"); + this.getDmps(); } ); diff --git a/dmp-frontend/src/app/pipes/project-table-filter.pipe.ts b/dmp-frontend/src/app/pipes/project-table-filter.pipe.ts index 4ce000575..e1b667b5d 100644 --- a/dmp-frontend/src/app/pipes/project-table-filter.pipe.ts +++ b/dmp-frontend/src/app/pipes/project-table-filter.pipe.ts @@ -13,7 +13,7 @@ export class ProjectTableFilterPipe implements PipeTransform { return _.filter(array, row => { if(onlyMyProjects){ - return (row.label.indexOf(query) > -1) && (row.creationUser==userid); + return (row.label.indexOf(query) > -1) && (row.creationUser.id==userid); } else{ return row.label.indexOf(query) > -1; diff --git a/dmp-frontend/src/app/projects/project.html b/dmp-frontend/src/app/projects/project.html index 3685db049..85bcee400 100644 --- a/dmp-frontend/src/app/projects/project.html +++ b/dmp-frontend/src/app/projects/project.html @@ -60,7 +60,7 @@
{{project?.status | statusToString}} {{(project?.description?.length > 40) ? (project?.description | slice:0:40)+'...':(project?.description) }} - +