mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix hotbar migration of workspaces (#3178)
This commit is contained in:
1 parent
b9dfd20a93
commit
51655884c7
39 files changed
+333
-446
No files matched your search
@@ -20,34 +20,24 @@
|
||||
*/
|
||||
|
||||
// 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 { Hotbar, HotbarStore } from "../../common/hotbar-store";
|
||||
import * as uuid from "uuid";
|
||||
import type { MigrationDeclaration } from "../helpers";
|
||||
import { catalogEntity } from "../../main/catalog-sources/general";
|
||||
|
||||
export default {
|
||||
version: "5.0.0-alpha.0",
|
||||
run(store) {
|
||||
const hotbars: Hotbar[] = [];
|
||||
const hotbar: Hotbar = {
|
||||
id: uuid.v4(),
|
||||
name: "default",
|
||||
items: HotbarStore.getInitialItems(),
|
||||
};
|
||||
|
||||
ClusterStore.getInstance().clustersList.forEach((cluster: any) => {
|
||||
const name = cluster.workspace;
|
||||
const { metadata: { uid, name, source } } = catalogEntity;
|
||||
|
||||
if (!name) return;
|
||||
hotbar.items[0] = { entity: { uid, name, source } };
|
||||
|
||||
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;
|
||||
Reference in new issue
Block a user