Add sheets step
This commit is contained in:
parent
faf886f446
commit
e9d4dd51bb
|
@ -32,8 +32,9 @@
|
||||||
const integrationName = IntegrationNames[IntegrationTypes.GOOGLE_SHEETS]
|
const integrationName = IntegrationNames[IntegrationTypes.GOOGLE_SHEETS]
|
||||||
|
|
||||||
export const GoogleDatasouceConfigStep = {
|
export const GoogleDatasouceConfigStep = {
|
||||||
AUTH: "Auth",
|
AUTH: "auth",
|
||||||
SET_URL: "Set_url",
|
SET_URL: "set_url",
|
||||||
|
SET_SHEETS: "set_sheets",
|
||||||
}
|
}
|
||||||
|
|
||||||
let step = continueSetupId
|
let step = continueSetupId
|
||||||
|
@ -43,8 +44,11 @@
|
||||||
let isValid = false
|
let isValid = false
|
||||||
|
|
||||||
const modalConfig = {
|
const modalConfig = {
|
||||||
[GoogleDatasouceConfigStep.AUTH]: {},
|
[GoogleDatasouceConfigStep.AUTH]: {
|
||||||
|
title: `Connect to ${integrationName}`,
|
||||||
|
},
|
||||||
[GoogleDatasouceConfigStep.SET_URL]: {
|
[GoogleDatasouceConfigStep.SET_URL]: {
|
||||||
|
title: `Connect your spreadsheet`,
|
||||||
confirmButtonText: "Connect",
|
confirmButtonText: "Connect",
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
const checkConnection =
|
const checkConnection =
|
||||||
|
@ -57,14 +61,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
step = GoogleDatasouceConfigStep.SET_SHEETS
|
||||||
|
notifications.success(
|
||||||
|
checkConnection
|
||||||
|
? "Connection Successful"
|
||||||
|
: `Datasource created successfully.`
|
||||||
|
)
|
||||||
|
|
||||||
|
// prevent the modal from closing
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[GoogleDatasouceConfigStep.SET_SHEETS]: {
|
||||||
|
title: `Choose your sheets`,
|
||||||
|
confirmButtonText: "Fetch sheets",
|
||||||
|
onConfirm: async () => {
|
||||||
try {
|
try {
|
||||||
const resp = await saveDatasource(datasource)
|
const resp = await saveDatasource(datasource)
|
||||||
$goto(`./datasource/${resp._id}`)
|
$goto(`./datasource/${resp._id}`)
|
||||||
notifications.success(
|
notifications.success(`Datasource created successfully.`)
|
||||||
checkConnection
|
|
||||||
? "Connection Successful"
|
|
||||||
: `Datasource created successfully.`
|
|
||||||
)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error(err?.message ?? "Error saving datasource")
|
notifications.error(err?.message ?? "Error saving datasource")
|
||||||
// prevent the modal from closing
|
// prevent the modal from closing
|
||||||
|
@ -76,7 +91,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title={`Connect to ${integrationName}`}
|
title={modalConfig[step].title}
|
||||||
cancelText="Cancel"
|
cancelText="Cancel"
|
||||||
size="L"
|
size="L"
|
||||||
confirmText={modalConfig[step].confirmButtonText}
|
confirmText={modalConfig[step].confirmButtonText}
|
||||||
|
@ -113,4 +128,9 @@
|
||||||
/>
|
/>
|
||||||
</Layout>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if step === GoogleDatasouceConfigStep.SET_SHEETS}
|
||||||
|
<Layout noPadding no>
|
||||||
|
<Body size="S">Select which spreadsheet you want to connect.</Body>
|
||||||
|
</Layout>
|
||||||
|
{/if}
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
Loading…
Reference in New Issue