[icinga-checkins] icinga.org: icinga-web/mhein/default: * Added better design for comments display

git at icinga.org git at icinga.org
Tue Sep 7 20:45:10 CEST 2010


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Tue Sep  7 18:52:58 2010 +0200

* Added better design for comments display
* Finish implementation for comments (fixes #697)
* Make files fix

---

 .../Cronks/data/xml/grid/icinga-host-template.xml  |   14 +++++-----
 .../data/xml/grid/icinga-service-template.xml      |   21 +++++++++++++--
 app/modules/Cronks/lib/js/grid/GridUtil.js         |    2 +-
 app/modules/Web/config/simple_data_provider.xml    |   13 +++++----
 app/modules/Web/lib/js/SimpleDataProvider.js       |    6 ++--
 .../IcingaTemplateDisplayMonitoring.class.php      |    3 +-
 etc/make/files.mk                                  |    4 ++-
 pub/styles/icinga.css                              |   26 +++++++++++++++++++-
 8 files changed, 65 insertions(+), 24 deletions(-)

diff --git a/app/modules/Cronks/data/xml/grid/icinga-host-template.xml b/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
index 5cb6e1e..78ea1af 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
@@ -489,11 +489,11 @@
             <order>
                 <parameter name="enabled">false</parameter>
             </order>
-	</field>
-	END EXAMPLE -->
+		</field>
+		END EXAMPLE -->
 	
-	<!--  Example to include images on the fly
-	<field name="image_hover">
+		<!--  Example to include images on the fly
+		<field name="image_hover">
             <datasource>
             	<parameter name="field">HOST_NAME</parameter>
             </datasource>
@@ -551,10 +551,10 @@
             <order>
                 <parameter name="enabled">false</parameter>
             </order>
-	</field>
-	END EXAMPLE -->
+		</field>
+		END EXAMPLE -->
 
-	<field name="comments">
+		<field name="comments">
 			<datasource>
             	<parameter name="field">HOST_OBJECT_ID</parameter>
             </datasource>
diff --git a/app/modules/Cronks/data/xml/grid/icinga-service-template.xml b/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
index 7dd56ae..5d997ac 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
@@ -26,6 +26,21 @@
         	<parameter>Cronk.grid.IcingaColumnRenderer</parameter>
         </parameter>
         
+        <parameter name="gridEvents">
+        	
+        	<!-- Initialize comments -->
+        	<parameter>
+        		<parameter name="type">viewready</parameter>
+        		<parameter name="function">Cronk.grid.GridUtil.initCommentEventHandler</parameter>
+        		<parameter name="arguments">
+        			<parameter name="column_name">comments</parameter>
+               		<!-- <parameter name="class">icinga-icon-comment icon-24 icinga-link icinga-notext</parameter> -->
+               		<parameter name="title">Comments for {service_name}</parameter>
+        		</parameter>
+        	</parameter>
+        	
+        </parameter>
+        
         <!-- 
         	Selection model of rows (checkbox/row). This is needed for
         	commands and maybe other user things ...
@@ -408,9 +423,9 @@
             </order>
         </field>
         
-		<field name="service_comments">
+		<field name="comments">
 			<datasource>
-            	<parameter name="field">SERVICE_OBJECT_ID</parameter>
+            	<parameter name="field">HOST_OBJECT_ID</parameter>
             </datasource>
             
             <display>
@@ -429,7 +444,7 @@
                 	<parameter name="class">IcingaTemplateDisplayMonitoring</parameter>
                 	<parameter name="method">icingaComments</parameter>
                 	<parameter name="arguments">
-                		<parameter name="object_id_field">service_comments</parameter>
+                		<parameter name="object_id_field">comments</parameter>
                 		<parameter name="instance_id_field">instance_id</parameter>
                 	</parameter>
                 </parameter>
diff --git a/app/modules/Cronks/lib/js/grid/GridUtil.js b/app/modules/Cronks/lib/js/grid/GridUtil.js
index bd0add2..bc7ab42 100644
--- a/app/modules/Cronks/lib/js/grid/GridUtil.js
+++ b/app/modules/Cronks/lib/js/grid/GridUtil.js
@@ -19,7 +19,7 @@ Cronk.grid.GridUtil = (function() {
 					var node = AppKit.util.parseDOMfromString(record.get(c.column_name));
 					Icinga.util.SimpleDataProvider.createToolTip({
 						target: node.getAttribute('id'),
-						title: Cronk.grid.ColumnRendererUtil.applyXTemplate(lGrid, rowIndex, node.getAttribute('title')),
+						title: Cronk.grid.ColumnRendererUtil.applyXTemplate(lGrid, rowIndex, c.title),
 						width: c.width || 400,
 						filter: [{key: 'object_id', value: node.firstChild.data}],
 						srcId: c.sourceId || 'comments'
diff --git a/app/modules/Web/config/simple_data_provider.xml b/app/modules/Web/config/simple_data_provider.xml
index 7dd86b9..1af33c8 100755
--- a/app/modules/Web/config/simple_data_provider.xml
+++ b/app/modules/Web/config/simple_data_provider.xml
@@ -28,13 +28,14 @@
 			</ae:parameter>
 			<ae:parameter name="xtemplate_code"><![CDATA[
 				<tpl for="data">
-					<tpl for=".">
-					<div>
-						<div>{COMMENT_TIME}, {COMMENT_AUTHOR_NAME}:</div>
-						<div>{COMMENT_DATA}</div>
+					<div class="icinga-comment-frame">
+						<tpl for=".">
+							<div class="icinga-comment">
+								<div class="icinga-comment-author">{COMMENT_TIME}, {COMMENT_AUTHOR_NAME}:</div>
+								<div class="icinga-comment-data">{COMMENT_DATA}</div>
+							</div>
+						</tpl>
 					</div>
-					<hr />
-					</tpl>
 				</tpl>
 			]]></ae:parameter>
 			<ae:parameter name="filter">
diff --git a/app/modules/Web/lib/js/SimpleDataProvider.js b/app/modules/Web/lib/js/SimpleDataProvider.js
index adfc39b..7895dde 100755
--- a/app/modules/Web/lib/js/SimpleDataProvider.js
+++ b/app/modules/Web/lib/js/SimpleDataProvider.js
@@ -90,8 +90,10 @@ Icinga.util.SimpleDataProvider = (function () {
 					closable: config.closable,
 					anchor: config.anchor,
 					target: config.target,
-					autoHide: false,
+					dismissDelay: 5000,
+					hideDelay: 1000,
 					draggable: true,
+					autoHide: true,
 					title: (!Ext.isEmpty(config.title)) ? _(config.title) : '' 
 				});
 				
@@ -141,8 +143,6 @@ Icinga.util.SimpleDataProvider = (function () {
 				);
 			}
 			
-			AppKit.log(tpl, responseObj);
-			
 			tpl.overwrite(el, responseObj.result);
 		};
 		
diff --git a/app/modules/Web/lib/tdisplay/IcingaTemplateDisplayMonitoring.class.php b/app/modules/Web/lib/tdisplay/IcingaTemplateDisplayMonitoring.class.php
index a6b7270..cc1c1da 100755
--- a/app/modules/Web/lib/tdisplay/IcingaTemplateDisplayMonitoring.class.php
+++ b/app/modules/Web/lib/tdisplay/IcingaTemplateDisplayMonitoring.class.php
@@ -48,8 +48,7 @@ class IcingaTemplateDisplayMonitoring extends IcingaTemplateDisplay {
 				$id = sprintf('%s-%d', 'comment-object-id', $object_id);
 				return (string)AppKitXmlTag::create('div', $object_id)
 				->addAttribute('id', $id)
-				->addAttribute('class', $method_params->getParameter('class', 'icinga-icon-comment icon-24 icinga-link icinga-notext'))
-				->addAttribute('title', 'Comments');
+				->addAttribute('class', $method_params->getParameter('class', 'icinga-icon-comment icon-24 icinga-link icinga-notext'));
 			}
 		}
 		
diff --git a/etc/make/files.mk b/etc/make/files.mk
index 217fcbd..51bc8b2 100755
--- a/etc/make/files.mk
+++ b/etc/make/files.mk
@@ -485,6 +485,7 @@ inc-install-files:
 	$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/grid
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/grid/ColumnRenderer.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/grid/ColumnRenderer.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/grid/GridPanel.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/grid/GridPanel.js
+	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/grid/GridUtil.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/grid/GridUtil.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/grid/MetaGridCreator.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/grid/MetaGridCreator.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/Portlet.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/Portlet.js
 	$(INSTALL) -m 644 $(INSTALL_OPTS) app/modules/Cronks/lib/js/rmd160.js $(DESTDIR)$(prefix)/app/modules/Cronks/lib/js/rmd160.js
@@ -7866,6 +7867,7 @@ inc-install-files:
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/images/icons/cancel.png $(DESTDIR)$(prefix)/pub/images/icons/cancel.png
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/images/icons/chart_bar.png $(DESTDIR)$(prefix)/pub/images/icons/chart_bar.png
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/images/icons/cog.png $(DESTDIR)$(prefix)/pub/images/icons/cog.png
+	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/images/icons/comment.png $(DESTDIR)$(prefix)/pub/images/icons/comment.png
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/images/icons/cross.png $(DESTDIR)$(prefix)/pub/images/icons/cross.png
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/images/icons/database_go.png $(DESTDIR)$(prefix)/pub/images/icons/database_go.png
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/images/icons/database.png $(DESTDIR)$(prefix)/pub/images/icons/database.png
@@ -7922,6 +7924,6 @@ inc-install-files:
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/styles/icinga.css $(DESTDIR)$(prefix)/pub/styles/icinga.css
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/styles/icinga-icons.css $(DESTDIR)$(prefix)/pub/styles/icinga-icons.css
 	$(INSTALL) -m 644 $(INSTALL_OPTS) pub/styles/statusmap.css $(DESTDIR)$(prefix)/pub/styles/statusmap.css
-INC_FILES=7008
+INC_FILES=7010
 INC_DIRS=913
 # INSTALL_FILES_END
diff --git a/pub/styles/icinga.css b/pub/styles/icinga.css
index b5b899b..637850c 100644
--- a/pub/styles/icinga.css
+++ b/pub/styles/icinga.css
@@ -590,7 +590,31 @@ div.icinga-codeBox {
 }
 
 div.icinga-icon-bug-32 {
-	 background-image: url(../images/icinga/bug_big.png) !important; background-repeat: no-repeat; }
+	background-image: url(../images/icinga/bug_big.png) !important; background-repeat: no-repeat;
+}
+
+/** Comments **/
+
+div.icinga-comment-frame {
+	padding: 8px 5px 3px 5px;
+}
+
+div.icinga-comment {
+	border: 1px solid #666666;
+	-webkit-border-radius: 5px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
+	margin: 2px 0px 2px 0px;
+}
+
+div.icinga-comment .icinga-comment-author {
+	padding: 2px 5px 2px 5px;
+	background-color: #666666;
+	color: #ffffff;
+}
 
+div.icinga-comment .icinga-comment-data {
+	padding: 5px 2px 2px 5px;
 }
+
 /* EOF */





More information about the icinga-checkins mailing list