mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Make EntitySettingRegistry fully injectable Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add behavioural tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * Revert tsconfig change Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Update snapshot Signed-off-by: Sebastian Malton <sebastian@malton.name> * Improve naming Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
21 lines
848 B
TypeScript
21 lines
848 B
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable } from "@ogre-tools/injectable";
|
|
import { computed } from "mobx";
|
|
import catalogEntityRegistryInjectable from "../../api/catalog/entity/registry.injectable";
|
|
import entitySettingsRouteParametersInjectable from "./route-parameters.injectable";
|
|
|
|
const currentCatalogEntityForSettingsInjectable = getInjectable({
|
|
id: "current-catalog-entity-for-settings",
|
|
instantiate: (di) => {
|
|
const { entityId } = di.inject(entitySettingsRouteParametersInjectable);
|
|
const catalogEntityRegistry = di.inject(catalogEntityRegistryInjectable);
|
|
|
|
return computed(() => catalogEntityRegistry.getById(entityId.get()));
|
|
},
|
|
});
|
|
|
|
export default currentCatalogEntityForSettingsInjectable;
|