mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add eslint rule padding-line-between-statements (#1593)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
7b77f18376
commit
dcf253e7d5
401 files changed
+2018
-40
No files matched your search
@@ -134,6 +134,7 @@ export const NodeCharts = observer(() => {
|
||||
label: ({ datasetIndex, index }, { datasets }) => {
|
||||
const { label, data } = datasets[datasetIndex];
|
||||
const value = data[index] as ChartPoint;
|
||||
|
||||
return `${label}: ${value.y}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ export class NodeDetails extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { object: node } = this.props;
|
||||
|
||||
if (!node) return;
|
||||
const { status } = node;
|
||||
const { nodeInfo, addresses, capacity, allocatable } = status;
|
||||
@@ -54,6 +55,7 @@ export class NodeDetails extends React.Component<Props> {
|
||||
<Trans key="disk">Disk</Trans>,
|
||||
<Trans key="pods">Pods</Trans>,
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="NodeDetails">
|
||||
{podsStore.isLoaded && (
|
||||
@@ -121,6 +123,7 @@ export class NodeDetails extends React.Component<Props> {
|
||||
{
|
||||
conditions.map(condition => {
|
||||
const { type } = condition;
|
||||
|
||||
return (
|
||||
<Badge
|
||||
key={type}
|
||||
|
||||
@@ -16,6 +16,7 @@ export class NodesStore extends KubeObjectStore<Node> {
|
||||
@action
|
||||
async loadUsageMetrics() {
|
||||
this.metricsLoading = true;
|
||||
|
||||
try {
|
||||
this.metrics = await nodesApi.getMetrics();
|
||||
this.metricsLoaded = true;
|
||||
@@ -42,6 +43,7 @@ export class NodesStore extends KubeObjectStore<Node> {
|
||||
return;
|
||||
}
|
||||
const nodeName = node.getName();
|
||||
|
||||
return metricNames.map(metricName => {
|
||||
try {
|
||||
const metric = this.metrics[metricName];
|
||||
@@ -52,6 +54,7 @@ export class NodesStore extends KubeObjectStore<Node> {
|
||||
result.metric.kubernetes_node,
|
||||
].includes(nodeName);
|
||||
});
|
||||
|
||||
return result ? parseFloat(result.values.slice(-1)[0][1]) : 0;
|
||||
} catch (e) {
|
||||
return 0;
|
||||
|
||||
@@ -48,9 +48,11 @@ export class Nodes extends React.Component<Props> {
|
||||
|
||||
renderCpuUsage(node: Node) {
|
||||
const metrics = nodesStore.getLastMetricValues(node, ["cpuUsage", "cpuCapacity"]);
|
||||
|
||||
if (!metrics || !metrics[1]) return <LineProgress value={0}/>;
|
||||
const usage = metrics[0];
|
||||
const cores = metrics[1];
|
||||
|
||||
return (
|
||||
<LineProgress
|
||||
max={cores}
|
||||
@@ -65,9 +67,11 @@ export class Nodes extends React.Component<Props> {
|
||||
|
||||
renderMemoryUsage(node: Node) {
|
||||
const metrics = nodesStore.getLastMetricValues(node, ["memoryUsage", "memoryCapacity"]);
|
||||
|
||||
if (!metrics || !metrics[1]) return <LineProgress value={0}/>;
|
||||
const usage = metrics[0];
|
||||
const capacity = metrics[1];
|
||||
|
||||
return (
|
||||
<LineProgress
|
||||
max={capacity}
|
||||
@@ -82,9 +86,11 @@ export class Nodes extends React.Component<Props> {
|
||||
|
||||
renderDiskUsage(node: Node): any {
|
||||
const metrics = nodesStore.getLastMetricValues(node, ["fsUsage", "fsSize"]);
|
||||
|
||||
if (!metrics || !metrics[1]) return <LineProgress value={0}/>;
|
||||
const usage = metrics[0];
|
||||
const capacity = metrics[1];
|
||||
|
||||
return (
|
||||
<LineProgress
|
||||
max={capacity}
|
||||
@@ -102,9 +108,11 @@ export class Nodes extends React.Component<Props> {
|
||||
return null;
|
||||
}
|
||||
const conditions = node.getActiveConditions();
|
||||
|
||||
return conditions.map(condition => {
|
||||
const { type } = condition;
|
||||
const tooltipId = `node-${node.getName()}-condition-${type}`;
|
||||
|
||||
return (
|
||||
<div key={type} id={tooltipId} className={cssNames("condition", kebabCase(type))}>
|
||||
{type}
|
||||
@@ -161,6 +169,7 @@ export class Nodes extends React.Component<Props> {
|
||||
]}
|
||||
renderTableContents={(node: Node) => {
|
||||
const tooltipId = `node-taints-${node.getId()}`;
|
||||
|
||||
return [
|
||||
node.getName(),
|
||||
<KubeObjectStatusIcon key="icon" object={node} />,
|
||||
|
||||
Reference in new issue
Block a user