diff --git a/src/migrations/cluster-store/5.0.0-beta.10.ts b/src/migrations/cluster-store/5.0.0-beta.10.ts index daea58279b..3a2b5bdfe3 100644 --- a/src/migrations/cluster-store/5.0.0-beta.10.ts +++ b/src/migrations/cluster-store/5.0.0-beta.10.ts @@ -23,7 +23,7 @@ import path from "path"; import { app } from "electron"; import fse from "fs-extra"; import type { ClusterModel } from "../../common/cluster-store"; -import { MigrationDeclaration, migrationLog } from "../helpers"; +import type { MigrationDeclaration } from "../helpers"; interface Pre500WorkspaceStoreModel { workspaces: { @@ -36,7 +36,7 @@ export default { version: "5.0.0-beta.10", run(store) { const userDataPath = app.getPath("userData"); - + try { const workspaceData: Pre500WorkspaceStoreModel = fse.readJsonSync(path.join(userDataPath, "lens-workspace-store.json")); const workspaces = new Map(); // mapping from WorkspaceId to name @@ -45,8 +45,6 @@ export default { workspaces.set(id, name); } - migrationLog("workspaces", JSON.stringify([...workspaces.entries()])); - const clusters: ClusterModel[] = store.get("clusters"); for (const cluster of clusters) { @@ -58,8 +56,6 @@ export default { store.set("clusters", clusters); } catch (error) { - migrationLog("error", error.path); - if (!(error.code === "ENOENT" && error.path.endsWith("lens-workspace-store.json"))) { // ignore lens-workspace-store.json being missing throw error; diff --git a/src/migrations/hotbar-store/5.0.0-alpha.0.ts b/src/migrations/hotbar-store/5.0.0-alpha.0.ts index 7cd8011414..27f8aa7097 100644 --- a/src/migrations/hotbar-store/5.0.0-alpha.0.ts +++ b/src/migrations/hotbar-store/5.0.0-alpha.0.ts @@ -21,33 +21,18 @@ // Cleans up a store that had the state related data stored import type { Hotbar } from "../../common/hotbar-store"; -import { ClusterStore } from "../../common/cluster-store"; import * as uuid from "uuid"; import type { MigrationDeclaration } from "../helpers"; export default { version: "5.0.0-alpha.0", run(store) { - const hotbars: Hotbar[] = []; + const hotbar: Hotbar = { + id: uuid.v4(), + name: "default", + items: [...Array.from(Array(12).fill(null))], + }; - ClusterStore.getInstance().clustersList.forEach((cluster: any) => { - const name = cluster.workspace; - - if (!name) return; - - let hotbar = hotbars.find((h) => h.name === name); - - if (!hotbar) { - hotbar = { id: uuid.v4(), name, items: [] }; - hotbars.push(hotbar); - } - - hotbar.items.push({ - entity: { uid: cluster.id }, - params: {} - }); - }); - - store.set("hotbars", hotbars); + store.set("hotbars", [hotbar]); } } as MigrationDeclaration; diff --git a/src/migrations/hotbar-store/5.0.0-beta.10.ts b/src/migrations/hotbar-store/5.0.0-beta.10.ts index fe1b06f320..71f279fd6c 100644 --- a/src/migrations/hotbar-store/5.0.0-beta.10.ts +++ b/src/migrations/hotbar-store/5.0.0-beta.10.ts @@ -19,6 +19,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +import { createHash } from "crypto"; import { app } from "electron"; import fse from "fs-extra"; import path from "path"; @@ -59,7 +60,7 @@ export default { if (workspaceHotbar?.items.length < defaultHotbarCells) { workspaceHotbar.items.push({ entity: { - uid: cluster.id, + uid: createHash("md5").update(`${cluster.kubeConfigPath}:${cluster.contextName}`).digest("hex"), name: cluster.preferences.clusterName || cluster.contextName, } }); diff --git a/src/renderer/components/+catalog/catalog-entity-details.tsx b/src/renderer/components/+catalog/catalog-entity-details.tsx index 1a6f0ab03a..fd1b874c82 100644 --- a/src/renderer/components/+catalog/catalog-entity-details.tsx +++ b/src/renderer/components/+catalog/catalog-entity-details.tsx @@ -30,6 +30,7 @@ import { CatalogEntityDrawerMenu } from "./catalog-entity-drawer-menu"; import { CatalogEntityDetailRegistry } from "../../../extensions/registries"; import { HotbarIcon } from "../hotbar/hotbar-icon"; import type { CatalogEntityItem } from "./catalog-entity.store"; +import { isDevelopment } from "../../../common/vars"; interface Props { item: CatalogEntityItem | null | undefined; @@ -91,6 +92,11 @@ export class CatalogEntityDetails extends Component {...item.getLabelBadges(this.props.hideDetails)} + {isDevelopment && ( + + {item.getId()} + + )} )}