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 {
|
.CrdResources {
|
||||||
|
a.filterNamespace {
|
||||||
|
border-bottom: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,9 @@ import { KubeObjectAge } from "../kube-object/age";
|
|||||||
import type { CustomResourceDefinitionStore } from "./definition.store";
|
import type { CustomResourceDefinitionStore } from "./definition.store";
|
||||||
import apiManagerInjectable from "../../../common/k8s-api/api-manager/manager.injectable";
|
import apiManagerInjectable from "../../../common/k8s-api/api-manager/manager.injectable";
|
||||||
import customResourceDefinitionStoreInjectable from "./definition.store.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 {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -31,6 +34,7 @@ interface Dependencies {
|
|||||||
name: IComputedValue<string>;
|
name: IComputedValue<string>;
|
||||||
apiManager: ApiManager;
|
apiManager: ApiManager;
|
||||||
customResourceDefinitionStore: CustomResourceDefinitionStore;
|
customResourceDefinitionStore: CustomResourceDefinitionStore;
|
||||||
|
filterByNamespace: FilterByNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
@ -102,7 +106,15 @@ class NonInjectedCustomResources extends React.Component<Dependencies> {
|
|||||||
]}
|
]}
|
||||||
renderTableContents={customResource => [
|
renderTableContents={customResource => [
|
||||||
customResource.getName(),
|
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)),
|
...extraColumns.map((column) => safeJSONPathValue(customResource, column.jsonPath)),
|
||||||
<KubeObjectAge key="age" object={customResource} />,
|
<KubeObjectAge key="age" object={customResource} />,
|
||||||
]}
|
]}
|
||||||
@ -129,6 +141,7 @@ export const CustomResources = withInjectables<Dependencies>(NonInjectedCustomRe
|
|||||||
...di.inject(customResourcesRouteParametersInjectable),
|
...di.inject(customResourcesRouteParametersInjectable),
|
||||||
apiManager: di.inject(apiManagerInjectable),
|
apiManager: di.inject(apiManagerInjectable),
|
||||||
customResourceDefinitionStore: di.inject(customResourceDefinitionStoreInjectable),
|
customResourceDefinitionStore: di.inject(customResourceDefinitionStoreInjectable),
|
||||||
|
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user