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
@@ -24,20 +24,25 @@ export class PodsStore extends KubeObjectStore<Pod> {
|
||||
|
||||
async loadKubeMetrics(namespace?: string) {
|
||||
const metrics = await podMetricsApi.list({ namespace });
|
||||
|
||||
this.kubeMetrics.replace(metrics);
|
||||
}
|
||||
|
||||
getPodsByOwner(workload: WorkloadKubeObject): Pod[] {
|
||||
if (!workload) return [];
|
||||
|
||||
return this.items.filter(pod => {
|
||||
const owners = pod.getOwnerRefs();
|
||||
|
||||
if (!owners.length) return;
|
||||
|
||||
return owners.find(owner => owner.uid === workload.getId());
|
||||
});
|
||||
}
|
||||
|
||||
getPodsByNode(node: string) {
|
||||
if (!this.isLoaded) return [];
|
||||
|
||||
return this.items.filter(pod => pod.spec.nodeName === node);
|
||||
}
|
||||
|
||||
@@ -54,15 +59,19 @@ export class PodsStore extends KubeObjectStore<Pod> {
|
||||
metric.getNs() === pod.getNs()
|
||||
].every(v => v);
|
||||
});
|
||||
|
||||
if (!metrics) return empty;
|
||||
|
||||
return containers.reduce((total, container) => {
|
||||
const metric = metrics.containers.find(item => item.name == container.name);
|
||||
let cpu = "0";
|
||||
let memory = "0";
|
||||
|
||||
if (metric && metric.usage) {
|
||||
cpu = metric.usage.cpu || "0";
|
||||
memory = metric.usage.memory || "0";
|
||||
}
|
||||
|
||||
return {
|
||||
cpu: total.cpu + cpuUnitsToNumber(cpu),
|
||||
memory: total.memory + unitsToBytes(memory)
|
||||
|
||||
Reference in new issue
Block a user