fix linting

This commit is contained in:
Arthur Lu 2023-10-25 19:46:37 +00:00
parent cb1e3a776e
commit 3668cb0445
3 changed files with 9 additions and 7 deletions

View File

@ -44,7 +44,7 @@ class LocalDB {
}
addUser (username, config = null) {
config = config ? config : this.#data.global.defaultuser;
config = config || this.#data.global.defaultuser;
this.#data.users[username] = config;
this.#save();
}

View File

@ -20,8 +20,8 @@ global.argv = parseArgs(process.argv.slice(2), {
global.api = _package(global.argv.package);
global.pve = pve;
global.utils = utils;
const db = (await import(global.argv.db)).default;
global.db = new db(global.argv.dbconfig);
const DB = (await import(global.argv.db)).default;
global.db = new DB(global.argv.dbconfig);
const app = express();
global.app = app;

View File

@ -240,14 +240,16 @@ export async function getNodeAvailDevices (node) {
// get node pci devices
let nodeAvailPci = requestPVE(`/nodes/${node}/hardware/pci`, "GET", { token: pveAPIToken });
// for each node container, get its config and remove devices which are already used
let vms = (await requestPVE(`/nodes/${node}/qemu`, "GET", { token: pveAPIToken })).data.data;
const vms = (await requestPVE(`/nodes/${node}/qemu`, "GET", { token: pveAPIToken })).data.data;
const promises = [];
for (const vm of vms) {
promises.push(requestPVE(`/nodes/${node}/qemu/${vm.vmid}/config`, "GET", { token: pveAPIToken }));
}
const configs = await Promise.all(promises);
configs.forEach((e,i) => {configs[i] = e.data.data});
configs.forEach((e, i) => {
configs[i] = e.data.data;
});
nodeAvailPci = (await nodeAvailPci).data.data;