redirect to created datasource

This commit is contained in:
Peter Clement 2021-09-24 10:19:48 +01:00
parent 4c8a2b3a2d
commit b438b3d7b5
1 changed files with 4 additions and 3 deletions

View File

@ -1,10 +1,12 @@
<script> <script>
import { goto } from "@roxi/routify"
import { ModalContent, notifications } from "@budibase/bbui" import { ModalContent, notifications } from "@budibase/bbui"
import IntegrationConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte" import IntegrationConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte"
import { datasources, tables } from "stores/backend" import { datasources, tables } from "stores/backend"
import { IntegrationNames } from "constants" import { IntegrationNames } from "constants"
export let integration export let integration
function prepareData() { function prepareData() {
let datasource = {} let datasource = {}
let existingTypeCount = $datasources.list.filter( let existingTypeCount = $datasources.list.filter(
@ -31,8 +33,8 @@
if (integration.plus) { if (integration.plus) {
updateDatasourceSchema(resp) updateDatasourceSchema(resp)
} }
await datasources.select(resp["_id"]) await datasources.select(resp._id)
console.log($datasources) $goto(`./datasource/${resp._id}`)
notifications.success(`Datasource updated successfully.`) notifications.success(`Datasource updated successfully.`)
} catch (err) { } catch (err) {
notifications.error(`Error saving datasource: ${err}`) notifications.error(`Error saving datasource: ${err}`)
@ -42,7 +44,6 @@
async function updateDatasourceSchema(datasourceJson) { async function updateDatasourceSchema(datasourceJson) {
try { try {
await datasources.updateSchema(datasourceJson) await datasources.updateSchema(datasourceJson)
notifications.success(`Datasource ${name} tables updated successfully.`)
await tables.fetch() await tables.fetch()
} catch (err) { } catch (err) {
notifications.error(`Error updating datasource schema: ${err}`) notifications.error(`Error updating datasource schema: ${err}`)