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 { Link } from "react-router-dom";
|
||||||
import type { CronJobStore } from "./store";
|
import type { CronJobStore } from "./store";
|
||||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||||
import { getDetailsUrl } from "../kube-detail-params";
|
|
||||||
import type { Job } from "../../../common/k8s-api/endpoints";
|
import type { Job } from "../../../common/k8s-api/endpoints";
|
||||||
import { CronJob } from "../../../common/k8s-api/endpoints";
|
import { CronJob } from "../../../common/k8s-api/endpoints";
|
||||||
import type { Logger } from "../../../common/logger";
|
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 cronJobStoreInjectable from "./store.injectable";
|
||||||
import jobStoreInjectable from "../+workloads-jobs/store.injectable";
|
import jobStoreInjectable from "../+workloads-jobs/store.injectable";
|
||||||
import loggerInjectable from "../../../common/logger.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> {
|
export interface CronJobDetailsProps extends KubeObjectDetailsProps<CronJob> {
|
||||||
}
|
}
|
||||||
@ -33,6 +34,7 @@ interface Dependencies {
|
|||||||
jobStore: JobStore;
|
jobStore: JobStore;
|
||||||
cronJobStore: CronJobStore;
|
cronJobStore: CronJobStore;
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
|
getDetailsUrl: GetDetailsUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
@ -46,7 +48,7 @@ class NonInjectedCronJobDetails extends React.Component<CronJobDetailsProps & De
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { object: cronJob, jobStore, cronJobStore } = this.props;
|
const { object: cronJob, jobStore, cronJobStore, getDetailsUrl } = this.props;
|
||||||
|
|
||||||
if (!cronJob) {
|
if (!cronJob) {
|
||||||
return null;
|
return null;
|
||||||
@ -126,5 +128,6 @@ export const CronJobDetails = withInjectables<Dependencies, CronJobDetailsProps>
|
|||||||
cronJobStore: di.inject(cronJobStoreInjectable),
|
cronJobStore: di.inject(cronJobStoreInjectable),
|
||||||
jobStore: di.inject(jobStoreInjectable),
|
jobStore: di.inject(jobStoreInjectable),
|
||||||
logger: di.inject(loggerInjectable),
|
logger: di.inject(loggerInjectable),
|
||||||
|
getDetailsUrl: di.inject(getDetailsUrlInjectable),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,13 +2,15 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import type { PodVolumeVariants, Pod, SecretReference } from "../../../../../common/k8s-api/endpoints";
|
import type { PodVolumeVariants, Pod, SecretReference } from "../../../../../common/k8s-api/endpoints";
|
||||||
import type { KubeApiQueryParams, ResourceDescriptor } from "../../../../../common/k8s-api/kube-api";
|
import type { KubeApiQueryParams, ResourceDescriptor } from "../../../../../common/k8s-api/kube-api";
|
||||||
import type { LocalObjectReference } from "../../../../../common/k8s-api/kube-object";
|
import type { LocalObjectReference } from "../../../../../common/k8s-api/kube-object";
|
||||||
import { DrawerItem } from "../../../drawer";
|
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> {
|
export interface PodVolumeVariantSpecificProps<Kind extends keyof PodVolumeVariants> {
|
||||||
variant: PodVolumeVariants[Kind];
|
variant: PodVolumeVariants[Kind];
|
||||||
@ -29,16 +31,35 @@ export interface LocalRefProps {
|
|||||||
api: LocalRefPropsApi;
|
api: LocalRefPropsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const LocalRef = ({ pod, title, kubeRef: ref, api }: LocalRefProps) => {
|
interface Dependencies {
|
||||||
if (!ref) {
|
getDetailsUrl: GetDetailsUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NonInjectedLocalRef = (props: LocalRefProps & Dependencies) => {
|
||||||
|
const {
|
||||||
|
pod,
|
||||||
|
title,
|
||||||
|
kubeRef,
|
||||||
|
api,
|
||||||
|
getDetailsUrl,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
if (!kubeRef) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DrawerItem name={title}>
|
<DrawerItem name={title}>
|
||||||
<Link to={getDetailsUrl(api.getUrl({ namespace: pod.getNs(), ...ref }))}>
|
<Link to={getDetailsUrl(api.getUrl({ namespace: pod.getNs(), ...kubeRef }))}>
|
||||||
{ref.name}
|
{kubeRef.name}
|
||||||
</Link>
|
</Link>
|
||||||
</DrawerItem>
|
</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 { 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";
|
import showDetailsInjectable from "./show-details.injectable";
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `di.inject(getDetailsUrlInjectable)` instead
|
|
||||||
*/
|
|
||||||
export const getDetailsUrl = asLegacyGlobalFunctionForExtensionApi(getDetailsUrlInjectable);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use `di.inject(showDetailsInjectable)` instead
|
* @deprecated use `di.inject(showDetailsInjectable)` instead
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user