diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-09-06 13:30:39 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-09-08 14:26:27 +1000 |
commit | e4a641a6e3133158b003d19ee285cfc37164cb1f (patch) | |
tree | a3c5bf74b43d6575ac17b33288188859f604c86d | |
parent | 662129afba2d344d692a9dbfd430c91eff4f281d (diff) | |
download | petitboot-e4a641a6e3133158b003d19ee285cfc37164cb1f.zip petitboot-e4a641a6e3133158b003d19ee285cfc37164cb1f.tar.gz |
ui/ncurses: Display warning when net override active
If the current interface config has been set by an IPMI network
override, display a warning in nc-config that saving the current config
will overwrite any saved interface config.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r-- | ui/ncurses/nc-config.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index 10d7eb6..fbba943 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -33,7 +33,7 @@ #include "nc-config.h" #include "nc-widgets.h" -#define N_FIELDS 42 +#define N_FIELDS 43 extern struct help_text config_help_text; @@ -67,6 +67,7 @@ struct config_screen { bool autoboot_enabled; bool ipmi_override; + bool net_override; struct { struct nc_widget_label *autoboot_l; @@ -112,6 +113,7 @@ struct config_screen { struct nc_widget_select *boot_tty_f; struct nc_widget_label *current_tty_l; + struct nc_widget_label *net_override_l; struct nc_widget_label *safe_mode; struct nc_widget_button *ok_b; struct nc_widget_button *help_b; @@ -473,7 +475,8 @@ static void config_screen_layout_widgets(struct config_screen *screen) widget_move(wf, y, screen->field_x); widget_move(wh, y, screen->field_x + widget_width(wf) + 1); y += 2; - } + } else + y += 1; if (screen->ipmi_override) { wl = widget_label_base(screen->widgets.ipmi_type_l); @@ -583,13 +586,6 @@ static void config_screen_layout_widgets(struct config_screen *screen) y += 1; - show = screen->cui->config->safe_mode; - if (show) { - widget_move(widget_label_base(screen->widgets.safe_mode), - y, screen->field_x); - y += 1; - } - layout_pair(screen, y, screen->widgets.allow_write_l, widget_select_base(screen->widgets.allow_write_f)); y += widget_height(widget_select_base(screen->widgets.allow_write_f)); @@ -612,6 +608,22 @@ static void config_screen_layout_widgets(struct config_screen *screen) screen->widgets.current_tty_l), false); } + if (screen->net_override) { + widget_move(widget_label_base(screen->widgets.net_override_l), + y, screen->label_x); + widget_set_visible(widget_label_base(screen->widgets.net_override_l), + true); + y += 1; + } + + if (screen->cui->config->safe_mode) { + widget_move(widget_label_base(screen->widgets.safe_mode), + y, screen->label_x); + widget_set_visible(widget_label_base(screen->widgets.safe_mode), + true); + y += 1; + } + widget_move(widget_button_base(screen->widgets.ok_b), y, screen->field_x); widget_move(widget_button_base(screen->widgets.help_b), @@ -960,6 +972,12 @@ static void config_screen_setup_widgets(struct config_screen *screen, url = ifcfg->static_config.url; } + screen->net_override = ifcfg && ifcfg->override; + if (screen->net_override) { + screen->widgets.net_override_l = widget_new_label(set, 0, 0, + _("Network Override Active! 'OK' will overwrite interface config")); + } + screen->widgets.ip_addr_l = widget_new_label(set, 0, 0, _("IP/mask:")); screen->widgets.ip_addr_f = widget_new_textbox(set, 0, 0, 16, ip); screen->widgets.ip_mask_l = widget_new_label(set, 0, 0, "/"); |