Merge branch 'master' of git@gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot.git
This commit is contained in:
commit
5973cd75d0
|
@ -8,7 +8,7 @@ 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';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'projects',
|
selector: 'datasets-table',
|
||||||
templateUrl: 'dataset.html',
|
templateUrl: 'dataset.html',
|
||||||
// template: `
|
// template: `
|
||||||
// <h1 class="title">Projects</h1>
|
// <h1 class="title">Projects</h1>
|
||||||
|
@ -68,6 +68,7 @@ export class DatasetsComponent implements OnInit{
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadDatasets(params) {
|
reloadDatasets(params) {
|
||||||
|
this.datasetResource = new DataTableResource(this.datasets);
|
||||||
this.datasetResource.query(params).then(projects => this.datasets = projects);
|
this.datasetResource.query(params).then(projects => this.datasets = projects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ import { DatasetRoutingModule } from './dataset-routing.module';
|
||||||
DatasetsComponent
|
DatasetsComponent
|
||||||
//ProjectDetailComponent
|
//ProjectDetailComponent
|
||||||
],
|
],
|
||||||
providers: [ ]
|
providers: [ ],
|
||||||
|
exports: [
|
||||||
|
DatasetsComponent
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class DatasetsModule {}
|
export class DatasetsModule {}
|
|
@ -27,7 +27,8 @@
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h5>Sign in with</h5>
|
<h5>Sign in with</h5>
|
||||||
</div>
|
</div>
|
||||||
<google-signin [clientId]="myClientId" (googleSignInSuccess)="onGoogleSignInSuccess($event)"></google-signin>
|
<!-- <google-signin [clientId]="myClientId" (googleSignInSuccess)="onGoogleSignInSuccess($event)"></google-signin> -->
|
||||||
|
<div class="g-signin2" id="googleBtn"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
import { Component, OnInit, NgZone } from '@angular/core';
|
import { Component, OnInit, NgZone, AfterViewInit, ElementRef } 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 { TokenService, TokenProvider } from '../services/token.service';
|
import { TokenService, TokenProvider } from '../services/token.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'login-page',
|
selector: 'login-page',
|
||||||
templateUrl: './login-page.html',
|
templateUrl: './login-page.html',
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit{
|
export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
returnUrl: string;
|
returnUrl: string;
|
||||||
|
token: any;
|
||||||
|
|
||||||
|
constructor(
|
||||||
constructor(
|
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private ngZone: NgZone,
|
private ngZone: NgZone,
|
||||||
private tokenService : TokenService
|
private tokenService: TokenService,
|
||||||
){
|
private element: ElementRef
|
||||||
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,41 +27,61 @@ export class LoginComponent implements OnInit{
|
||||||
//this.authenticationService.logout();
|
//this.authenticationService.logout();
|
||||||
|
|
||||||
// get return url from route parameters or default to '/'
|
// get return url from route parameters or default to '/'
|
||||||
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
|
||||||
}
|
//this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
||||||
private myClientId: string = '524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com';
|
}
|
||||||
|
//private myClientId: string = '524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com';
|
||||||
|
private myClientId: string = '1010962018903-glegmqudqtl1lub0150vacopbu06lgsg.apps.googleusercontent.com';
|
||||||
|
|
||||||
onGoogleSignInSuccess(event: GoogleSignInSuccess) {
|
public auth2: any;
|
||||||
let googleUser: gapi.auth2.GoogleUser = event.googleUser;
|
|
||||||
let id: string = googleUser.getId();
|
|
||||||
let profile: gapi.auth2.BasicProfile = googleUser.getBasicProfile();
|
|
||||||
this.tokenService.setToken(googleUser.getAuthResponse().id_token);
|
|
||||||
|
|
||||||
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
|
private scope = [
|
||||||
console.log('Name: ' + profile.getName());
|
'profile',
|
||||||
console.log('token: ' + this.tokenService.getToken());
|
'email'
|
||||||
|
].join(' ');
|
||||||
this.tokenService.setProvider(TokenProvider.google);
|
|
||||||
this.tokenService.setLoggedIn(true);
|
|
||||||
this.tokenService.setEmail(profile.getEmail());
|
|
||||||
this.tokenService.setUsername(profile.getName());
|
|
||||||
|
|
||||||
localStorage.setItem('currentUser', this.tokenService.getToken());
|
public googleInit() {
|
||||||
/* AYTA FEYGOUN, xanontai me to refresh tis selidas
|
|
||||||
|
|
||||||
localStorage.setItem('currentUser', JSON.stringify(googleUser));
|
|
||||||
var currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
|
||||||
console.log('current user local storage:' +currentUser)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// STO LOGOUT, KATHARIZEIS TO tokenService (apo opoudipote... e;inai apo pantou prosvasimo, kai den xanei tis times toy oso exeis to browser anoixto.)
|
gapi.load('auth2', () => {debugger;
|
||||||
|
this.auth2 = gapi.auth2.init({
|
||||||
|
client_id: this.myClientId,
|
||||||
|
cookie_policy: 'single_host_origin',
|
||||||
|
scope: this.scope
|
||||||
|
});
|
||||||
|
var buttonElement = this.element.nativeElement.querySelector('#googleBtn');
|
||||||
|
this.attachSignin(buttonElement);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public attachSignin(element) {debugger;
|
||||||
|
this.auth2.attachClickHandler(element, {},
|
||||||
|
(googleUser) => {
|
||||||
|
this.token = googleUser.getAuthResponse().id_token;
|
||||||
|
|
||||||
|
let profile = googleUser.getBasicProfile();
|
||||||
|
|
||||||
|
this.tokenService.setLoggedIn(true);
|
||||||
|
this.tokenService.setToken(this.token);
|
||||||
|
this.tokenService.setProvider(TokenProvider.google);
|
||||||
|
this.tokenService.setUsername(profile.getName());
|
||||||
|
this.tokenService.setEmail(profile.getEmail());
|
||||||
|
|
||||||
|
this.ngZone.run(() => this.router.navigateByUrl('projects'));
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
|
||||||
|
}, function (error) {
|
||||||
|
console.log(JSON.stringify(error, undefined, 2));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.googleInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//this.router.navigateByUrl('dynamic-form');
|
|
||||||
this.ngZone.run(() => this.router.navigateByUrl('projects'));
|
|
||||||
//this.router.navigate(['/projects']);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core';
|
||||||
|
import { ServerService } from '../../app/services/server.service';
|
||||||
|
import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown';
|
||||||
|
import { Param } from '../entities/model/param';
|
||||||
|
import { Dataset } from '../entities/model/dataset';
|
||||||
|
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'modal',
|
||||||
|
templateUrl: './modal.html'
|
||||||
|
})
|
||||||
|
|
||||||
|
export class ModalComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() datasetDropDown: DropdownField;
|
||||||
|
@Input() dataSetVisibe:boolean;
|
||||||
|
@Input() datasets: Dataset[];
|
||||||
|
datasetResource :DataTableResource<Dataset>;
|
||||||
|
@Input() datasetCount = 0;
|
||||||
|
|
||||||
|
@ViewChild('modalDmps') modalDmps;
|
||||||
|
|
||||||
|
constructor(private serverService: ServerService) {
|
||||||
|
this.datasetDropDown = new DropdownField();
|
||||||
|
this.datasetDropDown.options = [];
|
||||||
|
this.dataSetVisibe= false;
|
||||||
|
this.datasets = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this.serverService.listDmpsLabelID().subscribe(
|
||||||
|
response => {
|
||||||
|
console.log("response");
|
||||||
|
console.log(response);
|
||||||
|
//let params = new Param();
|
||||||
|
response.forEach((dmp) => {
|
||||||
|
let params = new Param();
|
||||||
|
params.key = dmp.id;
|
||||||
|
params.value = dmp.label;
|
||||||
|
this.datasetDropDown.options.push(params);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
showDatasets(dmpId, event) {
|
||||||
|
debugger;
|
||||||
|
this.dataSetVisibe = true;
|
||||||
|
this.serverService.getAllDatasets().subscribe(
|
||||||
|
response => {
|
||||||
|
console.log("response");
|
||||||
|
console.log(response);
|
||||||
|
//let params = new Param();
|
||||||
|
response.forEach((dataset) => {
|
||||||
|
let dt = new Dataset();
|
||||||
|
dt.id = dataset.id;
|
||||||
|
dt.name = dataset.label;
|
||||||
|
dt.uriDataset = dataset.uri;
|
||||||
|
this.datasets.push(dt);
|
||||||
|
var params = { limit: 8, offset: 0, sortAsc: false }
|
||||||
|
this.afterLoad();
|
||||||
|
this.datasetResource.query(params).then(datasets => this.datasets = datasets);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
afterLoad(){
|
||||||
|
this.datasetResource = new DataTableResource(this.datasets);
|
||||||
|
this.datasetResource.count().then(count => this.datasetCount = count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
<div class="modal fade" id="exampleModalDmps" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" #exampleModalDmps>
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalLabel">Project</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="recipient-name" class="col-form-label">DMP:</label>
|
||||||
|
<select class="form-control" [id]="datasetDropDownKey" [(ngModel)]="datasetDropDownKey" [name]="datasetDropDown" #datasetfield>
|
||||||
|
<option *ngFor="let opt of datasetDropDown.options" [value]="opt.key">{{opt.value}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="label-name" class="form-control-label">Label:</label>
|
||||||
|
<input type="text" class="form-control" id="label-name">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="abbreviation-text" class="form-control-label">Abbreviation:</label>
|
||||||
|
<input class="form-control" id="abbreviation-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="reference-text" class="form-control-label">Reference:</label>
|
||||||
|
<input class="form-control" id="reference-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="uri-text" class="form-control-label">Uri:</label>
|
||||||
|
<input class="form-control" id="uri-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="start-date" class="form-control-label">Start Date:</label>
|
||||||
|
<input class="form-control" id="startDate-date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="end-date" class="form-control-label">End Date:</label>
|
||||||
|
<input class="form-control" id="endDate-date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="code-name" class="form-control-label">Code:</label>
|
||||||
|
<input type="text" class="form-control" id="code-name" disabled>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary">Save</button>
|
||||||
|
<button type="button" class="btn btn-primary" (click)= "showDatasets(datasetfield.value, exampleModalDmps)" >Show Datasets</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--DATASET TABLE-->
|
||||||
|
<datasets-table *ngIf="dataSetVisibe == true"></datasets-table>
|
|
@ -7,10 +7,6 @@
|
||||||
background-color: #E4EDF9;
|
background-color: #E4EDF9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fa {
|
a.editGridColumn{
|
||||||
display: inline-block;
|
color: #333;
|
||||||
font: normal normal normal 14px/1 FontAwesome;
|
|
||||||
font-size: inherit;
|
|
||||||
text-rendering: auto;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
}
|
}
|
|
@ -1,42 +1,38 @@
|
||||||
|
|
||||||
<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)"
|
<div>
|
||||||
|
<span>Filter: </span>
|
||||||
|
<input type="text" id="myInput" (keyup)="myFunction()" placeholder="Search for labels.." title="Type in a name">
|
||||||
|
</div>
|
||||||
|
<data-table id="projects-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"
|
||||||
[expandableRows]="true" [translations]="translations" [indexColumnHeader]="'#'" [selectOnRowClick]="true">
|
[expandableRows]="true" [translations]="translations" [indexColumnHeader]="'#'" [selectOnRowClick]="true">
|
||||||
<template #dataTableExpand let-item="item">
|
|
||||||
<div>
|
|
||||||
<!-- <a [routerLink]="['/dynamic-form', item.id]"> {{ item.dmp.id }}</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>
|
|
||||||
|
|
||||||
</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]="'startDate'" [header]="'Start Date'" [sortable]="true">
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
<data-table-column [property]="'uri'" [header]="'Uri'" [sortable]="true">
|
<data-table-column [property]="'endDate'" [header]="'End Date'" [sortable]="true">
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
<data-table-column [property]="'definition'" [header]="'Definition'" [sortable]="true">
|
<data-table-column [property]="'active'" [header]="'Status'" [width]="100" [resizable]="true">
|
||||||
|
<template #dataTableHeader let-item="item">
|
||||||
|
<span>Active</span>
|
||||||
|
</template>
|
||||||
|
<template #dataTableCell let-item="item">
|
||||||
|
<span style="color: grey">
|
||||||
|
<span class="fa fa-check" *ngIf="item.active"></span>
|
||||||
|
<span class="fa fa-times" *ngIf="!item.active"></span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</data-table-column>
|
||||||
|
<data-table-column header="Actions">
|
||||||
|
<template #dataTableHeader let-item="item">
|
||||||
|
<i>Actions</i>
|
||||||
|
</template>
|
||||||
|
<template #dataTableCell let-item="item">
|
||||||
|
<a class="editGridColumn" data-toggle="modal" data-target="#exampleModalDmps"><i class="fa fa-pencil fa-fw"></i></a>
|
||||||
|
</template>
|
||||||
</data-table-column>
|
</data-table-column>
|
||||||
</data-table>
|
</data-table>
|
||||||
<div style="margin-top: 10px">
|
<div style="margin-top: 10px">
|
||||||
|
@ -44,7 +40,69 @@
|
||||||
<span *ngIf="projectsTable.selectedRow == null"><i>No item selected</i></span>
|
<span *ngIf="projectsTable.selectedRow == null"><i>No item selected</i></span>
|
||||||
<span [textContent]="projectsTable.selectedRow && projectsTable.selectedRow.item.name"></span>
|
<span [textContent]="projectsTable.selectedRow && projectsTable.selectedRow.item.name"></span>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-info">New Project</button>
|
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#exampleModal">New Project</button>
|
||||||
</div>
|
|
||||||
<router-outlet></router-outlet>
|
|
||||||
|
|
||||||
|
<!-- <select class="form-control" [id]="datasetDropDownKey" [(ngModel)]="datasetDropDownKey">
|
||||||
|
<option *ngFor="let opt of datasetDropDown.options" [value]="opt.key">{{opt.value}}</option>
|
||||||
|
</select> -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalLabel">Create New Project</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="label-name" class="form-control-label">Label:</label>
|
||||||
|
<input type="text" class="form-control" id="label-name">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="abbreviation-text" class="form-control-label">Abbreviation:</label>
|
||||||
|
<input class="form-control" id="abbreviation-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="reference-text" class="form-control-label">Reference:</label>
|
||||||
|
<input class="form-control" id="reference-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="uri-text" class="form-control-label">Uri:</label>
|
||||||
|
<input class="form-control" id="uri-text">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="start-date" class="form-control-label">Start Date:</label>
|
||||||
|
<input class="form-control" id="startDate-date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="end-date" class="form-control-label">End Date:</label>
|
||||||
|
<input class="form-control" id="endDate-date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="code-name" class="form-control-label">Code:</label>
|
||||||
|
<input type="text" class="form-control" id="code-name" disabled>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary">Save project</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--Modal for DMPs-->
|
||||||
|
<modal></modal>
|
||||||
|
|
||||||
|
<!--DATASET TABLE-->
|
||||||
|
<datasets-table *ngIf="dataSetVisibe == true"></datasets-table>
|
||||||
|
|
||||||
|
<a href="#" (click)="signOut2();" #isignOutBtn >Sign out</a>
|
||||||
|
<router-outlet></router-outlet>
|
|
@ -7,17 +7,21 @@ import { ProjectsComponent } from './projects.component';
|
||||||
|
|
||||||
import { ProjectRoutingModule } from './project-routing.module';
|
import { ProjectRoutingModule } from './project-routing.module';
|
||||||
import { ProjectDetailComponent } from './project.detail';
|
import { ProjectDetailComponent } from './project.detail';
|
||||||
|
import { DatasetsModule } from '../datasets/dataset.module';
|
||||||
|
import { ModalComponent } from '../modal/modal.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
ProjectRoutingModule,
|
ProjectRoutingModule,
|
||||||
DataTableModule
|
DataTableModule,
|
||||||
|
DatasetsModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ProjectsComponent,
|
ProjectsComponent,
|
||||||
ProjectDetailComponent
|
ProjectDetailComponent,
|
||||||
|
ModalComponent
|
||||||
],
|
],
|
||||||
providers: [ ]
|
providers: [ ]
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,6 +6,10 @@ import { Project } from '../entities/model/project';
|
||||||
import { Dmp } from '../entities/model/Dmp';
|
import { Dmp } from '../entities/model/Dmp';
|
||||||
import { Dataset } from '../entities/model/dataset';
|
import { Dataset } from '../entities/model/dataset';
|
||||||
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4';
|
import { DataTable, DataTableTranslations, DataTableResource } from 'angular-4-data-table-bootstrap-4';
|
||||||
|
import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown';
|
||||||
|
import { Param } from '../entities/model/param';
|
||||||
|
import { ModalComponent } from '../modal/modal.component';
|
||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'projects',
|
selector: 'projects',
|
||||||
|
@ -31,15 +35,24 @@ export class ProjectsComponent implements OnInit{
|
||||||
returnUrl: string;
|
returnUrl: string;
|
||||||
@Input() projects: Project[];
|
@Input() projects: Project[];
|
||||||
projectResource :DataTableResource<Project>;
|
projectResource :DataTableResource<Project>;
|
||||||
|
datasetResource :DataTableResource<Dataset>;
|
||||||
@Input() projectCount = 0;
|
@Input() projectCount = 0;
|
||||||
|
@Input() datasetDropDown:DropdownField;
|
||||||
|
@Input() dataSetVisibe:boolean;
|
||||||
|
@Input() datasets: Dataset[];
|
||||||
|
|
||||||
@ViewChild(DataTable) projectsTable;
|
@ViewChild(DataTable) projectsTable;
|
||||||
|
@ViewChild(DataTable) datasetsTable;
|
||||||
|
@ViewChild('isignOutBtn') isignOutBtn;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router){
|
private router: Router){
|
||||||
|
this.datasetDropDown = new DropdownField();
|
||||||
|
this.datasetDropDown.options = [];
|
||||||
|
this.dataSetVisibe= false;
|
||||||
|
this.datasets = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -48,8 +61,7 @@ export class ProjectsComponent implements OnInit{
|
||||||
this.serverService.getAllProjects().subscribe( //getProjects()
|
this.serverService.getAllProjects().subscribe( //getProjects()
|
||||||
response => {
|
response => {
|
||||||
|
|
||||||
console.log("response");
|
|
||||||
console.log(response);
|
|
||||||
response.forEach(resp => {
|
response.forEach(resp => {
|
||||||
let pr = new Project();
|
let pr = new Project();
|
||||||
pr.id = resp.id;
|
pr.id = resp.id;
|
||||||
|
@ -59,19 +71,34 @@ export class ProjectsComponent implements OnInit{
|
||||||
pr.uri = resp.uri;
|
pr.uri = resp.uri;
|
||||||
pr.dmp = new Dmp();
|
pr.dmp = new Dmp();
|
||||||
// pr.dmp.id = resp.dmp;
|
// pr.dmp.id = resp.dmp;
|
||||||
pr.dmp.id = resp.dmp =! null || resp.dmp ==! undefined ? resp.dmp.id : null;
|
pr.dmp.id = resp.dmp =! null ? resp.dmp.id : null;
|
||||||
pr.dataset = new Dataset();
|
pr.dataset = new Dataset();
|
||||||
pr.dmp.dataset = resp.dmp.dataset != null ? resp.dmp.dataset.id: null;
|
pr.dmp.dataset = resp.dmp !=null && resp.dmp.dataset != null ? resp.dmp.dataset.id: null;
|
||||||
this.projects.push(pr);
|
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.projectResource.query(params).then(projects => this.projects = projects);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
(err: HttpErrorResponse) => {debugger;
|
||||||
|
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}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadProjects(params) {
|
reloadProjects(params) {
|
||||||
|
this.projectResource = new DataTableResource(this.projects);
|
||||||
this.projectResource.query(params).then(projects => this.projects = projects);
|
this.projectResource.query(params).then(projects => this.projects = projects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +107,73 @@ afterLoad(){
|
||||||
this.projectResource.count().then(count => this.projectCount = count);
|
this.projectResource.count().then(count => this.projectCount = count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDMPs(){
|
||||||
|
this.serverService.listDmpsLabelID().subscribe(
|
||||||
|
response =>{
|
||||||
|
console.log("response");
|
||||||
|
console.log(response);
|
||||||
|
//let params = new Param();
|
||||||
|
response.forEach((dmp) => {
|
||||||
|
let params = new Param();
|
||||||
|
params.key = dmp.id;
|
||||||
|
params.value = dmp.label;
|
||||||
|
this.datasetDropDown.options.push(params);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
showDatasets(dmpId, event){debugger;
|
||||||
|
this.dataSetVisibe = true;
|
||||||
|
this.serverService.getAllDatasets().subscribe(
|
||||||
|
response =>{
|
||||||
|
console.log("response");
|
||||||
|
console.log(response);
|
||||||
|
//let params = new Param();
|
||||||
|
response.forEach((dataset) => {
|
||||||
|
let dt = new Dataset();
|
||||||
|
dt.id = dataset.id;
|
||||||
|
dt.name = dataset.label;
|
||||||
|
dt.uriDataset = dataset.uri;
|
||||||
|
this.datasets.push(dt);
|
||||||
|
var params = {limit:8,offset:0, sortAsc:false}
|
||||||
|
this.afterLoad();
|
||||||
|
this.datasetResource.query(params).then(datasets => this.datasets = datasets);
|
||||||
|
},
|
||||||
|
(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,
|
||||||
|
console.log(`Backend returned code ${err.status}, body was: ${err.error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
myFunction() {
|
||||||
|
var input, filter, table, tr, td, i;
|
||||||
|
input = document.getElementById("myInput");
|
||||||
|
filter = input.value.toUpperCase();
|
||||||
|
table = document.getElementById("projects-grid");
|
||||||
|
tr = table.getElementsByTagName("tr");
|
||||||
|
for (i = 0; i < tr.length; i++) {
|
||||||
|
td = tr[i].getElementsByTagName("td")[3];
|
||||||
|
if (td) {
|
||||||
|
if (td.innerText.toUpperCase().indexOf(filter) > -1) {
|
||||||
|
tr[i].style.display = "";
|
||||||
|
} else {
|
||||||
|
tr[i].style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// special params:
|
// special params:
|
||||||
translations = <DataTableTranslations>{
|
translations = <DataTableTranslations>{
|
||||||
indexColumn: 'Index column',
|
indexColumn: 'Index column',
|
||||||
|
|
|
@ -78,7 +78,7 @@ export class dataModelBuilder {
|
||||||
newfield = new CheckBoxField({
|
newfield = new CheckBoxField({
|
||||||
label: element.title.__cdata,
|
label: element.title.__cdata,
|
||||||
key: element._id,
|
key: element._id,
|
||||||
value: element.value,
|
value: false,
|
||||||
order: element._ordinal,
|
order: element._ordinal,
|
||||||
rules: element.visible.rule != undefined ? element.visible.rule : rule,
|
rules: element.visible.rule != undefined ? element.visible.rule : rule,
|
||||||
visible: element._defaultVisibility,
|
visible: element._defaultVisibility,
|
||||||
|
@ -230,21 +230,16 @@ export class dataModelBuilder {
|
||||||
|
|
||||||
|
|
||||||
fields.find(x => x.key == newAttribute.id).url.url = attr.sources.source.url._value;
|
fields.find(x => x.key == newAttribute.id).url.url = attr.sources.source.url._value;
|
||||||
|
|
||||||
this.restBase.proxy_get(attr.sources.source.url._value).subscribe((data) => {
|
this.restBase.proxy_get(attr.sources.source.url._value).subscribe((data) => {
|
||||||
|
console.log(data);
|
||||||
|
newAttribute.sources.forEach(src => {
|
||||||
|
src.params = new Array();
|
||||||
console.log(data);
|
data.data.forEach(data => {
|
||||||
newAttribute.sources.forEach(src => {
|
|
||||||
src.params = new Array();
|
|
||||||
data.data.forEach(data => {
|
|
||||||
let prm = new Param();
|
let prm = new Param();
|
||||||
prm.key = data.id;
|
prm.key = data.id;
|
||||||
prm.value = data.attributes.name;
|
prm.value = data.attributes.name;
|
||||||
src.params.push(prm);
|
src.params.push(prm);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -307,7 +302,7 @@ export class dataModelBuilder {
|
||||||
|
|
||||||
attribute.push(newAttribute);
|
attribute.push(newAttribute);
|
||||||
//if (fields.find(x => x.key == newAttribute.id).url.url == null)
|
//if (fields.find(x => x.key == newAttribute.id).url.url == null)
|
||||||
fields.find(x => x.key == newAttribute.id).attributes.sources = newAttribute.sources;
|
fields.find(x => x.key == newAttribute.id).attributes.sources = newAttribute.sources;
|
||||||
fields.find(x => x.key == newAttribute.id).attributes.validation = newAttribute.validation;
|
fields.find(x => x.key == newAttribute.id).attributes.validation = newAttribute.validation;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,12 @@ export class RestBase {
|
||||||
protocol: string = "http";
|
protocol: string = "http";
|
||||||
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
|
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
|
||||||
port: number = 8080;//8080;//
|
port: number = 8080;//8080;//
|
||||||
webappname: string = "dmp-backend";//"dmp-backend-new";//
|
webappname: string = "dmp-backend-1";//"dmp-backend-new";//
|
||||||
|
|
||||||
|
/*protocol: string = "http";
|
||||||
|
hostname: string ="dionysus.di.uoa.gr" ;
|
||||||
|
port: number = 7070;
|
||||||
|
webappname: string = "dmp-backend-1";//"dmp-backend-new";//*/
|
||||||
|
|
||||||
|
|
||||||
proxyPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/proxy/";
|
proxyPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/proxy/";
|
||||||
|
|
|
@ -17,7 +17,6 @@ declare var X2JS: any;
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ServerService {
|
export class ServerService {
|
||||||
|
|
||||||
|
|
||||||
xml2jsonOBJ: any;
|
xml2jsonOBJ: any;
|
||||||
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a868dbbb-ee37-4ce6-81c8-27048e0599a9';
|
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a868dbbb-ee37-4ce6-81c8-27048e0599a9';
|
||||||
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a71a6a92-5c23-40d7-ab87-e30bc860f5a4';//include rules!
|
//fetchURL: string = 'http://dl010.madgik.di.uoa.gr:8080/dmp-backend/rest/DMP/a71a6a92-5c23-40d7-ab87-e30bc860f5a4';//include rules!
|
||||||
|
@ -85,9 +84,18 @@ export class ServerService {
|
||||||
public listProjectsLabelID(){
|
public listProjectsLabelID(){
|
||||||
return this.restBase.get("project/listAllLabelIDs");
|
return this.restBase.get("project/listAllLabelIDs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
signOut2() {
|
||||||
|
|
||||||
|
var auth2 = gapi.auth2.getAuthInstance();
|
||||||
|
auth2.signOut().then(function () {
|
||||||
|
console.log('User signed out.');
|
||||||
|
localStorage.removeItem('currentUser');
|
||||||
|
});
|
||||||
|
this.tokenService.setToken(null); //kanonika prepei na mpei mesa sthn function.....
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
getData() {
|
getData() {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.js"></script>
|
<script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.js"></script>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Digital Management Plans - Manager</title>
|
<title>Data Management Plans - Manager</title>
|
||||||
<base href="/">
|
<base href="/">
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
@ -32,7 +32,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 Plan</h3>
|
<h3 class="panel-title" style="text-align: center;">Data Management Plan</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue