mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Transformations: Expose "keep fields" option in partition by values (#81743)
* expose keep fields to partitionByValues UI
This commit is contained in:
parent
67b6be5515
commit
f73d0eb41c
@ -67,6 +67,11 @@ export function PartitionByValuesEditor({
|
||||
{ label: 'As frame name', value: namingModes.frameName },
|
||||
];
|
||||
|
||||
const KeepFieldsOptions = [
|
||||
{ label: 'Yes', value: true },
|
||||
{ label: 'No', value: false },
|
||||
];
|
||||
|
||||
const removeField = useCallback(
|
||||
(v: string) => {
|
||||
if (!v) {
|
||||
@ -135,6 +140,15 @@ export function PartitionByValuesEditor({
|
||||
/>
|
||||
</InlineField>
|
||||
</InlineFieldRow>
|
||||
<InlineFieldRow>
|
||||
<InlineField tooltip={'Keeps the partition fields in the frames.'} label={'Keep fields'} labelWidth={16}>
|
||||
<RadioButtonGroup
|
||||
options={KeepFieldsOptions}
|
||||
value={options.keepFields}
|
||||
onChange={(v) => onChange({ ...options, keepFields: v })}
|
||||
/>
|
||||
</InlineField>
|
||||
</InlineFieldRow>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -67,7 +67,9 @@ export const partitionByValuesTransformer: SynchronousDataTransformerInfo<Partit
|
||||
id: DataTransformerID.partitionByValues,
|
||||
name: 'Partition by values',
|
||||
description: `Splits a one-frame dataset into multiple series discriminated by unique/enum values in one or more fields.`,
|
||||
defaultOptions: {},
|
||||
defaultOptions: {
|
||||
keepFields: false,
|
||||
},
|
||||
|
||||
operator: (options, ctx) => (source) =>
|
||||
source.pipe(map((data) => partitionByValuesTransformer.transformer(options, ctx)(data))),
|
||||
|
Loading…
Reference in New Issue
Block a user