Fix multiple nodes on the same server being broken (scoping issue, switch to foreach)
This commit is contained in:
parent
4a5286c6ed
commit
a9c939a3af
1 changed files with 7 additions and 7 deletions
14
src/index.js
14
src/index.js
|
@ -524,14 +524,14 @@ function multicollab(url) {
|
||||||
await vm.connect();
|
await vm.connect();
|
||||||
var list = await vm.list();
|
var list = await vm.list();
|
||||||
vm.disconnect();
|
vm.disconnect();
|
||||||
for (var i = 0; i < list.length; i++) {
|
list.forEach((curr) => {
|
||||||
var id = list[i].id;
|
var id = curr.id;
|
||||||
var name = list[i].name;
|
var name = curr.name;
|
||||||
if (id === window.location.hash.substring(1)) {
|
if (id === window.location.hash.substring(1)) {
|
||||||
openVM(url, id);
|
openVM(url, id);
|
||||||
res(false);
|
res(false);
|
||||||
}
|
}
|
||||||
vms.push(list[i]);
|
vms.push(curr);
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.classList = "col-sm-4";
|
div.classList = "col-sm-4";
|
||||||
var card = document.createElement("div");
|
var card = document.createElement("div");
|
||||||
|
@ -539,7 +539,7 @@ function multicollab(url) {
|
||||||
card.setAttribute("data-cvm-node", id);
|
card.setAttribute("data-cvm-node", id);
|
||||||
card.addEventListener("click", () => openVM(url, id));
|
card.addEventListener("click", () => openVM(url, id));
|
||||||
var img = document.createElement("img");
|
var img = document.createElement("img");
|
||||||
img.src = "data:image/png;base64," + list[i].thumb;
|
img.src = "data:image/png;base64," + curr.thumb;
|
||||||
img.classList = "card-img-top";
|
img.classList = "card-img-top";
|
||||||
var bdy = document.createElement("div");
|
var bdy = document.createElement("div");
|
||||||
bdy.classList = "card-body";
|
bdy.classList = "card-body";
|
||||||
|
@ -549,9 +549,9 @@ function multicollab(url) {
|
||||||
card.appendChild(img);
|
card.appendChild(img);
|
||||||
card.appendChild(bdy);
|
card.appendChild(bdy);
|
||||||
div.appendChild(card);
|
div.appendChild(card);
|
||||||
list[i].element = div;
|
curr.element = div;
|
||||||
reloadVMList();
|
reloadVMList();
|
||||||
}
|
});
|
||||||
res(true);
|
res(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue