mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove last usages of legacy global getDetailsUrl
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
f145cb2fd0
commit
b7b1e97a7b
@ -14,7 +14,6 @@ import type { JobStore } from "../+workloads-jobs/store";
|
||||
import { Link } from "react-router-dom";
|
||||
import type { CronJobStore } from "./store";
|
||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||
import { getDetailsUrl } from "../kube-detail-params";
|
||||
import type { Job } from "../../../common/k8s-api/endpoints";
|
||||
import { CronJob } from "../../../common/k8s-api/endpoints";
|
||||
import type { Logger } from "../../../common/logger";
|
||||
@ -24,6 +23,8 @@ import subscribeStoresInjectable from "../../kube-watch-api/subscribe-stores.inj
|
||||
import cronJobStoreInjectable from "./store.injectable";
|
||||
import jobStoreInjectable from "../+workloads-jobs/store.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import type { GetDetailsUrl } from "../kube-detail-params/get-details-url.injectable";
|
||||
import getDetailsUrlInjectable from "../kube-detail-params/get-details-url.injectable";
|
||||
|
||||
export interface CronJobDetailsProps extends KubeObjectDetailsProps<CronJob> {
|
||||
}
|
||||
@ -33,6 +34,7 @@ interface Dependencies {
|
||||
jobStore: JobStore;
|
||||
cronJobStore: CronJobStore;
|
||||
logger: Logger;
|
||||
getDetailsUrl: GetDetailsUrl;
|
||||
}
|
||||
|
||||
@observer
|
||||
@ -46,7 +48,7 @@ class NonInjectedCronJobDetails extends React.Component<CronJobDetailsProps & De
|
||||
}
|
||||
|
||||
render() {
|
||||
const { object: cronJob, jobStore, cronJobStore } = this.props;
|
||||
const { object: cronJob, jobStore, cronJobStore, getDetailsUrl } = this.props;
|
||||
|
||||
if (!cronJob) {
|
||||
return null;
|
||||
@ -126,5 +128,6 @@ export const CronJobDetails = withInjectables<Dependencies, CronJobDetailsProps>
|
||||
cronJobStore: di.inject(cronJobStoreInjectable),
|
||||
jobStore: di.inject(jobStoreInjectable),
|
||||
logger: di.inject(loggerInjectable),
|
||||
getDetailsUrl: di.inject(getDetailsUrlInjectable),
|
||||
}),
|
||||
});
|
||||
|
||||
@ -2,13 +2,15 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import type { PodVolumeVariants, Pod, SecretReference } from "../../../../../common/k8s-api/endpoints";
|
||||
import type { KubeApiQueryParams, ResourceDescriptor } from "../../../../../common/k8s-api/kube-api";
|
||||
import type { LocalObjectReference } from "../../../../../common/k8s-api/kube-object";
|
||||
import { DrawerItem } from "../../../drawer";
|
||||
import { getDetailsUrl } from "../../../kube-detail-params";
|
||||
import type { GetDetailsUrl } from "../../../kube-detail-params/get-details-url.injectable";
|
||||
import getDetailsUrlInjectable from "../../../kube-detail-params/get-details-url.injectable";
|
||||
|
||||
export interface PodVolumeVariantSpecificProps<Kind extends keyof PodVolumeVariants> {
|
||||
variant: PodVolumeVariants[Kind];
|
||||
@ -29,16 +31,35 @@ export interface LocalRefProps {
|
||||
api: LocalRefPropsApi;
|
||||
}
|
||||
|
||||
export const LocalRef = ({ pod, title, kubeRef: ref, api }: LocalRefProps) => {
|
||||
if (!ref) {
|
||||
interface Dependencies {
|
||||
getDetailsUrl: GetDetailsUrl;
|
||||
}
|
||||
|
||||
const NonInjectedLocalRef = (props: LocalRefProps & Dependencies) => {
|
||||
const {
|
||||
pod,
|
||||
title,
|
||||
kubeRef,
|
||||
api,
|
||||
getDetailsUrl,
|
||||
} = props;
|
||||
|
||||
if (!kubeRef) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<DrawerItem name={title}>
|
||||
<Link to={getDetailsUrl(api.getUrl({ namespace: pod.getNs(), ...ref }))}>
|
||||
{ref.name}
|
||||
<Link to={getDetailsUrl(api.getUrl({ namespace: pod.getNs(), ...kubeRef }))}>
|
||||
{kubeRef.name}
|
||||
</Link>
|
||||
</DrawerItem>
|
||||
);
|
||||
};
|
||||
|
||||
export const LocalRef = withInjectables<Dependencies, LocalRefProps>(NonInjectedLocalRef, {
|
||||
getProps: (di, props) => ({
|
||||
...props,
|
||||
getDetailsUrl: di.inject(getDetailsUrlInjectable),
|
||||
}),
|
||||
});
|
||||
|
||||
@ -4,14 +4,8 @@
|
||||
*/
|
||||
|
||||
import { asLegacyGlobalFunctionForExtensionApi } from "../../../extensions/as-legacy-globals-for-extension-api/as-legacy-global-function-for-extension-api";
|
||||
import getDetailsUrlInjectable from "./get-details-url.injectable";
|
||||
import showDetailsInjectable from "./show-details.injectable";
|
||||
|
||||
/**
|
||||
* @deprecated use `di.inject(getDetailsUrlInjectable)` instead
|
||||
*/
|
||||
export const getDetailsUrl = asLegacyGlobalFunctionForExtensionApi(getDetailsUrlInjectable);
|
||||
|
||||
/**
|
||||
* @deprecated use `di.inject(showDetailsInjectable)` instead
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user