Skip to content

Commit

Permalink
chore: Rename Totals to Summary in table chart (#29360)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina committed Jun 26, 2024
1 parent df8b61b commit fc97a81
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const showTotalsControlSetItem: ControlSetItem = {
name: 'show_totals',
config: {
type: 'CheckboxControl',
label: t('Show totals'),
label: t('Show summary'),
default: false,
description: t(
'Show total aggregations of selected metrics. Note that row limit does not apply to the result.',
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/plugins/plugin-chart-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"xss": "^1.0.14"
},
"peerDependencies": {
"@ant-design/icons": "^5.0.1",
"@superset-ui/chart-controls": "*",
"@superset-ui/core": "*",
"@testing-library/dom": "^7.29.4",
Expand Down
30 changes: 27 additions & 3 deletions superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ import {
css,
t,
tn,
useTheme,
} from '@superset-ui/core';

import { isNumber } from 'lodash';
import { InfoCircleOutlined } from '@ant-design/icons';
import { Tooltip } from '@superset-ui/chart-controls';
import { DataColumnMeta, TableChartTransformedProps } from './types';
import DataTable, {
DataTableProps,
Expand Down Expand Up @@ -250,6 +253,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
});
// keep track of whether column order changed, so that column widths can too
const [columnOrderToggle, setColumnOrderToggle] = useState(false);
const theme = useTheme();

// only take relevant page size options
const pageSizeOptions = useMemo(() => {
Expand Down Expand Up @@ -572,7 +576,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
/* The following classes are added to support custom CSS styling */
className={cx(
'cell-bar',
value && value < 0 ? 'negative' : 'positive',
isNumber(value) && value < 0 ? 'negative' : 'positive',
)}
css={cellBarStyles}
/>
Expand Down Expand Up @@ -639,7 +643,27 @@ export default function TableChart<D extends DataRecord = DataRecord>(
),
Footer: totals ? (
i === 0 ? (
<th>{t('Totals')}</th>
<th>
<div
css={css`
display: flex;
align-items: center;
& svg {
margin-left: ${theme.gridUnit}px;
color: ${theme.colors.grayscale.dark1} !important;
}
`}
>
{t('Summary')}
<Tooltip
overlay={t(
'Show total aggregations of selected metrics. Note that row limit does not apply to the result.',
)}
>
<InfoCircleOutlined />
</Tooltip>
</div>
</th>
) : (
<td style={sharedStyle}>
<strong>{formatColumnValue(column, totals[key])[1]}</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ const config: ControlPanelConfig = {
name: 'show_totals',
config: {
type: 'CheckboxControl',
label: t('Show totals'),
label: t('Show summary'),
default: false,
description: t(
'Show total aggregations of selected metrics. Note that row limit does not apply to the result.',
Expand Down

0 comments on commit fc97a81

Please sign in to comment.