korbit-ai[bot] commented on code in PR #32231:
URL: https://github.com/apache/superset/pull/32231#discussion_r1958876291
##########
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:
Hi @Vitor-Avila, I appreciate your diligence in checking other parts of the
code for consistency. I also agree with you for now. However, I believe we
should consider refactoring these code snippets in the future to log errors for
debugging purposes. Thank you for bringing this to notice.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]