feat(containers): update the containers view to add a column with exposed ports (#157)

pull/161/head
Anthony Lapenna 8 years ago committed by GitHub
parent 5f290937d2
commit 71eb3feac9

@ -100,7 +100,6 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Mes
var registry = _.toLower($scope.config.Registry); var registry = _.toLower($scope.config.Registry);
var imageConfig = createImageConfig(image, registry); var imageConfig = createImageConfig(image, registry);
ContainerCommit.commit({id: $stateParams.id, tag: imageConfig.tag, repo: imageConfig.repo}, function (d) { ContainerCommit.commit({id: $stateParams.id, tag: imageConfig.tag, repo: imageConfig.repo}, function (d) {
console.log(JSON.stringify(d, null, 4));
update(); update();
$('#createImageSpinner').hide(); $('#createImageSpinner').hide();
Messages.send("Container commited", $stateParams.id); Messages.send("Container commited", $stateParams.id);

@ -52,6 +52,13 @@
<span ng-show="sortType == 'Names' && sortReverse" class="glyphicon glyphicon-chevron-up"></span> <span ng-show="sortType == 'Names' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a> </a>
</th> </th>
<th>
<a ui-sref="containers" ng-click="order('Image')">
Image
<span ng-show="sortType == 'Image' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'Image' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a>
</th>
<th ng-if="state.displayIP"> <th ng-if="state.displayIP">
<a ui-sref="containers" ng-click="order('IP')"> <a ui-sref="containers" ng-click="order('IP')">
IP Address IP Address
@ -67,17 +74,10 @@
</a> </a>
</th> </th>
<th> <th>
<a ui-sref="containers" ng-click="order('Image')"> <a ui-sref="containers" ng-click="order('Ports')">
Image Exposed Ports
<span ng-show="sortType == 'Image' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span> <span ng-show="sortType == 'Ports' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'Image' && sortReverse" class="glyphicon glyphicon-chevron-up"></span> <span ng-show="sortType == 'Ports' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a>
</th>
<th>
<a ui-sref="containers" ng-click="order('Command')">
Command
<span ng-show="sortType == 'Command' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'Command' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a> </a>
</th> </th>
</tr> </tr>
@ -88,10 +88,15 @@
<td><span class="label label-{{ container.Status|containerstatusbadge }}">{{ container.Status|containerstatus }}</span></td> <td><span class="label label-{{ container.Status|containerstatusbadge }}">{{ container.Status|containerstatus }}</span></td>
<td ng-if="swarm"><a ui-sref="container({id: container.Id})">{{ container|swarmcontainername}}</a></td> <td ng-if="swarm"><a ui-sref="container({id: container.Id})">{{ container|swarmcontainername}}</a></td>
<td ng-if="!swarm"><a ui-sref="container({id: container.Id})">{{ container|containername}}</a></td> <td ng-if="!swarm"><a ui-sref="container({id: container.Id})">{{ container|containername}}</a></td>
<td><a ui-sref="image({id: container.Image})">{{ container.Image }}</a></td>
<td ng-if="state.displayIP">{{ container.IP ? container.IP : '-' }}</td> <td ng-if="state.displayIP">{{ container.IP ? container.IP : '-' }}</td>
<td ng-if="swarm">{{ container.hostIP }}</td> <td ng-if="swarm">{{ container.hostIP }}</td>
<td><a ui-sref="image({id: container.Image})">{{ container.Image }}</a></td> <td>
<td>{{ container.Command|truncate:60 }}</td> <a ng-if="container.Ports.length > 0" ng-repeat="p in container.Ports" class="image-tag" ng-href="http://{{p.host}}:{{p.public}}" target="_blank">
<i class="fa fa-external-link" aria-hidden="true"></i> {{ p.private }}
</a>
<span ng-if="container.Ports.length == 0" >-</span>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

@ -6,7 +6,7 @@ function ($scope, Container, Info, Settings, Messages, Config, errorMsgFilter) {
$scope.state.displayAll = Settings.displayAll; $scope.state.displayAll = Settings.displayAll;
$scope.state.displayIP = false; $scope.state.displayIP = false;
$scope.sortType = 'State'; $scope.sortType = 'State';
$scope.sortReverse = true; $scope.sortReverse = false;
$scope.state.selectedItemCount = 0; $scope.state.selectedItemCount = 0;
$scope.order = function (sortType) { $scope.order = function (sortType) {

@ -19,6 +19,13 @@ function ContainerViewModel(data) {
this.Image = data.Image; this.Image = data.Image;
this.Command = data.Command; this.Command = data.Command;
this.Checked = false; this.Checked = false;
this.Ports = [];
for (var i = 0; i < data.Ports.length; ++i) {
var p = data.Ports[i];
if (p.PublicPort) {
this.Ports.push({ host: p.IP, private: p.PrivatePort, public: p.PublicPort });
}
}
} }
function createEventDetails(event) { function createEventDetails(event) {

Loading…
Cancel
Save