Validate onboarding

This commit is contained in:
Adria Navarro 2023-05-24 11:07:49 +02:00
parent 237cda064c
commit d3eb262bed
1 changed files with 19 additions and 0 deletions

View File

@ -18,6 +18,8 @@
import { Roles } from "constants/backend" import { Roles } from "constants/backend"
import Spinner from "components/common/Spinner.svelte" import Spinner from "components/common/Spinner.svelte"
import { helpers } from "@budibase/shared-core" import { helpers } from "@budibase/shared-core"
import { validateDatasourceConfig } from "builderStore/datasource"
import { DatasourceFeature } from "@budibase/types"
let name = "My first app" let name = "My first app"
let url = "my-first-app" let url = "my-first-app"
@ -108,7 +110,24 @@
isGoogle, isGoogle,
}) => { }) => {
let app let app
try { try {
if (
datasourceConfig &&
plusIntegrations[stage].features[DatasourceFeature.CONNECTION_CHECKING]
) {
const resp = await validateDatasourceConfig({
config: datasourceConfig,
type: stage,
})
if (!resp.connected) {
notifications.error(
`Unable to connect - ${resp.error ?? "Error validating datasource"}`
)
return false
}
}
app = await createApp(useSampleData) app = await createApp(useSampleData)
let datasource let datasource