Skip to content

Commit

Permalink
#281 - details view of durable subscriber with option to delete it if…
Browse files Browse the repository at this point in the history
… it's not active
  • Loading branch information
dejanb committed Nov 29, 2013
1 parent 6575e3a commit 98957ce
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 17 deletions.
Expand Up @@ -6,11 +6,6 @@
title="Create durable subscriber">
<i class="icon-plus"></i> Create
</button>
<button class="btn" ng-disabled="!gridOptions.selectedItems.length"
ng-click="deleteSubscriberDialog.open()"
title="Delete the selected subscribers">
<i class="icon-remove"></i> Delete
</button>
<button class="btn" ng-click="refresh()"
title="Refreshes the list of subscribers">
<i class="icon-refresh"></i>
Expand Down Expand Up @@ -50,9 +45,9 @@
<div class="pull-right">
<form class="form-horizontal no-bottom-margin">

<button class="btn btn-danger" ng-disabled="!gridOptions.selectedItems.length"
ng-click="deleteDialog = true"
title="Delete the selected messages">
<button class="btn btn-danger" ng-disabled="showSubscriberDialog.subscriber.Status == 'Active'"
ng-click="deleteSubscriberDialog.open()"
title="Delete subscriber">
<i class="icon-remove"></i> Delete
</button>

Expand All @@ -74,10 +69,42 @@
</tr>
</thead>
<tbody>
<tr>
<td class="property-name">Client Id</td>
<td class="property-value">{{showSubscriberDialog.subscriber["ClientId"]}}</td>
</tr>
<tr>
<td class="property-name">Subscription Name</td>
<td class="property-value">{{showSubscriberDialog.subscriber["SubscriptionName"]}}</td>
</tr>
<tr>
<td class="property-name">Topic Name</td>
<td class="property-value">{{showSubscriberDialog.subscriber["DestinationName"]}}</td>
</tr>
<tr>
<td class="property-name">Selector</td>
<td class="property-value">{{showSubscriberDialog.subscriber["Selector"]}}</td>
</tr>
<tr>
<td class="property-name">Status</td>
<td class="property-value">{{showSubscriberDialog.subscriber.Status}}</td>
</tr>
<tr>
<td class="property-name">Enqueue Counter</td>
<td class="property-value">{{showSubscriberDialog.subscriber["EnqueueCounter"]}}</td>
</tr>
<tr>
<td class="property-name">Dequeue Counter</td>
<td class="property-value">{{showSubscriberDialog.subscriber["DequeueCounter"]}}</td>
</tr>
<tr>
<td class="property-name">Dispatched Counter</td>
<td class="property-value">{{showSubscriberDialog.subscriber["DispatchedCounter"]}}</td>
</tr>
<tr>
<td class="property-name">Pending Size</td>
<td class="property-value">{{showSubscriberDialog.subscriber["PendingQueueSize"]}}</td>
</tr>
</tbody>
</table>
</div>
Expand All @@ -87,4 +114,10 @@

</div>

<div hawtio-confirm-dialog="deleteSubscriberDialog.show" ok-button-text="Yes" cancel-button-text="No" on-ok="deleteSubscribers()">
<div class="dialog-body">
<p>Are you sure you want to delete the subscriber</p>
</div>
</div>

</div>
21 changes: 12 additions & 9 deletions hawtio-web/src/main/webapp/app/activemq/js/durableSubscriber.ts
Expand Up @@ -73,19 +73,22 @@ module ActiveMQ {
}

$scope.deleteSubscribers = () => {
var selection = workspace.selection;
var mbean = selection.objectName;
if (mbean && selection) {
var selectedItems = $scope.gridOptions.selectedItems;
angular.forEach(selectedItems, (item, idx) => {
alert("deleting " + item.clientId);
});
}
var mbean = getBrokerMBean(jolokia);
if (mbean) {
jolokia.execute(mbean, "destroyDurableSubscriber(java.lang.String, java.lang.String)", $scope.showSubscriberDialog.subscriber.ClientId, $scope.showSubscriberDialog.subscriber.SubscriptionName, onSuccess(function() {
$scope.showSubscriberDialog.close();
notification('success', "Deleted durable subscriber");
loadTable();
}));
} else {
notification("error", "Could not find the Broker MBean!");
}
};

$scope.openSubscriberDialog = (subscriber) => {
jolokia.request({type: "read", mbean: subscriber.entity._id, attribute: ["SubscriptionName"]}, onSuccess((response) => {
jolokia.request({type: "read", mbean: subscriber.entity._id}, onSuccess((response) => {
$scope.showSubscriberDialog.subscriber = response.value;
$scope.showSubscriberDialog.subscriber.Status = subscriber.entity.status;
console.log("Subscriber is now " + $scope.showSubscriberDialog.subscriber);
Core.$apply($scope);

Expand Down

0 comments on commit 98957ce

Please sign in to comment.