Skip to content

Commit

Permalink
add completion of queue names in the move UI
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Apr 30, 2013
1 parent 79efe57 commit 99259ec
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
41 changes: 26 additions & 15 deletions hawtio-web/src/main/webapp/app/activemq/html/browseQueue.html
Expand Up @@ -73,7 +73,7 @@
<div class="modal-body">
<p>You are about to delete
<ng-pluralize count="selectedItems.length"
when="{'1': 'a message!', 'other': '{} messages!'}">
when="{'1': 'a message!', 'other': '{} messages!'}">
</ng-pluralize>
</p>
<p>This operation cannot be undone so please be careful.</p>
Expand All @@ -85,20 +85,31 @@
</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 <ng-pluralize count="selectedItems.length"
when="{'1': 'a message', 'other': 'messages'}"></ng-pluralize>
</h4></div>
<div class="modal-body">
<p>Move <ng-pluralize count="selectedItems.length"
when="{'1': 'a message', 'other': '{} messages'}"></ng-pluralize>
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>
<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
<ng-pluralize count="selectedItems.length"
when="{'1': 'a message', 'other': 'messages'}"></ng-pluralize>
</h4>
</div>
<div class="modal-body">
<p>Move
<ng-pluralize count="selectedItems.length"
when="{'1': 'a message', 'other': '{} messages'}"></ng-pluralize>
to: <input type="text" style="width: 100%" ng-model="queueName" placeholder="Queue name"
typeahead="title for title in queueNames() | filter:$viewValue" typeahead-editable='false'></p>
<p>
You cannot undo this operation.
Though after the move you can always move the <ng-pluralize count="selectedItems.length"
when="{'1': 'a message', 'other': 'messages'}"></ng-pluralize> back again.
</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>
Expand Down
5 changes: 5 additions & 0 deletions hawtio-web/src/main/webapp/app/activemq/js/browse.ts
Expand Up @@ -127,6 +127,11 @@ module ActiveMQ {
$scope.deleteDialog.close();
};

$scope.queueNames = () => {
var queuesFolder = getSelectionQueuesFolder(workspace);
return (queuesFolder) ? queuesFolder.children.map(n => n.title) : [];
};

function populateTable(response) {
$scope.messages = response.value;
angular.forEach($scope.messages, (message) => {
Expand Down
21 changes: 21 additions & 0 deletions hawtio-web/src/main/webapp/app/activemq/js/helpers.ts
@@ -1,3 +1,24 @@
module ActiveMQ {

export function getSelectionQueuesFolder(workspace) {
function findQueuesFolder(node) {
if (node) {
if (node.title === "Queues" || node.title === "Queue") {
return node;
}
var parent = node.parent;
if (parent) {
return findQueuesFolder(parent);
}
}
return null;
}


var selection = workspace.selection;
if (selection) {
return findQueuesFolder(selection);
}
return null;
}
}

0 comments on commit 99259ec

Please sign in to comment.