mirror of https://github.com/portainer/portainer
feat(swarm): support Swarm replica management (#245)
parent
01d5d11c01
commit
59e65222eb
|
@ -41,7 +41,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Nodes</td>
|
<td>Nodes</td>
|
||||||
<td>{{ infoData.SystemStatus[3][1] }}</td>
|
<td>{{ infoData.SystemStatus[0][1] == 'primary' ? infoData.SystemStatus[3][1] : infoData.SystemStatus[4][1] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Swarm version</td>
|
<td>Swarm version</td>
|
||||||
|
|
|
@ -47,7 +47,8 @@ function ($scope, Info, Version, Node) {
|
||||||
// Swarm filters
|
// Swarm filters
|
||||||
$scope.swarm[systemStatus[2][0]] = systemStatus[2][1];
|
$scope.swarm[systemStatus[2][0]] = systemStatus[2][1];
|
||||||
// Swarm node count
|
// Swarm node count
|
||||||
var node_count = parseInt(systemStatus[3][1], 10);
|
var nodes = systemStatus[0][1] == 'primary' ? systemStatus[3][1] : systemStatus[4][1];
|
||||||
|
var node_count = parseInt(nodes, 10);
|
||||||
$scope.swarm[systemStatus[3][0]] = node_count;
|
$scope.swarm[systemStatus[3][0]] = node_count;
|
||||||
|
|
||||||
$scope.swarm.Status = [];
|
$scope.swarm.Status = [];
|
||||||
|
@ -55,9 +56,10 @@ function ($scope, Info, Version, Node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractNodesInfo(info, node_count) {
|
function extractNodesInfo(info, node_count) {
|
||||||
// First information for node1 available at element #4 of SystemStatus
|
// First information for node1 available at element #4 of SystemStatus if connected to a primary
|
||||||
|
// If connected to a replica, information for node1 is available at element #5
|
||||||
// The next 10 elements are information related to the node
|
// The next 10 elements are information related to the node
|
||||||
var node_offset = 4;
|
var node_offset = info[0][1] == 'primary' ? 4 : 5;
|
||||||
for (i = 0; i < node_count; i++) {
|
for (i = 0; i < node_count; i++) {
|
||||||
extractNodeInfo(info, node_offset);
|
extractNodeInfo(info, node_offset);
|
||||||
node_offset += 9;
|
node_offset += 9;
|
||||||
|
|
Loading…
Reference in New Issue