fetch possible values for gallery view
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable, OnInit } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
|
||||
@Injectable({
|
||||
@@ -39,12 +40,13 @@ export class PlotService {
|
||||
return this.http.get<Array<string>>('//'+window.location.hostname+':8080/fields');
|
||||
}
|
||||
|
||||
autocomplete(query: string, caretIndex: number): Observable<AutocompleteResult>
|
||||
autocomplete(query: string, caretIndex: number, resultMode: ResultMode): Observable<AutocompleteResult>
|
||||
{
|
||||
const options = {
|
||||
params: new HttpParams()
|
||||
.set('caretIndex', ""+caretIndex)
|
||||
.set('query', query)
|
||||
.set('query', query)
|
||||
.set('resultMode', resultMode)
|
||||
};
|
||||
return this.http.get<AutocompleteResult>('//'+window.location.hostname+':8080/autocomplete', options);
|
||||
}
|
||||
@@ -58,6 +60,16 @@ export class PlotService {
|
||||
getFilterDefaults(): Observable<FilterDefaults>{
|
||||
return this.http.get<FilterDefaults>('//'+window.location.hostname+':8080/filters/defaults')
|
||||
}
|
||||
|
||||
splitQuery(query: string, splitBy:string) : Observable<Array<string>>{
|
||||
|
||||
const q = "("+query+") and "+splitBy+"=";
|
||||
return this.autocomplete(q, q.length+1, ResultMode.FULL_VALUES).pipe(
|
||||
map(
|
||||
autocompleteResult => autocompleteResult.proposals.map(suggestion => suggestion.value)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,3 +184,8 @@ export class FilterDefaults {
|
||||
fields: Array<string>;
|
||||
splitBy: string;
|
||||
}
|
||||
|
||||
export enum ResultMode {
|
||||
CUT_AT_DOT = "CUT_AT_DOT",
|
||||
FULL_VALUES = "FULL_VALUES"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user