mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add quick namespace filtering to ResourceQuotas view
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
4bb8dedb3c
commit
dc27078bf9
@ -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 resourceQuotaStoreInjectable from "./store.injectable";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `di.inject(resourceQuotaStoreInjectable)` instead
|
|
||||||
*/
|
|
||||||
export const resourceQuotaStore = asLegacyGlobalForExtensionApi(resourceQuotaStoreInjectable);
|
|
||||||
@ -8,5 +8,9 @@
|
|||||||
&.warning {
|
&.warning {
|
||||||
@include table-cell-warning;
|
@include table-cell-warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.filterNamespace {
|
||||||
|
border-bottom: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,10 +9,15 @@ import React from "react";
|
|||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||||
import { AddQuotaDialog } from "./add-quota-dialog";
|
import { AddQuotaDialog } from "./add-quota-dialog";
|
||||||
import { resourceQuotaStore } 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 { ResourceQuotaStore } 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 resourceQuotaStoreInjectable from "./store.injectable";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -20,8 +25,13 @@ enum columnId {
|
|||||||
age = "age",
|
age = "age",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Dependencies {
|
||||||
|
resourceQuotaStore: ResourceQuotaStore;
|
||||||
|
filterByNamespace: FilterByNamespace;
|
||||||
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class ResourceQuotas extends React.Component {
|
class NonInjectedResourceQuotas extends React.Component<Dependencies> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<SiblingsInTabLayout>
|
<SiblingsInTabLayout>
|
||||||
@ -29,7 +39,7 @@ export class ResourceQuotas extends React.Component {
|
|||||||
isConfigurable
|
isConfigurable
|
||||||
tableId="configuration_quotas"
|
tableId="configuration_quotas"
|
||||||
className="ResourceQuotas"
|
className="ResourceQuotas"
|
||||||
store={resourceQuotaStore}
|
store={this.props.resourceQuotaStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[columnId.name]: resourceQuota => resourceQuota.getName(),
|
[columnId.name]: resourceQuota => resourceQuota.getName(),
|
||||||
[columnId.namespace]: resourceQuota => resourceQuota.getNs(),
|
[columnId.namespace]: resourceQuota => resourceQuota.getNs(),
|
||||||
@ -49,7 +59,13 @@ export class ResourceQuotas extends React.Component {
|
|||||||
renderTableContents={resourceQuota => [
|
renderTableContents={resourceQuota => [
|
||||||
resourceQuota.getName(),
|
resourceQuota.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={resourceQuota}/>,
|
<KubeObjectStatusIcon key="icon" object={resourceQuota}/>,
|
||||||
resourceQuota.getNs(),
|
<a
|
||||||
|
key="namespace"
|
||||||
|
className="filterNamespace"
|
||||||
|
onClick={prevDefault(() => this.props.filterByNamespace(resourceQuota.getNs()))}
|
||||||
|
>
|
||||||
|
{resourceQuota.getNs()}
|
||||||
|
</a>,
|
||||||
<KubeObjectAge key="age" object={resourceQuota} />,
|
<KubeObjectAge key="age" object={resourceQuota} />,
|
||||||
]}
|
]}
|
||||||
addRemoveButtons={{
|
addRemoveButtons={{
|
||||||
@ -62,3 +78,11 @@ export class ResourceQuotas extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const ResourceQuotas = withInjectables<Dependencies>(NonInjectedResourceQuotas, {
|
||||||
|
getProps: (di, props) => ({
|
||||||
|
...props,
|
||||||
|
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
||||||
|
resourceQuotaStore: di.inject(resourceQuotaStoreInjectable),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user