1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-26 00:39:41 +02:00

fix(dashboard): show endpoint tags (#4216)

* fix(dashboard): show endpoint tags

* fix(dashboard): use ctrl
This commit is contained in:
Chaim Lev-Ari 2020-08-17 03:30:02 +03:00 committed by GitHub
parent 5c6147c9b9
commit b6fc434291
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 19 deletions

View file

@ -1,3 +1,6 @@
import angular from 'angular';
import _ from 'lodash';
angular.module('portainer.docker').controller('DashboardController', [
'$scope',
'$q',
@ -13,6 +16,7 @@ angular.module('portainer.docker').controller('DashboardController', [
'Notifications',
'EndpointProvider',
'StateManager',
'TagService',
function (
$scope,
$q,
@ -27,7 +31,8 @@ angular.module('portainer.docker').controller('DashboardController', [
EndpointService,
Notifications,
EndpointProvider,
StateManager
StateManager,
TagService
) {
$scope.dismissInformationPanel = function (id) {
StateManager.dismissInformationPanel(id);
@ -52,6 +57,7 @@ angular.module('portainer.docker').controller('DashboardController', [
stacks: StackService.stacks(true, endpointMode.provider === 'DOCKER_SWARM_MODE' && endpointMode.role === 'MANAGER', endpointId),
info: SystemService.info(),
endpoint: EndpointService.endpoint(endpointId),
tags: TagService.tags(),
})
.then(function success(data) {
$scope.containers = data.containers;
@ -62,6 +68,18 @@ angular.module('portainer.docker').controller('DashboardController', [
$scope.stackCount = data.stacks.length;
$scope.info = data.info;
$scope.endpoint = data.endpoint;
$scope.endpointTags = $scope.endpoint.TagIds.length
? _.join(
_.filter(
_.map($scope.endpoint.TagIds, (id) => {
const tag = data.tags.find((tag) => tag.Id === id);
return tag ? tag.Name : '';
}),
Boolean
),
', '
)
: '-';
$scope.offlineMode = EndpointProvider.offlineMode();
})
.catch(function error(err) {