1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Filtering out clusters by metadata.id

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-06-28 16:48:49 +03:00
parent 8dda513b79
commit dde0d0ba83

View File

@ -22,7 +22,7 @@
import { createHash } from "crypto";
import { app } from "electron";
import fse from "fs-extra";
import { isNull } from "lodash";
import { isNull, uniqBy } from "lodash";
import path from "path";
import * as uuid from "uuid";
import type { ClusterStoreModel } from "../../common/cluster-store";
@ -47,6 +47,7 @@ export default {
const workspaceStoreData: Pre500WorkspaceStoreModel = fse.readJsonSync(path.join(userDataPath, "lens-workspace-store.json"));
const { clusters }: ClusterStoreModel = fse.readJSONSync(path.join(userDataPath, "lens-cluster-store.json"));
const workspaceHotbars = new Map<string, Hotbar>(); // mapping from WorkspaceId to HotBar
const uniqueClusters = uniqBy(clusters, "metadata.id"); // Filtering out duplicated clusters
for (const { id, name } of workspaceStoreData.workspaces) {
workspaceHotbars.set(id, {
@ -68,7 +69,7 @@ export default {
});
}
for (const cluster of clusters) {
for (const cluster of uniqueClusters) {
const workspaceHotbar = workspaceHotbars.get(cluster.workspace);
if (workspaceHotbar?.items.length < defaultHotbarCells) {