Ensure datasources are refreshed when loading the create screen modal
This commit is contained in:
parent
0e82f3be04
commit
ebf1fd5238
|
@ -1,11 +1,18 @@
|
||||||
<script>
|
<script>
|
||||||
import { store, selectedAccessRole } from "builderStore"
|
import { store, selectedAccessRole } from "builderStore"
|
||||||
import { ModalContent, Layout, Select, Divider } from "@budibase/bbui"
|
import {
|
||||||
|
ModalContent,
|
||||||
|
Layout,
|
||||||
|
Select,
|
||||||
|
Divider,
|
||||||
|
notifications,
|
||||||
|
} from "@budibase/bbui"
|
||||||
import { tables, datasources, roles } from "stores/backend"
|
import { tables, datasources, roles } from "stores/backend"
|
||||||
import getTemplates from "builderStore/store/screenTemplates"
|
import getTemplates from "builderStore/store/screenTemplates"
|
||||||
import ICONS from "../../backend/DatasourceNavigator/icons"
|
import ICONS from "../../backend/DatasourceNavigator/icons"
|
||||||
import { IntegrationNames } from "constants"
|
import { IntegrationNames } from "constants"
|
||||||
import analytics, { Events } from "analytics"
|
import analytics, { Events } from "analytics"
|
||||||
|
import { onMount } from "svelte"
|
||||||
|
|
||||||
export let onCancel
|
export let onCancel
|
||||||
export let onConfirm
|
export let onConfirm
|
||||||
|
@ -40,12 +47,25 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$: filteredSources = $datasources.list.reduce((acc, datasource) => {
|
$: filteredSources = Array.isArray($datasources.list)
|
||||||
if (datasource.source !== IntegrationNames.REST && datasource["entities"]) {
|
? $datasources.list.reduce((acc, datasource) => {
|
||||||
|
if (
|
||||||
|
datasource.source !== IntegrationNames.REST &&
|
||||||
|
datasource["entities"]
|
||||||
|
) {
|
||||||
acc.push(datasource)
|
acc.push(datasource)
|
||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, [])
|
}, [])
|
||||||
|
: []
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
try {
|
||||||
|
await datasources.fetch()
|
||||||
|
} catch (error) {
|
||||||
|
notifications.error("Error fetching datasources")
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
|
Loading…
Reference in New Issue