diff --git a/esp/src/eclwatch/DFUQueryWidget.js b/esp/src/eclwatch/DFUQueryWidget.js index 0f717c95436..9648cf6d143 100644 --- a/esp/src/eclwatch/DFUQueryWidget.js +++ b/esp/src/eclwatch/DFUQueryWidget.js @@ -31,6 +31,8 @@ define([ "put-selector/put", + "src/Utility", + "dojo/text!../templates/DFUQueryWidget.html", "hpcc/TargetSelectWidget", @@ -63,7 +65,7 @@ define([ registry, Dialog, Menu, MenuItem, MenuSeparator, PopupMenuItem, editor, selector, tree, _TabContainerWidget, WsDfu, FileSpray, ESPUtil, ESPLogicalFile, ESPDFUWorkunit, DelayLoadWidget, WsTopology, Utility, Session, - put, + put, Utility, template) { var nlsHPCC = nlsHPCCMod.default; @@ -736,13 +738,13 @@ define([ MinSkew: { label: nlsHPCC.MinSkew, width: 60, formatter: function (value, row) { - return value !== undefined ? value : ""; + return value ? "-" + Utility.formatDecimal(value / 100) + "%" : ""; } }, MaxSkew: { label: nlsHPCC.MaxSkew, width: 60, formatter: function (value, row) { - return value !== undefined ? value : ""; + return value ? Utility.formatDecimal(value / 100) + "%" : ""; } }, Modified: { label: this.i18n.ModifiedUTCGMT, width: 162 }, diff --git a/esp/src/eclwatch/LFDetailsWidget.js b/esp/src/eclwatch/LFDetailsWidget.js index 06ace68f0fa..d6861e1cda7 100644 --- a/esp/src/eclwatch/LFDetailsWidget.js +++ b/esp/src/eclwatch/LFDetailsWidget.js @@ -10,6 +10,8 @@ define([ "dijit/registry", + "src/Utility", + "hpcc/_TabContainerWidget", "hpcc/DelayLoadWidget", "src/Clippy", @@ -49,7 +51,7 @@ define([ "hpcc/TableContainer" ], function (exports, declare, lang, nlsHPCCMod, dom, domAttr, domClass, domForm, - registry, + registry, Utility, _TabContainerWidget, DelayLoadWidget, Clippy, ESPLogicalFile, ESPDFUWorkunit, FileSpray, DataPatternsWidget, Session, template) { @@ -462,6 +464,10 @@ define([ this.updateInput("RecordSize", oldValue, this.i18n.NoPublishedSize); } else if (name === "Cost") { this.updateInput("FormattedCost", oldValue, Session.formatCost(newValue)); + } else if (name === "MinSkew") { + domAttr.set(this.id + "MinSkew", "innerHTML", this.logicalFile.MinSkew ? Utility.formatDecimal(this.logicalFile.MinSkew) + "%" : ""); + } else if (name === "MaxSkew") { + domAttr.set(this.id + "MaxSkew", "innerHTML", this.logicalFile.MaxSkew ? Utility.formatDecimal(this.logicalFile.MaxSkew) + "%" : ""); } }, diff --git a/esp/src/src-react/components/Files.tsx b/esp/src/src-react/components/Files.tsx index 0b3beb6d6c3..deaa3ba52cf 100644 --- a/esp/src/src-react/components/Files.tsx +++ b/esp/src/src-react/components/Files.tsx @@ -200,10 +200,10 @@ export const Files: React.FunctionComponent = ({ }, []), }, MinSkew: { - label: nlsHPCC.MinSkew, width: 60, formatter: React.useCallback((value, row) => value ?? "", []) + label: nlsHPCC.MinSkew, width: 60, formatter: React.useCallback((value, row) => value ? `-${Utility.formatDecimal(value / 100)}%` : "", []) }, MaxSkew: { - label: nlsHPCC.MaxSkew, width: 60, formatter: React.useCallback((value, row) => value ?? "", []) + label: nlsHPCC.MaxSkew, width: 60, formatter: React.useCallback((value, row) => value ? `${Utility.formatDecimal(value / 100)}%` : "", []) }, Modified: { label: nlsHPCC.ModifiedUTCGMT, width: 162 }, AtRestCost: { diff --git a/esp/src/src-react/components/LogicalFileSummary.tsx b/esp/src/src-react/components/LogicalFileSummary.tsx index bc63c92112c..69e1c78d0eb 100644 --- a/esp/src/src-react/components/LogicalFileSummary.tsx +++ b/esp/src/src-react/components/LogicalFileSummary.tsx @@ -180,8 +180,8 @@ export const LogicalFileSummary: React.FunctionComponent 0, readonly: true }, "NumParts": { label: nlsHPCC.FileParts, type: "number", value: file?.NumParts, readonly: true }, - "MinSkew": { label: nlsHPCC.MinSkew, type: "string", value: file?.Stat?.MinSkew, readonly: true }, - "MaxSkew": { label: nlsHPCC.MaxSkew, type: "string", value: file?.Stat?.MaxSkew, readonly: true }, + "MinSkew": { label: nlsHPCC.MinSkew, type: "string", value: `${Utility.formatDecimal(file?.Stat?.MinSkew ?? "0")}%`, readonly: true }, + "MaxSkew": { label: nlsHPCC.MaxSkew, type: "string", value: `${Utility.formatDecimal(file?.Stat?.MaxSkew ?? "0")}%`, readonly: true }, "MinSkewPart": { label: nlsHPCC.MinSkewPart, type: "string", value: file?.Stat?.MinSkewPart === undefined ? "" : file?.Stat?.MinSkewPart?.toString(), readonly: true }, "MaxSkewPart": { label: nlsHPCC.MaxSkewPart, type: "string", value: file?.Stat?.MaxSkewPart === undefined ? "" : file?.Stat?.MaxSkewPart?.toString(), readonly: true }, }} onChange={(id, value) => { diff --git a/esp/src/src/Session.ts b/esp/src/src/Session.ts index bd6952c33bc..740a1acfbf3 100644 --- a/esp/src/src/Session.ts +++ b/esp/src/src/Session.ts @@ -48,7 +48,7 @@ getBuildInfo().then(info => { dojoConfig.currencyCode = info["currencyCode"] ?? ""; }); -const format = d3Format(".2f"); +const format = d3Format(",.2f"); export function formatCost(value?: number | string): string { if (value !== 0 && !value) { logger.debug(`formatCost called for a nullish value: ${value}`); diff --git a/esp/src/src/Utility.ts b/esp/src/src/Utility.ts index 3e9eab453f2..e7a9bf05fcf 100644 --- a/esp/src/src/Utility.ts +++ b/esp/src/src/Utility.ts @@ -1061,6 +1061,14 @@ export function deleteCookie(name: string) { document.cookie = `${name}=; domain=${window.location.hostname}; path=/; expires=${expireDate.toUTCString()}`; } +export function formatDecimal(str): string { + const format = d3Format(",.2f"); + if (isNaN(str)) { + return str; + } + return format(str); +} + export function formatNum(str): string { if (isNaN(str)) { return str;