Skip to content

Commit

Permalink
add jmxTreeUpdated events so that the application and connectors view…
Browse files Browse the repository at this point in the history
…s update automatically when a web app / connector starts/stops (e.g. if you drop a war into the webapps dir)
  • Loading branch information
jstrachan committed Apr 18, 2013
1 parent ab3cfa9 commit 3db1e93
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
16 changes: 11 additions & 5 deletions hawtio-web/src/main/webapp/app/jetty/js/connectors.ts
Expand Up @@ -84,14 +84,20 @@ module Jetty {
loadData();
};

$scope.$watch('workspace.tree', function () {
// if the JMX tree is reloaded its probably because a new MBean has been added or removed
// so lets reload, asynchronously just in case
setTimeout(loadData, 50);
});
$scope.$on('jmxTreeUpdated', reloadFunction);
$scope.$watch('workspace.tree', reloadFunction);

function reloadFunction() {
// if the JMX tree is reloaded its probably because a new MBean has been added or removed
// so lets reload, asynchronously just in case
setTimeout(loadData, 50);
}


function loadData() {
console.log("Loading Jetty connector data...");
var tree = workspace.tree;

jolokia.search("org.eclipse.jetty.server.nio:type=selectchannelconnector,*", onSuccess(render));
}

Expand Down
15 changes: 9 additions & 6 deletions hawtio-web/src/main/webapp/app/jetty/js/jetty.ts
Expand Up @@ -122,13 +122,16 @@ module Jetty {
//console.log("got response: " + response);
};

$scope.$watch('workspace.tree', function () {
// if the JMX tree is reloaded its probably because a new MBean has been added or removed
// so lets reload, asynchronously just in case
setTimeout(loadData, 50);
});
$scope.$on('jmxTreeUpdated', reloadFunction);
$scope.$watch('workspace.tree', reloadFunction);

function loadData() {
function reloadFunction() {
// if the JMX tree is reloaded its probably because a new MBean has been added or removed
// so lets reload, asynchronously just in case
setTimeout(loadData, 50);
}

function loadData() {
console.log("Loading Jetty webapp data...");
// support embedded jetty which may use morbay mbean names
jolokia.search("org.mortbay.jetty.plugin:type=jettywebappcontext,*", onSuccess(render));
Expand Down

0 comments on commit 3db1e93

Please sign in to comment.