dataset page , getDataset rest-base urls
This commit is contained in:
parent
1d4878ae4d
commit
ab5d169e77
|
@ -1,8 +1,9 @@
|
||||||
import { Component, OnInit, Input, ViewChild } from '@angular/core';
|
import { Component, OnInit, Input, ViewChild, NgZone } from '@angular/core';
|
||||||
import {GoogleSignInSuccess} from 'angular-google-signin';
|
import {GoogleSignInSuccess} from 'angular-google-signin';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { ServerService } from '../../app/services/server.service';
|
import { ServerService } from '../../app/services/server.service';
|
||||||
import { Project } from '../entities/model/project';
|
import { Project } from '../entities/model/project';
|
||||||
|
import { Dataset } from '../entities/model/dataset';
|
||||||
import { Dmp } from '../entities/model/Dmp';
|
import { Dmp } from '../entities/model/Dmp';
|
||||||
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4';
|
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4';
|
||||||
|
|
||||||
|
@ -29,54 +30,54 @@ import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-d
|
||||||
export class DatasetsComponent implements OnInit{
|
export class DatasetsComponent implements OnInit{
|
||||||
|
|
||||||
returnUrl: string;
|
returnUrl: string;
|
||||||
@Input() projects: Project[];
|
@Input() datasets: Dataset[];
|
||||||
projectResource :DataTableResource<Project>;
|
datasetResource :DataTableResource<Dataset>;
|
||||||
@Input() projectCount = 0;
|
@Input() datasetCount = 0;
|
||||||
|
|
||||||
@ViewChild(DataTable) projectsTable;
|
@ViewChild(DataTable) projectsTable;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router){
|
private router: Router,
|
||||||
|
private ngZone: NgZone){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
//this.projects = this.serverService.getDummyProjects();
|
//this.projects = this.serverService.getDummyProjects();
|
||||||
this.projects = [];
|
this.datasets = [];
|
||||||
this.serverService.getProjects().subscribe(
|
this.serverService.getAllDatasets().subscribe(
|
||||||
response => {
|
response => {
|
||||||
|
|
||||||
console.log("response");
|
console.log("response");
|
||||||
console.log(response);
|
console.log(response);
|
||||||
response.forEach(resp => {
|
response.forEach(resp => {
|
||||||
let pr = new Project();
|
|
||||||
pr.id = resp.id;
|
let dt = new Dataset();
|
||||||
pr.name = resp.label;
|
dt.id = resp.id;
|
||||||
pr.abbreviation = resp.abbreviation;
|
dt.name = resp.label;
|
||||||
pr.definition = resp.definition;
|
dt.uriDataset = resp.uri;
|
||||||
pr.uri = resp.uri;
|
this.datasets.push(dt);
|
||||||
pr.dmp = new Dmp();
|
|
||||||
// pr.dmp.id = resp.dmp;
|
|
||||||
pr.dmp.id = resp.dmp =! null || resp.dmp ==! undefined ? resp.dmp.id : null;
|
|
||||||
// pr.dmp.dataset = resp.dmp.dataset != null ? resp.dmp.dataset.id: null;
|
|
||||||
this.projects.push(pr);
|
|
||||||
var params = {limit:8,offset:0, sortAsc:false}
|
var params = {limit:8,offset:0, sortAsc:false}
|
||||||
this.afterLoad();
|
this.afterLoad();
|
||||||
this.projectResource.query(params).then(projects => this.projects = projects);
|
this.datasetResource.query(params).then(datasets => this.datasets = datasets);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadProjects(params) {
|
reloadDatasets(params) {
|
||||||
this.projectResource.query(params).then(projects => this.projects = projects);
|
this.datasetResource.query(params).then(projects => this.datasets = projects);
|
||||||
}
|
}
|
||||||
|
|
||||||
afterLoad(){
|
afterLoad(){
|
||||||
this.projectResource = new DataTableResource(this.projects);
|
this.datasetResource = new DataTableResource(this.datasets);
|
||||||
this.projectResource.count().then(count => this.projectCount = count);
|
this.datasetResource.count().then(count => this.datasetCount = count);
|
||||||
|
}
|
||||||
|
|
||||||
|
rowClick(rowEvent){
|
||||||
|
this.ngZone.run(() => this.router.navigateByUrl('dynamic-form', rowEvent.row.item.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
// special params:
|
// special params:
|
||||||
|
|
|
@ -1,42 +1,23 @@
|
||||||
<div style="margin: auto; max-width: 1000px; margin-top:50px">
|
<div style="margin: auto; max-width: 1000px; margin-top:50px">
|
||||||
<data-table id="films-grid" headerTitle="My Projects" [items]="projects" [itemCount]="projectCount" (reload)="reloadProjects($event)"
|
<data-table id="films-grid" headerTitle="Datasets" [items]="datasets" [itemCount]="datasetCount" (reload)="reloadDatasets($event)"
|
||||||
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [selectColumn]="true" [multiSelect]="false" [substituteRows]="false"
|
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [substituteRows]="false"
|
||||||
[expandableRows]="true" [translations]="translations" [indexColumnHeader]="'#'" [selectOnRowClick]="true">
|
[expandableRows]="true" [translations]="translations" [selectOnRowClick]="true" (rowClick)="rowClick($event)">
|
||||||
<template #dataTableExpand let-item="item">
|
<template #dataTableExpand let-item="item">
|
||||||
<div>
|
<div>
|
||||||
<!-- <a [routerLink]="['/dynamic-form', item.id]"> {{ item.dmp.id }}</a> -->
|
<a [routerLink]="['/dynamic-form', item.id]"> dataset</a>
|
||||||
<table class="table">
|
|
||||||
<thead class="thead-inverse">
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<th>Dmp</th>
|
|
||||||
<th>Id</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<!-- <td> <a [routerLink]="['/dynamic-form', item.id]"> {{ item.dmp.id }}</a></td>-->
|
|
||||||
<td> <a [routerLink]="['/dataset']"> {{ item.dmp.id }}</a></td>
|
|
||||||
<td>{{item.dmp.id}}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<data-table-column [property]="'name'" [header]="'Label'" [sortable]="true">
|
<data-table-column [property]="'name'" [header]="'Label'" [sortable]="true">
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
<data-table-column [property]="'abbreviation'" [header]="'Abbreviation'" [sortable]="true">
|
<!-- <data-table-column [property]="'abbreviation'" [header]="'Abbreviation'" [sortable]="true">
|
||||||
</data-table-column>
|
</data-table-column> -->
|
||||||
<data-table-column [property]="'id'" [header]="'Id'" [sortable]="true">
|
<data-table-column [property]="'id'" [header]="'Id'" [sortable]="true">
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
<data-table-column [property]="'uri'" [header]="'Uri'" [sortable]="true">
|
<data-table-column [property]="'uriDataset'" [header]="'Uri'" [sortable]="true">
|
||||||
</data-table-column>
|
|
||||||
<data-table-column [property]="'definition'" [header]="'Definition'" [sortable]="true">
|
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
|
<!-- <data-table-column [property]="'definition'" [header]="'Definition'" [sortable]="true">
|
||||||
|
</data-table-column> -->
|
||||||
</data-table>
|
</data-table>
|
||||||
<div style="margin-top: 10px">
|
<div style="margin-top: 10px">
|
||||||
<b>Selected:</b>
|
<b>Selected:</b>
|
||||||
|
|
|
@ -3,4 +3,5 @@ import { Injectable } from '@angular/core';
|
||||||
export class Dataset {
|
export class Dataset {
|
||||||
id:string;
|
id:string;
|
||||||
name: string;
|
name: string;
|
||||||
|
uriDataset: string;
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
<div> <a [routerLink]="['/dynamic-form',123]"> dataset</a></div>
|
||||||
<div style="margin: auto; max-width: 1000px; margin-top:50px">
|
<div style="margin: auto; max-width: 1000px; margin-top:50px">
|
||||||
<data-table id="films-grid" headerTitle="My Projects" [items]="projects" [itemCount]="projectCount" (reload)="reloadProjects($event)"
|
<data-table id="films-grid" headerTitle="My Projects" [items]="projects" [itemCount]="projectCount" (reload)="reloadProjects($event)"
|
||||||
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [selectColumn]="true" [multiSelect]="false" [substituteRows]="false"
|
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [selectColumn]="true" [multiSelect]="false" [substituteRows]="false"
|
||||||
|
|
|
@ -45,7 +45,7 @@ export class ProjectsComponent implements OnInit{
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
//this.projects = this.serverService.getDummyProjects();
|
//this.projects = this.serverService.getDummyProjects();
|
||||||
this.projects = [];
|
this.projects = [];
|
||||||
this.serverService.getProjects().subscribe(
|
this.serverService.getAllProjects().subscribe( //getProjects()
|
||||||
response => {
|
response => {
|
||||||
|
|
||||||
console.log("response");
|
console.log("response");
|
||||||
|
|
|
@ -16,8 +16,8 @@ export class RestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol: string = "http";
|
protocol: string = "http";
|
||||||
hostname: string = "localhost";//"dl010.madgik.di.uoa.gr";//
|
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
|
||||||
port: number = 7070;//8080;//
|
port: number = 8080;//8080;//
|
||||||
webappname: string = "dmp-backend";//"dmp-backend-new";//
|
webappname: string = "dmp-backend";//"dmp-backend-new";//
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ export class RestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private createOptions(){
|
private createOptions(){debugger;
|
||||||
var token = this.tokenService.getToken();
|
var token = this.tokenService.getToken();
|
||||||
var provider: TokenProvider = this.tokenService.getProvider();
|
var provider: TokenProvider = this.tokenService.getProvider();
|
||||||
//var csrfToken : string = this.tokenService.getCSRFToken();
|
//var csrfToken : string = this.tokenService.getCSRFToken();
|
||||||
|
|
|
@ -40,49 +40,49 @@ export class ServerService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
listDatasetIDs(){
|
public listDatasetIDs(){
|
||||||
return this.restBase.get("dataset");
|
return this.restBase.get("dataset");
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllDatasets(){
|
public getAllDatasets(){
|
||||||
return this.restBase.get("getAllDatasets");
|
return this.restBase.get("getAllDatasets");
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllDatasetIDs(datasetId: string){
|
public getAllDatasetIDs(datasetId: string){
|
||||||
return this.restBase.get("dataset/"+datasetId);
|
return this.restBase.get("dataset/"+datasetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getAllDmps(){
|
public getAllDmps(){
|
||||||
return this.restBase.get("dmp/getAll");
|
return this.restBase.get("dmp/getAll");
|
||||||
}
|
}
|
||||||
|
|
||||||
listDmpsLabelID(){
|
public listDmpsLabelID(){
|
||||||
return this.restBase.get("dmp/listDMPLabelID");
|
return this.restBase.get("dmp/listDMPLabelID");
|
||||||
}
|
}
|
||||||
|
|
||||||
getDmp(dmpid : string){
|
public getDmp(dmpid : string){
|
||||||
return this.restBase.get("dmps/"+dmpid);
|
return this.restBase.get("dmps/"+dmpid);
|
||||||
}
|
}
|
||||||
|
|
||||||
listDmpIDs(){
|
public listDmpIDs(){
|
||||||
return this.restBase.get("dmps");
|
return this.restBase.get("dmps");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
listProjectIDs(){
|
public listProjectIDs(){
|
||||||
return this.restBase.get("projects");
|
return this.restBase.get("projects");
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllProjects(){
|
public getAllProjects(){
|
||||||
return this.restBase.get("project/getAll");
|
return this.restBase.get("project/getAll");
|
||||||
}
|
}
|
||||||
|
|
||||||
getProject(projectID : string){
|
public getProject(projectID : string){
|
||||||
return this.restBase.get("projects/"+projectID);
|
return this.restBase.get("projects/"+projectID);
|
||||||
}
|
}
|
||||||
|
|
||||||
listProjectsLabelID(){
|
public listProjectsLabelID(){
|
||||||
return this.restBase.get("project/listAllLabelIDs");
|
return this.restBase.get("project/listAllLabelIDs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,12 +92,13 @@ export class ServerService {
|
||||||
getData() {
|
getData() {
|
||||||
|
|
||||||
//let headers = new HttpHeaders();
|
//let headers = new HttpHeaders();
|
||||||
let headers = new HttpHeaders().set("google-token", this.tokenService.getToken());
|
|
||||||
|
|
||||||
console.log("google-token: "+ this.tokenService.getToken());
|
// let headers = new HttpHeaders().set("google-token", this.tokenService.getToken());
|
||||||
|
|
||||||
return this.httpClient.get<any>(this.fetchURL);
|
// console.log("google-token: "+ this.tokenService.getToken());
|
||||||
|
|
||||||
|
// return this.httpClient.get<any>(this.fetchURL);
|
||||||
|
return this.restBase.get("dmps/9a4a4a57-4d01-465e-9887-254534f31600");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
return this.http.get(this.fetchURL)
|
return this.http.get(this.fetchURL)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
<div class="panel panel-default" style="margin-top: 30px; margin-bottom: 30px; margin-right: 30px; margin-left: 30px;">
|
<div class="panel panel-default" style="margin-top: 30px; margin-bottom: 30px; margin-right: 30px; margin-left: 30px;">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title" style="text-align: center;">Digital Management Plans Editor</h3>
|
<h3 class="panel-title" style="text-align: center;">Digital Management Plan</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue