1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-04-19 17:02:42 +03:00
parent 05f75beec8
commit 0f7acdaaab
5 changed files with 27 additions and 6 deletions

View File

@ -2,7 +2,7 @@
"name": "kontena-lens", "name": "kontena-lens",
"productName": "Lens", "productName": "Lens",
"description": "Lens - The Kubernetes IDE", "description": "Lens - The Kubernetes IDE",
"version": "5.0.0-alpha.1", "version": "5.0.0-alpha.2",
"main": "static/build/main.js", "main": "static/build/main.js",
"copyright": "© 2021, Mirantis, Inc.", "copyright": "© 2021, Mirantis, Inc.",
"license": "MIT", "license": "MIT",

View File

@ -43,7 +43,7 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
} }
set activeHotbarId(id: string) { set activeHotbarId(id: string) {
if (this.getByid(id)) { if (this.getById(id)) {
this._activeHotbarId = id; this._activeHotbarId = id;
} }
} }
@ -64,7 +64,7 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
} }
if (data.activeHotbarId) { if (data.activeHotbarId) {
if (this.getByid(data.activeHotbarId)) { if (this.getById(data.activeHotbarId)) {
this.activeHotbarId = data.activeHotbarId; this.activeHotbarId = data.activeHotbarId;
} }
} }
@ -75,14 +75,14 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
} }
getActive() { getActive() {
return this.getByid(this.activeHotbarId); return this.getById(this.activeHotbarId);
} }
getByName(name: string) { getByName(name: string) {
return this.hotbars.find((hotbar) => hotbar.name === name); return this.hotbars.find((hotbar) => hotbar.name === name);
} }
getByid(id: string) { getById(id: string) {
return this.hotbars.find((hotbar) => hotbar.id === id); return this.hotbars.find((hotbar) => hotbar.id === id);
} }

View File

@ -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);
}
});

View File

@ -1,7 +1,9 @@
// Hotbar store migrations // Hotbar store migrations
import version500alpha0 from "./5.0.0-alpha.0"; import version500alpha0 from "./5.0.0-alpha.0";
import version500alpha2 from "./5.0.0-alpha.2";
export default { export default {
...version500alpha0, ...version500alpha0,
...version500alpha2
}; };

View File

@ -15,7 +15,7 @@ export class HotbarRemoveCommand extends React.Component {
} }
onChange(id: string): void { onChange(id: string): void {
const hotbar = hotbarStore.getByid(id); const hotbar = hotbarStore.getById(id);
if (!hotbar) { if (!hotbar) {
return; return;