Transformations: Expose "keep fields" option in partition by values (#81743)

* expose keep fields to partitionByValues UI
This commit is contained in:
Galen Kistler 2024-02-01 17:08:02 -06:00 committed by GitHub
parent 67b6be5515
commit f73d0eb41c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -67,6 +67,11 @@ export function PartitionByValuesEditor({
{ label: 'As frame name', value: namingModes.frameName }, { label: 'As frame name', value: namingModes.frameName },
]; ];
const KeepFieldsOptions = [
{ label: 'Yes', value: true },
{ label: 'No', value: false },
];
const removeField = useCallback( const removeField = useCallback(
(v: string) => { (v: string) => {
if (!v) { if (!v) {
@ -135,6 +140,15 @@ export function PartitionByValuesEditor({
/> />
</InlineField> </InlineField>
</InlineFieldRow> </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> </div>
); );
} }

View File

@ -67,7 +67,9 @@ export const partitionByValuesTransformer: SynchronousDataTransformerInfo<Partit
id: DataTransformerID.partitionByValues, id: DataTransformerID.partitionByValues,
name: 'Partition by values', name: 'Partition by values',
description: `Splits a one-frame dataset into multiple series discriminated by unique/enum values in one or more fields.`, 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) => operator: (options, ctx) => (source) =>
source.pipe(map((data) => partitionByValuesTransformer.transformer(options, ctx)(data))), source.pipe(map((data) => partitionByValuesTransformer.transformer(options, ctx)(data))),