mirror of https://github.com/portainer/portainer
refactor(project): remove Swarm standalone support (#1720)
* refactor(project): remove Swarm standalone support * fix(state): fix an issue with endpoint state not being registeredpull/1776/head
parent
517f983ec6
commit
1cfbec557c
|
@ -156,13 +156,6 @@
|
||||||
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'IP' && $ctrl.state.reverseOrder"></i>
|
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'IP' && $ctrl.state.reverseOrder"></i>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th ng-if="$ctrl.swarmContainers">
|
|
||||||
<a ng-click="$ctrl.changeOrderBy('Host')">
|
|
||||||
Host IP
|
|
||||||
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Host' && !$ctrl.state.reverseOrder"></i>
|
|
||||||
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Host' && $ctrl.state.reverseOrder"></i>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
<th>
|
||||||
<a ng-click="$ctrl.changeOrderBy('Ports')">
|
<a ng-click="$ctrl.changeOrderBy('Ports')">
|
||||||
Published Ports
|
Published Ports
|
||||||
|
@ -186,8 +179,7 @@
|
||||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
||||||
<label for="select_{{ $index }}"></label>
|
<label for="select_{{ $index }}"></label>
|
||||||
</span>
|
</span>
|
||||||
<a ui-sref="docker.containers.container({ id: item.Id })" ng-if="!$ctrl.swarmContainers">{{ item | containername | truncate: $ctrl.settings.containerNameTruncateSize }}</a>
|
<a ui-sref="docker.containers.container({ id: item.Id })">{{ item | containername | truncate: $ctrl.settings.containerNameTruncateSize }}</a>
|
||||||
<a ui-sref="docker.containers.container({ id: item.Id })" ng-if="$ctrl.swarmContainers">{{ item | swarmcontainername | truncate: $ctrl.settings.containerNameTruncateSize }}</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span ng-if="['starting','healthy','unhealthy'].indexOf(item.Status) !== -1" class="label label-{{ item.Status|containerstatusbadge }} interactive" uib-tooltip="This container has a health check">{{ item.Status }}</span>
|
<span ng-if="['starting','healthy','unhealthy'].indexOf(item.Status) !== -1" class="label label-{{ item.Status|containerstatusbadge }} interactive" uib-tooltip="This container has a health check">{{ item.Status }}</span>
|
||||||
|
@ -204,7 +196,6 @@
|
||||||
<td>{{ item.StackName ? item.StackName : '-' }}</td>
|
<td>{{ item.StackName ? item.StackName : '-' }}</td>
|
||||||
<td><a ui-sref="docker.images.image({ id: item.Image })">{{ item.Image | trimshasum }}</a></td>
|
<td><a ui-sref="docker.images.image({ id: item.Image })">{{ item.Image | trimshasum }}</a></td>
|
||||||
<td>{{ item.IP ? item.IP : '-' }}</td>
|
<td>{{ item.IP ? item.IP : '-' }}</td>
|
||||||
<td ng-if="$ctrl.swarmContainers">{{ item.hostIP }}</td>
|
|
||||||
<td>
|
<td>
|
||||||
<a ng-if="item.Ports.length > 0" ng-repeat="p in item.Ports" class="image-tag" ng-href="http://{{ $ctrl.publicUrl || p.host }}:{{p.public}}" target="_blank">
|
<a ng-if="item.Ports.length > 0" ng-repeat="p in item.Ports" class="image-tag" ng-href="http://{{ $ctrl.publicUrl || p.host }}:{{p.public}}" target="_blank">
|
||||||
<i class="fa fa-external-link-alt" aria-hidden="true"></i> {{ p.public }}:{{ p.private }}
|
<i class="fa fa-external-link-alt" aria-hidden="true"></i> {{ p.public }}:{{ p.private }}
|
||||||
|
|
|
@ -10,7 +10,6 @@ angular.module('portainer.docker').component('containersDatatable', {
|
||||||
reverseOrder: '<',
|
reverseOrder: '<',
|
||||||
showTextFilter: '<',
|
showTextFilter: '<',
|
||||||
showOwnershipColumn: '<',
|
showOwnershipColumn: '<',
|
||||||
swarmContainers: '<',
|
|
||||||
publicUrl: '<',
|
publicUrl: '<',
|
||||||
containerNameTruncateSize: '<',
|
containerNameTruncateSize: '<',
|
||||||
startAction: '<',
|
startAction: '<',
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
<div class="datatable">
|
|
||||||
<rd-widget>
|
|
||||||
<rd-widget-body classes="no-padding">
|
|
||||||
<div class="toolBar">
|
|
||||||
<div class="toolBarTitle">
|
|
||||||
<i class="fas" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.title }}
|
|
||||||
</div>
|
|
||||||
<div class="settings">
|
|
||||||
<span class="setting" ng-class="{ 'setting-active': $ctrl.state.displayTextFilter }" ng-click="$ctrl.updateDisplayTextFilter()" ng-if="$ctrl.showTextFilter">
|
|
||||||
<i class="fa fa-search" aria-hidden="true"></i> Search
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
|
||||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
|
||||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
|
||||||
</div>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<a ng-click="$ctrl.changeOrderBy('name')">
|
|
||||||
Name
|
|
||||||
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'name' && !$ctrl.state.reverseOrder"></i>
|
|
||||||
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'name' && $ctrl.state.reverseOrder"></i>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a ng-click="$ctrl.changeOrderBy('cpu')">
|
|
||||||
CPU
|
|
||||||
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'cpu' && !$ctrl.state.reverseOrder"></i>
|
|
||||||
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'cpu' && $ctrl.state.reverseOrder"></i>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a ng-click="$ctrl.changeOrderBy('memory')">
|
|
||||||
Memory
|
|
||||||
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'memory' && !$ctrl.state.reverseOrder"></i>
|
|
||||||
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'memory' && $ctrl.state.reverseOrder"></i>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a ng-click="$ctrl.changeOrderBy('ip')">
|
|
||||||
IP Address
|
|
||||||
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'ip' && !$ctrl.state.reverseOrder"></i>
|
|
||||||
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'ip' && $ctrl.state.reverseOrder"></i>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a ng-click="$ctrl.changeOrderBy('version')">
|
|
||||||
Engine
|
|
||||||
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'version' && !$ctrl.state.reverseOrder"></i>
|
|
||||||
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'version' && $ctrl.state.reverseOrder"></i>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a ng-click="$ctrl.changeOrderBy('status')">
|
|
||||||
Status
|
|
||||||
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'status' && !$ctrl.state.reverseOrder"></i>
|
|
||||||
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'status' && $ctrl.state.reverseOrder"></i>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" ng-class="{active: item.Checked}">
|
|
||||||
<td>{{ item.name }}</td>
|
|
||||||
<td>{{ item.cpu }}</td>
|
|
||||||
<td>{{ item.memory }}</td>
|
|
||||||
<td>{{ item.ip }}</td>
|
|
||||||
<td>{{ item.version }}</td>
|
|
||||||
<td><span class="label label-{{ item.status | nodestatusbadge }}">{{ item.status }}</span></td>
|
|
||||||
</tr>
|
|
||||||
<tr ng-if="!$ctrl.dataset">
|
|
||||||
<td colspan="6" class="text-center text-muted">Loading...</td>
|
|
||||||
</tr>
|
|
||||||
<tr ng-if="$ctrl.state.filteredDataSet.length === 0">
|
|
||||||
<td colspan="6" class="text-center text-muted">No node available.</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="footer" ng-if="$ctrl.dataset">
|
|
||||||
<div class="paginationControls">
|
|
||||||
<form class="form-inline">
|
|
||||||
<span class="limitSelector">
|
|
||||||
<span style="margin-right: 5px;">
|
|
||||||
Items per page
|
|
||||||
</span>
|
|
||||||
<select class="form-control" ng-model="$ctrl.state.paginatedItemLimit" ng-change="$ctrl.changePaginationLimit()">
|
|
||||||
<option value="0">All</option>
|
|
||||||
<option value="10">10</option>
|
|
||||||
<option value="25">25</option>
|
|
||||||
<option value="50">50</option>
|
|
||||||
<option value="100">100</option>
|
|
||||||
</select>
|
|
||||||
</span>
|
|
||||||
<dir-pagination-controls max-size="5"></dir-pagination-controls>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</rd-widget-body>
|
|
||||||
</rd-widget>
|
|
||||||
</div>
|
|
|
@ -1,13 +0,0 @@
|
||||||
angular.module('portainer.docker').component('nodesSsDatatable', {
|
|
||||||
templateUrl: 'app/docker/components/datatables/nodes-ss-datatable/nodesSSDatatable.html',
|
|
||||||
controller: 'GenericDatatableController',
|
|
||||||
bindings: {
|
|
||||||
title: '@',
|
|
||||||
titleIcon: '@',
|
|
||||||
dataset: '<',
|
|
||||||
tableKey: '@',
|
|
||||||
orderBy: '@',
|
|
||||||
reverseOrder: '<',
|
|
||||||
showTextFilter: '<'
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -162,12 +162,6 @@ angular.module('portainer.docker')
|
||||||
return name.substring(1, name.length);
|
return name.substring(1, name.length);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter('swarmcontainername', function () {
|
|
||||||
'use strict';
|
|
||||||
return function (container) {
|
|
||||||
return _.split(container.Names[0], '/')[2];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.filter('swarmversion', function () {
|
.filter('swarmversion', function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
return function (text) {
|
return function (text) {
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
angular.module('portainer.docker')
|
angular.module('portainer.docker')
|
||||||
.factory('InfoHelper', [function InfoHelperFactory() {
|
.factory('InfoHelper', [function InfoHelperFactory() {
|
||||||
'use strict';
|
'use strict';
|
||||||
return {
|
|
||||||
determineEndpointMode: function(info) {
|
var helper = {};
|
||||||
|
|
||||||
|
helper.determineEndpointMode = function(info) {
|
||||||
var mode = {
|
var mode = {
|
||||||
provider: '',
|
provider: '',
|
||||||
role: ''
|
role: ''
|
||||||
};
|
};
|
||||||
if (_.startsWith(info.ServerVersion, 'swarm')) {
|
|
||||||
mode.provider = 'DOCKER_SWARM';
|
|
||||||
if (info.SystemStatus[0][1] === 'primary') {
|
|
||||||
mode.role = 'PRIMARY';
|
|
||||||
} else {
|
|
||||||
mode.role = 'REPLICA';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!info.Swarm || _.isEmpty(info.Swarm.NodeID)) {
|
if (!info.Swarm || _.isEmpty(info.Swarm.NodeID)) {
|
||||||
if (info.ID === 'vSphere Integrated Containers') {
|
if (info.ID === 'vSphere Integrated Containers') {
|
||||||
mode.provider = 'VMWARE_VIC';
|
mode.provider = 'VMWARE_VIC';
|
||||||
|
@ -29,8 +24,8 @@ angular.module('portainer.docker')
|
||||||
mode.role = 'WORKER';
|
mode.role = 'WORKER';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return mode;
|
return mode;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return helper;
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -31,7 +31,7 @@ angular.module('portainer.docker')
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
service.networks = function(localNetworks, swarmNetworks, swarmAttachableNetworks, globalNetworks) {
|
service.networks = function(localNetworks, swarmNetworks, swarmAttachableNetworks) {
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
Network.query({}).$promise
|
Network.query({}).$promise
|
||||||
|
@ -48,9 +48,6 @@ angular.module('portainer.docker')
|
||||||
if (swarmAttachableNetworks && network.Scope === 'swarm' && network.Attachable === true) {
|
if (swarmAttachableNetworks && network.Scope === 'swarm' && network.Attachable === true) {
|
||||||
return network;
|
return network;
|
||||||
}
|
}
|
||||||
if (globalNetworks && network.Scope === 'global') {
|
|
||||||
return network;
|
|
||||||
}
|
|
||||||
}).map(function (item) {
|
}).map(function (item) {
|
||||||
return new NetworkViewModel(item);
|
return new NetworkViewModel(item);
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
dataset="containers" table-key="containers"
|
dataset="containers" table-key="containers"
|
||||||
order-by="Status" show-text-filter="true"
|
order-by="Status" show-text-filter="true"
|
||||||
show-ownership-column="applicationState.application.authentication"
|
show-ownership-column="applicationState.application.authentication"
|
||||||
swarm-containers="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'"
|
|
||||||
public-url="state.publicURL"
|
public-url="state.publicURL"
|
||||||
container-name-truncate-size="truncate_size"
|
container-name-truncate-size="truncate_size"
|
||||||
start-action="startAction"
|
start-action="startAction"
|
||||||
|
|
|
@ -105,28 +105,10 @@ angular.module('portainer.docker')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function retrieveSwarmHostsInfo(data) {
|
function assignContainers(containers) {
|
||||||
var swarm_hosts = {};
|
|
||||||
var systemStatus = data.SystemStatus;
|
|
||||||
var node_count = parseInt(systemStatus[3][1], 10);
|
|
||||||
var node_offset = 4;
|
|
||||||
for (i = 0; i < node_count; i++) {
|
|
||||||
var host = {};
|
|
||||||
host.name = _.trim(systemStatus[node_offset][0]);
|
|
||||||
host.ip = _.split(systemStatus[node_offset][1], ':')[0];
|
|
||||||
swarm_hosts[host.name] = host.ip;
|
|
||||||
node_offset += 9;
|
|
||||||
}
|
|
||||||
return swarm_hosts;
|
|
||||||
}
|
|
||||||
|
|
||||||
function assignContainers(containers, provider) {
|
|
||||||
var previouslySelectedContainers = $transition$.params().selectedContainers || [];
|
var previouslySelectedContainers = $transition$.params().selectedContainers || [];
|
||||||
$scope.containers = containers.map(function (container) {
|
$scope.containers = containers.map(function (container) {
|
||||||
container.Status = $filter('containerstatus')(container.Status);
|
container.Status = $filter('containerstatus')(container.Status);
|
||||||
if (provider === 'DOCKER_SWARM') {
|
|
||||||
container.hostIP = $scope.swarm_hosts[_.split(container.Names[0], '/')[1]];
|
|
||||||
}
|
|
||||||
|
|
||||||
var previousContainer = _.find(previouslySelectedContainers, function(item) {
|
var previousContainer = _.find(previouslySelectedContainers, function(item) {
|
||||||
return item.Id === container.Id;
|
return item.Id === container.Id;
|
||||||
|
@ -143,15 +125,9 @@ angular.module('portainer.docker')
|
||||||
function initView() {
|
function initView() {
|
||||||
var provider = $scope.applicationState.endpoint.mode.provider;
|
var provider = $scope.applicationState.endpoint.mode.provider;
|
||||||
|
|
||||||
$q.all({
|
ContainerService.containers(1)
|
||||||
swarm: provider !== 'DOCKER_SWARM' || SystemService.info(),
|
|
||||||
containers: ContainerService.containers(1)
|
|
||||||
})
|
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
if (provider === 'DOCKER_SWARM') {
|
assignContainers(data);
|
||||||
$scope.swarm_hosts = retrieveSwarmHostsInfo(data.swarm);
|
|
||||||
}
|
|
||||||
assignContainers(data.containers, provider);
|
|
||||||
})
|
})
|
||||||
.catch(function error(err) {
|
.catch(function error(err) {
|
||||||
Notifications.error('Failure', err, 'Unable to retrieve containers');
|
Notifications.error('Failure', err, 'Unable to retrieve containers');
|
||||||
|
|
|
@ -183,9 +183,6 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
|
||||||
var containerName = container;
|
var containerName = container;
|
||||||
if (container && typeof container === 'object') {
|
if (container && typeof container === 'object') {
|
||||||
containerName = $filter('trimcontainername')(container.Names[0]);
|
containerName = $filter('trimcontainername')(container.Names[0]);
|
||||||
if ($scope.applicationState.endpoint.mode.provider === 'DOCKER_SWARM') {
|
|
||||||
containerName = $filter('swarmcontainername')(container);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var networkMode = mode;
|
var networkMode = mode;
|
||||||
if (containerName) {
|
if (containerName) {
|
||||||
|
@ -505,8 +502,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
|
||||||
NetworkService.networks(
|
NetworkService.networks(
|
||||||
provider === 'DOCKER_STANDALONE' || provider === 'DOCKER_SWARM_MODE',
|
provider === 'DOCKER_STANDALONE' || provider === 'DOCKER_SWARM_MODE',
|
||||||
false,
|
false,
|
||||||
provider === 'DOCKER_SWARM_MODE' && apiVersion >= 1.25,
|
provider === 'DOCKER_SWARM_MODE' && apiVersion >= 1.25
|
||||||
provider === 'DOCKER_SWARM'
|
|
||||||
)
|
)
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
var networks = data;
|
var networks = data;
|
||||||
|
|
|
@ -307,10 +307,7 @@
|
||||||
<div class="form-group" ng-if="config.HostConfig.NetworkMode == 'container'">
|
<div class="form-group" ng-if="config.HostConfig.NetworkMode == 'container'">
|
||||||
<label for="container_network_container" class="col-sm-2 col-lg-1 control-label text-left">Container</label>
|
<label for="container_network_container" class="col-sm-2 col-lg-1 control-label text-left">Container</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<select ng-if="applicationState.endpoint.mode.provider !== 'DOCKER_SWARM'" ng-options="container|containername for container in runningContainers" class="form-control" ng-model="formValues.NetworkContainer">
|
<select ng-options="container|containername for container in runningContainers" class="form-control" ng-model="formValues.NetworkContainer">
|
||||||
<option selected disabled hidden value="">Select a container</option>
|
|
||||||
</select>
|
|
||||||
<select ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'" ng-options="container|swarmcontainername for container in runningContainers" class="form-control" ng-model="formValues.NetworkContainer">
|
|
||||||
<option selected disabled hidden value="">Select a container</option>
|
<option selected disabled hidden value="">Select a container</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -274,8 +274,7 @@ function ($q, $scope, $state, $transition$, $filter, Container, Commit, Containe
|
||||||
NetworkService.networks(
|
NetworkService.networks(
|
||||||
provider === 'DOCKER_STANDALONE' || provider === 'DOCKER_SWARM_MODE',
|
provider === 'DOCKER_STANDALONE' || provider === 'DOCKER_SWARM_MODE',
|
||||||
false,
|
false,
|
||||||
provider === 'DOCKER_SWARM_MODE' && apiVersion >= 1.25,
|
provider === 'DOCKER_SWARM_MODE' && apiVersion >= 1.25
|
||||||
provider === 'DOCKER_SWARM'
|
|
||||||
)
|
)
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
var networks = data;
|
var networks = data;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</rd-header>
|
</rd-header>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-md-12 col-xs-12" ng-if="applicationState.endpoint.mode.provider !== 'DOCKER_SWARM'">
|
<div class="col-sm-12">
|
||||||
<rd-widget>
|
<rd-widget>
|
||||||
<rd-widget-header icon="fa-tachometer-alt" title="Node info"></rd-widget-header>
|
<rd-widget-header icon="fa-tachometer-alt" title="Node info"></rd-widget-header>
|
||||||
<rd-widget-body classes="no-padding">
|
<rd-widget-body classes="no-padding">
|
||||||
|
@ -31,33 +31,6 @@
|
||||||
</rd-widget-body>
|
</rd-widget-body>
|
||||||
</rd-widget>
|
</rd-widget>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-12 col-md-12 col-xs-12" ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">
|
|
||||||
<rd-widget>
|
|
||||||
<rd-widget-header icon="fa-tachometer-alt" title="Cluster info"></rd-widget-header>
|
|
||||||
<rd-widget-body classes="no-padding">
|
|
||||||
<table class="table">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>Nodes</td>
|
|
||||||
<td>{{ infoData.SystemStatus[0][1] == 'primary' ? infoData.SystemStatus[3][1] : infoData.SystemStatus[4][1] }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Swarm version</td>
|
|
||||||
<td>{{ infoData.ServerVersion|swarmversion }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Total CPU</td>
|
|
||||||
<td>{{ infoData.NCPU }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Total memory</td>
|
|
||||||
<td>{{ infoData.MemTotal|humansize: 2 }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</rd-widget-body>
|
|
||||||
</rd-widget>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-12 col-md-12 col-xs-12" ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">
|
<div class="col-lg-12 col-md-12 col-xs-12" ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">
|
||||||
<rd-widget>
|
<rd-widget>
|
||||||
<rd-widget-header icon="fa-tachometer-alt" title="Swarm info"></rd-widget-header>
|
<rd-widget-header icon="fa-tachometer-alt" title="Swarm info"></rd-widget-header>
|
||||||
|
|
|
@ -57,9 +57,6 @@ function ($scope, $state, ImageService, Notifications, ModalService) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function initView() {
|
function initView() {
|
||||||
var endpointProvider = $scope.applicationState.endpoint.mode.provider;
|
|
||||||
var apiVersion = $scope.applicationState.endpoint.apiVersion;
|
|
||||||
|
|
||||||
ImageService.images(true)
|
ImageService.images(true)
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
$scope.images = data;
|
$scope.images = data;
|
||||||
|
|
|
@ -119,9 +119,8 @@ function ($q, $scope, $state, PluginService, Notifications, NetworkService, Labe
|
||||||
};
|
};
|
||||||
|
|
||||||
function initView() {
|
function initView() {
|
||||||
var endpointProvider = $scope.applicationState.endpoint.mode.provider;
|
|
||||||
var apiVersion = $scope.applicationState.endpoint.apiVersion;
|
var apiVersion = $scope.applicationState.endpoint.apiVersion;
|
||||||
if(endpointProvider !== 'DOCKER_SWARM') {
|
|
||||||
PluginService.networkPlugins(apiVersion < 1.25)
|
PluginService.networkPlugins(apiVersion < 1.25)
|
||||||
.then(function success(data){
|
.then(function success(data){
|
||||||
$scope.availableNetworkDrivers = data;
|
$scope.availableNetworkDrivers = data;
|
||||||
|
@ -130,7 +129,6 @@ function ($q, $scope, $state, PluginService, Notifications, NetworkService, Labe
|
||||||
Notifications.error('Failure', err, 'Unable to retrieve network drivers');
|
Notifications.error('Failure', err, 'Unable to retrieve network drivers');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -16,48 +16,21 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Nodes</td>
|
<td>Nodes</td>
|
||||||
<td ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">{{ swarm.Nodes }}</td>
|
<td>{{ info.Swarm.Nodes }}</td>
|
||||||
<td ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">{{ info.Swarm.Nodes }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">
|
|
||||||
<td>Images</td>
|
|
||||||
<td>{{ info.Images }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">
|
|
||||||
<td>Swarm version</td>
|
|
||||||
<td>{{ docker.Version|swarmversion }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Docker API version</td>
|
<td>Docker API version</td>
|
||||||
<td>{{ docker.ApiVersion }}</td>
|
<td>{{ docker.ApiVersion }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">
|
|
||||||
<td>Strategy</td>
|
|
||||||
<td>{{ swarm.Strategy }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Total CPU</td>
|
<td>Total CPU</td>
|
||||||
<td ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">{{ info.NCPU }}</td>
|
<td>{{ totalCPU }}</td>
|
||||||
<td ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">{{ totalCPU }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Total memory</td>
|
<td>Total memory</td>
|
||||||
<td ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">{{ info.MemTotal|humansize: 2 }}</td>
|
<td>{{ totalMemory|humansize: 2 }}</td>
|
||||||
<td ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">{{ totalMemory|humansize: 2 }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">
|
<tr>
|
||||||
<td>Operating system</td>
|
|
||||||
<td>{{ info.OperatingSystem }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">
|
|
||||||
<td>Kernel version</td>
|
|
||||||
<td>{{ info.KernelVersion }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">
|
|
||||||
<td>Go version</td>
|
|
||||||
<td>{{ docker.GoVersion }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">
|
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="btn-group" role="group" aria-label="...">
|
<div class="btn-group" role="group" aria-label="...">
|
||||||
<a ui-sref="docker.swarm.visualizer"><i class="fa fa-object-group space-right" aria-hidden="true"></i>Go to cluster visualizer</a>
|
<a ui-sref="docker.swarm.visualizer"><i class="fa fa-object-group space-right" aria-hidden="true"></i>Go to cluster visualizer</a>
|
||||||
|
@ -72,14 +45,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12" ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM'">
|
<div class="col-sm-12">
|
||||||
<nodes-ss-datatable
|
|
||||||
title="Nodes" title-icon="fa-hdd"
|
|
||||||
dataset="swarm.Status" table-key="nodes"
|
|
||||||
order-by="name" show-text-filter="true"
|
|
||||||
></nodes-ss-datatable>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-12" ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">
|
|
||||||
<nodes-datatable
|
<nodes-datatable
|
||||||
title="Nodes" title-icon="fa-hdd"
|
title="Nodes" title-icon="fa-hdd"
|
||||||
dataset="nodes" table-key="nodes"
|
dataset="nodes" table-key="nodes"
|
||||||
|
|
|
@ -126,10 +126,7 @@
|
||||||
<div ng-repeat="var in state.selectedTemplate.Env" ng-if="!var.set" class="form-group">
|
<div ng-repeat="var in state.selectedTemplate.Env" ng-if="!var.set" class="form-group">
|
||||||
<label for="field_{{ $index }}" class="col-sm-2 control-label text-left">{{ var.label }}</label>
|
<label for="field_{{ $index }}" class="col-sm-2 control-label text-left">{{ var.label }}</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<select ng-if="applicationState.endpoint.mode.provider !== 'DOCKER_SWARM' && var.type === 'container'" ng-options="container|containername for container in runningContainers" class="form-control" ng-model="var.value">
|
<select ng-if="var.type === 'container'" ng-options="container|containername for container in runningContainers" class="form-control" ng-model="var.value">
|
||||||
<option selected disabled hidden value="">Select a container</option>
|
|
||||||
</select>
|
|
||||||
<select ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM' && var.type === 'container'" ng-options="container|swarmcontainername for container in runningContainers" class="form-control" ng-model="var.value">
|
|
||||||
<option selected disabled hidden value="">Select a container</option>
|
<option selected disabled hidden value="">Select a container</option>
|
||||||
</select>
|
</select>
|
||||||
<input ng-if="!var.type || !var.type === 'container'" type="text" class="form-control" ng-model="var.value" id="field_{{ $index }}">
|
<input ng-if="!var.type || !var.type === 'container'" type="text" class="form-control" ng-model="var.value" id="field_{{ $index }}">
|
||||||
|
@ -329,9 +326,6 @@
|
||||||
<span ng-hide="state.actionInProgress">Deploy the container</span>
|
<span ng-hide="state.actionInProgress">Deploy the container</span>
|
||||||
<span ng-show="state.actionInProgress">Deployment in progress...</span>
|
<span ng-show="state.actionInProgress">Deployment in progress...</span>
|
||||||
</button>
|
</button>
|
||||||
<span class="small text-muted" style="margin-left: 10px" ng-if="globalNetworkCount === 0 && applicationState.endpoint.mode.provider === 'DOCKER_SWARM' && !state.formValidationError">
|
|
||||||
When using Swarm, we recommend deploying containers in a shared network. Looks like you don't have any shared network, head over the <a ui-sref="docker.networks">networks view</a> to create one.
|
|
||||||
</span>
|
|
||||||
<span class="text-danger" ng-if="state.formValidationError" style="margin-left: 5px;">{{ state.formValidationError }}</span>
|
<span class="text-danger" ng-if="state.formValidationError" style="margin-left: 5px;">{{ state.formValidationError }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -198,11 +198,8 @@ function ($scope, $q, $state, $transition$, $anchorScroll, $filter, ContainerSer
|
||||||
}
|
}
|
||||||
|
|
||||||
function determineContainerMapping(network) {
|
function determineContainerMapping(network) {
|
||||||
var endpointProvider = $scope.applicationState.endpoint.mode.provider;
|
|
||||||
var containerMapping = 'BY_CONTAINER_IP';
|
var containerMapping = 'BY_CONTAINER_IP';
|
||||||
if (endpointProvider === 'DOCKER_SWARM' && network.Scope === 'global') {
|
if (network.Name !== 'bridge') {
|
||||||
containerMapping = 'BY_SWARM_CONTAINER_NAME';
|
|
||||||
} else if (network.Name !== 'bridge') {
|
|
||||||
containerMapping = 'BY_CONTAINER_NAME';
|
containerMapping = 'BY_CONTAINER_NAME';
|
||||||
}
|
}
|
||||||
return containerMapping;
|
return containerMapping;
|
||||||
|
@ -231,8 +228,8 @@ function ($scope, $q, $state, $transition$, $anchorScroll, $filter, ContainerSer
|
||||||
networks: NetworkService.networks(
|
networks: NetworkService.networks(
|
||||||
provider === 'DOCKER_STANDALONE' || provider === 'DOCKER_SWARM_MODE',
|
provider === 'DOCKER_STANDALONE' || provider === 'DOCKER_SWARM_MODE',
|
||||||
false,
|
false,
|
||||||
provider === 'DOCKER_SWARM_MODE' && apiVersion >= 1.25,
|
provider === 'DOCKER_SWARM_MODE' && apiVersion >= 1.25
|
||||||
provider === 'DOCKER_SWARM'),
|
),
|
||||||
settings: SettingsService.publicSettings()
|
settings: SettingsService.publicSettings()
|
||||||
})
|
})
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
|
|
|
@ -75,9 +75,8 @@ function ($q, $scope, $state, VolumeService, PluginService, ResourceControlServi
|
||||||
};
|
};
|
||||||
|
|
||||||
function initView() {
|
function initView() {
|
||||||
var endpointProvider = $scope.applicationState.endpoint.mode.provider;
|
|
||||||
var apiVersion = $scope.applicationState.endpoint.apiVersion;
|
var apiVersion = $scope.applicationState.endpoint.apiVersion;
|
||||||
if (endpointProvider !== 'DOCKER_SWARM') {
|
|
||||||
PluginService.volumePlugins(apiVersion < 1.25 || endpointProvider === 'VMWARE_VIC')
|
PluginService.volumePlugins(apiVersion < 1.25 || endpointProvider === 'VMWARE_VIC')
|
||||||
.then(function success(data) {
|
.then(function success(data) {
|
||||||
$scope.availableVolumeDrivers = data;
|
$scope.availableVolumeDrivers = data;
|
||||||
|
@ -86,7 +85,6 @@ function ($q, $scope, $state, VolumeService, PluginService, ResourceControlServi
|
||||||
Notifications.error('Failure', err, 'Unable to retrieve volume drivers');
|
Notifications.error('Failure', err, 'Unable to retrieve volume drivers');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -68,8 +68,6 @@ angular.module('portainer.app')
|
||||||
value = container.NetworkSettings.Networks[Object.keys(container.NetworkSettings.Networks)[0]].IPAddress;
|
value = container.NetworkSettings.Networks[Object.keys(container.NetworkSettings.Networks)[0]].IPAddress;
|
||||||
} else if (containerMapping === 'BY_CONTAINER_NAME') {
|
} else if (containerMapping === 'BY_CONTAINER_NAME') {
|
||||||
value = $filter('containername')(envvar.value);
|
value = $filter('containername')(envvar.value);
|
||||||
} else if (containerMapping === 'BY_SWARM_CONTAINER_NAME') {
|
|
||||||
value = $filter('swarmcontainername')(envvar.value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
env.push(envvar.name + '=' + value);
|
env.push(envvar.name + '=' + value);
|
||||||
|
|
Loading…
Reference in New Issue