Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#282 - jms scheduler support
- Loading branch information
Showing
4 changed files
with
167 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div ng-controller="ActiveMQ.JobSchedulerController"> | ||
|
||
<div class="row-fluid"> | ||
<div class="span12"> | ||
<div class="pull-right"> | ||
<form class="form-inline"> | ||
<button class="btn" ng-disabled="!gridOptions.selectedItems.length" | ||
ng-click="deleteJobsDialog.open()" | ||
title="Delete the selected jobs"> | ||
<i class="icon-remove"></i> Delete | ||
</button> | ||
<button class="btn" ng-click="refresh()" | ||
title="Refreshes the list of subscribers"> | ||
<i class="icon-refresh"></i> | ||
</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row-fluid"> | ||
<div class="gridStyle" ng-grid="gridOptions"></div> | ||
</div> | ||
|
||
<div hawtio-confirm-dialog="deleteJobsDialog.show" ok-button-text="Yes" cancel-button-text="No" on-ok="deleteJobs()"> | ||
<div class="dialog-body"> | ||
<p>Are you sure you want to delete the jobs</p> | ||
</div> | ||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
module ActiveMQ { | ||
export function JobSchedulerController($scope, workspace:Workspace, jolokia) { | ||
|
||
$scope.refresh = loadTable; | ||
|
||
$scope.jobs = []; | ||
$scope.deleteJobsDialog = new Core.Dialog(); | ||
|
||
$scope.gridOptions = { | ||
selectedItems: [], | ||
data: 'jobs', | ||
displayFooter: false, | ||
showFilter: false, | ||
showColumnMenu: true, | ||
enableColumnResize: true, | ||
enableColumnReordering: true, | ||
filterOptions: { | ||
filterText: '' | ||
}, | ||
selectWithCheckboxOnly: true, | ||
showSelectionCheckbox: true, | ||
maintainColumnRatios: false, | ||
columnDefs: [ | ||
{ | ||
field: 'jobId', | ||
displayName: 'Job ID', | ||
width: '25%' | ||
}, | ||
{ | ||
field: 'cronEntry', | ||
displayName: 'Cron Entry', | ||
width: '10%' | ||
}, | ||
{ | ||
field: 'delay', | ||
displayName: 'Delay', | ||
width: '5%' | ||
}, | ||
{ | ||
field: 'repeat', | ||
displayName: 'repeat', | ||
width: '5%' | ||
}, | ||
{ | ||
field: 'period', | ||
displayName: 'period', | ||
width: '5%' | ||
}, | ||
{ | ||
field: 'start', | ||
displayName: 'Start', | ||
width: '25%' | ||
}, | ||
{ | ||
field: 'next', | ||
displayName: 'Next', | ||
width: '25%' | ||
} | ||
] | ||
}; | ||
|
||
$scope.$watch('workspace.selection', function () { | ||
if (workspace.moveIfViewInvalid()) return; | ||
|
||
// lets defer execution as we may not have the selection just yet | ||
setTimeout(loadTable, 50); | ||
}); | ||
|
||
function loadTable() { | ||
var selection = workspace.selection; | ||
if (selection) { | ||
var mbean = selection.objectName; | ||
if (mbean) { | ||
jolokia.request( | ||
{type: 'read', mbean: mbean, attribute: "AllJobs"}, | ||
onSuccess(populateTable)); | ||
} | ||
} | ||
Core.$apply($scope); | ||
} | ||
|
||
function populateTable(response) { | ||
var data = response.value; | ||
if (!angular.isArray(data)) { | ||
$scope.jobs = []; | ||
angular.forEach(data, (value, idx) => { | ||
$scope.jobs.push(value); | ||
}); | ||
} else { | ||
$scope.jobs = data | ||
} | ||
Core.$apply($scope); | ||
} | ||
|
||
$scope.deleteJobs = () => { | ||
var selection = workspace.selection; | ||
var mbean = selection.objectName; | ||
if (mbean && selection) { | ||
var selectedItems = $scope.gridOptions.selectedItems; | ||
$scope.message = "Deleted " + Core.maybePlural(selectedItems.length, "job"); | ||
var operation = "removeJob(java.lang.String)"; | ||
angular.forEach(selectedItems, (item, idx) => { | ||
var id = item.jobId; | ||
if (id) { | ||
var callback = (idx + 1 < selectedItems.length) ? intermediateResult : operationSuccess; | ||
jolokia.execute(mbean, operation, id, onSuccess(callback)); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
function intermediateResult() { | ||
} | ||
|
||
function operationSuccess() { | ||
$scope.gridOptions.selectedItems.splice(0); | ||
notification("success", $scope.message); | ||
setTimeout(loadTable, 50); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters