From 33c36c1112a3f7d695a3a230d7190d22bf8d5e08 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 12 Oct 2022 15:31:53 +0100 Subject: [PATCH] Include stage templates --- .../src/components/integration/index.svelte | 19 +++++++++++++++++-- packages/server/src/integrations/mongodb.ts | 19 +++++++++++++++++++ packages/types/src/sdk/datasources.ts | 6 ++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/integration/index.svelte b/packages/builder/src/components/integration/index.svelte index c98746ae6e..d07f395a01 100644 --- a/packages/builder/src/components/integration/index.svelte +++ b/packages/builder/src/components/integration/index.svelte @@ -4,6 +4,7 @@ import { Label, Input, + Select, Divider, Layout, Icon, @@ -42,6 +43,19 @@ } } + function setEditorTemplate(fromKey, toKey, index) { + if ( + schema.steps.filter(step => step.key === fromKey)[0]?.template === + query.fields.steps[index].value.value + ) { + query.fields.steps[index].value.value = schema.steps.filter( + step => step.key === toKey + )[0]?.template + flowEditors[index].update(query.fields.steps[index].value.value) + } + query.fields.steps[index].key = toKey + } + $: shouldDisplayJsonBox = schema.type === QueryTypes.JSON && query.fields.extra?.actionType !== "flow" @@ -114,10 +128,11 @@
- s.key)} on:change={({ detail }) => { - query.fields.steps[index].key = detail + setEditorTemplate(step.key, detail, index) }} /> } export interface ExtraQueryConfig {