diff --git a/src/views/emails-queue.html b/src/views/emails-queue.html
index d3739eac2..5fcefdf47 100644
--- a/src/views/emails-queue.html
+++ b/src/views/emails-queue.html
@@ -19,7 +19,7 @@
@@ -43,7 +43,7 @@
- |
+ |
{{ 'emails.queue.empty' | tr }}
@@ -65,7 +65,7 @@
|
-
+
|
diff --git a/src/views/emails-queue.js b/src/views/emails-queue.js
index b707bef36..6c5624e7b 100644
--- a/src/views/emails-queue.js
+++ b/src/views/emails-queue.js
@@ -18,6 +18,7 @@ angular.module('Application').controller('EmailsQueueController', ['$scope', '$l
$scope.queue = {
busy: true,
+ busyRefresh: false,
items: [],
activeItem: null,
currentPage: 1,
@@ -25,41 +26,52 @@ angular.module('Application').controller('EmailsQueueController', ['$scope', '$l
pageItems: $scope.pageItemCount[0],
search: '',
- refresh: function () {
- $scope.queue.busy = true;
+ refresh: function (showBusy, callback) {
+ if (showBusy) $scope.queue.busy = true;
Client.listMailQueue($scope.queue.search, $scope.queue.currentPage, $scope.queue.pageItems.value, function (error, result) {
- if (error) return console.error('Failed to fetch mail eventlogs.', error);
+ if (showBusy) $scope.queue.busy = false;
- $scope.queue.busy = false;
+ if (error) {
+ console.error('Failed to fetch mail eventlogs.', error);
+ } else {
+ $scope.queue.items = result;
+ }
- $scope.queue.items = result;
+ if (callback) callback();
+ });
+ },
+
+ reload: function () {
+ $scope.queue.busyRefresh = true;
+ $scope.queue.refresh(true, function () {
+ $scope.queue.busyRefresh = false;
});
},
resend: function (item) {
Client.resendMailQueueItem(item.file, function (error) {
if (error) return console.error('Failed to retry item.', error);
- $scope.queue.refresh();
+ $scope.queue.refresh(false);
});
},
discard: function (item) {
Client.delMailQueueItem(item.file, function (error) {
if (error) return console.error('Failed to discard item.', error);
- $scope.queue.refresh();
+ $scope.queue.refresh(false);
});
},
showNextPage: function () {
$scope.queue.currentPage++;
- $scope.queue.refresh();
+ $scope.queue.refresh(true);
},
showPrevPage: function () {
if ($scope.queue.currentPage > 1) $scope.queue.currentPage--;
else $scope.queue.currentPage = 1;
- $scope.queue.refresh();
+ $scope.queue.refresh(true);
},
showItemDetails: function (item) {
@@ -69,14 +81,14 @@ angular.module('Application').controller('EmailsQueueController', ['$scope', '$l
updateFilter: function (fresh) {
if (fresh) $scope.queue.currentPage = 1;
- $scope.queue.refresh();
+ $scope.queue.refresh(false);
}
};
Client.onReady(function () {
$scope.ready = true;
- $scope.queue.refresh();
+ $scope.queue.refresh(true);
});
$('.modal-backdrop').remove();