import { ReactNode, useMemo } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { sceneGraph, SceneGridRow, VizPanel } from '@grafana/scenes'; import { Alert, Button, Input, TextLink } from '@grafana/ui'; import { t, Trans } from 'app/core/internationalization'; import { OptionsPaneCategoryDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor'; import { OptionsPaneItemDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor'; import { RepeatRowSelect2 } from 'app/features/dashboard/components/RepeatRowSelect/RepeatRowSelect'; import { SHARED_DASHBOARD_QUERY } from 'app/plugins/datasource/dashboard/constants'; import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource'; import { getDashboardSceneFor, getLayoutManagerFor, getQueryRunnerFor } from '../../utils/utils'; import { DashboardScene } from '../DashboardScene'; import { BulkActionElement } from '../types/BulkActionElement'; import { EditableDashboardElement, EditableDashboardElementInfo } from '../types/EditableDashboardElement'; import { DefaultGridLayoutManager } from './DefaultGridLayoutManager'; import { RowRepeaterBehavior } from './RowRepeaterBehavior'; export class SceneGridRowEditableElement implements EditableDashboardElement, BulkActionElement { public readonly isEditableDashboardElement = true; public constructor(private _row: SceneGridRow) {} public getEditableElementInfo(): EditableDashboardElementInfo { return { typeId: 'panel', icon: 'line-alt', name: sceneGraph.interpolate(this._row, this._row.state.title, undefined, 'text'), }; } public useEditPaneOptions(): OptionsPaneCategoryDescriptor[] { const row = this._row; const rowOptions = useMemo(() => { return new OptionsPaneCategoryDescriptor({ title: t('dashboard.default-layout.row-options.title', 'Row options'), id: 'row-options', isOpenDefault: true, }).addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.default-layout.row-options.form.title', 'Title'), render: () => , }) ); }, [row]); const rowRepeatOptions = useMemo(() => { const dashboard = getDashboardSceneFor(row); return new OptionsPaneCategoryDescriptor({ title: t('dashboard.default-layout.row-options.repeat.title', 'Repeat options'), id: 'row-repeat-options', isOpenDefault: true, }).addItem( new OptionsPaneItemDescriptor({ title: t('dashboard.default-layout.row-options.repeat.variable.title', 'Variable'), render: () => , }) ); }, [row]); return [rowOptions, rowRepeatOptions]; } public onDelete() { const layoutManager = getLayoutManagerFor(this._row); if (layoutManager instanceof DefaultGridLayoutManager) { layoutManager.removeRow(this._row); } } public renderActions(): ReactNode { return ( <>