Merge pull request #10846 from Budibase/budi-6945/display_errors
Display inline errors
This commit is contained in:
commit
25af2cf3eb
1 changed files with 23 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
Link,
|
Link,
|
||||||
notifications,
|
notifications,
|
||||||
FancyCheckboxGroup,
|
FancyCheckboxGroup,
|
||||||
|
InlineAlert,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { IntegrationNames, IntegrationTypes } from "constants/backend"
|
import { IntegrationNames, IntegrationTypes } from "constants/backend"
|
||||||
import GoogleButton from "../_components/GoogleButton.svelte"
|
import GoogleButton from "../_components/GoogleButton.svelte"
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
|
|
||||||
let allSheets
|
let allSheets
|
||||||
let selectedSheets
|
let selectedSheets
|
||||||
|
let setSheetsErrorTitle, setSheetsErrorMessage
|
||||||
|
|
||||||
$: modalConfig = {
|
$: modalConfig = {
|
||||||
[GoogleDatasouceConfigStep.AUTH]: {
|
[GoogleDatasouceConfigStep.AUTH]: {
|
||||||
|
@ -119,7 +121,19 @@
|
||||||
|
|
||||||
return
|
return
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error(err?.message ?? "Error fetching the sheets")
|
const message = err?.message ?? "Error fetching the sheets"
|
||||||
|
// Handling message with format: Error title - error description
|
||||||
|
const indexSeparator = message.indexOf(" - ")
|
||||||
|
if (indexSeparator >= 0) {
|
||||||
|
setSheetsErrorTitle = message.substr(0, indexSeparator)
|
||||||
|
setSheetsErrorMessage =
|
||||||
|
message[indexSeparator + 3].toUpperCase() +
|
||||||
|
message.substr(indexSeparator + 4)
|
||||||
|
} else {
|
||||||
|
setSheetsErrorTitle = null
|
||||||
|
setSheetsErrorMessage = message
|
||||||
|
}
|
||||||
|
|
||||||
// prevent the modal from closing
|
// prevent the modal from closing
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -182,6 +196,14 @@
|
||||||
bind:selected={selectedSheets}
|
bind:selected={selectedSheets}
|
||||||
selectAllText="Select all sheets"
|
selectAllText="Select all sheets"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{#if setSheetsErrorTitle || setSheetsErrorMessage}
|
||||||
|
<InlineAlert
|
||||||
|
type="error"
|
||||||
|
header={setSheetsErrorTitle}
|
||||||
|
message={setSheetsErrorMessage}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
</Layout>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
Loading…
Reference in a new issue