mirror of https://github.com/portainer/portainer
fix(dashboard): show endpoint tags (#4216)
* fix(dashboard): show endpoint tags * fix(dashboard): use ctrlpull/4224/head
parent
5c6147c9b9
commit
b6fc434291
|
@ -57,14 +57,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Tags</td>
|
<td>Tags</td>
|
||||||
<td>
|
<td>{{ endpointTags }}</td>
|
||||||
<span ng-if="endpoint.Tags.length === 0">
|
|
||||||
-
|
|
||||||
</span>
|
|
||||||
<span ng-if="endpoint.Tags.length > 0">
|
|
||||||
<span ng-repeat="tag in endpoint.Tags"> {{ tag }}{{ $last ? '' : ', ' }} </span>
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER'">
|
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER'">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import angular from 'angular';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
angular.module('portainer.docker').controller('DashboardController', [
|
angular.module('portainer.docker').controller('DashboardController', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'$q',
|
'$q',
|
||||||
|
@ -13,6 +16,7 @@ angular.module('portainer.docker').controller('DashboardController', [
|
||||||
'Notifications',
|
'Notifications',
|
||||||
'EndpointProvider',
|
'EndpointProvider',
|
||||||
'StateManager',
|
'StateManager',
|
||||||
|
'TagService',
|
||||||
function (
|
function (
|
||||||
$scope,
|
$scope,
|
||||||
$q,
|
$q,
|
||||||
|
@ -27,7 +31,8 @@ angular.module('portainer.docker').controller('DashboardController', [
|
||||||
EndpointService,
|
EndpointService,
|
||||||
Notifications,
|
Notifications,
|
||||||
EndpointProvider,
|
EndpointProvider,
|
||||||
StateManager
|
StateManager,
|
||||||
|
TagService
|
||||||
) {
|
) {
|
||||||
$scope.dismissInformationPanel = function (id) {
|
$scope.dismissInformationPanel = function (id) {
|
||||||
StateManager.dismissInformationPanel(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),
|
stacks: StackService.stacks(true, endpointMode.provider === 'DOCKER_SWARM_MODE' && endpointMode.role === 'MANAGER', endpointId),
|
||||||
info: SystemService.info(),
|
info: SystemService.info(),
|
||||||
endpoint: EndpointService.endpoint(endpointId),
|
endpoint: EndpointService.endpoint(endpointId),
|
||||||
|
tags: TagService.tags(),
|
||||||
})
|
})
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
$scope.containers = data.containers;
|
$scope.containers = data.containers;
|
||||||
|
@ -62,6 +68,18 @@ angular.module('portainer.docker').controller('DashboardController', [
|
||||||
$scope.stackCount = data.stacks.length;
|
$scope.stackCount = data.stacks.length;
|
||||||
$scope.info = data.info;
|
$scope.info = data.info;
|
||||||
$scope.endpoint = data.endpoint;
|
$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();
|
$scope.offlineMode = EndpointProvider.offlineMode();
|
||||||
})
|
})
|
||||||
.catch(function error(err) {
|
.catch(function error(err) {
|
||||||
|
|
|
@ -24,14 +24,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Tags</td>
|
<td>Tags</td>
|
||||||
<td>
|
<td>{{ ctrl.endpointTags }}</td>
|
||||||
<span ng-if="ctrl.endpoint.Tags.length === 0">
|
|
||||||
-
|
|
||||||
</span>
|
|
||||||
<span ng-if="ctrl.endpoint.Tags.length > 0">
|
|
||||||
<span ng-repeat="tag in ctrl.endpoint.Tags"> {{ tag }}{{ $last ? '' : ', ' }} </span>
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -14,7 +14,8 @@ class KubernetesDashboardController {
|
||||||
KubernetesConfigurationService,
|
KubernetesConfigurationService,
|
||||||
KubernetesVolumeService,
|
KubernetesVolumeService,
|
||||||
KubernetesNamespaceHelper,
|
KubernetesNamespaceHelper,
|
||||||
Authentication
|
Authentication,
|
||||||
|
TagService
|
||||||
) {
|
) {
|
||||||
this.$async = $async;
|
this.$async = $async;
|
||||||
this.Notifications = Notifications;
|
this.Notifications = Notifications;
|
||||||
|
@ -26,6 +27,7 @@ class KubernetesDashboardController {
|
||||||
this.KubernetesVolumeService = KubernetesVolumeService;
|
this.KubernetesVolumeService = KubernetesVolumeService;
|
||||||
this.KubernetesNamespaceHelper = KubernetesNamespaceHelper;
|
this.KubernetesNamespaceHelper = KubernetesNamespaceHelper;
|
||||||
this.Authentication = Authentication;
|
this.Authentication = Authentication;
|
||||||
|
this.TagService = TagService;
|
||||||
|
|
||||||
this.onInit = this.onInit.bind(this);
|
this.onInit = this.onInit.bind(this);
|
||||||
this.getAll = this.getAll.bind(this);
|
this.getAll = this.getAll.bind(this);
|
||||||
|
@ -37,17 +39,31 @@ class KubernetesDashboardController {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const endpointId = this.EndpointProvider.endpointID();
|
const endpointId = this.EndpointProvider.endpointID();
|
||||||
const [endpoint, pools, applications, configurations, volumes] = await Promise.all([
|
const [endpoint, pools, applications, configurations, volumes, tags] = await Promise.all([
|
||||||
this.EndpointService.endpoint(endpointId),
|
this.EndpointService.endpoint(endpointId),
|
||||||
this.KubernetesResourcePoolService.get(),
|
this.KubernetesResourcePoolService.get(),
|
||||||
this.KubernetesApplicationService.get(),
|
this.KubernetesApplicationService.get(),
|
||||||
this.KubernetesConfigurationService.get(),
|
this.KubernetesConfigurationService.get(),
|
||||||
this.KubernetesVolumeService.get(),
|
this.KubernetesVolumeService.get(),
|
||||||
|
this.TagService.tags(),
|
||||||
]);
|
]);
|
||||||
this.endpoint = endpoint;
|
this.endpoint = endpoint;
|
||||||
this.applications = applications;
|
this.applications = applications;
|
||||||
this.volumes = volumes;
|
this.volumes = volumes;
|
||||||
|
|
||||||
|
this.endpointTags = this.endpoint.TagIds.length
|
||||||
|
? _.join(
|
||||||
|
_.filter(
|
||||||
|
_.map(this.endpoint.TagIds, (id) => {
|
||||||
|
const tag = tags.find((tag) => tag.Id === id);
|
||||||
|
return tag ? tag.Name : '';
|
||||||
|
}),
|
||||||
|
Boolean
|
||||||
|
),
|
||||||
|
', '
|
||||||
|
)
|
||||||
|
: '-';
|
||||||
|
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
this.pools = _.filter(pools, (pool) => {
|
this.pools = _.filter(pools, (pool) => {
|
||||||
return !this.KubernetesNamespaceHelper.isSystemNamespace(pool.Namespace.Name);
|
return !this.KubernetesNamespaceHelper.isSystemNamespace(pool.Namespace.Name);
|
||||||
|
|
Loading…
Reference in New Issue