diff --git a/packages/core/src/common/k8s-api/endpoints/replication-controller.api.ts b/packages/core/src/common/k8s-api/endpoints/replication-controller.api.ts index e8fb734f03..b0e733815d 100644 --- a/packages/core/src/common/k8s-api/endpoints/replication-controller.api.ts +++ b/packages/core/src/common/k8s-api/endpoints/replication-controller.api.ts @@ -8,7 +8,7 @@ import { KubeApi } from "../kube-api"; import type { BaseKubeObjectCondition, KubeObjectStatus, - NamespaceScopedMetadata + NamespaceScopedMetadata, } from "../kube-object"; import { KubeObject } from "../kube-object"; import type { PodTemplateSpec } from "./types"; @@ -63,7 +63,7 @@ export interface ReplicationControllerSpec { * Template is the object that describes the pod that will be created if insufficient replicas are detected. This takes precedence over a TemplateRef. * More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template */ - template?: PodTemplateSpec; + template: PodTemplateSpec; } export interface ReplicationControllerStatus extends KubeObjectStatus { @@ -103,8 +103,8 @@ export class ReplicationController extends KubeObject< return this.spec?.minReadySeconds ?? 0; } - getDesiredReplicas(): number | undefined { - return this.spec?.replicas; + getGeneration() { + return this.status?.observedGeneration; } getSelectorLabels(): string[] { @@ -115,6 +115,10 @@ export class ReplicationController extends KubeObject< return this.status?.replicas; } + getDesiredReplicas(): number | undefined { + return this.spec?.replicas; + } + getAvailableReplicas(): number | undefined { return this.status?.availableReplicas; } diff --git a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replication-controllers-route-component.injectable.ts b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replication-controllers-route-component.injectable.ts index a1a0e86105..9049b69076 100644 --- a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replication-controllers-route-component.injectable.ts +++ b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replication-controllers-route-component.injectable.ts @@ -5,7 +5,7 @@ import { getInjectable } from "@ogre-tools/injectable"; import { ReplicationControllers } from "./replicationcontrollers"; import { - routeSpecificComponentInjectionToken + routeSpecificComponentInjectionToken, } from "../../routes/route-specific-component-injection-token"; import replicationControllersRouteInjectable from "../../../common/front-end-routing/routes/cluster/workloads/replicationcontrollers/replicationcontrollers-route.injectable"; diff --git a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-details.tsx b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-details.tsx index 2da9bd6a19..0202cf6438 100644 --- a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-details.tsx +++ b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-details.tsx @@ -7,11 +7,11 @@ import styles from "./replicationcontroller-details.module.scss"; import React from "react"; import { observer } from "mobx-react"; import { withInjectables } from "@ogre-tools/injectable-react"; -import { DrawerItem } from "../drawer"; +import { DrawerItem, DrawerTitle } from "../drawer"; import { Badge } from "../badge"; import type { KubeObjectDetailsProps } from "../kube-object-details"; -import type { ReplicationControllerStore } from "./replicationctrl-store"; -import replicationControllerStoreInjectable from "./replicationctrl-store.injectable"; +import type { ReplicationControllerStore } from "./replicationcontroller-store"; +import replicationControllerStoreInjectable from "./replicationcontroller-store.injectable"; import type { ReplicationController } from "../../../common/k8s-api/endpoints"; export interface ReplicationControllerDetailsProps extends KubeObjectDetailsProps { @@ -24,13 +24,39 @@ interface Dependencies { @observer class NonInjectedReplicationControllerDetails extends React.Component { render() { - const { object: ctrl, store } = this.props; + const { object: resource } = this.props; return (
- -

Controller: {ctrl.getName()}

-

Items in store:

+ + Spec + + + {resource.getDesiredReplicas()} + + + { + resource.getSelectorLabels().map(label => ()) + } + + + + Status + + + {resource.getReplicas()} + + + {resource.getAvailableReplicas()} + + + {resource.getLabeledReplicas()} + + + {resource.getGeneration()} + + + {`${resource.getMinReadySeconds()} seconds`}
); diff --git a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationctrl-sidebar-items.injectable.tsx b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-sidebar-items.injectable.tsx similarity index 100% rename from packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationctrl-sidebar-items.injectable.tsx rename to packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-sidebar-items.injectable.tsx diff --git a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationctrl-store.injectable.ts b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-store.injectable.ts similarity index 93% rename from packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationctrl-store.injectable.ts rename to packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-store.injectable.ts index d56ff8769a..5749acf915 100644 --- a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationctrl-store.injectable.ts +++ b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-store.injectable.ts @@ -4,7 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { kubeObjectStoreInjectionToken } from "../../../common/k8s-api/api-manager/kube-object-store-token"; -import { ReplicationControllerStore } from "./replicationctrl-store"; +import { ReplicationControllerStore } from "./replicationcontroller-store"; import clusterFrameContextForNamespacedResourcesInjectable from "../../cluster-frame-context/for-namespaced-resources.injectable"; import loggerInjectable from "../../../common/logger.injectable"; import replicationControllerApiInjectable diff --git a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationctrl-store.ts b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-store.ts similarity index 93% rename from packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationctrl-store.ts rename to packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-store.ts index 9b19eeaa1e..9b5243c219 100644 --- a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationctrl-store.ts +++ b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontroller-store.ts @@ -5,11 +5,11 @@ import type { ReplicationController, - ReplicationControllerApi + ReplicationControllerApi, } from "../../../common/k8s-api/endpoints"; import type { KubeObjectStoreDependencies, - KubeObjectStoreOptions + KubeObjectStoreOptions, } from "../../../common/k8s-api/kube-object.store"; import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store"; diff --git a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontrollers.tsx b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontrollers.tsx index b26e880598..00f13feecc 100644 --- a/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontrollers.tsx +++ b/packages/core/src/renderer/components/+workloads-replicationcontrollers/replicationcontrollers.tsx @@ -6,65 +6,72 @@ import styles from "./replicationcontrollers.module.scss"; import React from "react"; import { observer } from "mobx-react"; -import { KubeObjectStatusIcon } from "../kube-object-status-icon"; import { KubeObjectListLayout } from "../kube-object-list-layout"; import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout"; -import type { ReplicationControllerStore } from "./replicationctrl-store"; -import type { EventStore } from "../+events/store"; +import type { ReplicationControllerStore } from "./replicationcontroller-store"; import { withInjectables } from "@ogre-tools/injectable-react"; -import eventStoreInjectable from "../+events/store.injectable"; -import replicationControllerStoreInjectable from "./replicationctrl-store.injectable"; +import replicationControllerStoreInjectable from "./replicationcontroller-store.injectable"; import { NamespaceSelectBadge } from "../+namespaces/namespace-select-badge"; +import { Badge } from "../badge"; enum columnId { name = "name", namespace = "namespace", + replicas = "replicas", + replicasDesired = "replicasDesired", + selector = "selector", } interface Dependencies { store: ReplicationControllerStore; - eventStore: EventStore; } const NonInjectedReplicationControllers = observer((props: Dependencies) => { - const { - eventStore, - store, - } = props; - return ( replicaSet.getName(), - [columnId.namespace]: replicaSet => replicaSet.getNs(), + [columnId.name]: item => item.getName(), + [columnId.namespace]: item => item.getNs(), + [columnId.selector]: item => item.getSelectorLabels(), + [columnId.replicas]: item => item.getReplicas(), + [columnId.replicasDesired]: item => item.getDesiredReplicas(), }} searchFilters={[ - replicaSet => replicaSet.getSearchFields(), + item => item.getSearchFields(), + item => item.getSelectorLabels(), ]} renderHeaderTitle="Replication Controllers" renderTableHeader={[ { title: "Name", className: "name", sortBy: columnId.name, id: columnId.name }, - { className: "warning", showWithColumn: columnId.name }, { title: "Namespace", className: "namespace", sortBy: columnId.namespace, id: columnId.namespace, }, + { title: "Replicas", sortBy: columnId.replicas, id: columnId.replicas }, + { + title: "Desired Replicas", + sortBy: columnId.replicasDesired, + id: columnId.replicasDesired, + }, + { + title: "Selector", + sortBy: columnId.selector, + id: columnId.selector, + }, ]} - renderTableContents={replicaSet => [ - replicaSet.getName(), - , - , + renderTableContents={item => [ + item.getName(), + , + item.getReplicas(), + item.getDesiredReplicas(), + item.getSelectorLabels().map(label => ()), ]} /> @@ -74,7 +81,6 @@ const NonInjectedReplicationControllers = observer((props: Dependencies) => { export const ReplicationControllers = withInjectables(NonInjectedReplicationControllers, { getProps: (di, props) => ({ ...props, - eventStore: di.inject(eventStoreInjectable), store: di.inject(replicationControllerStoreInjectable), }), }); diff --git a/packages/core/src/renderer/components/kube-object-details/kube-object-detail-items/implementations/replication-controller-detail-item.injectable.ts b/packages/core/src/renderer/components/kube-object-details/kube-object-detail-items/implementations/replication-controller-detail-item.injectable.ts index ae48bc30fd..df14d6cc35 100644 --- a/packages/core/src/renderer/components/kube-object-details/kube-object-detail-items/implementations/replication-controller-detail-item.injectable.ts +++ b/packages/core/src/renderer/components/kube-object-details/kube-object-detail-items/implementations/replication-controller-detail-item.injectable.ts @@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable"; import { kubeObjectDetailItemInjectionToken } from "../kube-object-detail-item-injection-token"; import { computed } from "mobx"; import { - kubeObjectMatchesToKindAndApiVersion + kubeObjectMatchesToKindAndApiVersion, } from "../kube-object-matches-to-kind-and-api-version"; import currentKubeObjectInDetailsInjectable from "../../current-kube-object-in-details.injectable"; import { ReplicationControllerDetails } from "../../../+workloads-replicationcontrollers";