Replace other uuids with hard coded ids
This commit is contained in:
+1
-3
@@ -1,5 +1,3 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { t } from '@grafana/i18n';
|
||||
import { Icon, Stack, Tooltip } from '@grafana/ui';
|
||||
import { OptionsPaneCategoryDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor';
|
||||
@@ -56,7 +54,7 @@ export function useConditionalRenderingEditor(
|
||||
}).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title,
|
||||
id: uuidv4(),
|
||||
id: 'conditional-rendering-options-item',
|
||||
render: () => <conditionalRenderingToRender.Component model={conditionalRenderingToRender} />,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { CoreApp } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
@@ -38,7 +37,7 @@ export function getPanelFrameOptions(panel: VizPanel): OptionsPaneCategoryDescri
|
||||
.addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard-scene.get-panel-frame-options.title.title', 'Title'),
|
||||
id: uuidv4(),
|
||||
id: 'panel-frame-options-title',
|
||||
value: panel.state.title,
|
||||
popularRank: 1,
|
||||
render: function renderTitle(descriptor) {
|
||||
@@ -56,7 +55,7 @@ export function getPanelFrameOptions(panel: VizPanel): OptionsPaneCategoryDescri
|
||||
.addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard-scene.get-panel-frame-options.title.description', 'Description'),
|
||||
id: uuidv4(),
|
||||
id: 'panel-frame-options-description',
|
||||
value: panel.state.description,
|
||||
render: function renderDescription(descriptor) {
|
||||
return <PanelDescriptionTextArea id={descriptor.props.id} panel={panel} />;
|
||||
@@ -72,7 +71,7 @@ export function getPanelFrameOptions(panel: VizPanel): OptionsPaneCategoryDescri
|
||||
.addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard-scene.get-panel-frame-options.title.transparent-background', 'Transparent background'),
|
||||
id: uuidv4(),
|
||||
id: 'panel-frame-options-transparent-bg',
|
||||
render: function renderTransparent(descriptor) {
|
||||
return <PanelBackgroundSwitch id={descriptor.props.id} panel={panel} />;
|
||||
},
|
||||
@@ -87,7 +86,7 @@ export function getPanelFrameOptions(panel: VizPanel): OptionsPaneCategoryDescri
|
||||
}).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard-scene.get-panel-frame-options.title.panel-links', 'Panel links'),
|
||||
id: uuidv4(),
|
||||
id: 'panel-frame-options-panel-links',
|
||||
render: () => <ScenePanelLinksEditor panelLinks={panelLinksObject ?? undefined} />,
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { t } from '@grafana/i18n';
|
||||
import { OptionsPaneCategoryDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor';
|
||||
import { OptionsPaneItemDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor';
|
||||
@@ -18,7 +16,7 @@ export function getOptions(model: AutoGridItem): OptionsPaneCategoryDescriptor[]
|
||||
}).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.auto-grid.item-options.repeat.variable.title', 'Repeat by variable'),
|
||||
id: uuidv4(),
|
||||
id: 'auto-grid-repeat-by-variable',
|
||||
description: t(
|
||||
'dashboard.auto-grid.item-options.repeat.variable.description',
|
||||
'Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard.'
|
||||
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
import { useMemo } from 'react';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
@@ -47,7 +46,7 @@ export class SceneGridRowEditableElement implements EditableDashboardElement, Bu
|
||||
}).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.default-layout.row-options.form.title', 'Title'),
|
||||
id: uuidv4(),
|
||||
id: 'row-options-title',
|
||||
render: (descriptor) => <RowTitleInput id={descriptor.props.id} row={row} />,
|
||||
})
|
||||
);
|
||||
@@ -63,7 +62,7 @@ export class SceneGridRowEditableElement implements EditableDashboardElement, Bu
|
||||
}).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.default-layout.row-options.repeat.variable.title', 'Variable'),
|
||||
id: uuidv4(),
|
||||
id: 'row-options-repeat-variable',
|
||||
render: (descriptor) => <RowRepeatSelect id={descriptor.props.id} row={row} dashboard={dashboard} />,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useMemo } from 'react';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
@@ -25,7 +24,7 @@ export function useEditOptions(model: TabItem, isNewElement: boolean): OptionsPa
|
||||
new OptionsPaneCategoryDescriptor({ title: '', id: 'tab-item-options' }).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.tabs-layout.tab-options.title-option', 'Title'),
|
||||
id: uuidv4(),
|
||||
id: 'tab-options-title',
|
||||
render: (descriptor) => <TabTitleInput id={descriptor.props.id} tab={model} isNewElement={isNewElement} />,
|
||||
})
|
||||
),
|
||||
@@ -41,7 +40,7 @@ export function useEditOptions(model: TabItem, isNewElement: boolean): OptionsPa
|
||||
}).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.tabs-layout.tab-options.repeat.variable.title', 'Repeat by variable'),
|
||||
id: uuidv4(),
|
||||
id: 'tab-options-repeat-variable',
|
||||
description: t(
|
||||
'dashboard.tabs-layout.tab-options.repeat.variable.description',
|
||||
'Repeat this tab for each value in the selected variable.'
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
import { FormEvent } from 'react';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
@@ -81,7 +80,7 @@ export function getCustomVariableOptions(variable: SceneVariable): OptionsPaneIt
|
||||
return [
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.edit-pane.variable.custom-options.values', 'Values separated by comma'),
|
||||
id: uuidv4(),
|
||||
id: 'custom-variable-values',
|
||||
render: (descriptor) => <ValuesTextField id={descriptor.props.id} variable={variable} />,
|
||||
}),
|
||||
];
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
import { FormEvent } from 'react';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { t } from '@grafana/i18n';
|
||||
import { ConstantVariable, SceneVariable } from '@grafana/scenes';
|
||||
@@ -32,7 +31,7 @@ export function getConstantVariableOptions(variable: SceneVariable): OptionsPane
|
||||
return [
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard-scene.constant-variable-form.label-value', 'Value'),
|
||||
id: uuidv4(),
|
||||
id: 'constant-variable-value',
|
||||
render: (descriptor) => <ConstantValueInput id={descriptor.props.id} variable={variable} />,
|
||||
}),
|
||||
];
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
import { FormEvent } from 'react';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { t } from '@grafana/i18n';
|
||||
@@ -59,7 +58,7 @@ export function getCustomVariableOptions(variable: SceneVariable): OptionsPaneIt
|
||||
return [
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.edit-pane.variable.custom-options.values', 'Values separated by comma'),
|
||||
id: uuidv4(),
|
||||
id: 'custom-variable-values',
|
||||
render: ({ props }) => <ValuesTextField id={props.id} variable={variable} />,
|
||||
}),
|
||||
];
|
||||
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
import React, { FormEvent } from 'react';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
@@ -81,12 +80,12 @@ export function getDataSourceVariableOptions(variable: SceneVariable): OptionsPa
|
||||
return [
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.edit-pane.variable.datasource-options.type', 'Type'),
|
||||
id: uuidv4(),
|
||||
id: 'datasource-options-type',
|
||||
render: ({ props }) => <DataSourceTypeSelect id={props.id} variable={variable} />,
|
||||
}),
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.edit-pane.variable.datasource-options.name-filter', 'Name filter'),
|
||||
id: uuidv4(),
|
||||
id: 'datasource-options-name-filter',
|
||||
description: t(
|
||||
'dashboard.edit-pane.variable.datasource-options.name-filter-description',
|
||||
'Regex filter for which data source instances to include. Leave empty for all.'
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { css } from '@emotion/css';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import * as React from 'react';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import {
|
||||
FieldConfigOptionsRegistry,
|
||||
@@ -123,7 +122,7 @@ export function getFieldOverrideCategories(
|
||||
/**
|
||||
* Add override matcher UI element
|
||||
*/
|
||||
const htmlId = uuidv4();
|
||||
const htmlId = `${overrideId}-matcher`;
|
||||
category.addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
id: htmlId,
|
||||
@@ -170,7 +169,7 @@ export function getFieldOverrideCategories(
|
||||
onOverrideChange(idx, { ...override, properties: override.properties.filter((_, i) => i !== propIdx) });
|
||||
};
|
||||
|
||||
const htmlId = `${overrideId}-${property.id}`;
|
||||
const htmlId = `${overrideId}-property-${property.id}`;
|
||||
|
||||
/**
|
||||
* Add override property item
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { t } from '@grafana/i18n';
|
||||
import { Input } from '@grafana/ui';
|
||||
import { LibraryPanelInformation } from 'app/features/library-panels/components/LibraryPanelInfo/LibraryPanelInfo';
|
||||
@@ -26,7 +24,7 @@ export function getLibraryPanelOptionsCategory(props: OptionPaneRenderProps): Op
|
||||
.addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.get-library-panel-options-category.title.name', 'Name'),
|
||||
id: uuidv4(),
|
||||
id: 'library-panel-name',
|
||||
value: panel.libraryPanel.name,
|
||||
popularRank: 1,
|
||||
render: function renderName(descriptor) {
|
||||
@@ -45,7 +43,7 @@ export function getLibraryPanelOptionsCategory(props: OptionPaneRenderProps): Op
|
||||
.addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.get-library-panel-options-category.title.information', 'Information'),
|
||||
id: uuidv4(),
|
||||
id: 'library-panel-information',
|
||||
render: function renderLibraryPanelInformation() {
|
||||
return <LibraryPanelInformation panel={panel} formatDate={dashboard.formatDate} />;
|
||||
},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { get as lodashGet } from 'lodash';
|
||||
import { v4 as uuiv4 } from 'uuid';
|
||||
|
||||
import {
|
||||
EventBus,
|
||||
@@ -94,7 +93,7 @@ export function getVisualizationOptions(props: OptionPaneRenderProps): OptionsPa
|
||||
};
|
||||
|
||||
// Load the options into categories
|
||||
fillOptionsPaneItems(plugin.getPanelOptionsSupplier(), access, getOptionsPaneCategory, context);
|
||||
fillOptionsPaneItems(plugin.meta.id, plugin.getPanelOptionsSupplier(), access, getOptionsPaneCategory, context);
|
||||
|
||||
/**
|
||||
* Field options
|
||||
@@ -241,7 +240,7 @@ export function getVisualizationOptions2(props: OptionPaneRenderProps2): Options
|
||||
});
|
||||
|
||||
// Load the options into categories
|
||||
fillOptionsPaneItems(plugin.getPanelOptionsSupplier(), access, getOptionsPaneCategory, context);
|
||||
fillOptionsPaneItems(plugin.meta.id, plugin.getPanelOptionsSupplier(), access, getOptionsPaneCategory, context);
|
||||
|
||||
// Field options
|
||||
const currentFieldConfig = panel.state.fieldConfig;
|
||||
@@ -299,6 +298,7 @@ export function getVisualizationOptions2(props: OptionPaneRenderProps2): Options
|
||||
* @internal
|
||||
*/
|
||||
export function fillOptionsPaneItems(
|
||||
idPrefix: string,
|
||||
supplier: PanelOptionsSupplier<any>,
|
||||
access: NestedValueAccess,
|
||||
getOptionsPaneCategory: categoryGetter,
|
||||
@@ -313,6 +313,8 @@ export function fillOptionsPaneItems(
|
||||
continue;
|
||||
}
|
||||
|
||||
const htmlId = `${idPrefix}-${pluginOption.id}`;
|
||||
|
||||
let category = parentCategory;
|
||||
if (!category) {
|
||||
category = getOptionsPaneCategory(pluginOption.category);
|
||||
@@ -328,6 +330,7 @@ export function fillOptionsPaneItems(
|
||||
: { ...context, options: access.getValue(pluginOption.path) };
|
||||
|
||||
fillOptionsPaneItems(
|
||||
htmlId,
|
||||
pluginOption.getBuilder(),
|
||||
subAccess,
|
||||
getOptionsPaneCategory,
|
||||
@@ -337,8 +340,6 @@ export function fillOptionsPaneItems(
|
||||
continue;
|
||||
}
|
||||
|
||||
const htmlId = uuiv4();
|
||||
|
||||
const Editor = pluginOption.editor;
|
||||
category.addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
|
||||
@@ -41,7 +41,7 @@ export function getTransformerOptionPane<T = any>(
|
||||
};
|
||||
|
||||
// Use the panel options loader
|
||||
fillOptionsPaneItems(supplier, access, getOptionsPaneCategory, context);
|
||||
fillOptionsPaneItems('spatial-transformer', supplier, access, getOptionsPaneCategory, context);
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ function getOptionsPaneCategoryDescriptor<T extends object>(
|
||||
};
|
||||
|
||||
// Use the panel options loader
|
||||
fillOptionsPaneItems(supplier, access, getOptionsPaneCategory, context);
|
||||
fillOptionsPaneItems('canvas-inline', supplier, access, getOptionsPaneCategory, context);
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user