mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* 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>
29 lines
1.0 KiB
TypeScript
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;
|