Skip to content

Commit

Permalink
MOTECH-2729: Migrate Queues Admin Interface (#44)
Browse files Browse the repository at this point in the history
* MOTECH-2729: Migrate Queues Admin Interface

-Add all files

* MOTECH-2729: Migrate Queues Admin Interface

-first page works correctly
-second page doesn't work

* MOTECH-2729: Migrate Queues Admin Interface

-second page start work

* MOTECH-2729: Migrate Queues Admin Interface

-everything works

* MOTECH-2729: Migrate Queues Admin Interface

-change table to motech-list

* MOTECH-2729: Migrate Queues Admin Interface

-delete css
  • Loading branch information
DamianNowakSoldevelo authored and jredlarski committed Jul 27, 2016
1 parent 06ae72e commit 067e06f
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/admin/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<li><a>{{ 'admin.messages' | translate }}</a></li>
<li><a>{{ 'admin.settings' | translate }}</a></li>
<li ui-sref-active="active"><a ui-sref="log">{{ 'admin.log' | translate }}</a></li>
<li ui-sref-active="active"><a ui-sref="queues">{{ 'admin.queues' | translate }}</a></li>
<li ui-sref-active="active"><a ui-sref="topics">{{ 'admin.topics' | translate }}</a></li>
</ul>
3 changes: 3 additions & 0 deletions src/admin/queues/nav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<nav>
<a ui-sref-active="active" ui-sref="queues">{{'admin.queue.statistics'|translate}}</a>
</nav>
16 changes: 16 additions & 0 deletions src/admin/queues/queue.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(function () {
'use strict';

angular.module('motech-admin')
.controller('QueueController', controller);

controller.$inject = ['$scope', '$stateParams', '$http', 'ServerService'];
function controller ($scope, $stateParams, $http, ServerService) {
$scope.dataAvailable = true;
$http.get(ServerService.formatURL('/module/admin/api/queues/browse?queueName=' + $stateParams.queueName)).success(function (data) {
$scope.messages = data;
}).error(function () {
$scope.dataAvailable = false;
});
}
})();
10 changes: 10 additions & 0 deletions src/admin/queues/queue.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<motech-list ng-show="dataAvailable">
<motech-list-item ng-repeat="message in messages" >
<motech-list-column column-title="Message ID" sortable>{{message.messageId}}</motech-list-column>
<motech-list-column column-title="Redelivered" sortable>{{message.redelivered}}</motech-list-column>
<motech-list-column column-title="Timestamp" sortable>{{message.timestamp}}</motech-list-column>
</motech-list-item>
</motech-list>
<div class="row inside" ng-show="!dataAvailable">
{{'admin.queue.message.error'|translate}}
</div>
38 changes: 38 additions & 0 deletions src/admin/queues/queue.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(function () {
'use strict';

angular.module('motech-admin')
.config(adminRoutes);

adminRoutes.$inject = ['$stateProvider'];
function adminRoutes ($stateProvider) {
$stateProvider
.state('queues', {
url: '/queues',
ncyBreadcrumb: {
label: 'admin.queue.statistics'
},
views: {
'appArea@': {
templateUrl: '/admin/queues/queues-list.html',
controller: 'AdminQueueStatsCtrl'
},
'secondaryNav@': {
templateUrl: '/admin/queues/nav.html'
}
}
})
.state('queues.queue', {
url: '/:queueName',
ncyBreadcrumb: {
label: 'admin.queue.messages.pending'
},
views: {
'appArea@': {
templateUrl: '/admin/queues/queue.html',
controller: 'QueueController'
}
}
});
}
})();
17 changes: 17 additions & 0 deletions src/admin/queues/queues-list.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(function () {
'use strict';

angular.module('motech-admin')
.controller('AdminQueueStatsCtrl', adminQueueStatsCtrl);

adminQueueStatsCtrl.$inject = ['$scope', '$rootScope', 'QueuesFactory'];
function adminQueueStatsCtrl ($scope, $rootScope, QueuesFactory) {

$scope.dataAvailable = true;
QueuesFactory.query(function(queues){
$scope.queues = queues;
}, function(){
$scope.dataAvailable = false;
});
}
})();
15 changes: 15 additions & 0 deletions src/admin/queues/queues-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<motech-list ng-show="dataAvailable">
<motech-list-item ng-repeat="queue in queues" >
<motech-list-column column-title="Name" sortable>
<a ui-sref="queues.queue({queueName: queue.destination})">{{queue.destination}}</a>
</motech-list-column>
<motech-list-column column-title="Number of Pending Messages" sortable>{{queue.queueSize}}</motech-list-column>
<motech-list-column column-title="Consumer Count" sortable>{{queue.consumerCount}}</motech-list-column>
<motech-list-column column-title="Enqueue Count" sortable>{{queue.enqueueCount}}</motech-list-column>
<motech-list-column column-title="Dequeue Count" sortable>{{queue.dequeueCount}}</motech-list-column>
<motech-list-column column-title="Expiry Count" sortable>{{queue.expiredCount}}</motech-list-column>
</motech-list-item>
</motech-list>
<div class="alert alert-danger" ng-show="!dataAvailable">
{{'admin.queue.error'|translate}}
</div>
12 changes: 12 additions & 0 deletions src/admin/queues/queues.factory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(function () {
'use strict';

angular.module('motech-admin')
.factory('QueuesFactory', queuesFactory);

queuesFactory.$inject = ['$rootScope', '$resource', 'ServerService'];
function queuesFactory ($rootScope, $resource, ServerService) {
return $resource(ServerService.formatURL('/module/admin/api/queues/'));
}

})();

0 comments on commit 067e06f

Please sign in to comment.