diff --git a/src/main/initializers/ipc.ts b/src/main/initializers/ipc.ts index 3c3e14f923..53d6b5b055 100644 --- a/src/main/initializers/ipc.ts +++ b/src/main/initializers/ipc.ts @@ -28,6 +28,7 @@ import type { ClusterId } from "../../common/cluster-types"; import { appEventBus } from "../../common/event-bus"; import { dialogShowOpenDialogHandler, ipcMainHandle } from "../../common/ipc"; import { catalogEntityRegistry } from "../catalog"; +import { pushCatalogToRenderer } from "../catalog-pusher"; import { ClusterManager } from "../cluster-manager"; import { bundledKubectlPath } from "../kubectl"; import logger from "../logger"; @@ -48,6 +49,8 @@ export function initIpcMainHandlers() { if (cluster) { clusterFrameMap.set(cluster.id, { frameId: event.frameId, processId: event.processId }); cluster.pushState(); + + pushCatalogToRenderer(catalogEntityRegistry); } }); diff --git a/src/renderer/components/cluster-settings/cluster-settings.tsx b/src/renderer/components/cluster-settings/cluster-settings.tsx index 21081bc5ce..ce9822b26c 100644 --- a/src/renderer/components/cluster-settings/cluster-settings.tsx +++ b/src/renderer/components/cluster-settings/cluster-settings.tsx @@ -42,7 +42,7 @@ export function GeneralSettings({ entity }: EntitySettingViewProps) {
- +
diff --git a/src/renderer/components/cluster-settings/components/cluster-name-setting.tsx b/src/renderer/components/cluster-settings/components/cluster-name-setting.tsx index cd6a6a7032..0ed41106ab 100644 --- a/src/renderer/components/cluster-settings/components/cluster-name-setting.tsx +++ b/src/renderer/components/cluster-settings/components/cluster-name-setting.tsx @@ -26,9 +26,11 @@ import { observable, autorun, makeObservable } from "mobx"; import { observer, disposeOnUnmount } from "mobx-react"; import { SubTitle } from "../../layout/sub-title"; import { isRequired } from "../../input/input_validators"; +import type { KubernetesCluster } from "../../../../common/catalog-entities"; interface Props { cluster: Cluster; + entity: KubernetesCluster; } @observer @@ -43,7 +45,7 @@ export class ClusterNameSetting extends React.Component { componentDidMount() { disposeOnUnmount(this, autorun(() => { - this.name = this.props.cluster.preferences.clusterName; + this.name = this.props.cluster.preferences.clusterName || this.props.entity.metadata.name; }) ); } diff --git a/src/renderer/components/layout/sidebar.tsx b/src/renderer/components/layout/sidebar.tsx index adfac26add..1f584d176f 100644 --- a/src/renderer/components/layout/sidebar.tsx +++ b/src/renderer/components/layout/sidebar.tsx @@ -40,8 +40,7 @@ import { SidebarItem } from "./sidebar-item"; import { Apps } from "../+apps"; import * as routes from "../../../common/routes"; import { Config } from "../+config"; -import { ClusterStore } from "../../../common/cluster-store"; -import { App } from "../app"; +import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; interface Props { className?: string; @@ -178,14 +177,20 @@ export class Sidebar extends React.Component { }); } + get clusterEntity() { + return catalogEntityRegistry.activeEntity; + } + render() { const { className } = this.props; return (
-
- {ClusterStore.getInstance().getById(App.clusterId)?.name} -
+ {this.clusterEntity && ( +
+ {this.clusterEntity.metadata.name} +
+ )}