Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions wicket/src/ui/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use ratatui::style::{Modifier, Style};
use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, BorderType, Borders, List, ListItem, Paragraph};
use slog::{Logger, o};
use wicketd_client::types::GetLocationResponse;
use wicketd_client::types::{CurrentRssUserConfig, GetLocationResponse};

/// The [`MainScreen`] is the primary UI element of the terminal, covers the
/// entire terminal window/buffer and is visible for all interactions except
Expand Down Expand Up @@ -194,7 +194,8 @@ impl MainScreen {
frame: &mut Frame<'_>,
rect: Rect,
) {
let location_spans = location_spans(&state.wicketd_location);
let location_spans =
location_spans(&state.rss_config, &state.wicketd_location);
let wicketd_spans = state.service_status.wicketd_liveness().to_spans();
let mgs_spans = state.service_status.mgs_liveness().to_spans();
let xcvr_spans = state.service_status.transceiver_liveness().to_spans();
Expand Down Expand Up @@ -230,11 +231,24 @@ impl MainScreen {
}
}

fn location_spans(location: &GetLocationResponse) -> Vec<Span<'static>> {
fn location_spans(
rss_config: &Option<CurrentRssUserConfig>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. I think this will only show something if an RSS config has been uploaded to this sled's wicketd since it was last rebooted (i.e., basically only during rack setup?). Is that good enough, or do we really want this info to be available even on already-set-up racks too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not to stick my nose where it does not belong, but it might be worse if it only showed this under limited situations? I would love it if you could connect to wicket and have it get current info if the rack is setup, give you loaded RSS config if it has that.

That being said, if this helps you on the way to more, then ignore my comments and do what you want :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had mistakenly assumed that the config would be present if the rack was initialized. Thank you both for the review, I agree it's not very useful to have the name shown ~1% of the time. I'll close this out.

location: &GetLocationResponse,
) -> Vec<Span<'static>> {
// We reuse `style::connected()` and `style::delayed()` in these spans to
// match the wicketd/mgs connection statuses that follow us in the status
// bar.
let mut spans = Vec::new();
if let Some(config) = rss_config {
spans.push(Span::styled(
config.insensitive.external_dns_zone_name.clone(),
style::connected(),
));
} else {
spans
.push(Span::styled("Unnamed Rack".to_string(), style::connected()));
}
spans.push(Span::styled("/", style::divider()));
if let Some(id) = location.sled_id.as_ref() {
spans.push(Span::styled(
format!("Sled {}", id.slot),
Expand Down
Loading