1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+workloads-pods/load-pods-from-all-namespaces.injectable.ts
Alex Andreev 4377cd8102 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>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-12-21 07:50:58 -05:00

29 lines
1.0 KiB
TypeScript

/**
* 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;