[icinga-checkins] icinga.org: icinga-web/master: * Changed tackle components a bit (fixes)

git at icinga.org git at icinga.org
Tue Feb 21 12:08:23 CET 2012


Module: icinga-web
Branch: master
Commit: 5131d6c85cc227f7ce66705ddf82110352db33ea
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=5131d6c85cc227f7ce66705ddf82110352db33ea

Author: Marius Hein <marius.hein at netways.de>
Date:   Tue Feb 21 12:07:21 2012 +0100

* Changed tackle components a bit (fixes)
* Added xtype ellipsiscolumn for auto template columns

---

 app/modules/AppKit/config/javascript.xml           |    1 +
 app/modules/AppKit/lib/js/ux/EllipsisColumn.js     |   17 ++++++++++++++
 .../Cronks/lib/js/Cronks/Tackle/Relation/Head.js   |   24 +++++++++++++------
 .../Cronks/lib/js/grid/renderer/ColumnRenderer.js  |    5 ++-
 4 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/app/modules/AppKit/config/javascript.xml b/app/modules/AppKit/config/javascript.xml
index 05565fa..325f396 100644
--- a/app/modules/AppKit/config/javascript.xml
+++ b/app/modules/AppKit/config/javascript.xml
@@ -26,6 +26,7 @@
             <ae:parameter>%core.module_dir%/AppKit/lib/js/form/action/JSONSubmit.js</ae:parameter>
             <ae:parameter>%core.module_dir%/AppKit/lib/js/request/Ajax.js</ae:parameter>
             <ae:parameter>%core.module_dir%/AppKit/lib/js/ux/DDTabPanel.js</ae:parameter>
+            <ae:parameter>%core.module_dir%/AppKit/lib/js/ux/EllipsisColumn.js</ae:parameter>
             <ae:parameter>%core.module_dir%/AppKit/lib/js/search/AppKitSearchBox.js</ae:parameter>
             <ae:parameter>%core.module_dir%/AppKit/lib/js/search/AppKitSearchHandler.js</ae:parameter>
             
diff --git a/app/modules/AppKit/lib/js/ux/EllipsisColumn.js b/app/modules/AppKit/lib/js/ux/EllipsisColumn.js
new file mode 100644
index 0000000..ff028c3
--- /dev/null
+++ b/app/modules/AppKit/lib/js/ux/EllipsisColumn.js
@@ -0,0 +1,17 @@
+Ext.namespace('Ext.ux.grid');
+
+Ext.ux.grid.EllipsisColumn = Ext.extend(Ext.grid.Column, {
+	selectableClass: 'x-icinga-grid-cell-selectable',
+	
+	constructor: function(c) {
+		Ext.ux.grid.EllipsisColumn.superclass.constructor.call(this, c);
+		var vname = '{' + this.dataIndex + '}';
+		this.tpl = new Ext.XTemplate('<span ext:qtip="' + vname + '">' + vname + '</span>');
+		this.renderer = (function(value, p, r) {
+			p.css += ' ' + this.selectableClass;
+			return this.tpl.apply(r.data);
+		}).createDelegate(this);
+	}
+});
+
+Ext.grid.Column.types.ellipsiscolumn = Ext.ux.grid.EllipsisColumn;
\ No newline at end of file
diff --git a/app/modules/Cronks/lib/js/Cronks/Tackle/Relation/Head.js b/app/modules/Cronks/lib/js/Cronks/Tackle/Relation/Head.js
index b69a2aa..61ceb82 100644
--- a/app/modules/Cronks/lib/js/Cronks/Tackle/Relation/Head.js
+++ b/app/modules/Cronks/lib/js/Cronks/Tackle/Relation/Head.js
@@ -68,16 +68,20 @@ Icinga.Cronks.Tackle.Relation.Head = Ext.extend(Ext.Panel, {
         	colModel : new Ext.grid.ColumnModel({
         		columns : [{
         			header : _('Group'),
-        			dataIndex : 'contactgroup_name'
+        			dataIndex : 'contactgroup_name',
+        			xtype: 'ellipsiscolumn'
         		}, {
                     header : _('Name'),
-                    dataIndex : 'contact_name'
+                    dataIndex : 'contact_name',
+                    xtype: 'ellipsiscolumn'
                 }, {
         			header : _('Alias'),
-        			dataIndex : 'contact_alias'
+        			dataIndex : 'contact_alias',
+        			xtype: 'ellipsiscolumn'
         		}, {
         			header : _('Email address'),
-        			dataIndex : 'contact_email_address'
+        			dataIndex : 'contact_email_address',
+        			xtype: 'ellipsiscolumn'
         		}]
         	}),
         	
@@ -101,10 +105,12 @@ Icinga.Cronks.Tackle.Relation.Head = Ext.extend(Ext.Panel, {
     		colModel : new Ext.grid.ColumnModel({
     			columns : [{
     				header : _('Name'),
-    				dataIndex : 'varname'
+    				dataIndex : 'varname',
+    				xtype: 'ellipsiscolumn'
     			}, {
     				header : _('Value'),
-    				dataIndex : 'varvalue'
+    				dataIndex : 'varvalue',
+    				xtype: 'ellipsiscolumn'
     			}]
     		}),
             viewConfig : {
@@ -123,10 +129,12 @@ Icinga.Cronks.Tackle.Relation.Head = Ext.extend(Ext.Panel, {
             colModel : new Ext.grid.ColumnModel({
             	columns : [{
             		header : _('Name'),
-            		dataIndex : 'name'
+            		dataIndex : 'name',
+            		xtype: 'ellipsiscolumn'
             	}, {
             		header : _('Alias'),
-            		dataIndex : 'alias'
+            		dataIndex : 'alias',
+            		xtype: 'ellipsiscolumn'
             	}]
             }),
             viewConfig : {
diff --git a/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js b/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
index 4afceae..61a5533 100755
--- a/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
+++ b/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
@@ -80,6 +80,7 @@ Cronk.grid.ColumnRenderer = {
 	
 	truncateText : function(cfg) {
 		var defaultLength = AppKit.getPrefVal('org.icinga.grid.outputLength') || 70;
+		cfg = cfg || {};
 		return function(value, metaData, record, rowIndex, colIndex, store) {
 			if(!value) 
 				return "";
@@ -87,7 +88,7 @@ Cronk.grid.ColumnRenderer = {
 			if(value.match(/<.*?>(.*?)<\/.*?>/g))
 				return value;
             
-			var out = Ext.util.Format.ellipsis(value, (cfg.length || defaultLength));
+			var out = Ext.util.Format.ellipsis(value, (Ext.isEmpty(cfg.length)) ? defaultLength : cfg.length);
 			if (out.indexOf('...', (out.length-3)) != -1) {
                 metaData.attr = 'ext:qtip="' + value.replace(/"/g, "'") + '"';
 			}
@@ -227,7 +228,7 @@ Cronk.grid.ColumnRenderer = {
     
     selectableColumn : function(cfg) {
         return function(value, metaData, record, rowIndex, colIndex, store) {
-            metaData.css += ' x-icinga-grid-cell-selectabl;e'
+            metaData.css += ' x-icinga-grid-cell-selectable';
 			return value;
 		}
     }





More information about the icinga-checkins mailing list