mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Finish using NamespaceSelectBadge in all places (#6972)
Signed-off-by: Roman <ixrock@gmail.com> Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
d3b1b0e3b6
commit
a5c62da002
@ -10,15 +10,14 @@ import { observer } from "mobx-react";
|
|||||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||||
import type { HorizontalPodAutoscaler } from "../../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
import type { HorizontalPodAutoscaler } from "../../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { cssNames, prevDefault } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
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 type { HorizontalPodAutoscalerStore } from "./store";
|
import type { HorizontalPodAutoscalerStore } from "./store";
|
||||||
import type { FilterByNamespace } from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
|
||||||
import horizontalPodAutoscalerStoreInjectable from "./store.injectable";
|
import horizontalPodAutoscalerStoreInjectable from "./store.injectable";
|
||||||
|
import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -33,7 +32,6 @@ enum columnId {
|
|||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
horizontalPodAutoscalerStore: HorizontalPodAutoscalerStore;
|
horizontalPodAutoscalerStore: HorizontalPodAutoscalerStore;
|
||||||
filterByNamespace: FilterByNamespace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
@ -90,13 +88,10 @@ class NonInjectedHorizontalPodAutoscalers extends React.Component<Dependencies>
|
|||||||
renderTableContents={hpa => [
|
renderTableContents={hpa => [
|
||||||
hpa.getName(),
|
hpa.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={hpa} />,
|
<KubeObjectStatusIcon key="icon" object={hpa} />,
|
||||||
<a
|
<NamespaceSelectBadge
|
||||||
key="namespace"
|
key="namespace"
|
||||||
className="filterNamespace"
|
namespace={hpa.getNs()}
|
||||||
onClick={prevDefault(() => this.props.filterByNamespace(hpa.getNs()))}
|
/>,
|
||||||
>
|
|
||||||
{hpa.getNs()}
|
|
||||||
</a>,
|
|
||||||
this.getTargets(hpa),
|
this.getTargets(hpa),
|
||||||
hpa.getMinPods(),
|
hpa.getMinPods(),
|
||||||
hpa.getMaxPods(),
|
hpa.getMaxPods(),
|
||||||
@ -124,7 +119,6 @@ class NonInjectedHorizontalPodAutoscalers extends React.Component<Dependencies>
|
|||||||
export const HorizontalPodAutoscalers = withInjectables<Dependencies>(NonInjectedHorizontalPodAutoscalers, {
|
export const HorizontalPodAutoscalers = withInjectables<Dependencies>(NonInjectedHorizontalPodAutoscalers, {
|
||||||
getProps: (di, props) => ({
|
getProps: (di, props) => ({
|
||||||
...props,
|
...props,
|
||||||
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
|
||||||
horizontalPodAutoscalerStore: di.inject(horizontalPodAutoscalerStoreInjectable),
|
horizontalPodAutoscalerStore: di.inject(horizontalPodAutoscalerStoreInjectable),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,12 +11,10 @@ import React from "react";
|
|||||||
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 { LimitRangeStore } from "./store";
|
import type { LimitRangeStore } from "./store";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
|
||||||
import limitRangeStoreInjectable from "./store.injectable";
|
import limitRangeStoreInjectable from "./store.injectable";
|
||||||
|
import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -25,7 +23,6 @@ enum columnId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
filterByNamespace: FilterByNamespace;
|
|
||||||
limitRangeStore: LimitRangeStore;
|
limitRangeStore: LimitRangeStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,13 +55,10 @@ class NonInjectedLimitRanges extends React.Component<Dependencies> {
|
|||||||
renderTableContents={limitRange => [
|
renderTableContents={limitRange => [
|
||||||
limitRange.getName(),
|
limitRange.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={limitRange}/>,
|
<KubeObjectStatusIcon key="icon" object={limitRange}/>,
|
||||||
<a
|
<NamespaceSelectBadge
|
||||||
key="namespace"
|
key="namespace"
|
||||||
className="filterNamespace"
|
namespace={limitRange.getNs()}
|
||||||
onClick={prevDefault(() => this.props.filterByNamespace(limitRange.getNs()))}
|
/>,
|
||||||
>
|
|
||||||
{limitRange.getNs()}
|
|
||||||
</a>,
|
|
||||||
<KubeObjectAge key="age" object={limitRange} />,
|
<KubeObjectAge key="age" object={limitRange} />,
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
@ -76,7 +70,6 @@ class NonInjectedLimitRanges extends React.Component<Dependencies> {
|
|||||||
export const LimitRanges = withInjectables<Dependencies>(NonInjectedLimitRanges, {
|
export const LimitRanges = withInjectables<Dependencies>(NonInjectedLimitRanges, {
|
||||||
getProps: (di, props) => ({
|
getProps: (di, props) => ({
|
||||||
...props,
|
...props,
|
||||||
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
|
||||||
limitRangeStore: di.inject(limitRangeStoreInjectable),
|
limitRangeStore: di.inject(limitRangeStoreInjectable),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,7 +4,4 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
.CrdResources {
|
.CrdResources {
|
||||||
a.filterNamespace {
|
|
||||||
border-bottom: unset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,9 +19,7 @@ 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 { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge";
|
||||||
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",
|
||||||
@ -34,7 +32,6 @@ interface Dependencies {
|
|||||||
name: IComputedValue<string>;
|
name: IComputedValue<string>;
|
||||||
apiManager: ApiManager;
|
apiManager: ApiManager;
|
||||||
customResourceDefinitionStore: CustomResourceDefinitionStore;
|
customResourceDefinitionStore: CustomResourceDefinitionStore;
|
||||||
filterByNamespace: FilterByNamespace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
@ -107,13 +104,7 @@ class NonInjectedCustomResources extends React.Component<Dependencies> {
|
|||||||
renderTableContents={customResource => [
|
renderTableContents={customResource => [
|
||||||
customResource.getName(),
|
customResource.getName(),
|
||||||
isNamespaced && (
|
isNamespaced && (
|
||||||
<a
|
<NamespaceSelectBadge namespace={customResource.getNs() as string} />
|
||||||
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} />,
|
||||||
@ -141,7 +132,6 @@ 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),
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import type { HeaderCustomizer } from "../item-object-list";
|
|||||||
import { Tooltip } from "../tooltip";
|
import { Tooltip } from "../tooltip";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import type { IClassName } from "../../utils";
|
import type { IClassName } from "../../utils";
|
||||||
import { prevDefault, cssNames, stopPropagation } from "../../utils";
|
import { cssNames, stopPropagation } from "../../utils";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import type { ApiManager } from "../../../common/k8s-api/api-manager";
|
import type { ApiManager } from "../../../common/k8s-api/api-manager";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
@ -28,10 +28,9 @@ import { KubeObjectAge } from "../kube-object/age";
|
|||||||
import { ReactiveDuration } from "../duration/reactive-duration";
|
import { ReactiveDuration } from "../duration/reactive-duration";
|
||||||
import apiManagerInjectable from "../../../common/k8s-api/api-manager/manager.injectable";
|
import apiManagerInjectable from "../../../common/k8s-api/api-manager/manager.injectable";
|
||||||
import eventStoreInjectable from "./store.injectable";
|
import eventStoreInjectable from "./store.injectable";
|
||||||
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";
|
|
||||||
import type { GetDetailsUrl } from "../kube-detail-params/get-details-url.injectable";
|
import type { GetDetailsUrl } from "../kube-detail-params/get-details-url.injectable";
|
||||||
import getDetailsUrlInjectable from "../kube-detail-params/get-details-url.injectable";
|
import getDetailsUrlInjectable from "../kube-detail-params/get-details-url.injectable";
|
||||||
|
import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
message = "message",
|
message = "message",
|
||||||
@ -58,7 +57,6 @@ interface Dependencies {
|
|||||||
navigateToEvents: () => void;
|
navigateToEvents: () => void;
|
||||||
eventStore: EventStore;
|
eventStore: EventStore;
|
||||||
apiManager: ApiManager;
|
apiManager: ApiManager;
|
||||||
filterByNamespace: FilterByNamespace;
|
|
||||||
getDetailsUrl: GetDetailsUrl;
|
getDetailsUrl: GetDetailsUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,15 +200,7 @@ class NonInjectedEvents extends React.Component<Dependencies & EventsProps> {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
compact
|
compact
|
||||||
? (
|
? <NamespaceSelectBadge key="namespace" namespace={event.getNs()} />
|
||||||
<a
|
|
||||||
key="namespace"
|
|
||||||
className="filterNamespace"
|
|
||||||
onClick={prevDefault(() => this.props.filterByNamespace(event.getNs()))}
|
|
||||||
>
|
|
||||||
{event.getNs()}
|
|
||||||
</a>
|
|
||||||
)
|
|
||||||
: event.getNs(),
|
: event.getNs(),
|
||||||
<Link
|
<Link
|
||||||
key="link"
|
key="link"
|
||||||
@ -246,7 +236,6 @@ export const Events = withInjectables<Dependencies, EventsProps>(NonInjectedEven
|
|||||||
navigateToEvents: di.inject(navigateToEventsInjectable),
|
navigateToEvents: di.inject(navigateToEventsInjectable),
|
||||||
apiManager: di.inject(apiManagerInjectable),
|
apiManager: di.inject(apiManagerInjectable),
|
||||||
eventStore: di.inject(eventStoreInjectable),
|
eventStore: di.inject(eventStoreInjectable),
|
||||||
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
|
||||||
getDetailsUrl: di.inject(getDetailsUrlInjectable),
|
getDetailsUrl: di.inject(getDetailsUrlInjectable),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { observer } from "mobx-react";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||||
import { unitsToBytes } from "../../../common/utils/convertMemory";
|
import { unitsToBytes } from "../../../common/utils/convertMemory";
|
||||||
import { prevDefault, stopPropagation } from "../../utils";
|
import { stopPropagation } from "../../utils";
|
||||||
import type { StorageClassApi } from "../../../common/k8s-api/endpoints";
|
import type { StorageClassApi } from "../../../common/k8s-api/endpoints";
|
||||||
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";
|
||||||
@ -18,13 +18,12 @@ import { KubeObjectAge } from "../kube-object/age";
|
|||||||
import type { PersistentVolumeClaimStore } from "./store";
|
import type { PersistentVolumeClaimStore } from "./store";
|
||||||
import type { PodStore } from "../+workloads-pods/store";
|
import type { PodStore } from "../+workloads-pods/store";
|
||||||
import type { GetDetailsUrl } from "../kube-detail-params/get-details-url.injectable";
|
import type { GetDetailsUrl } from "../kube-detail-params/get-details-url.injectable";
|
||||||
import type { FilterByNamespace } from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable";
|
|
||||||
import getDetailsUrlInjectable from "../kube-detail-params/get-details-url.injectable";
|
import getDetailsUrlInjectable from "../kube-detail-params/get-details-url.injectable";
|
||||||
import persistentVolumeClaimStoreInjectable from "./store.injectable";
|
import persistentVolumeClaimStoreInjectable from "./store.injectable";
|
||||||
import podStoreInjectable from "../+workloads-pods/store.injectable";
|
import podStoreInjectable from "../+workloads-pods/store.injectable";
|
||||||
import storageClassApiInjectable from "../../../common/k8s-api/endpoints/storage-class.api.injectable";
|
import storageClassApiInjectable from "../../../common/k8s-api/endpoints/storage-class.api.injectable";
|
||||||
|
import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -41,7 +40,6 @@ interface Dependencies {
|
|||||||
storageClassApi: StorageClassApi;
|
storageClassApi: StorageClassApi;
|
||||||
podStore: PodStore;
|
podStore: PodStore;
|
||||||
getDetailsUrl: GetDetailsUrl;
|
getDetailsUrl: GetDetailsUrl;
|
||||||
filterByNamespace: FilterByNamespace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
@ -49,7 +47,6 @@ class NonInjectedPersistentVolumeClaims extends React.Component<Dependencies> {
|
|||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
persistentVolumeClaimStore,
|
persistentVolumeClaimStore,
|
||||||
filterByNamespace,
|
|
||||||
getDetailsUrl,
|
getDetailsUrl,
|
||||||
podStore,
|
podStore,
|
||||||
storageClassApi,
|
storageClassApi,
|
||||||
@ -97,13 +94,10 @@ class NonInjectedPersistentVolumeClaims extends React.Component<Dependencies> {
|
|||||||
return [
|
return [
|
||||||
pvc.getName(),
|
pvc.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={pvc} />,
|
<KubeObjectStatusIcon key="icon" object={pvc} />,
|
||||||
<a
|
<NamespaceSelectBadge
|
||||||
key="namespace"
|
key="namespace"
|
||||||
className="filterNamespace"
|
namespace={pvc.getNs()}
|
||||||
onClick={prevDefault(() => filterByNamespace(pvc.getNs()))}
|
/>,
|
||||||
>
|
|
||||||
{pvc.getNs()}
|
|
||||||
</a>,
|
|
||||||
<Link
|
<Link
|
||||||
key="link"
|
key="link"
|
||||||
to={storageClassDetailsUrl}
|
to={storageClassDetailsUrl}
|
||||||
@ -134,7 +128,6 @@ class NonInjectedPersistentVolumeClaims extends React.Component<Dependencies> {
|
|||||||
export const PersistentVolumeClaims = withInjectables<Dependencies>(NonInjectedPersistentVolumeClaims, {
|
export const PersistentVolumeClaims = withInjectables<Dependencies>(NonInjectedPersistentVolumeClaims, {
|
||||||
getProps: (di, props) => ({
|
getProps: (di, props) => ({
|
||||||
...props,
|
...props,
|
||||||
filterByNamespace: di.inject(filterByNamespaceInjectable),
|
|
||||||
getDetailsUrl: di.inject(getDetailsUrlInjectable),
|
getDetailsUrl: di.inject(getDetailsUrlInjectable),
|
||||||
persistentVolumeClaimStore: di.inject(persistentVolumeClaimStoreInjectable),
|
persistentVolumeClaimStore: di.inject(persistentVolumeClaimStoreInjectable),
|
||||||
podStore: di.inject(podStoreInjectable),
|
podStore: di.inject(podStoreInjectable),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user