Skip to content

Commit 8776455

Browse files
committed
feat(cluster-list): add context-path in cluster-list
1 parent 5a1045f commit 8776455

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

packages/cluster/src/commands/list.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ const formatStatus = status => {
3434
}
3535
}
3636

37-
const run = async function (argv) {
37+
const run = async function(argv) {
3838
const clusters = await listClusters(argv)
39-
39+
const anyCustomContext = clusters.some(
40+
cluster => cluster.contextPath !== ''
41+
)
4042
const table = new Table({
4143
head: [
4244
'Name',
@@ -45,20 +47,22 @@ const run = async function (argv) {
4547
'DHIS2 Version',
4648
'DB Version',
4749
'Status',
48-
],
50+
].concat(anyCustomContext ? 'Context Path' : []),
4951
})
5052

5153
await Promise.all(
5254
clusters.map(async cluster => {
5355
const status = await getStatus(cluster)
54-
table.push([
55-
chalk.blue(cluster.name),
56-
cluster.port,
57-
cluster.channel,
58-
cluster.dhis2Version,
59-
cluster.dbVersion,
60-
formatStatus(status),
61-
])
56+
table.push(
57+
[
58+
chalk.blue(cluster.name),
59+
cluster.port,
60+
cluster.channel,
61+
cluster.dhis2Version,
62+
cluster.dbVersion,
63+
formatStatus(status),
64+
].concat(anyCustomContext ? cluster.contextPath : [])
65+
)
6266
})
6367
)
6468

packages/cluster/src/common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ async function resolveConfiguration(argv = {}) {
122122
)
123123

124124
reporter.debug('Resolved configuration\n', resolved)
125+
125126
await argv.getCache().write(
126127
file,
127128
JSON.stringify(
@@ -163,7 +164,7 @@ module.exports.makeEnvironment = cfg => {
163164
return env
164165
}
165166

166-
const resolveCustomContextPath = (resolved) => {
167+
const resolveCustomContextPath = resolved => {
167168
let contextPath = resolved.customContext
168169
if (customContext === '') {
169170
contextPath = resolved.name

0 commit comments

Comments
 (0)