Skip to content

Commit

Permalink
Merge branch 'release-1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
John Simons committed Aug 7, 2015
2 parents 005e0ee + 9e21fd7 commit 62854d6
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 41 deletions.
77 changes: 46 additions & 31 deletions src/ServicePulse.Host/app/js/failed_messages/failedMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ angular.module('failedMessages', [])
function ($scope, $window, $timeout, serviceControlService, streamService, $routeParams, scConfig, notifications, semverService) {
$scope.allFailedMessagesGroup = { 'id': undefined, 'title': 'All failed messages', 'count': 0 };
$scope.selectedExceptionGroup = $scope.allFailedMessagesGroup;
$scope.model = { exceptionGroups: [], failedMessages: [], selectedIds: [], newMessages: 0, activePageTab:"" };
$scope.model = { exceptionGroups: [], failedMessages: [], selectedIds: [], newMessages: 0, activePageTab: '', displayGroupsTab: false };
$scope.loadingData = false;
$scope.allMessagesLoaded = false;
var scVersionSupportingExceptionGroups = '1.6.0';
Expand All @@ -26,6 +26,20 @@ angular.module('failedMessages', [])
page++;
};

var autoGetExceptionGroups = function() {
serviceControlService.getExceptionGroups()
.then(function (response) {
if (response.data.length > 0) {
$scope.model.exceptionGroups = response.data;
return;
}

$timeout(function () {
autoGetExceptionGroups();
}, 2000);
});
}

