mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Hotbar disabled items (#2710)
* Saving more entity data to HotbarItem Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Adding generic MaterialTooltip component Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Move HotbarCell to separate component Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Abstract out HotbarEntityIcon from HotbarIcon Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Styling disabled hotbar items Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Migration for adding extra data to hotbar items Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Testing migration Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Some cleaning up Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Bump migration version Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Bump app version in package.json Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
1 parent
2d0609ed24
commit
a930d5f14f
14 files changed
+501
-204
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import type { Hotbar } from "../../common/hotbar-store";
|
||||
import { migration } from "../migration-wrapper";
|
||||
import { catalogEntityRegistry } from "../../renderer/api/catalog-entity-registry";
|
||||
|
||||
export default migration({
|
||||
version: "5.0.0-beta.5",
|
||||
run(store) {
|
||||
const hotbars: Hotbar[] = store.get("hotbars");
|
||||
|
||||
hotbars.forEach((hotbar, hotbarIndex) => {
|
||||
hotbar.items.forEach((item, itemIndex) => {
|
||||
const entity = catalogEntityRegistry.items.find((entity) => entity.metadata.uid === item?.entity.uid);
|
||||
|
||||
if (!entity) {
|
||||
// Clear disabled item
|
||||
hotbars[hotbarIndex].items[itemIndex] = null;
|
||||
} else {
|
||||
// Save additional data
|
||||
hotbars[hotbarIndex].items[itemIndex].entity = {
|
||||
...item.entity,
|
||||
name: entity.metadata.name,
|
||||
source: entity.metadata.source
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
store.set("hotbars", hotbars);
|
||||
}
|
||||
});
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
import version500alpha0 from "./5.0.0-alpha.0";
|
||||
import version500alpha2 from "./5.0.0-alpha.2";
|
||||
import version500beta5 from "./5.0.0-beta.5";
|
||||
|
||||
export default {
|
||||
...version500alpha0,
|
||||
...version500alpha2
|
||||
...version500alpha2,
|
||||
...version500beta5,
|
||||
};
|
||||
Reference in new issue
Block a user