mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move lookupApi into apiManager (#3540)
This commit is contained in:
1 parent
574aea40b4
commit
ee158e33df
16 files changed
+70
-90
No files matched your search
@@ -33,7 +33,7 @@ import { boundMethod, cssNames, prevDefault } from "../../utils";
|
||||
import type { ItemObject } from "../../item.store";
|
||||
import { Spinner } from "../spinner";
|
||||
import { ThemeStore } from "../../theme.store";
|
||||
import { lookupApiLink } from "../../api/kube-api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { kubeSelectedUrlParam, showDetails } from "../kube-detail-params";
|
||||
import { kubeWatchApi } from "../../api/kube-watch-api";
|
||||
|
||||
@@ -106,7 +106,7 @@ export class ClusterIssues extends React.Component<Props> {
|
||||
age: getAge(),
|
||||
message,
|
||||
kind,
|
||||
selfLink: lookupApiLink(involvedObject, error),
|
||||
selfLink: apiManager.lookupApiLink(involvedObject, error),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||
import { cssNames } from "../../utils";
|
||||
import { HorizontalPodAutoscaler, HpaMetricType, IHpaMetric } from "../../api/endpoints/hpa.api";
|
||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
import { lookupApiLink } from "../../api/kube-api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { KubeObjectMeta } from "../kube-object-meta";
|
||||
import { getDetailsUrl } from "../kube-detail-params";
|
||||
|
||||
@@ -55,7 +55,7 @@ export class HpaDetails extends React.Component<HpaDetailsProps> {
|
||||
case HpaMetricType.Object:
|
||||
const { target } = metric.object;
|
||||
const { kind, name } = target;
|
||||
const objectUrl = getDetailsUrl(lookupApiLink(target, hpa));
|
||||
const objectUrl = getDetailsUrl(apiManager.lookupApiLink(target, hpa));
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -108,7 +108,7 @@ export class HpaDetails extends React.Component<HpaDetailsProps> {
|
||||
|
||||
<DrawerItem name="Reference">
|
||||
{scaleTargetRef && (
|
||||
<Link to={getDetailsUrl(lookupApiLink(scaleTargetRef, hpa))}>
|
||||
<Link to={getDetailsUrl(apiManager.lookupApiLink(scaleTargetRef, hpa))}>
|
||||
{scaleTargetRef.kind}/{scaleTargetRef.name}
|
||||
</Link>
|
||||
)}
|
||||
|
||||
@@ -30,7 +30,7 @@ import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||
import type { KubeEvent } from "../../api/endpoints/events.api";
|
||||
import { KubeObjectMeta } from "../kube-object-meta";
|
||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
import { lookupApiLink } from "../../api/kube-api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { LocaleDate } from "../locale-date";
|
||||
import { getDetailsUrl } from "../kube-detail-params";
|
||||
|
||||
@@ -82,7 +82,7 @@ export class EventDetails extends React.Component<Props> {
|
||||
</TableHead>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Link to={getDetailsUrl(lookupApiLink(involvedObject, event))}>
|
||||
<Link to={getDetailsUrl(apiManager.lookupApiLink(involvedObject, event))}>
|
||||
{name}
|
||||
</Link>
|
||||
</TableCell>
|
||||
|
||||
@@ -35,7 +35,7 @@ import { Tooltip } from "../tooltip";
|
||||
import { Link } from "react-router-dom";
|
||||
import { cssNames, IClassName, stopPropagation } from "../../utils";
|
||||
import { Icon } from "../icon";
|
||||
import { lookupApiLink } from "../../api/kube-api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { eventsURL } from "../../../common/routes";
|
||||
import { getDetailsUrl } from "../kube-detail-params";
|
||||
|
||||
@@ -196,7 +196,7 @@ export class Events extends React.Component<Props> {
|
||||
)
|
||||
},
|
||||
event.getNs(),
|
||||
<Link key="link" to={getDetailsUrl(lookupApiLink(involvedObject, event))} onClick={stopPropagation}>
|
||||
<Link key="link" to={getDetailsUrl(apiManager.lookupApiLink(involvedObject, event))} onClick={stopPropagation}>
|
||||
{involvedObject.kind}: {involvedObject.name}
|
||||
</Link>,
|
||||
event.getSource(),
|
||||
|
||||
@@ -26,7 +26,7 @@ import { observer } from "mobx-react";
|
||||
import { EndpointSubset, Endpoint, EndpointAddress} from "../../api/endpoints";
|
||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
import { boundMethod } from "../../utils";
|
||||
import { lookupApiLink } from "../../api/kube-api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { Link } from "react-router-dom";
|
||||
import { getDetailsUrl } from "../kube-detail-params";
|
||||
|
||||
@@ -92,7 +92,7 @@ export class EndpointSubsetList extends React.Component<Props> {
|
||||
<TableCell className="name">{address.hostname}</TableCell>
|
||||
<TableCell className="target">
|
||||
{ address.targetRef && (
|
||||
<Link to={getDetailsUrl(lookupApiLink(address.getTargetRef(), endpoint))}>
|
||||
<Link to={getDetailsUrl(apiManager.lookupApiLink(address.getTargetRef(), endpoint))}>
|
||||
{address.targetRef.name}
|
||||
</Link>
|
||||
)}
|
||||
|
||||
@@ -35,7 +35,7 @@ import { jobStore } from "./job.store";
|
||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||
import { getMetricsForJobs, IPodMetrics, Job } from "../../api/endpoints";
|
||||
import { PodDetailsList } from "../+workloads-pods/pod-details-list";
|
||||
import { lookupApiLink } from "../../api/kube-api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { KubeObjectMeta } from "../kube-object-meta";
|
||||
import { makeObservable, observable } from "mobx";
|
||||
import { podMetricTabs, PodCharts } from "../+workloads-pods/pod-charts";
|
||||
@@ -117,7 +117,7 @@ export class JobDetails extends React.Component<Props> {
|
||||
{
|
||||
ownerRefs.map(ref => {
|
||||
const { name, kind } = ref;
|
||||
const detailsUrl = getDetailsUrl(lookupApiLink(ref, job));
|
||||
const detailsUrl = getDetailsUrl(apiManager.lookupApiLink(ref, job));
|
||||
|
||||
return (
|
||||
<p key={name}>
|
||||
|
||||
@@ -35,7 +35,7 @@ import { cssNames, stopPropagation } from "../../utils";
|
||||
import toPairs from "lodash/toPairs";
|
||||
import startCase from "lodash/startCase";
|
||||
import kebabCase from "lodash/kebabCase";
|
||||
import { lookupApiLink } from "../../api/kube-api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||
import { Badge } from "../badge";
|
||||
import type { PodsRouteParams } from "../../../common/routes";
|
||||
@@ -135,7 +135,7 @@ export class Pods extends React.Component<Props> {
|
||||
pod.getRestartsCount(),
|
||||
pod.getOwnerRefs().map(ref => {
|
||||
const { kind, name } = ref;
|
||||
const detailsLink = getDetailsUrl(lookupApiLink(ref, pod));
|
||||
const detailsLink = getDetailsUrl(apiManager.lookupApiLink(ref, pod));
|
||||
|
||||
return (
|
||||
<Badge flat key={name} className="owner" tooltip={name}>
|
||||
|
||||
@@ -105,7 +105,7 @@ export class CreateResource extends React.Component<Props> {
|
||||
await Promise.all(
|
||||
resources.map(data => {
|
||||
return resourceApplierApi.update(data)
|
||||
.then(item => createdResources.push(item.getName()))
|
||||
.then(item => createdResources.push(item.metadata.name))
|
||||
.catch((err: JsonApiErrorParsed) => errors.push(err.toString()));
|
||||
})
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
import React from "react";
|
||||
import type { KubeMetaField, KubeObject } from "../../api/kube-object";
|
||||
import { DrawerItem, DrawerItemLabels } from "../drawer";
|
||||
import { lookupApiLink } from "../../api/kube-api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { Link } from "react-router-dom";
|
||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||
import { LocaleDate } from "../locale-date";
|
||||
@@ -93,7 +93,7 @@ export class KubeObjectMeta extends React.Component<KubeObjectMetaProps> {
|
||||
{
|
||||
ownerRefs.map(ref => {
|
||||
const { name, kind } = ref;
|
||||
const ownerDetailsUrl = getDetailsUrl(lookupApiLink(ref, object));
|
||||
const ownerDetailsUrl = getDetailsUrl(apiManager.lookupApiLink(ref, object));
|
||||
|
||||
return (
|
||||
<p key={name}>
|
||||
|
||||
Reference in new issue
Block a user