1
0
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:
Alex Andreev 2021-05-06 11:48:31 +03:00
parent 8fff064e0c
commit e25f7fc655
2 changed files with 14 additions and 2 deletions

View File

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

View File

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