Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(explore): make to convert null to N/A in view results #19316

Merged
merged 2 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions superset-frontend/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,8 @@ export const FAST_DEBOUNCE = 250;
* Slower debounce delay for inputs with expensive API calls.
*/
export const SLOW_DEBOUNCE = 500;

/**
* Display null as `N/A`
*/
export const NULL_DISPLAY = 'N/A';
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
BOOL_FALSE_DISPLAY,
BOOL_TRUE_DISPLAY,
SLOW_DEBOUNCE,
NULL_DISPLAY,
} from 'src/constants';
import { Radio } from 'src/components/Radio';
import Icons from 'src/components/Icons';
Expand All @@ -49,6 +50,10 @@ import {
unsetTimeFormattedColumn,
} from 'src/explore/actions/exploreActions';

export const CellNull = styled('span')`
prosdev0107 marked this conversation as resolved.
Show resolved Hide resolved
color: ${({ theme }) => theme.colors.grayscale.light1};
`;

export const CopyButton = styled(Button)`
font-size: ${({ theme }) => theme.typography.sizes.s}px;

Expand Down Expand Up @@ -303,6 +308,9 @@ export const useTableColumns = (
if (value === false) {
return BOOL_FALSE_DISPLAY;
}
if (value === null) {
prosdev0107 marked this conversation as resolved.
Show resolved Hide resolved
return <CellNull>{NULL_DISPLAY}</CellNull>;
}
if (timeFormattedColumnIndex > -1) {
return timeFormatter(value);
}
Expand Down