diff --git a/src/renderer/components/app.tsx b/src/renderer/components/app.tsx index eba890ff3f..f5ad684595 100755 --- a/src/renderer/components/app.tsx +++ b/src/renderer/components/app.tsx @@ -91,23 +91,15 @@ export class App extends React.Component { reaction(() => this.warningsTotal, (count: number) => { broadcastMessage(`cluster-warning-event-count:${getHostedCluster().id}`, count); }), - - reaction(getHostedCluster, () => { - this.setStartUrl(); - }) ]); } - @observable startUrl: string = clusterURL(); + @observable startUrl = isAllowedResource(["events", "nodes", "pods"]) ? clusterURL() : workloadsURL(); @computed get warningsTotal(): number { return nodesStore.getWarningsCount() + eventStore.getWarningsCount(); } - setStartUrl() { - this.startUrl = isAllowedResource(["events", "nodes", "pods"]) ? clusterURL() : workloadsURL(); - } - getTabLayoutRoutes(menuItem: ClusterPageMenuRegistration) { const routes: TabLayoutRoute[] = []; @@ -190,7 +182,7 @@ export class App extends React.Component { - + ); diff --git a/src/renderer/components/command-palette/command-container.tsx b/src/renderer/components/command-palette/command-container.tsx index 2db9aa08e6..c6950bc5b9 100644 --- a/src/renderer/components/command-palette/command-container.tsx +++ b/src/renderer/components/command-palette/command-container.tsx @@ -8,7 +8,7 @@ import { EventEmitter } from "../../../common/event-emitter"; import { subscribeToBroadcast } from "../../../common/ipc"; import { CommandDialog } from "./command-dialog"; import { CommandRegistration, commandRegistry } from "../../../extensions/registries/command-registry"; -import { clusterStore, getHostedCluster } from "../../../common/cluster-store"; +import { clusterStore } from "../../../common/cluster-store"; import { workspaceStore } from "../../../common/workspace-store"; export type CommandDialogEvent = { @@ -28,9 +28,8 @@ export class CommandOverlay { } @observer -export class CommandContainer extends React.Component { +export class CommandContainer extends React.Component<{ clusterId?: string }> { @observable.ref commandComponent: React.ReactElement; - @observable cluster = getHostedCluster(); private escHandler(event: KeyboardEvent) { if (event.key === "Escape") { @@ -56,8 +55,8 @@ export class CommandContainer extends React.Component { } componentDidMount() { - if (this.cluster) { - subscribeToBroadcast(`command-palette:run-action:${this.cluster.id}`, (event, commandId: string) => { + if (this.props.clusterId) { + subscribeToBroadcast(`command-palette:run-action:${this.props.clusterId}`, (event, commandId: string) => { const command = this.findCommandById(commandId); if (command) {