mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Table: Fixes logic for when adhoc filters are shown (#63642)
This commit is contained in:
parent
95bd79ef4b
commit
30c6ac49ba
@ -15,14 +15,14 @@ interface CellActionProps extends TableCellProps {
|
|||||||
|
|
||||||
interface CommonButtonProps {
|
interface CommonButtonProps {
|
||||||
size: IconSize;
|
size: IconSize;
|
||||||
|
showFilters?: boolean;
|
||||||
tooltipPlacement: TooltipPlacement;
|
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 [isInspecting, setIsInspecting] = useState(false);
|
||||||
|
|
||||||
const isRightAligned = getTextAlign(field) === 'flex-end';
|
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 inspectEnabled = Boolean((field.config.custom as TableFieldOptions)?.inspect);
|
||||||
const commonButtonProps: CommonButtonProps = {
|
const commonButtonProps: CommonButtonProps = {
|
||||||
size: 'sm',
|
size: 'sm',
|
||||||
|
@ -28,7 +28,7 @@ export const DefaultCell: FC<TableCellProps> = (props) => {
|
|||||||
value = formattedValueToString(displayValue);
|
value = formattedValueToString(displayValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
const showFilters = field.config.filterable;
|
const showFilters = props.onCellFilterAdded && field.config.filterable;
|
||||||
const showActions = (showFilters && cell.value !== undefined) || inspectEnabled;
|
const showActions = (showFilters && cell.value !== undefined) || inspectEnabled;
|
||||||
const cellOptions = getCellOptions(field);
|
const cellOptions = getCellOptions(field);
|
||||||
const cellStyle = getCellStyle(tableStyles, cellOptions, displayValue, inspectEnabled);
|
const cellStyle = getCellStyle(tableStyles, cellOptions, displayValue, inspectEnabled);
|
||||||
@ -56,7 +56,7 @@ export const DefaultCell: FC<TableCellProps> = (props) => {
|
|||||||
</DataLinksContextMenu>
|
</DataLinksContextMenu>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showActions && <CellActions {...props} previewMode="text" />}
|
{showActions && <CellActions {...props} previewMode="text" showFilters={showFilters} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user