Skip to content

Commit

Permalink
#281 - add support for adding new durable subscribers through ui
Browse files Browse the repository at this point in the history
  • Loading branch information
dejanb committed Nov 28, 2013
1 parent 49dcd9e commit cc8cb3a
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 3 deletions.
@@ -1,5 +1,46 @@
<form class="form-horizontal" ng-controller="ActiveMQ.DurableSubscriberController">
<div ng-controller="ActiveMQ.DurableSubscriberController">
<div class="row-fluid">
<div class="span12">
<div class="pull-right">
<button class="btn" ng-click="createSubscriberDialog.open()"
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>
</button>
</div>
</div>
</div>

<div class="row-fluid">
<div class="gridStyle" ng-grid="gridOptions"></div>
</div>
</form>

<div modal="createSubscriberDialog.show">
<form name="createSubscriber" class="form-horizontal no-bottom-margin" ng-submit="doCreateSubscriber(clientId, subscriberName, topicName, selector)">
<div class="modal-header"><h4>Create Durable Subscriber</h4></div>
<div class="modal-body">
<label>Client Id: </label>
<input name="clientId" class="input-xlarge" type="text" ng-model="clientId" required>
<label>Subscriber Name: </label>
<input name="subscriberName" class="input-xlarge" type="text" ng-model="subscriberName" required>
<label>Topic Name: </label>
<input name="topicName" class="input-xlarge" type="text" ng-model="topicName" required>
<label>Selector: </label>
<input name="subSelector" class="input-xlarge" type="text" ng-model="subSelector">
</div>
<div class="modal-footer">
<input class="btn btn-success" type="submit" value="Create">
<input class="btn btn-primary" ng-click="createSubscriberDialog.close()" value="Cancel">
</div>
</form>
</div>

</div>
42 changes: 41 additions & 1 deletion hawtio-web/src/main/webapp/app/activemq/js/durableSubscriber.ts
Expand Up @@ -7,6 +7,14 @@ module ActiveMQ {

$scope.tempData = [];

$scope.createSubscriberDialog = new Core.Dialog();
$scope.deleteSubscriberDialog = new Core.Dialog();

$scope.topicName = '';
$scope.clientId = '';
$scope.subscriberName = '';
$scope.subSelector = '';

$scope.gridOptions = {
selectedItems: [],
data: 'durableSubscribers',
Expand All @@ -19,7 +27,7 @@ module ActiveMQ {
filterText: ''
},
selectWithCheckboxOnly: true,
showSelectionCheckbox: true,
showSelectionCheckbox: false,
maintainColumnRatios: false,
columnDefs: [
{
Expand All @@ -40,6 +48,38 @@ module ActiveMQ {
]
};

$scope.doCreateSubscriber = (clientId, subscriberName, topicName, subSelector) => {
$scope.createSubscriberDialog.close();
$scope.clientId = clientId;
$scope.subscriberName = subscriberName;
$scope.topicName = topicName;
$scope.subSelector = subSelector;
var mbean = getBrokerMBean(jolokia);
if (mbean) {
jolokia.execute(mbean, "createDurableSubscriber(java.lang.String, java.lang.String, java.lang.String, java.lang.String)", $scope.clientId, $scope.subscriberName, $scope.topicName, $scope.subSelector, onSuccess(function() {
notification('success', "Created durable subscriber " + clientId);
$scope.clientId = '';
$scope.subscriberName = '';
$scope.topicName = '';
$scope.subSelector = '';
loadTable();
}));
} else {
notification("error", "Could not find the Broker MBean!");
}
}

$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);
});
}
};

$scope.$watch('workspace.selection', function () {
if (workspace.moveIfViewInvalid()) return;

Expand Down

0 comments on commit cc8cb3a

Please sign in to comment.