Skip to content

Commit af4e72b

Browse files
committed
Merge branch 'hotfix/service-formatting', prepare 2.1.1
2 parents b5ff90c + 9bdb1a2 commit af4e72b

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

src/util/formatServices.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ module.exports = services =>
44
const domain = svc.Config.Labels['traefik.frontend.rule']
55
? svc.Config.Labels['traefik.frontend.rule'].replace('Host:', '')
66
: 'Not set';
7-
const aliases = svc.NetworkSettings.Networks.exoframe.Aliases
8-
? svc.NetworkSettings.Networks.exoframe.Aliases.filter(alias => !svc.Id.startsWith(alias))
9-
: [];
7+
const aliases = Object.keys(svc.NetworkSettings.Networks)
8+
.map(networkName => svc.NetworkSettings.Networks[networkName])
9+
.filter(net => net.Aliases && net.Aliases.length > 0)
10+
.map(net => net.Aliases.filter(alias => !svc.Id.startsWith(alias)))
11+
.reduce((acc, val) => acc.concat(val), []);
1012
const project = svc.Config.Labels['exoframe.project'];
1113
const host = aliases.shift() || 'Not set';
1214
const status = svc.State ? svc.State.Status : '';

test/__snapshots__/list.test.js.snap

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`Should get list of deployments 1`] = `
44
Array [
55
Array [
6-
"[32m3 deployments found on http://localhost:8080:[39m
6+
"[32m4 deployments found on http://localhost:8080:[39m
77
",
88
],
99
Array [
@@ -22,7 +22,8 @@ Array [
2222
Array [],
2323
Array [
2424
" ID   URL   Hostname   Status 
25-
test3   Not set   Not set   Up 13 minutes ",
25+
test3   Not set   Not set   Up 13 minutes
26+
test4   Not set   alias4   Up 10 minutes ",
2627
],
2728
]
2829
`;

test/list.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,26 @@ const services = [
6161
},
6262
},
6363
},
64+
{
65+
Id: '444',
66+
Name: '/test4',
67+
Config: {
68+
Labels: {'exoframe.project': 'somethingelse'},
69+
},
70+
State: {
71+
Status: 'Up 10 minutes',
72+
},
73+
NetworkSettings: {
74+
Networks: {
75+
default: {
76+
Aliases: null,
77+
},
78+
traefik: {
79+
Aliases: ['alias4'],
80+
},
81+
},
82+
},
83+
},
6484
];
6585

6686
// test removal

0 commit comments

Comments
 (0)