services: fix status color in recovery mode

This commit is contained in:
Girish Ramakrishnan
2021-10-19 15:51:44 -07:00
parent 9b8e16f990
commit a2b4d945a2
2 changed files with 25 additions and 10 deletions

View File

@@ -86,7 +86,18 @@
</tr>
<tr ng-repeat="service in services | filter:{ isRedis: false } | orderBy:'name'">
<td>
<i class="fa fa-circle" uib-tooltip="{{ service.status }}" ng-style="{ color: service.status === 'active' ? '#27CE65' : (service.status === 'starting' ? '#f0ad4e' : '#d9534f') }" ng-show="service.status"></i>
<span ng-switch on="service.status" ng-show="service.status">
<span ng-switch-when="active">
<i class="fa fa-circle" uib-tooltip="active" ng-style="{ color: '#27CE65' }"></i>
</span>
<span ng-switch-when="starting">
<i class="fa fa-circle" uib-tooltip="starting" ng-style="{ color: '#f0ad4e' }" ng-show="!service.config.recoveryMode"></i>
<i class="fa fa-circle" uib-tooltip="recovery mode" ng-style="{ color: '#ec534f' }" ng-show="service.config.recoveryMode"></i>
</span>
<span ng-switch-default>
<i class="fa fa-circle" uib-tooltip="{{ service.status }}" ng-style="{ color: '#d9534f' }"></i>
</span>
</span>
<i class="fa fa-circle-notch fa-spin" ng-hide="service.status"></i>
</td>
<td class="elide-table-cell">

View File

@@ -31,15 +31,15 @@ angular.module('Application').controller('ServicesController', ['$scope', '$loca
});
}
function waitForActive(serviceName) {
refresh(serviceName, function (error, result) {
if (result.status === 'active') return;
setTimeout(function () { waitForActive(serviceName); }, 3000);
});
}
$scope.restartService = function (serviceName) {
function waitForActive(serviceName) {
refresh(serviceName, function (error, result) {
if (result.status === 'active') return;
setTimeout(function () { waitForActive(serviceName); }, 3000);
});
}
$scope.services.find(function (s) { return s.name === serviceName; }).status = 'starting';
Client.restartService(serviceName, function (error) {
@@ -107,7 +107,11 @@ angular.module('Application').controller('ServicesController', ['$scope', '$loca
return;
}
refresh($scope.serviceConfigure.service.name);
if ($scope.serviceConfigure.recoveryMode === true) {
refresh($scope.serviceConfigure.service.name);
} else {
waitForActive($scope.serviceConfigure.service.name);
}
$('#serviceConfigureModal').modal('hide');
$scope.serviceConfigure.reset();