[icinga-checkins] icinga.org: icinga-web/mhein/default: * Updated output field, calculates size now

git at icinga.org git at icinga.org
Fri Nov 18 17:05:37 CET 2011


Module: icinga-web
Branch: mhein/default
Commit: b5359132ede444774faffe58e4ae37e3b4b51a53
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=b5359132ede444774faffe58e4ae37e3b4b51a53

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Thu Nov 17 17:31:55 2011 +0100

* Updated output field, calculates size now

---

 .../Cronks/lib/js/Cronks/Tackle/ObjectGrid.js      |   26 ++++++++++++-------
 .../Cronks/lib/js/Cronks/Tackle/ServicesSubGrid.js |   24 +++++++++++-------
 .../models/System/StatusOverallModel.class.php     |    2 +
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/app/modules/Cronks/lib/js/Cronks/Tackle/ObjectGrid.js b/app/modules/Cronks/lib/js/Cronks/Tackle/ObjectGrid.js
index 95d1a74..6fdd0ae 100644
--- a/app/modules/Cronks/lib/js/Cronks/Tackle/ObjectGrid.js
+++ b/app/modules/Cronks/lib/js/Cronks/Tackle/ObjectGrid.js
@@ -305,7 +305,7 @@ Icinga.Cronks.Tackle.ObjectGrid = Ext.extend(Ext.grid.GridPanel, {
                 header: _('Output'),
                 dataIndex: 'HOST_OUTPUT',
                 sortable: false,
-                width: 200,
+                width: 300,
                 listeners: {
                     scope:this
                 },
@@ -313,6 +313,7 @@ Icinga.Cronks.Tackle.ObjectGrid = Ext.extend(Ext.grid.GridPanel, {
                     html: "%VALUE%",
                     border: false,
                     record: "%RECORD%",
+                    style: 'cursor: pointer',
                     listeners: {
                         render: function(c) {
                             c.getEl().on("click",function(el) {
@@ -326,16 +327,21 @@ Icinga.Cronks.Tackle.ObjectGrid = Ext.extend(Ext.grid.GridPanel, {
                                     c.origHeight = c.getEl().getHeight();
                                     c.origValue = c.getEl().dom.innerHTML;
                                     c.toggleState = "open";
-                                    c.getEl().setHeight(100);
-                                    c.update(
-                                        "<p><b>Long output:</b> <br/>"+
-                                        c.record.get("HOST_LONG_OUTPUT")+" </p>"+
-                                        "<p><b>Perfdata:</b><br/>"+
-                                        c.record.get("HOST_PERFDATA")+"</p>"
-                                    );
+                                    
+                                    var html = Ext.DomHelper.markup({
+                                        tag: 'div',
+                                        children: [
+                                            {tag: 'b', html: _('Long output')},
+                                            {tag: 'div', html: c.record.get('HOST_LONG_OUTPUT')},
+                                            {tag: 'b', html: _('<br/>Performance data')},
+                                            {tag: 'div', html: c.record.get('HOST_PERFDATA')},
+                                        ]
+                                    });
+                                    var height = Ext.util.TextMetrics.createInstance(c.getEl()).getHeight(html);
+                                    c.getEl().setHeight(height);
+                                    c.update(html);
                                 }
-                            });
-                            c.getEl().innerHTML = "<div class='icinga-icon-info'>"+c.getEl().innerHTML+"</div>";
+                            });                           
                         },
                         scope:this
                     }
diff --git a/app/modules/Cronks/lib/js/Cronks/Tackle/ServicesSubGrid.js b/app/modules/Cronks/lib/js/Cronks/Tackle/ServicesSubGrid.js
index 2ef764e..8e3b841 100644
--- a/app/modules/Cronks/lib/js/Cronks/Tackle/ServicesSubGrid.js
+++ b/app/modules/Cronks/lib/js/Cronks/Tackle/ServicesSubGrid.js
@@ -182,7 +182,7 @@ Icinga.Cronks.Tackle.ServicesSubGrid = Ext.extend(Ext.grid.GridPanel, {
                 header: _('Output'),
                 dataIndex: 'SERVICE_OUTPUT',
                 sortable: false,
-                width: 200,
+                width: 400,
                 listeners: {
                     scope:this
                 },
@@ -190,6 +190,7 @@ Icinga.Cronks.Tackle.ServicesSubGrid = Ext.extend(Ext.grid.GridPanel, {
                     html: "%VALUE%",
                     border: false,
                     record: "%RECORD%",
+                    style: 'cursor: pointer',
                     listeners: {
                         render: function(c) {
                             c.getEl().on("click",function(el) {
@@ -203,16 +204,21 @@ Icinga.Cronks.Tackle.ServicesSubGrid = Ext.extend(Ext.grid.GridPanel, {
                                     c.origHeight = c.getEl().getHeight();
                                     c.origValue = c.getEl().dom.innerHTML;
                                     c.toggleState = "open";
-                                    c.getEl().setHeight(100);
-                                    c.update(
-                                        "<p><b>Long output:</b> <br/>"+
-                                        c.record.get("SERVICE_LONG_OUTPUT")+" </p>"+
-                                        "<p><b>Perfdata:</b>"+
-                                        c.record.get("SERVICE_PERFDATA")+"</p>"
-                                    );
+
+                                    var html = Ext.DomHelper.markup({
+                                        tag: 'div',
+                                        children: [
+                                            {tag: 'b', html: _('Long output')},
+                                            {tag: 'div', html: c.record.get('SERVICE_LONG_OUTPUT')},
+                                            {tag: 'b', html: _('<br/>Performance data')},
+                                            {tag: 'div', html: c.record.get('SERVICE_PERFDATA')},
+                                        ]
+                                    });
+                                    var height = Ext.util.TextMetrics.createInstance(c.getEl()).getHeight(html);
+                                    c.getEl().setHeight(height);
+                                    c.update(html);
                                 }
                             });
-                            c.getEl().innerHTML = "<div class='icinga-icon-info'>"+c.getEl().innerHTML+"</div>";
                         },
                         scope:this
                     }
diff --git a/app/modules/Cronks/models/System/StatusOverallModel.class.php b/app/modules/Cronks/models/System/StatusOverallModel.class.php
index a2d2d34..a9616cf 100644
--- a/app/modules/Cronks/models/System/StatusOverallModel.class.php
+++ b/app/modules/Cronks/models/System/StatusOverallModel.class.php
@@ -131,8 +131,10 @@ class Cronks_System_StatusOverallModel extends CronksBaseModel {
         $status = false;
         
         foreach ($instances as $instance) {
+            
             $date = (int)strtotime($instance->last_command_check);
             $diff = (time()-$date);
+            
             if ($diff < $checkTime && $instance->is_currently_running) {
                 $status = true;
             } else {





More information about the icinga-checkins mailing list