Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
improving error state and triggering refetch
Browse files Browse the repository at this point in the history
  • Loading branch information
pellicceama committed Oct 18, 2024
1 parent 2791c83 commit 3d180e4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
15 changes: 8 additions & 7 deletions packages/engine-frontend/components/AGConnectionPortal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ const AGConnectionPortalComponent: React.FC<AGConnectionPortalProps> = ({
// const iframe = document.getElementById('openint-connect-iframeId');
// iframe?.contentWindow.postMessage({type: 'triggerConnectDialog', value: true },'*');

const handleMessage = React.useCallback((event: MessageEvent) => {
const handleMessage = React.useCallback(async (event: MessageEvent) => {
if (event.data.type === 'triggerConnectDialog') {
console.log('triggerConnectDialog', event.data.value)
setOpenDialog(event.data.value)
if(event.data.value) {
await listConnectionsRes.refetch().then(() => {
setOpenDialog(event.data.value)
})
}
}
}, [])

Expand Down Expand Up @@ -135,11 +139,8 @@ const AGConnectionPortalComponent: React.FC<AGConnectionPortalProps> = ({
connectorConfigFilters={{verticalKey: category.key}}
open={openDialog}
setOpen={setOpenDialog}
onEvent={(event) => {
if (event.type === 'close') {
listConnectionsRes.refetch(); // Trigger refetch
}
}}
// trigger refetch of connections
onEvent={() => listConnectionsRes.refetch()}
/>
)}
</div>
Expand Down
17 changes: 13 additions & 4 deletions packages/engine-frontend/components/ConnectDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,19 @@ export function ConnectDialog({
const [first, ...rest] = filteredCcfgs
if (!first) {
return (
<div>
No connectors configured for {categoryKey}. Please check your
settings
</div>
<Dialog open={true} onOpenChange={() => {}}>
<DialogContent>
<DialogHeader>
<DialogTitle>No Integrations Available</DialogTitle>
<DialogDescription>
You have no further integrations available. If you believe this is an error, please contact support.
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button onClick={() => {}}>Close</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)
}
const category = categoryKey ? VERTICAL_BY_KEY[categoryKey] : undefined
Expand Down

0 comments on commit 3d180e4

Please sign in to comment.