mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix editing of kube resource (#5906)
This commit is contained in:
1 parent
b94672b5a8
commit
e682c7de45
59 files changed
+14123
-298
No files matched your search
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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 { parseKubeApi } from "../kube-api-parse";
|
||||
import { kubeApiInjectionToken } from "./kube-api-injection-token";
|
||||
import type { KubeApi } from "../kube-api";
|
||||
|
||||
const getKubeApiFromPathInjectable = getInjectable({
|
||||
id: "get-kube-api-from-path",
|
||||
|
||||
instantiate: (di) => {
|
||||
const kubeApis = di.injectMany(kubeApiInjectionToken);
|
||||
|
||||
return (apiPath: string) => {
|
||||
const parsed = parseKubeApi(apiPath);
|
||||
|
||||
const kubeApi = kubeApis.find((api) => api.apiBase === parsed.apiBase);
|
||||
|
||||
return (kubeApi as KubeApi) || undefined;
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default getKubeApiFromPathInjectable;
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { KubeApi } from "../kube-api";
|
||||
|
||||
export const kubeApiInjectionToken = getInjectionToken<KubeApi<any, any>>({
|
||||
id: "kube-api-injection-token",
|
||||
});
|
||||
Reference in new issue
Block a user