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

View File

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