Skip to content

ui: standardize the display of node name in legend#45665

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
girishramnani:ui-node-id
Apr 13, 2020
Merged

ui: standardize the display of node name in legend#45665
craig[bot] merged 3 commits intocockroachdb:masterfrom
girishramnani:ui-node-id

Conversation

@girishramnani
Copy link
Copy Markdown

@girishramnani girishramnani commented Mar 3, 2020

Standardize the display of node names in report -> legend

Fixes #45622

Release note: none

@girishramnani girishramnani requested a review from a team March 3, 2020 20:29
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 3, 2020

CLA assistant check
All committers have signed the CLA.

@nathanstilwell
Copy link
Copy Markdown
Contributor

@girishramnani Thank you for the contribution! The underlying issue referred to in #45622 and #45551 is that instead of maintaining the display of node names in where they occur, we could use a standard function to control this display wherever they occur. The most likely place to standardize around is the getDisplayName method. But the complication is that the signature for getDisplayName is

getDisplayName(node: INodeStatus, livenessStatus = LivenessStatus.LIVE)

which takes an INodeStatus, but in the case where you've made the change we only have a NoConnection value (which only gives us a number from value.from.nodeID for instance).

So the work would be to reconcile the two. Off the top of my head I don't know how many things are referencing getDisplayName, so I don't know how invasive this change would be. But it seems that it is only using the IP address and node id from INodeStatus so it may not be too much to refactor this method to use a Union Type.

@girishramnani
Copy link
Copy Markdown
Author

girishramnani commented Mar 6, 2020

@nathanstilwell so essentially change the signature of getDisplayName to

getDisplayName(node: INodeStatus | NoConnection, livenessStatus = LivenessStatus.LIVE)

and then have a type guards on it for both INodeStatus and NoConnection?

@nathanstilwell
Copy link
Copy Markdown
Contributor

@girishramnani That is a good start. If we find that we are using this function in lots of other places with various types and have to keep changing that signature, we may consider doing something else. I was imagining a way to prevent that issue, but I suppose there's no use in preoptimizing for the time being.

The important point is that we want to have a single function that controls the format of displaying nodes.

@girishramnani
Copy link
Copy Markdown
Author

sure, will do this change

@girishramnani
Copy link
Copy Markdown
Author

@nathanstilwell changed the code as discussed

Copy link
Copy Markdown
Contributor

@nathanstilwell nathanstilwell left a comment

Choose a reason for hiding this comment

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

One tiny nitpick, before the final LGTM. Thank you for your contribution and being patient with my reviews.

Copy link
Copy Markdown
Contributor

@nathanstilwell nathanstilwell left a comment

Choose a reason for hiding this comment

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

Looks good!

@nathanstilwell
Copy link
Copy Markdown
Contributor

@girishramnani Due to Cockroach being in a stability period ahead of the 20.1 release, I may not merge this in until we cut our release branch. Thank you for the contribution!

@girishramnani
Copy link
Copy Markdown
Author

No problem, I will keep rebasing if there are any conflicts

@dhartunian dhartunian self-requested a review March 18, 2020 19:41
@girishramnani
Copy link
Copy Markdown
Author

@nathanstilwell any update on this?

@nathanstilwell
Copy link
Copy Markdown
Contributor

@girishramnani Thanks for the nudge. I will try to merge now, but we'll see if we get any conflicts.

@nathanstilwell
Copy link
Copy Markdown
Contributor

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 13, 2020

Build succeeded

@craig craig bot merged commit 36fd3c5 into cockroachdb:master Apr 13, 2020
@nathanstilwell
Copy link
Copy Markdown
Contributor

@girishramnani Looks like we're good. Thank you for the contribution!

@girishramnani girishramnani deleted the ui-node-id branch April 26, 2020 10:48
@Amruta-Ranade
Copy link
Copy Markdown
Contributor

@girishramnani Thank you for contributing to CockroachDB this year. As a token of our appreciation, we would like to send you a gift. Please DM me on our community Slack @amruta so I can send you a link. (If you don’t want a gift, we also have a charitable contribution choice.) All orders need to be in by December 13, so please contact me as soon as possible :)

@SWDevAngel
Copy link
Copy Markdown

@girishramnani LAST DAY TO ORDER!!!
Hi Girish. Thank you for contributing to CockroachDB this year. As a token of our appreciation we would like to send you a gift. We tried to reach you via GitHub or on email, but if you didn’t see the message please DM me on our community Slack @lisa so I can send you a link to order your gift. (If you don’t want a gift, we also have a charitable contribution choice.) All orders must be in by December 13 (that’s tomorrow!), so please send this asap. :)

Sign up for free to 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.

ui: Rendering of node names is inconsistent in the code

6 participants