boot-tree: palette options, finished-run timeline, readable unit names, repaint on reconnect, handover frame
This commit is contained in:
1 parent
1482d4437a
commit
101d7bae89
16 files changed
+854
-292
No files matched your search
Generated
+229
-15
@@ -53,7 +53,7 @@ version = "1.1.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -64,7 +64,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"once_cell_polyfill",
|
"once_cell_polyfill",
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -129,6 +129,9 @@ name = "bitflags"
|
|||||||
version = "2.13.2"
|
version = "2.13.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-buffer"
|
name = "block-buffer"
|
||||||
@@ -144,12 +147,14 @@ name = "boot-tree"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"crossterm",
|
"crossterm 0.29.0",
|
||||||
"dbus",
|
"dbus",
|
||||||
"jiff",
|
"jiff",
|
||||||
"ratatui",
|
"ratatui",
|
||||||
"rustix",
|
"rustix 1.1.5",
|
||||||
|
"serde",
|
||||||
"signal-hook 0.4.5",
|
"signal-hook 0.4.5",
|
||||||
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -258,6 +263,7 @@ dependencies = [
|
|||||||
"itoa",
|
"itoa",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
"ryu",
|
"ryu",
|
||||||
|
"serde",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -285,6 +291,23 @@ version = "1.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
|
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossterm"
|
||||||
|
version = "0.28.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"crossterm_winapi",
|
||||||
|
"mio",
|
||||||
|
"parking_lot",
|
||||||
|
"rustix 0.38.44",
|
||||||
|
"serde",
|
||||||
|
"signal-hook 0.3.18",
|
||||||
|
"signal-hook-mio",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossterm"
|
name = "crossterm"
|
||||||
version = "0.29.0"
|
version = "0.29.0"
|
||||||
@@ -297,7 +320,8 @@ dependencies = [
|
|||||||
"document-features",
|
"document-features",
|
||||||
"mio",
|
"mio",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"rustix",
|
"rustix 1.1.5",
|
||||||
|
"serde",
|
||||||
"signal-hook 0.3.18",
|
"signal-hook 0.3.18",
|
||||||
"signal-hook-mio",
|
"signal-hook-mio",
|
||||||
"winapi",
|
"winapi",
|
||||||
@@ -374,7 +398,7 @@ checksum = "3ab69f03cc8c4340c9c8e315114e1658e6775a9b16a04357973aa21cec22b32e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"libdbus-sys",
|
"libdbus-sys",
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -480,7 +504,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -640,6 +664,16 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "2.14.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
||||||
|
dependencies = [
|
||||||
|
"equivalent",
|
||||||
|
"hashbrown 0.17.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indoc"
|
name = "indoc"
|
||||||
version = "2.0.8"
|
version = "2.0.8"
|
||||||
@@ -784,6 +818,12 @@ dependencies = [
|
|||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.4.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -827,7 +867,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "f3d0581a75c45969c63afd2bb87b1d8b25cfcc556c7a918cf9bb13b0fe8d2381"
|
checksum = "f3d0581a75c45969c63afd2bb87b1d8b25cfcc556c7a918cf9bb13b0fe8d2381"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nix 0.31.3",
|
"nix 0.31.3",
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -866,7 +906,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"wasi",
|
"wasi",
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -939,6 +979,12 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "numtoa"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6aa2c4e539b869820a2b82e1aef6ff40aa85e65decdd5185e83fb4b1249cd00f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.21.4"
|
version = "1.21.4"
|
||||||
@@ -1210,6 +1256,7 @@ dependencies = [
|
|||||||
"ratatui-crossterm",
|
"ratatui-crossterm",
|
||||||
"ratatui-macros",
|
"ratatui-macros",
|
||||||
"ratatui-termina",
|
"ratatui-termina",
|
||||||
|
"ratatui-termion",
|
||||||
"ratatui-termwiz",
|
"ratatui-termwiz",
|
||||||
"ratatui-widgets",
|
"ratatui-widgets",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -1244,7 +1291,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "567584a3b0e6a8203c23de40b4861497266725eb5363dbfd18a1edd603cca9f0"
|
checksum = "567584a3b0e6a8203c23de40b4861497266725eb5363dbfd18a1edd603cca9f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"crossterm",
|
"crossterm 0.28.1",
|
||||||
|
"crossterm 0.29.0",
|
||||||
"instability",
|
"instability",
|
||||||
"ratatui-core",
|
"ratatui-core",
|
||||||
]
|
]
|
||||||
@@ -1270,6 +1318,17 @@ dependencies = [
|
|||||||
"termina",
|
"termina",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ratatui-termion"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87c732202fa5a71a9da0991013f0853e53f87048f45198e3a1ca3ee722accc2f"
|
||||||
|
dependencies = [
|
||||||
|
"instability",
|
||||||
|
"ratatui-core",
|
||||||
|
"termion",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ratatui-termwiz"
|
name = "ratatui-termwiz"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
@@ -1347,6 +1406,19 @@ dependencies = [
|
|||||||
"semver",
|
"semver",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.38.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys 0.4.15",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "1.1.5"
|
version = "1.1.5"
|
||||||
@@ -1356,8 +1428,8 @@ dependencies = [
|
|||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys 0.12.1",
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1414,6 +1486,15 @@ dependencies = [
|
|||||||
"syn 3.0.7",
|
"syn 3.0.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_spanned"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha2"
|
||||||
version = "0.10.9"
|
version = "0.10.9"
|
||||||
@@ -1500,7 +1581,7 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"psm",
|
"psm",
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1577,9 +1658,9 @@ checksum = "9048a889effe34a5cddee0af7f53285198b16dca3be510858d38dfdb3e62a04e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"rustix",
|
"rustix 1.1.5",
|
||||||
"signal-hook 0.3.18",
|
"signal-hook 0.3.18",
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1594,6 +1675,17 @@ dependencies = [
|
|||||||
"phf_codegen",
|
"phf_codegen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "termion"
|
||||||
|
version = "4.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f44138a9ae08f0f502f24104d82517ef4da7330c35acd638f1f29d3cd5475ecb"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"numtoa",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termios"
|
name = "termios"
|
||||||
version = "0.3.3"
|
version = "0.3.3"
|
||||||
@@ -1628,6 +1720,7 @@ dependencies = [
|
|||||||
"pest",
|
"pest",
|
||||||
"pest_derive",
|
"pest_derive",
|
||||||
"phf",
|
"phf",
|
||||||
|
"serde",
|
||||||
"sha2",
|
"sha2",
|
||||||
"signal-hook 0.3.18",
|
"signal-hook 0.3.18",
|
||||||
"siphasher",
|
"siphasher",
|
||||||
@@ -1706,6 +1799,45 @@ version = "0.1.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"
|
checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "1.1.8+spec-1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
|
||||||
|
dependencies = [
|
||||||
|
"indexmap",
|
||||||
|
"serde_core",
|
||||||
|
"serde_spanned",
|
||||||
|
"toml_datetime",
|
||||||
|
"toml_parser",
|
||||||
|
"toml_writer",
|
||||||
|
"winnow",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_datetime"
|
||||||
|
version = "1.1.2+spec-1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_parser"
|
||||||
|
version = "1.1.5+spec-1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
|
||||||
|
dependencies = [
|
||||||
|
"winnow",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_writer"
|
||||||
|
version = "1.1.3+spec-1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.20.1"
|
version = "1.20.1"
|
||||||
@@ -1762,6 +1894,7 @@ dependencies = [
|
|||||||
"atomic",
|
"atomic",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
"serde_core",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1858,6 +1991,7 @@ checksum = "692daff6d93d94e29e4114544ef6d5c942a7ed998b37abdc19b17136ea428eb7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.3.4",
|
"getrandom 0.3.4",
|
||||||
"mac_address",
|
"mac_address",
|
||||||
|
"serde",
|
||||||
"sha2",
|
"sha2",
|
||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
"uuid",
|
"uuid",
|
||||||
@@ -1872,6 +2006,7 @@ dependencies = [
|
|||||||
"csscolorparser",
|
"csscolorparser",
|
||||||
"deltae",
|
"deltae",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
"serde",
|
||||||
"wezterm-dynamic",
|
"wezterm-dynamic",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1940,6 +2075,15 @@ version = "0.2.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.61.2"
|
version = "0.61.2"
|
||||||
@@ -1949,6 +2093,76 @@ dependencies = [
|
|||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_gnullvm",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winnow"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wit-bindgen"
|
name = "wit-bindgen"
|
||||||
version = "0.57.1"
|
version = "0.57.1"
|
||||||
|
|||||||
+3
-1
@@ -13,9 +13,11 @@ clap = { version = "4.5", features = ["derive"] }
|
|||||||
crossterm = "0.29"
|
crossterm = "0.29"
|
||||||
dbus = "0.9"
|
dbus = "0.9"
|
||||||
jiff = { version = "0.2", default-features = false, features = ["std"] }
|
jiff = { version = "0.2", default-features = false, features = ["std"] }
|
||||||
ratatui = "0.30"
|
ratatui = { version = "0.30", features = ["serde"] }
|
||||||
rustix = { version = "1", features = ["fs", "process", "stdio", "system", "termios", "time"] }
|
rustix = { version = "1", features = ["fs", "process", "stdio", "system", "termios", "time"] }
|
||||||
|
serde = { version = "1.0.229", features = ["derive"] }
|
||||||
signal-hook = "0.4"
|
signal-hook = "0.4"
|
||||||
|
toml = "1.1.8"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "thin"
|
lto = "thin"
|
||||||
|
|||||||
@@ -69,6 +69,43 @@ With `boot.initrd.systemd.enable` the unit is added to the initrd as well.
|
|||||||
To draw on another terminal, override `TTYPath=` with
|
To draw on another terminal, override `TTYPath=` with
|
||||||
`systemctl edit boot-tree.service`.
|
`systemctl edit boot-tree.service`.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Colours come from `/etc/boot-tree.toml` (another path with `--config`). Every
|
||||||
|
key is optional; these are the defaults:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[palette]
|
||||||
|
text = "white" # running units, headings
|
||||||
|
muted = "dark-gray" # rules, tree lines, axis
|
||||||
|
waiting = "gray" # queued units, finished-unit labels
|
||||||
|
running = "yellow"
|
||||||
|
done = "green"
|
||||||
|
failed = "light-red"
|
||||||
|
target = "cyan"
|
||||||
|
```
|
||||||
|
|
||||||
|
Values are the 16 console colour names (`red`, `light-red`, `dark-gray`, …).
|
||||||
|
The Linux console cannot show other colours, so to change what the names look
|
||||||
|
like, set the console palette itself. That recolours every virtual terminal from
|
||||||
|
the start of boot:
|
||||||
|
|
||||||
|
- NixOS: `console.colors = [ "1d2021" "fb4934" … ];` (16 hex values);
|
||||||
|
- elsewhere: the kernel parameters `vt.default_red=`, `vt.default_grn=` and
|
||||||
|
`vt.default_blu=`.
|
||||||
|
|
||||||
|
On NixOS set the roles as options; unset ones keep their defaults:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
services.boot-tree.palette = {
|
||||||
|
running = "light-yellow";
|
||||||
|
done = "light-green";
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
On dracut and mkinitcpio systems the hooks copy `/etc/boot-tree.toml` into the
|
||||||
|
initramfs, so rebuild it after editing.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Commands assume the dev shell is active (`direnv allow` once; `.envrc` runs
|
Commands assume the dev shell is active (`direnv allow` once; `.envrc` runs
|
||||||
@@ -78,7 +115,7 @@ Commands assume the dev shell is active (`direnv allow` once; `.envrc` runs
|
|||||||
| --- | --- |
|
| --- | --- |
|
||||||
| Unit and render snapshot tests | `cargo test` |
|
| Unit and render snapshot tests | `cargo test` |
|
||||||
| Scripted boot animation, no systemd needed | `cargo run --example demo` (`q` quits) |
|
| Scripted boot animation, no systemd needed | `cargo run --example demo` (`q` quits) |
|
||||||
| Live against your user manager | `nix run .#demo-units -- start`, then `nix run . -- --user --target boot-tree-demo.target --hold-ms 3000` |
|
| Live against your user manager | `nix run .#demo-units -- start`, then `nix run . -- --user --target boot-tree-demo.target --hold 3s` |
|
||||||
| Boot a demo VM in a window | `env -u LD_LIBRARY_PATH nix run .#vm` |
|
| Boot a demo VM in a window | `env -u LD_LIBRARY_PATH nix run .#vm` |
|
||||||
| Automated boot test with OCR | `nix build .#checks.x86_64-linux.boot` (screenshots in `result/`) |
|
| Automated boot test with OCR | `nix build .#checks.x86_64-linux.boot` (screenshots in `result/`) |
|
||||||
| Same test, interactively | `nix run .#checks.x86_64-linux.boot.driverInteractive`, then `test_script()` |
|
| Same test, interactively | `nix run .#checks.x86_64-linux.boot.driverInteractive`, then `test_script()` |
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ def "main start" [--units: path, --target: string] {
|
|||||||
install-units $units
|
install-units $units
|
||||||
^systemctl --user stop ...(unit-names $units)
|
^systemctl --user stop ...(unit-names $units)
|
||||||
^systemctl --user start --no-block $target
|
^systemctl --user start --no-block $target
|
||||||
print $"started ($target); watch it with: boot-tree --user --target ($target) --hold-ms 3000"
|
print $"started ($target); watch it with: boot-tree --user --target ($target) --hold 3s"
|
||||||
}
|
}
|
||||||
|
|
||||||
def "main remove" [--units: path, --target: string] {
|
def "main remove" [--units: path, --target: string] {
|
||||||
|
|||||||
+22
-1
@@ -35,9 +35,30 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.boot-tree.enable = true;
|
services.boot-tree = {
|
||||||
|
enable = true;
|
||||||
|
palette.running = "light-yellow";
|
||||||
|
};
|
||||||
|
|
||||||
console = {
|
console = {
|
||||||
|
colors = [
|
||||||
|
"1d2021"
|
||||||
|
"fb4934"
|
||||||
|
"b8bb26"
|
||||||
|
"fabd2f"
|
||||||
|
"83a598"
|
||||||
|
"d3869b"
|
||||||
|
"8ec07c"
|
||||||
|
"d5c4a1"
|
||||||
|
"665c54"
|
||||||
|
"fb4934"
|
||||||
|
"b8bb26"
|
||||||
|
"fabd2f"
|
||||||
|
"83a598"
|
||||||
|
"d3869b"
|
||||||
|
"8ec07c"
|
||||||
|
"fbf1c7"
|
||||||
|
];
|
||||||
earlySetup = true;
|
earlySetup = true;
|
||||||
font = "${pkgs.terminus_font}/share/consolefonts/ter-v20n.psf.gz";
|
font = "${pkgs.terminus_font}/share/consolefonts/ter-v20n.psf.gz";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use std::{
|
|||||||
|
|
||||||
use boot_tree::{
|
use boot_tree::{
|
||||||
model::{ActiveState, Activity, BootState, JobResult, Phase, UnitFacts},
|
model::{ActiveState, Activity, BootState, JobResult, Phase, UnitFacts},
|
||||||
|
palette::Palette,
|
||||||
view::BootView,
|
view::BootView,
|
||||||
};
|
};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
@@ -306,6 +307,7 @@ fn play(terminal: &mut DefaultTerminal) -> io::Result<()> {
|
|||||||
canvas.render_widget(
|
canvas.render_widget(
|
||||||
BootView {
|
BootView {
|
||||||
state: &state,
|
state: &state,
|
||||||
|
palette: &Palette::default(),
|
||||||
now: now(),
|
now: now(),
|
||||||
host: "demo",
|
host: "demo",
|
||||||
frame,
|
frame,
|
||||||
|
|||||||
+29
-1
@@ -7,6 +7,20 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.services.boot-tree;
|
cfg = config.services.boot-tree;
|
||||||
|
chosenColors = lib.filterAttrs (_: color: color != null) cfg.palette;
|
||||||
|
configFile = (pkgs.formats.toml { }).generate "boot-tree.toml" { palette = chosenColors; };
|
||||||
|
colorOption =
|
||||||
|
role: default:
|
||||||
|
lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
example = "light-yellow";
|
||||||
|
description = ''
|
||||||
|
Colour for ${role}; unset keeps `${default}`. One of the 16 console
|
||||||
|
colour names (`red`, `light-red`, `dark-gray`, …). What each name
|
||||||
|
looks like comes from the console palette, {option}`console.colors`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.boot-tree = {
|
options.services.boot-tree = {
|
||||||
@@ -23,10 +37,23 @@ in
|
|||||||
defaultText = lib.literalExpression "boot-tree.packages.\${system}.default";
|
defaultText = lib.literalExpression "boot-tree.packages.\${system}.default";
|
||||||
description = "The boot-tree package, which ships the systemd unit.";
|
description = "The boot-tree package, which ships the systemd unit.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
palette = {
|
||||||
|
text = colorOption "running units and headings" "white";
|
||||||
|
muted = colorOption "rules, tree lines and the time axis" "dark-gray";
|
||||||
|
waiting = colorOption "queued units and finished-unit labels" "gray";
|
||||||
|
running = colorOption "running units and their bars" "yellow";
|
||||||
|
done = colorOption "finished units, stages and milestones" "green";
|
||||||
|
failed = colorOption "failed units" "light-red";
|
||||||
|
target = colorOption "targets in the tree" "cyan";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment = {
|
||||||
|
systemPackages = [ cfg.package ];
|
||||||
|
etc."boot-tree.toml" = lib.mkIf (chosenColors != { }) { source = configFile; };
|
||||||
|
};
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
packages = [ cfg.package ];
|
packages = [ cfg.package ];
|
||||||
@@ -37,6 +64,7 @@ in
|
|||||||
packages = [ cfg.package ];
|
packages = [ cfg.package ];
|
||||||
storePaths = [ (lib.getExe cfg.package) ];
|
storePaths = [ (lib.getExe cfg.package) ];
|
||||||
services.boot-tree.wantedBy = [ "sysinit.target" ];
|
services.boot-tree.wantedBy = [ "sysinit.target" ];
|
||||||
|
contents."/etc/boot-tree.toml" = lib.mkIf (chosenColors != { }) { source = configFile; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -12,5 +12,8 @@ depends() {
|
|||||||
install() {
|
install() {
|
||||||
inst_binary boot-tree
|
inst_binary boot-tree
|
||||||
inst_simple "$systemdsystemunitdir/boot-tree.service"
|
inst_simple "$systemdsystemunitdir/boot-tree.service"
|
||||||
|
if [[ -f /etc/boot-tree.toml ]]; then
|
||||||
|
inst_simple /etc/boot-tree.toml
|
||||||
|
fi
|
||||||
$SYSTEMCTL -q --root "$initdir" enable boot-tree.service
|
$SYSTEMCTL -q --root "$initdir" enable boot-tree.service
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,9 @@
|
|||||||
build() {
|
build() {
|
||||||
add_binary boot-tree
|
add_binary boot-tree
|
||||||
add_systemd_unit boot-tree.service
|
add_systemd_unit boot-tree.service
|
||||||
|
if [[ -f /etc/boot-tree.toml ]]; then
|
||||||
|
add_file /etc/boot-tree.toml
|
||||||
|
fi
|
||||||
add_symlink /usr/lib/systemd/system/sysinit.target.wants/boot-tree.service \
|
add_symlink /usr/lib/systemd/system/sysinit.target.wants/boot-tree.service \
|
||||||
/usr/lib/systemd/system/boot-tree.service
|
/usr/lib/systemd/system/boot-tree.service
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -22,9 +22,10 @@ const SILENT_STATUS: &str = "no";
|
|||||||
const CONFIGURED_STATUS: &str = "";
|
const CONFIGURED_STATUS: &str = "";
|
||||||
|
|
||||||
pub struct Feed {
|
pub struct Feed {
|
||||||
|
pub connections: u32,
|
||||||
scope: Scope,
|
scope: Scope,
|
||||||
target: Option<String>,
|
target: Option<String>,
|
||||||
session: Option<Session>,
|
pub session: Option<Session>,
|
||||||
unit_paths: HashMap<Path<'static>, String>,
|
unit_paths: HashMap<Path<'static>, String>,
|
||||||
in_initrd: bool,
|
in_initrd: bool,
|
||||||
sysroot: Option<Sysroot>,
|
sysroot: Option<Sysroot>,
|
||||||
@@ -35,6 +36,7 @@ pub struct Feed {
|
|||||||
impl Feed {
|
impl Feed {
|
||||||
pub fn new(scope: Scope, target: Option<String>) -> Self {
|
pub fn new(scope: Scope, target: Option<String>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
connections: 0,
|
||||||
in_initrd: scope == Scope::System && FilePath::new(INITRD_RELEASE).exists(),
|
in_initrd: scope == Scope::System && FilePath::new(INITRD_RELEASE).exists(),
|
||||||
scope,
|
scope,
|
||||||
target,
|
target,
|
||||||
@@ -66,6 +68,7 @@ impl Feed {
|
|||||||
match self.connect(state) {
|
match self.connect(state) {
|
||||||
Ok(session) => {
|
Ok(session) => {
|
||||||
self.session = Some(session);
|
self.session = Some(session);
|
||||||
|
self.connections += 1;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Err(_) if Instant::now() < self.reconnect_deadline => {
|
Err(_) if Instant::now() < self.reconnect_deadline => {
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
pub mod model;
|
pub mod model;
|
||||||
|
pub mod palette;
|
||||||
pub mod view;
|
pub mod view;
|
||||||
+32
-6
@@ -6,9 +6,11 @@ mod run;
|
|||||||
mod sysroot;
|
mod sysroot;
|
||||||
mod systemd;
|
mod systemd;
|
||||||
|
|
||||||
use std::{process::ExitCode, time::Duration};
|
use std::{fs, io::ErrorKind, path::PathBuf, process::ExitCode, time::Duration};
|
||||||
|
|
||||||
|
use boot_tree::palette::Config;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
use jiff::SignedDuration;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
run::{Options, run},
|
run::{Options, run},
|
||||||
@@ -27,20 +29,44 @@ struct Cli {
|
|||||||
target: Option<String>,
|
target: Option<String>,
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
default_value_t = 0,
|
default_value = "1s",
|
||||||
help = "Milliseconds to keep the final frame on screen"
|
value_parser = parse_duration,
|
||||||
|
help = "How long the final frame stays on screen, e.g. 1s or 500ms"
|
||||||
)]
|
)]
|
||||||
hold_ms: u64,
|
hold: Duration,
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
default_value = "/etc/boot-tree.toml",
|
||||||
|
help = "TOML file with a [palette] table"
|
||||||
|
)]
|
||||||
|
config: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_duration(raw: &str) -> Result<Duration, String> {
|
||||||
|
let signed: SignedDuration = raw.parse().map_err(|error| format!("{error}"))?;
|
||||||
|
Duration::try_from(signed).map_err(|error| format!("{error}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
let config = match fs::read_to_string(&cli.config) {
|
||||||
|
Ok(text) => toml::from_str(&text).unwrap_or_else(|error| {
|
||||||
|
eprintln!("boot-tree: ignoring {}: {error}", cli.config.display());
|
||||||
|
Config::default()
|
||||||
|
}),
|
||||||
|
Err(error) if error.kind() == ErrorKind::NotFound => Config::default(),
|
||||||
|
Err(error) => {
|
||||||
|
eprintln!("boot-tree: cannot read {}: {error}", cli.config.display());
|
||||||
|
Config::default()
|
||||||
|
}
|
||||||
|
};
|
||||||
let options = Options {
|
let options = Options {
|
||||||
scope: if cli.user { Scope::User } else { Scope::System },
|
scope: if cli.user { Scope::User } else { Scope::System },
|
||||||
target: cli.target,
|
target: cli.target,
|
||||||
hold: Duration::from_millis(cli.hold_ms),
|
hold: cli.hold,
|
||||||
|
palette: config.palette,
|
||||||
};
|
};
|
||||||
match run(options) {
|
match run(&options) {
|
||||||
Ok(()) => ExitCode::SUCCESS,
|
Ok(()) => ExitCode::SUCCESS,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
eprintln!("boot-tree: {error}");
|
eprintln!("boot-tree: {error}");
|
||||||
|
|||||||
+43
-4
@@ -87,6 +87,7 @@ pub struct Activity {
|
|||||||
struct PendingJob {
|
struct PendingJob {
|
||||||
id: u32,
|
id: u32,
|
||||||
queued_at: Duration,
|
queued_at: Duration,
|
||||||
|
brings_up: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
@@ -162,6 +163,14 @@ pub struct Tally {
|
|||||||
pub failed: usize,
|
pub failed: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
|
pub struct FinishedRun {
|
||||||
|
pub label: String,
|
||||||
|
pub started_at: Duration,
|
||||||
|
pub finished_at: Duration,
|
||||||
|
pub failed: bool,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct FinishedStage {
|
pub struct FinishedStage {
|
||||||
pub label: &'static str,
|
pub label: &'static str,
|
||||||
@@ -177,8 +186,9 @@ pub struct BootState {
|
|||||||
pub root: Option<String>,
|
pub root: Option<String>,
|
||||||
pub failed: Vec<String>,
|
pub failed: Vec<String>,
|
||||||
pub finished_stages: Vec<FinishedStage>,
|
pub finished_stages: Vec<FinishedStage>,
|
||||||
|
pub finished_runs: Vec<FinishedRun>,
|
||||||
|
pub handoff_unit: Option<String>,
|
||||||
root_job_seen: bool,
|
root_job_seen: bool,
|
||||||
handoff_unit: Option<String>,
|
|
||||||
milestone_targets: Vec<String>,
|
milestone_targets: Vec<String>,
|
||||||
finished_before_reconnect: usize,
|
finished_before_reconnect: usize,
|
||||||
units: HashMap<String, UnitRecord>,
|
units: HashMap<String, UnitRecord>,
|
||||||
@@ -210,6 +220,7 @@ impl BootState {
|
|||||||
root: None,
|
root: None,
|
||||||
failed: Vec::new(),
|
failed: Vec::new(),
|
||||||
finished_stages: Vec::new(),
|
finished_stages: Vec::new(),
|
||||||
|
finished_runs: Vec::new(),
|
||||||
root_job_seen: false,
|
root_job_seen: false,
|
||||||
handoff_unit,
|
handoff_unit,
|
||||||
milestone_targets,
|
milestone_targets,
|
||||||
@@ -258,7 +269,7 @@ impl BootState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn queue_job(&mut self, id: u32, unit: &str, at: Duration) {
|
pub fn queue_job(&mut self, id: u32, unit: &str, at: Duration) {
|
||||||
self.queue_job_of_unknown_kind(id, unit, at);
|
self.enqueue(id, unit, at, true);
|
||||||
if self.jobs.get(&id).is_some_and(|tracked| tracked == unit)
|
if self.jobs.get(&id).is_some_and(|tracked| tracked == unit)
|
||||||
&& self.root.as_deref() == Some(unit)
|
&& self.root.as_deref() == Some(unit)
|
||||||
{
|
{
|
||||||
@@ -267,13 +278,21 @@ impl BootState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn queue_job_of_unknown_kind(&mut self, id: u32, unit: &str, at: Duration) {
|
pub fn queue_job_of_unknown_kind(&mut self, id: u32, unit: &str, at: Duration) {
|
||||||
|
self.enqueue(id, unit, at, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn enqueue(&mut self, id: u32, unit: &str, at: Duration, brings_up: bool) {
|
||||||
if self.jobs.contains_key(&id) {
|
if self.jobs.contains_key(&id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let Some(record) = self.units.get_mut(unit) else {
|
let Some(record) = self.units.get_mut(unit) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
record.job = Some(PendingJob { id, queued_at: at });
|
record.job = Some(PendingJob {
|
||||||
|
id,
|
||||||
|
queued_at: at,
|
||||||
|
brings_up,
|
||||||
|
});
|
||||||
record.outcome = None;
|
record.outcome = None;
|
||||||
self.jobs.insert(id, unit.to_owned());
|
self.jobs.insert(id, unit.to_owned());
|
||||||
}
|
}
|
||||||
@@ -285,9 +304,26 @@ impl BootState {
|
|||||||
let Some(record) = self.units.get_mut(&unit) else {
|
let Some(record) = self.units.get_mut(&unit) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
let started_at = record
|
||||||
|
.inactive_exit
|
||||||
|
.filter(|started| *started >= self.origin && *started <= at)
|
||||||
|
.filter(|_| record.job.is_some_and(|job| job.id == id && job.brings_up));
|
||||||
if record.job.is_some_and(|job| job.id == id) {
|
if record.job.is_some_and(|job| job.id == id) {
|
||||||
record.job = None;
|
record.job = None;
|
||||||
}
|
}
|
||||||
|
if let Some(started_at) = started_at
|
||||||
|
&& !record.facts.name.ends_with(".target")
|
||||||
|
{
|
||||||
|
self.finished_runs.push(FinishedRun {
|
||||||
|
label: display_label(&record.facts),
|
||||||
|
started_at,
|
||||||
|
finished_at: at,
|
||||||
|
failed: matches!(
|
||||||
|
result,
|
||||||
|
JobResult::Failed | JobResult::Timeout | JobResult::Dependency
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
let outcome = match result {
|
let outcome = match result {
|
||||||
JobResult::Done => Outcome::Succeeded { at },
|
JobResult::Done => Outcome::Succeeded { at },
|
||||||
JobResult::Skipped | JobResult::Canceled => Outcome::Abandoned,
|
JobResult::Skipped | JobResult::Canceled => Outcome::Abandoned,
|
||||||
@@ -611,7 +647,10 @@ fn display_label(facts: &UnitFacts) -> String {
|
|||||||
if let Some(stem) = facts.name.strip_suffix(".service") {
|
if let Some(stem) = facts.name.strip_suffix(".service") {
|
||||||
return stem.to_owned();
|
return stem.to_owned();
|
||||||
}
|
}
|
||||||
if facts.name.ends_with(".device") && !facts.description.is_empty() {
|
let described_by_path = [".device", ".mount", ".swap", ".automount"]
|
||||||
|
.iter()
|
||||||
|
.any(|suffix| facts.name.ends_with(suffix));
|
||||||
|
if described_by_path && !facts.description.is_empty() {
|
||||||
return facts.description.clone();
|
return facts.description.clone();
|
||||||
}
|
}
|
||||||
facts.name.clone()
|
facts.name.clone()
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
use ratatui::style::Color;
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq)]
|
||||||
|
#[serde(default, deny_unknown_fields)]
|
||||||
|
pub struct Palette {
|
||||||
|
pub text: Color,
|
||||||
|
pub muted: Color,
|
||||||
|
pub waiting: Color,
|
||||||
|
pub running: Color,
|
||||||
|
pub done: Color,
|
||||||
|
pub failed: Color,
|
||||||
|
pub target: Color,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Palette {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
text: Color::White,
|
||||||
|
muted: Color::DarkGray,
|
||||||
|
waiting: Color::Gray,
|
||||||
|
running: Color::Yellow,
|
||||||
|
done: Color::Green,
|
||||||
|
failed: Color::LightRed,
|
||||||
|
target: Color::Cyan,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Eq)]
|
||||||
|
#[serde(default, deny_unknown_fields)]
|
||||||
|
pub struct Config {
|
||||||
|
pub palette: Palette,
|
||||||
|
}
|
||||||
+17
-5
@@ -5,11 +5,12 @@ use std::{
|
|||||||
atomic::{AtomicBool, Ordering},
|
atomic::{AtomicBool, Ordering},
|
||||||
},
|
},
|
||||||
thread::sleep,
|
thread::sleep,
|
||||||
time::Duration,
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
|
|
||||||
use boot_tree::{
|
use boot_tree::{
|
||||||
model::{BootState, Phase},
|
model::{BootState, Phase},
|
||||||
|
palette::Palette,
|
||||||
view::BootView,
|
view::BootView,
|
||||||
};
|
};
|
||||||
use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyModifiers};
|
use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyModifiers};
|
||||||
@@ -30,15 +31,16 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
const FRAME_INTERVAL: Duration = Duration::from_millis(100);
|
const FRAME_INTERVAL: Duration = Duration::from_millis(100);
|
||||||
const FRAMES_PER_FULL_REPAINT: u64 = 20;
|
const FULL_REPAINT_INTERVAL: Duration = Duration::from_secs(1);
|
||||||
|
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
pub scope: Scope,
|
pub scope: Scope,
|
||||||
pub target: Option<String>,
|
pub target: Option<String>,
|
||||||
pub hold: Duration,
|
pub hold: Duration,
|
||||||
|
pub palette: Palette,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(options: Options) -> Result<(), Error> {
|
pub fn run(options: &Options) -> Result<(), Error> {
|
||||||
let terminate = Arc::new(AtomicBool::new(false));
|
let terminate = Arc::new(AtomicBool::new(false));
|
||||||
flag::register(SIGTERM, Arc::clone(&terminate))?;
|
flag::register(SIGTERM, Arc::clone(&terminate))?;
|
||||||
let phase = match options.scope {
|
let phase = match options.scope {
|
||||||
@@ -47,7 +49,7 @@ pub fn run(options: Options) -> Result<(), Error> {
|
|||||||
Scope::System => Phase::Host,
|
Scope::System => Phase::Host,
|
||||||
};
|
};
|
||||||
let mut state = BootState::new(phase);
|
let mut state = BootState::new(phase);
|
||||||
let mut feed = Feed::new(options.scope, options.target);
|
let mut feed = Feed::new(options.scope, options.target.clone());
|
||||||
let _quiet_kernel = (options.scope == Scope::System)
|
let _quiet_kernel = (options.scope == Scope::System)
|
||||||
.then(QuietKernelConsole::take)
|
.then(QuietKernelConsole::take)
|
||||||
.flatten();
|
.flatten();
|
||||||
@@ -58,6 +60,7 @@ pub fn run(options: Options) -> Result<(), Error> {
|
|||||||
&mut feed,
|
&mut feed,
|
||||||
&mut terminal,
|
&mut terminal,
|
||||||
&terminate,
|
&terminate,
|
||||||
|
&options.palette,
|
||||||
options.hold,
|
options.hold,
|
||||||
);
|
);
|
||||||
ratatui::restore();
|
ratatui::restore();
|
||||||
@@ -80,20 +83,29 @@ fn watch(
|
|||||||
feed: &mut Feed,
|
feed: &mut Feed,
|
||||||
terminal: &mut DefaultTerminal,
|
terminal: &mut DefaultTerminal,
|
||||||
terminate: &AtomicBool,
|
terminate: &AtomicBool,
|
||||||
|
palette: &Palette,
|
||||||
hold: Duration,
|
hold: Duration,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let host = uname().nodename().to_string_lossy().into_owned();
|
let host = uname().nodename().to_string_lossy().into_owned();
|
||||||
let mut frame: u64 = 0;
|
let mut frame: u64 = 0;
|
||||||
|
let mut painted_connections = feed.connections;
|
||||||
|
let mut last_full_repaint = Instant::now();
|
||||||
loop {
|
loop {
|
||||||
feed.pump(state, FRAME_INTERVAL)?;
|
feed.pump(state, FRAME_INTERVAL)?;
|
||||||
if frame.is_multiple_of(FRAMES_PER_FULL_REPAINT) {
|
if feed.session.is_none()
|
||||||
|
|| feed.connections != painted_connections
|
||||||
|
|| last_full_repaint.elapsed() >= FULL_REPAINT_INTERVAL
|
||||||
|
{
|
||||||
terminal.backend_mut().clear_region(ClearType::All)?;
|
terminal.backend_mut().clear_region(ClearType::All)?;
|
||||||
terminal.swap_buffers();
|
terminal.swap_buffers();
|
||||||
|
painted_connections = feed.connections;
|
||||||
|
last_full_repaint = Instant::now();
|
||||||
}
|
}
|
||||||
terminal.draw(|canvas| {
|
terminal.draw(|canvas| {
|
||||||
canvas.render_widget(
|
canvas.render_widget(
|
||||||
BootView {
|
BootView {
|
||||||
state,
|
state,
|
||||||
|
palette,
|
||||||
now: monotonic_now(),
|
now: monotonic_now(),
|
||||||
host: &host,
|
host: &host,
|
||||||
frame,
|
frame,
|
||||||
|
|||||||
+393
-256
@@ -1,4 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
|
cmp::Reverse,
|
||||||
iter::{once, repeat_n},
|
iter::{once, repeat_n},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
@@ -12,7 +13,10 @@ use ratatui::{
|
|||||||
widgets::{Block, Borders, Paragraph, Row, Table, Widget},
|
widgets::{Block, Borders, Paragraph, Row, Table, Widget},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::model::{BootState, MilestoneRow, PendingRow, RowStatus, Tally};
|
use crate::{
|
||||||
|
model::{BootState, FinishedRun, MilestoneRow, PendingRow, RowStatus, Tally},
|
||||||
|
palette::Palette,
|
||||||
|
};
|
||||||
|
|
||||||
const SPINNER: [char; 4] = ['|', '/', '-', '\\'];
|
const SPINNER: [char; 4] = ['|', '/', '-', '\\'];
|
||||||
const DONE: char = '√';
|
const DONE: char = '√';
|
||||||
@@ -24,6 +28,7 @@ const RUNNING_MARK: char = '►';
|
|||||||
const ROOT_SWITCH_MARK: char = '│';
|
const ROOT_SWITCH_MARK: char = '│';
|
||||||
const RULE: char = '─';
|
const RULE: char = '─';
|
||||||
const RULE_STUB: &str = "──";
|
const RULE_STUB: &str = "──";
|
||||||
|
const KERNEL_ORIGIN_LABEL: &str = "kernel";
|
||||||
|
|
||||||
const DURATION_WIDTH: u16 = 8;
|
const DURATION_WIDTH: u16 = 8;
|
||||||
const TIMELINE_LABEL_WIDTH: u16 = 28;
|
const TIMELINE_LABEL_WIDTH: u16 = 28;
|
||||||
@@ -60,31 +65,50 @@ const AXIS_LABEL: SpanPrinter = SpanPrinter::new()
|
|||||||
|
|
||||||
pub struct BootView<'a> {
|
pub struct BootView<'a> {
|
||||||
pub state: &'a BootState,
|
pub state: &'a BootState,
|
||||||
|
pub palette: &'a Palette,
|
||||||
pub now: Duration,
|
pub now: Duration,
|
||||||
pub host: &'a str,
|
pub host: &'a str,
|
||||||
pub frame: u64,
|
pub frame: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct TimelineContent<'a> {
|
||||||
|
milestones: Vec<MilestoneRow>,
|
||||||
|
finished: Vec<&'a FinishedRun>,
|
||||||
|
running: Vec<&'a PendingRow>,
|
||||||
|
}
|
||||||
|
|
||||||
impl Widget for BootView<'_> {
|
impl Widget for BootView<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
let rows = self.state.pending_rows();
|
let rows = self.state.pending_rows();
|
||||||
|
let mut running: Vec<&PendingRow> = rows
|
||||||
|
.iter()
|
||||||
|
.filter(|row| !row.is_target && row.status == RowStatus::Running)
|
||||||
|
.collect();
|
||||||
|
running.sort_by_key(|row| row.running_since);
|
||||||
let milestones: Vec<MilestoneRow> = self
|
let milestones: Vec<MilestoneRow> = self
|
||||||
.state
|
.state
|
||||||
.milestones()
|
.milestones()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|row| row.reached_at.is_some())
|
.filter(|row| row.reached_at.is_some())
|
||||||
.collect();
|
.collect();
|
||||||
let mut units: Vec<&PendingRow> = rows.iter().filter(|row| !row.is_target).collect();
|
let failures = self.failure_lines();
|
||||||
units.sort_by_key(|row| row.running_since.unwrap_or(Duration::MAX));
|
|
||||||
let failures = failure_lines(&self.state.failed);
|
|
||||||
let stages = self.stage_lines(area.width);
|
let stages = self.stage_lines(area.width);
|
||||||
let stages_height = u16::try_from(stages.len()).unwrap_or(u16::MAX);
|
let stages_height = u16::try_from(stages.len()).unwrap_or(u16::MAX);
|
||||||
let failures_height = u16::try_from(failures.len()).unwrap_or(u16::MAX);
|
let failures_height = u16::try_from(failures.len()).unwrap_or(u16::MAX);
|
||||||
|
let fits_timeline = area.width >= TIMELINE_LABEL_WIDTH + 1 + MIN_BAR_WIDTH
|
||||||
|
&& area.height >= MIN_HEIGHT_FOR_TIMELINE;
|
||||||
|
let timeline_entries = milestones.len() + self.state.finished_runs.len() + running.len();
|
||||||
|
let timeline_need = if fits_timeline && timeline_entries > 0 {
|
||||||
|
TIMELINE_CHROME_HEIGHT
|
||||||
|
.saturating_add(u16::try_from(timeline_entries).unwrap_or(u16::MAX))
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
};
|
||||||
let heights = Heights::share(
|
let heights = Heights::share(
|
||||||
area.height
|
area.height
|
||||||
.saturating_sub(HEADER_HEIGHT + stages_height + failures_height + FOOTER_HEIGHT),
|
.saturating_sub(HEADER_HEIGHT + stages_height + failures_height + FOOTER_HEIGHT),
|
||||||
u16::try_from(rows.len()).unwrap_or(u16::MAX),
|
u16::try_from(rows.len()).unwrap_or(u16::MAX),
|
||||||
timeline_need(area, milestones.len() + units.len()),
|
timeline_need,
|
||||||
);
|
);
|
||||||
|
|
||||||
let [header, _, stage_area, tree, failed, _, timeline, footer] = Layout::vertical([
|
let [header, _, stage_area, tree, failed, _, timeline, footer] = Layout::vertical([
|
||||||
@@ -104,15 +128,24 @@ impl Widget for BootView<'_> {
|
|||||||
self.tree(&rows, tree.height).render(tree, buf);
|
self.tree(&rows, tree.height).render(tree, buf);
|
||||||
Paragraph::new(failures).render(failed, buf);
|
Paragraph::new(failures).render(failed, buf);
|
||||||
if heights.timeline > 0 {
|
if heights.timeline > 0 {
|
||||||
self.timeline(&milestones, &units, timeline.width)
|
let bar_rows = usize::from(heights.timeline.saturating_sub(TIMELINE_CHROME_HEIGHT));
|
||||||
.render(timeline, buf);
|
let finished_room = bar_rows.saturating_sub(milestones.len() + running.len());
|
||||||
|
let mut finished: Vec<&FinishedRun> = self.state.finished_runs.iter().collect();
|
||||||
|
finished.sort_by_key(|run| Reverse(run.finished_at.saturating_sub(run.started_at)));
|
||||||
|
finished.truncate(finished_room);
|
||||||
|
finished.sort_by_key(|run| run.started_at);
|
||||||
|
self.timeline(
|
||||||
|
&TimelineContent {
|
||||||
|
milestones,
|
||||||
|
finished,
|
||||||
|
running,
|
||||||
|
},
|
||||||
|
timeline.width,
|
||||||
|
)
|
||||||
|
.render(timeline, buf);
|
||||||
}
|
}
|
||||||
footer_paragraph(
|
self.footer(self.state.tally(), footer.width)
|
||||||
self.state.tally(),
|
.render(footer, buf);
|
||||||
footer.width,
|
|
||||||
!self.state.finished_stages.is_empty(),
|
|
||||||
)
|
|
||||||
.render(footer, buf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,45 +170,63 @@ impl Heights {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rule_line(width: u16, left: Vec<Span<'static>>, right: Vec<Span<'static>>) -> Line<'static> {
|
|
||||||
let used = Line::from(left.clone()).width() + Line::from(right.clone()).width();
|
|
||||||
let fill: String = repeat_n(RULE, usize::from(width).saturating_sub(used)).collect();
|
|
||||||
Line::from(
|
|
||||||
left.into_iter()
|
|
||||||
.chain(once(Span::from(fill).dark_gray()))
|
|
||||||
.chain(right)
|
|
||||||
.collect::<Vec<_>>(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BootView<'_> {
|
impl BootView<'_> {
|
||||||
|
fn rule_line(
|
||||||
|
&self,
|
||||||
|
width: u16,
|
||||||
|
left: Vec<Span<'static>>,
|
||||||
|
right: Vec<Span<'static>>,
|
||||||
|
) -> Line<'static> {
|
||||||
|
let used = Line::from(left.clone()).width() + Line::from(right.clone()).width();
|
||||||
|
let fill: String = repeat_n(RULE, usize::from(width).saturating_sub(used)).collect();
|
||||||
|
Line::from(
|
||||||
|
left.into_iter()
|
||||||
|
.chain(once(Span::styled(
|
||||||
|
fill,
|
||||||
|
Style::new().fg(self.palette.muted),
|
||||||
|
)))
|
||||||
|
.chain(right)
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn header(&self) -> Table<'static> {
|
fn header(&self) -> Table<'static> {
|
||||||
let elapsed =
|
let total = (!self.state.finished_stages.is_empty()).then(|| {
|
||||||
ELAPSED.unsigned_duration_to_string(&self.now.saturating_sub(self.state.origin));
|
ELAPSED.unsigned_duration_to_string(&self.now.saturating_sub(self.state.origin))
|
||||||
|
});
|
||||||
Table::new(
|
Table::new(
|
||||||
[Row::new([
|
[Row::new([
|
||||||
Line::from(format!("boot-tree {}", self.host)),
|
Line::from(format!("boot-tree {}", self.host)),
|
||||||
Line::from(elapsed).right_aligned(),
|
Line::from(total.unwrap_or_default()).right_aligned(),
|
||||||
])],
|
])],
|
||||||
[Constraint::Fill(1), Constraint::Length(DURATION_WIDTH)],
|
[Constraint::Fill(1), Constraint::Length(DURATION_WIDTH)],
|
||||||
)
|
)
|
||||||
|
.style(Style::new().fg(self.palette.text))
|
||||||
.bold()
|
.bold()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stage_lines(&self, width: u16) -> Vec<Line<'static>> {
|
fn stage_lines(&self, width: u16) -> Vec<Line<'static>> {
|
||||||
let finished = self.state.finished_stages.iter().map(|stage| {
|
let finished = self.state.finished_stages.iter().map(|stage| {
|
||||||
rule_line(
|
self.rule_line(
|
||||||
width,
|
width,
|
||||||
vec![
|
vec![
|
||||||
Span::from(format!("{RULE_STUB} {} {RULE_STUB} ", stage.label)).dark_gray(),
|
Span::styled(
|
||||||
Span::from(format!(
|
format!("{RULE_STUB} {} {RULE_STUB} ", stage.label),
|
||||||
"{BEAD} done in {}",
|
Style::new().fg(self.palette.muted),
|
||||||
ELAPSED.unsigned_duration_to_string(
|
),
|
||||||
&stage.reached_at.saturating_sub(stage.started_at)
|
Span::styled(
|
||||||
)
|
format!(
|
||||||
))
|
"{BEAD} done in {}",
|
||||||
.green(),
|
ELAPSED.unsigned_duration_to_string(
|
||||||
Span::from(format!(" · {} ", unit_count(stage.finished_units))).dark_gray(),
|
&stage.reached_at.saturating_sub(stage.started_at)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Style::new().fg(self.palette.done),
|
||||||
|
),
|
||||||
|
Span::styled(
|
||||||
|
format!(" · {} ", unit_count(stage.finished_units)),
|
||||||
|
Style::new().fg(self.palette.waiting),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
)
|
)
|
||||||
@@ -185,26 +236,95 @@ impl BootView<'_> {
|
|||||||
.finished_stages
|
.finished_stages
|
||||||
.last()
|
.last()
|
||||||
.map_or(self.state.origin, |stage| stage.reached_at);
|
.map_or(self.state.origin, |stage| stage.reached_at);
|
||||||
let current = rule_line(
|
let current = if self.state.is_complete() {
|
||||||
width,
|
let handed_to = self
|
||||||
vec![
|
.state
|
||||||
Span::from(format!("{RULE_STUB} ")).dark_gray(),
|
.handoff_unit
|
||||||
Span::from(self.state.phase.label()).bold(),
|
.as_deref()
|
||||||
Span::raw(" "),
|
.or(self.state.root.as_deref())
|
||||||
],
|
.unwrap_or("the console");
|
||||||
vec![
|
self.rule_line(
|
||||||
Span::raw(" "),
|
width,
|
||||||
Span::from(
|
vec![
|
||||||
ELAPSED
|
Span::styled(format!("{RULE_STUB} "), Style::new().fg(self.palette.muted)),
|
||||||
.unsigned_duration_to_string(&self.now.saturating_sub(current_started_at)),
|
Span::styled(
|
||||||
)
|
format!(
|
||||||
.bold(),
|
"{BEAD} boot finished in {}",
|
||||||
Span::from(format!(" {RULE_STUB}")).dark_gray(),
|
ELAPSED.unsigned_duration_to_string(
|
||||||
],
|
&self.now.saturating_sub(self.state.origin)
|
||||||
);
|
)
|
||||||
|
),
|
||||||
|
Style::new().fg(self.palette.done).bold(),
|
||||||
|
),
|
||||||
|
Span::styled(
|
||||||
|
format!(" · handing over to {handed_to} "),
|
||||||
|
Style::new().fg(self.palette.text),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Vec::new(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
self.rule_line(
|
||||||
|
width,
|
||||||
|
vec![
|
||||||
|
Span::styled(format!("{RULE_STUB} "), Style::new().fg(self.palette.muted)),
|
||||||
|
Span::styled(
|
||||||
|
self.state.phase.label(),
|
||||||
|
Style::new().fg(self.palette.text).bold(),
|
||||||
|
),
|
||||||
|
Span::raw(" "),
|
||||||
|
],
|
||||||
|
vec![
|
||||||
|
Span::raw(" "),
|
||||||
|
Span::styled(
|
||||||
|
ELAPSED.unsigned_duration_to_string(
|
||||||
|
&self.now.saturating_sub(current_started_at),
|
||||||
|
),
|
||||||
|
Style::new().fg(self.palette.text).bold(),
|
||||||
|
),
|
||||||
|
Span::styled(format!(" {RULE_STUB}"), Style::new().fg(self.palette.muted)),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
};
|
||||||
finished.chain(once(current)).collect()
|
finished.chain(once(current)).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn failure_lines(&self) -> Vec<Line<'static>> {
|
||||||
|
let units = &self.state.failed;
|
||||||
|
let hidden = units.len().saturating_sub(MAX_FAILED_ROWS);
|
||||||
|
units
|
||||||
|
.iter()
|
||||||
|
.take(MAX_FAILED_ROWS)
|
||||||
|
.map(|unit| format!("{FAILED} {unit} failed"))
|
||||||
|
.chain((hidden > 0).then(|| format!("{FAILED} {hidden} more failed")))
|
||||||
|
.map(|text| Line::styled(text, Style::new().fg(self.palette.failed).bold()))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn label_style(&self, row: &PendingRow) -> Style {
|
||||||
|
match (row.is_target, row.status) {
|
||||||
|
(true, _) => Style::new().fg(self.palette.target),
|
||||||
|
(false, RowStatus::Running) => Style::new().fg(self.palette.text),
|
||||||
|
(false, RowStatus::Waiting) => Style::new().fg(self.palette.waiting),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn status_marker(&self, row: &PendingRow) -> Span<'static> {
|
||||||
|
match (row.is_target, row.status) {
|
||||||
|
(true, _) => Span::raw(""),
|
||||||
|
(false, RowStatus::Running) => {
|
||||||
|
let spinner = SPINNER[usize::try_from(self.frame % 4).unwrap_or_default()];
|
||||||
|
Span::styled(
|
||||||
|
format!("[{spinner}] "),
|
||||||
|
Style::new().fg(self.palette.running),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
(false, RowStatus::Waiting) => {
|
||||||
|
Span::styled("[ ] ", Style::new().fg(self.palette.waiting))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn tree<'a>(&self, rows: &'a [PendingRow], height: u16) -> Table<'a> {
|
fn tree<'a>(&self, rows: &'a [PendingRow], height: u16) -> Table<'a> {
|
||||||
let capacity = usize::from(height);
|
let capacity = usize::from(height);
|
||||||
let shown = if rows.len() > capacity {
|
let shown = if rows.len() > capacity {
|
||||||
@@ -213,8 +333,12 @@ impl BootView<'_> {
|
|||||||
rows.len()
|
rows.len()
|
||||||
};
|
};
|
||||||
let hidden = rows.len() - shown;
|
let hidden = rows.len() - shown;
|
||||||
let overflow =
|
let overflow = (hidden > 0).then(|| {
|
||||||
(hidden > 0).then(|| Row::new([Line::from(format!("… {hidden} more")).dark_gray()]));
|
Row::new([Line::styled(
|
||||||
|
format!("… {hidden} more"),
|
||||||
|
Style::new().fg(self.palette.waiting),
|
||||||
|
)])
|
||||||
|
});
|
||||||
Table::new(
|
Table::new(
|
||||||
rows.iter()
|
rows.iter()
|
||||||
.take(shown)
|
.take(shown)
|
||||||
@@ -228,22 +352,17 @@ impl BootView<'_> {
|
|||||||
let since = row.running_since.unwrap_or(row.queued_at);
|
let since = row.running_since.unwrap_or(row.queued_at);
|
||||||
Row::new([
|
Row::new([
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
Span::from(tree_prefix(row)).dark_gray(),
|
Span::styled(tree_prefix(row), Style::new().fg(self.palette.muted)),
|
||||||
status_marker(row, self.frame),
|
self.status_marker(row),
|
||||||
Span::styled(row.label.as_str(), label_style(row)),
|
Span::styled(row.label.as_str(), self.label_style(row)),
|
||||||
]),
|
]),
|
||||||
Line::from(ELAPSED.unsigned_duration_to_string(&self.now.saturating_sub(since)))
|
Line::from(ELAPSED.unsigned_duration_to_string(&self.now.saturating_sub(since)))
|
||||||
.style(label_style(row))
|
.style(self.label_style(row))
|
||||||
.right_aligned(),
|
.right_aligned(),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn timeline<'a>(
|
fn timeline<'a>(&self, content: &TimelineContent<'a>, width: u16) -> Table<'a> {
|
||||||
&self,
|
|
||||||
milestones: &'a [MilestoneRow],
|
|
||||||
units: &[&'a PendingRow],
|
|
||||||
width: u16,
|
|
||||||
) -> Table<'a> {
|
|
||||||
let axis = TimeAxis::new(
|
let axis = TimeAxis::new(
|
||||||
self.state.origin,
|
self.state.origin,
|
||||||
self.now,
|
self.now,
|
||||||
@@ -255,36 +374,25 @@ impl BootView<'_> {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|stage| stage.reached_at)
|
.map(|stage| stage.reached_at)
|
||||||
.collect();
|
.collect();
|
||||||
|
let muted = Style::new().fg(self.palette.muted);
|
||||||
let axis_rows = [
|
let axis_rows = [
|
||||||
Row::new([Line::default(), axis.labels()]),
|
Row::new([Line::default(), axis.labels(muted)]),
|
||||||
Row::new([Line::default(), axis.ticks_line(&root_switches)]),
|
Row::new([Line::default(), axis.ticks_line(&root_switches, muted)]),
|
||||||
];
|
];
|
||||||
let milestone_rows = milestones.iter().map(|row| {
|
let entries = content
|
||||||
|
.milestones
|
||||||
|
.iter()
|
||||||
|
.map(|row| self.milestone_entry(row))
|
||||||
|
.chain(content.finished.iter().map(|run| self.finished_entry(run)))
|
||||||
|
.chain(content.running.iter().map(|row| self.running_entry(row)));
|
||||||
|
let bar_rows = entries.map(|entry| {
|
||||||
Row::new([
|
Row::new([
|
||||||
Line::from(format!(
|
entry.label,
|
||||||
"{DONE} {} ({})",
|
axis.bar(&entry.segments, entry.still_going_at, &root_switches, muted),
|
||||||
row.label,
|
|
||||||
unit_count(row.finished_units)
|
|
||||||
))
|
|
||||||
.green(),
|
|
||||||
axis.bar(&milestone_segments(row), None, &root_switches),
|
|
||||||
])
|
|
||||||
});
|
|
||||||
let unit_rows = units.iter().map(|row| {
|
|
||||||
Row::new([
|
|
||||||
Line::from(vec![
|
|
||||||
timeline_marker(row),
|
|
||||||
Span::styled(row.label.as_str(), label_style(row)),
|
|
||||||
]),
|
|
||||||
axis.bar(
|
|
||||||
&unit_segments(row, self.now),
|
|
||||||
Some(self.now),
|
|
||||||
&root_switches,
|
|
||||||
),
|
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
Table::new(
|
Table::new(
|
||||||
axis_rows.into_iter().chain(milestone_rows).chain(unit_rows),
|
axis_rows.into_iter().chain(bar_rows),
|
||||||
[
|
[
|
||||||
Constraint::Length(TIMELINE_LABEL_WIDTH),
|
Constraint::Length(TIMELINE_LABEL_WIDTH),
|
||||||
Constraint::Fill(1),
|
Constraint::Fill(1),
|
||||||
@@ -293,65 +401,135 @@ impl BootView<'_> {
|
|||||||
.block(
|
.block(
|
||||||
Block::new()
|
Block::new()
|
||||||
.borders(Borders::TOP)
|
.borders(Borders::TOP)
|
||||||
.border_style(Style::new().dark_gray())
|
.border_style(Style::new().fg(self.palette.muted))
|
||||||
.title(Line::from(" timeline ").dark_gray()),
|
.title(Line::styled(
|
||||||
|
" timeline ",
|
||||||
|
Style::new().fg(self.palette.waiting),
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn milestone_entry(&self, row: &MilestoneRow) -> TimelineEntry<'static> {
|
||||||
|
let done = Style::new().fg(self.palette.done);
|
||||||
|
TimelineEntry {
|
||||||
|
label: Line::styled(
|
||||||
|
format!("{DONE} {} ({})", row.label, unit_count(row.finished_units)),
|
||||||
|
done,
|
||||||
|
),
|
||||||
|
segments: row
|
||||||
|
.reached_at
|
||||||
|
.map(|reached_at| Segment {
|
||||||
|
from: row.started_at,
|
||||||
|
to: reached_at,
|
||||||
|
symbol: BEAD,
|
||||||
|
style: done,
|
||||||
|
})
|
||||||
|
.into_iter()
|
||||||
|
.collect(),
|
||||||
|
still_going_at: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn finished_entry<'a>(&self, run: &'a FinishedRun) -> TimelineEntry<'a> {
|
||||||
|
let (mark, outcome) = if run.failed {
|
||||||
|
(FAILED, Style::new().fg(self.palette.failed))
|
||||||
|
} else {
|
||||||
|
(DONE, Style::new().fg(self.palette.done))
|
||||||
|
};
|
||||||
|
TimelineEntry {
|
||||||
|
label: Line::from(vec![
|
||||||
|
Span::styled(format!("{mark} "), outcome),
|
||||||
|
Span::styled(run.label.as_str(), Style::new().fg(self.palette.waiting)),
|
||||||
|
]),
|
||||||
|
segments: vec![Segment {
|
||||||
|
from: run.started_at,
|
||||||
|
to: run.finished_at,
|
||||||
|
symbol: BEAD,
|
||||||
|
style: outcome,
|
||||||
|
}],
|
||||||
|
still_going_at: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn running_entry<'a>(&self, row: &'a PendingRow) -> TimelineEntry<'a> {
|
||||||
|
let since = row.running_since.unwrap_or(row.queued_at);
|
||||||
|
let waited = (since > row.queued_at).then(|| Segment {
|
||||||
|
from: row.queued_at,
|
||||||
|
to: since,
|
||||||
|
symbol: WAITING_BEAD,
|
||||||
|
style: Style::new().fg(self.palette.waiting),
|
||||||
|
});
|
||||||
|
let ran = Segment {
|
||||||
|
from: since,
|
||||||
|
to: self.now,
|
||||||
|
symbol: BEAD,
|
||||||
|
style: Style::new().fg(self.palette.running),
|
||||||
|
};
|
||||||
|
TimelineEntry {
|
||||||
|
label: Line::from(vec![
|
||||||
|
Span::styled(
|
||||||
|
format!("{RUNNING_MARK} "),
|
||||||
|
Style::new().fg(self.palette.running),
|
||||||
|
),
|
||||||
|
Span::styled(row.label.as_str(), Style::new().fg(self.palette.text)),
|
||||||
|
]),
|
||||||
|
segments: waited.into_iter().chain(once(ran)).collect(),
|
||||||
|
still_going_at: Some(self.now),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn footer(&self, tally: Tally, width: u16) -> Paragraph<'static> {
|
||||||
|
let failed_style = if tally.failed > 0 {
|
||||||
|
Style::new().fg(self.palette.failed).bold()
|
||||||
|
} else {
|
||||||
|
Style::new().fg(self.palette.waiting)
|
||||||
|
};
|
||||||
|
let counts = vec![
|
||||||
|
Span::styled(
|
||||||
|
format!("{DONE} {} done", tally.done),
|
||||||
|
Style::new().fg(self.palette.done),
|
||||||
|
),
|
||||||
|
Span::styled(
|
||||||
|
format!(" {} running", tally.running),
|
||||||
|
Style::new().fg(self.palette.running),
|
||||||
|
),
|
||||||
|
Span::styled(
|
||||||
|
format!(" {} waiting", tally.waiting),
|
||||||
|
Style::new().fg(self.palette.waiting),
|
||||||
|
),
|
||||||
|
Span::styled(format!(" {FAILED} {} failed", tally.failed), failed_style),
|
||||||
|
];
|
||||||
|
let switch_legend = if self.state.finished_stages.is_empty() {
|
||||||
|
String::new()
|
||||||
|
} else {
|
||||||
|
format!(" {ROOT_SWITCH_MARK} root switch")
|
||||||
|
};
|
||||||
|
let legend = format!("{BEAD} running {WAITING_BEAD} waiting{switch_legend}");
|
||||||
|
let used = Line::from(counts.clone()).width() + legend.chars().count();
|
||||||
|
let gap = usize::from(width).saturating_sub(used);
|
||||||
|
let spans = if gap >= 2 {
|
||||||
|
counts
|
||||||
|
.into_iter()
|
||||||
|
.chain([
|
||||||
|
Span::raw(" ".repeat(gap)),
|
||||||
|
Span::styled(legend, Style::new().fg(self.palette.waiting)),
|
||||||
|
])
|
||||||
|
.collect()
|
||||||
|
} else {
|
||||||
|
counts
|
||||||
|
};
|
||||||
|
Paragraph::new(Line::from(spans)).block(
|
||||||
|
Block::new()
|
||||||
|
.borders(Borders::TOP)
|
||||||
|
.border_style(Style::new().fg(self.palette.muted)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn timeline_need(screen: Rect, entries: usize) -> u16 {
|
struct TimelineEntry<'a> {
|
||||||
let fits = screen.width >= TIMELINE_LABEL_WIDTH + 1 + MIN_BAR_WIDTH
|
label: Line<'a>,
|
||||||
&& screen.height >= MIN_HEIGHT_FOR_TIMELINE
|
segments: Vec<Segment>,
|
||||||
&& entries > 0;
|
still_going_at: Option<Duration>,
|
||||||
if fits {
|
|
||||||
TIMELINE_CHROME_HEIGHT.saturating_add(u16::try_from(entries).unwrap_or(u16::MAX))
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn failure_lines(units: &[String]) -> Vec<Line<'static>> {
|
|
||||||
let hidden = units.len().saturating_sub(MAX_FAILED_ROWS);
|
|
||||||
units
|
|
||||||
.iter()
|
|
||||||
.take(MAX_FAILED_ROWS)
|
|
||||||
.map(|unit| format!("{FAILED} {unit} failed"))
|
|
||||||
.chain((hidden > 0).then(|| format!("{FAILED} {hidden} more failed")))
|
|
||||||
.map(|text| Line::from(text).red().bold())
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn footer_paragraph(tally: Tally, width: u16, root_switched: bool) -> Paragraph<'static> {
|
|
||||||
let counts = format!(
|
|
||||||
"{DONE} {} done {} running {} waiting {FAILED} {} failed",
|
|
||||||
tally.done, tally.running, tally.waiting, tally.failed
|
|
||||||
);
|
|
||||||
let switch_legend = if root_switched {
|
|
||||||
format!(" {ROOT_SWITCH_MARK} root switch")
|
|
||||||
} else {
|
|
||||||
String::new()
|
|
||||||
};
|
|
||||||
let legend = format!("{BEAD} running {WAITING_BEAD} waiting{switch_legend}");
|
|
||||||
let gap = usize::from(width).saturating_sub(counts.chars().count() + legend.chars().count());
|
|
||||||
let counts_style = if tally.failed > 0 {
|
|
||||||
Style::new().red().bold()
|
|
||||||
} else {
|
|
||||||
Style::new()
|
|
||||||
};
|
|
||||||
let line = if gap >= 2 {
|
|
||||||
Line::from(vec![
|
|
||||||
Span::styled(counts, counts_style),
|
|
||||||
Span::raw(" ".repeat(gap)),
|
|
||||||
Span::from(legend).dark_gray(),
|
|
||||||
])
|
|
||||||
} else {
|
|
||||||
Line::from(Span::styled(counts, counts_style))
|
|
||||||
};
|
|
||||||
Paragraph::new(line).block(
|
|
||||||
Block::new()
|
|
||||||
.borders(Borders::TOP)
|
|
||||||
.border_style(Style::new().dark_gray()),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Segment {
|
struct Segment {
|
||||||
@@ -361,35 +539,6 @@ struct Segment {
|
|||||||
style: Style,
|
style: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn milestone_segments(row: &MilestoneRow) -> Vec<Segment> {
|
|
||||||
row.reached_at
|
|
||||||
.map(|reached_at| Segment {
|
|
||||||
from: row.started_at,
|
|
||||||
to: reached_at,
|
|
||||||
symbol: BEAD,
|
|
||||||
style: Style::new().green(),
|
|
||||||
})
|
|
||||||
.into_iter()
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn unit_segments(row: &PendingRow, now: Duration) -> Vec<Segment> {
|
|
||||||
let waiting_until = row.running_since.unwrap_or(now);
|
|
||||||
let waiting = (waiting_until > row.queued_at).then(|| Segment {
|
|
||||||
from: row.queued_at,
|
|
||||||
to: waiting_until,
|
|
||||||
symbol: WAITING_BEAD,
|
|
||||||
style: Style::new().dark_gray(),
|
|
||||||
});
|
|
||||||
let running = row.running_since.map(|since| Segment {
|
|
||||||
from: since,
|
|
||||||
to: now,
|
|
||||||
symbol: BEAD,
|
|
||||||
style: Style::new().yellow(),
|
|
||||||
});
|
|
||||||
waiting.into_iter().chain(running).collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Stroke {
|
struct Stroke {
|
||||||
column: u16,
|
column: u16,
|
||||||
glyphs: String,
|
glyphs: String,
|
||||||
@@ -484,50 +633,38 @@ impl TimeAxis {
|
|||||||
.take_while(|offset| *offset <= self.span)
|
.take_while(|offset| *offset <= self.span)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn root_switch_strokes(&self, root_switches: &[Duration]) -> Vec<Stroke> {
|
fn labels(&self, style: Style) -> Line<'static> {
|
||||||
root_switches
|
|
||||||
.iter()
|
|
||||||
.map(|at| {
|
|
||||||
Stroke::run(
|
|
||||||
self.column(*at),
|
|
||||||
1,
|
|
||||||
ROOT_SWITCH_MARK,
|
|
||||||
Style::new().dark_gray(),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn labels(&self) -> Line<'static> {
|
|
||||||
canvas_line(
|
canvas_line(
|
||||||
self.width,
|
self.width,
|
||||||
self.tick_offsets().map(|offset| {
|
self.tick_offsets().map(|offset| {
|
||||||
let glyphs = AXIS_LABEL.unsigned_duration_to_string(&offset);
|
let glyphs = if offset.is_zero() && self.origin.is_zero() {
|
||||||
|
KERNEL_ORIGIN_LABEL.to_owned()
|
||||||
|
} else {
|
||||||
|
AXIS_LABEL.unsigned_duration_to_string(&offset)
|
||||||
|
};
|
||||||
let label_width = u16::try_from(glyphs.len()).unwrap_or(self.width);
|
let label_width = u16::try_from(glyphs.len()).unwrap_or(self.width);
|
||||||
Stroke {
|
Stroke {
|
||||||
column: self
|
column: self
|
||||||
.column(self.origin + offset)
|
.column(self.origin + offset)
|
||||||
.min(self.width.saturating_sub(label_width)),
|
.min(self.width.saturating_sub(label_width)),
|
||||||
glyphs,
|
glyphs,
|
||||||
style: Style::new().dark_gray(),
|
style,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ticks_line(&self, root_switches: &[Duration]) -> Line<'static> {
|
fn ticks_line(&self, root_switches: &[Duration], style: Style) -> Line<'static> {
|
||||||
canvas_line(
|
canvas_line(
|
||||||
self.width,
|
self.width,
|
||||||
self.root_switch_strokes(root_switches)
|
root_switches
|
||||||
.into_iter()
|
.iter()
|
||||||
.chain(self.tick_offsets().map(|offset| {
|
.map(|at| Stroke::run(self.column(*at), 1, ROOT_SWITCH_MARK, style))
|
||||||
Stroke::run(
|
.chain(
|
||||||
self.column(self.origin + offset),
|
self.tick_offsets().map(|offset| {
|
||||||
1,
|
Stroke::run(self.column(self.origin + offset), 1, '|', style)
|
||||||
'|',
|
}),
|
||||||
Style::new().dark_gray(),
|
),
|
||||||
)
|
|
||||||
})),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,47 +673,19 @@ impl TimeAxis {
|
|||||||
segments: &[Segment],
|
segments: &[Segment],
|
||||||
still_going_at: Option<Duration>,
|
still_going_at: Option<Duration>,
|
||||||
root_switches: &[Duration],
|
root_switches: &[Duration],
|
||||||
|
switch_style: Style,
|
||||||
) -> Line<'static> {
|
) -> Line<'static> {
|
||||||
|
let switches = root_switches
|
||||||
|
.iter()
|
||||||
|
.map(|at| Stroke::run(self.column(*at), 1, ROOT_SWITCH_MARK, switch_style));
|
||||||
let bars = segments.iter().map(|segment| {
|
let bars = segments.iter().map(|segment| {
|
||||||
let start = self.column(segment.from);
|
let start = self.column(segment.from);
|
||||||
let end = self.column(segment.to).max(start + 1);
|
let end = self.column(segment.to).max(start + 1);
|
||||||
Stroke::run(start, end - start, segment.symbol, segment.style)
|
Stroke::run(start, end - start, segment.symbol, segment.style)
|
||||||
});
|
});
|
||||||
let still_going = still_going_at
|
let still_going =
|
||||||
.map(|now| Stroke::run(self.column(now), 1, STILL_GOING, Style::new().dark_gray()));
|
still_going_at.map(|now| Stroke::run(self.column(now), 1, STILL_GOING, switch_style));
|
||||||
canvas_line(
|
canvas_line(self.width, switches.chain(bars).chain(still_going))
|
||||||
self.width,
|
|
||||||
self.root_switch_strokes(root_switches)
|
|
||||||
.into_iter()
|
|
||||||
.chain(bars)
|
|
||||||
.chain(still_going),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn status_marker(row: &PendingRow, frame: u64) -> Span<'static> {
|
|
||||||
match (row.is_target, row.status) {
|
|
||||||
(true, _) => Span::raw(""),
|
|
||||||
(false, RowStatus::Running) => {
|
|
||||||
let spinner = SPINNER[usize::try_from(frame % 4).unwrap_or_default()];
|
|
||||||
Span::from(format!("[{spinner}] ")).yellow()
|
|
||||||
}
|
|
||||||
(false, RowStatus::Waiting) => Span::from("[ ] ").dark_gray(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn timeline_marker(row: &PendingRow) -> Span<'static> {
|
|
||||||
match row.status {
|
|
||||||
RowStatus::Running => Span::from(format!("{RUNNING_MARK} ")).yellow(),
|
|
||||||
RowStatus::Waiting => Span::raw(" "),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn label_style(row: &PendingRow) -> Style {
|
|
||||||
match (row.is_target, row.status) {
|
|
||||||
(true, _) => Style::new().cyan(),
|
|
||||||
(false, RowStatus::Running) => Style::new(),
|
|
||||||
(false, RowStatus::Waiting) => Style::new().dark_gray(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,6 +734,7 @@ mod tests {
|
|||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
BootView {
|
BootView {
|
||||||
state,
|
state,
|
||||||
|
palette: &Palette::default(),
|
||||||
now,
|
now,
|
||||||
host: "ryzen",
|
host: "ryzen",
|
||||||
frame: 1,
|
frame: 1,
|
||||||
@@ -663,7 +773,7 @@ mod tests {
|
|||||||
(
|
(
|
||||||
facts(
|
facts(
|
||||||
"multi-user.target",
|
"multi-user.target",
|
||||||
&["docker.service", "systemd-rfkill.service"],
|
&["docker.service", "systemd-rfkill.service", "web.service"],
|
||||||
),
|
),
|
||||||
Activity::default(),
|
Activity::default(),
|
||||||
),
|
),
|
||||||
@@ -672,8 +782,10 @@ mod tests {
|
|||||||
facts("systemd-rfkill.service", &[]),
|
facts("systemd-rfkill.service", &[]),
|
||||||
running_since(6000 * MS),
|
running_since(6000 * MS),
|
||||||
),
|
),
|
||||||
|
(facts("web.service", &[]), Activity::default()),
|
||||||
(facts("sysinit.target", &[]), Activity::default()),
|
(facts("sysinit.target", &[]), Activity::default()),
|
||||||
(facts("nvidia-powerd.service", &[]), Activity::default()),
|
(facts("nvidia-powerd.service", &[]), Activity::default()),
|
||||||
|
(facts("udev-settle.service", &[]), running_since(2000 * MS)),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.zip(1..)
|
.zip(1..)
|
||||||
@@ -682,8 +794,9 @@ mod tests {
|
|||||||
state.track_unit(unit, activity);
|
state.track_unit(unit, activity);
|
||||||
state.queue_job(id, &name, 1000 * MS);
|
state.queue_job(id, &name, 1000 * MS);
|
||||||
});
|
});
|
||||||
state.finish_job(5, JobResult::Done, 4000 * MS);
|
state.finish_job(6, JobResult::Done, 4000 * MS);
|
||||||
state.finish_job(6, JobResult::Failed, 5000 * MS);
|
state.finish_job(7, JobResult::Failed, 5000 * MS);
|
||||||
|
state.finish_job(8, JobResult::Done, 3500 * MS);
|
||||||
state
|
state
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -691,41 +804,48 @@ mod tests {
|
|||||||
fn tree_on_top_timeline_below() {
|
fn tree_on_top_timeline_below() {
|
||||||
let lines = render(&boot_in_progress(), 12_400 * MS, 110, 24);
|
let lines = render(&boot_in_progress(), 12_400 * MS, 110, 24);
|
||||||
let screen = lines.join("\n");
|
let screen = lines.join("\n");
|
||||||
assert!(lines[0].starts_with("boot-tree ryzen"), "{screen}");
|
assert_eq!(lines[0], "boot-tree ryzen", "{screen}");
|
||||||
assert!(lines[0].ends_with("12.4s"), "{screen}");
|
|
||||||
assert!(lines[2].starts_with("── stage 2 ──"), "{screen}");
|
assert!(lines[2].starts_with("── stage 2 ──"), "{screen}");
|
||||||
assert!(lines[2].ends_with("12.4s ──"), "{screen}");
|
assert!(lines[2].ends_with("12.4s ──"), "{screen}");
|
||||||
assert!(lines[3].starts_with("graphical.target"), "{screen}");
|
assert!(lines[3].starts_with("graphical.target"), "{screen}");
|
||||||
assert!(lines[4].starts_with("└─ multi-user.target"), "{screen}");
|
assert!(lines[4].starts_with("└─ multi-user.target"), "{screen}");
|
||||||
assert!(lines[5].starts_with(" ├─ [/] systemd-rfkill"), "{screen}");
|
assert!(lines[5].starts_with(" ├─ [/] systemd-rfkill"), "{screen}");
|
||||||
assert!(lines[6].starts_with(" └─ [/] docker"), "{screen}");
|
assert!(lines[6].starts_with(" ├─ [/] docker"), "{screen}");
|
||||||
|
assert!(lines[7].starts_with(" └─ [ ] web"), "{screen}");
|
||||||
assert!(
|
assert!(
|
||||||
lines[7].starts_with("× nvidia-powerd.service failed"),
|
lines[8].starts_with("× nvidia-powerd.service failed"),
|
||||||
"{screen}"
|
"{screen}"
|
||||||
);
|
);
|
||||||
let timeline = lines
|
let timeline = lines
|
||||||
.iter()
|
.iter()
|
||||||
.position(|line| line.contains(" timeline "))
|
.position(|line| line.contains(" timeline "))
|
||||||
.expect("timeline panel");
|
.expect("timeline panel");
|
||||||
assert_eq!(timeline, 24 - 2 - 3 - 3, "{screen}");
|
|
||||||
assert!(lines[timeline + 1].contains("0s"), "{screen}");
|
|
||||||
assert!(
|
assert!(
|
||||||
lines[timeline + 3].starts_with("√ sysinit.target (1 unit)"),
|
lines[timeline + 1].starts_with(&format!("{:29}kernel", "")),
|
||||||
"{screen}"
|
|
||||||
);
|
|
||||||
assert!(lines[timeline + 3].contains('■'), "{screen}");
|
|
||||||
assert!(
|
|
||||||
lines[timeline + 4].starts_with("► systemd-rfkill"),
|
|
||||||
"{screen}"
|
"{screen}"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
lines[timeline + 4].contains("·■") && lines[timeline + 4].ends_with('▶'),
|
lines[timeline + 3].starts_with("√ sysinit.target (2 units)"),
|
||||||
|
"{screen}"
|
||||||
|
);
|
||||||
|
assert!(lines[timeline + 4].starts_with("√ udev-settle"), "{screen}");
|
||||||
|
assert!(lines[timeline + 4].contains('■'), "{screen}");
|
||||||
|
assert!(
|
||||||
|
lines[timeline + 5].starts_with("► systemd-rfkill"),
|
||||||
|
"{screen}"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
lines[timeline + 5].contains("·■") && lines[timeline + 5].ends_with('▶'),
|
||||||
|
"{screen}"
|
||||||
|
);
|
||||||
|
assert!(lines[timeline + 6].starts_with("► docker"), "{screen}");
|
||||||
|
assert!(
|
||||||
|
lines[timeline..].iter().all(|line| !line.contains(" web")),
|
||||||
"{screen}"
|
"{screen}"
|
||||||
);
|
);
|
||||||
assert!(lines[timeline + 5].starts_with("► docker"), "{screen}");
|
|
||||||
assert!(!screen.contains("root switch"), "{screen}");
|
assert!(!screen.contains("root switch"), "{screen}");
|
||||||
assert!(
|
assert!(
|
||||||
lines[23].starts_with("√ 1 done 2 running 2 waiting × 1 failed"),
|
lines[23].starts_with("√ 2 done 2 running 3 waiting × 1 failed"),
|
||||||
"{screen}"
|
"{screen}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -754,6 +874,7 @@ mod tests {
|
|||||||
state.queue_job(2, "graphical.target", 7300 * MS);
|
state.queue_job(2, "graphical.target", 7300 * MS);
|
||||||
let lines = render(&state, 17_300 * MS, 110, 24);
|
let lines = render(&state, 17_300 * MS, 110, 24);
|
||||||
let screen = lines.join("\n");
|
let screen = lines.join("\n");
|
||||||
|
assert!(lines[0].ends_with("17.3s"), "{screen}");
|
||||||
assert!(
|
assert!(
|
||||||
lines[2].starts_with("── initrd ── ■ done in 7.2s · 1 unit ──"),
|
lines[2].starts_with("── initrd ── ■ done in 7.2s · 1 unit ──"),
|
||||||
"{screen}"
|
"{screen}"
|
||||||
@@ -776,10 +897,26 @@ mod tests {
|
|||||||
Some(switch_column),
|
Some(switch_column),
|
||||||
"{screen}"
|
"{screen}"
|
||||||
);
|
);
|
||||||
assert!(lines[timeline + 3].contains("■│"), "{screen}");
|
|
||||||
assert!(screen.contains("│ root switch"), "{screen}");
|
assert!(screen.contains("│ root switch"), "{screen}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn completion_announces_the_handover() {
|
||||||
|
let mut state = BootState::new(Phase::Host);
|
||||||
|
state.set_root("graphical.target".to_owned());
|
||||||
|
state.track_unit(facts("graphical.target", &[]), Activity::default());
|
||||||
|
state.queue_job(1, "graphical.target", Duration::ZERO);
|
||||||
|
state.finish_job(1, JobResult::Done, 9000 * MS);
|
||||||
|
let lines = render(&state, 9500 * MS, 110, 24);
|
||||||
|
assert!(
|
||||||
|
lines[2].starts_with(
|
||||||
|
"── ■ boot finished in 9.5s · handing over to display-manager.service ──"
|
||||||
|
),
|
||||||
|
"{}",
|
||||||
|
lines.join("\n")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn overflowing_trees_are_cut_with_a_count() {
|
fn overflowing_trees_are_cut_with_a_count() {
|
||||||
let mut state = BootState::new(Phase::Host);
|
let mut state = BootState::new(Phase::Host);
|
||||||
|
|||||||
Reference in new issue
Block a user