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

HPCC-31075 ECL Watch v9 change compressed file size notation #18193

Merged
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
11 changes: 4 additions & 7 deletions esp/src/src-react/components/IndexFileSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from "react";
import { CommandBar, ContextualMenuItemType, ICommandBarItemProps, ScrollablePane, ScrollbarVisibility, Sticky, StickyPositionType } from "@fluentui/react";
import { DFUService, WsDfu } from "@hpcc-js/comms";
import { format as d3Format } from "@hpcc-js/common";
import { scopedLogger } from "@hpcc-js/util";
import nlsHPCC from "src/nlsHPCC";
import { formatCost } from "src/Session";
@@ -21,8 +20,6 @@ const logger = scopedLogger("src-react/components/IndexFileSummary.tsx");

import "react-reflex/styles.css";

const format = d3Format(",.2f");

const dfuService = new DFUService({ baseUrl: "" });

interface IndexFileSummaryProps {
@@ -175,7 +172,7 @@ export const IndexFileSummary: React.FunctionComponent<IndexFileSummaryProps> =
"Filesize": { label: nlsHPCC.FileSize, type: "string", value: file?.Filesize, readonly: true },
"Format": { label: nlsHPCC.Format, type: "string", value: file?.Format, readonly: true },
"IsCompressed": { label: nlsHPCC.IsCompressed, type: "checkbox", value: file?.IsCompressed, readonly: true },
"CompressedFileSizeString": { label: nlsHPCC.CompressedFileSize, type: "string", value: file?.CompressedFileSize ? file?.CompressedFileSize.toString() : "", readonly: true },
"CompressedFileSizeString": { label: nlsHPCC.CompressedFileSize, type: "string", value: file?.CompressedFileSize ? Utility.safeFormatNum(file?.CompressedFileSize) : "", readonly: true },
"PercentCompressed": { label: nlsHPCC.PercentCompressed, type: "string", value: file?.PercentCompressed, readonly: true },
"Modified": { label: nlsHPCC.Modified, type: "string", value: file?.Modified, readonly: true },
"ExpirationDate": { label: nlsHPCC.ExpirationDate, type: "string", value: file?.ExpirationDate, readonly: true },
@@ -237,21 +234,21 @@ export const IndexFileSummary: React.FunctionComponent<IndexFileSummaryProps> =
label: nlsHPCC.File,
originalSize: Utility.convertedSize(file?.FileSizeInt64),
diskSize: Utility.convertedSize(file?.CompressedFileSize || file?.FileSizeInt64),
percentCompressed: ((file?.CompressedFileSize && file?.FileSizeInt64) ? format(100 * file?.CompressedFileSize / file?.FileSizeInt64) : 0) + "%",
percentCompressed: ((file?.CompressedFileSize && file?.FileSizeInt64) ? Utility.formatDecimal(100 * file?.CompressedFileSize / file?.FileSizeInt64) : 0) + "%",
memorySize: (file?.ExtendedIndexInfo?.SizeMemoryBranches && file?.ExtendedIndexInfo?.SizeMemoryLeaves) ? Utility.convertedSize(file?.ExtendedIndexInfo?.SizeMemoryBranches + file?.ExtendedIndexInfo?.SizeMemoryLeaves) : ""
},
{
label: nlsHPCC.Branches,
originalSize: Utility.convertedSize(file?.ExtendedIndexInfo?.SizeOriginalBranches) ?? "",
diskSize: Utility.convertedSize(file?.ExtendedIndexInfo?.SizeDiskBranches) ?? "",
percentCompressed: file?.ExtendedIndexInfo?.BranchCompressionPercent ? format(file.ExtendedIndexInfo.BranchCompressionPercent) + "%" : "",
percentCompressed: file?.ExtendedIndexInfo?.BranchCompressionPercent ? Utility.formatDecimal(file.ExtendedIndexInfo.BranchCompressionPercent) + "%" : "",
memorySize: Utility.convertedSize(file?.ExtendedIndexInfo?.SizeMemoryBranches) ?? ""
},
{
label: nlsHPCC.Data,
originalSize: Utility.convertedSize(file?.ExtendedIndexInfo?.SizeOriginalData) ?? "",
diskSize: (file?.ExtendedIndexInfo?.SizeDiskLeaves !== undefined && file?.ExtendedIndexInfo?.SizeDiskBlobs !== undefined) ? Utility.convertedSize(file?.ExtendedIndexInfo?.SizeDiskLeaves + file?.ExtendedIndexInfo?.SizeDiskBlobs) : "",
percentCompressed: file?.ExtendedIndexInfo?.DataCompressionPercent ? format(file.ExtendedIndexInfo.DataCompressionPercent) + "%" : "",
percentCompressed: file?.ExtendedIndexInfo?.DataCompressionPercent ? Utility.formatDecimal(file.ExtendedIndexInfo.DataCompressionPercent) + "%" : "",
memorySize: Utility.convertedSize(file?.ExtendedIndexInfo?.SizeMemoryLeaves) ?? ""
}
]}
5 changes: 1 addition & 4 deletions esp/src/src-react/components/LogicalFileSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from "react";
import { CommandBar, ContextualMenuItemType, ICommandBarItemProps, MessageBar, MessageBarType, ScrollablePane, ScrollbarVisibility, Sticky, StickyPositionType } from "@fluentui/react";
import { format as d3Format } from "@hpcc-js/common";
import { DFUService, WsDfu } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import nlsHPCC from "src/nlsHPCC";
@@ -29,8 +28,6 @@ interface LogicalFileSummaryProps {
tab?: string;
}

const formatInt = d3Format(",");

export const LogicalFileSummary: React.FunctionComponent<LogicalFileSummaryProps> = ({
cluster,
logicalFile,
@@ -196,7 +193,7 @@ export const LogicalFileSummary: React.FunctionComponent<LogicalFileSummaryProps
"KeyType": { label: nlsHPCC.KeyType, type: "string", value: file?.KeyType, readonly: true },
"Format": { label: nlsHPCC.Format, type: "string", value: file?.Format, readonly: true },
"IsCompressed": { label: nlsHPCC.IsCompressed, type: "checkbox", value: file?.IsCompressed, readonly: true },
"CompressedFileSizeString": { label: nlsHPCC.CompressedFileSize, type: "string", value: file?.CompressedFileSize ? formatInt(file?.CompressedFileSize) : "", readonly: true },
"CompressedFileSizeString": { label: nlsHPCC.CompressedFileSize, type: "string", value: file?.CompressedFileSize ? Utility.safeFormatNum(file?.CompressedFileSize) : "", readonly: true },
"Filesize": { label: nlsHPCC.FileSize, type: "string", value: file?.Filesize, readonly: true },
"PercentCompressed": { label: nlsHPCC.PercentCompressed, type: "string", value: file?.PercentCompressed, readonly: true },
"Modified": { label: nlsHPCC.Modified, type: "string", value: file?.Modified, readonly: true },
2 changes: 1 addition & 1 deletion esp/src/src/Utility.ts
Original file line number Diff line number Diff line change
@@ -1093,7 +1093,7 @@ export function deleteCookie(name: string) {
}

const d3FormatDecimal = d3Format(",.2f");
const d3FormatInt = d3Format(",");
const d3FormatInt = d3Format(",.0f");

export function formatDecimal(num: number): string {
if (!num) return "";
Loading
Oops, something went wrong.