mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove usages of legacy global persistentVolumeClaimApi
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
5849e093f7
commit
e763df755a
@ -9,7 +9,6 @@ import cronJobApiInjectable from "./cron-job.api.injectable";
|
||||
import jobApiInjectable from "./job.api.injectable";
|
||||
import networkPolicyApiInjectable from "./network-policy.api.injectable";
|
||||
import nodeApiInjectable from "./node.api.injectable";
|
||||
import persistentVolumeClaimApiInjectable from "./persistent-volume-claim.api.injectable";
|
||||
import podApiInjectable from "./pod.api.injectable";
|
||||
import roleApiInjectable from "./role.api.injectable";
|
||||
|
||||
@ -47,8 +46,3 @@ export const networkPolicyApi = asLegacyGlobalForExtensionApi(networkPolicyApiIn
|
||||
* @deprecated use `di.inject(nodeApiInjectable)` instead
|
||||
*/
|
||||
export const nodeApi = asLegacyGlobalForExtensionApi(nodeApiInjectable);
|
||||
|
||||
/**
|
||||
* @deprecated use `di.inject(persistentVolumeClaimApiInjectable)` instead
|
||||
*/
|
||||
export const persistentVolumeClaimApi = asLegacyGlobalForExtensionApi(persistentVolumeClaimApiInjectable);
|
||||
|
||||
@ -3,18 +3,36 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import React from "react";
|
||||
import { persistentVolumeClaimApi } from "../../../../../../common/k8s-api/endpoints";
|
||||
import type { VolumeVariantComponent } from "../variant-helpers";
|
||||
import type { PersistentVolumeClaimApi } from "../../../../../../common/k8s-api/endpoints";
|
||||
import persistentVolumeClaimApiInjectable from "../../../../../../common/k8s-api/endpoints/persistent-volume-claim.api.injectable";
|
||||
import type { PodVolumeVariantSpecificProps } from "../variant-helpers";
|
||||
import { LocalRef } from "../variant-helpers";
|
||||
|
||||
export const PersistentVolumeClaim: VolumeVariantComponent<"persistentVolumeClaim"> = (
|
||||
({ pod, variant: { claimName }}) => (
|
||||
interface Dependencies {
|
||||
persistentVolumeClaimApi: PersistentVolumeClaimApi;
|
||||
}
|
||||
|
||||
const NonInjectedPersistentVolumeClaim = (props: PodVolumeVariantSpecificProps<"persistentVolumeClaim"> & Dependencies) => {
|
||||
const {
|
||||
pod,
|
||||
variant: { claimName },
|
||||
persistentVolumeClaimApi,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<LocalRef
|
||||
pod={pod}
|
||||
title="Name"
|
||||
kubeRef={{ name: claimName }}
|
||||
api={persistentVolumeClaimApi}
|
||||
/>
|
||||
)
|
||||
);
|
||||
api={persistentVolumeClaimApi} />
|
||||
);
|
||||
};
|
||||
|
||||
export const PersistentVolumeClaim = withInjectables<Dependencies, PodVolumeVariantSpecificProps<"persistentVolumeClaim">>(NonInjectedPersistentVolumeClaim, {
|
||||
getProps: (di, props) => ({
|
||||
...props,
|
||||
persistentVolumeClaimApi: di.inject(persistentVolumeClaimApiInjectable),
|
||||
}),
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user