From 7331a2e8c323f693bf84c90d0cabe610502553cc Mon Sep 17 00:00:00 2001 From: Luminessa Starlight Date: Thu, 21 Aug 2025 15:23:23 -0400 Subject: [PATCH] Revert: "Accessibility: Ensure dashboard edit panel inputs have accessible labels" (#109984) * Revert "Accessibility: Ensure dashboard edit panel inputs have accessible labels (#109546)" This reverts commit 4d067059c945f19c0429bd59b20c9b2e92a18908. * kick CI --- ...shboards-edit-panel-transparent-bg.spec.ts | 2 +- .../panels-suite/table-kitchenSink.spec.ts | 4 +- .../panels-suite/geomap-map-controls.spec.ts | 10 ++--- .../components/ColorPicker/ColorPicker.tsx | 3 +- .../ColorPicker/ColorPickerPopover.tsx | 1 - .../components/MatchersUI/FieldNamePicker.tsx | 3 +- .../MatchersUI/FieldsByFrameRefIdMatcher.tsx | 8 +--- .../src/components/UnitPicker/UnitPicker.tsx | 4 +- .../NestedFolderPicker/NestedFolderPicker.tsx | 5 --- .../core/components/OptionsUI/NumberInput.tsx | 2 - .../app/core/components/OptionsUI/color.tsx | 4 +- .../core/components/OptionsUI/multiSelect.tsx | 3 +- .../app/core/components/OptionsUI/number.tsx | 3 +- .../app/core/components/OptionsUI/select.tsx | 3 +- .../app/core/components/OptionsUI/slider.tsx | 4 +- .../app/core/components/OptionsUI/string.tsx | 3 +- .../app/core/components/OptionsUI/units.tsx | 6 +-- .../ConditionalRenderingEditor.tsx | 3 -- .../edit-pane/DashboardEditableElement.tsx | 5 +-- .../edit-pane/VizPanelEditableElement.tsx | 12 +++--- .../panel-edit/getPanelFrameOptions.tsx | 8 ++-- .../layout-auto-grid/AutoGridItemEditor.tsx | 4 +- .../DashboardGridItemEditor.tsx | 9 ++-- .../SceneGridRowEditableElement.tsx | 14 +++---- .../scene/layout-rows/RowItemEditor.tsx | 24 ++++------- .../scene/layout-tabs/TabItemEditor.tsx | 13 ++---- .../variables/VariableEditableElement.tsx | 18 +++----- .../components/CustomVariableForm.tsx | 7 +--- .../editors/ConstantVariableEditor.tsx | 7 +--- .../editors/CustomVariableEditor.tsx | 7 +--- .../editors/DataSourceVariableEditor.tsx | 18 ++------ .../editors/SystemVariableEditor.tsx | 1 + .../useVariableSelectionOptionsCategory.tsx | 41 +++++------------- .../PanelEditor/OptionsPaneItemDescriptor.tsx | 6 ++- .../PanelEditor/getFieldOverrideElements.tsx | 42 ++++++++++++++----- .../PanelEditor/getLibraryPanelOptions.tsx | 8 +--- .../PanelEditor/getPanelFrameOptions.tsx | 22 ++++------ .../PanelEditor/getVisualizationOptions.tsx | 21 +++------- .../state/OptionSearchEngine.test.ts | 14 ------- .../editors/ColorDimensionEditor.tsx | 3 +- .../editors/ScalarDimensionEditor.tsx | 5 +-- .../editors/ScaleDimensionEditor.tsx | 15 +++---- .../editors/TextDimensionEditor.tsx | 9 +--- .../geo/editor/locationModeEditor.tsx | 2 - public/app/plugins/panel/alertlist/module.tsx | 3 +- .../geomap/editor/FrameSelectionEditor.tsx | 3 +- .../panel/geomap/editor/MapViewEditor.tsx | 8 +--- .../panel/geomap/editor/StyleEditor.tsx | 31 +------------- .../plugins/panel/table/PaginationEditor.tsx | 4 +- .../panel/table/TableCellOptionEditor.tsx | 5 +-- .../table/cells/AutoCellOptionsEditor.tsx | 6 +-- .../ColorBackgroundCellOptionsEditor.tsx | 10 +---- .../table/cells/ImageCellOptionsEditor.tsx | 9 ++-- .../cells/SparklineCellOptionsEditor.tsx | 5 +-- .../table/table-new/PaginationEditor.tsx | 3 +- .../table/table-new/TableCellOptionEditor.tsx | 5 +-- .../ColorBackgroundCellOptionsEditor.tsx | 5 --- .../cells/ImageCellOptionsEditor.tsx | 9 ++-- .../cells/SparklineCellOptionsEditor.tsx | 5 +-- .../table-new/cells/TextWrapOptionsEditor.tsx | 5 --- .../plugins/panel/xychart/SeriesEditor.tsx | 13 +----- 61 files changed, 166 insertions(+), 369 deletions(-) diff --git a/e2e-playwright/dashboard-new-layouts/dashboards-edit-panel-transparent-bg.spec.ts b/e2e-playwright/dashboard-new-layouts/dashboards-edit-panel-transparent-bg.spec.ts index a7ef95b1f4d..d483b7b8005 100644 --- a/e2e-playwright/dashboard-new-layouts/dashboards-edit-panel-transparent-bg.spec.ts +++ b/e2e-playwright/dashboard-new-layouts/dashboards-edit-panel-transparent-bg.spec.ts @@ -34,7 +34,7 @@ test.describe( const initialBackground = await panelTitle.evaluate((el) => getComputedStyle(el).background); expect(initialBackground).not.toMatch(/rgba\(0, 0, 0, 0\)/); - await page.getByRole('switch', { name: 'Transparent background' }).click({ force: true }); + await page.locator('#transparent-background').click({ force: true }); const transparentBackground = await panelTitle.evaluate((el) => getComputedStyle(el).background); expect(transparentBackground).toMatch(/rgba\(0, 0, 0, 0\)/); diff --git a/e2e-playwright/panels-suite/table-kitchenSink.spec.ts b/e2e-playwright/panels-suite/table-kitchenSink.spec.ts index 739646813f8..7b5f1d84967 100644 --- a/e2e-playwright/panels-suite/table-kitchenSink.spec.ts +++ b/e2e-playwright/panels-suite/table-kitchenSink.spec.ts @@ -95,8 +95,8 @@ test.describe('Panels test: Table - Kitchen Sink', { tag: ['@panels', '@table'] await dashboardPage .getByGrafanaSelector(selectors.components.PanelEditor.OptionsPane.fieldLabel('Cell options Cell value inspect')) .first() - .getByRole('switch', { name: 'Cell value inspect' }) - .click({ force: true }); + .locator('label[for="custom.inspect"]') + .click(); await loremIpsumCell.hover(); await expect(getCellHeight(page, 1, longTextColIdx)).resolves.toBeLessThan(100); diff --git a/e2e/old-arch/panels-suite/geomap-map-controls.spec.ts b/e2e/old-arch/panels-suite/geomap-map-controls.spec.ts index fcadcb55a47..b344dae5abe 100644 --- a/e2e/old-arch/panels-suite/geomap-map-controls.spec.ts +++ b/e2e/old-arch/panels-suite/geomap-map-controls.spec.ts @@ -17,35 +17,35 @@ describe('Geomap layer controls options', () => { e2e.components.PanelEditor.showZoomField() .should('be.visible') .within(() => { - cy.get('input[type="checkbox"]').check({ force: true }); + cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked'); }); // Show attribution e2e.components.PanelEditor.showAttributionField() .should('be.visible') .within(() => { - cy.get('input[type="checkbox"]').check({ force: true }); + cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked'); }); // Show scale e2e.components.PanelEditor.showScaleField() .should('be.visible') .within(() => { - cy.get('input[type="checkbox"]').check({ force: true }); + cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked'); }); // Show measure tool e2e.components.PanelEditor.showMeasureField() .should('be.visible') .within(() => { - cy.get('input[type="checkbox"]').check({ force: true }); + cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked'); }); // Show debug e2e.components.PanelEditor.showDebugField() .should('be.visible') .within(() => { - cy.get('input[type="checkbox"]').check({ force: true }); + cy.get('input[type="checkbox"]').check({ force: true }).should('be.checked'); }); e2e.components.Panels.Panel.content({ timeout: TIMEOUT }) diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx index 43daedcbdb6..5b23a4fefa6 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx @@ -37,7 +37,7 @@ export const colorPickerFactory = ( pickerTriggerRef = createRef(); render() { - const { theme, children, onChange, color, id } = this.props; + const { theme, children, onChange, color } = this.props; const styles = getStyles(theme); const popoverElement = React.createElement(popover, { ...{ ...this.props, children: null }, @@ -67,7 +67,6 @@ export const colorPickerFactory = ( }) ) : ( extends ColorPickerProps, PopoverContentProps { diff --git a/packages/grafana-ui/src/components/MatchersUI/FieldNamePicker.tsx b/packages/grafana-ui/src/components/MatchersUI/FieldNamePicker.tsx index cce936f01f7..63240a9b0eb 100644 --- a/packages/grafana-ui/src/components/MatchersUI/FieldNamePicker.tsx +++ b/packages/grafana-ui/src/components/MatchersUI/FieldNamePicker.tsx @@ -10,7 +10,7 @@ import { useFieldDisplayNames, useSelectOptions, frameHasName } from './utils'; type Props = StandardEditorProps; // Pick a field name out of the fields -export const FieldNamePicker = ({ value, onChange, context, item, id }: Props) => { +export const FieldNamePicker = ({ value, onChange, context, item }: Props) => { const settings: FieldNamePickerConfigSettings = item.settings ?? {}; const names = useFieldDisplayNames(context.data, settings?.filter); const selectOptions = useSelectOptions(names, value, undefined, undefined, settings.baseNameMode); @@ -29,7 +29,6 @@ export const FieldNamePicker = ({ value, onChange, context, item, id }: Props) = return ( <> void; placeholder?: string; - id?: string; } -export function RefIDMultiPicker({ value, data, onChange, placeholder, id }: MultiProps) { +export function RefIDMultiPicker({ value, data, onChange, placeholder }: MultiProps) { const listOfRefIds = useMemo(() => getListOfQueryRefIds(data), [data]); const [priorSelectionState, updatePriorSelectionState] = useState<{ @@ -175,7 +172,6 @@ export function RefIDMultiPicker({ value, data, onChange, placeholder, id }: Mul } return ( void; value?: string; width?: number; - id?: string; } function formatCreateLabel(input: string) { @@ -22,7 +21,7 @@ export class UnitPicker extends PureComponent { }; render() { - const { value, width, id } = this.props; + const { value, width } = this.props; // Set the current selection let current: SelectableValue | undefined = undefined; @@ -57,7 +56,6 @@ export class UnitPicker extends PureComponent { return ( { return ( void; settings?: ColorValueEditorSettings; @@ -26,7 +25,7 @@ interface Props { /** * @alpha * */ -export const ColorValueEditor = ({ value, settings, onChange, details, id }: Props) => { +export const ColorValueEditor = ({ value, settings, onChange, details }: Props) => { const theme = useTheme2(); const styles = useStyles2(getStyles); @@ -38,7 +37,6 @@ export const ColorValueEditor = ({ value, settings, onChange, details, id }: Pro
extends PureComponent, State> render() { const { options, isLoading } = this.state; - const { value, onChange, item, id } = this.props; + const { value, onChange, item } = this.props; const { settings } = item; return ( - inputId={id} isLoading={isLoading} value={value} defaultValue={value} diff --git a/public/app/core/components/OptionsUI/number.tsx b/public/app/core/components/OptionsUI/number.tsx index cd69f2b0370..e7b0db58bbe 100644 --- a/public/app/core/components/OptionsUI/number.tsx +++ b/public/app/core/components/OptionsUI/number.tsx @@ -6,7 +6,7 @@ import { NumberInput } from './NumberInput'; type Props = StandardEditorProps; -export const NumberValueEditor = ({ value, onChange, item, id }: Props) => { +export const NumberValueEditor = ({ value, onChange, item }: Props) => { const { settings } = item; const onValueChange = useCallback( @@ -18,7 +18,6 @@ export const NumberValueEditor = ({ value, onChange, item, id }: Props) => { return ( extends PureComponent, State> { render() { const { options, isLoading } = this.state; - const { value, onChange, item, id } = this.props; + const { value, onChange, item } = this.props; const { settings } = item; let current = options.find((v) => v.value === value); @@ -63,7 +63,6 @@ export class SelectValueEditor extends PureComponent, State> { } return ( - inputId={id} isLoading={isLoading} value={current} defaultValue={value} diff --git a/public/app/core/components/OptionsUI/slider.tsx b/public/app/core/components/OptionsUI/slider.tsx index 01835ea9a38..b9bb41bbd90 100644 --- a/public/app/core/components/OptionsUI/slider.tsx +++ b/public/app/core/components/OptionsUI/slider.tsx @@ -11,7 +11,7 @@ import { NumberInput } from './NumberInput'; type Props = StandardEditorProps; -export const SliderValueEditor = ({ value, onChange, item, id }: Props) => { +export const SliderValueEditor = ({ value, onChange, item }: Props) => { // Input reference const inputRef = useRef(null); @@ -109,7 +109,7 @@ export const SliderValueEditor = ({ value, onChange, item, id }: Props) => { included={included} /> - +
diff --git a/public/app/core/components/OptionsUI/string.tsx b/public/app/core/components/OptionsUI/string.tsx index 7ec4635f7c8..8001bf096af 100644 --- a/public/app/core/components/OptionsUI/string.tsx +++ b/public/app/core/components/OptionsUI/string.tsx @@ -8,7 +8,7 @@ interface Props extends StandardEditorProps { suffix?: ReactNode; } -export const StringValueEditor = ({ value, onChange, item, suffix, id }: Props) => { +export const StringValueEditor = ({ value, onChange, item, suffix }: Props) => { const Component = item.settings?.useTextarea ? TextArea : Input; const onValueChange = useCallback( ( @@ -36,7 +36,6 @@ export const StringValueEditor = ({ value, onChange, item, suffix, id }: Props) return ( ; -export function UnitValueEditor({ value, onChange, item, id }: Props) { +export function UnitValueEditor({ value, onChange, item }: Props) { const styles = useStyles2(getStyles); if (item?.settings?.isClearable && value != null) { return (
- + ); } - return ; + return ; } const getStyles = (theme: GrafanaTheme2) => ({ diff --git a/public/app/features/dashboard-scene/conditional-rendering/ConditionalRenderingEditor.tsx b/public/app/features/dashboard-scene/conditional-rendering/ConditionalRenderingEditor.tsx index 8d0a0614778..796987d8773 100644 --- a/public/app/features/dashboard-scene/conditional-rendering/ConditionalRenderingEditor.tsx +++ b/public/app/features/dashboard-scene/conditional-rendering/ConditionalRenderingEditor.tsx @@ -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,6 @@ export function useConditionalRenderingEditor( }).addItem( new OptionsPaneItemDescriptor({ title, - id: uuidv4(), render: () => , }) ); diff --git a/public/app/features/dashboard-scene/edit-pane/DashboardEditableElement.tsx b/public/app/features/dashboard-scene/edit-pane/DashboardEditableElement.tsx index 730c16aa410..93e5ec503d8 100644 --- a/public/app/features/dashboard-scene/edit-pane/DashboardEditableElement.tsx +++ b/public/app/features/dashboard-scene/edit-pane/DashboardEditableElement.tsx @@ -1,5 +1,4 @@ import { ReactNode, useMemo, useRef } from 'react'; -import { v4 as uuidv4 } from 'uuid'; import { Trans, t } from '@grafana/i18n'; import { SceneObject } from '@grafana/scenes'; @@ -39,8 +38,8 @@ export class DashboardEditableElement implements EditableDashboardElement { const { body } = dashboard.useState(); const dashboardOptions = useMemo(() => { - const dashboardTitleInputId = uuidv4(); - const dashboardDescriptionInputId = uuidv4(); + const dashboardTitleInputId = 'dashboard-title-input'; + const dashboardDescriptionInputId = 'dashboard-description-input'; const editPaneHeaderOptions = new OptionsPaneCategoryDescriptor({ title: '', id: 'dashboard-options' }) .addItem( new OptionsPaneItemDescriptor({ diff --git a/public/app/features/dashboard-scene/edit-pane/VizPanelEditableElement.tsx b/public/app/features/dashboard-scene/edit-pane/VizPanelEditableElement.tsx index c5c55bbaf61..574028a75d8 100644 --- a/public/app/features/dashboard-scene/edit-pane/VizPanelEditableElement.tsx +++ b/public/app/features/dashboard-scene/edit-pane/VizPanelEditableElement.tsx @@ -1,5 +1,4 @@ import { useMemo } from 'react'; -import { v4 as uuidv4 } from 'uuid'; import { Trans, t } from '@grafana/i18n'; import { locationService } from '@grafana/runtime'; @@ -49,14 +48,13 @@ export class VizPanelEditableElement implements EditableDashboardElement, BulkAc .addItem( new OptionsPaneItemDescriptor({ title: '', - id: uuidv4(), render: () => , }) ) .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.viz-panel.options.title-option', 'Title'), - id: uuidv4(), + id: 'PanelFrameTitle', value: panel.state.title, popularRank: 1, render: (descriptor) => ( @@ -67,7 +65,7 @@ export class VizPanelEditableElement implements EditableDashboardElement, BulkAc .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.viz-panel.options.description', 'Description'), - id: uuidv4(), + id: 'description-text-area', value: panel.state.description, render: (descriptor) => , }) @@ -75,7 +73,7 @@ export class VizPanelEditableElement implements EditableDashboardElement, BulkAc .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.viz-panel.options.transparent-background', 'Transparent background'), - id: uuidv4(), + id: 'transparent-background', render: (descriptor) => , }) ); @@ -135,7 +133,9 @@ export class VizPanelEditableElement implements EditableDashboardElement, BulkAc } } -type OpenPanelEditVizProps = { panel: VizPanel }; +type OpenPanelEditVizProps = { + panel: VizPanel; +}; const OpenPanelEditViz = ({ panel }: OpenPanelEditVizProps) => { return ( diff --git a/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx b/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx index a46c113c7c9..366fcdc81e4 100644 --- a/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx +++ b/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx @@ -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: 'PanelFrameTitle', 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: 'description-text-area', value: panel.state.description, render: function renderDescription(descriptor) { return ; @@ -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: 'transparent-background', render: function renderTransparent(descriptor) { return ; }, @@ -87,7 +86,6 @@ export function getPanelFrameOptions(panel: VizPanel): OptionsPaneCategoryDescri }).addItem( new OptionsPaneItemDescriptor({ title: t('dashboard-scene.get-panel-frame-options.title.panel-links', 'Panel links'), - id: uuidv4(), render: () => , }) ) diff --git a/public/app/features/dashboard-scene/scene/layout-auto-grid/AutoGridItemEditor.tsx b/public/app/features/dashboard-scene/scene/layout-auto-grid/AutoGridItemEditor.tsx index 93804685fcb..dc20ec7a8bd 100644 --- a/public/app/features/dashboard-scene/scene/layout-auto-grid/AutoGridItemEditor.tsx +++ b/public/app/features/dashboard-scene/scene/layout-auto-grid/AutoGridItemEditor.tsx @@ -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: 'repeat-by-variable-select', 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.' diff --git a/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItemEditor.tsx b/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItemEditor.tsx index 9f822fe01e7..43929dd09c6 100644 --- a/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItemEditor.tsx +++ b/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItemEditor.tsx @@ -1,5 +1,4 @@ import { useCallback } from 'react'; -import { v4 as uuidv4 } from 'uuid'; import { SelectableValue } from '@grafana/data'; import { t } from '@grafana/i18n'; @@ -23,7 +22,7 @@ export function getDashboardGridItemOptions(gridItem: DashboardGridItem): Option .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.default-layout.item-options.repeat.variable.title', 'Repeat by variable'), - id: uuidv4(), + id: 'repeat-by-variable-select', description: t( 'dashboard.default-layout.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.' @@ -44,12 +43,11 @@ export function getDashboardGridItemOptions(gridItem: DashboardGridItem): Option .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.default-layout.item-options.repeat.max', 'Max per row'), - id: uuidv4(), useShowIf: () => { const { variableName, repeatDirection } = gridItem.useState(); return Boolean(variableName) && repeatDirection === 'h'; }, - render: (descriptor) => , + render: () => , }) ); @@ -92,7 +90,7 @@ function RepeatDirectionOption({ gridItem }: OptionComponentProps) { ); } -function MaxPerRowOption({ gridItem, id }: OptionComponentProps & { id?: string }) { +function MaxPerRowOption({ gridItem }: OptionComponentProps) { const { maxPerRow } = gridItem.useState(); const maxPerRowOptions: Array> = [2, 3, 4, 6, 8, 12].map((value) => ({ label: value.toString(), @@ -101,7 +99,6 @@ function MaxPerRowOption({ gridItem, id }: OptionComponentProps & { id?: string return ( row.setState({ title: e.currentTarget.value })} />; + return row.setState({ title: e.currentTarget.value })} />; } -function RowRepeatSelect({ row, dashboard, id }: { row: SceneGridRow; dashboard: DashboardScene; id?: string }) { +function RowRepeatSelect({ row, dashboard }: { row: SceneGridRow; dashboard: DashboardScene }) { const { $behaviors, children } = row.useState(); let repeatBehavior = $behaviors?.find((b) => b instanceof RowRepeaterBehavior); const vizPanels = useMemo( @@ -107,7 +104,6 @@ function RowRepeatSelect({ row, dashboard, id }: { row: SceneGridRow; dashboard: return ( <> { diff --git a/public/app/features/dashboard-scene/scene/layout-rows/RowItemEditor.tsx b/public/app/features/dashboard-scene/scene/layout-rows/RowItemEditor.tsx index a05393bca37..396e4075587 100644 --- a/public/app/features/dashboard-scene/scene/layout-rows/RowItemEditor.tsx +++ b/public/app/features/dashboard-scene/scene/layout-rows/RowItemEditor.tsx @@ -1,5 +1,4 @@ -import { useId, useMemo } from 'react'; -import { v4 as uuidv4 } from 'uuid'; +import { useMemo } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { Trans, t } from '@grafana/i18n'; @@ -33,15 +32,13 @@ export function useEditOptions(model: RowItem, isNewElement: boolean): OptionsPa .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.rows-layout.row-options.row.fill-screen', 'Fill screen'), - id: uuidv4(), - render: (descriptor) => , + render: () => , }) ) .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.rows-layout.row-options.row.hide-header', 'Hide row header'), - id: uuidv4(), - render: (descriptor) => , + render: () => , }) ), [model, isNewElement] @@ -56,12 +53,11 @@ export function useEditOptions(model: RowItem, isNewElement: boolean): OptionsPa }).addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.rows-layout.row-options.repeat.variable.title', 'Repeat by variable'), - id: uuidv4(), description: t( 'dashboard.rows-layout.row-options.repeat.variable.description', 'Repeat this row for each value in the selected variable.' ), - render: (descriptor) => , + render: () => , }) ), [model] @@ -98,7 +94,6 @@ function RowTitleInput({ row, isNewElement }: { row: RowItem; isNewElement: bool } > row.onHeaderHiddenToggle()} />; + return row.onHeaderHiddenToggle()} />; } -function FillScreenSwitch({ row, id }: { row: RowItem; id?: string }) { +function FillScreenSwitch({ row }: { row: RowItem }) { const { fillScreen } = row.useState(); - return row.onChangeFillScreen(!fillScreen)} />; + return row.onChangeFillScreen(!fillScreen)} />; } -function RowRepeatSelect({ row, id }: { row: RowItem; id?: string }) { +function RowRepeatSelect({ row }: { row: RowItem }) { const { layout } = row.useState(); const dashboard = useDashboard(row); @@ -136,7 +131,6 @@ function RowRepeatSelect({ row, id }: { row: RowItem; id?: string }) { return ( <> row.onChangeRepeat(repeat)} diff --git a/public/app/features/dashboard-scene/scene/layout-tabs/TabItemEditor.tsx b/public/app/features/dashboard-scene/scene/layout-tabs/TabItemEditor.tsx index 0c34c8a7776..0a2b0b3f30e 100644 --- a/public/app/features/dashboard-scene/scene/layout-tabs/TabItemEditor.tsx +++ b/public/app/features/dashboard-scene/scene/layout-tabs/TabItemEditor.tsx @@ -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,8 +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(), - render: (descriptor) => , + render: () => , }) ), [model, isNewElement] @@ -41,12 +39,11 @@ 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(), description: t( 'dashboard.tabs-layout.tab-options.repeat.variable.description', 'Repeat this tab for each value in the selected variable.' ), - render: (descriptor) => , + render: () => , }) ), [model] @@ -68,7 +65,7 @@ export function useEditOptions(model: TabItem, isNewElement: boolean): OptionsPa return editOptions; } -function TabTitleInput({ tab, isNewElement, id }: { tab: TabItem; isNewElement: boolean; id?: string }) { +function TabTitleInput({ tab, isNewElement }: { tab: TabItem; isNewElement: boolean }) { const { title } = tab.useState(); const ref = useEditPaneInputAutoFocus({ autoFocus: isNewElement }); @@ -82,7 +79,6 @@ function TabTitleInput({ tab, isNewElement, id }: { tab: TabItem; isNewElement: } > tab.onChangeRepeat(repeat)} diff --git a/public/app/features/dashboard-scene/settings/variables/VariableEditableElement.tsx b/public/app/features/dashboard-scene/settings/variables/VariableEditableElement.tsx index 862a51ee1ac..86450b91f92 100644 --- a/public/app/features/dashboard-scene/settings/variables/VariableEditableElement.tsx +++ b/public/app/features/dashboard-scene/settings/variables/VariableEditableElement.tsx @@ -1,5 +1,4 @@ -import { FormEvent, useId, useMemo, useRef, useState } from 'react'; -import { v4 as uuidv4 } from 'uuid'; +import { FormEvent, useMemo, useRef, useState } from 'react'; import { VariableHide } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -64,16 +63,14 @@ export class VariableEditableElement implements EditableDashboardElement, BulkAc .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.edit-pane.variable.label', 'Label'), - id: uuidv4(), description: t('dashboard.edit-pane.variable.label-description', 'Optional display name'), - render: (descriptor) => , + render: () => , }) ) .addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.edit-pane.variable.description', 'Description'), - id: uuidv4(), - render: (descriptor) => , + render: () => , }) ) .addItem( @@ -120,7 +117,6 @@ export class VariableEditableElement implements EditableDashboardElement, BulkAc interface VariableInputProps { variable: SceneVariable; - id?: string; } function VariableNameInput({ variable, isNewElement }: { variable: SceneVariable; isNewElement: boolean }) { @@ -142,7 +138,6 @@ function VariableNameInput({ variable, isNewElement }: { variable: SceneVariable return ( { @@ -176,13 +171,12 @@ function VariableNameInput({ variable, isNewElement }: { variable: SceneVariable ); } -function VariableLabelInput({ variable, id }: VariableInputProps) { +function VariableLabelInput({ variable }: VariableInputProps) { const { label } = variable.useState(); const oldLabel = useRef(label ?? ''); return ( { oldLabel.current = label ?? ''; @@ -207,13 +201,13 @@ function VariableLabelInput({ variable, id }: VariableInputProps) { ); } -function VariableDescriptionTextArea({ variable, id }: VariableInputProps) { +function VariableDescriptionTextArea({ variable }: VariableInputProps) { const { description } = variable.useState(); const oldDescription = useRef(description ?? ''); return (