From 9428ab55a9906a96ede4373f1b13fe050423a4dc Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Mon, 6 Nov 2017 15:11:03 +0200 Subject: [PATCH] Implemented a workspace component --- dmp-frontend/src/app/app-routing.module.ts | 13 +++++++--- dmp-frontend/src/app/app.component.html | 8 +++--- dmp-frontend/src/app/app.module.ts | 4 +++ .../src/app/datasets/dataset.component.ts | 22 +++++++++++++--- dmp-frontend/src/app/datasets/dataset.html | 11 ++++---- dmp-frontend/src/app/dmps/dmp.component.ts | 18 +++++++++++++ dmp-frontend/src/app/dmps/dmps.html | 3 +-- dmp-frontend/src/app/empty.component.ts | 6 +++++ .../googgle-sign-in.component.ts | 2 +- .../main-sign-in/main-sign-in.component.ts | 6 ++++- .../app/pipes/dataset-status-filter.pipe.ts | 8 +++--- .../app/pipes/dataset-table-filter.pipe.ts | 7 +++-- dmp-frontend/src/app/services/rest-base.ts | 6 ++--- .../src/app/services/server.service.ts | 8 ++++++ .../user-workspace.component.css | 0 .../user-workspace.component.html | 26 +++++++++++++++++++ .../user-workspace.component.spec.ts | 25 ++++++++++++++++++ .../user-workspace.component.ts | 19 ++++++++++++++ 18 files changed, 158 insertions(+), 34 deletions(-) create mode 100644 dmp-frontend/src/app/empty.component.ts create mode 100644 dmp-frontend/src/app/user-workspace/user-workspace.component.css create mode 100644 dmp-frontend/src/app/user-workspace/user-workspace.component.html create mode 100644 dmp-frontend/src/app/user-workspace/user-workspace.component.spec.ts create mode 100644 dmp-frontend/src/app/user-workspace/user-workspace.component.ts diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index abbcf9ee3..ab3af942c 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -1,27 +1,32 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { PageNotFoundComponent } from './not-found.component'; +import { EmptyComponent } from './empty.component'; import { DynamicFormComponent } from './form/dynamic-form.component'; import { AuthGuard } from './guards/auth.guard'; import { ProjectsComponent } from './projects/projects.component'; import { DatasetsComponent } from './datasets/dataset.component'; 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'; const appRoutes: Routes = [ { path: 'dynamic-form', component: DynamicFormComponent, canActivate: [AuthGuard] }, { path: 'login', component: MainSignInComponent}, - { path: 'projects', component: ProjectsComponent}, - { path: 'dmps', component: DmpComponent}, - { path: '', redirectTo: '/login', pathMatch: 'full' }, + //{ path: 'projects', component: ProjectsComponent}, + //{ path: 'dmps', component: DmpComponent}, + { path: 'workspace', component: UserWorkspaceComponent}, + //{ path: '', component: EmptyComponent}, + //{ path: '', redirectTo: '/login', pathMatch: 'full' }, { path: '**', component: PageNotFoundComponent }, + /* { path: '', redirectTo: 'app-root', pathMatch: 'full' } - + */ ]; @NgModule({ diff --git a/dmp-frontend/src/app/app.component.html b/dmp-frontend/src/app/app.component.html index 4d428c521..10d34c8ea 100644 --- a/dmp-frontend/src/app/app.component.html +++ b/dmp-frontend/src/app/app.component.html @@ -44,10 +44,10 @@
- About - Services - Clients - Contact + My Workspace + Orphan Datasets + Clients + Contact
diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index ec617c3eb..ada17b51e 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -21,6 +21,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 { TocComponent } from './form/tableOfContents/toc.component'; import { PaginationService } from './services/pagination.service'; @@ -60,6 +61,7 @@ import { ModalComponent } from './modal/modal.component'; import { StatusToString } from './pipes/various/status-to-string'; import { SidebarModule } from 'ng-sidebar'; +import { UserWorkspaceComponent } from './user-workspace/user-workspace.component'; @@ -75,11 +77,13 @@ import { SidebarModule } from 'ng-sidebar'; GooggleSignInComponent, MainSignInComponent, PageNotFoundComponent, + EmptyComponent, ModalComponent, ProjectDetailComponent, ProjectsComponent, DmpComponent, DatasetsComponent, + UserWorkspaceComponent, ProjectTableFilterPipe, DmpVersionFilterPipe, diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts index b8d4deae9..89c47d5f9 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.ts +++ b/dmp-frontend/src/app/datasets/dataset.component.ts @@ -87,8 +87,7 @@ export class DatasetsComponent implements OnInit { this.datasetProfileDropDown.options = []; this.saveAndDescribe = false; this.statusDropDown = new DropdownField(); - this.statusDropDown.options =[]; - this.statusDropDown.options= [{key:'0', value:"active"},{key:'1', value:"inactive"}] + this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}] } @@ -115,6 +114,7 @@ export class DatasetsComponent implements OnInit { ) } + SaveDataset(){ if(this.dataset.id ==null){ this.dataset.dmp = { "id": this.dmpIdforDatasets } @@ -130,7 +130,6 @@ export class DatasetsComponent implements OnInit { $("#newDatasetModal").modal("hide"); } - else{ this.dataset.dmp = { "id": this.dmpIdforDatasets } this.dataset.profile = { "id": this.dataset.profile } @@ -166,10 +165,11 @@ export class DatasetsComponent implements OnInit { editRow(item, event) { if (event.toElement.id == "editDataset"){ + this.dataset = item; this.dataset.label = item.label; this.dataset.uri = item.uri; //this.dataset.dmp = item.dmp; - this.dataset.profile = item.profile.id; + this.dataset.profile = item.profile==null ? null : item.profile.id; this.dataset.id = item.id; $("#newDatasetModal").modal("show"); } @@ -196,4 +196,18 @@ export class DatasetsComponent implements OnInit { this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profile.id, datasetId:item.id}])); } + deleteRow(dataset, $event){ + this.serverService.deleteDataset(dataset).subscribe( + response => { + console.log("Deleted Successfully the dataset") + }, + err => { + console.log("Could not delete the dataset") + } + ); + this.getDatasets(); + } + + + } diff --git a/dmp-frontend/src/app/datasets/dataset.html b/dmp-frontend/src/app/datasets/dataset.html index 3a417d6a7..6320a38e1 100644 --- a/dmp-frontend/src/app/datasets/dataset.html +++ b/dmp-frontend/src/app/datasets/dataset.html @@ -10,10 +10,9 @@ - - +