From 222fc0949e01923c25f18666a8fb41d567ca5bd7 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Thu, 23 Nov 2023 16:58:44 +0100
Subject: [PATCH] fix size of top output

---
 public_html/deployment/js/functions.js                 | 10 ++++++----
 .../deployment/plugins/shellcmd/top/config.json        |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/public_html/deployment/js/functions.js b/public_html/deployment/js/functions.js
index b50f3bd8..c2ce242e 100644
--- a/public_html/deployment/js/functions.js
+++ b/public_html/deployment/js/functions.js
@@ -58,6 +58,7 @@ function wb_getdefaults(sId, aOverrides) {
     if (_aReturn['y']<_aReturn['top']){
         _aReturn['y']=_aReturn['top'];
     }
+    // console.log(_aReturn);
     return _aReturn;
 }
 /**
@@ -147,7 +148,6 @@ function showIdAsModalMessage(sId, sTitle) {
         width: 700,
         height: 500,
 
-
         // take content from existing div
         // mount: oWrapper
         // mount: document.getElementById(sId).cloneNode(true),
@@ -174,6 +174,8 @@ function toggleShellWindow(sId, oLink) {
         aWinBoxes[sId].close();
     } else {
         var oWrapper = document.getElementById(sId);
+        var iDefaultWidth=200;
+        var iDefaultHeight=200;
         var aOptions = wb_getdefaults(sId, {
             title: oLink.innerText,
             id: 'winbox-' + sId,
@@ -182,8 +184,8 @@ function toggleShellWindow(sId, oLink) {
             // position + size
             x: "center",
             y: "center",
-            width: 10,
-            height: 10,
+            width: iDefaultWidth,
+            height: iDefaultHeight,
 
             // take content from existing div
             mount: oWrapper,
@@ -200,7 +202,7 @@ function toggleShellWindow(sId, oLink) {
         if (oLink) {
             $(oLink).addClass('active');
         }
-        if(aOptions['width']==10){
+        if(aOptions['width']==iDefaultWidth){
             window.setTimeout("aWinBoxes['" + sId + "'].resize(" + (oWrapper.clientWidth + 25) + ", " + (oWrapper.clientHeight + 150) + ").move('center', 'center')", 10);
         }
     }
diff --git a/public_html/deployment/plugins/shellcmd/top/config.json b/public_html/deployment/plugins/shellcmd/top/config.json
index 9ea4596c..eb6484aa 100644
--- a/public_html/deployment/plugins/shellcmd/top/config.json
+++ b/public_html/deployment/plugins/shellcmd/top/config.json
@@ -2,6 +2,6 @@
     "command": "top -b -n 1 | head -20",
     "icon": "fa-solid fa-arrow-up-wide-short",
     "interval": 5000,
-    "window-cols": 50,
+    "window-cols": 60,
     "window-lines": 30
 }
\ No newline at end of file
-- 
GitLab