This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 3d443e0126 feat(number-format): Add duration formatter with colon
notation (#30593)
3d443e0126 is described below
commit 3d443e01269a3ec2bc44aa0cc6ab20be98809f87
Author: Michael Gerber <[email protected]>
AuthorDate: Thu Oct 24 19:43:04 2024 +0200
feat(number-format): Add duration formatter with colon notation (#30593)
---
.../packages/superset-ui-chart-controls/src/utils/D3Formatting.ts | 1 +
superset-frontend/src/setup/setupFormatters.ts | 4 ++++
2 files changed, 5 insertions(+)
diff --git
a/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts
b/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts
index 5541c4a4b4..d7fb542c6b 100644
---
a/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts
+++
b/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts
@@ -57,6 +57,7 @@ export const D3_FORMAT_OPTIONS: [string, string][] = [
...d3Formatted,
['DURATION', t('Duration in ms (66000 => 1m 6s)')],
['DURATION_SUB', t('Duration in ms (1.40008 => 1ms 400µs 80ns)')],
+ ['DURATION_COL', t('Duration in ms (10500 => 0:10.5)')],
['MEMORY_DECIMAL', t('Memory in bytes - decimal (1024B => 1.024kB)')],
['MEMORY_BINARY', t('Memory in bytes - binary (1024B => 1KiB)')],
];
diff --git a/superset-frontend/src/setup/setupFormatters.ts
b/superset-frontend/src/setup/setupFormatters.ts
index 384b1be9e3..b8b181fb7f 100644
--- a/superset-frontend/src/setup/setupFormatters.ts
+++ b/superset-frontend/src/setup/setupFormatters.ts
@@ -78,6 +78,10 @@ export default function setupFormatters(
'DURATION_SUB',
createDurationFormatter({ formatSubMilliseconds: true }),
)
+ .registerValue(
+ 'DURATION_COL',
+ createDurationFormatter({ colonNotation: true }),
+ )
.registerValue('MEMORY_DECIMAL', createMemoryFormatter({ binary: false }))
.registerValue('MEMORY_BINARY', createMemoryFormatter({ binary: true }));