diff --git a/package-lock.json b/package-lock.json index 5bbf22a6a..ffdee57f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.23.4", + "version": "1.23.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.23.4", + "version": "1.23.5", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index c87830ddf..2be0d2708 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.23.4", + "version": "1.23.5", "description": "Supporting common component library", "type": "module", "main": "dist/index.js", diff --git a/src/Shared/Store/IndexStore.tsx b/src/Shared/Store/IndexStore.tsx index 376344a78..de39de7e9 100644 --- a/src/Shared/Store/IndexStore.tsx +++ b/src/Shared/Store/IndexStore.tsx @@ -116,20 +116,33 @@ export function getiNodesByRootNodeWithChildNodes( }) }) - // Add containers to Pod type nodes + // Add init containers and containers to Pod type nodes children .filter((_child) => _child.kind.toLowerCase() == Nodes.Pod.toLowerCase()) .map((_pn) => { + const podMeta = (podMetadata || _appDetailsSubject.getValue().resourceTree?.podMetadata)?.filter( + (_pmd) => _pmd.uid === _pn.uid, + )[0] + + const initNodes: iNode[] = (podMeta?.initContainers || []).map((_c: string) => { + const initNode = {} as iNode + initNode.kind = Nodes.Containers + initNode.name = _c + initNode.pNode = _pn + initNode.isInitContainer = true + return initNode + }) + + const containerNodes: iNode[] = (podMeta?.containers || []).map((_c: string) => { + const childNode = {} as iNode + childNode.kind = Nodes.Containers + childNode.name = _c + childNode.pNode = _pn + return childNode + }) + // eslint-disable-next-line no-param-reassign - _pn.childNodes = (podMetadata || _appDetailsSubject.getValue().resourceTree?.podMetadata) - ?.filter((_pmd) => _pmd.uid === _pn.uid)[0] - ?.containers?.map((_c) => { - const childNode = {} as iNode - childNode.kind = Nodes.Containers - childNode.pNode = _pn - childNode.name = _c - return childNode - }) + _pn.childNodes = [...initNodes, ...containerNodes] }) children = children.flatMap((_node) => _node.childNodes ?? []) } diff --git a/src/Shared/types.ts b/src/Shared/types.ts index e96b02019..362d2c9d9 100644 --- a/src/Shared/types.ts +++ b/src/Shared/types.ts @@ -174,6 +174,8 @@ export interface iNode extends Node { type: NodeType status: string pNode?: iNode + /** Marks a node as an init container, used for display purposes in the resource tree. */ + isInitContainer?: boolean } export interface HelmReleaseStatus {