mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Saving more entity data to HotbarItem
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
8fff064e0c
commit
e25f7fc655
@ -8,6 +8,8 @@ import isNull from "lodash/isNull";
|
||||
export interface HotbarItem {
|
||||
entity: {
|
||||
uid: string;
|
||||
name: string;
|
||||
source: string;
|
||||
};
|
||||
params?: {
|
||||
[key: string]: string;
|
||||
@ -123,9 +125,14 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
addToHotbar(item: CatalogEntityItem, cellIndex = -1) {
|
||||
const hotbar = this.getActive();
|
||||
const newItem = { entity: { uid: item.id }};
|
||||
const newItem = { entity: {
|
||||
uid: item.id,
|
||||
name: item.name,
|
||||
source: item.source
|
||||
}};
|
||||
|
||||
if (hotbar.items.find(i => i?.entity.uid === item.id)) {
|
||||
return;
|
||||
@ -146,6 +153,7 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
removeFromHotbar(uid: string) {
|
||||
const hotbar = this.getActive();
|
||||
const index = hotbar.items.findIndex((i) => i?.entity.uid === uid);
|
||||
|
||||
@ -22,7 +22,11 @@ export default migration({
|
||||
}
|
||||
|
||||
hotbar.items.push({
|
||||
entity: { uid: cluster.id },
|
||||
entity: {
|
||||
uid: cluster.id,
|
||||
name: cluster.name,
|
||||
source: cluster.source
|
||||
},
|
||||
params: {}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user