git-next/crates/cli/src/tui
Paul Campbell 52bd9cc30b
All checks were successful
Rust / build (push) Successful in 10m32s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 1m30s
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
feat(tui): forge widgets only use required lines
Rather than filling all the space available, the ForgeWidget now only
uses as many lines as it needs to show its contents.
2024-08-28 22:25:31 +01:00
..
actor feat(tui): remove duplicate messages from repo body 2024-08-26 08:39:33 +01:00
components feat(tui): forge widgets only use required lines 2024-08-28 22:25:31 +01:00
logging.rs feat(tui): (experimental) show repo state, messages and git log 2024-08-25 15:59:42 +01:00
mod.rs feat(tui): (experimental) show repo state, messages and git log 2024-08-25 15:59:42 +01:00
README.md feat(tui): (experimental) show repo state, messages and git log 2024-08-25 15:59:42 +01:00

TUI Actor

  • Maintains it's own copy of data for holding state
  • Is notified of update via actor messages from the Server and Repo Actors
  • State is somewhat heirarchical

State

enum TuiState {
 Initial,
 Configured {
   app_config: ValidAppConfig,
   forges: BTreeMap<ForgeAlias, RepoState>,
 },
}
enum RepoState {
 Identified { repo_alias: RepoAlias },
 Configured { repo_alias: RepoAlias, branches: RepoBranches },
 Ready { repo_alias: RepoAlias, branches: RepoBranches, main: Commit, next: Commit, dev: Commit, log: Log },
 Alert { repo_alias: RepoAlias, message: String, branches: RepoBranches, main: Commit, next: Commit, dev: Commit, log: Log },
}

State Transitions:

TuiState

stateDiagram-v2
  * --> Initial
  Initial --> Configured
  • message!(Configure, ValidAppConfig, "Initialise UI with valid config");

RepoState

stateDiagram-v2
  * --> Identified
  Identified --> Configured
  Identified --> Ready
  Configured --> Ready
  Ready --> Alert
  Configured --> Alert
  Identified --> Alert
  Alert --> Ready
  • Identified - from AppConfig where a repo alias is listed, but repo config needs to be loaded from .git-next.toml
  • Configured - as Identified but either branches are identified in server config, OR the .git-next.toml file has been loaded
  • Ready - as Configured but the branch positions have been validated and do not require user intervention
  • Alert - as Ready but user intervention is required

Widget

Initial mock up of UI. Possibly add some borders and padding as it looks a little squached together.

+ gh
- jo
  + test (main/next/dev)
  - tasyn (main/next/dev)
    * 12ab32f (dev) added feature X
    * bce43b1 (next) added feature Y
    * f43e379 (main) added feature Z
  - git-next (main/next/dev) DEV NOT AHEAD OF MAIN - rebase onto main
    * 239cefd (main/next) fix bug A
    * b4c290a (dev)

Adding a border around open forges:

+ gh
- jo --------------------------------------------------------------------+
| + test (main/next/dev)                                                 |
| - tasyn (main/next/dev)                                                |
|   * 12ab32f (dev) added feature X                                      |
|   * bce43b1 (next) added feature Y                                     |
|   * f43e379 (main) added feature Z                                     |
| - git-next (main/next/dev) DEV NOT AHEAD OF MAIN - rebase onto main    |
|   * 239cefd (main/next) fix bug A                                      |
|   * b4c290a (dev)                                                      |
+------------------------------------------------------------------------+

Adding a border around open forges and repos (I like this one the best):

+ gh
- jo --------------------------------------------------------------------+
| + test (main/next/dev)                                                 |
| - tasyn (main/next/dev) ---------------------------------------------+ |
| | * 12ab32f (dev) added feature X                                    | |
| | * bce43b1 (next) added feature Y                                   | |
| | * f43e379 (main) added feature Z                                   | |
| +--------------------------------------------------------------------+ |
| - git-next (main/next/dev) DEV NOT AHEAD OF MAIN - rebase onto main -+ |
| | * 239cefd (main/next) fix bug A                                    | |
| | * b4c290a (dev)                                                    | |
| +--------------------------------------------------------------------+ |
+------------------------------------------------------------------------+

Logging

  • tui-logger to create an optional panel to show the normal server logs

Branch Graph

  • tui-nodes ?

Scrolling

  • tui-scrollview

Tree View

  • tui-tree-widget