import React, { ReactElement } from 'react'; import { Field, useStyles2 } from '@grafana/ui'; import { LibraryPanelInput, LibraryPanelInputState } from '../state/reducers'; import { GrafanaTheme2 } from '@grafana/data'; import { css } from '@emotion/css'; import { LibraryPanelCard } from '../../library-panels/components/LibraryPanelCard/LibraryPanelCard'; interface ImportDashboardLibraryPanelsListProps { inputs: LibraryPanelInput[]; label: string; description: string; folderName?: string; } export function ImportDashboardLibraryPanelsList({ inputs, label, description, folderName, }: ImportDashboardLibraryPanelsListProps): ReactElement | null { const styles = useStyles2(getStyles); if (!Boolean(inputs?.length)) { return null; } return (
<> {inputs.map((input, index) => { const libraryPanelIndex = `elements[${index}]`; const libraryPanel = input.state === LibraryPanelInputState.New ? { ...input.model, meta: { ...input.model.meta, folderName: folderName ?? 'General' } } : { ...input.model }; return (
undefined} />
); })}
); } function getStyles(theme: GrafanaTheme2) { return { spacer: css` margin-bottom: ${theme.spacing(2)}; `, item: css` margin-bottom: ${theme.spacing(1)}; `, }; }