From 4da83d6ca64b0d2fbadde80194d1eadf8bb8cd2d Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Fri, 13 Sep 2019 09:59:28 +0200
Subject: [PATCH] added show count of servers, set ajax timout

---
 .gitignore                         | 11 ++++++-----
 classes/cronlog-renderer.class.php | 15 +++++++++------
 js/asimax.class.js                 |  1 +
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 42838eb..e771990 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
-/data/
-/nbproject/
-/cronjobs.html
-/winscp.rnd
-config/inc_cronlog.php
+/data/
+/nbproject/
+/cronjobs.html
+/winscp.rnd
+config/inc_cronlog.php
+/data__/
\ No newline at end of file
diff --git a/classes/cronlog-renderer.class.php b/classes/cronlog-renderer.class.php
index adc85eb..d195b47 100644
--- a/classes/cronlog-renderer.class.php
+++ b/classes/cronlog-renderer.class.php
@@ -498,19 +498,22 @@ class cronlogrenderer extends cronlog{
      */
     public function renderServerlist($sSelectedItem=false){
         $sHtml='';
+        $iMaxItemsToShow=30;
         $sHtml.='<option value="ALL"'
                 .($sSelectedItem===false || $sSelectedItem==='ALL' ? ' selected="selected"' : '')
-                . '>[ALLE]</option>';
+                . '>[ALLE ('.count($this->getServers()).')]</option>';
         foreach($this->getServers() as $sServer=>$aData){
             $sHtml.='<option value="'.$sServer.'"'
                     .($sSelectedItem===$sServer ? ' selected="selected"' : '')
                     .'>'.$sServer.'</option>';
         }
-        $sHtml=$sHtml ? '<select'
-                . ' size="'.(count($this->getServers())+1).'"'
-                // . ' size="1"'
-                . ' onchange="setServer(this.value); return false;"'
-                . '>'.$sHtml.'</select>' : false;
+        $sHtml=$sHtml 
+                ? '<select'
+                    . ' size="'.( min(array(count($this->getServers())+1 , $iMaxItemsToShow)) ).'"'
+                    // . ' size="1"'
+                    . ' onchange="setServer(this.value); return false;"'
+                    . '>'.$sHtml.'</select>' 
+                : false;
         return $sHtml;
     }
     
diff --git a/js/asimax.class.js b/js/asimax.class.js
index 03e3fee..ea49a4b 100644
--- a/js/asimax.class.js
+++ b/js/asimax.class.js
@@ -134,6 +134,7 @@ var asimax = function () {
             url: url,
             data: queryparams,
             type: this.cfg.apimethod,
+            timeout: 5000, // [ms]
             success: function (data) {
                 $('#' + domid).css('opacity', 1);
                 $('#' + domid).html(data);
-- 
GitLab