Table: Fixes logic for when adhoc filters are shown (#63642)

pull/64208/head
Torkel Ödegaard 2 years ago committed by GitHub
parent 95bd79ef4b
commit 30c6ac49ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/grafana-ui/src/components/Table/CellActions.tsx
  2. 4
      packages/grafana-ui/src/components/Table/DefaultCell.tsx

@ -15,14 +15,14 @@ interface CellActionProps extends TableCellProps {
interface CommonButtonProps {
size: IconSize;
showFilters?: boolean;
tooltipPlacement: TooltipPlacement;
}
export function CellActions({ field, cell, previewMode, onCellFilterAdded }: CellActionProps) {
export function CellActions({ field, cell, previewMode, showFilters, onCellFilterAdded }: CellActionProps) {
const [isInspecting, setIsInspecting] = useState(false);
const isRightAligned = getTextAlign(field) === 'flex-end';
const showFilters = Boolean(field.config.filterable) && cell.value !== undefined;
const inspectEnabled = Boolean((field.config.custom as TableFieldOptions)?.inspect);
const commonButtonProps: CommonButtonProps = {
size: 'sm',

@ -28,7 +28,7 @@ export const DefaultCell: FC<TableCellProps> = (props) => {
value = formattedValueToString(displayValue);
}
const showFilters = field.config.filterable;
const showFilters = props.onCellFilterAdded && field.config.filterable;
const showActions = (showFilters && cell.value !== undefined) || inspectEnabled;
const cellOptions = getCellOptions(field);
const cellStyle = getCellStyle(tableStyles, cellOptions, displayValue, inspectEnabled);
@ -56,7 +56,7 @@ export const DefaultCell: FC<TableCellProps> = (props) => {
</DataLinksContextMenu>
)}
{showActions && <CellActions {...props} previewMode="text" />}
{showActions && <CellActions {...props} previewMode="text" showFilters={showFilters} />}
</div>
);
};

Loading…
Cancel
Save