From 53b2fd442b1fef5bb3fd41e9ce7633f86756e738 Mon Sep 17 00:00:00 2001 From: Jonathan Baecker Date: Mon, 14 Oct 2024 12:27:55 +0200 Subject: [PATCH] better advanced config form --- engine/src/utils/advanced_config.rs | 46 ++- engine/src/utils/config.rs | 4 +- frontend/components/ConfigAdvanced.vue | 448 +++++++++++++++++++++++-- frontend/components/ConfigPlayout.vue | 169 +++++++--- frontend/components/ConfigUser.vue | 15 +- frontend/i18n/locales/de-DE.js | 60 ++-- frontend/i18n/locales/en-US.js | 46 ++- frontend/i18n/locales/pt-BR.js | 60 ++-- frontend/i18n/locales/ru-RU.js | 59 ++-- frontend/pages/configure.vue | 14 +- frontend/stores/config.ts | 3 +- frontend/types/advanced_config.d.ts | 11 + frontend/types/index.d.ts | 1 + frontend/types/playout_config.d.ts | 2 +- 14 files changed, 749 insertions(+), 189 deletions(-) create mode 100644 frontend/types/advanced_config.d.ts diff --git a/engine/src/utils/advanced_config.rs b/engine/src/utils/advanced_config.rs index 9301486f..a22b91f3 100644 --- a/engine/src/utils/advanced_config.rs +++ b/engine/src/utils/advanced_config.rs @@ -5,11 +5,13 @@ use serde_with::{serde_as, NoneAsEmptyString}; use shlex::split; use sqlx::{Pool, Sqlite}; use tokio::io::AsyncReadExt; +use ts_rs::TS; use crate::db::{handles, models::AdvancedConfiguration}; use crate::utils::ServiceError; -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct AdvancedConfig { pub decoder: DecoderConfig, pub encoder: EncoderConfig, @@ -18,81 +20,115 @@ pub struct AdvancedConfig { } #[serde_as] -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct DecoderConfig { + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub input_param: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub output_param: Option, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub input_cmd: Option>, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub output_cmd: Option>, } #[serde_as] -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct EncoderConfig { + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub input_param: Option, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub input_cmd: Option>, } #[serde_as] -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct IngestConfig { + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub input_param: Option, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub input_cmd: Option>, } #[serde_as] -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct FilterConfig { + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub deinterlace: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub pad_scale_w: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub pad_scale_h: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub pad_video: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub fps: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub scale: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub set_dar: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub fade_in: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub fade_out: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub overlay_logo_scale: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub overlay_logo_fade_in: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub overlay_logo_fade_out: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub overlay_logo: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub tpad: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub drawtext_from_file: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub drawtext_from_zmq: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub aevalsrc: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub afade_in: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub afade_out: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub apad: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub volume: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub split: Option, } diff --git a/engine/src/utils/config.rs b/engine/src/utils/config.rs index 0dc57df3..1d248389 100644 --- a/engine/src/utils/config.rs +++ b/engine/src/utils/config.rs @@ -454,8 +454,7 @@ pub struct Storage { pub filler_path: PathBuf, pub extensions: Vec, pub shuffle: bool, - #[ts(skip)] - #[serde(skip_serializing, skip_deserializing)] + #[serde(skip_deserializing)] pub shared_storage: bool, } @@ -490,7 +489,6 @@ pub struct Text { #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub zmq_server_socket: Option, - #[ts(rename = "font")] #[serde(alias = "fontfile")] pub font: String, #[ts(skip)] diff --git a/frontend/components/ConfigAdvanced.vue b/frontend/components/ConfigAdvanced.vue index 9f497575..d0d483ff 100644 --- a/frontend/components/ConfigAdvanced.vue +++ b/frontend/components/ConfigAdvanced.vue @@ -1,5 +1,5 @@