1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Plugin admin partial

This commit is contained in:
Ryan Blenis 2019-11-02 06:27:39 -04:00
parent 72b5939a44
commit 67b6df9454
5 changed files with 126 additions and 13 deletions

View file

@ -9408,7 +9408,7 @@
// Fetch the server timeline stats if needed
if ((x == 40) && (serverTimelineStats == null)) { refreshServerTimelineStats(); }
if (x == 7) refreshPluginLatest();
if (x == 7) refreshPluginLatest(); else noGoPlugin();
// Update the web page title
if ((currentNode) && (x >= 10) && (x < 20)) {
@ -9456,7 +9456,7 @@
installedPluginList.forEach(function(p){
var cant_action = [];
if (p.hasAdminPanel == true) {
p.name = `<a onclick="return goPlugin('${p._id}');">${p.name}</a>`;
p.nameHtml = `<a onclick="return goPlugin('${p.shortName}', '${p.name}');">${p.name}</a>`;
}
p.statusText = statusMap[p.status].text;
p.statusColor = statusMap[p.status].color;
@ -9490,7 +9490,7 @@
}
p.actions += '</select>';
let tpl = `<td>${p.name}</td><td>${p.description}</td><td><a href="${p.homepage}" target="_blank">Homepage</a></td><td>${p.version}</td><td class="pluginUpgradeAvailable">${p.upgradeAvail}</td><td style="color: #${p.statusColor}">${p.statusText}</td><td class="pluginAction">${p.actions}</td>`;
let tpl = `<td>${p.nameHtml}</td><td>${p.description}</td><td><a href="${p.homepage}" target="_blank">Homepage</a></td><td>${p.version}</td><td class="pluginUpgradeAvailable">${p.upgradeAvail}</td><td style="color: #${p.statusColor}">${p.statusText}</td><td class="pluginAction">${p.actions}</td>`;
let tr = tbl.insertRow(-1);
tr.innerHTML = tpl;
tr.classList.add('p7tblRow');
@ -9532,6 +9532,38 @@
elem.value = '';
}
function goPlugin(pname, title) {
let xwin = `<div class="pluginTitleBar"><span>${title}</span><span class="pluginCloseBtn"><button onclick="return noGoPlugin(this);">X</button></span></div>`
let dif = document.createElement('div');
dif.classList.add('pluginOverlay');
dif.innerHTML = xwin;
let pif = document.createElement('iframe');
pif.src = '/pluginadmin.ashx?pin='+pname;
pif.setAttribute('frameBorder', '0');
pif.style.width = '100%';
pif.style.height = '100%';
pif.setAttribute('frameBorder', '0');
dif.append(pif);
let x = Q('p7');
x.parentNode.insertBefore(dif, x.nextSibling);
Q('p7').classList.add('pluginOverlayBg');
}
function noGoPlugin(el) {
if (el == null) {
var boxes = document.querySelectorAll('.pluginOverlay');
for (const b in Object.values(boxes)) {
boxes[b].parentNode.removeChild(boxes[b]);
}
Q('p7').classList.remove('pluginOverlayBg');
return;
}
var box = document.querySelector('.pluginOverlay').closest(".pluginOverlay");
box.parentNode.removeChild(box);
Q('p7').classList.remove('pluginOverlayBg');
}
// Generic methods
function joinPaths() { var x = []; for (var i in arguments) { var w = arguments[i]; if ((w != null) && (w != '')) { while (w.endsWith('/') || w.endsWith('\\')) { w = w.substring(0, w.length - 1); } while (w.startsWith('/') || w.startsWith('\\')) { w = w.substring(1); } x.push(w); } } return x.join('/'); }
function putstore(name, val) {