$scope.init = function () {
page = 1;
$scope.model.failedMessages = [];
Expand All @@ -44,16 +58,9 @@ angular.module('failedMessages', [])
serviceControlService.getVersion()
.then(function (sc_version) {
if (semverService.isSupported(sc_version, scVersionSupportingExceptionGroups)) {
serviceControlService.getExceptionGroups()
.then(function (response) {
$scope.model.exceptionGroups = response.data;
})
.then(function () {
if ($scope.model.exceptionGroups.length > 0) {
$scope.model.activePageTab = "groups";
}
})
;
$scope.model.displayGroupsTab = true;
$scope.model.activePageTab = "groups";
autoGetExceptionGroups();
} else {
var SCneedsUpgradeMessage = 'You are using Service Control version ' + sc_version + '. Please, upgrade to version ' + scVersionSupportingExceptionGroups + ' or higher to unlock new functionality in ServicePulse.';
notifications.pushForCurrentRoute(SCneedsUpgradeMessage, 'info');
Expand All @@ -65,7 +72,6 @@ angular.module('failedMessages', [])
processLoadedMessages(response.data);
});
};

$scope.togglePanel = function (row, panelnum) {
if (row.messageBody === undefined) {
serviceControlService.getMessageBody(row.message_id).then(function (message) {
Expand All @@ -86,18 +92,26 @@ angular.module('failedMessages', [])
return false;
};

$scope.selectGroup = function (group, sort) {
var selectGroupInternal = function (group, sort, changeToMessagesTab) {
if ($scope.loadingData) {
return;
}

if (changeToMessagesTab) {
$scope.model.activePageTab = "messages";
}

if ($scope.loadingData)
return;
$scope.model.activePageTab = "messages";
$scope.model.failedMessages = [];
$scope.selectedExceptionGroup = group;
$scope.allMessagesLoaded = false;
page = 1;

$scope.loadMoreResults(group, sort);
}

$scope.selectGroup = function (group, sort) {

selectGroupInternal(group, sort, true);
};

$scope.loadMoreResults = function (group, sort) {
Expand Down Expand Up @@ -177,33 +191,34 @@ angular.module('failedMessages', [])
}
}

var selectAllFailedMessagesGroup = function () {
// move focus
$scope.selectGroup($scope.allFailedMessagesGroup);
}

$scope.retryExceptionGroup = function($event, group) {
$event.stopPropagation();

$scope.retryExceptionGroup = function(group) {
var notificationText = 'Retrying messages from group ' + group.title;
serviceControlService.retryExceptionGroup(group.id, notificationText);

removeGroup(group);

if ($scope.model.exceptionGroups.length === 0) {
$scope.model.failedMessages = [];
return;
}

markMessage(group, 'retried');
selectAllFailedMessagesGroup();
selectGroupInternal($scope.allFailedMessagesGroup, null, false);
}



$scope.archiveExceptionGroup = function ($event, group) {

$event.stopPropagation();
$scope.archiveExceptionGroup = function (group) {
var notificationText = 'Archiving messages from group ' + group.title;
serviceControlService.archiveExceptionGroup(group.id, notificationText);

removeGroup(group);

if ($scope.model.exceptionGroups.length === 0) {
$scope.model.failedMessages = [];
return;
}

markMessage(group, 'archived');
selectAllFailedMessagesGroup();
selectGroupInternal($scope.allFailedMessagesGroup, null, false);
};

$scope.archiveSelected = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
</ul>
<hr>
</div>

<div class="row-fluid">

<div class="well" ng-show="model.failedMessages.length === 0">
<p class="text-center" style="font-size: 60pt;"><i class="fa fa-inbox"></i></p>
<h2 class="text-center">Well done, no error messages!</h2>
</div>

<div class="row-fluid" ng-show="model.failedMessages.length > 0">
<ul class="nav nav-tabs" >
<li ng-show="model.exceptionGroups.length > 0" ng-class="{active: model.activePageTab == 'groups'}">
<li ng-show="model.displayGroupsTab" ng-class="{active: model.activePageTab == 'groups'}">
<a ng-click="model.activePageTab = 'groups'">Error Groups</a>
</li>
<li ng-class="{active: model.activePageTab == 'messages'}">
Expand All @@ -25,9 +30,16 @@

<div class="box span12" ng-switch-when="groups">
<div class="box-header" data-original-title>
<h2><i class="fa fa-th"></i><span class="break"></span>Showing {{model.exceptionGroups.length}} failed messages groups. Messages are grouped by exception type and exception line of code.</h2>
<h2><i class="fa fa-th"></i><span class="break"></span>Showing {{model.exceptionGroups.length}} failed messages groups. Messages are grouped by exception type and exception line of code.
</h2>
</div>
<div class="box-content">
<div class="box-content" ng-show="model.exceptionGroups.length === 0 && model.failedMessages.length > 0">
<div class="well well-large">
<h2>Loading...</h2>
We are still grouping your failed messages, it shouldn't be much longer.
</div>
</div>
<div class="box-content" ng-show="model.exceptionGroups.length > 0">
<div class="scRow failedMessagesGroup-row">
<div class="span8"><strong>Title</strong></div>
<div class="span1"><strong>Count</strong></div>
Expand All @@ -50,19 +62,18 @@ <h2><i class="fa fa-th"></i><span class="break"></span>Showing {{model.exception
<sp-moment date="{{excGroup.last}}" />
</div>
<div class="span1">
<button type="button" class="btn btn-small" tooltip="Archive Group" ng-click="archiveExceptionGroup($event, excGroup)" ng-disabled="excGroup.count == 0"><i class="fa fa-archive"></i></button>
<button type="button" class="btn btn-small" tooltip="Retry Group" ng-click="retryExceptionGroup($event, excGroup)" ng-disabled="excGroup.count == 0"><i class="fa fa-refresh"></i></button>
<button type="button" class="btn btn-small" tooltip="Archive Group" ng-click="archiveExceptionGroup(excGroup)" ng-disabled="excGroup.count == 0"><i class="fa fa-archive"></i></button>
<button type="button" class="btn btn-small" tooltip="Retry Group" ng-click="retryExceptionGroup(excGroup)" ng-disabled="excGroup.count == 0"><i class="fa fa-refresh"></i></button>
</div>
</div>
</div>

</div>

<p><br /></p>

<div class="alert alert-error alert-block">
<p class="pull-right">
<button class="btn btn-danger" type="button" confirm-click="Are you really sure you want to retry {{allFailedMessagesGroup.count}} messages?" ng-click="retryAll()" ng-disabled="allFailedMessagesGroup.count == 0" tooltip="All failed messages will be Retried"><i class="fa fa-refresh white"></i> Retry {{allFailedMessagesGroup.count}} Failed Messages</button>
<button class="btn btn-danger" type="button" confirm-click="Are you really sure you want to retry all failed messages?" ng-click="retryAll()" tooltip="All failed messages will be Retried"><i class="fa fa-refresh white"></i> Retry All Failed Messages</button>
<button class="btn" type="button" ng-click="selectGroup(allFailedMessagesGroup)" tooltip="Review all Messages"><i class="fa fa-envelope"></i> View All Failed Messages</button>
</p>
<p><H4>Warning!</H4> Retrying all messages can be a time consuming operation. Take care when doing this.</p>
Expand Down
2 changes: 1 addition & 1 deletion src/ServicePulse.Host/app/js/services/semverService.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
return minSupported.patch <= current.patch;
}

return false;
return true;
};

this.parse = function (version) {
Expand Down

0 comments on commit 62854d6

Please sign in to comment.