Merge branch 'chore/ratatui_upgrade' into dev

This commit is contained in:
Jack Wills
2024-02-12 16:20:54 +00:00
11 changed files with 231 additions and 197 deletions
@@ -56,7 +56,7 @@ jobs:
# Upload output for release page
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ matrix.target }}
@@ -75,7 +75,7 @@ jobs:
uses: actions/checkout@v4
- name: Setup | Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
- name: Update Release
uses: ncipollo/release-action@v1
Generated
+118 -80
View File
@@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.8.7"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff"
dependencies = [
"cfg-if",
"once_cell",
@@ -66,9 +66,9 @@ dependencies = [
[[package]]
name = "anstyle"
version = "1.0.4"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
[[package]]
name = "anstyle-parse"
@@ -207,6 +207,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]]
name = "castaway"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc"
dependencies = [
"rustversion",
]
[[package]]
name = "cc"
version = "1.0.83"
@@ -224,9 +233,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.32"
version = "0.4.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a"
checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
dependencies = [
"android-tzdata",
"iana-time-zone",
@@ -237,9 +246,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.4.18"
version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c"
checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f"
dependencies = [
"clap_builder",
"clap_derive",
@@ -247,9 +256,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.4.18"
version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7"
checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99"
dependencies = [
"anstream",
"anstyle",
@@ -261,9 +270,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.4.7"
version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47"
dependencies = [
"heck",
"proc-macro2",
@@ -273,9 +282,9 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
[[package]]
name = "colorchoice"
@@ -283,6 +292,19 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "compact_str"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f"
dependencies = [
"castaway",
"cfg-if",
"itoa",
"ryu",
"static_assertions",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.6"
@@ -347,9 +369,9 @@ dependencies = [
[[package]]
name = "either"
version = "1.9.0"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "equivalent"
@@ -453,7 +475,7 @@ dependencies = [
"futures-sink",
"futures-util",
"http",
"indexmap 2.1.0",
"indexmap 2.2.3",
"slab",
"tokio",
"tokio-util",
@@ -484,9 +506,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3"
[[package]]
name = "hex"
@@ -567,9 +589,9 @@ dependencies = [
[[package]]
name = "iana-time-zone"
version = "0.1.59"
version = "0.1.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539"
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@@ -611,9 +633,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.1.0"
version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
dependencies = [
"equivalent",
"hashbrown 0.14.3",
@@ -628,9 +650,9 @@ checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
[[package]]
name = "itertools"
version = "0.12.0"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
"either",
]
@@ -643,9 +665,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "js-sys"
version = "0.3.67"
version = "0.3.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1"
checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee"
dependencies = [
"wasm-bindgen",
]
@@ -658,9 +680,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.152"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libredox"
@@ -691,9 +713,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "lru"
version = "0.12.1"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7"
checksum = "db2c024b41519440580066ba82aab04092b333e09066a5eb86c7c4890df31f22"
dependencies = [
"hashbrown 0.14.3",
]
@@ -706,9 +728,9 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "miniz_oxide"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
dependencies = [
"adler",
]
@@ -736,10 +758,16 @@ dependencies = [
]
[[package]]
name = "num-traits"
version = "0.2.17"
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-traits"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
@@ -837,18 +865,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project"
version = "1.1.3"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.3"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
dependencies = [
"proc-macro2",
"quote",
@@ -929,12 +957,13 @@ dependencies = [
[[package]]
name = "ratatui"
version = "0.25.0"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5659e52e4ba6e07b2dad9f1158f578ef84a73762625ddb51536019f34d180eb"
checksum = "bcb12f8fbf6c62614b0d56eb352af54f6a22410c3b079eb53ee93c7b97dd31d8"
dependencies = [
"bitflags 2.4.2",
"cassowary",
"compact_str",
"crossterm",
"indoc",
"itertools",
@@ -992,18 +1021,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "serde"
version = "1.0.195"
version = "1.0.196"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.195"
version = "1.0.196"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
dependencies = [
"proc-macro2",
"quote",
@@ -1012,9 +1041,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.111"
version = "1.0.113"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79"
dependencies = [
"itoa",
"ryu",
@@ -1046,16 +1075,17 @@ dependencies = [
[[package]]
name = "serde_with"
version = "3.5.1"
version = "3.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5c9fdb6b00a489875b22efd4b78fe2b363b72265cc5f6eb2e2b9ee270e6140c"
checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270"
dependencies = [
"base64",
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.1.0",
"indexmap 2.2.3",
"serde",
"serde_derive",
"serde_json",
"time",
]
@@ -1135,25 +1165,31 @@ dependencies = [
]
[[package]]
name = "strsim"
version = "0.10.0"
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strsim"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01"
[[package]]
name = "strum"
version = "0.25.0"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
version = "0.25.3"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18"
dependencies = [
"heck",
"proc-macro2",
@@ -1186,18 +1222,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.56"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.56"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
dependencies = [
"proc-macro2",
"quote",
@@ -1216,12 +1252,13 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.31"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e"
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
dependencies = [
"deranged",
"itoa",
"num-conv",
"powerfmt",
"serde",
"time-core",
@@ -1236,10 +1273,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
version = "0.2.16"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f"
checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
dependencies = [
"num-conv",
"time-core",
]
@@ -1260,9 +1298,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.35.1"
version = "1.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
dependencies = [
"backtrace",
"bytes",
@@ -1403,9 +1441,9 @@ dependencies = [
[[package]]
name = "unicode-segmentation"
version = "1.10.1"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]]
name = "unicode-width"
@@ -1469,9 +1507,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.90"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406"
checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@@ -1479,9 +1517,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.90"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd"
checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b"
dependencies = [
"bumpalo",
"log",
@@ -1494,9 +1532,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.90"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999"
checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -1504,9 +1542,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.90"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7"
checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
dependencies = [
"proc-macro2",
"quote",
@@ -1517,9 +1555,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.90"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
[[package]]
name = "winapi"
+3 -3
View File
@@ -29,13 +29,13 @@ similar_names = "allow"
anyhow = "1.0"
bollard = "0.15"
cansi = "2.2"
clap = { version = "4.4", features = ["color", "derive", "unicode"] }
clap = { version = "4.5", features = ["color", "derive", "unicode"] }
crossterm = "0.27"
directories = "5.0"
futures-util = "0.3"
parking_lot = { version = "0.12" }
ratatui = "0.25"
tokio = { version = "1.35", features = ["full"] }
ratatui = "0.26"
tokio = { version = "1.36", features = ["full"] }
tracing = "0.1"
tracing-subscriber = "0.3"
uuid = { version = "1.7", features = ["fast-rng", "v4"] }
+2 -2
View File
@@ -689,7 +689,7 @@ mod tests {
use super::{ByteStats, ContainerName, CpuStats, LogsTz};
#[test]
// Display CpuStats as a string
/// Display CpuStats as a string
fn test_container_state_cpustats_to_string() {
let test = |f: f64, s: &str| {
assert_eq!(CpuStats::new(f).to_string(), s);
@@ -702,7 +702,7 @@ mod tests {
}
#[test]
// Display bytestats as a string, convert into correct data unit (Kb, MB, GB)
/// Display bytestats as a string, convert into correct data unit (Kb, MB, GB)
fn test_container_state_bytestats_to_string() {
let test = |u: u64, s: &str| {
assert_eq!(ByteStats::new(u).to_string(), s);
+10 -9
View File
@@ -212,7 +212,7 @@ impl AppData {
}
/// Get all the ContainerItems
pub const fn get_container_items(&self) -> &Vec<ContainerItem> {
pub fn get_container_items(&self) -> &[ContainerItem] {
&self.containers.items
}
@@ -383,6 +383,7 @@ impl AppData {
}
/// Get mutable Option of the currently selected container DockerControls items
/// TODO command or control, need a uniform name acorss the application
pub fn get_control_items(&mut self) -> Option<&mut Vec<DockerControls>> {
self.get_mut_selected_container()
.map(|i| &mut i.docker_controls.items)
@@ -1229,7 +1230,7 @@ mod tests {
}
#[test]
// Get the currently selected container
/// Get the currently selected container
fn test_app_data_get_selected_container() {
let (_ids, mut containers) = gen_containers();
let mut app_data = gen_appdata(&containers);
@@ -1249,7 +1250,7 @@ mod tests {
}
#[test]
// Get mut container by id
/// Get mut container by id
fn test_app_data_get_container_by_id() {
let (_ids, mut containers) = gen_containers();
let mut app_data = gen_appdata(&containers);
@@ -1259,7 +1260,7 @@ mod tests {
}
#[test]
// Get just the containers name by id
/// Get just the containers name by id
fn test_app_data_get_container_name_by_id() {
let (_ids, containers) = gen_containers();
let mut app_data = gen_appdata(&containers);
@@ -1269,7 +1270,7 @@ mod tests {
}
#[test]
// Get the id of the currently selected container
/// Get the id of the currently selected container
fn test_app_data_get_selected_container_id() {
let (_ids, containers) = gen_containers();
let mut app_data = gen_appdata(&containers);
@@ -1832,15 +1833,15 @@ mod tests {
fn test_app_data_update_containers() {
let (_ids, containers) = gen_containers();
let mut app_data = gen_appdata(&containers);
let result_pre = app_data.get_container_items().clone();
let mut input = vec![
let result_pre = app_data.get_container_items().to_owned();
let mut input = [
gen_container_summary(1, "paused"),
gen_container_summary(2, "dead"),
];
app_data.update_containers(&mut input);
let result_post = app_data.get_container_items();
assert_ne!(&result_pre, result_post);
let result_post = app_data.get_container_items().to_owned();
assert_ne!(result_pre, result_post);
assert_eq!(result_post[0].state, State::Paused);
assert_eq!(result_post[1].state, State::Dead);
}
+1 -1
View File
@@ -71,7 +71,7 @@ pub struct DockerData {
impl DockerData {
/// Use docker stats to calculate current cpu usage
#[allow(clippy::cast_precision_loss)]
// FIX: this can overflow
// TODO FIX: this can overflow
fn calculate_usage(stats: &Stats) -> f64 {
let mut cpu_percentage = 0.0;
let previous_cpu = stats.precpu_stats.cpu_usage.total_usage;
-1
View File
@@ -150,7 +150,6 @@ async fn main() {
let containers = app_data
.lock()
.get_container_items()
.clone()
.iter()
.map(|i| format!("{i}"))
.collect::<Vec<_>>();
+5 -2
View File
@@ -98,12 +98,13 @@ mod tests {
}]
.to_vec(),
alignment: None,
style: Style::default(),
}];
assert_eq!(result, expected);
}
#[test]
// Use the escape codes to colorize the text
/// Use the escape codes to colorize the text
fn color_match_colorize() {
let result = log_sanitizer::colorize_logs(INPUT);
let expected = vec![Line {
@@ -130,12 +131,13 @@ mod tests {
},
],
alignment: None,
style: Style::default(),
}];
assert_eq!(result, expected);
}
#[test]
// Remove all escape ansi codes from given input
/// Remove all escape ansi codes from given input
fn color_match_remove_ansi() {
let result = log_sanitizer::remove_ansi(INPUT);
let expected = vec![Line {
@@ -143,6 +145,7 @@ mod tests {
content: std::borrow::Cow::Borrowed("oxker"),
style: Style::default(),
}],
style: Style::default(),
alignment: None,
}];
assert_eq!(result, expected);
+75 -83
View File
@@ -44,9 +44,9 @@ const MARGIN: &str = " ";
const RIGHT_ARROW: &str = "";
const CIRCLE: &str = "";
const CONSTRAINT_50_50: [Constraint; 2] = [Constraint::Percentage(50), Constraint::Percentage(50)];
const CONSTRAINT_100: [Constraint; 1] = [Constraint::Percentage(100)];
// TODO FIX THIS
const CONSTRAINT_POPUP: [Constraint; 5] = [
Constraint::Min(2),
Constraint::Max(1),
@@ -113,8 +113,7 @@ pub fn commands(
fd: &FrameData,
gui_state: &Arc<Mutex<GuiState>>,
) {
let block = || generate_block(app_data, area, fd, gui_state, SelectablePanel::Commands);
// let block = block();
let block = generate_block(app_data, area, fd, gui_state, SelectablePanel::Commands);
let items = app_data.lock().get_control_items().map_or(vec![], |i| {
i.iter()
.map(|c| {
@@ -127,18 +126,14 @@ pub fn commands(
.collect::<Vec<_>>()
});
if let Some(i) = app_data.lock().get_control_state() {
let items = List::new(items)
.block(block())
.block(block)
.highlight_style(Style::default().add_modifier(Modifier::BOLD))
.highlight_symbol(RIGHT_ARROW);
if let Some(i) = app_data.lock().get_control_state() {
f.render_stateful_widget(items, area, i);
} else {
let block = || generate_block(app_data, area, fd, gui_state, SelectablePanel::Commands);
let paragraph = Paragraph::new("")
.block(block())
.alignment(Alignment::Center);
let paragraph = Paragraph::new("").block(block).alignment(Alignment::Center);
f.render_widget(paragraph, area);
}
}
@@ -260,11 +255,11 @@ pub fn logs(
fd: &FrameData,
gui_state: &Arc<Mutex<GuiState>>,
) {
let block = || generate_block(app_data, area, fd, gui_state, SelectablePanel::Logs);
let block = generate_block(app_data, area, fd, gui_state, SelectablePanel::Logs);
if fd.init {
let paragraph = Paragraph::new(format!("parsing logs {}", fd.loading_icon))
.style(Style::default())
.block(block())
.block(block)
.alignment(Alignment::Center);
f.render_widget(paragraph, area);
} else {
@@ -272,12 +267,12 @@ pub fn logs(
if logs.is_empty() {
let paragraph = Paragraph::new("no logs found")
.block(block())
.block(block)
.alignment(Alignment::Center);
f.render_widget(paragraph, area);
} else {
let items = List::new(logs)
.block(block())
.block(block)
.highlight_symbol(RIGHT_ARROW)
.highlight_style(Style::default().add_modifier(Modifier::BOLD));
// This should always return Some, as logs is not empty
@@ -524,9 +519,9 @@ pub fn heading_bar(
let column_width = if column_width > 0 { column_width } else { 1 };
let splits = if data.has_containers {
vec![
Constraint::Min(2),
Constraint::Max(2),
Constraint::Min(column_width.try_into().unwrap_or_default()),
Constraint::Min(info_width.try_into().unwrap_or_default()),
Constraint::Max(info_width.try_into().unwrap_or_default()),
]
} else {
CONSTRAINT_100.to_vec()
@@ -773,16 +768,16 @@ pub fn help_box(f: &mut Frame) {
BoxLocation::MiddleCentre,
);
// This is wrong!
// TODO
let split_popup = Layout::default()
.direction(Direction::Vertical)
.constraints(
[
.constraints([
Constraint::Max(name_info.height.try_into().unwrap_or_default()),
Constraint::Max(description_info.height.try_into().unwrap_or_default()),
Constraint::Max(button_info.height.try_into().unwrap_or_default()),
Constraint::Max(final_info.height.try_into().unwrap_or_default()),
]
)
Constraint::Min(final_info.height.try_into().unwrap_or_default()),
])
.split(area);
let name_paragraph = Paragraph::new(name_info.lines)
@@ -1079,7 +1074,7 @@ mod tests {
// ******************** //
#[test]
// Test that when DockerCommands are available, they are drawn correctly, dependant on container state
/// Test that when DockerCommands are available, they are drawn correctly, dependant on container state
fn test_draw_blocks_commands_none() {
let (w, h) = (12, 6);
let mut setup = test_setup(w, h, false, false);
@@ -1230,7 +1225,7 @@ mod tests {
}
#[test]
// When control panel is selected, the border is blue, if not then white, selected text is highlighted
/// When control panel is selected, the border is blue, if not then white, selected text is highlighted
fn test_draw_blocks_commands_panel_selected_color() {
let (w, h) = (12, 6);
let mut setup = test_setup(w, h, true, true);
@@ -1320,7 +1315,7 @@ mod tests {
}
#[test]
// No containers, panel unselected, then selected, border color changes correctly
/// No containers, panel unselected, then selected, border color changes correctly
fn test_draw_blocks_containers_none() {
let (w, h) = (25, 6);
let mut setup = test_setup(w, h, true, true);
@@ -1381,7 +1376,7 @@ mod tests {
}
#[test]
// Containers panel drawn, selected line is bold, border is blue
/// Containers panel drawn, selected line is bold, border is blue
fn test_draw_blocks_containers_some() {
let (w, h) = (130, 6);
let mut setup = test_setup(w, h, true, true);
@@ -1740,7 +1735,7 @@ mod tests {
// ********** //
#[test]
// No logs, panel unselected, then selected, border color changes correctly
/// No logs, panel unselected, then selected, border color changes correctly
fn test_draw_blocks_logs_none() {
let (w, h) = (25, 6);
let mut setup = test_setup(w, h, true, true);
@@ -1802,7 +1797,7 @@ mod tests {
}
#[test]
// Parsing logs, spinner visible, and then animates by one frame
/// Parsing logs, spinner visible, and then animates by one frame
fn test_draw_blocks_logs_parsing() {
let (w, h) = (25, 6);
let mut setup = test_setup(w, h, true, true);
@@ -1868,7 +1863,7 @@ mod tests {
}
#[test]
// Logs correct displayed, changing log state also draws correctly
/// Logs correct displayed, changing log state also draws correctly
fn test_draw_blocks_logs_some() {
let (w, h) = (25, 6);
let mut setup = test_setup(w, h, true, true);
@@ -1937,7 +1932,7 @@ mod tests {
}
#[test]
// Full (long) name displayed in logs border
/// Full (long) name displayed in logs border
fn test_draw_blocks_logs_long_name() {
let (w, h) = (80, 6);
let mut setup = test_setup(w, h, true, true);
@@ -2026,7 +2021,7 @@ mod tests {
}
}
#[test]
// When status is Running, but not data, charts drawn without dots etc
/// When status is Running, but not data, charts drawn without dots etc
fn test_draw_blocks_charts_running_none() {
let (w, h) = (80, 10);
let mut setup = test_setup(w, h, true, true);
@@ -2081,7 +2076,7 @@ mod tests {
}
#[test]
// When status is Running, charts correctly drawn
/// When status is Running, charts correctly drawn
fn test_draw_blocks_charts_running_some() {
let (w, h) = (80, 10);
let mut setup = test_setup(w, h, true, true);
@@ -2134,7 +2129,7 @@ mod tests {
}
#[test]
// Whens status paused, some text is now Yellow
/// Whens status paused, some text is now Yellow
fn test_draw_blocks_charts_paused() {
let (w, h) = (80, 10);
let mut setup = test_setup(w, h, true, true);
@@ -2182,7 +2177,7 @@ mod tests {
}
#[test]
// When dead, text is read
/// When dead, text is read
fn test_draw_blocks_charts_dead() {
let (w, h) = (80, 10);
let mut setup = test_setup(w, h, true, true);
@@ -2329,7 +2324,6 @@ mod tests {
let result = &setup.terminal.backend().buffer().content;
for (index, expected_char) in expected.chars().enumerate() {
let result_cell = &result[index];
assert_eq!(result_cell.symbol(), expected_char.to_string());
assert_eq!(result_cell.bg, Color::Magenta);
assert_eq!(
@@ -2377,8 +2371,8 @@ mod tests {
test(" name state status cpu memory/limit id image ▼ ↓ rx ↑ tx ( h ) show help ", 99..=108, (Header::Rx, SortedOrder::Desc));
// tx
test(" name state status cpu memory/limit id image ↓ rx ▲ ↑ tx ( h ) show help ", 109..=122, (Header::Tx, SortedOrder::Asc));
test(" name state status cpu memory/limit id image ↓ rx ▼ ↑ tx ( h ) show help ", 109..=122, (Header::Tx, SortedOrder::Desc));
test(" name state status cpu memory/limit id image ↓ rx ▲ ↑ tx ( h ) show help ", 109..=118, (Header::Tx, SortedOrder::Asc));
test(" name state status cpu memory/limit id image ↓ rx ▼ ↑ tx ( h ) show help ", 109..=118, (Header::Tx, SortedOrder::Desc));
}
#[test]
@@ -2419,7 +2413,7 @@ mod tests {
// Help popup //
// ********** //
#[test]
// This will cause issues once the version has more than the current 5 chars (0.5.0)
/// This will cause issues once the version has more than the current 5 chars (0.5.0)
// Help popup is drawn correctly
fn test_draw_blocks_help() {
let (w, h) = (87, 30);
@@ -2519,7 +2513,7 @@ mod tests {
// ************ //
#[test]
// Delete container popup is drawn correctly
/// Delete container popup is drawn correctly
fn test_draw_blocks_delete() {
let (w, h) = (82, 10);
let mut setup = test_setup(w, h, true, true);
@@ -2611,13 +2605,13 @@ mod tests {
.unwrap();
let result = &setup.terminal.backend().buffer().content;
for (row_index, row) in expected.iter().enumerate() {
for (char_index, expected_char) in row.chars().enumerate() {
let index = row_index * usize::from(w) + char_index;
let result_cell = &result[index];
assert_eq!(expected_char.to_string(), result_cell.symbol());
let (fg, bg) = if row_index >= 6 && char_index >= 32 {
(Color::White, Color::Blue)
} else {
@@ -2635,7 +2629,7 @@ mod tests {
// *********** //
#[test]
// Test that the error popup is centered, red background, white border, white text, and displays the correct text
/// Test that the error popup is centered, red background, white border, white text, and displays the correct text
fn test_draw_blocks_docker_connect_error() {
let (w, h) = (46, 9);
let mut setup = test_setup(w, h, true, true);
@@ -2686,7 +2680,7 @@ mod tests {
}
#[test]
// Test that the clearable error popup is centered, red background, white border, white text, and displays the correct text
/// Test that the clearable error popup is centered, red background, white border, white text, and displays the correct text
fn test_draw_blocks_clearable_error() {
let (w, h) = (39, 10);
let mut setup = test_setup(w, h, true, true);
@@ -2738,7 +2732,7 @@ mod tests {
}
#[test]
// Port section when container has no ports
/// Port section when container has no ports
fn test_draw_blocks_ports_no_ports() {
let (w, h) = (30, 8);
let mut setup = test_setup(w, h, true, true);
@@ -2818,7 +2812,7 @@ mod tests {
}
#[test]
// Port section when container has multiple ports
/// Port section when container has multiple ports
fn test_draw_blocks_ports_multiple_ports() {
let (w, h) = (32, 8);
let mut setup = test_setup(w, h, true, true);
@@ -2891,51 +2885,51 @@ mod tests {
}
#[test]
// Port section title color correct dependant on state
/// Port section title color correct dependant on state
fn test_draw_blocks_ports_container_state() {
let (w, h) = (32, 8);
let mut setup = test_setup(w, h, true, true);
let max_lens = setup.app_data.lock().get_longest_port();
// setup.app_data.lock().containers.items[0].state = State::Paused;
// setup
// .terminal
// .draw(|f| {
// super::ports(f, setup.area, &setup.app_data, max_lens);
// })
// .unwrap();
setup.app_data.lock().containers.items[0].state = State::Paused;
setup
.terminal
.draw(|f| {
super::ports(f, setup.area, &setup.app_data, max_lens);
})
.unwrap();
// let expected = [
// "╭─────────── ports ────────────╮",
// "│ ip private public │",
// "│ 8001 │",
// "│ │",
// "│ │",
// "│ │",
// "│ │",
// "╰──────────────────────────────╯",
// ];
let expected = [
"╭─────────── ports ────────────╮",
"│ ip private public │",
"│ 8001 │",
"│ │",
"│ │",
"│ │",
"│ │",
"╰──────────────────────────────╯",
];
// let result = &setup.terminal.backend().buffer().content;
// for (row_index, row) in expected.iter().enumerate() {
// for (char_index, expected_char) in row.chars().enumerate() {
// let index = row_index * usize::from(w) + char_index;
// let result_cell = &result[index];
let result = &setup.terminal.backend().buffer().content;
for (row_index, row) in expected.iter().enumerate() {
for (char_index, expected_char) in row.chars().enumerate() {
let index = row_index * usize::from(w) + char_index;
let result_cell = &result[index];
// assert_eq!(expected_char.to_string(), result_cell.symbol());
assert_eq!(expected_char.to_string(), result_cell.symbol());
// if row_index == 0
// && result_cell
// .symbol()
// .chars()
// .next()
// .unwrap()
// .is_ascii_alphanumeric()
// {
// assert_eq!(result_cell.fg, Color::Yellow);
// }
// }
// }
if row_index == 0
&& result_cell
.symbol()
.chars()
.next()
.unwrap()
.is_ascii_alphanumeric()
{
assert_eq!(result_cell.fg, Color::Yellow);
}
}
}
setup.app_data.lock().containers.items[0].state = State::Dead;
setup
@@ -2945,9 +2939,7 @@ mod tests {
})
.unwrap();
println!("{:?}", setup.terminal.backend().buffer());
// This is wrong
// This is wrong - why?
let expected = [
"╭─────────── ports ────────────╮",
"│ ip private public │",
@@ -2985,7 +2977,7 @@ mod tests {
// The whole layout //
// **************** //
#[test]
// Check that the whole layout is drawn correctly
/// Check that the whole layout is drawn correctly
fn test_draw_blocks_whole_layout() {
let (w, h) = (160, 30);
let mut setup = test_setup(w, h, true, true);
+6 -6
View File
@@ -109,19 +109,19 @@ impl BoxLocation {
) -> [Constraint; 3] {
match self {
Self::TopLeft | Self::MiddleLeft | Self::BottomLeft => [
Constraint::Max(text_width),
Constraint::Min(text_width),
Constraint::Max(blank_horizontal),
Constraint::Max(blank_horizontal),
],
Self::TopCentre | Self::MiddleCentre | Self::BottomCentre => [
Constraint::Max(blank_horizontal),
Constraint::Max(text_width),
Constraint::Min(text_width),
Constraint::Max(blank_horizontal),
],
Self::TopRight | Self::MiddleRight | Self::BottomRight => [
Constraint::Max(blank_horizontal),
Constraint::Max(blank_horizontal),
Constraint::Max(text_width),
Constraint::Min(text_width),
],
}
}
@@ -133,19 +133,19 @@ impl BoxLocation {
) -> [Constraint; 3] {
match self {
Self::TopLeft | Self::TopCentre | Self::TopRight => [
Constraint::Max(number_lines),
Constraint::Min(number_lines),
Constraint::Max(blank_vertical),
Constraint::Max(blank_vertical),
],
Self::MiddleLeft | Self::MiddleCentre | Self::MiddleRight => [
Constraint::Max(blank_vertical),
Constraint::Max(number_lines),
Constraint::Min(number_lines),
Constraint::Max(blank_vertical),
],
Self::BottomLeft | Self::BottomCentre | Self::BottomRight => [
Constraint::Max(blank_vertical),
Constraint::Max(blank_vertical),
Constraint::Max(number_lines),
Constraint::Min(number_lines),
],
}
}
+4 -3
View File
@@ -265,13 +265,14 @@ fn draw_frame(f: &mut Frame, app_data: &Arc<Mutex<AppData>>, gui_state: &Arc<Mut
let whole_layout = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Min(1), Constraint::Min(100)].as_ref())
.constraints([Constraint::Max(1), Constraint::Min(1)].as_ref())
.split(f.size());
// Split into 3, containers+controls, logs, then graphs
// This one is the issue!
let upper_main = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Max(fd.height), Constraint::Percentage(50)].as_ref())
.constraints([Constraint::Max(fd.height), Constraint::Min(1)].as_ref())
.split(whole_layout[1]);
let top_split = if fd.has_containers {
@@ -286,7 +287,7 @@ fn draw_frame(f: &mut Frame, app_data: &Arc<Mutex<AppData>>, gui_state: &Arc<Mut
.split(upper_main[0]);
let lower_split = if fd.has_containers {
vec![Constraint::Percentage(70), Constraint::Percentage(20)]
vec![Constraint::Percentage(70), Constraint::Percentage(30)]
} else {
vec![Constraint::Percentage(100)]
};