import { useMemo } from 'react'; import { Select } from '@grafana/ui'; import { t } from 'app/core/internationalization'; import { OptionsPaneCategoryDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor'; import { OptionsPaneItemDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor'; import { DashboardLayoutManager } from '../types/DashboardLayoutManager'; import { isLayoutParent } from '../types/LayoutParent'; import { LayoutRegistryItem } from '../types/LayoutRegistryItem'; import { layoutRegistry } from './layoutRegistry'; import { findParentLayout } from './utils'; export interface Props { layoutManager: DashboardLayoutManager; } export function DashboardLayoutSelector({ layoutManager }: Props) { const options = useMemo(() => { const parentLayout = findParentLayout(layoutManager); const parentLayoutId = parentLayout?.descriptor.id; return layoutRegistry .list() .filter((layout) => layout.id !== parentLayoutId) .map((layout) => ({ label: layout.name, value: layout, })); }, [layoutManager]); const currentLayoutId = layoutManager.descriptor.id; const currentOption = options.find((option) => option.value.id === currentLayoutId); return (