Skip to content

feat(cluster): customisable context path - #565

Open
Birkbjo wants to merge 3 commits into
masterfrom
feat/cluster-context-path
Open

feat(cluster): customisable context path#565
Birkbjo wants to merge 3 commits into
masterfrom
feat/cluster-context-path

Conversation

@Birkbjo

@BirkbjoBirkbjo commented Sep 15, 2022

Copy link
Copy Markdown
Contributor

Previously the --customContext option for the up-command was just a boolean, and it used the cluster name for the contextPath when this was set. I think it should be possible to set this independently of the cluster name, as it's very useful if you would want additional levels, eg. /dhis2/dev. This is somewhat related to CLI-75, since having a cluster with a path-delimeter (/), results in very buggy behavior.

I've tried to implement this in a non-breaking way. Eg. we still support using a flag -c, and we will then use the cluster name.

@Birkbjo
Birkbjoforce-pushed the feat/cluster-context-path branch 2 times, most recently from 3ae135a to 8776455CompareSeptember 15, 2022 23:44
@Birkbjo
Birkbjoforce-pushed the feat/cluster-context-path branch 2 times, most recently from d3d2f29 to 17c6ae1CompareSeptember 16, 2022 00:05
@Birkbjo
Birkbjoforce-pushed the feat/cluster-context-path branch from 17c6ae1 to cf461d7CompareSeptember 16, 2022 00:07
@BirkbjoBirkbjo assigned amcgee and ghostSep 16, 2022
@BirkbjoBirkbjo changed the title feat(cluster): context pathfeat(cluster): customisable context pathSep 16, 2022
@BirkbjoBirkbjo unassigned amcgee and ghostSep 16, 2022
@Birkbjo
Birkbjo requested review from a user and amcgeeSeptember 16, 2022 10:32

@amcgeeamcgee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested myself but this looks good, thanks @Birkbjo! Some minor comments, not blocking.

Comment on lines +39 to +41
const anyCustomContext = clusters.some(
cluster => cluster.contextPath !== ''
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just always show the context, even if none are custom?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could. The idea was that this is most likely not relevant to most users. I think very few are actually using this context-path, and it might be confusing if you don't know what it does?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could go either way here... I also think it would be confusing if d2 cluster list sometimes renders in a different format if you happen to have a custom context on one cluster you're running. It would make any kind of parsing of the output difficult as well, though we're not exactly well setup for that as it is

cluster.dhis2Version,
cluster.dbVersion,
formatStatus(status),
].concat(anyCustomContext ? cluster.contextPath : [])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe cluster.contextPath || '/' ?

@BirkbjoBirkbjoSep 16, 2022

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think we should show this regardless of any set custom-context, I agree, we should probably do that.

Or do you mean we should show '/' instead of an empty cell for non-custom contexts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean we should show / instead of an empty cell for non-custom contexts, since that's the path that they can use to access the instance

@ghostghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer to Austin's review on this. I'm not super familiar with this bit of functionality as a user, changes look good to me 👍️

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Birkbjo@amcgee