my-test123
Version:
A planner front-end for Fabric8.
112 lines (111 loc) • 4.19 kB
TypeScript
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { ActivatedRoute } from '@angular/router';
import { Spaces } from 'ngx-fabric8-wit';
import { HttpService } from './http-service';
import { WorkItem } from './../models/work-item';
import { FilterModel } from '../models/filter.model';
export declare class FilterService {
private http;
private spaces;
private route;
private baseApiUrl;
filters: FilterModel[];
activeFilters: any[];
filterChange: Subject<{}>;
filterObservable: Subject<any>;
private headers;
and_notation: string;
or_notation: string;
equal_notation: string;
not_equal_notation: string;
in_notation: string;
not_in_notation: string;
sub_str_notation: string;
special_keys: {
'null': any;
'true': boolean;
'false': boolean;
'': any;
};
private compare_notations;
private join_notations;
private filtertoWorkItemMap;
constructor(http: HttpService, spaces: Spaces, route: ActivatedRoute, baseApiUrl: string);
setFilterValues(id: any, value: any): void;
getFilterValue(id: any): any;
applyFilter(): void;
getAppliedFilters(includeSidePanel?: boolean): any;
getFiltersFromUrl(): any;
clearFilters(keys?: string[]): void;
/**
* getFilters - Fetches all the available filters
* @param apiUrl - The url to get list of all filters
* @return Observable of FilterModel[] - Array of filters
*/
getFilters(): Observable<FilterModel[]>;
/**
* getFilters - Fetches all the available filters
* @param apiUrl - The url to get list of all filters
* @return Observable of FilterModel[] - Array of filters
*/
getFilters2(apiUrl: any): Observable<FilterModel[]>;
returnFilters(): FilterModel[];
/**
* Usage: to check if the workitem matches with current applied filter or not.
* TODO: Make this function better and smarter
* NOTE: To add a new filter you have to do nothing here, just update the filtertoWorkItemMap
* @param WorkItem - workItem
* @returns boolean
*/
doesMatchCurrentFilter(workItem: WorkItem): boolean;
/**
* Take the existing query and simply AND it with provided options
* @param existingQuery
* @param options
*/
constructQueryURL(existingQuery: string, options: Object): string;
/**
*
* @param key The value is the object key like 'workitem_type', 'iteration' etc
* @param compare The values are
* FilterService::equal_notation',
* FilterService::not_equal_notation',
* FilterService::not_equal_notation',
* FilterService::in_notation',
* FilterService::not_in_notation'
* @param value string or array of string of values (in case of IN or NOT IN)
*/
queryBuilder(key: string, compare: string, value: string | string[]): any;
/**
*
* @param existingQueryObject
* @param join The values are
* FilterService::and_notation,
* FilterService::or_notation
* @param newQueryObject
*/
queryJoiner(existingQueryObject: object, join: string, newQueryObject: object): any;
/**
* Query string to JSON conversion
*/
queryToJson(query: string, first_level?: boolean): any;
jsonToQuery(obj: object): string;
/**
* This decodes a key query term value from a given query string. It is used to
* shortcut the parsing of the query string to get context info from it. Currently,
* it is used when getting the context info from an existing query to give context
* to a following UX flow. This only supports a very narrow usecase currently, but
* may be extended later.
*
* @param queryString search/filter query string.
* @param key key of the term for which we look for the value.
*/
getConditionFromQuery(queryString: string, key: string): string;
queryToFlat(query: string): {
field: string;
index: number;
value: string;
}[];
flatToQuery(arr: any[]): {};
}