@kinvolk/headlamp-plugin
Version:
The needed infrastructure for building Headlamp plugins.
42 lines (41 loc) • 1.69 kB
TypeScript
import { KubeEvent } from '../lib/k8s/event';
import { KubeObjectInterface } from '../lib/k8s/KubeObject';
export interface FilterState {
/** The namespaces to filter on. */
namespaces: Set<string>;
}
export declare const initialState: FilterState;
/**
* Filters a resource based on the filter state.
*
* @param item - The item to filter.
* @param filter - The filter state.
* @param matchCriteria - The JSONPath criteria to match.
*
* @returns True if the item matches the filter, false otherwise.
*/
export declare function filterResource(item: KubeObjectInterface | KubeEvent, filter: FilterState, search?: string, matchCriteria?: string[]): boolean;
/**
* Filters a generic item based on the filter state.
*
* The item is considered to match if any of the matchCriteria (described as JSONPath)
* matches the filter.search contents. Case matching is insensitive.
*
* @param item - The item to filter.
* @param filter - The filter state.
* @param matchCriteria - The JSONPath criteria to match.
*/
export declare function filterGeneric<T extends {
[key: string]: any;
} = {
[key: string]: any;
}>(item: T, search?: string, matchCriteria?: string[]): boolean;
export declare const setNamespaceFilter: import("@reduxjs/toolkit").ActionCreatorWithPayload<string[], "filter/setNamespaceFilter">, resetFilter: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"filter/resetFilter">;
declare const _default: import("redux").Reducer<FilterState>;
export default _default;
/**
* Get globally selected namespaces
*
* @returns An array of selected namespaces, empty means all namespaces are visible
*/
export declare const useNamespaces: () => string[];