mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove usages of legacy global serviceApi
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
a9fa8fa0df
commit
6b769cfa07
@ -14,7 +14,6 @@ import podApiInjectable from "./pod.api.injectable";
|
|||||||
import resourceQuotaApiInjectable from "./resource-quota.api.injectable";
|
import resourceQuotaApiInjectable from "./resource-quota.api.injectable";
|
||||||
import roleApiInjectable from "./role.api.injectable";
|
import roleApiInjectable from "./role.api.injectable";
|
||||||
import secretApiInjectable from "./secret.api.injectable";
|
import secretApiInjectable from "./secret.api.injectable";
|
||||||
import serviceApiInjectable from "./service.api.injectable";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use `di.inject(roleApiInjectable)` instead
|
* @deprecated use `di.inject(roleApiInjectable)` instead
|
||||||
@ -65,8 +64,3 @@ export const resourceQuotaApi = asLegacyGlobalForExtensionApi(resourceQuotaApiIn
|
|||||||
* @deprecated use `di.inject(secretApiInjectable)` instead
|
* @deprecated use `di.inject(secretApiInjectable)` instead
|
||||||
*/
|
*/
|
||||||
export const secretApi = asLegacyGlobalForExtensionApi(secretApiInjectable);
|
export const secretApi = asLegacyGlobalForExtensionApi(secretApiInjectable);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `di.inject(serviceApiInjectable)` instead
|
|
||||||
*/
|
|
||||||
export const serviceApi = asLegacyGlobalForExtensionApi(serviceApiInjectable);
|
|
||||||
|
|||||||
@ -11,19 +11,33 @@ import type { PortForwardItem } from "../../port-forward";
|
|||||||
import { portForwardAddress } from "../../port-forward";
|
import { portForwardAddress } from "../../port-forward";
|
||||||
import { Drawer, DrawerItem } from "../drawer";
|
import { Drawer, DrawerItem } from "../drawer";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
import { podApi, serviceApi } from "../../../common/k8s-api/endpoints";
|
import type { PodApi, ServiceApi } from "../../../common/k8s-api/endpoints";
|
||||||
import { getDetailsUrl } from "../kube-detail-params";
|
|
||||||
import { PortForwardMenu } from "./port-forward-menu";
|
import { PortForwardMenu } from "./port-forward-menu";
|
||||||
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
|
import serviceApiInjectable from "../../../common/k8s-api/endpoints/service.api.injectable";
|
||||||
|
import type { GetDetailsUrl } from "../kube-detail-params/get-details-url.injectable";
|
||||||
|
import getDetailsUrlInjectable from "../kube-detail-params/get-details-url.injectable";
|
||||||
|
import podApiInjectable from "../../../common/k8s-api/endpoints/pod.api.injectable";
|
||||||
|
|
||||||
export interface PortForwardDetailsProps {
|
export interface PortForwardDetailsProps {
|
||||||
portForward: PortForwardItem;
|
portForward: PortForwardItem;
|
||||||
hideDetails(): void;
|
hideDetails(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PortForwardDetails extends React.Component<PortForwardDetailsProps> {
|
interface Dependencies {
|
||||||
|
serviceApi: ServiceApi;
|
||||||
|
getDetailsUrl: GetDetailsUrl;
|
||||||
|
podApi: PodApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
class NonInjectedPortForwardDetails extends React.Component<PortForwardDetailsProps & Dependencies> {
|
||||||
renderResourceName() {
|
renderResourceName() {
|
||||||
const { portForward } = this.props;
|
const {
|
||||||
|
portForward,
|
||||||
|
serviceApi,
|
||||||
|
podApi,
|
||||||
|
getDetailsUrl,
|
||||||
|
} = this.props;
|
||||||
const name = portForward.getName();
|
const name = portForward.getName();
|
||||||
const api = {
|
const api = {
|
||||||
"service": serviceApi,
|
"service": serviceApi,
|
||||||
@ -37,7 +51,7 @@ export class PortForwardDetails extends React.Component<PortForwardDetailsProps>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link to={getDetailsUrl(api.getUrl({ name, namespace: portForward.getNs() }))}>
|
<Link to={getDetailsUrl(api.formatUrlForNotListing({ name, namespace: portForward.getNs() }))}>
|
||||||
{name}
|
{name}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
@ -99,3 +113,12 @@ export class PortForwardDetails extends React.Component<PortForwardDetailsProps>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const PortForwardDetails = withInjectables<Dependencies, PortForwardDetailsProps>(NonInjectedPortForwardDetails, {
|
||||||
|
getProps: (di, props) => ({
|
||||||
|
...props,
|
||||||
|
serviceApi: di.inject(serviceApiInjectable),
|
||||||
|
getDetailsUrl: di.inject(getDetailsUrlInjectable),
|
||||||
|
podApi: di.inject(podApiInjectable),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user