mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
revert getByWorkspaceId and add getRendererInfoByWorkspaceId
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
fb109e8cff
commit
76f0bdcaca
@ -202,7 +202,7 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
||||
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<ClusterStoreModel> {
|
||||
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;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -105,7 +105,7 @@ export class ClusterMenu extends React.Component<Props> {
|
||||
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 (
|
||||
<div className={cssNames("ClustersMenu flex column", className)}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user