From bd7c6a2a46047de5fe89753decdfdf1f4851ee3f Mon Sep 17 00:00:00 2001 From: Guilhem Date: Wed, 16 Apr 2025 23:21:00 +0100 Subject: [PATCH] fix(frontend): postgres remove selectedTable (#5386) * remove selectedTable * add deletion options * fix select * add delete option for replication slot and fixed type conversion for timestampz * fix delete active slot * fix undefined error and add schema display --------- Co-authored-by: dieriba Co-authored-by: dieriba --- backend/windmill-api/src/postgres_triggers/handler.rs | 7 ++++--- .../triggers/postgres/PostgresEditorConfigSection.svelte | 1 - .../triggers/postgres/PostgresTriggerEditorInner.svelte | 7 +++---- .../lib/components/triggers/postgres/RelationPicker.svelte | 7 ++++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/windmill-api/src/postgres_triggers/handler.rs b/backend/windmill-api/src/postgres_triggers/handler.rs index 69fe8604f2..fcb5a934ff 100644 --- a/backend/windmill-api/src/postgres_triggers/handler.rs +++ b/backend/windmill-api/src/postgres_triggers/handler.rs @@ -30,9 +30,10 @@ use windmill_common::{ }; use super::{ - create_logical_replication_slot_query, create_publication_query, drop_publication_query, - generate_random_string, get_database_connection, get_raw_postgres_connection, - ERROR_PUBLICATION_NAME_NOT_EXISTS, ERROR_REPLICATION_SLOT_NOT_EXISTS, + create_logical_replication_slot_query, create_publication_query, + drop_logical_replication_slot_query, drop_publication_query, generate_random_string, + get_database_connection, get_raw_postgres_connection, ERROR_PUBLICATION_NAME_NOT_EXISTS, + ERROR_REPLICATION_SLOT_NOT_EXISTS, }; use lazy_static::lazy_static; diff --git a/frontend/src/lib/components/triggers/postgres/PostgresEditorConfigSection.svelte b/frontend/src/lib/components/triggers/postgres/PostgresEditorConfigSection.svelte index 29172d031a..9ed430bcee 100644 --- a/frontend/src/lib/components/triggers/postgres/PostgresEditorConfigSection.svelte +++ b/frontend/src/lib/components/triggers/postgres/PostgresEditorConfigSection.svelte @@ -35,7 +35,6 @@ export let publication: PublicationData = DEFAULT_PUBLICATION function updateValidity(publication: PublicationData) { - console.log({ publication }) isValid = !emptyString(postgres_resource_path) && (!publication.table_to_track || publication.table_to_track.length === 0) diff --git a/frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte b/frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte index 4956808907..988152f00c 100644 --- a/frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte +++ b/frontend/src/lib/components/triggers/postgres/PostgresTriggerEditorInner.svelte @@ -45,7 +45,7 @@ let postgres_resource_path = '' let publication_name: string = '' let replication_slot_name: string = '' - let relations: Relations[] = [] + let relations: Relations[] | undefined = [] let transaction_to_track: string[] = [] let language: Language = 'Typescript' let loading = false @@ -247,11 +247,10 @@ } const getTemplateScript = async () => { - if (relations.length === 0 || emptyString(postgres_resource_path)) { + if (!relations || relations.length === 0 || emptyString(postgres_resource_path)) { sendUserToast('You must pick a database resource and choose at least one schema', true) return } - try { loading = true let templateId = await PostgresTriggerService.createTemplateScript({ @@ -359,7 +358,7 @@ allowRefresh /> - {#if script_path === undefined && is_flow === false} + {#if emptyStringTrimmed(script_path) && is_flow === false}
{/each} - {:else if relations} + {/if} + {#if selected === 'specific'}