Vitor-Avila commented on code in PR #32231: URL: https://github.com/apache/superset/pull/32231#discussion_r1958876122
########## superset-frontend/src/pages/DatabaseList/index.tsx: ########## @@ -426,6 +431,49 @@ function DatabaseList({ handleDatabaseEditModal({ database: original, modalOpen: true }); const handleDelete = () => openDatabaseDeleteModal(original); const handleExport = () => handleDatabaseExport(original); + const handleResync = () => { + shouldResyncPermsInAsyncMode + ? addInfoToast( + t('Validating connectivity for %s', original.database_name), + ) + : addInfoToast( + t('Resyncing permissions for %s', original.database_name), + ); + SupersetClient.post({ + endpoint: `/api/v1/database/${original.id}/resync_permissions/`, + }) + .then(({ response, json }) => { + // Sync request + if (response.status === 200) { + addSuccessToast( + t( + 'Permissions successfully resynced for %s', + original.database_name, + ), + ); + } + // Async request + else { + addInfoToast( + t( + 'Syncing permissions for %s in the background', + original.database_name, + ), + ); + } + }) + .catch( + createErrorHandler(errMsg => + addDangerToast( + t( + 'An error occurred while resyncing permissions for %s: %s', + original.database_name, + errMsg, + ), + ), + ), + ); Review Comment: @korbit-ai I've checked several other places in `superset-frontend/src/pages/*` and they all handle this in a similar way (I actually removed the `.catch()` as found in other places). I'll resolve this one for now. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org