mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add quick namespace filtering to Endpoints view
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
0659cf8e65
commit
665e3a5443
@ -12,5 +12,9 @@
|
||||
&.warning {
|
||||
@include table-cell-warning;
|
||||
}
|
||||
|
||||
a.filterNamespace {
|
||||
border-bottom: unset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,11 +7,16 @@ import "./endpoints.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { endpointsStore } from "./legacy-store";
|
||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||
import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout";
|
||||
import { KubeObjectAge } from "../kube-object/age";
|
||||
import { prevDefault } from "../../utils";
|
||||
import type { EndpointsStore } from "./store";
|
||||
import type { FilterByNamespace } from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import endpointsStoreInjectable from "./store.injectable";
|
||||
import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||
|
||||
enum columnId {
|
||||
name = "name",
|
||||
@ -20,8 +25,13 @@ enum columnId {
|
||||
age = "age",
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
endpointsStore: EndpointsStore;
|
||||
filterByNamespace: FilterByNamespace;
|
||||
}
|
||||
|
||||
@observer
|
||||
export class Endpoints extends React.Component {
|
||||
class NonInjectedEndpoints extends React.Component<Dependencies> {
|
||||
render() {
|
||||
return (
|
||||
<SiblingsInTabLayout>
|
||||
@ -29,7 +39,7 @@ export class Endpoints extends React.Component {
|
||||
isConfigurable
|
||||
tableId="network_endpoints"
|
||||
className="Endpoints"
|
||||
store={endpointsStore}
|
||||
store={this.props.endpointsStore}
|
||||
sortingCallbacks={{
|
||||
[columnId.name]: endpoint => endpoint.getName(),
|
||||
[columnId.namespace]: endpoint => endpoint.getNs(),
|
||||
@ -49,7 +59,13 @@ export class Endpoints extends React.Component {
|
||||
renderTableContents={endpoint => [
|
||||
endpoint.getName(),
|
||||
<KubeObjectStatusIcon key="icon" object={endpoint} />,
|
||||
endpoint.getNs(),
|
||||
<a
|
||||
key="namespace"
|
||||
className="filterNamespace"
|
||||
onClick={prevDefault(() => this.props.filterByNamespace(endpoint.getNs()))}
|
||||
>
|
||||
{endpoint.getNs()}
|
||||
</a>,
|
||||
endpoint.toString(),
|
||||
<KubeObjectAge key="age" object={endpoint} />,
|
||||
]}
|
||||
@ -65,3 +81,11 @@ export class Endpoints extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const Endpoints = withInjectables<Dependencies>(NonInjectedEndpoints, {
|
||||
getProps: (di, props) => ({
|
||||
...props,
|
||||
endpointsStore: di.inject(endpointsStoreInjectable),
|
||||
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
||||
}),
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user