]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/nc-sysinfo.c
types: Remove detail and progress from struct status
[petitboot] / ui / ncurses / nc-sysinfo.c
index e907e3dc88ae6836affdc0bf312780f47da446f8..ce8957cdfe7f9dcd3aa6cbb4972c7891a721df79 100644 (file)
@@ -25,6 +25,7 @@
 #include <types/types.h>
 #include <log/log.h>
 #include <util/util.h>
+#include <i18n/i18n.h>
 
 #include "nc-cui.h"
 #include "nc-textscreen.h"
@@ -34,6 +35,8 @@ struct sysinfo_screen {
        struct text_screen text_scr;
 };
 
+extern const struct help_text sysinfo_help_text;
+
 struct nc_scr *sysinfo_screen_scr(struct sysinfo_screen *screen)
 {
        return text_screen_scr(&screen->text_scr);
@@ -48,47 +51,88 @@ static void if_info_mac_str(struct interface_info *info,
 static void sysinfo_screen_populate(struct sysinfo_screen *screen,
                const struct system_info *sysinfo)
 {
+       char macbuf[32];
        unsigned int i;
 
        text_screen_clear(&screen->text_scr);
 
 #define line(...) text_screen_append_line(&screen->text_scr, __VA_ARGS__)
        if (!sysinfo) {
-               line("Waiting for system information...");
+               line(_("Waiting for system information..."));
                return;
        }
 
-       line("%-12s %s", "System type:", sysinfo->type ?: "");
-       line("%-12s %s", "System id:",   sysinfo->identifier ?: "");
+       line("%-12s %s", _("System type:"), sysinfo->type ?: "");
+       line("%-12s %s", _("System id:"),   sysinfo->identifier ?: "");
+
+       if (sysinfo->n_primary) {
+               line(NULL);
+               line("%s", _("Primary platform versions:"));
+               for (i = 0; i < sysinfo->n_primary; i++) {
+                       line("\t%s", sysinfo->platform_primary[i] ?: "");
+               }
+       }
+
+       if (sysinfo->n_other) {
+               line(NULL);
+               line("%s", _("Alternate platform versions:"));
+               for (i = 0; i < sysinfo->n_other; i++) {
+                       line("\t%s", sysinfo->platform_other[i] ?: "");
+               }
+       }
+
+       if (sysinfo->n_bmc_current) {
+               line(NULL);
+               line("%s", _("BMC current side:"));
+               for (i = 0; i < sysinfo->n_bmc_current; i++) {
+                       line("\t%s", sysinfo->bmc_current[i] ?: "");
+               }
+       }
+
+       if (sysinfo->n_bmc_golden) {
+               line(NULL);
+               line("%s", _("BMC golden side:"));
+               for (i = 0; i < sysinfo->n_bmc_golden; i++) {
+                       line("\t%s", sysinfo->bmc_golden[i] ?: "");
+               }
+       }
 
        if (sysinfo->n_blockdevs) {
                line(NULL);
-               line("Storage devices");
+               line(_("Storage devices"));
        }
 
        for (i = 0; i < sysinfo->n_blockdevs; i++) {
                struct blockdev_info *info = sysinfo->blockdevs[i];
 
                line("%s:", info->name);
-               line(" UUID:       %s", info->uuid);
-               line(" mounted at: %s", info->mountpoint);
+               line(_(" UUID:       %s"), info->uuid);
+               line(_(" mounted at: %s"), info->mountpoint);
                line(NULL);
        }
 
+       if (sysinfo->bmc_mac) {
+               line(NULL);
+               mac_str(sysinfo->bmc_mac, HWADDR_SIZE, macbuf, sizeof(macbuf));
+               line(_("Management (BMC) interface"));
+               line(_(" MAC:  %s"), macbuf);
+       }
+
        if (sysinfo->n_interfaces) {
                line(NULL);
-               line("Network interfaces");
+               line(_("Network interfaces"));
        }
 
        for (i = 0; i < sysinfo->n_interfaces; i++) {
                struct interface_info *info = sysinfo->interfaces[i];
-               char macbuf[32];
 
                if_info_mac_str(info, macbuf, sizeof(macbuf));
 
                line("%s:", info->name);
-               line(" MAC:  %s", macbuf);
-               line(" link: %s", info->link ? "up" : "down");
+               line(_(" MAC:  %s"), macbuf);
+               /* TRANSLATORS: these "up" / "down" strings refer to the
+                * link status for a network connection. */
+               line(_(" link: %s"), info->link ? _("up") : _("down"));
                line(NULL);
        }
 
@@ -99,7 +143,11 @@ void sysinfo_screen_update(struct sysinfo_screen *screen,
                const struct system_info *sysinfo)
 {
        sysinfo_screen_populate(screen, sysinfo);
-       text_screen_draw(&screen->text_scr);
+
+       if (screen->text_scr.cui->help_screen)
+               screen->text_scr.need_update = true;
+       else
+               text_screen_draw(&screen->text_scr);
 }
 
 struct sysinfo_screen *sysinfo_screen_init(struct cui *cui,
@@ -110,7 +158,9 @@ struct sysinfo_screen *sysinfo_screen_init(struct cui *cui,
 
        screen = talloc_zero(cui, struct sysinfo_screen);
        text_screen_init(&screen->text_scr, cui,
-                       "Petitboot System Information", on_exit);
+                       _("Petitboot System Information"), on_exit);
+       text_screen_set_help(&screen->text_scr,
+                       _("System Information"), &sysinfo_help_text);
 
        sysinfo_screen_update(screen, sysinfo);