From f8fed98b682d302283bfadcc4a98a080df3ad21b Mon Sep 17 00:00:00 2001 From: cdxker Date: Tue, 17 Dec 2024 20:24:36 -0800 Subject: [PATCH] feature: add options to removeTriggers and add zIndex to the PublicPageSettings --- clients/ts-sdk/openapi.json | 9 +++ clients/ts-sdk/src/types.gen.ts | 2 + .../src/pages/dataset/PublicPageSettings.tsx | 60 ++++++++++++++++++- server/src/data/models.rs | 3 + server/src/handlers/page_handler.rs | 2 + 5 files changed, 74 insertions(+), 2 deletions(-) diff --git a/clients/ts-sdk/openapi.json b/clients/ts-sdk/openapi.json index 9f548e730..060b29a42 100644 --- a/clients/ts-sdk/openapi.json +++ b/clients/ts-sdk/openapi.json @@ -6977,6 +6977,10 @@ "mode": { "type": "string" }, + "removeTriggers": { + "type": "boolean", + "nullable": true + }, "selector": { "type": "string" } @@ -12447,6 +12451,11 @@ "useGroupSearch": { "type": "boolean", "nullable": true + }, + "zIndex": { + "type": "integer", + "format": "int32", + "nullable": true } } }, diff --git a/clients/ts-sdk/src/types.gen.ts b/clients/ts-sdk/src/types.gen.ts index 4532bbd5c..4da65f5c7 100644 --- a/clients/ts-sdk/src/types.gen.ts +++ b/clients/ts-sdk/src/types.gen.ts @@ -132,6 +132,7 @@ export type BulkDeleteChunkPayload = { export type ButtonTrigger = { mode: string; + removeTriggers?: (boolean) | null; selector: string; }; @@ -2081,6 +2082,7 @@ export type PublicPageParameters = { type?: (string) | null; useGroupSearch?: (boolean) | null; videoLink?: (string) | null; + zIndex?: (number) | null; }; export type PublicPageSearchOptions = { diff --git a/frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx b/frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx index 5902a2363..bc56ac765 100644 --- a/frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx +++ b/frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx @@ -559,7 +559,7 @@ const PublicPageControls = () => { /> { return `${trigger.selector},${trigger.mode}`; @@ -569,10 +569,18 @@ const PublicPageControls = () => { setExtraParams( "buttonTriggers", e.map((trigger) => { - const [selector, mode] = trigger.split(","); + const [selector, mode, replace] = trigger.split(","); + if (replace) { + return { + selector, + mode, + removeTriggers: replace === "true", + }; + } return { selector, mode, + removeTriggers: false, }; }), ); @@ -779,6 +787,54 @@ const PublicPageControls = () => { options={["search", "chat"]} /> +
+
+ + + } + /> +
+ { + setExtraParams( + "zIndex", + parseInt(e.currentTarget.value), + ); + }} + class="block w-full rounded border border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6" + /> +
diff --git a/server/src/data/models.rs b/server/src/data/models.rs index 75863f02d..a8e88c26e 100644 --- a/server/src/data/models.rs +++ b/server/src/data/models.rs @@ -3195,6 +3195,9 @@ impl DatasetConfigurationDTO { brand_font_family: page_parameters_self .brand_font_family .or(page_parameters_curr.brand_font_family), + z_index: page_parameters_self + .z_index + .or(page_parameters_curr.z_index), video_link: page_parameters_self .video_link .or(page_parameters_curr.video_link), diff --git a/server/src/handlers/page_handler.rs b/server/src/handlers/page_handler.rs index 111fec622..2e9dc8e43 100644 --- a/server/src/handlers/page_handler.rs +++ b/server/src/handlers/page_handler.rs @@ -245,6 +245,8 @@ pub struct PublicPageParameters { #[serde(skip_serializing_if = "Option::is_none")] pub brand_font_family: Option, #[serde(skip_serializing_if = "Option::is_none")] + pub z_index: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub video_link: Option, }