feat(storidge): update 8 - node availability on swarm overview

storidge-standalone
baron_l 2019-04-27 18:59:20 +02:00
parent b52dcaacc8
commit d4772672bb
3 changed files with 22 additions and 2 deletions

View File

@ -63,6 +63,13 @@
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Status' && $ctrl.state.reverseOrder"></i>
</a>
</th>
<th>
<a ng-click="$ctrl.changeOrderBy('Availability')">
Availability
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Availability' && !$ctrl.state.reverseOrder"></i>
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Availability' && $ctrl.state.reverseOrder"></i>
</a>
</th>
</tr>
</thead>
<tbody>
@ -77,6 +84,7 @@
<td>{{ item.EngineVersion }}</td>
<td ng-if="$ctrl.showIpAddressColumn">{{ item.Addr }}</td>
<td><span class="label label-{{ item.Status | nodestatusbadge }}">{{ item.Status }}</span></td>
<td><span class="label label-{{ item.Availability | dockerNodeAvailabilityBadge }}">{{ item.Availability }}</span></td>
</tr>
<tr ng-if="!$ctrl.dataset">
<td colspan="7" class="text-center text-muted">Loading...</td>

View File

@ -97,6 +97,18 @@ angular.module('portainer.docker')
return 'success';
};
})
.filter('dockerNodeAvailabilityBadge', function () {
'use strict';
return function (text) {
if (text === 'pause') {
return 'warning';
}
else if (text === 'drain') {
return 'danger';
}
return 'success';
};
})
.filter('trimcontainername', function () {
'use strict';
return function (name) {

View File

@ -17,9 +17,9 @@ angular.module('extension.storidge')
'use strict';
return function (text) {
var status = text ? _.toLower(text) : '';
if (status === 'cordoned') {
if (status === 'cordoned' || status === 'maintenance') {
return 'orange-icon';
} else if (status === 'leaving') {
} else if (status === 'leaving' || status === 'failed') {
return 'red-icon'
}
return 'green-icon';