mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add quick namespace filtering to CustomResources view
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
1d431666f3
commit
eb94e17177
@ -4,5 +4,7 @@
|
||||
*/
|
||||
|
||||
.CrdResources {
|
||||
|
||||
a.filterNamespace {
|
||||
border-bottom: unset;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,9 @@ import { KubeObjectAge } from "../kube-object/age";
|
||||
import type { CustomResourceDefinitionStore } from "./definition.store";
|
||||
import apiManagerInjectable from "../../../common/k8s-api/api-manager/manager.injectable";
|
||||
import customResourceDefinitionStoreInjectable from "./definition.store.injectable";
|
||||
import { prevDefault } from "../../utils";
|
||||
import type { FilterByNamespace } from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||
import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
||||
|
||||
enum columnId {
|
||||
name = "name",
|
||||
@ -31,6 +34,7 @@ interface Dependencies {
|
||||
name: IComputedValue<string>;
|
||||
apiManager: ApiManager;
|
||||
customResourceDefinitionStore: CustomResourceDefinitionStore;
|
||||
filterByNamespace: FilterByNamespace;
|
||||
}
|
||||
|
||||
@observer
|
||||
@ -102,7 +106,15 @@ class NonInjectedCustomResources extends React.Component<Dependencies> {
|
||||
]}
|
||||
renderTableContents={customResource => [
|
||||
customResource.getName(),
|
||||
isNamespaced && customResource.getNs(),
|
||||
isNamespaced && (
|
||||
<a
|
||||
key="namespace"
|
||||
className="filterNamespace"
|
||||
onClick={prevDefault(() => this.props.filterByNamespace(customResource.getNs() as string))}
|
||||
>
|
||||
{customResource.getNs()}
|
||||
</a>
|
||||
),
|
||||
...extraColumns.map((column) => safeJSONPathValue(customResource, column.jsonPath)),
|
||||
<KubeObjectAge key="age" object={customResource} />,
|
||||
]}
|
||||
@ -129,6 +141,7 @@ export const CustomResources = withInjectables<Dependencies>(NonInjectedCustomRe
|
||||
...di.inject(customResourcesRouteParametersInjectable),
|
||||
apiManager: di.inject(apiManagerInjectable),
|
||||
customResourceDefinitionStore: di.inject(customResourceDefinitionStoreInjectable),
|
||||
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user