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
},
select: query => {
update(state => ({ ...state, selected: query._id }))
datasources.update(state => ({ ...state, selected: query.datasourceId }))
},
delete: async query => {

View File

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

View File

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