feat(services) - add exposed ports (#690)
parent
0e439d7ae6
commit
ffa2cf62f5
|
@ -58,6 +58,13 @@
|
||||||
<span ng-show="sortType == 'Mode' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
<span ng-show="sortType == 'Mode' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
<a ui-sref="services" ng-click="order('Ports')">
|
||||||
|
Published Ports
|
||||||
|
<span ng-show="sortType == 'Ports' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||||
|
<span ng-show="sortType == 'Ports' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<a ui-sref="services" ng-click="order('UpdatedAt')">
|
<a ui-sref="services" ng-click="order('UpdatedAt')">
|
||||||
Updated at
|
Updated at
|
||||||
|
@ -92,6 +99,12 @@
|
||||||
<a class="interactive" ng-click="scaleService(service)"><i class="fa fa-check-square-o"></i></a>
|
<a class="interactive" ng-click="scaleService(service)"><i class="fa fa-check-square-o"></i></a>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<a ng-if="service.Ports && service.Ports.length > 0 && swarmManagerIP" ng-repeat="p in service.Ports" class="image-tag" ng-href="http://{{swarmManagerIP}}:{{p.PublishedPort}}" target="_blank">
|
||||||
|
<i class="fa fa-external-link" aria-hidden="true"></i> {{ p.PublishedPort }}:{{ p.TargetPort }}
|
||||||
|
</a>
|
||||||
|
<span ng-if="!service.Ports || service.Ports.length === 0 || !swarmManagerIP" >-</span>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ service.UpdatedAt|getisodate }}
|
{{ service.UpdatedAt|getisodate }}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
angular.module('services', [])
|
angular.module('services', [])
|
||||||
.controller('ServicesController', ['$q', '$scope', '$stateParams', '$state', 'Service', 'ServiceHelper', 'Messages', 'Pagination', 'Task', 'Node', 'Authentication', 'UserService', 'ModalService', 'ResourceControlService',
|
.controller('ServicesController', ['$q', '$scope', '$stateParams', '$state', 'Service', 'ServiceHelper', 'Messages', 'Pagination', 'Task', 'Node', 'NodeHelper', 'Authentication', 'UserService', 'ModalService', 'ResourceControlService',
|
||||||
function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Messages, Pagination, Task, Node, Authentication, UserService, ModalService, ResourceControlService) {
|
function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Messages, Pagination, Task, Node, NodeHelper, Authentication, UserService, ModalService, ResourceControlService) {
|
||||||
$scope.state = {};
|
$scope.state = {};
|
||||||
$scope.state.selectedItemCount = 0;
|
$scope.state.selectedItemCount = 0;
|
||||||
$scope.state.pagination_count = Pagination.getPaginationCount('services');
|
$scope.state.pagination_count = Pagination.getPaginationCount('services');
|
||||||
|
@ -137,6 +137,7 @@ function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Messages, Pa
|
||||||
nodes: Node.query({}).$promise,
|
nodes: Node.query({}).$promise,
|
||||||
})
|
})
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
|
$scope.swarmManagerIP = NodeHelper.getManagerIP(data.nodes);
|
||||||
$scope.services = data.services.map(function (service) {
|
$scope.services = data.services.map(function (service) {
|
||||||
var serviceTasks = data.tasks.filter(function (task) {
|
var serviceTasks = data.tasks.filter(function (task) {
|
||||||
return task.ServiceID === service.ID;
|
return task.ServiceID === service.ID;
|
||||||
|
|
|
@ -9,6 +9,16 @@ angular.module('portainer.helpers')
|
||||||
Labels: node.Spec.Labels,
|
Labels: node.Spec.Labels,
|
||||||
Availability: node.Spec.Availability
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
Loading…
Reference in New Issue