Skip to content

Commit

Permalink
fixes #318 so we can now either delete or purge a queue
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed May 2, 2013
1 parent 4293543 commit 713f091
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
30 changes: 21 additions & 9 deletions hawtio-web/src/main/webapp/app/activemq/html/deleteQueue.html
@@ -1,13 +1,25 @@
<form class="form-horizontal" ng-controller="ActiveMQ.DestinationController">
<div ng-controller="ActiveMQ.DestinationController">
<div class="row-fluid">

<div class="control-group">
<div class="alert">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Warning!</strong> You are about to delete queue '{{name()}}'.
<br/>
This operation cannot be undone!
</div>
<div class="alert">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Warning:</strong> these operations cannot be undone. Please be careful!
</div>
</div>
<div class="control-group">
</div>
<div class="row-fluid">
<div class="span4">
<div class="control-group">
<button type="submit" class="btn btn-warning" ng-click="deleteDestination()">Delete Queue '{{name()}}'</button>
<label>This will remove the queue completely.</label>
</div>
</div>
<div class="span4">
<div class="control-group">
<button type="submit" class="btn btn-warning" ng-click="purgeDestination()">Purge Queue '{{name()}}'</button>
<label>Purges all the current messages on the queue.</label>
</div>
</div>
</form>
</div>
</div>
8 changes: 4 additions & 4 deletions hawtio-web/src/main/webapp/app/activemq/js/activemqPlugin.ts
Expand Up @@ -87,13 +87,13 @@ module ActiveMQ {
href: () => "#/activemq/subscribers"
});
workspace.subLevelTabs.push({
content: '<i class="icon-plus"></i> Create Queue',
content: '<i class="icon-plus"></i> Create',
title: "Create a new queue",
isValid: (workspace:Workspace) => isQueuesFolder(workspace) || isBroker(workspace),
href: () => "#/activemq/createQueue"
});
workspace.subLevelTabs.push({
content: '<i class="icon-plus"></i> Create Topic',
content: '<i class="icon-plus"></i> Create',
title: "Create a new topic",
isValid: (workspace:Workspace) => isTopicsFolder(workspace) || isBroker(workspace),
href: () => "#/activemq/createTopic"
Expand All @@ -105,8 +105,8 @@ module ActiveMQ {
href: () => "#/activemq/deleteTopic"
});
workspace.subLevelTabs.push({
content: '<i class="icon-remove"></i> Delete Queue',
title: "Delete this queue",
content: '<i class="icon-remove"></i> Delete',
title: "Delete or purge this queue",
isValid: (workspace:Workspace) => isQueue(workspace),
href: () => "#/activemq/deleteQueue"
});
Expand Down
17 changes: 13 additions & 4 deletions hawtio-web/src/main/webapp/app/activemq/js/destination.ts
@@ -1,5 +1,5 @@
module ActiveMQ {
export function DestinationController($scope, $location, workspace:Workspace) {
export function DestinationController($scope, workspace:Workspace, jolokia) {
$scope.workspace = workspace;
$scope.message = "";

Expand Down Expand Up @@ -46,7 +46,6 @@ module ActiveMQ {
}

$scope.createDestination = (name, isQueue) => {
var jolokia = workspace.jolokia;
var mbean = getBrokerMBean(jolokia);
if (mbean) {
var operation;
Expand All @@ -66,13 +65,11 @@ module ActiveMQ {
};

$scope.deleteDestination = () => {
var jolokia = workspace.jolokia;
var mbean = getBrokerMBean(jolokia);
var selection = workspace.selection;
var entries = selection.entries;
if (mbean && selection && jolokia && entries) {
var domain = selection.domain;
//var name = entries["Destination"];
var name = entries["Destination"] || entries["destinationName"] || selection.title;
var isQueue = "Topic" !== (entries["Type"] || entries["destinationType"]);
var operation;
Expand All @@ -87,6 +84,18 @@ module ActiveMQ {
}
};

$scope.purgeDestination = () => {
var mbean = workspace.getSelectedMBeanName();
var selection = workspace.selection;
var entries = selection.entries;
if (mbean && selection && jolokia && entries) {
var name = entries["Destination"] || entries["destinationName"] || selection.title;
var operation = "purge()";
$scope.message = "Purged queue " + name;
jolokia.execute(mbean, operation, onSuccess(operationSuccess));
}
};

$scope.name = () => {
var selection = workspace.selection;
if (selection) {
Expand Down

0 comments on commit 713f091

Please sign in to comment.