Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Show ALL regions' leaders when viewing servers route #24723

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

philrenaud
Copy link
Contributor

@philrenaud philrenaud commented Dec 19, 2024

Resolves #24309

In a multi-region setup:
image

In a single-region setup:
image

Comment on lines +32 to +37
@tracked isLeader = false;

@action async checkForLeadership() {
const leaders = await this.system.leaders;
this.isLeader = leaders.includes(this.rpcAddr);
return this.isLeader;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using tracked is more idiomatic than the isLeader getter in Ember Octane. And since service getters (like this.get('system.leader....) was the thing holding it back as a classic model, removed the @classic tag as well.

.authorizedRequest(`/${namespace}/status/leader?region=${region}`)
.then((res) => res.json());
})
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Best as I can tell, the only thing that uses system.leader was the servers page, which is now using .leaders instead. Removed the old one.

Copy link
Member

Choose a reason for hiding this comment

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

What's the ${namespace} referring to here? v1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, v1! It's my third favourite among the three ways we use the term "namespace" in the UI.

It imports from

export const namespace = 'v1';


beforeModel() {
return this.get('system.leader');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As best as I can tell, this was accidentally left in here by copying the servers route page ~9 years ago.

Copy link
Contributor

Choose a reason for hiding this comment

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

nomad-bushes

Comment on lines +21 to +29
@text={{if
this.agent.isLeader
(if
this.agent.system.shouldShowRegions
(concat "True" " (" this.agent.region ")")
"True"
)
"False"
}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Funky formatting, but:

  1. If not a leader, just show "False"
  2. If a leader, show "True"
  3. If there are multiple regions at play, show region name in parentheses.

@philrenaud philrenaud marked this pull request as ready for review December 19, 2024 19:06
@philrenaud philrenaud requested review from a team as code owners December 19, 2024 19:06
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

Parity between /ui/servers and nomad server members
3 participants