commit
18421431ba
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { goto, beforeUrlChange } from "@roxi/routify"
|
import { goto } from "@roxi/routify"
|
||||||
import { Button, Heading, Body, Divider, Layout, Modal } from "@budibase/bbui"
|
import { Button, Heading, Body, Divider, Layout, Modal } from "@budibase/bbui"
|
||||||
import { datasources, integrations, queries, tables } from "stores/backend"
|
import { datasources, integrations, queries, tables } from "stores/backend"
|
||||||
import { notifications } from "@budibase/bbui"
|
import { notifications } from "@budibase/bbui"
|
||||||
|
@ -9,7 +9,6 @@
|
||||||
import ICONS from "components/backend/DatasourceNavigator/icons"
|
import ICONS from "components/backend/DatasourceNavigator/icons"
|
||||||
import { capitalise } from "helpers"
|
import { capitalise } from "helpers"
|
||||||
|
|
||||||
let unsaved = false
|
|
||||||
let relationshipModal
|
let relationshipModal
|
||||||
let displayColumnModal
|
let displayColumnModal
|
||||||
let selectedFromRelationship, selectedToRelationship
|
let selectedFromRelationship, selectedToRelationship
|
||||||
|
@ -71,7 +70,6 @@
|
||||||
// Create datasource
|
// Create datasource
|
||||||
await datasources.save(datasource)
|
await datasources.save(datasource)
|
||||||
notifications.success(`Datasource ${name} updated successfully.`)
|
notifications.success(`Datasource ${name} updated successfully.`)
|
||||||
unsaved = false
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error(`Error saving datasource: ${err}`)
|
notifications.error(`Error saving datasource: ${err}`)
|
||||||
}
|
}
|
||||||
|
@ -81,7 +79,6 @@
|
||||||
try {
|
try {
|
||||||
await datasources.updateSchema(datasource)
|
await datasources.updateSchema(datasource)
|
||||||
notifications.success(`Datasource ${name} tables updated successfully.`)
|
notifications.success(`Datasource ${name} tables updated successfully.`)
|
||||||
unsaved = false
|
|
||||||
await tables.fetch()
|
await tables.fetch()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error(`Error updating datasource schema: ${err}`)
|
notifications.error(`Error updating datasource schema: ${err}`)
|
||||||
|
@ -98,10 +95,6 @@
|
||||||
$goto(`../../table/${table._id}`)
|
$goto(`../../table/${table._id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUnsaved() {
|
|
||||||
unsaved = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function openRelationshipModal(fromRelationship, toRelationship) {
|
function openRelationshipModal(fromRelationship, toRelationship) {
|
||||||
selectedFromRelationship = fromRelationship || {}
|
selectedFromRelationship = fromRelationship || {}
|
||||||
selectedToRelationship = toRelationship || {}
|
selectedToRelationship = toRelationship || {}
|
||||||
|
@ -111,16 +104,6 @@
|
||||||
function openDisplayColumnModal() {
|
function openDisplayColumnModal() {
|
||||||
displayColumnModal.show()
|
displayColumnModal.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUrlChange(() => {
|
|
||||||
if (unsaved) {
|
|
||||||
notifications.error(
|
|
||||||
"Unsaved changes. Please save your datasource configuration before leaving."
|
|
||||||
)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal bind:this={relationshipModal}>
|
<Modal bind:this={relationshipModal}>
|
||||||
|
@ -164,7 +147,6 @@
|
||||||
<IntegrationConfigForm
|
<IntegrationConfigForm
|
||||||
schema={integration.datasource}
|
schema={integration.datasource}
|
||||||
integration={datasource.config}
|
integration={datasource.config}
|
||||||
on:change={setUnsaved}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if datasource.plus}
|
{#if datasource.plus}
|
||||||
|
|
|
@ -37,7 +37,11 @@
|
||||||
async function uploadLogo(file) {
|
async function uploadLogo(file) {
|
||||||
let data = new FormData()
|
let data = new FormData()
|
||||||
data.append("file", file)
|
data.append("file", file)
|
||||||
const res = await post("/api/global/configs/upload/settings/logo", data, {})
|
const res = await post(
|
||||||
|
"/api/admin/configs/upload/settings/logoUrl",
|
||||||
|
data,
|
||||||
|
{}
|
||||||
|
)
|
||||||
return await res.json()
|
return await res.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue