This is an automated email from the ASF dual-hosted git repository. kgabryje pushed a commit to branch folders in repository https://gitbox.apache.org/repos/asf/superset.git
commit 57c237f5d65f765122262885cfc3742f2d461ff3 Author: Kamil Gabryjelski <[email protected]> AuthorDate: Thu Jan 29 16:34:20 2026 +0100 Use sigma instead f(x) for metrics --- .../src/components/ColumnTypeLabel/ColumnTypeLabel.tsx | 7 +++++-- .../src/components/MetricOption.tsx | 2 +- .../test/components/ColumnTypeLabel.test.tsx | 4 ++++ .../superset-ui-core/src/components/Icons/index.tsx | 1 + superset-frontend/src/assets/images/icons/sigma.svg | Bin 0 -> 1002 bytes .../src/components/Datasource/FoldersEditor/TreeItem.tsx | 2 +- .../controls/MetricControl/FilterDefinitionOption.tsx | 4 ++-- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/components/ColumnTypeLabel/ColumnTypeLabel.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/components/ColumnTypeLabel/ColumnTypeLabel.tsx index 8487b865f45..57988ee9651 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/components/ColumnTypeLabel/ColumnTypeLabel.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/components/ColumnTypeLabel/ColumnTypeLabel.tsx @@ -29,8 +29,9 @@ import { FieldStringOutlined, NumberOutlined, } from '@ant-design/icons'; +import { Icons } from '@superset-ui/core/components'; -export type ColumnLabelExtendedType = 'expression' | ''; +export type ColumnLabelExtendedType = 'expression' | 'metric' | ''; export type ColumnTypeLabelProps = { type?: ColumnLabelExtendedType | GenericDataType; @@ -59,7 +60,9 @@ export function ColumnTypeLabel({ type }: ColumnTypeLabelProps) { <QuestionOutlined aria-label={t('unknown type icon')} /> ); - if (type === '' || type === 'expression') { + if (type === 'metric') { + typeIcon = <Icons.Sigma aria-label={t('metric type icon')} />; + } else if (type === '' || type === 'expression') { typeIcon = <FunctionOutlined aria-label={t('function type icon')} />; } else if (type === GenericDataType.String) { typeIcon = <FieldStringOutlined aria-label={t('string type icon')} />; diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/components/MetricOption.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/components/MetricOption.tsx index bf24d1279f5..1f7f43c4e49 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/components/MetricOption.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/components/MetricOption.tsx @@ -95,7 +95,7 @@ export function MetricOption({ return ( <FlexRowContainer className="metric-option"> - {showType && <ColumnTypeLabel type="expression" />} + {showType && <ColumnTypeLabel type="metric" />} {shouldShowTooltip ? ( <Tooltip id="metric-name-tooltip" title={tooltipText}> {label} diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/components/ColumnTypeLabel.test.tsx b/superset-frontend/packages/superset-ui-chart-controls/test/components/ColumnTypeLabel.test.tsx index 7943a78e496..a421bfe7a5a 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/test/components/ColumnTypeLabel.test.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/test/components/ColumnTypeLabel.test.tsx @@ -52,6 +52,10 @@ describe('ColumnOption', () => { renderColumnTypeLabel({ type: 'expression' }); expect(screen.getByLabelText('function type icon')).toBeVisible(); }); + it('metric type shows sigma icon', () => { + renderColumnTypeLabel({ type: 'metric' }); + expect(screen.getByLabelText('metric type icon')).toBeVisible(); + }); it('unknown type shows question mark', () => { renderColumnTypeLabel({ type: undefined }); expect(screen.getByLabelText('unknown type icon')).toBeVisible(); diff --git a/superset-frontend/packages/superset-ui-core/src/components/Icons/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/Icons/index.tsx index 0232707d521..fa246edae02 100644 --- a/superset-frontend/packages/superset-ui-core/src/components/Icons/index.tsx +++ b/superset-frontend/packages/superset-ui-core/src/components/Icons/index.tsx @@ -47,6 +47,7 @@ const customIcons = [ 'Queued', 'Redo', 'Running', + 'Sigma', 'Slack', 'Square', 'SortAsc', diff --git a/superset-frontend/src/assets/images/icons/sigma.svg b/superset-frontend/src/assets/images/icons/sigma.svg new file mode 100644 index 00000000000..7fbf250015b Binary files /dev/null and b/superset-frontend/src/assets/images/icons/sigma.svg differ diff --git a/superset-frontend/src/components/Datasource/FoldersEditor/TreeItem.tsx b/superset-frontend/src/components/Datasource/FoldersEditor/TreeItem.tsx index 4045d921915..e9d66df487c 100644 --- a/superset-frontend/src/components/Datasource/FoldersEditor/TreeItem.tsx +++ b/superset-frontend/src/components/Datasource/FoldersEditor/TreeItem.tsx @@ -171,7 +171,7 @@ function TreeItemComponent({ const columnType = useMemo(() => { if (type === FoldersEditorItemType.Metric) { - return 'expression'; + return 'metric'; } if (type === FoldersEditorItemType.Column && column) { const hasExpression = diff --git a/superset-frontend/src/explore/components/controls/MetricControl/FilterDefinitionOption.tsx b/superset-frontend/src/explore/components/controls/MetricControl/FilterDefinitionOption.tsx index c8aaf488555..dc3a8776552 100644 --- a/superset-frontend/src/explore/components/controls/MetricControl/FilterDefinitionOption.tsx +++ b/superset-frontend/src/explore/components/controls/MetricControl/FilterDefinitionOption.tsx @@ -46,7 +46,7 @@ export default function FilterDefinitionOption({ if (option.saved_metric_name) { return ( <StyledColumnOption - column={{ column_name: option.saved_metric_name, type: 'expression' }} + column={{ column_name: option.saved_metric_name, type: 'metric' }} showType /> ); @@ -62,7 +62,7 @@ export default function FilterDefinitionOption({ if (option.label) { return ( <StyledColumnOption - column={{ column_name: option.label, type: 'expression' }} + column={{ column_name: option.label, type: 'metric' }} showType /> );
