mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Typed catalog category events (#2812)
* typesafe catalog category events Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * use emit Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * rename events Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
c8e2f7ca2d
commit
cd96842750
6 files changed
+26
-6
No files matched your search
@@ -55,7 +55,7 @@ export class CatalogAddButton extends React.Component<CatalogAddButtonProps> {
|
||||
menuItems: this.menuItems
|
||||
};
|
||||
|
||||
category.emit("onCatalogAddMenu", context);
|
||||
category.emit("catalogAddMenu", context);
|
||||
}
|
||||
}, { fireImmediately: true })
|
||||
]);
|
||||
|
||||
@@ -23,9 +23,8 @@ import { action, computed, IReactionDisposer, makeObservable, observable, reacti
|
||||
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||
import type { CatalogEntity, CatalogEntityActionContext } from "../../api/catalog-entity";
|
||||
import { ItemObject, ItemStore } from "../../item.store";
|
||||
import { CatalogCategory } from "../../../common/catalog";
|
||||
import { CatalogCategory, catalogCategoryRegistry } from "../../../common/catalog";
|
||||
import { autoBind } from "../../../common/utils";
|
||||
|
||||
export class CatalogEntityItem implements ItemObject {
|
||||
constructor(public entity: CatalogEntity) {}
|
||||
|
||||
@@ -111,6 +110,14 @@ export class CatalogEntityStore extends ItemStore<CatalogEntityItem> {
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
if (this.activeCategory) {
|
||||
this.activeCategory.emit("load");
|
||||
} else {
|
||||
for (const category of catalogCategoryRegistry.items) {
|
||||
category.emit("load");
|
||||
}
|
||||
}
|
||||
|
||||
return this.loadItems(() => this.entities);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user