filters, enhancements
This commit is contained in:
parent
c09cd7305c
commit
1e06430280
|
@ -104,9 +104,6 @@ export class DatasetsComponent implements OnInit {
|
||||||
|
|
||||||
this.serverService.getAllDatsetsProfile().subscribe(
|
this.serverService.getAllDatsetsProfile().subscribe(
|
||||||
response => {
|
response => {
|
||||||
console.log("response");
|
|
||||||
console.log(response);
|
|
||||||
//let params = new Param();
|
|
||||||
response.forEach((datasetprofile) => {
|
response.forEach((datasetprofile) => {
|
||||||
let params = new Param();
|
let params = new Param();
|
||||||
params.key = datasetprofile.id;
|
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(){
|
SaveDataset(){
|
||||||
if(this.dataset.id ==null)
|
if(this.dataset.id ==null){
|
||||||
this.SaveNewDataset();
|
this.dataset.dmp = { "id": this.dmpIdforDatasets }
|
||||||
else
|
this.dataset.profile = { "id": this.dataset.profile }
|
||||||
this.SaveEditedDataset();
|
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(
|
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
|
||||||
response => {
|
response => {
|
||||||
|
this.tableData = 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);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -198,13 +175,19 @@ export class DatasetsComponent implements OnInit {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
editRow(item) { debugger;
|
editRow(item, event) { debugger;
|
||||||
this.dataset.label = item.label;
|
if (event.toElement.id == "editDataset"){
|
||||||
this.dataset.uri = item.uri;
|
this.dataset.label = item.label;
|
||||||
//this.dataset.dmp = item.dmp;
|
this.dataset.uri = item.uri;
|
||||||
this.dataset.profile = item.profile.id;
|
//this.dataset.dmp = item.dmp;
|
||||||
this.dataset.id = item.id;
|
this.dataset.profile = item.profile.id;
|
||||||
$("#newDatasetModal").modal("show");
|
this.dataset.id = item.id;
|
||||||
|
$("#newDatasetModal").modal("show");
|
||||||
|
}
|
||||||
|
else if(event.toElement.id == "describeDataset"){
|
||||||
|
this.describeDataset(item);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newDataset() {
|
newDataset() {
|
||||||
|
@ -220,8 +203,8 @@ export class DatasetsComponent implements OnInit {
|
||||||
this.SaveDataset();
|
this.SaveDataset();
|
||||||
}
|
}
|
||||||
|
|
||||||
describeDataset(item) {
|
describeDataset(item) {debugger;
|
||||||
this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profileId, datasetId:item.id, datasetProperties:item.properties}]));
|
this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profile.id, datasetId:item.id}]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<div style="margin: auto; max-width: 1000px; margin-top:50px">
|
|
||||||
|
|
||||||
|
<table class="table table-striped" [mfData]="tableData | datasetTableFilter : filterQuery | datasetstatusFilter: statusFilter" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
|
||||||
|
|
||||||
<table class="table table-striped" [mfData]="tableData | dmpTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
|
|
||||||
[(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
|
[(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -11,13 +8,13 @@
|
||||||
</th>
|
</th>
|
||||||
<th colspan="1">
|
<th colspan="1">
|
||||||
<!-- <input class="form-control" [(ngModel)]="versionFilter" placeholder='Filter' /> -->
|
<!-- <input class="form-control" [(ngModel)]="versionFilter" placeholder='Filter' /> -->
|
||||||
<select class="form-control" [id]="statusid" [(ngModel)]="statusDropDownkey" [name]="statusDropDown"
|
<select class="form-control" [id]="statusid" [(ngModel)]="statusFilter" [name]="statusDropDown"
|
||||||
#datasetfield >
|
#datasetfield >
|
||||||
<option *ngFor="let opt of statusDropDown.options" [value]="opt.key">{{opt.value}}</option>
|
<option *ngFor="let opt of statusDropDown.options" [value]="opt.key">{{opt.value}}</option>
|
||||||
</select>
|
</select>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<button class="btn btn-default" (click)="refreshTable($event)">
|
<button class="btn btn-default" (click)="getDatasets()">
|
||||||
<span class="glyphicon glyphicon-refresh"></span>
|
<span class="glyphicon glyphicon-refresh"></span>
|
||||||
</button>
|
</button>
|
||||||
</th>
|
</th>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import {DataTableModule} from 'angular2-datatable';
|
import {DataTableModule} from 'angular2-datatable';
|
||||||
import { DatasetTableFilterPipe } from '../pipes/dataset-table-filter.pipe';
|
import { DatasetTableFilterPipe } from '../pipes/dataset-table-filter.pipe';
|
||||||
|
import { DatasetStatusFilterPipe } from '../pipes/dataset-status-filter.pipe';
|
||||||
|
|
||||||
import { DatasetsComponent } from './dataset.component';
|
import { DatasetsComponent } from './dataset.component';
|
||||||
|
|
||||||
|
@ -18,7 +19,8 @@ import { DatasetRoutingModule } from './dataset-routing.module';
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
DatasetsComponent,
|
DatasetsComponent,
|
||||||
DatasetTableFilterPipe
|
DatasetTableFilterPipe,
|
||||||
|
DatasetStatusFilterPipe
|
||||||
//ProjectDetailComponent
|
//ProjectDetailComponent
|
||||||
],
|
],
|
||||||
providers: [ ],
|
providers: [ ],
|
||||||
|
|
|
@ -42,18 +42,16 @@ export class DmpComponent implements OnInit{
|
||||||
|
|
||||||
//visibility rules for containers
|
//visibility rules for containers
|
||||||
tableVisible: boolean = true;
|
tableVisible: boolean = true;
|
||||||
editorVisible: boolean = false;
|
editorVisible: boolean = true;
|
||||||
|
|
||||||
|
|
||||||
// for tableIds
|
// for tableIds
|
||||||
showIDs : boolean = false;
|
showIDs : boolean = false;
|
||||||
// END ALTERNATIVE
|
// END ALTERNATIVE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//@Input() dmps: Dmp[];
|
//@Input() dmps: Dmp[];
|
||||||
dmp:any;
|
dmp:any;
|
||||||
|
@Input() dmpTableVisible: boolean;
|
||||||
@Input() dmpCount = 0;
|
@Input() dmpCount = 0;
|
||||||
@Input() projectsDropDown:DropdownField;
|
@Input() projectsDropDown:DropdownField;
|
||||||
@Input() dataSetVisibe:boolean;
|
@Input() dataSetVisibe:boolean;
|
||||||
|
@ -76,6 +74,7 @@ export class DmpComponent implements OnInit{
|
||||||
this.projectsDropDown = new DropdownField();
|
this.projectsDropDown = new DropdownField();
|
||||||
this.projectsDropDown.options = [];
|
this.projectsDropDown.options = [];
|
||||||
//this.projects = [];
|
//this.projects = [];
|
||||||
|
this.dmpTableVisible = false;
|
||||||
this.dataSetVisibe = false;
|
this.dataSetVisibe = false;
|
||||||
this.dmp = {
|
this.dmp = {
|
||||||
id:null,
|
id:null,
|
||||||
|
@ -232,9 +231,6 @@ newDmp(item){
|
||||||
$("#newDmpModal").modal("show");
|
$("#newDmpModal").modal("show");
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshTable(){
|
|
||||||
this.getDmps();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<meta name="google-signin-client_id" content="524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com">
|
||||||
|
|
||||||
|
<div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]">
|
||||||
|
|
||||||
<table class="table table-striped" [mfData]="tableData | dmpTableFilter : filterQuery | dmpVersionFilter : versionFilter"
|
<table class="table table-striped" [mfData]="tableData | dmpTableFilter : filterQuery | dmpVersionFilter : versionFilter"
|
||||||
#mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
|
#mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -12,7 +13,7 @@
|
||||||
<input class="form-control" [(ngModel)]="versionFilter" placeholder='Filter' />
|
<input class="form-control" [(ngModel)]="versionFilter" placeholder='Filter' />
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<button class="btn btn-default" (click)="refreshTable($event)">
|
<button class="btn btn-default" (click)="getDmps()">
|
||||||
<span class="glyphicon glyphicon-refresh"></span>
|
<span class="glyphicon glyphicon-refresh"></span>
|
||||||
</button>
|
</button>
|
||||||
</th>
|
</th>
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!--Modal for new and edit DMP-->
|
<!--Modal for new and edit DMP-->
|
||||||
<div class="modal fade" id="newDmpModal" tabindex="-1" role="dialog" aria-labelledby="newDmpModalLabel" aria-hidden="true">
|
<div class="modal fade" id="newDmpModal" tabindex="-1" role="dialog" aria-labelledby="newDmpModalLabel" aria-hidden="true">
|
||||||
|
@ -110,7 +111,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="abbreviation-text" class="form-control-label">Version:</label>
|
<label for="abbreviation-text" class="form-control-label">Version:</label>
|
||||||
<input class="form-control" id="abbreviation-text" [(ngModel)]="dmp.version" name="version" >
|
<input class="form-control" id="abbreviation-text" [(ngModel)]="dmp.version" name="version" disabled>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="abbreviation-text" class="form-control-label">Description:</label>
|
<label for="abbreviation-text" class="form-control-label">Description:</label>
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ import * as _ from "lodash";
|
||||||
import {Pipe, PipeTransform} from "@angular/core";
|
import {Pipe, PipeTransform} from "@angular/core";
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: "dmpTableFilter"
|
name: "datasetTableFilter"
|
||||||
})
|
})
|
||||||
export class DatasetTableFilterPipe implements PipeTransform {
|
export class DatasetTableFilterPipe implements PipeTransform {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter' />
|
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter' />
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<button class="btn btn-default" (click)="refreshTable($event)">
|
<button class="btn btn-default" (click)="getProjects()">
|
||||||
<span class="glyphicon glyphicon-refresh"></span>
|
<span class="glyphicon glyphicon-refresh"></span>
|
||||||
</button>
|
</button>
|
||||||
</th>
|
</th>
|
||||||
|
|
|
@ -87,39 +87,45 @@ export class ProjectsComponent implements OnInit{
|
||||||
gapi.load('auth2', function() {
|
gapi.load('auth2', function() {
|
||||||
gapi.auth2.init({});
|
gapi.auth2.init({});
|
||||||
});
|
});
|
||||||
|
this.getProjects();
|
||||||
//this.projects = this.serverService.getDummyProjects();
|
//this.projects = this.serverService.getDummyProjects();
|
||||||
this.projects = [];
|
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(){
|
getDMPs(){
|
||||||
this.serverService.listDmpsLabelID().subscribe(
|
this.serverService.listDmpsLabelID().subscribe(
|
||||||
response =>{
|
response =>{
|
||||||
|
|
Loading…
Reference in New Issue