diff --git a/package.json b/package.json index ba3e965f77..48ff18ee5e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "kontena-lens", "productName": "Lens", "description": "Lens - The Kubernetes IDE", - "version": "5.0.0-alpha.1", + "version": "5.0.0-alpha.2", "main": "static/build/main.js", "copyright": "© 2021, Mirantis, Inc.", "license": "MIT", diff --git a/src/common/hotbar-store.ts b/src/common/hotbar-store.ts index 10f9a8c5a6..67d436b177 100644 --- a/src/common/hotbar-store.ts +++ b/src/common/hotbar-store.ts @@ -43,7 +43,7 @@ export class HotbarStore extends BaseStore { } set activeHotbarId(id: string) { - if (this.getByid(id)) { + if (this.getById(id)) { this._activeHotbarId = id; } } @@ -64,7 +64,7 @@ export class HotbarStore extends BaseStore { } if (data.activeHotbarId) { - if (this.getByid(data.activeHotbarId)) { + if (this.getById(data.activeHotbarId)) { this.activeHotbarId = data.activeHotbarId; } } @@ -75,14 +75,14 @@ export class HotbarStore extends BaseStore { } getActive() { - return this.getByid(this.activeHotbarId); + return this.getById(this.activeHotbarId); } getByName(name: string) { return this.hotbars.find((hotbar) => hotbar.name === name); } - getByid(id: string) { + getById(id: string) { return this.hotbars.find((hotbar) => hotbar.id === id); } diff --git a/src/migrations/hotbar-store/5.0.0-alpha.2.ts b/src/migrations/hotbar-store/5.0.0-alpha.2.ts new file mode 100644 index 0000000000..03b8b6526f --- /dev/null +++ b/src/migrations/hotbar-store/5.0.0-alpha.2.ts @@ -0,0 +1,19 @@ +// Cleans up a store that had the state related data stored +import { Hotbar } from "../../common/hotbar-store"; +import { migration } from "../migration-wrapper"; +import { v4 as uuid } from "uuid"; + +export default migration({ + version: "5.0.0-alpha.2", + run(store) { + const hotbars = (store.get("hotbars") || []) as Hotbar[]; + + hotbars.forEach((hotbar) => { + if (!hotbar.id) { + hotbar.id = uuid(); + } + }); + + store.set("hotbars", hotbars); + } +}); diff --git a/src/migrations/hotbar-store/index.ts b/src/migrations/hotbar-store/index.ts index ae9d4bc125..842f144a18 100644 --- a/src/migrations/hotbar-store/index.ts +++ b/src/migrations/hotbar-store/index.ts @@ -1,7 +1,9 @@ // Hotbar store migrations import version500alpha0 from "./5.0.0-alpha.0"; +import version500alpha2 from "./5.0.0-alpha.2"; export default { ...version500alpha0, + ...version500alpha2 }; diff --git a/src/renderer/components/hotbar/hotbar-remove-command.tsx b/src/renderer/components/hotbar/hotbar-remove-command.tsx index fbcd3f336b..97684ceb4e 100644 --- a/src/renderer/components/hotbar/hotbar-remove-command.tsx +++ b/src/renderer/components/hotbar/hotbar-remove-command.tsx @@ -15,7 +15,7 @@ export class HotbarRemoveCommand extends React.Component { } onChange(id: string): void { - const hotbar = hotbarStore.getByid(id); + const hotbar = hotbarStore.getById(id); if (!hotbar) { return;