[icinga-checkins] icinga.org: icinga-web/r1.2: * Added autoRefresh by default (#resolves 820)

git at icinga.org git at icinga.org
Wed Sep 29 14:36:17 CEST 2010


Module: icinga-web
Branch: r1.2
Commit: ac3ebd6e0345fb75eb5cef6eea31146940925e08
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=ac3ebd6e0345fb75eb5cef6eea31146940925e08

Author: jmosshammer <jannis.mosshammer at netways.de>
Date:   Tue Sep 28 15:12:52 2010 +0200

* Added autoRefresh by default (#resolves 820)

---

 .gitignore                                  |    1 +
 app/modules/AppKit/config/module.xml        |    3 +-
 app/modules/Cronks/lib/js/grid/GridPanel.js |   28 ++++++++++++++++++--------
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore
index 72ba2ed..d45eebb 100755
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,4 @@ etc/apache2/icinga-web.conf
 pub/.htaccess
 pub/soap/.htaccess
 *~
+*.swp
diff --git a/app/modules/AppKit/config/module.xml b/app/modules/AppKit/config/module.xml
index e0c3970..a967462 100755
--- a/app/modules/AppKit/config/module.xml
+++ b/app/modules/AppKit/config/module.xml
@@ -52,6 +52,7 @@
 					<ae:parameter name="org.icinga.cronk.default">portalHello</ae:parameter>
 					<ae:parameter name="org.icinga.bugTrackerEnabled">true</ae:parameter>
 					<ae:parameter name="org.icinga.errorNotificationsEnabled">true</ae:parameter>
+					<ae:parameter name="org.icinga.autoRefresh">true</ae:parameter>
 				</setting>
 
 				<!-- Adding styles -->
@@ -116,4 +117,4 @@
 		</module>
 		
 	</ae:configuration>
-</ae:configurations>
\ No newline at end of file
+</ae:configurations>
diff --git a/app/modules/Cronks/lib/js/grid/GridPanel.js b/app/modules/Cronks/lib/js/grid/GridPanel.js
index b374ace..be028ff 100755
--- a/app/modules/Cronks/lib/js/grid/GridPanel.js
+++ b/app/modules/Cronks/lib/js/grid/GridPanel.js
@@ -14,12 +14,8 @@ Cronk.grid.GridPanel = Ext.extend(Ext.grid.GridPanel, {
 	// Top toolbar of the grid
 	buildTopToolbar : function() {
 		
-		var autoRefresh = 300;
-
-		if (!Ext.isEmpty(this.meta.template.option.autoRefreshTime)) {
-			autoRefresh = this.meta.template.option.autoRefreshTime;
-		}
-
+		var autoRefresh = AppKit.getPrefVal('org.icinga.grid.refreshTime') || 300;
+		var autoRefreshDefault = AppKit.getPrefVal('org.icinga.autoRefresh') && AppKit.getPrefVal('org.icinga.autoRefresh') != 'false' 
 		return new Ext.Toolbar({
 			items: [{
 				text: _('Refresh'),
@@ -34,8 +30,7 @@ Cronk.grid.GridPanel = Ext.extend(Ext.grid.GridPanel, {
 				menu: {
 					items: [{
 						text: String.format(_('Auto refresh ({0} seconds)'), autoRefresh),
-						checked: false,
-
+						checked: autoRefreshDefault,
 						checkHandler: function(checkItem, checked) {
 							if (checked == true) {
 								this.trefresh = AppKit.getTr().start({
@@ -79,7 +74,22 @@ Cronk.grid.GridPanel = Ext.extend(Ext.grid.GridPanel, {
 						scope:this
 					}]
 				}
-			}]
+			}],
+			listeners: {
+				render: function(cmp) {
+					if(autoRefreshDefault) {
+						this.trefresh = AppKit.getTr().start({
+							run: function() {
+								AppKit.log("!");
+								this.getStore().reload();
+							},
+							interval: (autoRefresh*1000),
+							scope: this
+						});
+					}
+				},
+				scope: this			
+			}
 		});
 	},
 	





More information about the icinga-checkins mailing list