mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Lint: comma-spacing (error) & comma-dangle (error) (#4200)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
02e77afcd1
commit
c6dce043a7
406 files changed
+1590
-1580
No files matched your search
@@ -40,23 +40,23 @@ export const ClusterMetrics = observer(() => {
|
||||
const colors = { cpu: "#3D90CE", memory: "#C93DCE" };
|
||||
const data = metricValues.map(value => ({
|
||||
x: value[0],
|
||||
y: parseFloat(value[1]).toFixed(3)
|
||||
y: parseFloat(value[1]).toFixed(3),
|
||||
}));
|
||||
|
||||
const datasets = [{
|
||||
id: metricType + metricNodeRole,
|
||||
label: `${metricType.toUpperCase()} usage`,
|
||||
borderColor: colors[metricType],
|
||||
data
|
||||
data,
|
||||
}];
|
||||
const cpuOptions: ChartOptions = {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
suggestedMax: cpuCapacity,
|
||||
callback: (value) => value
|
||||
}
|
||||
}]
|
||||
callback: (value) => value,
|
||||
},
|
||||
}],
|
||||
},
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
@@ -64,18 +64,18 @@ export const ClusterMetrics = observer(() => {
|
||||
const value = data.datasets[0].data[index] as ChartPoint;
|
||||
|
||||
return value.y.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const memoryOptions: ChartOptions = {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
suggestedMax: memoryCapacity,
|
||||
callback: (value: string) => !value ? 0 : bytesToUnits(parseInt(value))
|
||||
}
|
||||
}]
|
||||
callback: (value: string) => !value ? 0 : bytesToUnits(parseInt(value)),
|
||||
},
|
||||
}],
|
||||
},
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
@@ -83,9 +83,9 @@ export const ClusterMetrics = observer(() => {
|
||||
const value = data.datasets[0].data[index] as ChartPoint;
|
||||
|
||||
return bytesToUnits(parseInt(value.y as string), 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const options = metricType === MetricType.CPU ? cpuOptions : memoryOptions;
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ import { apiManager } from "../../../common/k8s-api/api-manager";
|
||||
|
||||
export enum MetricType {
|
||||
MEMORY = "memory",
|
||||
CPU = "cpu"
|
||||
CPU = "cpu",
|
||||
}
|
||||
|
||||
export enum MetricNodeRole {
|
||||
MASTER = "master",
|
||||
WORKER = "worker"
|
||||
WORKER = "worker",
|
||||
}
|
||||
|
||||
export interface ClusterOverviewStorageState {
|
||||
|
||||
@@ -60,7 +60,7 @@ export class ClusterOverview extends React.Component {
|
||||
}),
|
||||
reaction(
|
||||
() => clusterOverviewStore.metricNodeRole, // Toggle Master/Worker node switcher
|
||||
() => this.metricPoller.restart(true)
|
||||
() => this.metricPoller.restart(true),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export const ClusterPieCharts = observer(() => {
|
||||
defaultColor,
|
||||
],
|
||||
id: "cpuUsage",
|
||||
label: "Usage"
|
||||
label: "Usage",
|
||||
},
|
||||
{
|
||||
data: [
|
||||
@@ -81,7 +81,7 @@ export const ClusterPieCharts = observer(() => {
|
||||
defaultColor,
|
||||
],
|
||||
id: "cpuRequests",
|
||||
label: "Requests"
|
||||
label: "Requests",
|
||||
},
|
||||
{
|
||||
data: [
|
||||
@@ -93,7 +93,7 @@ export const ClusterPieCharts = observer(() => {
|
||||
defaultColor,
|
||||
],
|
||||
id: "cpuLimits",
|
||||
label: "Limits"
|
||||
label: "Limits",
|
||||
},
|
||||
],
|
||||
labels: createLabels([
|
||||
@@ -116,7 +116,7 @@ export const ClusterPieCharts = observer(() => {
|
||||
defaultColor,
|
||||
],
|
||||
id: "memoryUsage",
|
||||
label: "Usage"
|
||||
label: "Usage",
|
||||
},
|
||||
{
|
||||
data: [
|
||||
@@ -128,7 +128,7 @@ export const ClusterPieCharts = observer(() => {
|
||||
defaultColor,
|
||||
],
|
||||
id: "memoryRequests",
|
||||
label: "Requests"
|
||||
label: "Requests",
|
||||
},
|
||||
{
|
||||
data: [
|
||||
@@ -140,7 +140,7 @@ export const ClusterPieCharts = observer(() => {
|
||||
defaultColor,
|
||||
],
|
||||
id: "memoryLimits",
|
||||
label: "Limits"
|
||||
label: "Limits",
|
||||
},
|
||||
],
|
||||
labels: [
|
||||
@@ -148,8 +148,8 @@ export const ClusterPieCharts = observer(() => {
|
||||
`Requests: ${bytesToUnits(memoryRequests)}`,
|
||||
`Limits: ${bytesToUnits(memoryLimits)}`,
|
||||
`Allocatable Capacity: ${bytesToUnits(memoryAllocatableCapacity)}`,
|
||||
`Capacity: ${bytesToUnits(memoryCapacity)}`
|
||||
]
|
||||
`Capacity: ${bytesToUnits(memoryCapacity)}`,
|
||||
],
|
||||
};
|
||||
const podsData: ChartData = {
|
||||
datasets: [
|
||||
@@ -163,13 +163,13 @@ export const ClusterPieCharts = observer(() => {
|
||||
defaultColor,
|
||||
],
|
||||
id: "podUsage",
|
||||
label: "Usage"
|
||||
label: "Usage",
|
||||
},
|
||||
],
|
||||
labels: [
|
||||
`Usage: ${podUsage || 0}`,
|
||||
`Capacity: ${podAllocatableCapacity}`,
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user