diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2024-07-15 19:12:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-15 19:12:01 +0100 |
| commit | 7eb985b616c12aed261fbef74a47c5a928c03e61 (patch) | |
| tree | fe3088dc687c640176bf376b4ca8baf2088bd69f /ui/backend | |
| parent | chore(deps): bump cachix/install-nix-action from 20 to 27 (#2268) (diff) | |
| download | atuin-7eb985b616c12aed261fbef74a47c5a928c03e61.zip | |
feat(gui): add runbook list, ability to create and delete, sql storage (#2282)
* wip
* saving works :))
* functioning delete button
* persist selection properly
Diffstat (limited to 'ui/backend')
| -rw-r--r-- | ui/backend/Cargo.lock | 90 | ||||
| -rw-r--r-- | ui/backend/Cargo.toml | 3 | ||||
| -rw-r--r-- | ui/backend/src/main.rs | 6 | ||||
| -rw-r--r-- | ui/backend/src/run/migrations.rs | 13 | ||||
| -rw-r--r-- | ui/backend/src/run/mod.rs | 1 | ||||
| -rw-r--r-- | ui/backend/tauri.conf.json | 2 |
6 files changed, 100 insertions, 15 deletions
diff --git a/ui/backend/Cargo.lock b/ui/backend/Cargo.lock index 105ad65f..7c678a32 100644 --- a/ui/backend/Cargo.lock +++ b/ui/backend/Cargo.lock @@ -141,6 +141,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] name = "argon2" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -349,6 +358,7 @@ dependencies = [ "base64 0.22.1", "clap", "config", + "crossterm", "crypto_secretbox", "directories", "eyre", @@ -360,9 +370,11 @@ dependencies = [ "indicatif", "interim", "itertools", + "lazy_static", "log", "memchr", "minspan", + "palette", "rand 0.8.5", "regex", "reqwest 0.11.27", @@ -378,6 +390,8 @@ dependencies = [ "shellexpand", "sql-builder", "sqlx", + "strum", + "strum_macros", "thiserror", "time", "tiny-bip39", @@ -610,6 +624,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] +name = "by_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" + +[[package]] name = "bytemuck" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1687,6 +1707,12 @@ dependencies = [ ] [[package]] +name = "fast-srgb8" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1" + +[[package]] name = "fastrand" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1746,7 +1772,7 @@ checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ "futures-core", "futures-sink", - "spin 0.9.8", + "spin", ] [[package]] @@ -2950,11 +2976,11 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin", ] [[package]] @@ -3687,6 +3713,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] +name = "palette" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbf71184cc5ecc2e4e1baccdb21026c20e5fc3dcf63028a086131b3ab00b6e6" +dependencies = [ + "approx", + "fast-srgb8", + "palette_derive", + "phf 0.11.2", + "serde", +] + +[[package]] +name = "palette_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5030daf005bface118c096f510ffb781fc28f9ab6a32ab224d8631be6851d30" +dependencies = [ + "by_address", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] name = "pango" version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4473,7 +4524,7 @@ dependencies = [ "cfg-if", "getrandom 0.2.15", "libc", - "spin 0.9.8", + "spin", "untrusted", "windows-sys 0.52.0", ] @@ -5202,12 +5253,6 @@ dependencies = [ [[package]] name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" @@ -5522,6 +5567,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.66", +] + +[[package]] name = "subtle" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6484,6 +6551,7 @@ dependencies = [ "cocoa", "comrak", "eyre", + "lazy_static", "nix 0.29.0", "portable-pty", "serde", diff --git a/ui/backend/Cargo.toml b/ui/backend/Cargo.toml index 3e4c61ca..9df8dfb5 100644 --- a/ui/backend/Cargo.toml +++ b/ui/backend/Cargo.toml @@ -18,7 +18,7 @@ atuin-dotfiles = { path = "../../crates/atuin-dotfiles", version = "0.4.0" } atuin-history = { path = "../../crates/atuin-history", version = "0.3.0" } eyre = "0.6" -tauri = { version = "2.0.0-beta", features = [ "tray-icon"] } +tauri = { version = "2.0.0-beta", features = ["tray-icon"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" time = "0.3.36" @@ -33,6 +33,7 @@ portable-pty = "0.8.1" vt100 = "0.15.2" bytes = "1.6.0" nix = "0.29.0" +lazy_static = "1.5.0" [target."cfg(target_os = \"macos\")".dependencies] cocoa = "0.25" diff --git a/ui/backend/src/main.rs b/ui/backend/src/main.rs index 147bf413..cff9558a 100644 --- a/ui/backend/src/main.rs +++ b/ui/backend/src/main.rs @@ -284,12 +284,16 @@ fn main() { dotfiles::vars::delete_var, dotfiles::vars::set_var, ]) - .plugin(tauri_plugin_sql::Builder::default().build()) + .plugin(tauri_plugin_sql::Builder::default().add_migrations("sqlite:runbooks.db", run::migrations::migrations()).build()) .plugin(tauri_plugin_http::init()) .plugin(tauri_plugin_single_instance::init(|app, args, cwd| { let _ = show_window(app); + })) .manage(state::AtuinState::default()) + .setup(|app|{ + Ok(()) + }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/ui/backend/src/run/migrations.rs b/ui/backend/src/run/migrations.rs new file mode 100644 index 00000000..3516e62a --- /dev/null +++ b/ui/backend/src/run/migrations.rs @@ -0,0 +1,13 @@ +use lazy_static::lazy_static; +use tauri_plugin_sql::{Builder, Migration, MigrationKind}; + +pub fn migrations() -> Vec<Migration> { + vec![ + Migration { + version: 1, + description: "create_initial_tables", + sql: "CREATE TABLE runbooks(id string PRIMARY KEY, name TEXT, content TEXT, created bigint, updated bigint);", + kind: MigrationKind::Up, + } + ] +} diff --git a/ui/backend/src/run/mod.rs b/ui/backend/src/run/mod.rs index 5ece0912..a7a28497 100644 --- a/ui/backend/src/run/mod.rs +++ b/ui/backend/src/run/mod.rs @@ -1 +1,2 @@ +pub mod migrations; pub mod pty; diff --git a/ui/backend/tauri.conf.json b/ui/backend/tauri.conf.json index c8565721..7eda7ca7 100644 --- a/ui/backend/tauri.conf.json +++ b/ui/backend/tauri.conf.json @@ -14,8 +14,6 @@ "title": "Atuin", "width": 1200, "height": 800, - "minWidth": 1000, - "minHeight": 500, "titleBarStyle": "Overlay", "hiddenTitle": true } |
