Skip to content

Commit

Permalink
Eng/notion messaging post update permissions (#4221)
Browse files Browse the repository at this point in the history
* enh: notion messaging post update permissions

* feedback

---------

Co-authored-by: Henry Fontanier <[email protected]>
  • Loading branch information
fontanierh and Henry Fontanier authored Mar 8, 2024
1 parent 35a4027 commit e7b1d26
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion front/pages/w/[wId]/builder/data-sources/[name]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Button,
Cog6ToothIcon,
ContextItem,
Dialog,
DocumentTextIcon,
GithubLogo,
ListCheckIcon,
Expand Down Expand Up @@ -725,6 +726,7 @@ interface ConnectorUiConfig {
addDataButtonLabel: string | null;
displaySettingsButton: boolean;
guideLink: string | null;
postPermissionsUpdateMessage?: string;
}

function getRenderingConfigForConnectorProvider(
Expand Down Expand Up @@ -759,6 +761,8 @@ function getRenderingConfigForConnectorProvider(
addDataButtonLabel: "Add / Remove data, manage permissions",
displaySettingsButton: false,
guideLink: CONNECTOR_CONFIGURATIONS[connectorProvider].guideLink,
postPermissionsUpdateMessage:
"We've taken your edits into account. Notion permission edits may take up to 24 hours to be reflected on your workspace.",
};
case "github":
return {
Expand Down Expand Up @@ -940,18 +944,39 @@ function ManagedDataSourceView({
addDataButtonLabel,
displaySettingsButton,
guideLink,
postPermissionsUpdateMessage,
} = getRenderingConfigForConnectorProvider(connectorProvider);

const [
postPermissionsUpdateDialogIsOpen,
setPostPermissionsUpdateDialogIsOpen,
] = useState(false);

return (
<>
{postPermissionsUpdateMessage && (
<Dialog
isOpen={postPermissionsUpdateDialogIsOpen}
onCancel={() => setPostPermissionsUpdateDialogIsOpen(false)}
onValidate={() => {
setPostPermissionsUpdateDialogIsOpen(false);
}}
title="Permissions updated"
>
<span>{postPermissionsUpdateMessage}</span>
</Dialog>
)}
<DataSourceDetailsModal
dataSource={dataSource}
visible={showDataSourceDetailsModal}
onClose={() => {
setShowDataSourceDetailsModal(false);
}}
onClick={() => {
void handleUpdatePermissions();
void handleUpdatePermissions().then(() => {
postPermissionsUpdateMessage &&
setPostPermissionsUpdateDialogIsOpen(true);
});
}}
/>
<ConnectorPermissionsModal
Expand Down

0 comments on commit e7b1d26

Please sign in to comment.