replace use of datasources.save with datasources.update
This commit is contained in:
parent
f3d5e2b4a0
commit
88582b871e
|
@ -1,8 +1,10 @@
|
|||
<script>
|
||||
import { get } from "svelte/store"
|
||||
import { ActionButton, Modal, notifications } from "@budibase/bbui"
|
||||
import CreateEditRelationship from "../../Datasources/CreateEditRelationship.svelte"
|
||||
import { datasources } from "../../../../stores/backend"
|
||||
import { datasources, integrations } from "../../../../stores/backend"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { integrationForDatasource } from "stores/selectors"
|
||||
|
||||
export let table
|
||||
const dispatch = createEventDispatcher()
|
||||
|
@ -27,7 +29,10 @@
|
|||
async function saveRelationship() {
|
||||
try {
|
||||
// Create datasource
|
||||
await datasources.save(datasource)
|
||||
await datasources.update({
|
||||
datasource,
|
||||
integration: integrationForDatasource(get(integrations), datasource),
|
||||
})
|
||||
notifications.success(`Relationship information saved.`)
|
||||
dispatch("updatecolumns")
|
||||
} catch (err) {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<script>
|
||||
import { datasources } from "stores/backend"
|
||||
import { get } from "svelte/store"
|
||||
import { datasources, integrations } from "stores/backend"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { Input, ModalContent, Modal } from "@budibase/bbui"
|
||||
import { integrationForDatasource } from "stores/selectors"
|
||||
|
||||
let error = ""
|
||||
let modal
|
||||
|
@ -32,7 +34,10 @@
|
|||
...datasource,
|
||||
name,
|
||||
}
|
||||
await datasources.save(updatedDatasource)
|
||||
await datasources.update({
|
||||
datasource: updatedDatasource,
|
||||
integration: integrationForDatasource(get(integrations), datasource),
|
||||
})
|
||||
notifications.success(`Datasource ${name} updated successfully.`)
|
||||
hide()
|
||||
}
|
||||
|
|
|
@ -176,7 +176,10 @@
|
|||
notifications.success(`Request saved successfully`)
|
||||
if (dynamicVariables) {
|
||||
datasource.config.dynamicVariables = rebuildVariables(saveId)
|
||||
datasource = await datasources.save(datasource)
|
||||
datasource = await datasources.update({
|
||||
integration: integrationInfo,
|
||||
datasource,
|
||||
})
|
||||
}
|
||||
prettifyQueryRequestBody(
|
||||
query,
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
const saveDatasource = async () => {
|
||||
try {
|
||||
// Create datasource
|
||||
await datasources.save(datasource)
|
||||
await datasources.update({ datasource, integration })
|
||||
if (datasource?.plus) {
|
||||
await tables.fetch()
|
||||
}
|
||||
|
|
|
@ -122,6 +122,7 @@ export function createDatasourcesStore() {
|
|||
}
|
||||
|
||||
const update = async ({ integration, datasource }) => {
|
||||
console.log(integration, datasource)
|
||||
if (await isDatasourceInvalid(integration, datasource)) {
|
||||
throw new Error("Unable to connect")
|
||||
}
|
||||
|
@ -131,17 +132,6 @@ export function createDatasourcesStore() {
|
|||
return updateDatasource(response)
|
||||
}
|
||||
|
||||
// TODO deprecate
|
||||
const save = async datasource => {
|
||||
if (await isDatasourceInvalid(datasource)) {
|
||||
throw new Error("Unable to connect")
|
||||
}
|
||||
|
||||
const response = await API.updateDatasource(datasource)
|
||||
|
||||
return updateDatasource(response)
|
||||
}
|
||||
|
||||
const deleteDatasource = async datasource => {
|
||||
await API.deleteDatasource({
|
||||
datasourceId: datasource?._id,
|
||||
|
@ -213,7 +203,6 @@ export function createDatasourcesStore() {
|
|||
updateSchema,
|
||||
create,
|
||||
update,
|
||||
save,
|
||||
delete: deleteDatasource,
|
||||
removeSchemaError,
|
||||
replaceDatasource,
|
||||
|
|
Loading…
Reference in New Issue