Adding an error for XLSX type sheets not working, adding the sheets URL as an option for google config (should be added to redirect URL) and fixing some error states.

This commit is contained in:
mike12345567 2023-03-10 18:46:48 +00:00
parent 741d732795
commit 9037ab86d5
4 changed files with 27 additions and 8 deletions

View File

@ -35,7 +35,9 @@
await datasources.fetch()
$goto(`../../table/${table._id}`)
} catch (error) {
notifications.error("Error saving table")
notifications.error(
`Error saving table - ${error?.message || "unknown error"}`
)
}
}
</script>

View File

@ -4,7 +4,7 @@
import cloneDeep from "lodash/cloneDeepWith"
import GoogleButton from "../_components/GoogleButton.svelte"
import { saveDatasource as save } from "builderStore/datasource"
import { API } from "api"
import { organisation } from "stores/portal"
import { onMount } from "svelte"
export let integration
@ -12,11 +12,10 @@
// kill the reference so the input isn't saved
let datasource = cloneDeep(integration)
let isGoogleConfigured
$: isGoogleConfigured = !!$organisation.google
onMount(async () => {
const config = await API.getTenantConfig()
isGoogleConfigured = !!config?.config.google
await organisation.init()
})
</script>

View File

@ -47,8 +47,9 @@
$: googleCallbackTooltip = $admin.cloud
? null
: googleCallbackReadonly
? "Vist the organisation page to update the platform URL"
? "Visit the organisation page to update the platform URL"
: "Leave blank to use the default callback URL"
$: googleSheetsCallbackUrl = `${$organisation.platformUrl}/api/global/auth/datasource/google/callback`
$: GoogleConfigFields = {
Google: [
@ -62,6 +63,14 @@
placeholder: $organisation.googleCallbackUrl,
copyButton: true,
},
{
name: "sheetsURL",
label: "Sheets URL",
readonly: googleCallbackReadonly,
tooltip: googleCallbackTooltip,
placeholder: googleSheetsCallbackUrl,
copyButton: true,
},
],
}
@ -396,7 +405,11 @@
</Heading>
<Body size="S">
To allow users to authenticate using their Google accounts, fill out the
fields below.
fields below. Read the <Link
size="M"
href={"https://docs.budibase.com/docs/sso-with-google"}
>documentation</Link
> for more information.
</Body>
</Layout>
<Layout gap="XS" noPadding>

View File

@ -199,7 +199,12 @@ class GoogleSheetsIntegration implements DatasourcePlus {
this.client.useOAuth2Client(oauthClient)
await this.client.loadInfo()
} catch (err) {
} catch (err: any) {
// this happens for xlsx imports
if (err.message?.includes("operation is not supported")) {
err.message =
"This operation is not supported - XLSX sheets must be converted."
}
console.error("Error connecting to google sheets", err)
throw err
}