1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Load all pods regardless selected namespace

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-12-15 11:52:31 +03:00
parent 5dd9a5c6bc
commit 91ccaf2ca9
2 changed files with 16 additions and 314 deletions

View File

@ -544,320 +544,6 @@ exports[`<PodDetailsList /> when few pods passed when metrics max values passed
</div> </div>
`; `;
exports[`<PodDetailsList /> when few pods passed when metrics max values passed sort table by name 1`] = `
<div>
<div
class="PodDetailsList flex column"
>
<div
class="DrawerTitle title"
>
Pods
</div>
<div
class="Table flex column box grow selectable sortable autoSize"
>
<div
class="TableHead sticky"
>
<div
class="TableCell name sorting"
>
Name
<i
class="Icon sortIcon enabled material focusable"
>
<span
class="icon"
data-icon-name="arrow_drop_down"
>
arrow_drop_down
</span>
</i>
</div>
<div
class="TableCell warning"
/>
<div
class="TableCell node sorting"
>
Node
<i
class="Icon sortIcon material focusable"
>
<span
class="icon"
data-icon-name="arrow_drop_down"
>
arrow_drop_down
</span>
</i>
</div>
<div
class="TableCell namespace sorting"
>
Namespace
<i
class="Icon sortIcon material focusable"
>
<span
class="icon"
data-icon-name="arrow_drop_down"
>
arrow_drop_down
</span>
</i>
</div>
<div
class="TableCell ready"
>
Ready
</div>
<div
class="TableCell cpu sorting"
>
CPU
<i
class="Icon sortIcon material focusable"
>
<span
class="icon"
data-icon-name="arrow_drop_down"
>
arrow_drop_down
</span>
</i>
</div>
<div
class="TableCell memory sorting"
>
Memory
<i
class="Icon sortIcon material focusable"
>
<span
class="icon"
data-icon-name="arrow_drop_down"
>
arrow_drop_down
</span>
</i>
</div>
<div
class="TableCell status"
>
Status
</div>
</div>
<div
class="TableRow nowrap"
>
<div
class="TableCell name"
>
foobar-pending
</div>
<div
class="TableCell warning"
/>
<div
class="TableCell node"
/>
<div
class="TableCell namespace"
>
default
</div>
<div
class="TableCell ready"
>
0 / 0
</div>
<div
class="TableCell cpu"
>
<div
class="LineProgress"
>
<div
class="line"
style="width: 50.00%;"
/>
</div>
<div>
<p>
CPU: 50%
<br />
0.500
</p>
</div>
</div>
<div
class="TableCell memory"
>
<div
class="LineProgress"
>
<div
class="line"
style="width: 12.50%;"
/>
</div>
<div>
<p>
Memory: 13%
<br />
256.000B
</p>
</div>
</div>
<div
class="TableCell status waiting"
>
Waiting
</div>
</div>
<div
class="TableRow nowrap"
>
<div
class="TableCell name"
>
foobar-failed
</div>
<div
class="TableCell warning"
/>
<div
class="TableCell node"
/>
<div
class="TableCell namespace"
>
kube-system
</div>
<div
class="TableCell ready"
>
0 / 0
</div>
<div
class="TableCell cpu"
>
<div
class="LineProgress"
>
<div
class="line"
style="width: 40.00%;"
/>
</div>
<div>
<p>
CPU: 40%
<br />
0.400
</p>
</div>
</div>
<div
class="TableCell memory"
>
<div
class="LineProgress"
>
<div
class="line"
style="width: 50.00%;"
/>
</div>
<div>
<p>
Memory: 50%
<br />
1.000KiB
</p>
</div>
</div>
<div
class="TableCell status failed"
>
Failed
</div>
</div>
<div
class="TableRow nowrap"
>
<div
class="TableCell name"
>
foobar
</div>
<div
class="TableCell warning"
/>
<div
class="TableCell node"
/>
<div
class="TableCell namespace"
>
default
</div>
<div
class="TableCell ready"
>
0 / 0
</div>
<div
class="TableCell cpu"
>
<div
class="LineProgress"
>
<div
class="line"
style="width: 20.00%;"
/>
</div>
<div>
<p>
CPU: 20%
<br />
0.200
</p>
</div>
</div>
<div
class="TableCell memory"
>
<div
class="LineProgress"
>
<div
class="line"
style="width: 6.25%;"
/>
</div>
<div>
<p>
Memory: 7%
<br />
128.000B
</p>
</div>
</div>
<div
class="TableCell status running"
>
Running
</div>
</div>
</div>
</div>
</div>
`;
exports[`<PodDetailsList /> when few pods passed when metrics max values passed sorts table by cpu 1`] = ` exports[`<PodDetailsList /> when few pods passed when metrics max values passed sorts table by cpu 1`] = `
<div> <div>
<div <div

View File

@ -21,6 +21,10 @@ import { Spinner } from "../spinner";
import { Table, TableCell, TableHead, TableRow } from "../table"; import { Table, TableCell, TableHead, TableRow } from "../table";
import type { PodStore } from "./store"; import type { PodStore } from "./store";
import podStoreInjectable from "./store.injectable"; import podStoreInjectable from "./store.injectable";
import namespaceStoreInjectable from "../+namespaces/store.injectable";
import type { NamespaceStore } from "../+namespaces/store";
import showErrorNotificationInjectable from "../notifications/show-error-notification.injectable";
import type { ShowNotification } from "../notifications/notifications";
enum sortBy { enum sortBy {
name = "name", name = "name",
@ -39,6 +43,8 @@ export interface PodDetailsListProps {
interface Dependencies { interface Dependencies {
getDetailsUrl: GetDetailsUrl; getDetailsUrl: GetDetailsUrl;
podStore: PodStore; podStore: PodStore;
namespaceStore: NamespaceStore;
showErrorNotification: ShowNotification;
} }
@observer @observer
@ -52,6 +58,14 @@ export class NonInjectedPodDetailsList extends React.Component<PodDetailsListPro
disposeOnUnmount(this, [ disposeOnUnmount(this, [
reaction(() => this.props.pods[0]?.getNs(), () => this.metricsWatcher.restart(true)), reaction(() => this.props.pods[0]?.getNs(), () => this.metricsWatcher.restart(true)),
]); ]);
this.props.podStore.loadAll({
namespaces: [
...this.props.namespaceStore.getItems().map(ns => ns.getName())
],
onLoadFailure: error =>
this.props.showErrorNotification(`Can not load Pods. ${String(error)}`)
});
} }
componentWillUnmount() { componentWillUnmount() {
@ -208,5 +222,7 @@ export const PodDetailsList = withInjectables<Dependencies, PodDetailsListProps>
...props, ...props,
getDetailsUrl: di.inject(getDetailsUrlInjectable), getDetailsUrl: di.inject(getDetailsUrlInjectable),
podStore: di.inject(podStoreInjectable), podStore: di.inject(podStoreInjectable),
namespaceStore: di.inject(namespaceStoreInjectable),
showErrorNotification: di.inject(showErrorNotificationInjectable)
}), }),
}); });