mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove usages of legacy global configMapApi
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
36c54fb6e4
commit
888077d8f6
2 files changed
+25
-12
No files matched your search
@@ -3,18 +3,37 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import React from "react";
|
||||
import { configMapApi } from "../../../../../../common/k8s-api/endpoints";
|
||||
import type { VolumeVariantComponent } from "../variant-helpers";
|
||||
import type { ConfigMapApi } from "../../../../../../common/k8s-api/endpoints";
|
||||
import configMapApiInjectable from "../../../../../../common/k8s-api/endpoints/config-map.api.injectable";
|
||||
import type { PodVolumeVariantSpecificProps } from "../variant-helpers";
|
||||
import { LocalRef } from "../variant-helpers";
|
||||
|
||||
export const ConfigMap: VolumeVariantComponent<"configMap"> = (
|
||||
({ pod, variant: { name }}) => (
|
||||
interface Dependencies {
|
||||
configMapApi: ConfigMapApi;
|
||||
}
|
||||
|
||||
const NonInjectedConfigMap = (props: PodVolumeVariantSpecificProps<"configMap"> & Dependencies) => {
|
||||
const {
|
||||
pod,
|
||||
variant: { name },
|
||||
configMapApi,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<LocalRef
|
||||
pod={pod}
|
||||
title="Name"
|
||||
kubeRef={{ name }}
|
||||
api={configMapApi}
|
||||
/>
|
||||
)
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
export const ConfigMap = withInjectables<Dependencies, PodVolumeVariantSpecificProps<"configMap">>(NonInjectedConfigMap, {
|
||||
getProps: (di, props) => ({
|
||||
...props,
|
||||
configMapApi: di.inject(configMapApiInjectable),
|
||||
}),
|
||||
});
|
||||
Reference in new issue
Block a user