Skip to content

Commit

Permalink
#786: Quartz plugin. Work in progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Dec 30, 2013
1 parent 834a4a8 commit bf8570e
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions hawtio-web/src/main/webapp/app/quartz/js/quartz.ts
Expand Up @@ -10,7 +10,7 @@ module Quartz {
$scope.selectedSchedulerDetails = [];
$scope.selectedSchedulerIcon = null;
$scope.selectedScheduler = null;
$scope.selectedSchedulerMBean = null;
$scope.selectedSchedulerMBean = $location.search()["nid"];
$scope.triggers = [];
$scope.jobs = [];

Expand Down Expand Up @@ -246,12 +246,12 @@ module Quartz {
function updateSelectionFromURL() {
Jmx.updateTreeSelectionFromURLAndAutoSelect($location, $("#quartztree"), (first) => {
// use function to auto select first scheduler if there is only one scheduler
var schedulers = first.getChildren();
if (schedulers && schedulers.length === 1) {
first = schedulers[0];
return first;
}
}, true);
var schedulers = first.getChildren();
if (schedulers && schedulers.length === 1) {
first = schedulers[0];
return first;
}
}, true);
}

function selectionChanged(data) {
Expand All @@ -266,20 +266,20 @@ module Quartz {
// TODO: is there a better way to add our nid to the uri parameter?
$location.search({nid: data.key});

var request = [{type: "read", mbean: $scope.selectedSchedulerMBean}];
var request = [
{type: "read", mbean: $scope.selectedSchedulerMBean}
];
Core.register(jolokia, $scope, request, onSuccess($scope.renderQuartz));
} else {
Core.unregister(jolokia, $scope);
$scope.selectedSchedulerMBean = null;
$scope.selectedScheduler = null;
$scope.triggers = [];
$scope.jobs = [];
// TODO: clear parameters?
$location.search() == {};
}
}

function includePropertyValue(key: string, value) {
function includePropertyValue(key:string, value) {
// skip these keys as we have hardcoded them to be shown already
if ("SchedulerName" === key || "Version" === key || "Started" === key) {
return false;
Expand All @@ -288,7 +288,16 @@ module Quartz {
return !angular.isObject(value);
}

// force tree to be loaded on startup
$scope.$on("$routeChangeSuccess", function (event, current, previous) {
// lets do this asynchronously to avoid Error: $digest already in progress
setTimeout(updateSelectionFromURL, 50);
});

$scope.$on('jmxTreeUpdated', function () {
reloadTree();
});

// reload tree on startup
reloadTree();
}

Expand Down

0 comments on commit bf8570e

Please sign in to comment.