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);
|
return this.deadClusters.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
getByWorkspaceId(workspaceId: string): ClusterRenderInfo[] {
|
getRendererInfoByWorkspace(workspaceId: string): ClusterRenderInfo[] {
|
||||||
const aliveClusters: ClusterRenderInfo[] = this.clustersList.filter(c => c.workspace === workspaceId);
|
const aliveClusters: ClusterRenderInfo[] = this.clustersList.filter(c => c.workspace === workspaceId);
|
||||||
const deadClusters: ClusterRenderInfo[] = this.deadClustersList
|
const deadClusters: ClusterRenderInfo[] = this.deadClustersList
|
||||||
.filter(([c]) => c.workspace === workspaceId)
|
.filter(([c]) => c.workspace === workspaceId)
|
||||||
@ -219,6 +219,11 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
|||||||
return _.sortBy([...aliveClusters, ...deadClusters], c => c.preferences?.iconOrder);
|
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 {
|
getCountInWorkspace(workspaceId: string): number {
|
||||||
const aliveCount = this.clustersList.filter(c => c.workspace === workspaceId).length;
|
const aliveCount = this.clustersList.filter(c => c.workspace === workspaceId).length;
|
||||||
const deadCount = this.deadClustersList.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",
|
label: "Clusters",
|
||||||
submenu: workspaceStore.enabledWorkspacesList
|
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)
|
.filter(([, clusters]) => clusters.length > 0)
|
||||||
.map(([workspace, clusters]): MenuItemConstructorOptions => ({
|
.map(([workspace, clusters]): MenuItemConstructorOptions => ({
|
||||||
label: workspace.name,
|
label: workspace.name,
|
||||||
|
|||||||
@ -105,7 +105,7 @@ export class ClusterMenu extends React.Component<Props> {
|
|||||||
const { className } = this.props;
|
const { className } = this.props;
|
||||||
const { newContexts } = userStore;
|
const { newContexts } = userStore;
|
||||||
const workspace = workspaceStore.getById(workspaceStore.currentWorkspaceId);
|
const workspace = workspaceStore.getById(workspaceStore.currentWorkspaceId);
|
||||||
const clusters = clusterStore.getByWorkspaceId(workspace.id);
|
const clusters = clusterStore.getRendererInfoByWorkspace(workspace.id);
|
||||||
const activeClusterId = clusterStore.activeCluster;
|
const activeClusterId = clusterStore.activeCluster;
|
||||||
return (
|
return (
|
||||||
<div className={cssNames("ClustersMenu flex column", className)}>
|
<div className={cssNames("ClustersMenu flex column", className)}>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user