From 62acbc43fda898675344d11a8ae75d853d0974b2 Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Tue, 26 Sep 2023 12:27:27 +0100 Subject: [PATCH 1/2] Query UI improvements (#11881) * wip * wip * wip * wip * wip * wip * wip * wip * wip * linting * sidebar close icon, fix overflow issue with sidebar * better schema auto populating behavior * rename newqueryviewer * remove external datasource table * linting * wip * align header * fix needing to press the validate button twice * table min width * wip * remove loading * remove disabled * remove validation * lint * wip * fix json panel --- .../DataTable/ExternalDataSourceTable.svelte | 33 - .../src/components/design/Panel.svelte | 16 +- .../integration/ExtraQueryConfig.svelte | 41 +- .../integration/KeyValueBuilder.svelte | 11 +- .../components/integration/QueryViewer.svelte | 649 ++++++++++-------- .../QueryViewerBindingBuilder.svelte | 56 +- .../QueryViewerSavePromptModal.svelte | 53 ++ .../QueryViewerSidePanel/JSONPanel.svelte | 22 + .../QueryViewerSidePanel/PreviewPanel.svelte | 33 + .../QueryViewerSidePanel/SchemaPanel.svelte | 29 + .../QueryViewerSidePanel/index.svelte | 66 ++ .../src/components/integration/index.svelte | 5 +- .../query/new/[datasourceId]/index.svelte | 3 + 13 files changed, 624 insertions(+), 393 deletions(-) delete mode 100644 packages/builder/src/components/backend/DataTable/ExternalDataSourceTable.svelte create mode 100644 packages/builder/src/components/integration/QueryViewerSavePromptModal.svelte create mode 100644 packages/builder/src/components/integration/QueryViewerSidePanel/JSONPanel.svelte create mode 100644 packages/builder/src/components/integration/QueryViewerSidePanel/PreviewPanel.svelte create mode 100644 packages/builder/src/components/integration/QueryViewerSidePanel/SchemaPanel.svelte create mode 100644 packages/builder/src/components/integration/QueryViewerSidePanel/index.svelte diff --git a/packages/builder/src/components/backend/DataTable/ExternalDataSourceTable.svelte b/packages/builder/src/components/backend/DataTable/ExternalDataSourceTable.svelte deleted file mode 100644 index bc18bf1b41..0000000000 --- a/packages/builder/src/components/backend/DataTable/ExternalDataSourceTable.svelte +++ /dev/null @@ -1,33 +0,0 @@ - - -{#if error} -
{error}
-{/if} - - - diff --git a/packages/builder/src/components/design/Panel.svelte b/packages/builder/src/components/design/Panel.svelte index f649a9bd06..91ea3f98ad 100644 --- a/packages/builder/src/components/design/Panel.svelte +++ b/packages/builder/src/components/design/Panel.svelte @@ -12,11 +12,19 @@ export let borderLeft = false export let borderRight = false export let wide = false + export let extraWide = false + export let closeButtonIcon = "Close" $: customHeaderContent = $$slots["panel-header-content"] -
+
{#if showBackButton} @@ -33,7 +41,7 @@
{/if} {#if showCloseButton} - + {/if}
@@ -70,6 +78,10 @@ width: 310px; flex: 0 0 310px; } + .panel.extraWide { + width: 450px; + flex: 0 0 450px; + } .header { flex: 0 0 48px; display: flex; diff --git a/packages/builder/src/components/integration/ExtraQueryConfig.svelte b/packages/builder/src/components/integration/ExtraQueryConfig.svelte index 303beb1e4b..59b08c5b7a 100644 --- a/packages/builder/src/components/integration/ExtraQueryConfig.svelte +++ b/packages/builder/src/components/integration/ExtraQueryConfig.svelte @@ -18,31 +18,20 @@ {#each extraFields as { key, displayName, type }} -
- - {#if type === "string"} - populateExtraQuery(extraQueryFields)} - bind:value={extraQueryFields[key]} - /> - {/if} + + {#if type === "string"} + populateExtraQuery(extraQueryFields)} + bind:value={extraQueryFields[key]} + /> + {/if} - {#if type === "list"} - populateExtraQuery(extraQueryFields)} + bind:value={extraQueryFields[key]} + options={config[key].data[query.queryVerb]} + getOptionLabel={current => current} + /> + {/if} {/each} - - diff --git a/packages/builder/src/components/integration/KeyValueBuilder.svelte b/packages/builder/src/components/integration/KeyValueBuilder.svelte index 5d35498cfe..096d5c0f71 100644 --- a/packages/builder/src/components/integration/KeyValueBuilder.svelte +++ b/packages/builder/src/components/integration/KeyValueBuilder.svelte @@ -34,6 +34,7 @@ export let bindings = [] export let bindingDrawerLeft export let allowHelpers = true + export let customButtonText = null let fields = Object.entries(object || {}).map(([name, value]) => ({ name, @@ -158,9 +159,13 @@ {/if} {#if !readOnly && !noAddButton}
- Add{name ? ` ${lowercase(name)}` : ""} + + {#if customButtonText} + {customButtonText} + {:else} + {`Add${name ? ` ${lowercase(name)}` : ""}`} + {/if} +
{/if} diff --git a/packages/builder/src/components/integration/QueryViewer.svelte b/packages/builder/src/components/integration/QueryViewer.svelte index 4683bc6335..6e7ee52268 100644 --- a/packages/builder/src/components/integration/QueryViewer.svelte +++ b/packages/builder/src/components/integration/QueryViewer.svelte @@ -1,364 +1,443 @@ - { - navigateTo = null - }} -> - { - await saveQuery() - override = true - resumeNavigation() - }} - onCancel={async () => { - override = true - resumeNavigation() - }} - > - Leaving this section will mean losing and changes to your query - - - -
- - Query {integrationInfo?.friendlyName} - - Config -
-
- - { - let newValue = e.target.value || "" - if (newValue.match(ValidQueryNameRegex)) { - query.name = newValue.trim() - nameError = null - } else { - nameError = "Invalid query name" - } - }} - error={nameError} - /> -
- {#if queryConfig} -
- - { + let newValue = e.target.value || "" + if (newValue.match(ValidQueryNameRegex)) { + newQuery.name = newValue.trim() + nameError = null + } else { + nameError = "Invalid query name" + } + }} + error={nameError} + /> + {#if integration.query} + +