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

@ -5,7 +5,7 @@ class LocalDB {
#path = null; #path = null;
#data = null; #data = null;
constructor (path) { constructor (path) {
try { try {
this.#path = path; this.#path = path;
this.#load(); this.#load();
this.pveAPI = this.getGlobal().application.pveAPI; this.pveAPI = this.getGlobal().application.pveAPI;
@ -44,7 +44,7 @@ class LocalDB {
} }
addUser (username, config = null) { addUser (username, config = null) {
config = config ? config : this.#data.global.defaultuser; config = config || this.#data.global.defaultuser;
this.#data.users[username] = config; this.#data.users[username] = config;
this.#save(); this.#save();
} }

View File

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

View File

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