Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot
This commit is contained in:
commit
eced040f8d
|
@ -23,6 +23,7 @@ import { ResearcherService } from './services/researcher-service';
|
|||
import { OrganisationService } from './services/organisation-service';
|
||||
import { DmpProfileService } from './services/dmpprofile-service';
|
||||
import { RegistryService } from './services/registry-service';
|
||||
import { DatarepoService } from './services/datarepo-service';
|
||||
import { Toolbox } from './services/toolbox';
|
||||
|
||||
import { DataFilterPipe } from './pipes/data-filter.pipe';
|
||||
|
@ -33,6 +34,7 @@ import { ProjectTableFilterPipe } from './pipes/project-table-filter.pipe';
|
|||
import { RegistryTableFilterPipe } from './pipes/registry-table-filter.pipe';
|
||||
import { OrganisationTableFilterPipe } from './pipes/organisation-table-filter.pipe';
|
||||
import { ResearcherTableFilterPipe } from './pipes/researcher-table-filter.pipe';
|
||||
import { DatarepoTableFilterPipe } from './pipes/datarepo-table-filter.pipe';
|
||||
|
||||
|
||||
import { GooggleSignInComponent } from './login/googgle-sign-in/googgle-sign-in.component';
|
||||
|
@ -53,6 +55,7 @@ import { OrganisationEditorComponent } from './managers/organisation-editor/orga
|
|||
import { RegistryEditorComponent } from './managers/registry-editor/registry-editor.component';
|
||||
import { ServiceEditorComponent } from './managers/service-editor/service-editor.component';
|
||||
import { ResearcherEditorComponent } from './managers/researcher-editor/researcher-editor.component';
|
||||
import { DatareposEditorComponent } from './managers/datarepos-editor/datarepos-editor.component';
|
||||
|
||||
|
||||
|
||||
|
@ -66,6 +69,7 @@ import { ResearcherEditorComponent } from './managers/researcher-editor/research
|
|||
RegistryTableFilterPipe,
|
||||
ServiceTableFilterPipe,
|
||||
ResearcherTableFilterPipe,
|
||||
DatarepoTableFilterPipe,
|
||||
|
||||
AppComponent,
|
||||
GooggleSignInComponent,
|
||||
|
@ -82,7 +86,8 @@ import { ResearcherEditorComponent } from './managers/researcher-editor/research
|
|||
RegistryEditorComponent,
|
||||
ServiceEditorComponent,
|
||||
MainSignInComponent,
|
||||
ResearcherEditorComponent
|
||||
ResearcherEditorComponent,
|
||||
DatareposEditorComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -97,7 +102,7 @@ import { ResearcherEditorComponent } from './managers/researcher-editor/research
|
|||
AppRouting
|
||||
],
|
||||
providers: [ DatasetsServiceService, TokenService, DmpsServiceService, ResearcherService,
|
||||
DialogService, DatasetProfileService, ProjectService, OrganisationService,
|
||||
DialogService, DatasetProfileService, ProjectService, OrganisationService, DatarepoService,
|
||||
DmpProfileService, RegistryService, ServiceService, NativeLoginService, HttpModule, Toolbox, HttpClient, RestBase],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
|
|
|
@ -112,6 +112,7 @@ export class DatasetsViewerComponent implements OnInit, AfterViewInit {
|
|||
|
||||
|
||||
|
||||
|
||||
onFocusOutProfileWin($event, value:string) {
|
||||
this.nullSafeProfile();
|
||||
if(this.haveChanges){
|
||||
|
@ -121,7 +122,7 @@ export class DatasetsViewerComponent implements OnInit, AfterViewInit {
|
|||
//create profile and a) assign it on data[] and on current profile b) assign it to dataset
|
||||
this.datasetProfileService.setDatasetProfile(this.profile).subscribe((resp) => {
|
||||
|
||||
/*
|
||||
|
||||
console.log("SERVICE RESPONSE: ");
|
||||
console.log(resp);
|
||||
console.log(resp.json());
|
||||
|
@ -141,13 +142,31 @@ export class DatasetsViewerComponent implements OnInit, AfterViewInit {
|
|||
simple_notifier("success",null,"Updated profile element");
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
simple_notifier("success",null,"Updated profile element");
|
||||
});
|
||||
}
|
||||
else{
|
||||
//this.getDatasetFromDataArray()
|
||||
|
||||
console.log("this.profile")
|
||||
console.log(this.profile)
|
||||
|
||||
console.log(this.profile)
|
||||
this.profile.dataset = {"id": this.profile.dataset};
|
||||
|
||||
|
||||
this.datasetProfileService.setDatasetProfile(this.profile).subscribe(
|
||||
response => {
|
||||
simple_notifier("success",null,"Saved DMP Profile");
|
||||
console.log(response);
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not save DMP Profile");
|
||||
console.log(err);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -365,4 +384,4 @@ export class DatasetsViewerComponent implements OnInit, AfterViewInit {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -23,11 +23,11 @@
|
|||
<li [ngClass]="{true:'active'}[currentlySelected=='dmpprofiles']" (click)="setActive('dmpprofiles')" [routerLink]="['/dmpprofiles']">DMP profiles</li>
|
||||
</ul>
|
||||
|
||||
<li data-toggle="collapse" data-target="#data-repositories" class="collapsed">
|
||||
<li data-toggle="collapse" data-target="#manage-repositories" class="collapsed">
|
||||
<a style="cursor:pointer"><i class="fa fa-database"></i> Manage Data Repositories <span class="arrow"></span></a>
|
||||
</li>
|
||||
<ul class="sub-menu collapse" id="data-repositories">
|
||||
<li>Data Repositories</li>
|
||||
<ul class="sub-menu collapse" id="manage-repositories">
|
||||
<li [ngClass]="{true:'active'}[currentlySelected=='datarepos']" (click)="setActive('datarepos')" [routerLink]="['/datarepos']">Data Repositories</li>
|
||||
<li>Non-assigned repositories</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
.invisible {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.visible {
|
||||
display:block;
|
||||
}
|
||||
|
||||
tr.hover:hover > * {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.editor-container{
|
||||
padding-top: 10px;
|
||||
padding-right: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.button-150px {
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
.ng-template{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.grayout-empty-table {
|
||||
opacity: 0.6; /* Real browsers */
|
||||
filter: alpha(opacity = 60); /* MSIE */
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
|
||||
<div class="editor-container container">
|
||||
|
||||
<div [ngClass]="{true:'visible', false:'invisible'}[tableVisible]">
|
||||
<table class="table table-striped" [mfData]="tableData | datarepoTableFilter : filterQuery" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="1">
|
||||
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter'/>
|
||||
</th>
|
||||
<th>
|
||||
<button class="btn btn-default" (click)="refreshTable($event)">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
|
||||
<th><mfDefaultSorter by="label">Label</mfDefaultSorter></th>
|
||||
<th><mfDefaultSorter by="abbreviation">Abbreviation</mfDefaultSorter></th>
|
||||
<th><mfDefaultSorter by="reference">Reference</mfDefaultSorter></th>
|
||||
<th><mfDefaultSorter by="uri">Uri</mfDefaultSorter></th>
|
||||
<th><mfDefaultSorter by="definition">Definition</mfDefaultSorter></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="grayout-empty-table" *ngIf="!mf.data[0]" [contextMenu]="basicMenu" [contextMenuSubject]="datarepo"> <td colspan="5">No elements</td></tr>
|
||||
|
||||
<tr *ngFor="let datarepo of mf.data" class="hover" [contextMenu]="basicMenu" [contextMenuSubject]="datarepo">
|
||||
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{datarepo.id}}</td>
|
||||
<td>{{datarepo?.label}}</td>
|
||||
<td>{{datarepo?.abbreviation}}</td>
|
||||
<td>{{datarepo?.reference}}</td>
|
||||
<td>{{datarepo?.uri}}</td>
|
||||
<td>{{datarepo?.definition}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<mfBootstrapPaginator [rowsOnPageSet]="[10,20,40]"></mfBootstrapPaginator>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- this is the dmp editor -->
|
||||
<div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]">
|
||||
|
||||
<div> <!-- form container -->
|
||||
<div style="display:block;">
|
||||
<button (click)="switchToTable()" class="btn btn-lg btn-success pull-right" style="max-width:120px;">
|
||||
<span class="glyphicon glyphicon-arrow-left"></span> Go back
|
||||
</button>
|
||||
</div>
|
||||
<form [formGroup]="datarepoEditorForm" novalidate style="display:block;">
|
||||
<div class="form-group" [ngClass]="{null:'invisible'}[editingDatarepo?.id]">
|
||||
<label class="center-block">ID: {{editingDatarepo?.id}}
|
||||
<input class="form-control invisible" formControlName="id" [ngModel]="editingDatarepo?.id">
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="center-block">Label:
|
||||
<input class="form-control" formControlName="label" [ngModel]="editingDatarepo?.label" (ngModelChange)="editingDatarepo.label=$event">
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="center-block">Abbreviation:
|
||||
<input class="form-control" formControlName="abbreviation" [ngModel]="editingDatarepo?.abbreviation" (ngModelChange)="editingDatarepo.abbreviation=$event">
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="center-block">Reference:
|
||||
<input class="form-control" formControlName="reference" [ngModel]="editingDatarepo?.reference" (ngModelChange)="editingDatarepo.reference$event">
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="center-block">Uri:
|
||||
<input class="form-control" formControlName="uri" [ngModel]="editingDatarepo?.uri" (ngModelChange)="editingDatarepo.uri$event">
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="center-block">Definition:
|
||||
<input class="form-control" formControlName="definition" [ngModel]="editingDatarepo?.definition" (ngModelChange)="editingDatarepo.definition$event">
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group" style="width:540px;">
|
||||
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<p>Form value: {{ datarepoEditorForm.value | json }}</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<context-menu>
|
||||
<ng-template contextMenuItem [subMenu]="manage">
|
||||
<span></span>Manage data repositories
|
||||
</ng-template>
|
||||
<context-menu #manage>
|
||||
<ng-template contextMenuItem (execute)="newDatarepo($event?.item)">
|
||||
<span class="glyphicon glyphicon-plus"></span>Create data repository
|
||||
</ng-template>
|
||||
<ng-template contextMenuItem (execute)="editDatarepo($event?.item?.id)">
|
||||
<span class="glyphicon glyphicon-pencil"></span>Edit this data repository
|
||||
</ng-template>
|
||||
<ng-template contextMenuItem (execute)="delete($event?.item?.id)">
|
||||
<span class="glyphicon glyphicon-trash red"></span> Delete this
|
||||
</ng-template>
|
||||
</context-menu>
|
||||
<ng-template contextMenuItem>
|
||||
<span></span>Show full tree connections
|
||||
</ng-template>
|
||||
</context-menu>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DatareposEditorComponent } from './datarepos-editor.component';
|
||||
|
||||
describe('DatareposEditorComponent', () => {
|
||||
let component: DatareposEditorComponent;
|
||||
let fixture: ComponentFixture<DatareposEditorComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DatareposEditorComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DatareposEditorComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,137 @@
|
|||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { DatarepoService } from '../../services/datarepo-service';
|
||||
import { ContextMenuComponent } from 'ngx-contextmenu';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
import '../../../assets/custom.js';
|
||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
||||
|
||||
@Component({
|
||||
selector: 'app-datarepos-editor',
|
||||
templateUrl: './datarepos-editor.component.html',
|
||||
styleUrls: ['./datarepos-editor.component.css']
|
||||
})
|
||||
export class DatareposEditorComponent implements OnInit {
|
||||
|
||||
constructor(private datarepoService : DatarepoService, private fb: FormBuilder) {
|
||||
|
||||
}
|
||||
|
||||
//whole dmp data model
|
||||
tableData : any[] = new Array();
|
||||
|
||||
//datarepos editor data model
|
||||
editingDatarepo: any = {};
|
||||
datarepoEditorForm : any;
|
||||
|
||||
//required by the table
|
||||
public filterQuery = "";
|
||||
public rowsOnPage = 10;
|
||||
//public sortBy = "email";
|
||||
public sortOrder = "asc";
|
||||
|
||||
//visibility rules for containers
|
||||
tableVisible: boolean = true;
|
||||
editorVisible: boolean = false;
|
||||
|
||||
|
||||
// for tableIds
|
||||
showIDs : boolean = false;
|
||||
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.getAllDatarepos(false);
|
||||
this.createDatareposEditorForm();
|
||||
}
|
||||
|
||||
createDatareposEditorForm(){
|
||||
this.datarepoEditorForm = this.fb.group({
|
||||
id: null,
|
||||
label: ['', Validators.required ],
|
||||
abbreviation: '',
|
||||
reference: '',
|
||||
uri: '',
|
||||
definition: ''
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
switchToTable(){
|
||||
this.tableVisible = true;
|
||||
this.editorVisible = false;
|
||||
}
|
||||
|
||||
switchToEditor(datarepoID){
|
||||
|
||||
this.tableVisible = false;
|
||||
this.editorVisible = true;
|
||||
if(datarepoID == null){
|
||||
this.editingDatarepo = {id: null, label: "", abbreviation: "", reference: "", uri: "", definition: "" };
|
||||
}
|
||||
else{
|
||||
this.editingDatarepo = this.tableData.filter((datarepo) => datarepo.id === datarepoID)[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getAllDatarepos(showNotification : boolean){
|
||||
this.datarepoService.getAllDatarepos().subscribe( (data) => {
|
||||
this.tableData = data;
|
||||
if(showNotification)
|
||||
simple_notifier("info",null,"Refreshed the table");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
editDatarepo(datarepo){
|
||||
this.switchToEditor(datarepo);
|
||||
}
|
||||
|
||||
newDatarepo(){
|
||||
this.switchToEditor(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
save(mouseEvent){
|
||||
this.datarepoService.create(this.datarepoEditorForm.value).subscribe(
|
||||
response => {
|
||||
simple_notifier("success",null,"Saved data repository");
|
||||
this.getAllDatarepos(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not save data repository");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
delete(datarepo){
|
||||
this.datarepoService.delete(datarepo).subscribe(
|
||||
(response) => {
|
||||
simple_notifier("success",null,"Deleted data repository");
|
||||
this.getAllDatarepos(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
(err) => {
|
||||
simple_notifier("danger",null,"Could not delete data repository");
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
refreshTable($event){
|
||||
this.getAllDatarepos(true);
|
||||
}
|
||||
|
||||
|
||||
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -102,7 +102,9 @@
|
|||
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<p>Form value: {{ dmpEditorForm.value | json }}</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -125,6 +125,7 @@ export class DmpEditorComponent implements OnInit {
|
|||
response => {
|
||||
simple_notifier("success",null,"Saved dmp");
|
||||
this.getAllDmps(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not save dmp");
|
||||
|
|
|
@ -67,7 +67,9 @@
|
|||
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<p>Form value: {{ dmpProfileEditorForm.value | json }}</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -100,6 +100,7 @@ export class DmpProfileEditorComponent implements OnInit {
|
|||
response => {
|
||||
simple_notifier("success",null,"Saved DMP Profile");
|
||||
this.getAllDmpProfiles(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not save DMP Profile");
|
||||
|
|
|
@ -89,7 +89,9 @@
|
|||
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<p>Form value: {{ organisationEditorForm.value | json }}</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -100,6 +100,7 @@ export class OrganisationEditorComponent implements OnInit {
|
|||
response => {
|
||||
simple_notifier("success",null,"Saved organisation");
|
||||
this.getAllOrganisations(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not save organisation");
|
||||
|
@ -111,7 +112,7 @@ export class OrganisationEditorComponent implements OnInit {
|
|||
this.organisationService.delete(organisation).subscribe(
|
||||
(response) => {
|
||||
simple_notifier("success",null,"Deleted organisation");
|
||||
this.refreshTable(false);
|
||||
this.getAllOrganisations(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
(err) => {
|
||||
|
|
|
@ -88,7 +88,9 @@
|
|||
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<p>Form value: {{ projectEditorForm.value | json }}</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -104,6 +104,7 @@ export class ProjectEditorComponent implements OnInit {
|
|||
response => {
|
||||
simple_notifier("success",null,"Saved project");
|
||||
this.getAllProjects(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not save project");
|
||||
|
|
|
@ -88,7 +88,9 @@
|
|||
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<p>Form value: {{ registryEditorForm.value | json }}</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -102,6 +102,8 @@ export class RegistryEditorComponent implements OnInit {
|
|||
this.registryService.create(this.registryEditorForm.value).subscribe(
|
||||
response => {
|
||||
simple_notifier("success",null,"Saved registry");
|
||||
this.getAllRegistries(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not save registry");
|
||||
|
@ -113,8 +115,8 @@ export class RegistryEditorComponent implements OnInit {
|
|||
this.registryService.delete(registry).subscribe(
|
||||
(response) => {
|
||||
simple_notifier("success",null,"Deleted registry");
|
||||
this.getAllRegistries(false);
|
||||
this.switchToTable();
|
||||
this.refreshTable(false);
|
||||
},
|
||||
(err) => {
|
||||
simple_notifier("danger",null,"Could not delete registry");
|
||||
|
|
|
@ -89,7 +89,9 @@
|
|||
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<p>Form value: {{ researcherEditorForm.value | json }}</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -100,6 +100,7 @@ export class ResearcherEditorComponent implements OnInit {
|
|||
response => {
|
||||
simple_notifier("success",null,"Saved resercher");
|
||||
this.getAllResearchers(false);
|
||||
this.switchToTable();
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not save researcher");
|
||||
|
|
|
@ -89,7 +89,9 @@
|
|||
<button style="float:right;" type="submit" (click)="save($event, $data, $form)"class="btn btn-success">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<p>Form value: {{ serviceEditorForm.value | json }}</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import * as _ from "lodash";
|
||||
import {Pipe, PipeTransform} from "@angular/core";
|
||||
|
||||
@Pipe({
|
||||
name: "datarepoTableFilter"
|
||||
})
|
||||
export class DatarepoTableFilterPipe implements PipeTransform {
|
||||
|
||||
transform(array: any[], query: string): any {
|
||||
|
||||
if (query) {
|
||||
|
||||
return _.filter(array, row => {
|
||||
if (row.uri == null) row.uri = "";
|
||||
if (row.label == null) row.label = "";
|
||||
if (row.id == null) row.id = "";
|
||||
return (
|
||||
|
||||
row.label.indexOf(query) > -1 ||
|
||||
|
||||
//row.version == query ||
|
||||
row.id.indexOf(query) > -1
|
||||
)
|
||||
});
|
||||
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ import { ServiceEditorComponent } from './managers/service-editor/service-editor
|
|||
import { RegistryEditorComponent } from './managers/registry-editor/registry-editor.component';
|
||||
import { OrganisationEditorComponent } from './managers/organisation-editor/organisation-editor.component';
|
||||
import { ResearcherEditorComponent } from './managers/researcher-editor/researcher-editor.component';
|
||||
import { DatareposEditorComponent } from './managers/datarepos-editor/datarepos-editor.component';
|
||||
|
||||
|
||||
import { MainWindowComponent } from './main-window/main-window.component';
|
||||
|
@ -29,6 +30,10 @@ export const routes: Routes = [
|
|||
path: 'datasets',
|
||||
component: DatasetsViewerComponent
|
||||
},
|
||||
{
|
||||
path: 'datarepos',
|
||||
component: DatareposEditorComponent
|
||||
},
|
||||
{
|
||||
path: 'datasets/profile',
|
||||
component: ProfileEditorComponent
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
import { Component, Input, OnInit, AfterViewChecked, ViewChild } from '@angular/core';
|
||||
import { HttpClient , HttpHeaders, HttpParams} from '@angular/common/http';
|
||||
import { TokenService, TokenProvider } from './login/token.service'
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Toolbox } from '../services/toolbox';
|
||||
import {RestBase} from './rest-base';
|
||||
import 'rxjs/Rx';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class DatarepoService implements OnInit {
|
||||
|
||||
|
||||
constructor(public restBase: RestBase) {
|
||||
}
|
||||
|
||||
ngOnInit(){
|
||||
|
||||
}
|
||||
|
||||
getDatarepoIdsLabels() {
|
||||
return this.restBase.get("datarepo/listAllLabelIDs");
|
||||
}
|
||||
|
||||
getDatarepoIds(){
|
||||
return this.restBase.get("datarepos");
|
||||
}
|
||||
|
||||
getAllDatarepos(){
|
||||
return this.restBase.get("datarepo/getAll");
|
||||
}
|
||||
|
||||
create(datarepo){
|
||||
return this.restBase.post("datarepo/create", datarepo);
|
||||
}
|
||||
|
||||
|
||||
delete(datarepoID){
|
||||
var datarepo = {"id": datarepoID};
|
||||
return this.restBase.post("datarepo/delete", datarepo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -19,12 +19,12 @@ export class DatasetProfileService implements OnInit {
|
|||
|
||||
|
||||
getDatasetProfileById(datasetProfileID){
|
||||
return this.restBase.get("datasetprofile/"+datasetProfileID)
|
||||
.map((response: Response) => response.json());
|
||||
return this.restBase.get("datasetprofile/"+datasetProfileID);
|
||||
//.map((response: Response) => response.json());
|
||||
}
|
||||
|
||||
setDatasetProfile(datasetProfile){
|
||||
return this.restBase.post("setDatasetProfile", datasetProfile);
|
||||
return this.restBase.post("datasetprofile/set", datasetProfile);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"lockfileVersion": 1
|
||||
}
|
|
@ -4,7 +4,11 @@ import java.util.UUID;
|
|||
|
||||
import dao.Dao;
|
||||
import entities.DMPResearcher;
|
||||
import entities.Researcher;
|
||||
|
||||
public interface DMPResearcherDao extends Dao<DMPResearcher, UUID> {
|
||||
|
||||
|
||||
Researcher getResearcherByEmail(String email);
|
||||
|
||||
}
|
|
@ -2,9 +2,13 @@ package dao.entities;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import org.hibernate.NonUniqueResultException;
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DMPResearcher;
|
||||
import entities.Researcher;
|
||||
|
||||
public class DMPResearcherDaoImpl extends JpaDao<DMPResearcher, UUID> implements DMPResearcherDao {
|
||||
|
||||
|
@ -12,6 +16,20 @@ public class DMPResearcherDaoImpl extends JpaDao<DMPResearcher, UUID> implements
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Researcher getResearcherByEmail(String email) {
|
||||
String queryString = "FROM Researcher researcher where primaryEmail=:email";
|
||||
TypedQuery<Researcher> typedQuery = entityManager.createQuery(queryString, Researcher.class);
|
||||
typedQuery.setParameter("email", email);
|
||||
try {
|
||||
return typedQuery.getSingleResult();
|
||||
}catch(Exception ex) {
|
||||
System.out.println(ex.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.UUID;
|
|||
|
||||
import dao.Dao;
|
||||
import entities.Registry;
|
||||
import entities.Researcher;
|
||||
import entities.responses.IDLabelPair;
|
||||
|
||||
public interface RegistryDao extends Dao<Registry, UUID> {
|
||||
|
@ -12,5 +13,6 @@ public interface RegistryDao extends Dao<Registry, UUID> {
|
|||
List<UUID> listAllIDs();
|
||||
|
||||
List<IDLabelPair> listAllIDsLabels();
|
||||
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ import org.hibernate.query.Query;
|
|||
|
||||
import dao.JpaDao;
|
||||
import entities.Registry;
|
||||
import entities.Researcher;
|
||||
import entities.responses.IDLabelPair;
|
||||
|
||||
public class RegistryDaoImpl extends JpaDao<Registry, UUID> implements RegistryDao {
|
||||
|
@ -37,6 +38,6 @@ public class RegistryDaoImpl extends JpaDao<Registry, UUID> implements RegistryD
|
|||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,5 +12,7 @@ public interface ResearcherDao extends Dao<Researcher, UUID> {
|
|||
List<UUID> listAllIDs();
|
||||
|
||||
List<IDLabelPair> listAllIDsLabels();
|
||||
|
||||
Researcher getResearcherByEmail(String email);
|
||||
|
||||
}
|
|
@ -38,6 +38,16 @@ public class ResearcherDaoImpl extends JpaDao<Researcher, UUID> implements Resea
|
|||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Researcher getResearcherByEmail(String email) {
|
||||
String queryString = "FROM Researcher researcher where researcher.primaryEmail=:email";
|
||||
TypedQuery<Researcher> typedQuery = entityManager.createQuery(queryString, Researcher.class);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package dao.entities.security;
|
||||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.security.UserInfo;
|
||||
import entities.UserInfo;
|
||||
|
||||
public interface UserInfoDao extends Dao<UserInfo, UUID> {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package dao.entities.security;
|
||||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
@ -7,8 +7,8 @@ import javax.persistence.NoResultException;
|
|||
import javax.persistence.TypedQuery;
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.UserInfo;
|
||||
import entities.security.UserAuth;
|
||||
import entities.security.UserInfo;
|
||||
|
||||
|
||||
public class UserInfoDaoImpl extends JpaDao<UserInfo, UUID> implements UserInfoDao {
|
|
@ -88,6 +88,14 @@ public class DMP implements Serializable {
|
|||
private Set<Researcher> researchers;
|
||||
|
||||
|
||||
// @OneToMany(fetch = FetchType.EAGER)
|
||||
// @JoinTable(name="\"UserDMP\"",
|
||||
// joinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")},
|
||||
// inverseJoinColumns={@JoinColumn(name="user", referencedColumnName="\"ID\"")}
|
||||
// )
|
||||
// private Set<UserInfo> users;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -168,6 +176,15 @@ public class DMP implements Serializable {
|
|||
this.researchers = researchers;
|
||||
}
|
||||
|
||||
|
||||
// public Set<UserInfo> getUsers() {
|
||||
// return users;
|
||||
// }
|
||||
//
|
||||
// public void setUsers(Set<UserInfo> users) {
|
||||
// this.users = users;
|
||||
// }
|
||||
|
||||
public String toString() {
|
||||
try {
|
||||
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this);
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
//package entities;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//import java.util.UUID;
|
||||
//
|
||||
//import javax.persistence.Column;
|
||||
//import javax.persistence.Entity;
|
||||
//import javax.persistence.GeneratedValue;
|
||||
//import javax.persistence.Id;
|
||||
//import javax.persistence.Table;
|
||||
//
|
||||
//import org.hibernate.annotations.GenericGenerator;
|
||||
//import org.hibernate.annotations.Type;
|
||||
//
|
||||
//import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
//import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
//
|
||||
//@Entity
|
||||
//@Table(name="\"UserInfo\"")
|
||||
//@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="autoid")
|
||||
//public class UserDMP implements Serializable{
|
||||
//
|
||||
// private static final long serialVersionUID = -4467370784003784660L;
|
||||
//
|
||||
//
|
||||
// @Id
|
||||
// @GeneratedValue
|
||||
// @GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
// @Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
// private UUID id;
|
||||
//
|
||||
// @Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
// @Column(name = "user", nullable = false)
|
||||
// private UUID user;
|
||||
//
|
||||
// @Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
// @Column(name = "dmp", nullable = false)
|
||||
// private UUID dmp;
|
||||
//
|
||||
// @Column(name = "role")
|
||||
// private Integer role;
|
||||
//
|
||||
// public UUID getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(UUID id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public UUID getUser() {
|
||||
// return user;
|
||||
// }
|
||||
//
|
||||
// public void setUser(UUID user) {
|
||||
// this.user = user;
|
||||
// }
|
||||
//
|
||||
// public UUID getDmp() {
|
||||
// return dmp;
|
||||
// }
|
||||
//
|
||||
// public void setDmp(UUID dmp) {
|
||||
// this.dmp = dmp;
|
||||
// }
|
||||
//
|
||||
// public Integer getRole() {
|
||||
// return role;
|
||||
// }
|
||||
//
|
||||
// public void setRole(Integer role) {
|
||||
// this.role = role;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
|
@ -1,7 +1,8 @@
|
|||
package entities.security;
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
@ -10,6 +11,8 @@ import javax.persistence.FetchType;
|
|||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
|
@ -21,10 +24,12 @@ import org.hibernate.annotations.Type;
|
|||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
import entities.security.UserAuth;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"UserInfo\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="autoid")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class UserInfo implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1225151430484658395L;
|
||||
|
@ -32,13 +37,10 @@ public class UserInfo implements Serializable{
|
|||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "autoid", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID autoid;
|
||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@Column(name = "identification", nullable = false)
|
||||
private String identification = null;
|
||||
|
||||
@Column(name = "email", nullable = false)
|
||||
private String email = null;
|
||||
|
||||
|
@ -71,12 +73,37 @@ public class UserInfo implements Serializable{
|
|||
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
|
||||
private String additionalinfo;
|
||||
|
||||
public String getIdentification() {
|
||||
return identification;
|
||||
// @OneToMany(fetch = FetchType.EAGER)
|
||||
// @JoinTable(name="\"UserDMP\"",
|
||||
// joinColumns={@JoinColumn(name="user", referencedColumnName="\"ID\"")},
|
||||
// inverseJoinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")}
|
||||
// )
|
||||
// private Set<UserInfo> users;
|
||||
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setIdentification(String identification) {
|
||||
this.identification = identification;
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getLastloggedin() {
|
||||
return lastloggedin;
|
||||
}
|
||||
|
||||
public void setLastloggedin(Date lastloggedin) {
|
||||
this.lastloggedin = lastloggedin;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
|
@ -21,10 +21,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import dao.entities.UserInfoDao;
|
||||
import dao.entities.security.UserAuthDao;
|
||||
import dao.entities.security.UserInfoDao;
|
||||
import entities.UserInfo;
|
||||
import entities.security.UserAuth;
|
||||
import entities.security.UserInfo;
|
||||
import security.TokenSessionManager;
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package rest.proxy;
|
||||
package proxy;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -57,12 +57,12 @@ public class Proxy {
|
|||
while ((inputLine = in.readLine()) != null)
|
||||
response.append(inputLine);
|
||||
in.close();
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(response.toString());
|
||||
}
|
||||
else {
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{'reason': 'Remote server responded with: "+responseCode+"'}");
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(response.toString());
|
||||
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{'reason': 'Could not proxy to given host'}");
|
||||
}
|
|
@ -257,6 +257,7 @@ public class Datasets {
|
|||
try {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDatasetProfile));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not set dataset profile!\"}");
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ public class Projects {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) {
|
||||
|
|
|
@ -96,6 +96,18 @@ public class Researchers {
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/researcher/getByEmail" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> getResearcherByEmail(@RequestParam("email") String email){
|
||||
try {
|
||||
Researcher researcher = researcherDao.getResearcherByEmail(email);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(researcher));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/researcher/getAll" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> getAllResearchers(){
|
||||
|
|
|
@ -12,8 +12,8 @@ import org.springframework.security.core.Authentication;
|
|||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import dao.entities.security.UserInfoDao;
|
||||
import entities.security.UserInfo;
|
||||
import dao.entities.UserInfoDao;
|
||||
import entities.UserInfo;
|
||||
import exceptions.NonValidTokenException;
|
||||
import security.validators.GoogleTokenValidator;
|
||||
import security.validators.NativeTokenValidator;
|
||||
|
@ -64,7 +64,6 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
|||
else
|
||||
throw new AuthenticationServiceException("Authentication failed");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.google.api.client.http.HttpTransport;
|
|||
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||
import com.google.api.client.json.jackson2.JacksonFactory;
|
||||
|
||||
import entities.security.UserInfo;
|
||||
import entities.UserInfo;
|
||||
import exceptions.NonValidTokenException;
|
||||
|
||||
public class GoogleTokenValidator implements TokenValidator {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<bean id="nativeTokenValidator" class="security.validators.NativeTokenValidator" />
|
||||
|
||||
|
||||
<bean id="proxy" class="rest.proxy.Proxy">
|
||||
<bean id="proxy" class="proxy.Proxy">
|
||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||
</bean>
|
||||
|
||||
|
@ -100,7 +100,7 @@
|
|||
<bean id="registryDao" class="dao.entities.RegistryDaoImpl" />
|
||||
<bean id="researcherDao" class="dao.entities.ResearcherDaoImpl" />
|
||||
<bean id="serviceDao" class="dao.entities.ServiceDaoImpl" />
|
||||
<bean id="userInfoDao" class="dao.entities.security.UserInfoDaoImpl" />
|
||||
<bean id="userInfoDao" class="dao.entities.UserInfoDaoImpl" />
|
||||
<bean id="userAuthDao" class="dao.entities.security.UserAuthDaoImpl" />
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||
|
||||
|
||||
<!-- <context:property-placeholder location="classpath*:**/dmp.properties" /> -->
|
||||
<context:property-placeholder location="classpath*:**/dmp.properties" />
|
||||
|
||||
<mvc:resources mapping="resources/**" location="/resources/" />
|
||||
<mvc:annotation-driven />
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||
|
||||
|
||||
<context:property-placeholder location="classpath*:**/dmp.properties" />
|
||||
|
||||
<mvc:resources mapping="resources/**" location="/resources/" />
|
||||
<mvc:annotation-driven />
|
||||
<context:component-scan base-package="proxy" />
|
||||
|
||||
|
||||
<bean id="proxy" class="proxy.Proxy">
|
||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="multipartResolver"
|
||||
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||
<property name="maxUploadSize" value="100000000" />
|
||||
</bean>
|
||||
|
||||
<bean id="jsonConverter"
|
||||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
||||
<property name="prefixJson" value="false" />
|
||||
<property name="supportedMediaTypes" value="application/json" />
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
|
||||
<property name="messageConverters">
|
||||
<list>
|
||||
<ref bean="jsonConverter" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -16,9 +16,7 @@
|
|||
<mvc:annotation-driven />
|
||||
<context:component-scan base-package="rest" />
|
||||
|
||||
<bean id="proxy" class="rest.proxy.Proxy">
|
||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
|
|
|
@ -3,7 +3,20 @@
|
|||
|
||||
<display-name>dmp-backend</display-name>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>dmp-backend-proxy</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>dmp-backend-proxy</servlet-name>
|
||||
<url-pattern>/proxy/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>dmp-backend-login</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
|
|
|
@ -25,7 +25,10 @@ drop table if exists "Registry" cascade;
|
|||
drop table if exists "DatasetService" cascade;
|
||||
drop table if exists "DatasetRegistry" cascade;
|
||||
drop table if exists "DatasetDataRepository" cascade;
|
||||
drop table if exists "UserInfo" cascade;
|
||||
DROP table if exists "UserDMP" cascade;
|
||||
DROP table if exists "UserInfo" cascade;
|
||||
DROP table if exists "UserAuth" cascade;
|
||||
|
||||
|
||||
|
||||
-- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
|
@ -447,12 +450,13 @@ ALTER TABLE ONLY "DatasetService"
|
|||
ADD CONSTRAINT "DatasetServiceServiceReference" FOREIGN KEY ("Service") REFERENCES "Service"("ID");
|
||||
|
||||
|
||||
DROP table if exists "UserDMP";
|
||||
DROP table if exists "UserInfo";
|
||||
DROP table if exists "UserAuth";
|
||||
|
||||
CREATE TABLE "UserInfo" (
|
||||
"autoid" uuid DEFAULT uuid_generate_v4() NOT NULL,
|
||||
"identification" character varying(500) NOT NULL,
|
||||
"email" character varying(250) NOT NULL,
|
||||
"id" uuid DEFAULT uuid_generate_v4() UNIQUE NOT NULL,
|
||||
"email" character varying(250) UNIQUE NOT NULL,
|
||||
"authorization_level" smallint NOT NULL,
|
||||
"usertype" smallint NOT NULL,
|
||||
"authentication" uuid,
|
||||
|
@ -461,15 +465,13 @@ CREATE TABLE "UserInfo" (
|
|||
"created" timestamp,
|
||||
"lastloggedin" timestamp,
|
||||
"additionalinfo" xml,
|
||||
PRIMARY KEY (identification, email)
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON COLUMN "UserInfo"."authorization_level" IS 'This stores the authorization level of the user: 0 admin, 1 user, being able to be extended furthermore';
|
||||
COMMENT ON COLUMN "UserInfo"."usertype" IS 'This stores the type of user: 0 -> internal, 1 external';
|
||||
|
||||
|
||||
DROP table if exists "UserAuth";
|
||||
|
||||
CREATE TABLE "UserAuth" (
|
||||
"id" uuid DEFAULT uuid_generate_v4() NOT NULL UNIQUE,
|
||||
"username" character varying(200) NOT NULL,
|
||||
|
@ -483,8 +485,21 @@ ALTER TABLE "UserInfo" ADD CONSTRAINT fkey_userinfo_userauth FOREIGN KEY ("authe
|
|||
|
||||
COMMENT ON COLUMN "UserAuth"."password" IS 'This field stores a password hash';
|
||||
|
||||
|
||||
create table "UserDMP" (
|
||||
"id" uuid DEFAULT uuid_generate_v4() NOT NULL,
|
||||
"user" uuid NOT NULL,
|
||||
"dmp" uuid NOT NUll,
|
||||
"role" integer
|
||||
);
|
||||
|
||||
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_user FOREIGN KEY ("user") REFERENCES "UserInfo"("id");
|
||||
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_dmp FOREIGN KEY ("dmp") REFERENCES "DMP"("ID");
|
||||
|
||||
|
||||
ALTER TABLE "UserInfo" OWNER TO dmptool;
|
||||
ALTER TABLE "UserAuth" OWNER TO dmptool;
|
||||
ALTER TABLE "UserDMP" OWNER TO dmptool;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import { RouterModule, Routes, Router } from '@angular/router';
|
|||
import {DataTableModule } from 'angular-2-data-table';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { RestBase } from './services/rest-base';
|
||||
import { DynamicFormComponent } from './form/dynamic-form.component';
|
||||
import { DynamicFormFieldComponent } from './form/fields/dynamic-form-field.component';
|
||||
import { ServerService } from './services/server.service';
|
||||
|
@ -22,6 +23,7 @@ import { PageNotFoundComponent } from './not-found.component';
|
|||
import { TocComponent } from './form/tableOfContents/toc.component';
|
||||
import { ProjectsModule } from './projects/project.module';
|
||||
import { PaginationService } from './services/pagination.service';
|
||||
import { EestoreService } from './services/eestore.service';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
@ -45,7 +47,7 @@ import { PaginationService } from './services/pagination.service';
|
|||
DataTableModule
|
||||
|
||||
],
|
||||
providers: [ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService],
|
||||
providers: [ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {
|
||||
|
|
|
@ -53,6 +53,7 @@ export class DynamicFormComponent implements OnInit {
|
|||
|
||||
|
||||
this.serverService.getData().subscribe(
|
||||
|
||||
response => {
|
||||
|
||||
console.log("response");
|
||||
|
@ -60,6 +61,12 @@ export class DynamicFormComponent implements OnInit {
|
|||
|
||||
const data = response;
|
||||
|
||||
console.log("data.dataset--BEFORE")
|
||||
console.log(response.dataset.profile.definition)
|
||||
console.log(response.dataset.profile.ruleset.definition)
|
||||
console.log(response.dataset.profile.viewstyle.definition)
|
||||
|
||||
|
||||
//replace the xmls {model,view,rule} definitions with json -- https://github.com/abdmob/x2js library
|
||||
data.dataset.profile.definition = this.xml2jsonOBJ.xml_str2json(data.dataset.profile.definition);
|
||||
data.dataset.profile.ruleset.definition = this.xml2jsonOBJ.xml_str2json(data.dataset.profile.ruleset.definition);
|
||||
|
@ -67,6 +74,12 @@ export class DynamicFormComponent implements OnInit {
|
|||
//can be converted back to xml (which shouldn't be needed) with this.xml2jsonOBJ.json2xml_str
|
||||
|
||||
console.log("this.serverService.getFields");
|
||||
|
||||
console.log("data.dataset")
|
||||
console.log(data.dataset.profile.definition)
|
||||
console.log(data.dataset.profile.ruleset.definition)
|
||||
console.log(data.dataset.profile.viewstyle.definition)
|
||||
|
||||
|
||||
this.dataModel = new DataModel();
|
||||
this.dataModel = this.dataModelService.getDataModel(data);
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
import { Component, Input, OnInit, AfterViewChecked, ViewChild, Injectable } from '@angular/core';
|
||||
|
||||
import {RestBase} from './rest-base';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class EestoreService implements OnInit {
|
||||
|
||||
base: string = "https://eestore.paas2.uninett.no/api/";
|
||||
|
||||
datarepo: string = this.base+"datarepo/";
|
||||
projectrepo: string = this.base+"projectrepo/";
|
||||
organizationrepo: string = this.base+"organizationrepo/";
|
||||
metadataschemarepo: string = this.base+"metadataschemarepo/";
|
||||
servicerepo: string = this.base+"servicerepo/";
|
||||
personrepo: string = this.base+"personrepo/";
|
||||
config: string = this.base+"config/";
|
||||
configtags: string = this.base+"configtags/";
|
||||
|
||||
|
||||
constructor(public restBase: RestBase) {
|
||||
}
|
||||
|
||||
ngOnInit(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
getDataRepos(){
|
||||
return this.restBase.proxy_get(this.datarepo);
|
||||
}
|
||||
|
||||
getProjectRepos(){
|
||||
return this.restBase.proxy_get(this.projectrepo);
|
||||
}
|
||||
|
||||
getOrganizationRepos(){
|
||||
return this.restBase.proxy_get(this.organizationrepo);
|
||||
}
|
||||
|
||||
getMetadataSchemaRepos(){
|
||||
return this.restBase.proxy_get(this.metadataschemarepo);
|
||||
}
|
||||
|
||||
getServiceRepos(){
|
||||
return this.restBase.proxy_get(this.servicerepo);
|
||||
}
|
||||
|
||||
getPersonRepos(){
|
||||
return this.restBase.proxy_get(this.personrepo);
|
||||
}
|
||||
|
||||
getConfigs(){
|
||||
return this.restBase.proxy_get(this.config);
|
||||
}
|
||||
|
||||
getConfigTags(){
|
||||
return this.restBase.proxy_get(this.configtags);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
import { HttpClient , HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { TokenService, TokenProvider } from './token.service'
|
||||
import 'rxjs/Rx';
|
||||
|
||||
|
||||
declare var X2JS: any;
|
||||
|
||||
export class RestBase {
|
||||
|
||||
xml2jsonOBJ: any;
|
||||
|
||||
static get parameters() { return [HttpClient, TokenService] }
|
||||
|
||||
constructor(public http : HttpClient, public tokenService : TokenService) {
|
||||
this.xml2jsonOBJ = new X2JS();
|
||||
}
|
||||
|
||||
protocol: string = "http";
|
||||
hostname: string = "localhost";//"dl010.madgik.di.uoa.gr";//
|
||||
port: number = 7070;//8080;//
|
||||
webappname: string = "dmp-backend";//"dmp-backend-new";//
|
||||
|
||||
|
||||
proxyPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/proxy/";
|
||||
loginPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/login/";
|
||||
restPath: string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/rest/";
|
||||
|
||||
|
||||
public proxy_get(path : string){
|
||||
var options = this.createOptions();
|
||||
return this.http.get<any>(this.proxyPath +"proxy?url="+ path, options);
|
||||
}
|
||||
|
||||
public login(path : string, data : any){
|
||||
let options = { headers: new HttpHeaders().set('Content-Type', 'application/json') };
|
||||
return this.http.post<any>(this.loginPath + path, JSON.stringify(data), options);
|
||||
}
|
||||
|
||||
public get(path : string){
|
||||
var options = this.createOptions();
|
||||
return this.http.get<any>(this.restPath + path, options);
|
||||
}
|
||||
|
||||
|
||||
public post(path : string, data : any) {
|
||||
var options = this.createOptions();
|
||||
return this.http.post<any>(this.restPath + path, JSON.stringify(data), options);
|
||||
}
|
||||
|
||||
|
||||
private createOptions(){
|
||||
var token = this.tokenService.getToken();
|
||||
var provider: TokenProvider = this.tokenService.getProvider();
|
||||
//var csrfToken : string = this.tokenService.getCSRFToken();
|
||||
|
||||
const params = new HttpParams();
|
||||
var headers;
|
||||
if(provider == TokenProvider.google)
|
||||
headers = new HttpHeaders().set('Content-Type', 'application/json').set("google-token", token);
|
||||
if(provider == TokenProvider.native)
|
||||
headers = new HttpHeaders().set('Content-Type', 'application/json').set("native-token", token);
|
||||
let options = { params: params, headers: headers };
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -11,11 +11,11 @@ export class TokenService {
|
|||
|
||||
|
||||
constructor (private storage : LocalStorageService, @Inject(DOCUMENT) private document) {
|
||||
var csrfToken : string = jQuery(document).find('meta[name="csrf-token"]').attr('content');
|
||||
this.setCSRFToken(csrfToken);
|
||||
//var csrfToken : string = jQuery(document).find('meta[name="csrf-token"]').attr('content');
|
||||
//this.setCSRFToken(csrfToken);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
getCSRFToken() : string{
|
||||
return this.storage.retrieve('csrf-token');
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export class TokenService {
|
|||
setCSRFToken(csrfToken : string){
|
||||
this.storage.store('csrf-token',csrfToken);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
getProvider() : TokenProvider {
|
||||
return this.storage.retrieve('provider');
|
||||
|
|
Loading…
Reference in New Issue