Author: chirino
Date: Thu Jan 3 23:16:33 2013
New Revision: 1428667
URL: http://svn.apache.org/viewvc?rev=1428667&view=rev
Log:
Added support for deleting destinations via 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=1428667&r1=1428666&r2=1428667&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 Thu Jan
3 23:16:33 2013
@@ -139,23 +139,23 @@
<table class="details table table-bordered table-striped" style="">
<tbody>
<tr>
- <th><input type="checkbox" id="all"></th>
+ <th>{{view Ember.Checkbox checkedBinding="App.DestinationsController.all_checked"}}</th>
<th>Name</th>
<th>Messages</th>
<th>Size</th>
<th>Producers</th>
- <th>Consumer</th>
+ <th>Consumers</th>
</tr>
{{#each App.DestinationsController}}
<tr>
- <td><input type="checkbox" id="foo"></td>
+ <td>{{view Ember.Checkbox checkedBinding="checked"}}</td>
<td><i class=" icon-zoom-in"></i> {{[0]}}</td><td>{{[1]}}</td><td>{{[2]}}</td><td>{{[3]}}</td><td>{{[4]}}</td>
</tr>
{{/each}}
</tbody>
</table>
<div style="padding:.5em 0">
- <button class="btn btn-small">Delete</button>
+ <button class="btn btn-small" {{action "remove" target="App.DestinationsController"
on="click"}}>Delete</button>
</div>
</div>
</div>
@@ -258,11 +258,11 @@
</footer>
<script src="js/jquery-1.7.2.min.js"></script>
-<script src="js/excanvas.min.js"></script>
-<script src="js/jquery.flot.js"></script>
-<script src="js/jquery.flot.pie.js"></script>
-<script src="js/jquery.flot.orderBars.js"></script>
-<script src="js/jquery.flot.resize.js"></script>
+<!--<script src="js/excanvas.min.js"></script>-->
+<!--<script src="js/jquery.flot.js"></script>-->
+<!--<script src="js/jquery.flot.pie.js"></script>-->
+<!--<script src="js/jquery.flot.orderBars.js"></script>-->
+<!--<script src="js/jquery.flot.resize.js"></script>-->
<script src="js/bootstrap.js"></script>
<script src="js/handlebars-1.0.0.beta.6.js"></script>
<script src="js/ember-1.0.0-pre.2.js"></script>
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=1428667&r1=1428666&r2=1428667&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 Thu Jan 3
23:16:33 2013
@@ -30,15 +30,7 @@ App = Em.Application.create({
}
},
- get:function(path, success, error) {
- this.http("GET", path, success, error)
- },
-
- put:function(path, success, error) {
- this.http("PUT", path, success, error)
- },
-
- http:function(type, path, success, error) {
+ ajax:function(type, path, success, error) {
if( !error ) {
error = this.default_error_handler;
}
@@ -100,7 +92,7 @@ App.LoginController = Em.Controller.crea
},
logout: function() {
- App.get("/session/signout", function(data) {
+ App.ajax("GET", "/session/signout", function(data) {
App.LoginController.set('content', data);
});
this.set('content', null);
@@ -125,7 +117,7 @@ App.LoginController = Em.Controller.crea
refresh: function(clear) {
var was_logged_in = this.get('is_logged_in')
var kind = this.get('kind')
- App.get("/session/whoami", function(data) {
+ App.ajax("GET", "/session/whoami", function(data) {
App.LoginController.set('content', data);
if( App.LoginController.get('is_logged_in') ) {
App.refresh();
@@ -139,7 +131,7 @@ App.LoginController = Em.Controller.crea
App.broker = Ember.Object.create({});
App.BrokerController = Ember.Controller.create({
refresh: function() {
- App.get("/broker", function(json) {
+ App.ajax("GET", "/broker", function(json) {
App.broker.setProperties(json);
if( App.VirtualHostController.get('selected') == null && json.virtual_hosts.length
> 0 ) {
App.VirtualHostController.set('selected', json.virtual_hosts[0]);
@@ -158,10 +150,10 @@ App.VirtualHostController = Em.ArrayCont
refresh: function() {
var selected = this.get("selected")
if( selected ) {
- App.get("/broker/virtual-hosts/"+selected, function(host) {
+ App.ajax("GET", "/broker/virtual-hosts/"+selected, function(host) {
App.virtual_host.setProperties(host);
if( host.store ) {
- App.get("/broker/virtual-hosts/"+selected+"/store", function(store) {
+ App.ajax("GET", "/broker/virtual-hosts/"+selected+"/store", function(store) {
App.virtual_host_store.setProperties(store);
});
}
@@ -196,7 +188,7 @@ App.DestinationsController = Ember. Arra
}
var kind = this.get('kind')
var fields = ['id', 'metrics.queue_items', 'metrics.queue_size', 'metrics.producer_count',
'metrics.consumer_count'];
- App.get("/broker/virtual-hosts/"+virtual_host+"/"+kind+"?ps=10000&f="+fields.join("&f="),
function(data) {
+ App.ajax("GET", "/broker/virtual-hosts/"+virtual_host+"/"+kind+"?ps=10000&f="+fields.join("&f="),
function(data) {
App.DestinationsController.set('content', data.rows);
});
}.observes("virtual_host", "kind"),
@@ -210,9 +202,33 @@ App.DestinationsController = Ember. Arra
var virtual_host = this.get('virtual_host');
var kind = this.get('kind');
var create_name = this.get('create_name');
- var self = this;
- App.put("/broker/virtual-hosts/"+virtual_host+"/"+kind+"/"+create_name, function(data)
{
- self.refresh();
+ this.set('create_name', "");
+ App.ajax("PUT", "/broker/virtual-hosts/"+virtual_host+"/"+kind+"/"+create_name, function(data)
{
+ App.DestinationsController.refresh();
+ });
+ },
+
+ all_checked:false,
+
+ check_all_toggle: function() {
+ var all_checked= this.get("all_checked");
+ this.get('content').forEach(function(item){
+ item.set('checked', all_checked);
+ });
+ }.observes("all_checked"),
+
+ remove: function() {
+ var virtual_host = this.get('virtual_host');
+ var kind = this.get('kind');
+ var content = this.get('content');
+ content.forEach(function(item){
+ var checked = item.get('checked');
+ if( checked ) {
+ var name = item.get(0);
+ App.ajax("DELETE", "/broker/virtual-hosts/"+virtual_host+"/"+kind+"/"+name, function(data)
{
+ App.DestinationsController.refresh();
+ });
+ }
});
},
|