Files
grafana/packages/grafana-data/src/transformations/transformers.ts

43 lines
1.8 KiB
TypeScript
Raw Normal View History

import { reduceTransformer } from './transformers/reduce';
import { concatenateTransformer } from './transformers/concat';
import { calculateFieldTransformer } from './transformers/calculateField';
import { filterFieldsTransformer, filterFramesTransformer } from './transformers/filter';
import { filterFieldsByNameTransformer } from './transformers/filterByName';
import { noopTransformer } from './transformers/noop';
import { filterFramesByRefIdTransformer } from './transformers/filterByRefId';
import { orderFieldsTransformer } from './transformers/order';
import { organizeFieldsTransformer } from './transformers/organize';
import { seriesToColumnsTransformer } from './transformers/seriesToColumns';
import { seriesToRowsTransformer } from './transformers/seriesToRows';
import { renameFieldsTransformer } from './transformers/rename';
import { labelsToFieldsTransformer } from './transformers/labelsToFields';
import { ensureColumnsTransformer } from './transformers/ensureColumns';
Transformations: Adding group by and aggregate on multiple fields transformation * Adding Occurences transformer * Adding test for Occurences Transformer * Cleanup. Adding a test. * Adding doc * Modifying UI to support custom calculations options * Implementing data transformation * Finalizing calculations implementation * Cleanup * Using Fields instead of arrays in data grouping * Renaming transformation to GroupBy * Adding some doc * Apply suggestions (solving TS typing errors) Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Tweaking UI * Preventing of selecting twice the same field name. * Removing console print. No calculations by default. * Forgot to add the current value to the GroupBy selector * Solving some typing issues and prettyfier errors * Cleanup * Updating test * Ensure proper copy of options (solves some issues) * Check if the fields exist in the data before processing * Adding missing import in test file * If group by field not specified, return all data untouched. * Adding another missing import in test * Minor updates * Implementing GroupBy multiple fields + Improve field typing * Removing console prints * Allowing the exact number of fields to be added as aggregation * Centering remove button icon * Cleanup * Correcting TS error * Chaging transformer options structure * Sorting so GroupBy fields appear on top * Cleanup * Simplifying some operations. Adding curly brackets. * Changing some labels on the UI * Updating test * Cleanup * Updating doc * Fixed field list. Storing options as Record instead of Array. * Update test * Cleaned up the group by editor UI code. * changed the transform to a table layout instead of a flexbox layout. * cleaned up group by transformer. * removed unused imports. * Added some more tests. * Added one more test and cleaned up code. * fixed failing test. * Fixed so we we have the proper casing on naming. * fixed so we don't wrap on the first row. Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2020-08-31 04:46:30 -04:00
import { groupByTransformer } from './transformers/groupBy';
import { sortByTransformer } from './transformers/sortBy';
import { mergeTransformer } from './transformers/merge';
import { renameByRegexTransformer } from './transformers/renameByRegex';
Transformation: added support for excluding/including rows based on their values. (#26884) * Adding FilterByValue transformer skeleton * Connecting options with Editor * Improving UI and making deep copy of options on change. * Improving Transformation Editor UI * Implementing Regex filtering * Adding valueFilters.ts and creating filter registry * Connecting the test function * Correcting TypeScript errors * Using FilterInstance instead of simple Filter test function * Adding field.type as filter options * Improving UI. Adding custom placeholder depending on filter. * Implementing a few more filter types * Implementing more filters * Return original data if no filter were processed * Improving UI * Correcting TS errors * Making sure inequality transform are invalid until the filterExpression is not empty * Cleanup in the UI file * Improving UI (highlight invalid fields) * Only show filterType that are supported for the selected field * Adding tests + correction of a filter * Adding transformer test * Adding doc * Cleanup * Typing props for FilterSelectorRow component Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Moving rendering in the JSX Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Memoizing filterTypeOptions computation Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Improve code compactness Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Cleanup + solving TS errors * Updating some labels * Wrapping stuff around useMemo and useCallback * Using cloneDeep from lodash * Don't highlight field name input if null * Removing time type fields in selectable options * We want loose equality in this scenario. * Adding `onChange` to useCallback dependencies Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Include or exclude matching any or all conditions * Correcting field name matching * Cleanup * Don't highlight the filterExpression input when its empty * Adding Range filter * Updating doc * Correcting TS error * Only showing the Match All/Match Any option if more than one condition * Two inputs for the Range filter instead of one * Improving invalid highlight for Range filter type * Cleanup * Improving labels in UI * Using ButtonSelect to improve UI * editor UI updates. * Updating tests * Adding component for Regex * Improve TS typing * Adding components for the other filter types. * Cleanup * Correct error * Updating valueFilter.test.ts * Updating filterByValue.test.ts * Reverting and removing Range filter * Update docs/sources/panels/transformations.md * starting to implement poc. * added a small poc. * wip * added tests. * added structure for dynamic value matcher editors. * added more support. * added some more value matchers. * removed unused value filters. * added some more matchers. * adding more matchers. * added a range matcher. * fixing some tests. * fixing tests. * remove unused dep. * making the matching a bit more performant. * UX improvements and alignment fixes * fixed delete button. * fixed some spacing in the UI. * added docs for matchers. * adding docs and exposing value matcher types. * will store dateTime as string. * updated docs according to feedback. * moved filter by value in transformation list. * Improved description. * added regex value filter. * added support for regex. * fixing failing tests. Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-12-01 04:22:37 -05:00
import { filterByValueTransformer } from './transformers/filterByValue';
export const standardTransformers = {
noopTransformer,
filterFieldsTransformer,
filterFieldsByNameTransformer,
filterFramesTransformer,
filterFramesByRefIdTransformer,
Transformation: added support for excluding/including rows based on their values. (#26884) * Adding FilterByValue transformer skeleton * Connecting options with Editor * Improving UI and making deep copy of options on change. * Improving Transformation Editor UI * Implementing Regex filtering * Adding valueFilters.ts and creating filter registry * Connecting the test function * Correcting TypeScript errors * Using FilterInstance instead of simple Filter test function * Adding field.type as filter options * Improving UI. Adding custom placeholder depending on filter. * Implementing a few more filter types * Implementing more filters * Return original data if no filter were processed * Improving UI * Correcting TS errors * Making sure inequality transform are invalid until the filterExpression is not empty * Cleanup in the UI file * Improving UI (highlight invalid fields) * Only show filterType that are supported for the selected field * Adding tests + correction of a filter * Adding transformer test * Adding doc * Cleanup * Typing props for FilterSelectorRow component Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Moving rendering in the JSX Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Memoizing filterTypeOptions computation Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Improve code compactness Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Cleanup + solving TS errors * Updating some labels * Wrapping stuff around useMemo and useCallback * Using cloneDeep from lodash * Don't highlight field name input if null * Removing time type fields in selectable options * We want loose equality in this scenario. * Adding `onChange` to useCallback dependencies Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Include or exclude matching any or all conditions * Correcting field name matching * Cleanup * Don't highlight the filterExpression input when its empty * Adding Range filter * Updating doc * Correcting TS error * Only showing the Match All/Match Any option if more than one condition * Two inputs for the Range filter instead of one * Improving invalid highlight for Range filter type * Cleanup * Improving labels in UI * Using ButtonSelect to improve UI * editor UI updates. * Updating tests * Adding component for Regex * Improve TS typing * Adding components for the other filter types. * Cleanup * Correct error * Updating valueFilter.test.ts * Updating filterByValue.test.ts * Reverting and removing Range filter * Update docs/sources/panels/transformations.md * starting to implement poc. * added a small poc. * wip * added tests. * added structure for dynamic value matcher editors. * added more support. * added some more value matchers. * removed unused value filters. * added some more matchers. * adding more matchers. * added a range matcher. * fixing some tests. * fixing tests. * remove unused dep. * making the matching a bit more performant. * UX improvements and alignment fixes * fixed delete button. * fixed some spacing in the UI. * added docs for matchers. * adding docs and exposing value matcher types. * will store dateTime as string. * updated docs according to feedback. * moved filter by value in transformation list. * Improved description. * added regex value filter. * added support for regex. * fixing failing tests. Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-12-01 04:22:37 -05:00
filterByValueTransformer,
orderFieldsTransformer,
organizeFieldsTransformer,
reduceTransformer,
concatenateTransformer,
calculateFieldTransformer,
seriesToColumnsTransformer,
seriesToRowsTransformer,
renameFieldsTransformer,
labelsToFieldsTransformer,
ensureColumnsTransformer,
Transformations: Adding group by and aggregate on multiple fields transformation * Adding Occurences transformer * Adding test for Occurences Transformer * Cleanup. Adding a test. * Adding doc * Modifying UI to support custom calculations options * Implementing data transformation * Finalizing calculations implementation * Cleanup * Using Fields instead of arrays in data grouping * Renaming transformation to GroupBy * Adding some doc * Apply suggestions (solving TS typing errors) Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> * Tweaking UI * Preventing of selecting twice the same field name. * Removing console print. No calculations by default. * Forgot to add the current value to the GroupBy selector * Solving some typing issues and prettyfier errors * Cleanup * Updating test * Ensure proper copy of options (solves some issues) * Check if the fields exist in the data before processing * Adding missing import in test file * If group by field not specified, return all data untouched. * Adding another missing import in test * Minor updates * Implementing GroupBy multiple fields + Improve field typing * Removing console prints * Allowing the exact number of fields to be added as aggregation * Centering remove button icon * Cleanup * Correcting TS error * Chaging transformer options structure * Sorting so GroupBy fields appear on top * Cleanup * Simplifying some operations. Adding curly brackets. * Changing some labels on the UI * Updating test * Cleanup * Updating doc * Fixed field list. Storing options as Record instead of Array. * Update test * Cleaned up the group by editor UI code. * changed the transform to a table layout instead of a flexbox layout. * cleaned up group by transformer. * removed unused imports. * Added some more tests. * Added one more test and cleaned up code. * fixed failing test. * Fixed so we we have the proper casing on naming. * fixed so we don't wrap on the first row. Co-authored-by: Marcus Andersson <systemvetaren@gmail.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2020-08-31 04:46:30 -04:00
groupByTransformer,
sortByTransformer,
mergeTransformer,
renameByRegexTransformer,
};