Skip to content

DTS/TUI integration #1683

@m-iwanicki

Description

@m-iwanicki

List of tasks that might have to be done before releasing DTS with new TUI.

References

Priorities

  • 🟢 - needs to be done before release
  • 🟡 - should be done before release
  • 🔴 - might be done before release

Tasks

🟢

  • Move tui-sh_git.bb to different meta-layer, so we can use it in non-DTS projects. Can be done as last step, it's currently in meta-dts to simplify testing during development
  • Resolve TUI: Fix DTS extensions submenu #1684
  • TUI: Fix delay during refresh (tui-sh) #1701
  • Fix OSFV test or modify integration in such a way that all currently passing tests will still pass
  • Do a review of code in tui-lib.sh
  • Run a workflow on real machine and compare with output from before TUI changes, check if everything is printed correctly

🟡

  • Review whole https://github.com/3mdeb/tui-sh repository, tests, documents, examples...
  • Remove examples where we override TUI shell functions (whole dts-integration), I don't think that's a good way to do this and it might encourage others to use library like this. Maybe create simple example based on current DTS implementation
  • Separate TUI library into core (tui_run and all internal functions used to display or configure menu) and utility, used for printing, colors, input and everything else that we might want to use in scripts
  • Add pre-commit to tui-sh (shellcheck, shfmt, markdownlint, maybe more). Run tests as a part of pre-commit.
  • Format strings before displaying them, e.g. section or option labels, entry values. Either disallow printing too long string, e.g. by trimming them and adding ... to the end so it looks better, or in case of section information such as RAM values wrap and display multiple lines correctly indented and with borders drawn
  • Allow usage of commands in callbacks, currently we have to pass whole path to executable
  • Allow usage of commands (with arguments) in conditions, currently we have to use shell variables. e.g. allow usage of systemctl is-active sshd, hide any possible output this might've produced, and display option based on return value of this command
  • Remove hidden Q option that quits menu, this might surprise both developer and user. Allow adding explicit exit option e.g. in footer.
  • Add more utility functions to be used by scripts, name them correctly and document how they should be used. Some of those might already be implemented
    • Colored printing - variables for changing color (exported, or in separate lib to be included), documented usage
    • tui_echo_* prints whole line, maybe change name to tui_print_line. Do we want echo -n version?
    • Various user input:
      • ask_for_choice - Allows us to specify prompt, and list of pairs, <choice_opt> and <choice_msg>.
      • Similar to above, but only prompt + list of choices, opt should be generated automatically (numerically, from 1) by function. Function should echo choice.
      • ask_for_confirmation - yes/no choice
      • Silent read (for passwords), or with * displayed for each key

🔴

  • In tui-lib.sh, use yq directly instead of first converting to JSON
  • Simplify (if possible) and comment config parsing as currently it's very hard to know what's happening (at least for casual jq user)
  • Don't export anything, if you want to use it, source library
  • Add right border - optional, might look better that way.
  • Allow using arguments for callbacks - Current implementation might require us to create useless wrappers that do only one thing, call target command with arguments.

Optional features

  • Add option to force usage of tui_* functions to print on screen. Normal commands e.g. echo shouldn't display anything.

  • Do we want to format output of main/footer commands? Without doing this we might have results like this

    ************************************************************
    **     1) Dasharo HCL report
    **     2) Update Dasharo Firmware
    **     4) Edit your DPP keys
    **     6) Transition Dasharo Firmware
    **     7) Fuse platform
    ************************************************************
    R to reboot  P to poweroff  S to enter shell
    K to launch SSH server  L to enable sending DTS logs
    C to display DPP credentials
    
    Enter an option:
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
    
    Press Enter to continue...
    
  • We might want to have some kind of tui_cat_* function to use if we want to display command output e.g.: ls | tui_cat_*

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions