fix linting errors

This commit is contained in:
Arthur Lu 2023-09-19 20:59:28 +00:00
parent 1b71c16eec
commit 497bd60653
2 changed files with 12 additions and 8 deletions

View File

@ -66,7 +66,7 @@ function createResourceUsageChart (resourceName, resourceAvail, resourceUsed, re
const R = Math.min(usedRatio * 510, 255); const R = Math.min(usedRatio * 510, 255);
const G = Math.min((1 - usedRatio) * 510, 255); const G = Math.min((1 - usedRatio) * 510, 255);
const usedColor = `rgb(${R}, ${G}, 0)`; const usedColor = `rgb(${R}, ${G}, 0)`;
new Chart(canvas, { createChart(canvas, {
type: "pie", type: "pie",
data: { data: {
labels: [ labels: [
@ -103,6 +103,10 @@ function createResourceUsageChart (resourceName, resourceAvail, resourceUsed, re
return container; return container;
} }
function createChart (ctx, data) {
return new window.Chart(ctx, data);
}
function parseNumber (value, unitData) { function parseNumber (value, unitData) {
if (!unitData) { if (!unitData) {
return `${value}`; return `${value}`;

View File

@ -47,15 +47,15 @@ async function populateInstances () {
} }
else { else {
criteria = (a, b) => { criteria = (a, b) => {
const a_inc = a.name.includes(searchQuery); const aInc = a.name.includes(searchQuery);
const b_inc = b.name.includes(searchQuery); const bInc = b.name.includes(searchQuery);
if (a_inc && b_inc) { if (aInc && bInc) {
return a.vmid > b.vmid ? 1 : -1; return a.vmid > b.vmid ? 1 : -1;
} }
else if (a_inc && !b_inc) { else if (aInc && !bInc) {
return -1; return -1;
} }
else if (!a_inc && b_inc) { else if (!aInc && bInc) {
return 1; return 1;
} }
else { else {
@ -64,9 +64,9 @@ async function populateInstances () {
}; };
} }
instances.sort(criteria); instances.sort(criteria);
//console.log(instances) // console.log(instances)
const instanceContainer = document.querySelector("#instance-container"); const instanceContainer = document.querySelector("#instance-container");
instanceContainer.innerHTML = ``; instanceContainer.innerHTML = "";
for (let i = 0; i < instances.length; i++) { for (let i = 0; i < instances.length; i++) {
const newInstance = document.createElement("instance-card"); const newInstance = document.createElement("instance-card");
newInstance.data = instances[i]; newInstance.data = instances[i];