Skip to content

Commit

Permalink
activemq - move messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dejanb committed Apr 26, 2013
1 parent 37e99b3 commit b6c62b3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
15 changes: 14 additions & 1 deletion hawtio-web/src/main/webapp/app/activemq/html/browseQueue.html
Expand Up @@ -7,7 +7,7 @@
<div class="span6">
<div class="pull-right">
<form class="form-inline">
<button class="btn" ng-disabled="!selectedItems.length" ng-click="move()"
<button class="btn" ng-disabled="!selectedItems.length" ng-click="moveDialog.open()"
title="Move the selected messages to another destination" data-placement="bottom">
<i class="icon-move"></i> Move
</button>
Expand Down Expand Up @@ -84,5 +84,18 @@
</div>
</form>
</div>

<div modal="moveDialog.show" close="moveDialog.close()" options="moveDialog.options">
<form class="form-horizontal no-bottom-margin" ng-submit="moveDialog.close()">
<div class="modal-header"><h4>Move to</h4></div>
<div class="modal-body">
<p>Move {{selectedItems.length}} messages to <input type="text" style="width: 100%" ng-model="queueName" placeholder="Queue name"></p>
</div>
<div class="modal-footer">
<input id="submit" class="btn btn-primary add" type="submit" ng-click="moveMessagesAndCloseMoveDialog()" value="Move">
<button class="btn btn-warning cancel" type="button" ng-click="moveDialog.close()">Cancel</button>
</div>
</form>
</div>
</div>

23 changes: 20 additions & 3 deletions hawtio-web/src/main/webapp/app/activemq/js/browse.ts
Expand Up @@ -9,6 +9,9 @@ module ActiveMQ {

$scope.deleteDialog = new Core.Dialog();
$scope.messageDialog = new Core.Dialog();
$scope.moveDialog = new Core.Dialog();

$scope.showMoveDialog = false;

$scope.gridOptions = {
selectedItems: $scope.selectedItems,
Expand Down Expand Up @@ -87,9 +90,23 @@ module ActiveMQ {
}
};

$scope.move = () => {
console.log("moving selected items " + $scope.selectedItems.length + " to another destination!");
};
$scope.moveMessagesAndCloseMoveDialog = () => {
var jolokia = workspace.jolokia;
var selection = workspace.selection;
var mbean = selection.objectName;
if (mbean && selection && jolokia) {
$scope.message = "Moved " + Core.maybePlural($scope.selectedItems.length, "message" + " to " + $scope.queueName);
var operation = "moveMessageTo(java.lang.String, java.lang.String)"
angular.forEach($scope.selectedItems, (item, idx) => {
var id = item.JMSMessageID;
if (id) {
var callback = (idx + 1 < $scope.selectedItems.length) ? intermediateResult : deleteSuccess;
jolokia.execute(mbean, operation, id, $scope.queueName, onSuccess(callback));
}
});
}
$scope.moveDialog.close();
}

$scope.deleteMessagesAndCloseDeleteDialog = () => {
var jolokia = workspace.jolokia;
Expand Down

0 comments on commit b6c62b3

Please sign in to comment.