v9.47: fix graph modal (overlay, _getInstances, localStorage auth)
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: cloud-dashboard
|
- name: cloud-dashboard
|
||||||
image: naeel/cloud-dashboard:v9.46
|
image: naeel/cloud-dashboard:v9.47
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
|
|||||||
+16
-18
@@ -75,16 +75,16 @@
|
|||||||
var graphCache = null; // built SVG string, null = not built yet
|
var graphCache = null; // built SVG string, null = not built yet
|
||||||
var building = false; // loading in progress flag
|
var building = false; // loading in progress flag
|
||||||
|
|
||||||
// ── Modal DOM ────────────────────────────────────────────────────────────
|
// ── DOM helpers ──────────────────────────────────────────────────────────
|
||||||
function getModal() { return document.getElementById("graph-modal"); }
|
function getOverlay() { return document.getElementById("graph-overlay"); }
|
||||||
function getCanvas() { return document.getElementById("graph-canvas"); }
|
function getCanvas() { return document.getElementById("graph-canvas"); }
|
||||||
function getStatus() { return document.getElementById("graph-status"); }
|
function getStatus() { return document.getElementById("graph-status"); }
|
||||||
|
|
||||||
// ── Open / Close ─────────────────────────────────────────────────────────
|
// ── Open / Close ─────────────────────────────────────────────────────────
|
||||||
function openGraph() {
|
function openGraph() {
|
||||||
var modal = getModal();
|
var overlay = getOverlay();
|
||||||
if (!modal) return;
|
if (!overlay) { console.error("[graph] #graph-overlay not found"); return; }
|
||||||
modal.style.display = "flex";
|
overlay.style.display = "flex";
|
||||||
if (graphCache) {
|
if (graphCache) {
|
||||||
showCached();
|
showCached();
|
||||||
} else if (!building) {
|
} else if (!building) {
|
||||||
@@ -93,8 +93,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function closeGraph() {
|
function closeGraph() {
|
||||||
var modal = getModal();
|
var overlay = getOverlay();
|
||||||
if (modal) modal.style.display = "none";
|
if (overlay) overlay.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshGraph() {
|
function refreshGraph() {
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
g.setNode(n.id, { width: n.w || NODE_W, height: n.h || NODE_H, label: n.id });
|
g.setNode(n.id, { width: n.w || NODE_W, height: n.h || NODE_H, label: n.id });
|
||||||
});
|
});
|
||||||
edges.forEach(function (e) {
|
edges.forEach(function (e) {
|
||||||
g.setEdge(e.from, e.to);
|
if (g.hasNode(e.from) && g.hasNode(e.to)) g.setEdge(e.from, e.to);
|
||||||
});
|
});
|
||||||
|
|
||||||
dagre.layout(g);
|
dagre.layout(g);
|
||||||
@@ -297,10 +297,10 @@
|
|||||||
canvas.innerHTML = "";
|
canvas.innerHTML = "";
|
||||||
setStatus("Строю схему: загрузка инстансов…");
|
setStatus("Строю схему: загрузка инстансов…");
|
||||||
|
|
||||||
// Step 1: Use allInstances already loaded in memory
|
// Step 1: Use allInstances exposed from IIFE via window._getInstances()
|
||||||
var instances = (typeof allInstances !== "undefined") ? allInstances : [];
|
var instances = (typeof window._getInstances === "function") ? window._getInstances() : [];
|
||||||
if (!instances.length) {
|
if (!instances || !instances.length) {
|
||||||
setStatus("Нет данных. Обновите таблицу сначала.");
|
setStatus("Нет данных. Нажмите «Обновить» в таблице, затем откройте схему снова.");
|
||||||
building = false;
|
building = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -373,13 +373,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var uid = uidList[idx];
|
var uid = uidList[idx];
|
||||||
var token = (typeof getToken === "function") ? getToken() : (window.getToken ? window.getToken() : "");
|
|
||||||
var env = (typeof getDeckEnv === "function") ? getDeckEnv() : (window.getDeckEnv ? window.getDeckEnv() : "test");
|
|
||||||
|
|
||||||
fetch("/dashboard/api/instances/" + uid, {
|
fetch("/dashboard/api/instances/" + uid, {
|
||||||
headers: {
|
headers: {
|
||||||
"X-Deck-Token": token,
|
"X-Deck-Token": localStorage.getItem("deck_token") || "",
|
||||||
"X-Deck-Env": env
|
"X-Deck-Env": localStorage.getItem("deck_env") || "test"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function (r) { return r.ok ? r.json() : null; })
|
.then(function (r) { return r.ok ? r.json() : null; })
|
||||||
|
|||||||
@@ -1094,6 +1094,10 @@ window.navigateToDep = navigateToDep;
|
|||||||
window.navBack = navBack;
|
window.navBack = navBack;
|
||||||
window.copyParamValue = copyParamValue;
|
window.copyParamValue = copyParamValue;
|
||||||
|
|
||||||
|
// Expose live accessors for graph.js
|
||||||
|
window._getInstances = function(){ return allInstances; };
|
||||||
|
window._apiHeaders = function(){ return { "X-Deck-Token": getToken(), "X-Deck-Env": getDeckEnv() }; };
|
||||||
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user