From 458c94c2ad362b1a6c31c2b1ee606a9f40605e06 Mon Sep 17 00:00:00 2001 From: Sergey Savelyev Date: Fri, 2 Jan 2026 12:29:35 -0800 Subject: [PATCH] Implement Fixes for Project Nautilus Integration (#12) **Rationale:** Some bugs were discovered in Project Nautilus integration. **Changes:** - Command and Telemetry paths now support `.` - Telemetry Values now work with Boolean types in the frontend - Constant Command Parameters no longer reset in the panel editor when you open the inspector Reviewed-on: https://gitea.sergeysav.com/sergeysav/telemetry_visualization/pulls/12 Co-authored-by: Sergey Savelyev Co-committed-by: Sergey Savelyev --- Cargo.toml | 9 +++++++- api-core/Cargo.toml | 4 ++-- api-proc-macro/Cargo.toml | 8 +++---- api/Cargo.toml | 8 +++---- examples/simple_command/Cargo.toml | 2 +- examples/simple_producer/Cargo.toml | 2 +- frontend/src/components/CommandInput.vue | 11 +++++---- .../CommandParameterListConfigurator.vue | 2 +- frontend/src/components/TelemetryValue.vue | 23 ++++++++----------- server/Cargo.toml | 6 ++--- server/src/http/api/cmd.rs | 4 ++-- server/src/http/api/tlm.rs | 2 +- 12 files changed, 43 insertions(+), 38 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8dfc5ec..3d9ccfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,10 +2,17 @@ members = ["api", "api-core", "api-proc-macro", "server", "examples/simple_producer", "examples/simple_command"] resolver = "2" +[workspace.package] +version = "0.1.0" +authors = ["Sergey "] + [workspace.dependencies] actix-web = "4.12.1" actix-ws = "0.3.0" anyhow = "1.0.100" +api = { path = "./api" } +api-core = { path = "./api-core" } +api-proc-macro = { path = "./api-proc-macro" } chrono = { version = "0.4.42" } derive_more = { version = "2.1.1" } env_logger = "0.11.8" @@ -22,8 +29,8 @@ sqlx = "0.8.6" syn = "2.0.112" thiserror = "2.0.17" tokio = { version = "1.48.0" } -tokio-test = "0.4.4" tokio-stream = "0.1.17" +tokio-test = "0.4.4" tokio-tungstenite = { version = "0.28.0" } tokio-util = "0.7.17" trybuild = "1.0.114" diff --git a/api-core/Cargo.toml b/api-core/Cargo.toml index bedaa3a..aff4b69 100644 --- a/api-core/Cargo.toml +++ b/api-core/Cargo.toml @@ -2,8 +2,8 @@ [package] name = "api-core" edition = "2021" -version = "0.1.0" -authors = ["Sergey "] +version.workspace = true +authors.workspace = true [dependencies] chrono = { workspace = true, features = ["serde"] } diff --git a/api-proc-macro/Cargo.toml b/api-proc-macro/Cargo.toml index da77f88..3f07294 100644 --- a/api-proc-macro/Cargo.toml +++ b/api-proc-macro/Cargo.toml @@ -2,18 +2,18 @@ [package] name = "api-proc-macro" edition = "2021" -version = "0.1.0" -authors = ["Sergey "] +version.workspace = true +authors.workspace = true [lib] proc-macro = true [dependencies] -api-core = { path = "../api-core" } +api-core = { workspace = true } proc-macro-error = { workspace = true } quote = { workspace = true } syn = { workspace = true } [dev-dependencies] -api = { path = "../api" } +api = { workspace = true } trybuild = { workspace = true } diff --git a/api/Cargo.toml b/api/Cargo.toml index 4ca8c50..9a26446 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -2,12 +2,12 @@ [package] name = "api" edition = "2021" -version = "0.1.0" -authors = ["Sergey "] +version.workspace = true +authors.workspace = true [dependencies] -api-core = { path = "../api-core" } -api-proc-macro = { path = "../api-proc-macro" } +api-core = { workspace = true } +api-proc-macro = { workspace = true } chrono = { workspace = true, features = ["serde"] } derive_more = { workspace = true, features = ["from", "try_into"] } futures-util = { workspace = true } diff --git a/examples/simple_command/Cargo.toml b/examples/simple_command/Cargo.toml index fdefbd1..330c48e 100644 --- a/examples/simple_command/Cargo.toml +++ b/examples/simple_command/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] anyhow = { workspace = true } -api = { path = "../../api" } +api = { workspace = true } env_logger = { workspace = true } log = { workspace = true } tokio = { workspace = true, features = ["rt-multi-thread", "signal"] } diff --git a/examples/simple_producer/Cargo.toml b/examples/simple_producer/Cargo.toml index c105fc6..ae0d148 100644 --- a/examples/simple_producer/Cargo.toml +++ b/examples/simple_producer/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] anyhow = { workspace = true } -api = { path = "../../api" } +api = { workspace = true } chrono = { workspace = true } env_logger = { workspace = true } futures-util = { workspace = true } diff --git a/frontend/src/components/CommandInput.vue b/frontend/src/components/CommandInput.vue index 32b8176..d41f532 100644 --- a/frontend/src/components/CommandInput.vue +++ b/frontend/src/components/CommandInput.vue @@ -23,10 +23,13 @@ const is_boolean = computed(() => { // Initialize the parameter to some value: onMounted(() => { - if (is_numeric.value) { - model.value = 0.0; - } else if (is_boolean.value) { - model.value = false; + if (model.value === undefined) { + if (is_numeric.value) { + model.value = 0.0; + } else if (is_boolean.value) { + debugger; + model.value = false; + } } }); diff --git a/frontend/src/components/CommandParameterListConfigurator.vue b/frontend/src/components/CommandParameterListConfigurator.vue index 1df1e6a..9eb0dc0 100644 --- a/frontend/src/components/CommandParameterListConfigurator.vue +++ b/frontend/src/components/CommandParameterListConfigurator.vue @@ -56,7 +56,7 @@ watch([command_info], ([cmd_info]) => { break; } } - if (!model_param_value) { + if (model_param_value === undefined) { let default_value: DynamicDataType = 0; if (isNumericType(param.data_type)) { default_value = 0; diff --git a/frontend/src/components/TelemetryValue.vue b/frontend/src/components/TelemetryValue.vue index e8dad87..39077bf 100644 --- a/frontend/src/components/TelemetryValue.vue +++ b/frontend/src/components/TelemetryValue.vue @@ -6,6 +6,8 @@ import { type WebsocketHandle, } from '@/composables/websocket.ts'; import NumericText from '@/components/NumericText.vue'; +import BooleanText from '@/components/BooleanText.vue'; +import { isBooleanType, isNumericType } from '@/composables/dynamic.ts'; const max_update_rate = 50; // ms const default_update_rate = 200; // ms @@ -33,30 +35,23 @@ const value = websocket.value.listen_to_telemetry( const is_data_present = computed(() => { return value.value != null; }); - -const numeric_data = computed(() => { - const val = value.value; - if (val) { - const type = telemetry_data.value!.data_type; - const item_val = val.value[type]; - if (typeof item_val == 'number') { - return item_val; - } - } - return null; -});