mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
add no-unused and react/recommended to eslint (#1523)
* add no-unused-vars and no-unused-imports * added quotes: double, and remove ignore pattern * move itif and describeif into utils Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
10eb082854
commit
7451869c25
199 files changed
+1178
-807
No files matched your search
@@ -11,10 +11,10 @@ import { WorkloadKubeObject } from "../../api/workload-kube-object";
|
||||
import { themeStore } from "../../theme.store";
|
||||
|
||||
export const podMetricTabs = [
|
||||
<Trans>CPU</Trans>,
|
||||
<Trans>Memory</Trans>,
|
||||
<Trans>Network</Trans>,
|
||||
<Trans>Filesystem</Trans>,
|
||||
<Trans key="cpu">CPU</Trans>,
|
||||
<Trans key="memory">Memory</Trans>,
|
||||
<Trans key="network">Network</Trans>,
|
||||
<Trans key="filesystem">Filesystem</Trans>,
|
||||
];
|
||||
|
||||
type IContext = IResourceMetricsValue<WorkloadKubeObject, { metrics: IPodMetrics }>;
|
||||
@@ -128,4 +128,4 @@ export const PodCharts = observer(() => {
|
||||
data={{ datasets: datasets[tabId] }}
|
||||
/>
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -40,7 +40,7 @@ export const ContainerEnvironment = observer((props: Props) => {
|
||||
);
|
||||
|
||||
const renderEnv = () => {
|
||||
const orderedEnv = _.sortBy(env, 'name');
|
||||
const orderedEnv = _.sortBy(env, "name");
|
||||
|
||||
return orderedEnv.map(variable => {
|
||||
const { name, value, valueFrom } = variable;
|
||||
|
||||
@@ -3,7 +3,7 @@ import "./pod-container-port.scss";
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { t } from "@lingui/macro";
|
||||
import { Pod, IPodContainer } from "../../api/endpoints";
|
||||
import { Pod } from "../../api/endpoints";
|
||||
import { _i18n } from "../../i18n";
|
||||
import { apiBase } from "../../api";
|
||||
import { observable } from "mobx";
|
||||
@@ -39,7 +39,7 @@ export class PodContainerPort extends React.Component<Props> {
|
||||
render() {
|
||||
const { port } = this.props;
|
||||
const { name, containerPort, protocol } = port;
|
||||
const text = (name ? name + ': ' : '')+`${containerPort}/${protocol}`;
|
||||
const text = (name ? name + ": " : "")+`${containerPort}/${protocol}`;
|
||||
return (
|
||||
<div className={cssNames("PodContainerPort", { waiting: this.waiting })}>
|
||||
<span title={_i18n._(t`Open in a browser`)} onClick={() => this.portForward() }>
|
||||
|
||||
@@ -21,27 +21,27 @@ interface Props {
|
||||
}
|
||||
|
||||
export class PodDetailsContainer extends React.Component<Props> {
|
||||
|
||||
|
||||
renderStatus(state: string, status: IPodContainerStatus) {
|
||||
const ready = status ? status.ready : "";
|
||||
return (
|
||||
<span className={cssNames("status", state)}>
|
||||
{state}{ready ? `, ${_i18n._(t`ready`)}` : ""}
|
||||
{state === 'terminated' ? ` - ${status.state.terminated.reason} (${_i18n._(t`exit code`)}: ${status.state.terminated.exitCode})` : ''}
|
||||
</span>
|
||||
{state === "terminated" ? ` - ${status.state.terminated.reason} (${_i18n._(t`exit code`)}: ${status.state.terminated.exitCode})` : ""}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
renderLastState(lastState: string, status: IPodContainerStatus) {
|
||||
if (lastState === 'terminated') {
|
||||
if (lastState === "terminated") {
|
||||
return (
|
||||
<span>
|
||||
{lastState}<br/>
|
||||
{_i18n._(t`Reason`)}: {status.lastState.terminated.reason} - {_i18n._(t`exit code`)}: {status.lastState.terminated.exitCode}<br/>
|
||||
{_i18n._(t`Started at`)}: {status.lastState.terminated.startedAt}<br/>
|
||||
{_i18n._(t`Finished at`)}: {status.lastState.terminated.finishedAt}<br/>
|
||||
{lastState}<br/>
|
||||
{_i18n._(t`Reason`)}: {status.lastState.terminated.reason} - {_i18n._(t`exit code`)}: {status.lastState.terminated.exitCode}<br/>
|
||||
{_i18n._(t`Started at`)}: {status.lastState.terminated.startedAt}<br/>
|
||||
{_i18n._(t`Finished at`)}: {status.lastState.terminated.finishedAt}<br/>
|
||||
</span>
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ export class PodDetailsContainer extends React.Component<Props> {
|
||||
const readiness = pod.getReadinessProbe(container);
|
||||
const isInitContainer = !!pod.getInitContainers().find(c => c.name == name);
|
||||
const metricTabs = [
|
||||
<Trans>CPU</Trans>,
|
||||
<Trans>Memory</Trans>,
|
||||
<Trans>Filesystem</Trans>,
|
||||
<Trans key="cpu">CPU</Trans>,
|
||||
<Trans key="memory">Memory</Trans>,
|
||||
<Trans key="filesystem">Filesystem</Trans>,
|
||||
];
|
||||
return (
|
||||
<div className="PodDetailsContainer">
|
||||
@@ -110,7 +110,7 @@ export class PodDetailsContainer extends React.Component<Props> {
|
||||
return (
|
||||
<React.Fragment key={name + mountPath}>
|
||||
<span className="mount-path">{mountPath}</span>
|
||||
<span className="mount-from">from {name} ({readOnly ? 'ro' : 'rw'})</span>
|
||||
<span className="mount-from">from {name} ({readOnly ? "ro" : "rw"})</span>
|
||||
</React.Fragment>
|
||||
);
|
||||
})
|
||||
@@ -137,16 +137,16 @@ export class PodDetailsContainer extends React.Component<Props> {
|
||||
}
|
||||
{command &&
|
||||
<DrawerItem name={<Trans>Command</Trans>}>
|
||||
{command.join(' ')}
|
||||
{command.join(" ")}
|
||||
</DrawerItem>
|
||||
}
|
||||
|
||||
{args &&
|
||||
<DrawerItem name={<Trans>Arguments</Trans>}>
|
||||
{args.join(' ')}
|
||||
{args.join(" ")}
|
||||
</DrawerItem>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ export class PodDetailsList extends React.Component<Props> {
|
||||
onClick={prevDefault(() => showDetails(pod.selfLink, false))}
|
||||
>
|
||||
<TableCell className="name">{pod.getName()}</TableCell>
|
||||
<TableCell className="warning"><KubeObjectStatusIcon object={pod}/></TableCell>
|
||||
<TableCell className="warning"><KubeObjectStatusIcon key="icon" object={pod}/></TableCell>
|
||||
<TableCell className="namespace">{pod.getNs()}</TableCell>
|
||||
<TableCell className="cpu">{this.renderCpuUsage(`cpu-${pod.getId()}`, metrics.cpu)}</TableCell>
|
||||
<TableCell className="memory">{this.renderMemoryUsage(`memory-${pod.getId()}`, metrics.memory)}</TableCell>
|
||||
|
||||
@@ -102,7 +102,7 @@ export class Pods extends React.Component<Props> {
|
||||
]}
|
||||
renderTableContents={(pod: Pod) => [
|
||||
pod.getName(),
|
||||
<KubeObjectStatusIcon object={pod} />,
|
||||
<KubeObjectStatusIcon key="icon" object={pod} />,
|
||||
pod.getNs(),
|
||||
this.renderContainersStatus(pod),
|
||||
pod.getRestartsCount(),
|
||||
|
||||
Reference in new issue
Block a user