fabric8-planner
Version:
A planner front-end for Fabric8.
122 lines (121 loc) • 4.45 kB
TypeScript
import { ActivatedRoute } from '@angular/router';
import { Observable, Subject } from 'rxjs';
import { FilterModel } from '../models/filter.model';
import { HttpClientService } from '../shared/http-module/http.service';
import { WorkItem } from './../models/work-item';
export declare class FilterService {
private httpClientService;
private route;
filters: FilterModel[];
activeFilters: any[];
filterChange: Subject<{}>;
filterObservable: Subject<any>;
and_notation: string;
or_notation: string;
equal_notation: string;
not_equal_notation: string;
in_notation: string;
not_in_notation: string;
sub_str_notation: string;
str_enclouser: string;
special_keys: {
'null': any;
'true': boolean;
'false': boolean;
'': any;
};
private compare_notations;
private join_notations;
private filtertoWorkItemMap;
constructor(httpClientService: HttpClientService, route: ActivatedRoute);
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(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;
/**
* This function encloses the query value within quotes
* only if the string contains any space
* value with spaces should never be without enclouser
* for ease of coding and understanding
* @param query
*/
encloseValue(query: string): any;
/**
* This function clears the quote from the value
* @param query
*/
clearEnclosedValue(query: string): string;
/**
* 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',
* FilterService::not_EQUAL',
* FilterService::not_EQUAL',
* 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,
* FilterService::OR
* @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[]): {};
/**
* This function takes only a query string
* and returns the parent number if it's only a child Query
* @param query
* @returns string
*/
isOnlyChildQuery(query: string): string | null;
}