import { css } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { Checkbox, useStyles2 } from '@grafana/ui'; import { t } from 'app/core/internationalization'; import { DashboardsTreeCellProps, SelectionState } from '../types'; import { isSharedWithMe } from './utils'; export default function CheckboxCell({ row: { original: row }, isSelected, onItemSelectionChange, }: DashboardsTreeCellProps) { const item = row.item; if (!isSelected) { return ; } if (item.kind === 'ui') { if (item.uiKind === 'pagination-placeholder') { return ; } else { return ; } } if (isSharedWithMe(item.uid)) { return ; } const state = isSelected(item); return ( onItemSelectionChange?.(item, ev.currentTarget.checked)} /> ); } function CheckboxSpacer() { const styles = useStyles2(getStyles); return ; } const getStyles = (theme: GrafanaTheme2) => ({ // Should be the same size as the so Dashboard name is aligned to Folder name siblings checkboxSpacer: css({ paddingLeft: theme.spacing(2), }), });