Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot

This commit is contained in:
annampak 2017-11-08 15:54:47 +02:00
commit fe0afe306b
11 changed files with 209 additions and 74 deletions

View File

@ -219,6 +219,23 @@
"source-map": "0.5.7"
}
},
"@ngui/auto-complete": {
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/@ngui/auto-complete/-/auto-complete-0.16.0.tgz",
"integrity": "sha1-s02xfjG4DlhKx5uqc45AWsurEsc=",
"requires": {
"@ngui/utils": "0.8.1"
}
},
"@ngui/utils": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@ngui/utils/-/utils-0.8.1.tgz",
"integrity": "sha1-jxq5qCbjXrC68XQd2UOOgoT8Tvg=",
"requires": {
"@types/js-beautify": "0.0.28",
"js-beautify": "1.7.4"
}
},
"@types/gapi": {
"version": "0.0.35",
"resolved": "https://registry.npmjs.org/@types/gapi/-/gapi-0.0.35.tgz",
@ -247,6 +264,11 @@
"@types/jasmine": "2.5.54"
}
},
"@types/js-beautify": {
"version": "0.0.28",
"resolved": "https://registry.npmjs.org/@types/js-beautify/-/js-beautify-0.0.28.tgz",
"integrity": "sha1-MiC7vZL8DnKLpTBr+kSwBIghYS0="
},
"@types/node": {
"version": "6.0.90",
"resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.90.tgz",
@ -267,8 +289,7 @@
"abbrev": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
"integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=",
"dev": true
"integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8="
},
"accepts": {
"version": "1.3.4",
@ -652,6 +673,11 @@
}
}
},
"angular2-uuid": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/angular2-uuid/-/angular2-uuid-1.1.1.tgz",
"integrity": "sha1-cvA81TK39AAy6x7PufhFc4S+lW4="
},
"ansi-escapes": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-2.0.0.tgz",
@ -1193,8 +1219,7 @@
"bluebird": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz",
"integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=",
"dev": true
"integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw="
},
"bn.js": {
"version": "4.11.8",
@ -1805,8 +1830,7 @@
"commander": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==",
"dev": true
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ=="
},
"common-tags": {
"version": "1.4.0",
@ -1865,6 +1889,15 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"config-chain": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.11.tgz",
"integrity": "sha1-q6CXR9++TD5w52am5BWG4YWfxvI=",
"requires": {
"ini": "1.3.4",
"proto-list": "1.2.4"
}
},
"connect": {
"version": "3.6.3",
"resolved": "https://registry.npmjs.org/connect/-/connect-3.6.3.tgz",
@ -2557,6 +2590,28 @@
"jsbn": "0.1.1"
}
},
"editorconfig": {
"version": "0.13.3",
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.13.3.tgz",
"integrity": "sha512-WkjsUNVCu+ITKDj73QDvi0trvpdDWdkDyHybDGSXPfekLCqwmpD7CP7iPbvBgosNuLcI96XTDwNa75JyFl7tEQ==",
"requires": {
"bluebird": "3.5.0",
"commander": "2.11.0",
"lru-cache": "3.2.0",
"semver": "5.4.1",
"sigmund": "1.0.1"
},
"dependencies": {
"lru-cache": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz",
"integrity": "sha1-cXibO39Tmb7IVl3aOKow0qCX7+4=",
"requires": {
"pseudomap": "1.0.2"
}
}
}
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@ -4062,8 +4117,7 @@
"ini": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz",
"integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=",
"dev": true
"integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4="
},
"inquirer": {
"version": "3.2.2",
@ -4643,6 +4697,27 @@
"integrity": "sha1-8OgK4DmkvWVLXygfyT8EqRSn/M4=",
"dev": true
},
"js-beautify": {
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.7.4.tgz",
"integrity": "sha512-6YX1g+lIl0/JDxjFFbgj7fz6i0bWFa2Hdc7PfGqFhynaEiYe1NJ3R1nda0VGaRiGU82OllR+EGDoWFpGr3k5Kg==",
"requires": {
"config-chain": "1.1.11",
"editorconfig": "0.13.3",
"mkdirp": "0.5.1",
"nopt": "3.0.6"
},
"dependencies": {
"nopt": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
"integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=",
"requires": {
"abbrev": "1.1.0"
}
}
}
},
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
@ -6774,6 +6849,11 @@
"asap": "2.0.6"
}
},
"proto-list": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
"integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk="
},
"protractor": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/protractor/-/protractor-5.1.2.tgz",
@ -6909,8 +6989,7 @@
"pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
"dev": true
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
},
"public-encrypt": {
"version": "4.0.0",
@ -7577,8 +7656,7 @@
"semver": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==",
"dev": true
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg=="
},
"semver-dsl": {
"version": "1.0.1",
@ -7716,6 +7794,11 @@
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
"dev": true
},
"sigmund": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA="
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",

