You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2013/01/30 15:25:57 UTC

svn commit: r1440431 - in /activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console: index.html js/app.js

Author: chirino
Date: Wed Jan 30 14:25:57 2013
New Revision: 1440431

URL: http://svn.apache.org/viewvc?rev=1440431&view=rev
Log:
Support changing the refresh interval of the ajax console.

Modified:
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html?rev=1440431&r1=1440430&r2=1440431&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html Wed Jan 30 14:25:57 2013
@@ -49,6 +49,7 @@
           <li class="dropdown">
             <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i>{{App.LoginController.user_name}}<b class="caret"></b></a>
             <ul class="dropdown-menu">
+              <li><a href="#" {{action "show" target="App.SettingsView" on="click"}}>Settings</a></li>
               <li><a href="#" {{action "logout" target="App.LoginController" on="click"}}>Logout</a></li>
             </ul>
           </li>
@@ -60,6 +61,25 @@
   </script>
 </div>
 <div class="container" style="padding-top:52px;">
+  <script type="text/x-handlebars" data-template-name="settings">
+    <div class="modal-header">
+      <button type="button" class="close" {{action "hide" target="App.SettingsView" on="click"}}>&times;</button>
+      <h3>Settings</h3>
+    </div>
+    <div class="modal-body">
+      <form class="form-horizontal">
+       <div class="control-group">
+         <label class="control-label">Refresh Interval</label>
+         <div class="controls">
+           {{view App.NumberField valueBinding="App.refresh_interval"}}
+         </div>
+       </div>
+     </form>
+    </div>
+    <div class="modal-footer">
+      <a href="#" class="btn" {{action "hide" target="App.SettingsView" on="click"}}>Close</a>
+    </div>
+  </script>
   <div class="row" id="notifications" style="padding-top: 1em;" >
     <script type="text/x-handlebars" data-template-name="notifications">
     {{#if App.BrokerController.offline}}

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js?rev=1440431&r1=1440430&r2=1440431&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js Wed Jan 30 14:25:57 2013
@@ -87,14 +87,24 @@ App = Em.Application.create({
     height:$(window).height(),
     width:$(window).width(),
   },
+
+  refresh_interval:2,
+
   ready: function() {
-    setInterval(function() {
+    this.schedule_refresh();
+    this._super();
+    App.LoginController.refresh();
+  },
+
+  schedule_refresh: function() {
+    var refresh_interval = App.get("refresh_interval");
+    refresh_interval = Math.min(Math.max(1,refresh_interval), 360);
+    setTimeout(function() {
       if( App.LoginController.get('is_logged_in') ) {
         App.auto_refresh();
       }
-    }, 2000);
-    this._super();
-    App.LoginController.refresh();
+      App.schedule_refresh();
+    }, refresh_interval*1000);
   },
 
   auto_refresh: function() {
@@ -858,6 +868,14 @@ App.ConfigurationController = Ember.Cont
 
 });
 
+App.NumberField = Ember.TextField.extend({
+    _validation: function() {
+      var value = this.get('value');
+      value = value.toString().replace(/[^\d.]/g, "");
+      this.set('value', value);
+    }.observes('value')
+});
+
 App.AceView = Ember.View.extend({
 
   editor: null,
@@ -949,6 +967,21 @@ Ember.View.create({
   templateName: 'content',
 }).appendTo("#content-holder");
 
+App.SettingsView = Ember.View.create({
+  templateName: 'settings',
+  classNames:["modal", "hide", "fade"],
+  show: function(){
+    var id = this.$().attr('id');
+    $("#"+id).modal("show");
+  },
+  hide: function(){
+    var id = this.$().attr('id');
+    $("#"+id).modal("hide");
+  }
+})
+App.SettingsView.appendTo("#content-holder")
+
+
 App.ApplicationController = Ember.Controller.extend();
 App.ApplicationView = Ember.View.extend();
 App.Router = Ember.Router.extend({