mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Pin icon for Catalog list items (#3810)
This commit is contained in:
1 parent
5998b4ca84
commit
0eac46530a
10 files changed
+147
-37
No files matched your search
@@ -324,6 +324,15 @@ describe("HotbarStore", () => {
|
||||
console.error = error;
|
||||
console.warn = warn;
|
||||
});
|
||||
|
||||
it("checks if entity already pinned to hotbar", () => {
|
||||
const hotbarStore = HotbarStore.getInstance();
|
||||
|
||||
hotbarStore.addToHotbar(testCluster);
|
||||
|
||||
expect(hotbarStore.isAddedToActive(testCluster)).toBeTruthy();
|
||||
expect(hotbarStore.isAddedToActive(awsCluster)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("pre beta-5 migrations", () => {
|
||||
|
||||
@@ -171,7 +171,7 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
|
||||
}};
|
||||
|
||||
|
||||
if (hotbar.items.find(i => i?.entity.uid === uid)) {
|
||||
if (this.isAddedToActive(item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -274,6 +274,14 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
|
||||
|
||||
hotbarStore.activeHotbarId = hotbarStore.hotbars[index].id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if entity already pinned to hotbar
|
||||
* @returns boolean
|
||||
*/
|
||||
isAddedToActive(entity: CatalogEntity) {
|
||||
return !!this.getActive().items.find(item => item?.entity.uid === entity.metadata.uid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user