Display fields
This commit is contained in:
parent
47d6113fee
commit
fe86428cc4
|
@ -28,9 +28,11 @@
|
|||
nameStore.markActive()
|
||||
|
||||
if ((await configStore.validate()) && (await nameStore.validate())) {
|
||||
const { config } = get(configStore)
|
||||
const { name } = get(nameStore)
|
||||
return onSubmit({
|
||||
config: get(configStore).config,
|
||||
name: get(nameStore).name,
|
||||
config,
|
||||
name,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -115,13 +115,15 @@ export function createDatasourcesStore() {
|
|||
.length
|
||||
}
|
||||
|
||||
const isDatasourceInvalid = async (integration, datasource) => {
|
||||
const checkDatasourceValidity = async (integration, datasource) => {
|
||||
if (integration.features?.[DatasourceFeature.CONNECTION_CHECKING]) {
|
||||
const { connected } = await API.validateDatasource(datasource)
|
||||
if (!connected) return true
|
||||
}
|
||||
const { connected, error } = await API.validateDatasource(datasource)
|
||||
if (connected) {
|
||||
return
|
||||
}
|
||||
|
||||
return false
|
||||
throw new Error(`Unable to connect: ${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
const create = async ({ integration, config }) => {
|
||||
|
@ -136,7 +138,7 @@ export function createDatasourcesStore() {
|
|||
plus: integration.plus && integration.name !== IntegrationTypes.REST,
|
||||
}
|
||||
|
||||
if (await isDatasourceInvalid(integration, datasource)) {
|
||||
if (await checkDatasourceValidity(integration, datasource)) {
|
||||
throw new Error("Unable to connect")
|
||||
}
|
||||
|
||||
|
@ -150,7 +152,7 @@ export function createDatasourcesStore() {
|
|||
}
|
||||
|
||||
const update = async ({ integration, datasource }) => {
|
||||
if (await isDatasourceInvalid(integration, datasource)) {
|
||||
if (await checkDatasourceValidity(integration, datasource)) {
|
||||
throw new Error("Unable to connect")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue