fixes issues with queries not getting selected correctly

This commit is contained in:
Keviin Åberg Kultalahti 2021-03-23 10:56:53 +01:00
parent 526283d406
commit c441307611
3 changed files with 6 additions and 4 deletions

View File

@ -49,6 +49,7 @@ function createQueriesStore() {
return json return json
}, },
select: query => { select: query => {
update(state => ({ ...state, selected: query._id }))
datasources.update(state => ({ ...state, selected: query.datasourceId })) datasources.update(state => ({ ...state, selected: query.datasourceId }))
}, },
delete: async query => { delete: async query => {

View File

@ -24,6 +24,8 @@
datasources.fetch() datasources.fetch()
queries.fetch() queries.fetch()
}) })
$: console.log($queries)
</script> </script>
{#if $database?._id} {#if $database?._id}

View File

@ -1,7 +1,6 @@
<script> <script>
import { params } from "@sveltech/routify" import { params } from "@sveltech/routify"
import { backendUiStore } from "builderStore" import { database, queries } from 'builderStore/store/backend/'
import { queries } from 'builderStore/store/backend/'
import QueryInterface from "components/integration/QueryViewer.svelte" import QueryInterface from "components/integration/QueryViewer.svelte"
async function fetchQueryConfig() { async function fetchQueryConfig() {
@ -16,7 +15,7 @@
} }
$: selectedQuery = $queries.list.find( $: selectedQuery = $queries.list.find(
query => query._id === $backendUiStore.selectedQueryId query => query._id === $queries.selected
) || { ) || {
datasourceId: $params.selectedDatasource, datasourceId: $params.selectedDatasource,
parameters: [], parameters: [],
@ -27,7 +26,7 @@
<section> <section>
<div class="inner"> <div class="inner">
{#if $backendUiStore.selectedDatabase._id && selectedQuery} {#if $database._id && selectedQuery}
<QueryInterface query={selectedQuery} /> <QueryInterface query={selectedQuery} />
{/if} {/if}
</div> </div>