mirror of https://github.com/portainer/portainer
fix(services): use the Public URL instead of a manager IP (#1665)
parent
ae5416583e
commit
b5e256c967
|
@ -114,7 +114,7 @@
|
|||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<a ng-if="item.Ports && item.Ports.length > 0 && $ctrl.swarmManagerIp && p.PublishedPort" ng-repeat="p in item.Ports" class="image-tag" ng-href="http://{{ $ctrl.swarmManagerIp }}:{{ p.PublishedPort }}" target="_blank">
|
||||
<a ng-if="item.Ports && item.Ports.length > 0 && p.PublishedPort" ng-repeat="p in item.Ports" class="image-tag" ng-href="http://{{ $ctrl.publicUrl }}:{{ p.PublishedPort }}" target="_blank">
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i> {{ p.PublishedPort }}:{{ p.TargetPort }}
|
||||
</a>
|
||||
<span ng-if="!item.Ports || item.Ports.length === 0 || !$ctrl.swarmManagerIp" >-</span>
|
||||
|
|
|
@ -12,7 +12,7 @@ angular.module('portainer.docker').component('servicesDatatable', {
|
|||
showOwnershipColumn: '<',
|
||||
removeAction: '<',
|
||||
scaleAction: '<',
|
||||
swarmManagerIp: '<',
|
||||
publicUrl: '<',
|
||||
forceUpdateAction: '<',
|
||||
showForceUpdateButton: '<'
|
||||
}
|
||||
|
|
|
@ -9,16 +9,6 @@ angular.module('portainer.docker')
|
|||
Labels: node.Spec.Labels,
|
||||
Availability: node.Spec.Availability
|
||||
};
|
||||
},
|
||||
getManagerIP: function(nodes) {
|
||||
var managerIp;
|
||||
for (var n in nodes) {
|
||||
if (undefined === nodes[n].ManagerStatus || nodes[n].ManagerStatus.Reachability !== 'reachable') {
|
||||
continue;
|
||||
}
|
||||
managerIp = nodes[n].ManagerStatus.Addr.split(':')[0];
|
||||
}
|
||||
return managerIp;
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
remove-action="removeAction"
|
||||
scale-action="scaleAction"
|
||||
force-update-action="forceUpdateAction"
|
||||
swarm-manager-ip="swarmManagerIP"
|
||||
public-url="state.publicURL"
|
||||
show-force-update-button="applicationState.endpoint.apiVersion >= 1.25"
|
||||
></services-datatable>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
angular.module('portainer.docker')
|
||||
.controller('ServicesController', ['$q', '$scope', '$state', 'Service', 'ServiceService', 'ServiceHelper', 'Notifications', 'Task', 'Node', 'NodeHelper', 'ModalService',
|
||||
function ($q, $scope, $state, Service, ServiceService, ServiceHelper, Notifications, Task, Node, NodeHelper, ModalService) {
|
||||
.controller('ServicesController', ['$q', '$scope', '$state', 'Service', 'ServiceService', 'ServiceHelper', 'Notifications', 'Task', 'Node', 'ModalService', 'EndpointProvider',
|
||||
function ($q, $scope, $state, Service, ServiceService, ServiceHelper, Notifications, Task, Node, ModalService, EndpointProvider) {
|
||||
|
||||
$scope.state = {
|
||||
publicURL: EndpointProvider.endpointPublicURL()
|
||||
};
|
||||
|
||||
$scope.scaleAction = function scaleService(service) {
|
||||
var config = ServiceHelper.serviceToConfig(service.Model);
|
||||
|
@ -88,7 +92,6 @@ function ($q, $scope, $state, Service, ServiceService, ServiceHelper, Notificati
|
|||
nodes: Node.query({}).$promise
|
||||
})
|
||||
.then(function success(data) {
|
||||
$scope.swarmManagerIP = NodeHelper.getManagerIP(data.nodes);
|
||||
$scope.services = data.services.map(function (service) {
|
||||
var runningTasks = data.tasks.filter(function (task) {
|
||||
return task.ServiceID === service.ID && task.Status.State === 'running';
|
||||
|
|
Loading…
Reference in New Issue