diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts index de4630a8b..976c8d77f 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.ts +++ b/dmp-frontend/src/app/datasets/dataset.component.ts @@ -104,9 +104,6 @@ export class DatasetsComponent implements OnInit { this.serverService.getAllDatsetsProfile().subscribe( response => { - console.log("response"); - console.log(response); - //let params = new Param(); response.forEach((datasetprofile) => { let params = new Param(); params.key = datasetprofile.id; @@ -118,62 +115,42 @@ export class DatasetsComponent implements OnInit { ) } - selectDataset(item) { - this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profileId, datasetId:item.id, datasetProperties:item.properties}])); - } - - SaveNewDataset() { - this.dataset.dmp = { "id": this.dmpIdforDatasets } - this.dataset.profile = { "id": this.dataset.profile } - this.serverService.createDatasetForDmp(this.dataset).subscribe( - response => { - console.log(response); - //if (this.saveAndDescribe == true) - //this.describeDataset(); PWS THA VRISKOUME TO ITEM GIA NA ANOIGEI TO SWSTO DATASET??? - } - ) - $("#newDatasetModal").modal("hide"); - this.CallDatasets(); - } - - SaveEditedDataset(){ - this.dataset.dmp = { "id": this.dmpIdforDatasets } - this.dataset.profile = { "id": this.dataset.profile } - this.serverService.updateDatsetsProfile(this.dataset).subscribe( - response => { - console.log(response); - - } - ) - $("#newDatasetModal").modal("hide"); - this.CallDatasets(); - } - SaveDataset(){ - if(this.dataset.id ==null) - this.SaveNewDataset(); - else - this.SaveEditedDataset(); + if(this.dataset.id ==null){ + this.dataset.dmp = { "id": this.dmpIdforDatasets } + this.dataset.profile = { "id": this.dataset.profile } + this.serverService.createDatasetForDmp(this.dataset).subscribe( + response => { + console.log(response); + this.getDatasets(); + if (this.saveAndDescribe == true) + this.describeDataset(response); + } + ) + $("#newDatasetModal").modal("hide"); + + } + + else{ + this.dataset.dmp = { "id": this.dmpIdforDatasets } + this.dataset.profile = { "id": this.dataset.profile } + this.serverService.updateDatsetsProfile(this.dataset).subscribe( + response => { + console.log(response); + this.getDatasets(); + if (this.saveAndDescribe == true) + this.describeDataset(response); + } + ) + $("#newDatasetModal").modal("hide"); + } + } - CallDatasets(){ + getDatasets(){ this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe( - response => { - - console.log("response"); - console.log(response); - this.datasets = []; - response.forEach(resp => { - - let dt = new Dataset(); - dt.id = resp.id; - dt.name = resp.label; - dt.uriDataset = resp.uri; - dt.dmp = resp.dmp.label; - dt.profile = resp.profile.label; - dt.profileId = resp.profile.id; - this.datasets.push(dt); - }); + response => { + this.tableData = response; } ); } @@ -198,13 +175,19 @@ export class DatasetsComponent implements OnInit { ); } - editRow(item) { debugger; - this.dataset.label = item.label; - this.dataset.uri = item.uri; - //this.dataset.dmp = item.dmp; - this.dataset.profile = item.profile.id; - this.dataset.id = item.id; - $("#newDatasetModal").modal("show"); + editRow(item, event) { debugger; + if (event.toElement.id == "editDataset"){ + this.dataset.label = item.label; + this.dataset.uri = item.uri; + //this.dataset.dmp = item.dmp; + this.dataset.profile = item.profile.id; + this.dataset.id = item.id; + $("#newDatasetModal").modal("show"); + } + else if(event.toElement.id == "describeDataset"){ + this.describeDataset(item); + } + } newDataset() { @@ -220,8 +203,8 @@ export class DatasetsComponent implements OnInit { this.SaveDataset(); } - describeDataset(item) { - this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profileId, datasetId:item.id, datasetProperties:item.properties}])); + describeDataset(item) {debugger; + this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profile.id, datasetId:item.id}])); } } diff --git a/dmp-frontend/src/app/datasets/dataset.html b/dmp-frontend/src/app/datasets/dataset.html index f90a748bd..8ffe6586f 100644 --- a/dmp-frontend/src/app/datasets/dataset.html +++ b/dmp-frontend/src/app/datasets/dataset.html @@ -1,8 +1,5 @@ -
- - - @@ -11,13 +8,13 @@ diff --git a/dmp-frontend/src/app/datasets/dataset.module.ts b/dmp-frontend/src/app/datasets/dataset.module.ts index 331b28929..688158eff 100644 --- a/dmp-frontend/src/app/datasets/dataset.module.ts +++ b/dmp-frontend/src/app/datasets/dataset.module.ts @@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import {DataTableModule} from 'angular2-datatable'; import { DatasetTableFilterPipe } from '../pipes/dataset-table-filter.pipe'; +import { DatasetStatusFilterPipe } from '../pipes/dataset-status-filter.pipe'; import { DatasetsComponent } from './dataset.component'; @@ -18,7 +19,8 @@ import { DatasetRoutingModule } from './dataset-routing.module'; ], declarations: [ DatasetsComponent, - DatasetTableFilterPipe + DatasetTableFilterPipe, + DatasetStatusFilterPipe //ProjectDetailComponent ], providers: [ ], diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts index 42d90049f..b4f981f99 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.ts +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -42,18 +42,16 @@ export class DmpComponent implements OnInit{ //visibility rules for containers tableVisible: boolean = true; - editorVisible: boolean = false; + editorVisible: boolean = true; // for tableIds showIDs : boolean = false; // END ALTERNATIVE - - - //@Input() dmps: Dmp[]; dmp:any; + @Input() dmpTableVisible: boolean; @Input() dmpCount = 0; @Input() projectsDropDown:DropdownField; @Input() dataSetVisibe:boolean; @@ -76,6 +74,7 @@ export class DmpComponent implements OnInit{ this.projectsDropDown = new DropdownField(); this.projectsDropDown.options = []; //this.projects = []; + this.dmpTableVisible = false; this.dataSetVisibe = false; this.dmp = { id:null, @@ -232,9 +231,6 @@ newDmp(item){ $("#newDmpModal").modal("show"); } -refreshTable(){ - this.getDmps(); -} } diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html index eda2bb270..14e01277d 100644 --- a/dmp-frontend/src/app/dmps/dmps.html +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -1,6 +1,7 @@ - +
+
- -
@@ -12,7 +13,7 @@ @@ -74,7 +75,7 @@
-
- +
- +
diff --git a/dmp-frontend/src/app/pipes/dataset-status-filter.pipe.ts b/dmp-frontend/src/app/pipes/dataset-status-filter.pipe.ts new file mode 100644 index 000000000..381ca2f71 --- /dev/null +++ b/dmp-frontend/src/app/pipes/dataset-status-filter.pipe.ts @@ -0,0 +1,26 @@ +import * as _ from "lodash"; +import { Pipe, PipeTransform } from "@angular/core"; + +@Pipe({ + name: "datasetstatusFilter" +}) +export class DatasetStatusFilterPipe implements PipeTransform { + + transform(array: any[], status: string): any { + debugger; + + if (status) { + + return _.filter(array, row => { + return ( + row.uri.indexOf(status) > -1 || + + //row.version == query || + row.id.indexOf(status) > -1 + ) + }); + + } + return array; + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/pipes/dataset-table-filter.pipe.ts b/dmp-frontend/src/app/pipes/dataset-table-filter.pipe.ts index 690a91256..7b8da8f35 100644 --- a/dmp-frontend/src/app/pipes/dataset-table-filter.pipe.ts +++ b/dmp-frontend/src/app/pipes/dataset-table-filter.pipe.ts @@ -2,7 +2,7 @@ import * as _ from "lodash"; import {Pipe, PipeTransform} from "@angular/core"; @Pipe({ - name: "dmpTableFilter" + name: "datasetTableFilter" }) export class DatasetTableFilterPipe implements PipeTransform { diff --git a/dmp-frontend/src/app/projects/project.html b/dmp-frontend/src/app/projects/project.html index 407e64e9b..7da2309dd 100644 --- a/dmp-frontend/src/app/projects/project.html +++ b/dmp-frontend/src/app/projects/project.html @@ -9,7 +9,7 @@ - diff --git a/dmp-frontend/src/app/projects/projects.component.ts b/dmp-frontend/src/app/projects/projects.component.ts index 2bd40a3e1..6214acbd5 100644 --- a/dmp-frontend/src/app/projects/projects.component.ts +++ b/dmp-frontend/src/app/projects/projects.component.ts @@ -87,39 +87,45 @@ export class ProjectsComponent implements OnInit{ gapi.load('auth2', function() { gapi.auth2.init({}); }); + this.getProjects(); //this.projects = this.serverService.getDummyProjects(); this.projects = []; - this.serverService.getProjectOfUer().subscribe( //getProjects() - response => { - this.tableData = response; - - response.forEach(resp => { - let pr = new Project(); - pr.id = resp.id; - pr.label = resp.label; - pr.abbreviation = resp.abbreviation; - pr.definition = resp.definition; - pr.uri = resp.uri; - this.projects.push(pr); - } - ); - } - // (err: HttpErrorResponse) => { - // if (err.error instanceof Error) { - // // A client-side or network error occurred. Handle it accordingly. - // console.log('An error occurred:', err.error.message); - // } else { - // // The backend returned an unsuccessful response code. - // // The response body may contain clues as to what went wrong, - // if(err.status == 401){ - // this.isignOutBtn.nativeElement.click(); - // } - // console.log(`Backend returned code ${err.status}, body was: ${err.error}`); - // } - // } - ); + } +getProjects(){ + this.serverService.getProjectOfUer().subscribe( //getProjects() + response => { + this.tableData = response; + + response.forEach(resp => { + let pr = new Project(); + pr.id = resp.id; + pr.label = resp.label; + pr.abbreviation = resp.abbreviation; + pr.definition = resp.definition; + pr.uri = resp.uri; + this.projects.push(pr); + } + ); + } + // (err: HttpErrorResponse) => { + // if (err.error instanceof Error) { + // // A client-side or network error occurred. Handle it accordingly. + // console.log('An error occurred:', err.error.message); + // } else { + // // The backend returned an unsuccessful response code. + // // The response body may contain clues as to what went wrong, + // if(err.status == 401){ + // this.isignOutBtn.nativeElement.click(); + // } + // console.log(`Backend returned code ${err.status}, body was: ${err.error}`); + // } + // } +); +} + + getDMPs(){ this.serverService.listDmpsLabelID().subscribe( response =>{