This commit is contained in:
Nikolaos Laskaris 2017-11-08 12:35:56 +02:00
parent 42f002af40
commit abef34ecb3
10 changed files with 90 additions and 60 deletions

View File

@ -67,6 +67,7 @@ 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';
@ -90,7 +91,8 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen
DatasetsComponent,
UserWorkspaceComponent,
ConfirmationComponent,
AutocompleteRemoteComponent,
ProjectTableFilterPipe,
DmpVersionFilterPipe,
DmpStatusFilterPipe,

View File

@ -0,0 +1,9 @@
<div class="form-group">
<label for="{{id}}">{{label}}</label>
<select id="{{id}}">
<option>Alfa Romeo</option>
<option>Audi</option>
<option>BMW</option>
<option>Citroen</option>
</select>
</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,39 @@
import { Component, OnInit,Input, Output } from '@angular/core';
declare var $: any;
@Component({
selector: 'autocomplete-remote',
templateUrl: './autocomplete-remote.component.html',
styleUrls: ['./autocomplete-remote.component.css']
})
export class AutocompleteRemoteComponent implements OnInit {
constructor() {
}
@Input() id : string = "test-field-123";
@Input() label : string = "Test";
@Input() url : string = "Test";
@Output() selectedValue : string;
allValues : string[];
query : string = null;
ngOnInit() {
$('#'+this.id).editableSelect();
}
updateByQuery(query){
if(query){
}
}
}

View File

@ -33,7 +33,7 @@ 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/";

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){
}
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;
}
}

View File

@ -0,0 +1,2 @@
/*! jQuery Editable Select - v2.2.5 - https://github.com/indrimuska/jquery-editable-select - (c) 2016 Indri Muska - MIT */
input.es-input{padding-right:20px!important;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAICAYAAADJEc7MAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAG2YAABzjgAA4DIAAIM2AAB5CAAAxgwAADT6AAAgbL5TJ5gAAABGSURBVHjaYvz//z8DOYCJgUzA0tnZidPK8vJyRpw24pLEpwnuVHRFhDQxMDAwMPz//x+OOzo6/iPz8WFGuocqAAAA//8DAD/sORHYg7kaAAAAAElFTkSuQmCC) right center no-repeat}input.es-input.open{-webkit-border-bottom-left-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0;-moz-border-radius-bottomright:0;border-bottom-right-radius:0}.es-list{position:absolute;padding:0;margin:0;border:1px solid #d1d1d1;display:none;z-index:1000;background:#fff;max-height:160px;overflow-y:auto;-moz-box-shadow:0 2px 3px #ccc;-webkit-box-shadow:0 2px 3px #ccc;box-shadow:0 2px 3px #ccc}.es-list li{display:block;padding:5px 10px;margin:0}.es-list li.selected{background:#f3f3f3}.es-list li[disabled]{opacity:.5}

File diff suppressed because one or more lines are too long

View File

@ -38,6 +38,10 @@
<!-- font-awesome css -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- for editable dropdown component (used for autocomplete) -->
<link rel="stylesheet" type="text/css" href="assets/editable-select/jquery-editable-select.min.css">
<script src="assets/editable-select/jquery-editable-select.min.js"></script>
<!-- my custom global code and css -->
<link rel="stylesheet" type="text/css" href="assets/custom.css">
<script src="assets/custom.js"></script>