1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

fix(swarm): fix multiple Swarm related issues (#1022)

* fix(containers): fix an issue where the containers would not be displayed

* fix(images): image usage filtering is not compliant with docker/swarm

* fix(volume-creation): do not load volume driver with docker/swarm
This commit is contained in:
Anthony Lapenna 2017-07-12 16:11:11 +02:00 committed by GitHub
parent 703e423e04
commit 536ca15e90
6 changed files with 25 additions and 22 deletions

View file

@ -233,7 +233,7 @@ angular.module('containers', [])
$q.when(provider !== 'DOCKER_SWARM' || SystemService.info())
.then(function success(data) {
if (provider === 'DOCKER_SWARM') {
$scope.swarm_hosts = retrieveSwarmHostsInfo(d);
$scope.swarm_hosts = retrieveSwarmHostsInfo(data);
}
update({all: $scope.state.displayAll ? 1 : 0});
})

View file

@ -70,6 +70,7 @@ function ($scope, $state, VolumeService, SystemService, ResourceControlService,
function initView() {
$('#loadingViewSpinner').show();
if ($scope.applicationState.endpoint.mode.provider !== 'DOCKER_SWARM') {
SystemService.getVolumePlugins()
.then(function success(data) {
$scope.availableVolumeDrivers = data;
@ -81,6 +82,7 @@ function ($scope, $state, VolumeService, SystemService, ResourceControlService,
$('#loadingViewSpinner').hide();
});
}
}
initView();
}]);

View file

@ -70,7 +70,7 @@
<div class="pull-right">
<input type="text" id="filter" ng-model="state.filter" placeholder="Filter..." class="form-control input-sm" />
</div>
<span class="btn-group btn-group-sm pull-right" style="margin-right: 20px;">
<span class="btn-group btn-group-sm pull-right" style="margin-right: 20px;" ng-if="applicationState.endpoint.mode.provider !== 'DOCKER_SWARM'">
<label class="btn btn-primary" ng-model="state.containersCountFilter" uib-btn-radio="undefined">
All
</label>
@ -125,7 +125,7 @@
<td><input type="checkbox" ng-model="image.Checked" ng-change="selectItem(image)" /></td>
<td>
<a class="monospaced" ui-sref="image({id: image.Id})">{{ image.Id|truncate:20}}</a>
<span style="margin-left: 10px;" class="label label-warning image-tag" ng-if="::image.Containers === 0">Unused</span></td>
<span style="margin-left: 10px;" class="label label-warning image-tag" ng-if="::image.Containers === 0 && applicationState.endpoint.mode.provider !== 'DOCKER_SWARM'">Unused</span></td>
<td>
<span class="label label-primary image-tag" ng-repeat="tag in (image|repotags)">{{ tag }}</span>
</td>

View file

@ -93,7 +93,8 @@ function ($scope, $state, ImageService, Notifications, Pagination, ModalService)
function fetchImages() {
$('#loadImagesSpinner').show();
ImageService.images()
var endpointProvider = $scope.applicationState.endpoint.mode.provider;
ImageService.images(endpointProvider !== 'DOCKER_SWARM')
.then(function success(data) {
$scope.images = data;
})

View file

@ -3,7 +3,7 @@ function ImageViewModel(data) {
this.Tag = data.Tag;
this.Repository = data.Repository;
this.Created = data.Created;
this.Containers = data.dataUsage.Containers;
this.Containers = data.dataUsage ? data.dataUsage.Containers : 0;
this.Checked = false;
this.RepoTags = data.RepoTags;
this.VirtualSize = data.VirtualSize;

View file

@ -20,11 +20,11 @@ angular.module('portainer.services')
return deferred.promise;
};
service.images = function() {
service.images = function(withUsage) {
var deferred = $q.defer();
$q.all({
dataUsage: SystemService.dataUsage(),
dataUsage: withUsage ? SystemService.dataUsage() : { Images: [] },
images: Image.query({}).$promise
})
.then(function success(data) {