mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Display node column in pods list
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
d35feab6ea
commit
56b391ed10
@ -6,6 +6,14 @@
|
|||||||
flex-grow: 2;
|
flex-grow: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.age {
|
||||||
|
flex-grow: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.qos {
|
||||||
|
flex-grow: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
&.warning {
|
&.warning {
|
||||||
@include table-cell-warning;
|
@include table-cell-warning;
|
||||||
}
|
}
|
||||||
@ -22,6 +30,7 @@
|
|||||||
|
|
||||||
&.status {
|
&.status {
|
||||||
@include pod-status-colors;
|
@include pod-status-colors;
|
||||||
|
flex-grow: 0.7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,7 +10,7 @@ import { volumeClaimStore } from "../+storage-volume-claims/volume-claim.store";
|
|||||||
import { IPodsRouteParams } from "../+workloads";
|
import { IPodsRouteParams } from "../+workloads";
|
||||||
import { eventStore } from "../+events/event.store";
|
import { eventStore } from "../+events/event.store";
|
||||||
import { KubeObjectListLayout } from "../kube-object";
|
import { KubeObjectListLayout } from "../kube-object";
|
||||||
import { Pod } from "../../api/endpoints";
|
import { nodesApi, Pod } from "../../api/endpoints";
|
||||||
import { StatusBrick } from "../status-brick";
|
import { StatusBrick } from "../status-brick";
|
||||||
import { cssNames, stopPropagation } from "../../utils";
|
import { cssNames, stopPropagation } from "../../utils";
|
||||||
import { getDetailsUrl } from "../../navigation";
|
import { getDetailsUrl } from "../../navigation";
|
||||||
@ -19,6 +19,7 @@ import startCase from "lodash/startCase";
|
|||||||
import kebabCase from "lodash/kebabCase";
|
import kebabCase from "lodash/kebabCase";
|
||||||
import { lookupApiLink } from "../../api/kube-api";
|
import { lookupApiLink } from "../../api/kube-api";
|
||||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||||
|
import { Span } from "../span";
|
||||||
|
|
||||||
|
|
||||||
enum sortBy {
|
enum sortBy {
|
||||||
@ -28,6 +29,7 @@ enum sortBy {
|
|||||||
restarts = "restarts",
|
restarts = "restarts",
|
||||||
age = "age",
|
age = "age",
|
||||||
qos = "qos",
|
qos = "qos",
|
||||||
|
node = "node",
|
||||||
owners = "owners",
|
owners = "owners",
|
||||||
status = "status",
|
status = "status",
|
||||||
}
|
}
|
||||||
@ -81,6 +83,7 @@ export class Pods extends React.Component<Props> {
|
|||||||
[sortBy.restarts]: (pod: Pod) => pod.getRestartsCount(),
|
[sortBy.restarts]: (pod: Pod) => pod.getRestartsCount(),
|
||||||
[sortBy.owners]: (pod: Pod) => pod.getOwnerRefs().map(ref => ref.kind),
|
[sortBy.owners]: (pod: Pod) => pod.getOwnerRefs().map(ref => ref.kind),
|
||||||
[sortBy.qos]: (pod: Pod) => pod.getQosClass(),
|
[sortBy.qos]: (pod: Pod) => pod.getQosClass(),
|
||||||
|
[sortBy.node]: (pod: Pod) => pod.getNodeName(),
|
||||||
[sortBy.age]: (pod: Pod) => pod.metadata.creationTimestamp,
|
[sortBy.age]: (pod: Pod) => pod.metadata.creationTimestamp,
|
||||||
[sortBy.status]: (pod: Pod) => pod.getStatusMessage(),
|
[sortBy.status]: (pod: Pod) => pod.getStatusMessage(),
|
||||||
}}
|
}}
|
||||||
@ -88,6 +91,7 @@ export class Pods extends React.Component<Props> {
|
|||||||
(pod: Pod) => pod.getSearchFields(),
|
(pod: Pod) => pod.getSearchFields(),
|
||||||
(pod: Pod) => pod.getStatusMessage(),
|
(pod: Pod) => pod.getStatusMessage(),
|
||||||
(pod: Pod) => pod.status.podIP,
|
(pod: Pod) => pod.status.podIP,
|
||||||
|
(pod: Pod) => pod.getNodeName(),
|
||||||
]}
|
]}
|
||||||
renderHeaderTitle={<Trans>Pods</Trans>}
|
renderHeaderTitle={<Trans>Pods</Trans>}
|
||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
@ -97,12 +101,13 @@ export class Pods extends React.Component<Props> {
|
|||||||
{ title: <Trans>Containers</Trans>, className: "containers", sortBy: sortBy.containers },
|
{ title: <Trans>Containers</Trans>, className: "containers", sortBy: sortBy.containers },
|
||||||
{ title: <Trans>Restarts</Trans>, className: "restarts", sortBy: sortBy.restarts },
|
{ title: <Trans>Restarts</Trans>, className: "restarts", sortBy: sortBy.restarts },
|
||||||
{ title: <Trans>Controlled By</Trans>, className: "owners", sortBy: sortBy.owners },
|
{ title: <Trans>Controlled By</Trans>, className: "owners", sortBy: sortBy.owners },
|
||||||
|
{ title: <Trans>Node</Trans>, className: "node", sortBy: sortBy.node },
|
||||||
{ title: <Trans>QoS</Trans>, className: "qos", sortBy: sortBy.qos },
|
{ title: <Trans>QoS</Trans>, className: "qos", sortBy: sortBy.qos },
|
||||||
{ title: <Trans>Age</Trans>, className: "age", sortBy: sortBy.age },
|
{ title: <Trans>Age</Trans>, className: "age", sortBy: sortBy.age },
|
||||||
{ title: <Trans>Status</Trans>, className: "status", sortBy: sortBy.status },
|
{ title: <Trans>Status</Trans>, className: "status", sortBy: sortBy.status },
|
||||||
]}
|
]}
|
||||||
renderTableContents={(pod: Pod) => [
|
renderTableContents={(pod: Pod) => [
|
||||||
pod.getName(),
|
<Span key="name" label={pod.getName()} tooltip={pod.getName()}></Span>,
|
||||||
<KubeObjectStatusIcon key="icon" object={pod} />,
|
<KubeObjectStatusIcon key="icon" object={pod} />,
|
||||||
pod.getNs(),
|
pod.getNs(),
|
||||||
this.renderContainersStatus(pod),
|
this.renderContainersStatus(pod),
|
||||||
@ -112,11 +117,20 @@ export class Pods extends React.Component<Props> {
|
|||||||
const detailsLink = getDetailsUrl(lookupApiLink(ref, pod));
|
const detailsLink = getDetailsUrl(lookupApiLink(ref, pod));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link key={name} to={detailsLink} className="owner" onClick={stopPropagation}>
|
<Span key={name} className="owner" tooltip={name}>
|
||||||
{kind}
|
<Link to={detailsLink} onClick={stopPropagation}>
|
||||||
</Link>
|
{kind}
|
||||||
|
</Link>
|
||||||
|
</Span>
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
pod.getNodeName() ?
|
||||||
|
<Span key="node" className="node" tooltip={pod.getNodeName()}>
|
||||||
|
<Link to={getDetailsUrl(nodesApi.getUrl({ name: pod.getNodeName() }))} onClick={stopPropagation}>
|
||||||
|
{pod.getNodeName()}
|
||||||
|
</Link>
|
||||||
|
</Span>
|
||||||
|
: "",
|
||||||
pod.getQosClass(),
|
pod.getQosClass(),
|
||||||
pod.getAge(),
|
pod.getAge(),
|
||||||
{ title: pod.getStatusMessage(), className: kebabCase(pod.getStatusMessage()) }
|
{ title: pod.getStatusMessage(), className: kebabCase(pod.getStatusMessage()) }
|
||||||
|
|||||||
1
src/renderer/components/span/index.ts
Normal file
1
src/renderer/components/span/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./span";
|
||||||
20
src/renderer/components/span/span.tsx
Normal file
20
src/renderer/components/span/span.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { TooltipDecoratorProps, withTooltip } from "../tooltip";
|
||||||
|
|
||||||
|
export interface SpanProps extends React.HTMLAttributes<any>, TooltipDecoratorProps {
|
||||||
|
label?: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@withTooltip
|
||||||
|
export class Span extends React.Component<SpanProps> {
|
||||||
|
render() {
|
||||||
|
const { className, label, children, ...elemProps } = this.props;
|
||||||
|
|
||||||
|
return <>
|
||||||
|
<span className={className} {...elemProps}>
|
||||||
|
{label}
|
||||||
|
{children}
|
||||||
|
</span>
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user