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 31, 2013
1 parent 3812ec7 commit 3900efc
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 14 deletions.
26 changes: 21 additions & 5 deletions hawtio-web/src/main/webapp/app/quartz/html/schedulers.html
Expand Up @@ -19,8 +19,27 @@
}
</style>

<div ng-show="selectedSchedulerMBean" class="row-fluid">
<form>
<div ng-show="selectedSchedulerMBean">

<div class="row-fluid">
<div class="pull-right">
<form class="form-inline no-bottom-margin">
<fieldset>
<div class="controls control-group inline-block controls-row">
<div class="btn-group">
<button
ng-disabled="selectedScheduler.Started"
class="btn" ng-click="startScheduler()" title="Start Scheduler">
<i class="icon-play-circle"></i></button>
<button
ng-disabled="!selectedScheduler.Started"
class="btn" ng-click="pauseScheduler()" title="Pause Scheduler">
<i class="icon-off"></i></button>
</div>
</div>
</fieldset>
</form>
</div>

<div class="row-fluid">
<dl class="dl-horizontal">
Expand All @@ -34,8 +53,6 @@
<dd><i class="{{selectedSchedulerIcon}}"></i></dd>
<dt>Shutdown</dt>
<dd>{{selectedScheduler.Shutdown}}</dd>
<dt>Standby</dt>
<dd>{{selectedScheduler.Standby}}</dd>
</dl>
</div>

Expand Down Expand Up @@ -63,7 +80,6 @@
</dl>
</div>

</form>
</div>

</div>
Expand Down
4 changes: 2 additions & 2 deletions hawtio-web/src/main/webapp/app/quartz/html/triggers.html
Expand Up @@ -19,11 +19,11 @@
<div class="btn-group">
<button
ng-disabled="gridOptions.selectedItems.length == 0 || gridOptions.selectedItems[0].state != 'PAUSED'"
class="btn" ng-click="resume()" title="Resume">
class="btn" ng-click="resumeTrigger()" title="Resume">
<i class="icon-play-circle"></i></button>
<button
ng-disabled="gridOptions.selectedItems.length == 0 || gridOptions.selectedItems[0].state == 'PAUSED'"
class="btn" ng-click="pause()" title="Pause">
class="btn" ng-click="pauseTrigger()" title="Pause">
<i class="icon-off"></i></button>
</div>
</div>
Expand Down
33 changes: 27 additions & 6 deletions hawtio-web/src/main/webapp/app/quartz/js/quartz.ts
@@ -1,3 +1,6 @@
/**
* @module Quartz
*/
module Quartz {

export function QuartzController($scope, $location:ng.ILocationService, workspace:Workspace, jolokia) {
Expand Down Expand Up @@ -134,9 +137,9 @@ module Quartz {
var newScheduler = $scope.selectedScheduler !== obj;
if (newScheduler) {
$scope.triggers = [];
$scope.selectedScheduler = obj;
}

$scope.selectedScheduler = obj;
$scope.selectedSchedulerIcon = Quartz.iconClass(obj.Started);

// grab state for all triggers which requires to call a JMX operation per trigger
Expand Down Expand Up @@ -196,7 +199,25 @@ module Quartz {
}
}

$scope.pause = () => {
$scope.pauseScheduler = () => {
if ($scope.selectedSchedulerMBean) {
jolokia.request({type: "exec", mbean: $scope.selectedSchedulerMBean,
operation: "standby"});

notification("success", "Paused scheduler " + $scope.selectedScheduler.SchedulerName);
}
}

$scope.startScheduler = () => {
if ($scope.selectedSchedulerMBean) {
jolokia.request({type: "exec", mbean: $scope.selectedSchedulerMBean,
operation: "start"});

notification("success", "Started scheduler " + $scope.selectedScheduler.SchedulerName);
}
}

$scope.pauseTrigger = () => {
if ($scope.gridOptions.selectedItems.length === 1) {
var groupName = $scope.gridOptions.selectedItems[0].group;
var triggerName = $scope.gridOptions.selectedItems[0].name;
Expand All @@ -208,7 +229,7 @@ module Quartz {
}
}

$scope.resume = () => {
$scope.resumeTrigger = () => {
if ($scope.gridOptions.selectedItems.length === 1) {
var groupName = $scope.gridOptions.selectedItems[0].group;
var triggerName = $scope.gridOptions.selectedItems[0].name;
Expand All @@ -221,7 +242,7 @@ module Quartz {
}

function reloadTree() {
log.info("Reloading Quartz Tree")
log.debug("Reloading Quartz Tree")
var mbean = Quartz.getQuartzMBean(workspace);
var domain = "quartz";
var rootFolder = new Folder("Quartz Schedulers");
Expand All @@ -248,13 +269,13 @@ module Quartz {
rootFolder.children.push(scheduler);
});

log.info("Setitng up Quartz tree with nid " + $location.search()["nid"]);
log.debug("Setitng up Quartz tree with nid " + $location.search()["nid"]);
var nid = $location.search()["nid"];
if (nid) {
var data = rootFolder.children.filter(folder => {
return folder.key === nid;
});
log.info("Found nid in tree " + data);
log.debug("Found nid in tree " + data);
if (data && data.length === 1) {
selectionChanged(data[0]);
}
Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/test/resources/applicationContext.xml
Expand Up @@ -172,7 +172,7 @@
<from uri="quartz2:mygroup/mytimer?trigger.repeatInterval=20000&amp;trigger.repeatCount=-1"/>
<log message="Quartz2 mytrigger fired"/>
<delay><constant>10000</constant></delay>
<log message="Quartz mytrigger done"/>
<log message="Quartz2 mytrigger done"/>
</route>

<route id="quartzRoute2">
Expand Down

0 comments on commit 3900efc

Please sign in to comment.