mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add quick namespace filtering to PodDisruptionBudgets view
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
1243dd5e6e
commit
4bb8dedb3c
@ -1,12 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { asLegacyGlobalForExtensionApi } from "../../../extensions/as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
|
||||||
import podDisruptionBudgetStoreInjectable from "./store.injectable";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `di.inject(podDisruptionBudgetStoreInjectable)` instead
|
|
||||||
*/
|
|
||||||
export const podDisruptionBudgetStore = asLegacyGlobalForExtensionApi(podDisruptionBudgetStoreInjectable);
|
|
||||||
@ -20,5 +20,9 @@
|
|||||||
&.age {
|
&.age {
|
||||||
flex: .5;
|
flex: .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.filterNamespace {
|
||||||
|
border-bottom: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,13 +7,18 @@ import "./pod-disruption-budgets.scss";
|
|||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { podDisruptionBudgetStore } from "./legacy-store";
|
|
||||||
import type { PodDisruptionBudget } from "../../../common/k8s-api/endpoints/pod-disruption-budget.api";
|
import type { PodDisruptionBudget } from "../../../common/k8s-api/endpoints/pod-disruption-budget.api";
|
||||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||||
import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout";
|
import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout";
|
||||||
import { KubeObjectAge } from "../kube-object/age";
|
import { KubeObjectAge } from "../kube-object/age";
|
||||||
|
import { prevDefault } from "../../utils";
|
||||||
|
import type { FilterByNamespace } from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||||
|
import type { PodDisruptionBudgetStore } from "./store";
|
||||||
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
|
import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||||
|
import podDisruptionBudgetStoreInjectable from "./store.injectable";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -28,8 +33,13 @@ enum columnId {
|
|||||||
export interface PodDisruptionBudgetsProps extends KubeObjectDetailsProps<PodDisruptionBudget> {
|
export interface PodDisruptionBudgetsProps extends KubeObjectDetailsProps<PodDisruptionBudget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Dependencies {
|
||||||
|
filterByNamespace: FilterByNamespace;
|
||||||
|
podDisruptionBudgetStore: PodDisruptionBudgetStore;
|
||||||
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class PodDisruptionBudgets extends React.Component<PodDisruptionBudgetsProps> {
|
class NonInjectedPodDisruptionBudgets extends React.Component<PodDisruptionBudgetsProps & Dependencies> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<SiblingsInTabLayout>
|
<SiblingsInTabLayout>
|
||||||
@ -37,7 +47,7 @@ export class PodDisruptionBudgets extends React.Component<PodDisruptionBudgetsPr
|
|||||||
isConfigurable
|
isConfigurable
|
||||||
tableId="configuration_distribution_budgets"
|
tableId="configuration_distribution_budgets"
|
||||||
className="PodDisruptionBudgets"
|
className="PodDisruptionBudgets"
|
||||||
store={podDisruptionBudgetStore}
|
store={this.props.podDisruptionBudgetStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[columnId.name]: pdb => pdb.getName(),
|
[columnId.name]: pdb => pdb.getName(),
|
||||||
[columnId.namespace]: pdb => pdb.getNs(),
|
[columnId.namespace]: pdb => pdb.getNs(),
|
||||||
@ -64,7 +74,13 @@ export class PodDisruptionBudgets extends React.Component<PodDisruptionBudgetsPr
|
|||||||
renderTableContents={pdb => [
|
renderTableContents={pdb => [
|
||||||
pdb.getName(),
|
pdb.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={pdb} />,
|
<KubeObjectStatusIcon key="icon" object={pdb} />,
|
||||||
pdb.getNs(),
|
<a
|
||||||
|
key="namespace"
|
||||||
|
className="filterNamespace"
|
||||||
|
onClick={prevDefault(() => this.props.filterByNamespace(pdb.getNs()))}
|
||||||
|
>
|
||||||
|
{pdb.getNs()}
|
||||||
|
</a>,
|
||||||
pdb.getMinAvailable(),
|
pdb.getMinAvailable(),
|
||||||
pdb.getMaxUnavailable(),
|
pdb.getMaxUnavailable(),
|
||||||
pdb.getCurrentHealthy(),
|
pdb.getCurrentHealthy(),
|
||||||
@ -76,3 +92,11 @@ export class PodDisruptionBudgets extends React.Component<PodDisruptionBudgetsPr
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const PodDisruptionBudgets = withInjectables<Dependencies, PodDisruptionBudgetsProps>(NonInjectedPodDisruptionBudgets, {
|
||||||
|
getProps: (di, props) => ({
|
||||||
|
...props,
|
||||||
|
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
||||||
|
podDisruptionBudgetStore: di.inject(podDisruptionBudgetStoreInjectable),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user