mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix: load pods from all namespaces in node details (#6794)
* Load pods from all namespaces in Node details Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Lint fixes Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
ed26e245e6
commit
5dde02733b
@ -23,6 +23,7 @@ import subscribeStoresInjectable from "../../kube-watch-api/subscribe-stores.inj
|
||||
import type { PodStore } from "../+workloads-pods/store";
|
||||
import podStoreInjectable from "../+workloads-pods/store.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import loadPodsFromAllNamespacesInjectable from "../+workloads-pods/load-pods-from-all-namespaces.injectable";
|
||||
|
||||
export interface NodeDetailsProps extends KubeObjectDetailsProps<Node> {
|
||||
}
|
||||
@ -31,6 +32,7 @@ interface Dependencies {
|
||||
subscribeStores: SubscribeStores;
|
||||
podStore: PodStore;
|
||||
logger: Logger;
|
||||
loadPodsFromAllNamespaces: () => void;
|
||||
}
|
||||
|
||||
@observer
|
||||
@ -41,6 +43,8 @@ class NonInjectedNodeDetails extends React.Component<NodeDetailsProps & Dependen
|
||||
this.props.podStore,
|
||||
]),
|
||||
]);
|
||||
|
||||
this.props.loadPodsFromAllNamespaces();
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -154,6 +158,7 @@ export const NodeDetails = withInjectables<Dependencies, NodeDetailsProps>(NonIn
|
||||
subscribeStores: di.inject(subscribeStoresInjectable),
|
||||
podStore: di.inject(podStoreInjectable),
|
||||
logger: di.inject(loggerInjectable),
|
||||
loadPodsFromAllNamespaces: di.inject(loadPodsFromAllNamespacesInjectable),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import namespaceStoreInjectable from "../+namespaces/store.injectable";
|
||||
import showErrorNotificationInjectable from "../notifications/show-error-notification.injectable";
|
||||
import podStoreInjectable from "./store.injectable";
|
||||
|
||||
const loadPodsFromAllNamespacesInjectable = getInjectable({
|
||||
id: "load-pods-from-all-namespaces",
|
||||
instantiate: (di) => {
|
||||
const podStore = di.inject(podStoreInjectable);
|
||||
const namespaceStore = di.inject(namespaceStoreInjectable);
|
||||
const showErrorNotification = di.inject(showErrorNotificationInjectable);
|
||||
|
||||
return () => {
|
||||
podStore.loadAll({
|
||||
namespaces: [...namespaceStore.getItems().map(ns => ns.getName())],
|
||||
onLoadFailure: error =>
|
||||
showErrorNotification(`Can not load Pods. ${String(error)}`),
|
||||
});
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default loadPodsFromAllNamespacesInjectable;
|
||||
Loading…
Reference in New Issue
Block a user