From 76f0bdcacac0a73d79b6cab8ef9ed049733d90dc Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 25 Nov 2020 15:41:21 -0500 Subject: [PATCH] revert getByWorkspaceId and add getRendererInfoByWorkspaceId Signed-off-by: Sebastian Malton --- src/common/cluster-store.ts | 7 ++++++- src/main/tray.ts | 2 +- src/renderer/components/cluster-manager/clusters-menu.tsx | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/cluster-store.ts b/src/common/cluster-store.ts index f50d499539..e408269163 100644 --- a/src/common/cluster-store.ts +++ b/src/common/cluster-store.ts @@ -202,7 +202,7 @@ export class ClusterStore extends BaseStore { return this.deadClusters.get(id); } - getByWorkspaceId(workspaceId: string): ClusterRenderInfo[] { + getRendererInfoByWorkspace(workspaceId: string): ClusterRenderInfo[] { const aliveClusters: ClusterRenderInfo[] = this.clustersList.filter(c => c.workspace === workspaceId); const deadClusters: ClusterRenderInfo[] = this.deadClustersList .filter(([c]) => c.workspace === workspaceId) @@ -219,6 +219,11 @@ export class ClusterStore extends BaseStore { return _.sortBy([...aliveClusters, ...deadClusters], c => c.preferences?.iconOrder); } + getByWorkspaceId(workspaceId: string): Cluster[] { + const clusters = this.clustersList.filter(c => c.workspace === workspaceId); + return _.sortBy(clusters, c => c.preferences?.iconOrder); + } + getCountInWorkspace(workspaceId: string): number { const aliveCount = this.clustersList.filter(c => c.workspace === workspaceId).length; const deadCount = this.deadClustersList.filter(([c]) => c.workspace === workspaceId).length; diff --git a/src/main/tray.ts b/src/main/tray.ts index 27e66a8542..3102e5c461 100644 --- a/src/main/tray.ts +++ b/src/main/tray.ts @@ -82,7 +82,7 @@ export function createTrayMenu(windowManager: WindowManager): Menu { { label: "Clusters", submenu: workspaceStore.enabledWorkspacesList - .map((workspace): [Workspace, ClusterRenderInfo[]] => [workspace, clusterStore.getByWorkspaceId(workspace.id)]) + .map((workspace): [Workspace, ClusterRenderInfo[]] => [workspace, clusterStore.getRendererInfoByWorkspace(workspace.id)]) .filter(([, clusters]) => clusters.length > 0) .map(([workspace, clusters]): MenuItemConstructorOptions => ({ label: workspace.name, diff --git a/src/renderer/components/cluster-manager/clusters-menu.tsx b/src/renderer/components/cluster-manager/clusters-menu.tsx index 506176d55c..1f37de3d2d 100644 --- a/src/renderer/components/cluster-manager/clusters-menu.tsx +++ b/src/renderer/components/cluster-manager/clusters-menu.tsx @@ -105,7 +105,7 @@ export class ClusterMenu extends React.Component { const { className } = this.props; const { newContexts } = userStore; const workspace = workspaceStore.getById(workspaceStore.currentWorkspaceId); - const clusters = clusterStore.getByWorkspaceId(workspace.id); + const clusters = clusterStore.getRendererInfoByWorkspace(workspace.id); const activeClusterId = clusterStore.activeCluster; return (