mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-11-20 18:06:05 -05:00
Fix deviceViewPanel to properly initialize panel entries (#7433)
Corrects the logic in deviceViewPanel to ensure that each plugin's panel entry is initialized as an object with header and content properties, and checks for the existence of both on_device_header and on_device_page functions before invoking them.
This commit is contained in:
@@ -200,10 +200,12 @@ module.exports.pluginHandler = function (parent) {
|
|||||||
obj.deviceViewPanel = function () {
|
obj.deviceViewPanel = function () {
|
||||||
var panel = {};
|
var panel = {};
|
||||||
for (var p in obj.plugins) {
|
for (var p in obj.plugins) {
|
||||||
if (typeof obj.plugins[p][hookName] == 'function') {
|
if (typeof obj.plugins[p].on_device_header === "function" && typeof obj.plugins[p].on_device_page === "function") {
|
||||||
try {
|
try {
|
||||||
panel[p].header = obj.plugins[p].on_device_header();
|
panel[p] = {
|
||||||
panel[p].content = obj.plugins[p].on_device_page();
|
header: obj.plugins[p].on_device_header(),
|
||||||
|
content: obj.plugins[p].on_device_page()
|
||||||
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Error occurred while getting plugin views " + p + ':' + ' (' + e + ')');
|
console.log("Error occurred while getting plugin views " + p + ':' + ' (' + e + ')');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user