From f5b1e255d5e28d60e4f9ed4b201d03bb1fc9f9bc Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 9 Dec 2021 18:41:07 +0000 Subject: [PATCH] Making it so that schema always shows up for future work towards global variables and making it so that tabs selected can be bound to. --- packages/bbui/src/Tabs/Tabs.svelte | 17 ++- .../rest/[query]/index.svelte | 118 ++++++++++-------- 2 files changed, 79 insertions(+), 56 deletions(-) diff --git a/packages/bbui/src/Tabs/Tabs.svelte b/packages/bbui/src/Tabs/Tabs.svelte index c801ff44fd..235e103bb1 100644 --- a/packages/bbui/src/Tabs/Tabs.svelte +++ b/packages/bbui/src/Tabs/Tabs.svelte @@ -11,6 +11,8 @@ export let quiet = false export let emphasized = false + let thisSelected = undefined + let _id = id() const tab = writable({ title: selected, id: _id, emphasized }) setContext("tab", tab) @@ -20,9 +22,18 @@ const dispatch = createEventDispatcher() $: { - if ($tab.title !== selected) { - selected = $tab.title - dispatch("select", selected) + if (thisSelected !== selected) { + thisSelected = selected + dispatch("select", thisSelected) + } else if ($tab.title !== thisSelected) { + thisSelected = $tab.title + dispatch("select", thisSelected) + } + if ($tab.title !== thisSelected) { + tab.update(state => { + state.title = thisSelected + return state + }) } } diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte index 604ce22c22..64572280ca 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte @@ -124,6 +124,7 @@ notifications.info("Request did not return any data.") } else { response.info = response.info || { code: 200 } + schema = response.schema notifications.success("Request sent successfully.") } } catch (err) { @@ -243,7 +244,7 @@
- {#if !response} + {#if !response && Object.keys(schema).length === 0} Response
@@ -254,59 +255,70 @@
{:else} - - -
- + + {#if response} + +
+ +
+
+ {/if} + {#if schema || response} + + + + {/if} + {#if response} + +