Changing reactivity a bit to make it a bit more understandable.

This commit is contained in:
mike12345567 2021-12-02 11:38:42 +00:00
parent 4de2d55112
commit 57169bc910
1 changed files with 6 additions and 9 deletions

View File

@ -27,6 +27,7 @@
$: integrationInfo = $integrations[datasourceType] $: integrationInfo = $integrations[datasourceType]
$: queryConfig = integrationInfo?.query $: queryConfig = integrationInfo?.query
$: url = buildUrl(url, breakQs) $: url = buildUrl(url, breakQs)
$: checkQueryName(url)
function getSelectedQuery() { function getSelectedQuery() {
return ( return (
@ -68,15 +69,14 @@
return str return str
} }
function checkQueryName(queryToCheck, inputUrl = null) { function checkQueryName(inputUrl = null) {
if (queryToCheck && (!queryToCheck.name || queryToCheck.flags.urlName)) { if (query && (!query.name || query.flags.urlName)) {
queryToCheck.flags.urlName = true query.flags.urlName = true
queryToCheck.name = url || inputUrl query.name = url || inputUrl
} }
} }
function buildUrl(base, qsObj) { function buildUrl(base, qsObj) {
console.log(base)
if (!base) { if (!base) {
return base return base
} }
@ -130,10 +130,7 @@
/> />
</div> </div>
<div class="url"> <div class="url">
<Input <Input bind:value={url} />
bind:value={url}
on:change={({ detail }) => checkQueryName(query, detail)}
/>
</div> </div>
<Button cta disabled={!url} on:click={saveQuery}>Send</Button> <Button cta disabled={!url} on:click={saveQuery}>Send</Button>
</div> </div>