From 34bee25c56bf8fb743ad9388f528aba684cc3a95 Mon Sep 17 00:00:00 2001 From: Shivanand Sonnad Date: Tue, 29 Oct 2024 16:53:43 +0000 Subject: [PATCH] fix: [AH-492]: show size coming from BE in layers table (#2893) * fix: [AH-492]: show size coming from BE in layers table --- .../DockerVersion/components/LayersTable/LayersTable.tsx | 4 +++- web/src/ar/pages/version-details/utils.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/ar/pages/version-details/DockerVersion/components/LayersTable/LayersTable.tsx b/web/src/ar/pages/version-details/DockerVersion/components/LayersTable/LayersTable.tsx index d7d079e76..608224cb1 100644 --- a/web/src/ar/pages/version-details/DockerVersion/components/LayersTable/LayersTable.tsx +++ b/web/src/ar/pages/version-details/DockerVersion/components/LayersTable/LayersTable.tsx @@ -16,10 +16,12 @@ import React, { useMemo } from 'react' import classNames from 'classnames' +import { defaultTo } from 'lodash-es' import type { Column } from 'react-table' import { TableV2 } from '@harnessio/uicore' import type { DockerLayerEntry } from '@harnessio/react-har-service-client' +import { DEFAULT_LAYER_SIZE } from '@ar/pages/version-details/utils' import { LayerActionCell, LayerCodeCell, LayerIndexCell, LayerSizeCell } from './LayersTableCells' import css from './LayersTable.module.scss' @@ -56,7 +58,7 @@ export default function LayersTable(props: LayersTableProps): JSX.Element { return data.map((each, index) => ({ id: index + 1, code: each.command, - size: '0 B' + size: defaultTo(each.size, DEFAULT_LAYER_SIZE) })) } return [] diff --git a/web/src/ar/pages/version-details/utils.ts b/web/src/ar/pages/version-details/utils.ts index 14aae32be..b657e8502 100644 --- a/web/src/ar/pages/version-details/utils.ts +++ b/web/src/ar/pages/version-details/utils.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +export const DEFAULT_LAYER_SIZE = '0 B' + export function prettifyManifestJSON(manifest: string): string { try { return JSON.stringify(JSON.parse(manifest), null, 2)