From a5c62da002f2418e075f881a7ca901c9fa190434 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 18 Jan 2023 21:36:48 +0200 Subject: [PATCH] Finish using NamespaceSelectBadge in all places (#6972) Signed-off-by: Roman Signed-off-by: Roman --- .../components/+config-autoscalers/hpa.tsx | 16 +++++----------- .../+config-limit-ranges/limit-ranges.tsx | 15 ++++----------- .../+custom-resources/crd-resources.scss | 3 --- .../+custom-resources/crd-resources.tsx | 14 ++------------ src/renderer/components/+events/events.tsx | 17 +++-------------- .../+storage-volume-claims/volume-claims.tsx | 17 +++++------------ 6 files changed, 19 insertions(+), 63 deletions(-) diff --git a/src/renderer/components/+config-autoscalers/hpa.tsx b/src/renderer/components/+config-autoscalers/hpa.tsx index 8900d7b73d..efdc7fd48d 100644 --- a/src/renderer/components/+config-autoscalers/hpa.tsx +++ b/src/renderer/components/+config-autoscalers/hpa.tsx @@ -10,15 +10,14 @@ import { observer } from "mobx-react"; import { KubeObjectListLayout } from "../kube-object-list-layout"; import type { HorizontalPodAutoscaler } from "../../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api"; import { Badge } from "../badge"; -import { cssNames, prevDefault } from "../../utils"; +import { cssNames } from "../../utils"; import { KubeObjectStatusIcon } from "../kube-object-status-icon"; import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout"; import { KubeObjectAge } from "../kube-object/age"; 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 filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable"; import horizontalPodAutoscalerStoreInjectable from "./store.injectable"; +import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge"; enum columnId { name = "name", @@ -33,7 +32,6 @@ enum columnId { interface Dependencies { horizontalPodAutoscalerStore: HorizontalPodAutoscalerStore; - filterByNamespace: FilterByNamespace; } @observer @@ -90,13 +88,10 @@ class NonInjectedHorizontalPodAutoscalers extends React.Component renderTableContents={hpa => [ hpa.getName(), , - this.props.filterByNamespace(hpa.getNs()))} - > - {hpa.getNs()} - , + namespace={hpa.getNs()} + />, this.getTargets(hpa), hpa.getMinPods(), hpa.getMaxPods(), @@ -124,7 +119,6 @@ class NonInjectedHorizontalPodAutoscalers extends React.Component export const HorizontalPodAutoscalers = withInjectables(NonInjectedHorizontalPodAutoscalers, { getProps: (di, props) => ({ ...props, - filterByNamespace: di.inject(filterByNamespaceInjectable), horizontalPodAutoscalerStore: di.inject(horizontalPodAutoscalerStoreInjectable), }), }); diff --git a/src/renderer/components/+config-limit-ranges/limit-ranges.tsx b/src/renderer/components/+config-limit-ranges/limit-ranges.tsx index ed189ed184..b89c7478f9 100644 --- a/src/renderer/components/+config-limit-ranges/limit-ranges.tsx +++ b/src/renderer/components/+config-limit-ranges/limit-ranges.tsx @@ -11,12 +11,10 @@ import React from "react"; import { KubeObjectStatusIcon } from "../kube-object-status-icon"; import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout"; 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 { withInjectables } from "@ogre-tools/injectable-react"; -import filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable"; import limitRangeStoreInjectable from "./store.injectable"; +import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge"; enum columnId { name = "name", @@ -25,7 +23,6 @@ enum columnId { } interface Dependencies { - filterByNamespace: FilterByNamespace; limitRangeStore: LimitRangeStore; } @@ -58,13 +55,10 @@ class NonInjectedLimitRanges extends React.Component { renderTableContents={limitRange => [ limitRange.getName(), , - this.props.filterByNamespace(limitRange.getNs()))} - > - {limitRange.getNs()} - , + namespace={limitRange.getNs()} + />, , ]} /> @@ -76,7 +70,6 @@ class NonInjectedLimitRanges extends React.Component { export const LimitRanges = withInjectables(NonInjectedLimitRanges, { getProps: (di, props) => ({ ...props, - filterByNamespace: di.inject(filterByNamespaceInjectable), limitRangeStore: di.inject(limitRangeStoreInjectable), }), }); diff --git a/src/renderer/components/+custom-resources/crd-resources.scss b/src/renderer/components/+custom-resources/crd-resources.scss index 3b217a77bf..0d0ee419d8 100644 --- a/src/renderer/components/+custom-resources/crd-resources.scss +++ b/src/renderer/components/+custom-resources/crd-resources.scss @@ -4,7 +4,4 @@ */ .CrdResources { - a.filterNamespace { - border-bottom: unset; - } } diff --git a/src/renderer/components/+custom-resources/crd-resources.tsx b/src/renderer/components/+custom-resources/crd-resources.tsx index 51ecd656ae..3cd0864c36 100644 --- a/src/renderer/components/+custom-resources/crd-resources.tsx +++ b/src/renderer/components/+custom-resources/crd-resources.tsx @@ -19,9 +19,7 @@ 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"; +import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge"; enum columnId { name = "name", @@ -34,7 +32,6 @@ interface Dependencies { name: IComputedValue; apiManager: ApiManager; customResourceDefinitionStore: CustomResourceDefinitionStore; - filterByNamespace: FilterByNamespace; } @observer @@ -107,13 +104,7 @@ class NonInjectedCustomResources extends React.Component { renderTableContents={customResource => [ customResource.getName(), isNamespaced && ( - this.props.filterByNamespace(customResource.getNs() as string))} - > - {customResource.getNs()} - + ), ...extraColumns.map((column) => safeJSONPathValue(customResource, column.jsonPath)), , @@ -141,7 +132,6 @@ export const CustomResources = withInjectables(NonInjectedCustomRe ...di.inject(customResourcesRouteParametersInjectable), apiManager: di.inject(apiManagerInjectable), customResourceDefinitionStore: di.inject(customResourceDefinitionStoreInjectable), - filterByNamespace: di.inject(filterByNamespaceInjectable), }), }); diff --git a/src/renderer/components/+events/events.tsx b/src/renderer/components/+events/events.tsx index e1b9e57bb8..d68bb21a53 100644 --- a/src/renderer/components/+events/events.tsx +++ b/src/renderer/components/+events/events.tsx @@ -19,7 +19,7 @@ import type { HeaderCustomizer } from "../item-object-list"; import { Tooltip } from "../tooltip"; import { Link } from "react-router-dom"; import type { IClassName } from "../../utils"; -import { prevDefault, cssNames, stopPropagation } from "../../utils"; +import { cssNames, stopPropagation } from "../../utils"; import { Icon } from "../icon"; import type { ApiManager } from "../../../common/k8s-api/api-manager"; import { withInjectables } from "@ogre-tools/injectable-react"; @@ -28,10 +28,9 @@ import { KubeObjectAge } from "../kube-object/age"; import { ReactiveDuration } from "../duration/reactive-duration"; import apiManagerInjectable from "../../../common/k8s-api/api-manager/manager.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 getDetailsUrlInjectable from "../kube-detail-params/get-details-url.injectable"; +import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge"; enum columnId { message = "message", @@ -58,7 +57,6 @@ interface Dependencies { navigateToEvents: () => void; eventStore: EventStore; apiManager: ApiManager; - filterByNamespace: FilterByNamespace; getDetailsUrl: GetDetailsUrl; } @@ -202,15 +200,7 @@ class NonInjectedEvents extends React.Component { ), }, compact - ? ( - this.props.filterByNamespace(event.getNs()))} - > - {event.getNs()} - - ) + ? : event.getNs(), (NonInjectedEven navigateToEvents: di.inject(navigateToEventsInjectable), apiManager: di.inject(apiManagerInjectable), eventStore: di.inject(eventStoreInjectable), - filterByNamespace: di.inject(filterByNamespaceInjectable), getDetailsUrl: di.inject(getDetailsUrlInjectable), }), }); diff --git a/src/renderer/components/+storage-volume-claims/volume-claims.tsx b/src/renderer/components/+storage-volume-claims/volume-claims.tsx index 31ebee4bc4..39ec81f8de 100644 --- a/src/renderer/components/+storage-volume-claims/volume-claims.tsx +++ b/src/renderer/components/+storage-volume-claims/volume-claims.tsx @@ -10,7 +10,7 @@ import { observer } from "mobx-react"; import { Link } from "react-router-dom"; import { KubeObjectListLayout } from "../kube-object-list-layout"; import { unitsToBytes } from "../../../common/utils/convertMemory"; -import { prevDefault, stopPropagation } from "../../utils"; +import { stopPropagation } from "../../utils"; import type { StorageClassApi } from "../../../common/k8s-api/endpoints"; import { KubeObjectStatusIcon } from "../kube-object-status-icon"; 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 { PodStore } from "../+workloads-pods/store"; 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 filterByNamespaceInjectable from "../+namespaces/namespace-select-filter-model/filter-by-namespace.injectable"; import getDetailsUrlInjectable from "../kube-detail-params/get-details-url.injectable"; import persistentVolumeClaimStoreInjectable from "./store.injectable"; import podStoreInjectable from "../+workloads-pods/store.injectable"; import storageClassApiInjectable from "../../../common/k8s-api/endpoints/storage-class.api.injectable"; +import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge"; enum columnId { name = "name", @@ -41,7 +40,6 @@ interface Dependencies { storageClassApi: StorageClassApi; podStore: PodStore; getDetailsUrl: GetDetailsUrl; - filterByNamespace: FilterByNamespace; } @observer @@ -49,7 +47,6 @@ class NonInjectedPersistentVolumeClaims extends React.Component { render() { const { persistentVolumeClaimStore, - filterByNamespace, getDetailsUrl, podStore, storageClassApi, @@ -97,13 +94,10 @@ class NonInjectedPersistentVolumeClaims extends React.Component { return [ pvc.getName(), , - filterByNamespace(pvc.getNs()))} - > - {pvc.getNs()} - , + namespace={pvc.getNs()} + />, { export const PersistentVolumeClaims = withInjectables(NonInjectedPersistentVolumeClaims, { getProps: (di, props) => ({ ...props, - filterByNamespace: di.inject(filterByNamespaceInjectable), getDetailsUrl: di.inject(getDetailsUrlInjectable), persistentVolumeClaimStore: di.inject(persistentVolumeClaimStoreInjectable), podStore: di.inject(podStoreInjectable),