grafana/public/app/features/scenes/apps/transforms.ts
Torkel Ödegaard 5c9898a860
Scenes: SceneApp example in core (#64686)
* Scenes: Progress on demo app

* Argh

* Fixing breadcrumbs

* Added spacer

* Conditional scene objects

* Quick and dirty test for drilldown link via panel title

* Changed the toggle

* Add url state syncing for most links

* Add url state syncing for most links

* Fix instance in url params

* Quick and dirty tabs on the handler page

* fixing breadcrumbs

* Hide footer

* Updates

* new table styles

* Update table cell link styles

* Added search box

* Scene app demo: dynamic data link (#60398)

* Dynamically build data links

* Add field override tests

* Updates

* Updated

* Updates

* before nesting routing

* Something is working

* Caching and nested routes working

* Simplify model

* Use app components from grafana/scenes

* Make the monitoring app work with section nav

* Fixing

* Update scenes

* Remove unused route

* Updates

* remove file

* Update scenes version and use new features

* Remove semicolon

* removed unused thing

* Add refresh pickers

---------

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2023-03-20 11:15:42 +01:00

43 lines
1.1 KiB
TypeScript

import { map } from 'rxjs';
import {
BasicValueMatcherOptions,
CustomTransformOperator,
DataTransformerID,
getFrameDisplayName,
ValueMatcherID,
} from '@grafana/data';
import { FilterByValueMatch, FilterByValueType } from '@grafana/data/src/transformations/transformers/filterByValue';
import { DataTransformerConfig, MatcherConfig } from '@grafana/schema';
export function getTableFilterTransform(query: string): DataTransformerConfig {
const regex: MatcherConfig<BasicValueMatcherOptions<string>> = {
id: ValueMatcherID.regex,
options: { value: query },
};
return {
id: DataTransformerID.filterByValue,
options: {
type: FilterByValueType.include,
match: FilterByValueMatch.all,
filters: [
{
fieldName: 'handler',
config: regex,
},
],
},
};
}
export function getTimeSeriesFilterTransform(query: string): CustomTransformOperator {
return () => (source) => {
return source.pipe(
map((data) => {
return data.filter((frame) => getFrameDisplayName(frame).toLowerCase().includes(query.toLowerCase()));
})
);
};
}