mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add quick namespace filtering to Secrets view
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
dc27078bf9
commit
4ff4b5e7af
@ -16,5 +16,9 @@
|
|||||||
&.labels {
|
&.labels {
|
||||||
@include table-cell-labels-offsets;
|
@include table-cell-labels-offsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.filterNamespace {
|
||||||
|
border-bottom: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,10 +10,15 @@ import { observer } from "mobx-react";
|
|||||||
import { AddSecretDialog } from "./add-secret-dialog";
|
import { AddSecretDialog } from "./add-secret-dialog";
|
||||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { secretStore } from "./legacy-store";
|
|
||||||
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 { prevDefault } from "../../utils";
|
||||||
|
import type { FilterByNamespace } from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||||
|
import type { SecretStore } from "./store";
|
||||||
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
|
import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||||
|
import secretStoreInjectable from "./store.injectable";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -24,8 +29,13 @@ enum columnId {
|
|||||||
age = "age",
|
age = "age",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Dependencies {
|
||||||
|
filterByNamespace: FilterByNamespace;
|
||||||
|
secretStore: SecretStore;
|
||||||
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class Secrets extends React.Component {
|
class NonInjectedSecrets extends React.Component<Dependencies> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<SiblingsInTabLayout>
|
<SiblingsInTabLayout>
|
||||||
@ -33,7 +43,7 @@ export class Secrets extends React.Component {
|
|||||||
isConfigurable
|
isConfigurable
|
||||||
tableId="configuration_secrets"
|
tableId="configuration_secrets"
|
||||||
className="Secrets"
|
className="Secrets"
|
||||||
store={secretStore}
|
store={this.props.secretStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[columnId.name]: secret => secret.getName(),
|
[columnId.name]: secret => secret.getName(),
|
||||||
[columnId.namespace]: secret => secret.getNs(),
|
[columnId.namespace]: secret => secret.getNs(),
|
||||||
@ -59,7 +69,13 @@ export class Secrets extends React.Component {
|
|||||||
renderTableContents={secret => [
|
renderTableContents={secret => [
|
||||||
secret.getName(),
|
secret.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={secret} />,
|
<KubeObjectStatusIcon key="icon" object={secret} />,
|
||||||
secret.getNs(),
|
<a
|
||||||
|
key="namespace"
|
||||||
|
className="filterNamespace"
|
||||||
|
onClick={prevDefault(() => this.props.filterByNamespace(secret.getNs()))}
|
||||||
|
>
|
||||||
|
{secret.getNs()}
|
||||||
|
</a>,
|
||||||
secret.getLabels().map(label => (
|
secret.getLabels().map(label => (
|
||||||
<Badge
|
<Badge
|
||||||
scrollable
|
scrollable
|
||||||
@ -82,3 +98,11 @@ export class Secrets extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const Secrets = withInjectables<Dependencies>(NonInjectedSecrets, {
|
||||||
|
getProps: (di, props) => ({
|
||||||
|
...props,
|
||||||
|
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
||||||
|
secretStore: di.inject(secretStoreInjectable),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user