From 5e7ba5dfb32a470526379a62b03999be6c60ffee Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 29 Apr 2021 09:01:24 +0100 Subject: [PATCH] Fix styles in datasource select --- .../PropertyControls/DataSourceSelect.svelte | 76 ++++++------------- 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte index 76b0a984bd..7c00f7465c 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte @@ -30,7 +30,7 @@ export let showAllQueries $: text = value?.label ?? "Choose an option" - $: tables = $tablesStore.list.map((m) => ({ + $: tables = $tablesStore.list.map(m => ({ label: m.name, tableId: m._id, type: "table", @@ -46,9 +46,9 @@ }, []) $: queries = $queriesStore.list .filter( - (query) => showAllQueries || query.queryVerb === "read" || query.readable + query => showAllQueries || query.queryVerb === "read" || query.readable ) - .map((query) => ({ + .map(query => ({ label: query.name, name: query.name, tableId: query._id, @@ -61,15 +61,15 @@ $currentAsset, $store.selectedComponentId ) - $: queryBindableProperties = bindableProperties.map((property) => ({ + $: queryBindableProperties = bindableProperties.map(property => ({ ...property, category: property.type === "instance" ? "Component" : "Table", label: property.readableBinding, path: property.readableBinding, })) $: links = bindableProperties - .filter((x) => x.fieldSchema?.type === "link") - .map((property) => { + .filter(x => x.fieldSchema?.type === "link") + .map(property => { return { providerId: property.providerId, label: property.readableBinding, @@ -89,7 +89,7 @@ } function fetchQueryDefinition(query) { - const source = $datasources.list.find((ds) => ds._id === query.datasourceId) + const source = $datasources.list.find(ds => ds._id === query.datasourceId) .source return $integrations[source].query[query.queryVerb] } @@ -100,20 +100,18 @@ readonly value={text} options={[text]} - on:click={dropdownRight.show} - /> - {#if value?.type === "query"} + on:click={dropdownRight.show} /> + {#if value?.type === 'query'} - + @@ -121,20 +119,15 @@ {#if value.parameters.length > 0} query._id === value._id) - .parameters} - bindings={queryBindableProperties} - /> + parameters={queries.find(query => query._id === value._id).parameters} + bindings={queryBindableProperties} /> {/if} ds._id === value.datasourceId - )} - editable={false} - /> + datasource={$datasources.list.find(ds => ds._id === value.datasourceId)} + editable={false} /> @@ -147,12 +140,7 @@
    {#each tables as table} -
  • handleSelected(table)} - > - {table.label} -
  • +
  • handleSelected(table)}>{table.label}
  • {/each}
@@ -161,12 +149,7 @@
    {#each views as view} -
  • handleSelected(view)} - > - {view.label} -
  • +
  • handleSelected(view)}>{view.label}
  • {/each}
@@ -175,12 +158,7 @@
    {#each links as link} -
  • handleSelected(link)} - > - {link.label} -
  • +
  • handleSelected(link)}>{link.label}
  • {/each}
@@ -191,8 +169,7 @@ {#each queries as query}
  • handleSelected(query)} - > + on:click={() => handleSelected(query)}> {query.label}
  • {/each} @@ -205,12 +182,7 @@
      {#each otherSources as source} -
    • handleSelected(source)} - > - {source.label} -
    • +
    • handleSelected(source)}>{source.label}
    • {/each}
    {/if} @@ -246,15 +218,15 @@ cursor: pointer; margin: 0px; padding: var(--spacing-s) var(--spacing-m); - font-size: var(--font-size-xs); + font-size: var(--font-size-m); } .selected { - background-color: var(--grey-4); + color: var(--spectrum-global-color-blue-600); } li:hover { - background-color: var(--grey-4); + background-color: var(--spectrum-global-color-gray-200); } .drawer-contents {