Skip to content

Commit

Permalink
feat(cluster-list): add context-path in cluster-list
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Sep 15, 2022
1 parent 5a1045f commit 8776455
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
26 changes: 15 additions & 11 deletions packages/cluster/src/commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ const formatStatus = status => {
}
}

const run = async function (argv) {
const run = async function(argv) {
const clusters = await listClusters(argv)

const anyCustomContext = clusters.some(
cluster => cluster.contextPath !== ''
)
const table = new Table({
head: [
'Name',
Expand All @@ -45,20 +47,22 @@ const run = async function (argv) {
'DHIS2 Version',
'DB Version',
'Status',
],
].concat(anyCustomContext ? 'Context Path' : []),
})

await Promise.all(
clusters.map(async cluster => {
const status = await getStatus(cluster)
table.push([
chalk.blue(cluster.name),
cluster.port,
cluster.channel,
cluster.dhis2Version,
cluster.dbVersion,
formatStatus(status),
])
table.push(
[
chalk.blue(cluster.name),
cluster.port,
cluster.channel,
cluster.dhis2Version,
cluster.dbVersion,
formatStatus(status),
].concat(anyCustomContext ? cluster.contextPath : [])
)
})
)

Expand Down
3 changes: 2 additions & 1 deletion packages/cluster/src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ async function resolveConfiguration(argv = {}) {
)

reporter.debug('Resolved configuration\n', resolved)

await argv.getCache().write(
file,
JSON.stringify(
Expand Down Expand Up @@ -163,7 +164,7 @@ module.exports.makeEnvironment = cfg => {
return env
}

const resolveCustomContextPath = (resolved) => {
const resolveCustomContextPath = resolved => {
let contextPath = resolved.customContext
if (customContext === '') {
contextPath = resolved.name
Expand Down

0 comments on commit 8776455

Please sign in to comment.