1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/catalog/catalog-entities-from-features/clusters.injectable.ts
Janne Savolainen ff8f8e8b66 WIP
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
2022-11-16 15:55:24 +02:00

38 lines
1001 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
import { computed } from "mobx";
export interface ClusterDto {
id: string;
name: string;
source: string;
labels: Record<string, string>;
distribution: string;
kubeconfigPath: string;
contextName: string;
clusterServerUrl: string;
version: string;
}
export const clusterInjectionToken = getInjectionToken<ClusterDto>({
id: "cluster-injection-token",
});
const clustersInjectable = getInjectable({
id: "clusters",
instantiate: (di) => {
const computedInjectMany = di.inject(computedInjectManyInjectable);
const clusters = computedInjectMany(clusterInjectionToken);
return computed(() => clusters.get());
},
});
export default clustersInjectable;