From ef7d8c0c1165289da6540d477c39ef19b8fe210a Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 19 May 2025 16:56:32 +0530 Subject: [PATCH 1/7] feat: add FEATURE_REDFISH_NODE_ENABLE to customEnv interface --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index 4d5f80fe0..16ec9bd43 100644 --- a/src/index.ts +++ b/src/index.ts @@ -149,6 +149,10 @@ export interface customEnv { * @default false */ FEATURE_APPLICATION_TEMPLATES_ENABLE?: boolean + /** + * @default false + */ + FEATURE_REDFISH_NODE_ENABLE?: boolean GATEKEEPER_URL?: string FEATURE_AI_INTEGRATION_ENABLE?: boolean LOGIN_PAGE_IMAGE?: string From 58b7d85e1a8780ff37d856f8f46ba145ec708ae0 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 19 May 2025 18:39:05 +0530 Subject: [PATCH 2/7] feat: enhance SegmentedBarChart with hideLegend prop and update types --- .../SegmentedBarChart/SegmentedBarChart.tsx | 21 ++++++++++++------- src/Common/SegmentedBarChart/types.ts | 15 ++++++++++--- src/Pages/ResourceBrowser/types.ts | 4 ++++ .../Security/SecurityModal/types.ts | 4 ++-- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/Common/SegmentedBarChart/SegmentedBarChart.tsx b/src/Common/SegmentedBarChart/SegmentedBarChart.tsx index 33d64f26d..cf842a68c 100644 --- a/src/Common/SegmentedBarChart/SegmentedBarChart.tsx +++ b/src/Common/SegmentedBarChart/SegmentedBarChart.tsx @@ -23,6 +23,7 @@ import { Entity, SegmentedBarChartProps } from './types' import './styles.scss' const SegmentedBarChart: React.FC = ({ + hideLegend, entities: userEntities = [FALLBACK_ENTITY], rootClassName, countClassName, @@ -36,7 +37,7 @@ const SegmentedBarChart: React.FC = ({ const total = entities.reduce((sum, entity) => entity.value + sum, 0) const filteredEntities = entities.filter((entity) => !!entity.value) - const calcSegmentWidth = (entity: Entity) => `${(entity.value / total) * 100}%` + const calcSegmentWidth = (entityValue: Entity['value']) => `${(entityValue / total) * 100}%` const renderLabel = (label: Entity['label']) => isLoading ? ( @@ -88,11 +89,17 @@ const SegmentedBarChart: React.FC = ({ )) } - const renderLegend = () => ( -
- {renderContent()} -
- ) + const renderLegend = () => { + if (hideLegend) { + return null + } + + return ( +
+ {renderContent()} +
+ ) + } const renderBar = () => ( = ({ className={`h-8 ${index === 0 ? 'dc__left-radius-4' : ''} ${ index === map.length - 1 ? 'dc__right-radius-4' : '' } ${isLoading ? 'shimmer' : ''}`} - style={{ backgroundColor: entity.color, width: calcSegmentWidth(entity) }} + style={{ backgroundColor: entity.color, width: calcSegmentWidth(entity.value) }} /> ))} diff --git a/src/Common/SegmentedBarChart/types.ts b/src/Common/SegmentedBarChart/types.ts index ea56fc846..b0153715f 100644 --- a/src/Common/SegmentedBarChart/types.ts +++ b/src/Common/SegmentedBarChart/types.ts @@ -20,8 +20,17 @@ export type Entity = { value: number } -export interface SegmentedBarChartProps { - entities: NonNullable +type EntityPropType = + | { + hideLegend?: false + entities: NonNullable + } + | { + hideLegend: true + entities: NonNullable & { label?: never }>[] + } + +export type SegmentedBarChartProps = { rootClassName?: string countClassName?: string labelClassName?: string @@ -29,4 +38,4 @@ export interface SegmentedBarChartProps { swapLegendAndBar?: boolean showAnimationOnBar?: boolean isLoading?: boolean -} +} & EntityPropType diff --git a/src/Pages/ResourceBrowser/types.ts b/src/Pages/ResourceBrowser/types.ts index ed8dda683..d7dfa9c06 100644 --- a/src/Pages/ResourceBrowser/types.ts +++ b/src/Pages/ResourceBrowser/types.ts @@ -16,6 +16,8 @@ import { Dispatch, ReactElement, SetStateAction } from 'react' +import { TabProps } from '@Shared/Components' + import { NodeActionRequest } from './ResourceBrowser.Types' export enum ClusterFiltersType { @@ -99,3 +101,5 @@ export interface AdditionalConfirmationModalOptionsProps { setOptionsData: Dispatch> children?: ReactElement } + +export type NodeDetailTabsInfoType = (Pick & { id: string; node: () => JSX.Element })[] diff --git a/src/Shared/Components/Security/SecurityModal/types.ts b/src/Shared/Components/Security/SecurityModal/types.ts index b1588666a..79e1dac6e 100644 --- a/src/Shared/Components/Security/SecurityModal/types.ts +++ b/src/Shared/Components/Security/SecurityModal/types.ts @@ -16,7 +16,7 @@ import React from 'react' -import { SegmentedBarChartProps } from '@Common/SegmentedBarChart' +import { Entity } from '@Common/SegmentedBarChart/types' import { ServerErrors } from '@Common/ServerError' import { GenericEmptyStateType } from '@Common/Types' import { LastExecutionResultType, Nodes, NodeType } from '@Shared/types' @@ -103,7 +103,7 @@ export interface StatusType { } export interface InfoCardPropsType extends Pick { - entities: SegmentedBarChartProps['entities'] + entities: NonNullable lastScanTimeString?: string } From 9b45b39c5852e0206d94ce2d73c8067becb658e9 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 19 May 2025 18:40:23 +0530 Subject: [PATCH 3/7] fix: update getBarChartEntities return type to NonNullable --- src/Shared/Components/BulkOperations/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Shared/Components/BulkOperations/types.ts b/src/Shared/Components/BulkOperations/types.ts index b3a1d5bc7..eea19a919 100644 --- a/src/Shared/Components/BulkOperations/types.ts +++ b/src/Shared/Components/BulkOperations/types.ts @@ -17,7 +17,7 @@ import { ReactNode } from 'react' import { APIOptions, DrawerProps } from '@Common/index' -import { SegmentedBarChartProps } from '@Common/SegmentedBarChart' +import { Entity } from '@Common/SegmentedBarChart/types' import { ConfirmationModalProps } from '../ConfirmationModal/types' import { getProgressingStateForStatus } from '../Security' @@ -64,7 +64,7 @@ export interface OperationResultStoreType { getResults: ( sortComparator: (a: BulkOperationResultType, b: BulkOperationResultType) => number, ) => BulkOperationResultWithIdType[] - getBarChartEntities: () => SegmentedBarChartProps['entities'] + getBarChartEntities: () => NonNullable getResultsStatusCount: () => Record getSize: () => number updateResultStatus: ( From 5ff3361b13597bd28c8795a661b3f673054ead53 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Tue, 20 May 2025 13:08:03 +0530 Subject: [PATCH 4/7] feat: add thermometer icon and update icon map --- src/Assets/IconV2/ic-thermometer.svg | 3 +++ src/Shared/Components/Icon/Icon.tsx | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 src/Assets/IconV2/ic-thermometer.svg diff --git a/src/Assets/IconV2/ic-thermometer.svg b/src/Assets/IconV2/ic-thermometer.svg new file mode 100644 index 000000000..470af06b5 --- /dev/null +++ b/src/Assets/IconV2/ic-thermometer.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/Shared/Components/Icon/Icon.tsx b/src/Shared/Components/Icon/Icon.tsx index 5db478d3f..868c3c55a 100644 --- a/src/Shared/Components/Icon/Icon.tsx +++ b/src/Shared/Components/Icon/Icon.tsx @@ -108,6 +108,7 @@ import { ReactComponent as ICSuccess } from '@IconsV2/ic-success.svg' import { ReactComponent as ICSuspended } from '@IconsV2/ic-suspended.svg' import { ReactComponent as ICTata1mg } from '@IconsV2/ic-tata1mg.svg' import { ReactComponent as ICTerminalFill } from '@IconsV2/ic-terminal-fill.svg' +import { ReactComponent as ICThermometer } from '@IconsV2/ic-thermometer.svg' import { ReactComponent as ICThumbDown } from '@IconsV2/ic-thumb-down.svg' import { ReactComponent as ICThumbUp } from '@IconsV2/ic-thumb-up.svg' import { ReactComponent as ICTimeoutDash } from '@IconsV2/ic-timeout-dash.svg' @@ -231,6 +232,7 @@ export const iconMap = { 'ic-suspended': ICSuspended, 'ic-tata1mg': ICTata1mg, 'ic-terminal-fill': ICTerminalFill, + 'ic-thermometer': ICThermometer, 'ic-thumb-down': ICThumbDown, 'ic-thumb-up': ICThumbUp, 'ic-timeout-dash': ICTimeoutDash, From ab2aead8c103b8a329711659ac1977c2c640b246 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Tue, 20 May 2025 14:51:02 +0530 Subject: [PATCH 5/7] feat: add terminal icon and update icon map --- src/Assets/IconV2/ic-terminal.svg | 3 +++ src/Shared/Components/Icon/Icon.tsx | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 src/Assets/IconV2/ic-terminal.svg diff --git a/src/Assets/IconV2/ic-terminal.svg b/src/Assets/IconV2/ic-terminal.svg new file mode 100644 index 000000000..0ebbdcb7c --- /dev/null +++ b/src/Assets/IconV2/ic-terminal.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/Shared/Components/Icon/Icon.tsx b/src/Shared/Components/Icon/Icon.tsx index 868c3c55a..be7369e49 100644 --- a/src/Shared/Components/Icon/Icon.tsx +++ b/src/Shared/Components/Icon/Icon.tsx @@ -107,6 +107,7 @@ import { ReactComponent as ICStamp } from '@IconsV2/ic-stamp.svg' import { ReactComponent as ICSuccess } from '@IconsV2/ic-success.svg' import { ReactComponent as ICSuspended } from '@IconsV2/ic-suspended.svg' import { ReactComponent as ICTata1mg } from '@IconsV2/ic-tata1mg.svg' +import { ReactComponent as ICTerminal } from '@IconsV2/ic-terminal.svg' import { ReactComponent as ICTerminalFill } from '@IconsV2/ic-terminal-fill.svg' import { ReactComponent as ICThermometer } from '@IconsV2/ic-thermometer.svg' import { ReactComponent as ICThumbDown } from '@IconsV2/ic-thumb-down.svg' @@ -232,6 +233,7 @@ export const iconMap = { 'ic-suspended': ICSuspended, 'ic-tata1mg': ICTata1mg, 'ic-terminal-fill': ICTerminalFill, + 'ic-terminal': ICTerminal, 'ic-thermometer': ICThermometer, 'ic-thumb-down': ICThumbDown, 'ic-thumb-up': ICThumbUp, From e567368cbc1d35609b97bb82ec40e958d1b47a0d Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Tue, 20 May 2025 16:06:15 +0530 Subject: [PATCH 6/7] fix: update NodeDetailTabsInfoType to use renderComponent instead of node --- src/Pages/ResourceBrowser/types.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Pages/ResourceBrowser/types.ts b/src/Pages/ResourceBrowser/types.ts index d7dfa9c06..db3389903 100644 --- a/src/Pages/ResourceBrowser/types.ts +++ b/src/Pages/ResourceBrowser/types.ts @@ -102,4 +102,7 @@ export interface AdditionalConfirmationModalOptionsProps { children?: ReactElement } -export type NodeDetailTabsInfoType = (Pick & { id: string; node: () => JSX.Element })[] +export type NodeDetailTabsInfoType = (Pick & { + id: string + renderComponent: () => JSX.Element +})[] From 7412648a4364f7a319ff7e008638c1c3d076c748 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Tue, 20 May 2025 19:56:07 +0530 Subject: [PATCH 7/7] fix: update version to 1.13.0-redfish-preview-beta-1 in package.json and package-lock.json --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 01938014c..98e3a11a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0", + "version": "1.13.0-redfish-preview-beta-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0", + "version": "1.13.0-redfish-preview-beta-1", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index a10088e67..1b7a87f6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0", + "version": "1.13.0-redfish-preview-beta-1", "description": "Supporting common component library", "type": "module", "main": "dist/index.js",