1
0
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:
Hung-Han (Henry) Chen 2021-10-05 08:26:44 +03:00
parent 613f84b180
commit 6fe1809e3d
No known key found for this signature in database
GPG Key ID: 54B44603D251B788
5 changed files with 13 additions and 13 deletions

View File

@ -22,7 +22,7 @@
import type { CatalogCategory, CatalogEntity } from "../../common/catalog"; import type { CatalogCategory, CatalogEntity } from "../../common/catalog";
import { catalogEntityRegistry as registry } from "../../renderer/api/catalog-entity-registry"; 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 { catalogCategoryRegistry as catalogCategories } from "../../common/catalog/catalog-category-registry";
export class CatalogEntityRegistry { 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. * @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 * @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); return registry.addOnRunHook(catalogEntityUid, onRunHook);
} }
/** /**
* Returns one catalog entity onRun hook by catalog entity uid * 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); return registry.getOnRunHook(catalogEntityUid);
} }
} }

View File

@ -30,7 +30,7 @@ import { once } from "lodash";
import type { CatalogEntityItem } from "../../renderer/components/+catalog/catalog-entity-item"; import type { CatalogEntityItem } from "../../renderer/components/+catalog/catalog-entity-item";
export type EntityFilter = (entity: CatalogEntity) => any; 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"]; type CatalogEntityUid = CatalogEntity["metadata"]["uid"];
@ -42,7 +42,7 @@ export class CatalogEntityRegistry {
}); });
protected entityOnRunHooks = observable.set<{ protected entityOnRunHooks = observable.set<{
catalogEntityUid: CatalogEntityUid; catalogEntityUid: CatalogEntityUid;
onRunHook: CatelogEntityOnRunHook onRunHook: CatalogEntityOnRunHook
}>([], { }>([], {
deep: false, 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. * @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 * @returns A function to remove that hook
*/ */
addOnRunHook(catalogEntityUid: CatalogEntityUid, onRunHook: CatelogEntityOnRunHook): Disposer { addOnRunHook(catalogEntityUid: CatalogEntityUid, onRunHook: CatalogEntityOnRunHook): Disposer {
this.entityOnRunHooks.add({ this.entityOnRunHooks.add({
catalogEntityUid, catalogEntityUid,
onRunHook, onRunHook,
@ -201,7 +201,7 @@ export class CatalogEntityRegistry {
/** /**
* Returns one catalog entity onRun hook by catalog entity uid * 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; return Array.from(this.entityOnRunHooks).find(({ catalogEntityUid }) => catalogEntityUid === _catalogEntityUid)?.onRunHook;
} }
} }

View File

@ -22,7 +22,7 @@ import styles from "./catalog.module.css";
import React from "react"; import React from "react";
import { action, computed } from "mobx"; import { action, computed } from "mobx";
import type { CatalogEntity, CatalogEntityActionContext } from "../../api/catalog-entity"; 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 type { ItemObject } from "../../../common/item.store";
import { Badge } from "../badge"; import { Badge } from "../badge";
import { navigation } from "../../navigation"; 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) { if (!onRunHook) {
this.entity.onRun(ctx); this.entity.onRun(ctx);

View File

@ -22,7 +22,7 @@
import { computed, IReactionDisposer, makeObservable, observable, reaction } from "mobx"; import { computed, IReactionDisposer, makeObservable, observable, reaction } from "mobx";
import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
import type { CatalogEntity } from "../../api/catalog-entity"; 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 { ItemStore } from "../../../common/item.store";
import { CatalogCategory, catalogCategoryRegistry } from "../../../common/catalog"; import { CatalogCategory, catalogCategoryRegistry } from "../../../common/catalog";
import { autoBind } from "../../../common/utils"; 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); 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); return catalogEntityRegistry.getOnRunHook(catalogEntityUid);
} }

View File

@ -26,7 +26,7 @@ import { observer } from "mobx-react";
import { HotbarEntityIcon } from "./hotbar-entity-icon"; import { HotbarEntityIcon } from "./hotbar-entity-icon";
import { cssNames, IClassName } from "../../utils"; import { cssNames, IClassName } from "../../utils";
import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; 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 { HotbarStore } from "../../../common/hotbar-store";
import { CatalogEntity, catalogEntityRunContext } from "../../api/catalog-entity"; import { CatalogEntity, catalogEntityRunContext } from "../../api/catalog-entity";
import { DragDropContext, Draggable, Droppable, DropResult } from "react-beautiful-dnd"; 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; return catalogEntityRegistry.getById(item?.entity.uid) ?? null;
} }
getEntityOnRunHook(uid: string): CatelogEntityOnRunHook | undefined { getEntityOnRunHook(uid: string): CatalogEntityOnRunHook | undefined {
return catalogEntityRegistry.getOnRunHook(uid); return catalogEntityRegistry.getOnRunHook(uid);
} }