mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add quick namespace filtering to Ingresses view
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
fabde6acc4
commit
c77b66ca9b
@ -31,5 +31,9 @@
|
|||||||
&.warning {
|
&.warning {
|
||||||
@include table-cell-warning;
|
@include table-cell-warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.filterNamespace {
|
||||||
|
border-bottom: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,12 +7,17 @@ import "./ingresses.scss";
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { ingressStore } from "./legacy-store";
|
|
||||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||||
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 { computeRouteDeclarations } from "../../../common/k8s-api/endpoints";
|
import { computeRouteDeclarations } from "../../../common/k8s-api/endpoints";
|
||||||
|
import { prevDefault } from "../../utils";
|
||||||
|
import type { IngressStore } from "./store";
|
||||||
|
import type { FilterByNamespace } from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||||
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
|
import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||||
|
import ingressStoreInjectable from "./store.injectable";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -22,8 +27,13 @@ enum columnId {
|
|||||||
age = "age",
|
age = "age",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Dependencies {
|
||||||
|
ingressStore: IngressStore;
|
||||||
|
filterByNamespace: FilterByNamespace;
|
||||||
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class Ingresses extends React.Component {
|
class NonInjectedIngresses extends React.Component<Dependencies> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<SiblingsInTabLayout>
|
<SiblingsInTabLayout>
|
||||||
@ -31,7 +41,7 @@ export class Ingresses extends React.Component {
|
|||||||
isConfigurable
|
isConfigurable
|
||||||
tableId="network_ingresses"
|
tableId="network_ingresses"
|
||||||
className="Ingresses"
|
className="Ingresses"
|
||||||
store={ingressStore}
|
store={this.props.ingressStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[columnId.name]: ingress => ingress.getName(),
|
[columnId.name]: ingress => ingress.getName(),
|
||||||
[columnId.namespace]: ingress => ingress.getNs(),
|
[columnId.namespace]: ingress => ingress.getNs(),
|
||||||
@ -53,7 +63,13 @@ export class Ingresses extends React.Component {
|
|||||||
renderTableContents={ingress => [
|
renderTableContents={ingress => [
|
||||||
ingress.getName(),
|
ingress.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={ingress} />,
|
<KubeObjectStatusIcon key="icon" object={ingress} />,
|
||||||
ingress.getNs(),
|
<a
|
||||||
|
key="namespace"
|
||||||
|
className="filterNamespace"
|
||||||
|
onClick={prevDefault(() => this.props.filterByNamespace(ingress.getNs()))}
|
||||||
|
>
|
||||||
|
{ingress.getNs()}
|
||||||
|
</a>,
|
||||||
ingress.getLoadBalancers().map(lb => <p key={lb}>{lb}</p>),
|
ingress.getLoadBalancers().map(lb => <p key={lb}>{lb}</p>),
|
||||||
computeRouteDeclarations(ingress).map(decl => (
|
computeRouteDeclarations(ingress).map(decl => (
|
||||||
decl.displayAsLink
|
decl.displayAsLink
|
||||||
@ -90,3 +106,11 @@ export class Ingresses extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const Ingresses = withInjectables<Dependencies>(NonInjectedIngresses, {
|
||||||
|
getProps: (di, props) => ({
|
||||||
|
...props,
|
||||||
|
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
||||||
|
ingressStore: di.inject(ingressStoreInjectable),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|||||||
@ -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 ingressStoreInjectable from "./store.injectable";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `di.inject(ingressStoreInjectable)` instead
|
|
||||||
*/
|
|
||||||
export const ingressStore = asLegacyGlobalForExtensionApi(ingressStoreInjectable);
|
|
||||||
Loading…
Reference in New Issue
Block a user