import { Deployment , KubernetesObjectKinds } from '../../kubernetes/kubernetesTypes' ; import { TreeNode , TreeNodeIcon } from './treeNode' ; /**
 * Defines deployment tree view item for display in GitOps Clusters tree view.
 */ export class ClusterDeploymentNode extends TreeNode { /**
     * Cluster deployment kubernetes resource object
     */ resource : Deployment ; constructor ( deployment ) { super ( deployment . metadata . name || '' ) ; this . resource = deployment ; this . label = this . getImageName ( deployment ) ; this . setIcon ( TreeNodeIcon . Unknown ) ; } param deployment returns getImageName ( deployment ) { const fluxControllerContainer = deployment . spec . template . spec ?. containers ?. find ( container => container || '' ) ; return fluxControllerContainer ?. image || '' ; } param status setStatus ( status ) { if ( status === 'success' ) { this . setIcon ( TreeNodeIcon . Success ) ; } else if ( status === 'failure' ) { this . setIcon ( TreeNodeIcon . Warning ) ; } } get contexts ( ) { return [ KubernetesObjectKinds . Deployment ] ; } }