View File

@ -21,12 +21,14 @@
"@angular/platform-browser": "^4.3.6",
"@angular/platform-browser-dynamic": "^4.3.6",
"@angular/router": "^4.3.6",
"@ngui/auto-complete": "^0.16.0",
"angular-2-data-table": "^0.1.2",
"angular-4-data-table-bootstrap-4": "^0.2.0",
"angular-google-signin": "^0.1.5",
"angular2-datatable": "^0.6.0",
"angular2-draggable": "^1.0.7",
"angular2-number-picker": "^0.8.8",
"angular2-uuid": "^1.1.1",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"flat": "^4.0.0",

View File

@ -66,6 +66,9 @@
<!--
-->
<!--
<autocomplete-remote [id]="'test-autocomplete'" [label]="'Please select smth'" [url]="'https://eestore.paas2.uninett.no/api/datarepo/'" ></autocomplete-remote>
-->
</div>
</div>

View File

@ -6,6 +6,9 @@ import { TokenService, TokenProvider } from './services/login/token.service';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
import { AutocompleteRemoteComponent } from './form/fields/autocomplete-remote/autocomplete-remote.component';
declare var $ :any;
@Component({
selector: 'app-root',

View File

@ -38,7 +38,7 @@ import { AngularDraggableModule } from 'angular2-draggable';
import { NativeLoginService } from './services/login/native-login.service';
import { GooggleSignInComponent } from './login/googgle-sign-in/googgle-sign-in.component';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
import { NguiAutoCompleteModule } from '@ngui/auto-complete';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
@ -67,6 +67,8 @@ import { NgDatepickerModule } from 'ng2-datepicker';
import { StatusToString } from './pipes/various/status-to-string';
import { SidebarModule } from 'ng-sidebar';
import { UserWorkspaceComponent } from './user-workspace/user-workspace.component';
import { AutocompleteRemoteComponent } from './form/fields/autocomplete-remote/autocomplete-remote.component';
import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner';
@ -90,7 +92,8 @@ import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner';
DatasetsComponent,
UserWorkspaceComponent,
ConfirmationComponent,
AutocompleteRemoteComponent,
ProjectTableFilterPipe,
DmpVersionFilterPipe,
DmpStatusFilterPipe,
@ -115,6 +118,7 @@ import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner';
DataTableModule,
NgDatepickerModule,
Ng4LoadingSpinnerModule,
NguiAutoCompleteModule,
SidebarModule.forRoot()
],

View File

@ -0,0 +1,5 @@
<div class="form-group">
<label *ngIf="label" for="{{id}}">{{label}}</label>
<input auto-complete class="form-control" id="{{id}}" [ngModel]="selectedValue" (ngModelChange)="updateByQuery($event)" [source]="values" />
</div>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AutocompleteRemoteComponent } from './autocomplete-remote.component';
describe('AutocompleteRemoteComponent', () => {
let component: AutocompleteRemoteComponent;
let fixture: ComponentFixture<AutocompleteRemoteComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AutocompleteRemoteComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AutocompleteRemoteComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,56 @@
import { Component, OnInit,Input, Output, EventEmitter} from '@angular/core';
import { ServerService } from '../../../services/server.service';
import { UUID } from 'angular2-uuid';
import { NguiAutoCompleteModule } from '@ngui/auto-complete';
declare var $: any;
@Component({
selector: 'autocomplete-remote',
templateUrl: './autocomplete-remote.component.html',
styleUrls: ['./autocomplete-remote.component.css']
})
export class AutocompleteRemoteComponent implements OnInit {
constructor(private serverService :ServerService) {
}
@Input() id : string;
@Input() label : string;
@Input() url : string;
selectedValue : string;
//@Output() selectedValueEmitter: EventEmitter<string> = new EventEmitter<string>();
values : any[] = new Array();
query : string = "";
ngOnInit() {
if(this.id == null)
this.id = UUID.UUID();
this.updateByQuery(this.query); //just to trigger the first call
}
updateByQuery(query : string){
//this.selectedValueEmitter.next(this.selectedValue);
this.serverService.getThroughProxy(this.url, query).subscribe(
response => {
this.values.length = 0; //clear array; -- this is quite a fast and memory efficient way
response.data.forEach(element => {
this.values.push(element.attributes.name);
});
},
error => {
console.log(error);
}
);
}
}

View File

@ -33,17 +33,24 @@ export class RestBase {
webappname: string = "dmp-backend";
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, params? : any){
var options = this.createOptions(params);
return this.http.get<any>(this.proxyPath +"proxy?url="+ path, options);
}
public proxy_get_wQuery(path : string, query: string, params? : any){
var options = this.createOptions(params);
return this.http.get<any>(this.proxyPath +"proxy?url="+ path+"?search="+query, 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);

View File

@ -1,12 +1,10 @@
import {Injectable, ReflectiveInjector, Injector} from '@angular/core';
import { HttpClient , HttpHeaders, HttpParams} from '@angular/common/http';
import {FieldBase} from '../../app/form/fields/field-base';
import {JsonObjest} from '../../app/entities/JsonObject.class';
import {dataModelBuilder} from '../../app/services/dataModelBuilder.service';
import { DatasetProfile } from '../entities/datasetprofile';
import {DataModel} from '../entities/DataModel';
import {Project} from '../entities/model/project';
import { TokenService, TokenProvider } from './login/token.service';
import {RestBase} from './rest-base';
import 'rxjs/Rx';
@ -18,7 +16,7 @@ export class ServerService {
xml2jsonOBJ: any;
constructor(private httpClient: HttpClient, private tokenService: TokenService, private restBase: RestBase) { //private http: Http
constructor(private restBase: RestBase) {
this.xml2jsonOBJ = new X2JS();
}
@ -143,68 +141,17 @@ public deleteDataset(dataset: any){
}
/*
logOut() {
this.tokenService.logout();
}
getData() {
//let headers = new HttpHeaders();
// let headers = new HttpHeaders().set("google-token", this.tokenService.getToken());
// 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)
.map(
(response: Response) => {
console.log("response");
console.log(response);
const data = response.json();
//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);
data.dataset.profile.viewstyle.definition = this.xml2jsonOBJ.xml_str2json(data.dataset.profile.viewstyle.definition);
//can be converted back to xml (which shouldn't be needed) with this.xml2jsonOBJ.json2xml_str
this.data = data; //cache it for subsequent calls
return data;
}
);
*/
getThroughProxy(url : string, query: string){
return this.restBase.proxy_get_wQuery(url, query);
}
getProjects(){
let headers = new HttpHeaders().set("google-token", this.tokenService.getToken());
console.log("google-token: "+ this.tokenService.getToken());
return this.httpClient.get<any>("http://dl010.madgik.di.uoa.gr:8080/dmp-backend-no-sec/rest/project/getAll");
// let projects :Project[] =[];
// let project = new Project;
// project.name = "Project1";
// project.id = "Project1Id";
// projects.push(project);
// let project2 = new Project;
// project2.name = "Project2";
// project2.id = "Project2Id";
// projects.push(project2);
// return projects;
}
}