mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cleanup
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
f20b7cd782
commit
0d2cf84115
@ -1,10 +1,9 @@
|
|||||||
// Extensions API -> Commands
|
// Extensions API -> Commands
|
||||||
|
|
||||||
import { BaseRegistry } from "./base-registry";
|
import { BaseRegistry } from "./base-registry";
|
||||||
import { action, observable, reaction } from "mobx";
|
import { action, observable } from "mobx";
|
||||||
import { LensExtension } from "../lens-extension";
|
import { LensExtension } from "../lens-extension";
|
||||||
import { CatalogEntity } from "../../common/catalog-entity";
|
import { CatalogEntity } from "../../common/catalog-entity";
|
||||||
import { catalogEntityRegistry } from "../../common/catalog-entity-registry";
|
|
||||||
|
|
||||||
export type CommandContext = {
|
export type CommandContext = {
|
||||||
entity?: CatalogEntity;
|
entity?: CatalogEntity;
|
||||||
@ -35,16 +34,4 @@ export class CommandRegistry extends BaseRegistry<CommandRegistration> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function syncCommandRegistryWithCatalog() {
|
|
||||||
reaction(() => catalogEntityRegistry.items, (items) => {
|
|
||||||
if (!commandRegistry.activeEntity) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!items.includes(commandRegistry.activeEntity)) {
|
|
||||||
commandRegistry.activeEntity = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export const commandRegistry = new CommandRegistry();
|
export const commandRegistry = new CommandRegistry();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user