mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix typo CatelogEntityOnRunHook > CatalogEntityOnRunHook
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
parent
613f84b180
commit
6fe1809e3d
@ -22,7 +22,7 @@
|
||||
|
||||
import type { CatalogCategory, CatalogEntity } from "../../common/catalog";
|
||||
import { catalogEntityRegistry as registry } from "../../renderer/api/catalog-entity-registry";
|
||||
import type { CatelogEntityOnRunHook } from "../../renderer/api/catalog-entity-registry";
|
||||
import type { CatalogEntityOnRunHook } from "../../renderer/api/catalog-entity-registry";
|
||||
export { catalogCategoryRegistry as catalogCategories } from "../../common/catalog/catalog-category-registry";
|
||||
|
||||
export class CatalogEntityRegistry {
|
||||
@ -55,14 +55,14 @@ export class CatalogEntityRegistry {
|
||||
* @param onRunHook The function that should return a boolean if the onRun of catalog entity should be triggered.
|
||||
* @returns A function to remove that hook
|
||||
*/
|
||||
addOnRunHook(catalogEntityUid: CatalogEntity["metadata"]["uid"], onRunHook: CatelogEntityOnRunHook) {
|
||||
addOnRunHook(catalogEntityUid: CatalogEntity["metadata"]["uid"], onRunHook: CatalogEntityOnRunHook) {
|
||||
return registry.addOnRunHook(catalogEntityUid, onRunHook);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one catalog entity onRun hook by catalog entity uid
|
||||
*/
|
||||
getOnRunHook(catalogEntityUid: CatalogEntity["metadata"]["uid"]): CatelogEntityOnRunHook | undefined {
|
||||
getOnRunHook(catalogEntityUid: CatalogEntity["metadata"]["uid"]): CatalogEntityOnRunHook | undefined {
|
||||
return registry.getOnRunHook(catalogEntityUid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ import { once } from "lodash";
|
||||
import type { CatalogEntityItem } from "../../renderer/components/+catalog/catalog-entity-item";
|
||||
|
||||
export type EntityFilter = (entity: CatalogEntity) => any;
|
||||
export type CatelogEntityOnRunHook = (entity: CatalogEntity | CatalogEntityItem<CatalogEntity>) => boolean | Promise<boolean>;
|
||||
export type CatalogEntityOnRunHook = (entity: CatalogEntity | CatalogEntityItem<CatalogEntity>) => boolean | Promise<boolean>;
|
||||
|
||||
type CatalogEntityUid = CatalogEntity["metadata"]["uid"];
|
||||
|
||||
@ -42,7 +42,7 @@ export class CatalogEntityRegistry {
|
||||
});
|
||||
protected entityOnRunHooks = observable.set<{
|
||||
catalogEntityUid: CatalogEntityUid;
|
||||
onRunHook: CatelogEntityOnRunHook
|
||||
onRunHook: CatalogEntityOnRunHook
|
||||
}>([], {
|
||||
deep: false,
|
||||
});
|
||||
@ -186,7 +186,7 @@ export class CatalogEntityRegistry {
|
||||
* @param onRunHook The function that should return a boolean if the onRun of catalog entity should be triggered.
|
||||
* @returns A function to remove that hook
|
||||
*/
|
||||
addOnRunHook(catalogEntityUid: CatalogEntityUid, onRunHook: CatelogEntityOnRunHook): Disposer {
|
||||
addOnRunHook(catalogEntityUid: CatalogEntityUid, onRunHook: CatalogEntityOnRunHook): Disposer {
|
||||
this.entityOnRunHooks.add({
|
||||
catalogEntityUid,
|
||||
onRunHook,
|
||||
@ -201,7 +201,7 @@ export class CatalogEntityRegistry {
|
||||
/**
|
||||
* Returns one catalog entity onRun hook by catalog entity uid
|
||||
*/
|
||||
getOnRunHook(_catalogEntityUid: CatalogEntityUid): CatelogEntityOnRunHook | undefined {
|
||||
getOnRunHook(_catalogEntityUid: CatalogEntityUid): CatalogEntityOnRunHook | undefined {
|
||||
return Array.from(this.entityOnRunHooks).find(({ catalogEntityUid }) => catalogEntityUid === _catalogEntityUid)?.onRunHook;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ import styles from "./catalog.module.css";
|
||||
import React from "react";
|
||||
import { action, computed } from "mobx";
|
||||
import type { CatalogEntity, CatalogEntityActionContext } from "../../api/catalog-entity";
|
||||
import type { CatelogEntityOnRunHook } from "../../api/catalog-entity-registry";
|
||||
import type { CatalogEntityOnRunHook } from "../../api/catalog-entity-registry";
|
||||
import type { ItemObject } from "../../../common/item.store";
|
||||
import { Badge } from "../badge";
|
||||
import { navigation } from "../../navigation";
|
||||
@ -104,7 +104,7 @@ export class CatalogEntityItem<T extends CatalogEntity> implements ItemObject {
|
||||
];
|
||||
}
|
||||
|
||||
onRun(onRunHook: CatelogEntityOnRunHook | undefined, ctx: CatalogEntityActionContext) {
|
||||
onRun(onRunHook: CatalogEntityOnRunHook | undefined, ctx: CatalogEntityActionContext) {
|
||||
if (!onRunHook) {
|
||||
this.entity.onRun(ctx);
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
import { computed, IReactionDisposer, makeObservable, observable, reaction } from "mobx";
|
||||
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||
import type { CatalogEntity } from "../../api/catalog-entity";
|
||||
import type { CatelogEntityOnRunHook } from "../../api/catalog-entity-registry";
|
||||
import type { CatalogEntityOnRunHook } from "../../api/catalog-entity-registry";
|
||||
import { ItemStore } from "../../../common/item.store";
|
||||
import { CatalogCategory, catalogCategoryRegistry } from "../../../common/catalog";
|
||||
import { autoBind } from "../../../common/utils";
|
||||
@ -50,7 +50,7 @@ export class CatalogEntityStore extends ItemStore<CatalogEntityItem<CatalogEntit
|
||||
return this.entities.find(e => e.getId() === this.selectedItemId);
|
||||
}
|
||||
|
||||
getCatalogEntityOnRunHook(catalogEntityUid: CatalogEntity["metadata"]["uid"]): CatelogEntityOnRunHook | undefined {
|
||||
getCatalogEntityOnRunHook(catalogEntityUid: CatalogEntity["metadata"]["uid"]): CatalogEntityOnRunHook | undefined {
|
||||
return catalogEntityRegistry.getOnRunHook(catalogEntityUid);
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ import { observer } from "mobx-react";
|
||||
import { HotbarEntityIcon } from "./hotbar-entity-icon";
|
||||
import { cssNames, IClassName } from "../../utils";
|
||||
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||
import type { CatelogEntityOnRunHook} from "../../api/catalog-entity-registry";
|
||||
import type { CatalogEntityOnRunHook} from "../../api/catalog-entity-registry";
|
||||
import { HotbarStore } from "../../../common/hotbar-store";
|
||||
import { CatalogEntity, catalogEntityRunContext } from "../../api/catalog-entity";
|
||||
import { DragDropContext, Draggable, Droppable, DropResult } from "react-beautiful-dnd";
|
||||
@ -56,7 +56,7 @@ export class HotbarMenu extends React.Component<Props> {
|
||||
return catalogEntityRegistry.getById(item?.entity.uid) ?? null;
|
||||
}
|
||||
|
||||
getEntityOnRunHook(uid: string): CatelogEntityOnRunHook | undefined {
|
||||
getEntityOnRunHook(uid: string): CatalogEntityOnRunHook | undefined {
|
||||
return catalogEntityRegistry.getOnRunHook(uid);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user