import { Kubectl } from "../../../kubectl" ; import * as kubectlUtils from '../../../kubectlUtils' ; import * as kuberesources from '../../../kuberesources' ; import { ResourceNode } from "../node.resource" ; import { ClusterExplorerNode } from "../node" ; export const selectedPodsChildSource = { async children ( kubectl , parent ) { const labelSelector = parent . extraInfo ! . labelSelector ; if ( ! labelSelector ) { return [ ] ; } const pods = await kubectlUtils . getPods ( kubectl , labelSelector ) ; return pods . map ( ( p ) => ResourceNode . create ( kuberesources . allKinds . pod , p . name , p . metadata , { podInfo : p } ) ) ; } } ; export const hasSelectorLister = { async list ( kubectl , kind ) { const objects = await kubectlUtils . getResourceWithSelector ( kind . abbreviation , kubectl ) ; return objects . map ( ( obj ) => ResourceNode . create ( kind , obj . name , obj . metadata , { labelSelector : obj . selector } ) ) ; } } ;