From d2a09a047571106b03ee9d24ef5e87cfb163a952 Mon Sep 17 00:00:00 2001 From: HelaniUdara Date: Mon, 13 May 2024 17:47:22 +0530 Subject: [PATCH] Update the code --- .../components/Workflow/WFRejectionPopup.jsx | 5 +- .../main/webapp/site/public/locales/en.json | 13 ++++- .../webapp/site/public/theme/settings.json | 4 +- .../Notifications/DeleteNotifications.jsx | 34 +++++++++-- .../Notifications/Notifications.jsx | 58 ++++++++++++++----- .../main/webapp/site/public/locales/en.json | 58 ++++++++++++++++++- .../webapp/site/public/locales/raw.en.json | 31 +++++++++- .../Notifications/DeleteNotifications.jsx | 34 +++++++++-- .../Notifications/Notifications.jsx | 43 +++++++++++--- 9 files changed, 234 insertions(+), 46 deletions(-) diff --git a/portals/admin/src/main/webapp/source/src/app/components/Workflow/WFRejectionPopup.jsx b/portals/admin/src/main/webapp/source/src/app/components/Workflow/WFRejectionPopup.jsx index e9ae424877f..d03ff68541c 100644 --- a/portals/admin/src/main/webapp/source/src/app/components/Workflow/WFRejectionPopup.jsx +++ b/portals/admin/src/main/webapp/source/src/app/components/Workflow/WFRejectionPopup.jsx @@ -40,9 +40,6 @@ function WFRejectionPopup(props) { }, []); const formSaveCallback = () => { - if (typeof updateStatus !== 'function') { - console.error('updateStatus prop is not a function:', updateStatus); - } updateStatus(referenceId, 'REJECTED', reason); }; @@ -62,7 +59,7 @@ function WFRejectionPopup(props) { /> ) } - saveButtonText='Confirm Reject' + saveButtonText='Confirm Rejection' triggerButtonText={( <> diff --git a/portals/devportal/src/main/webapp/site/public/locales/en.json b/portals/devportal/src/main/webapp/site/public/locales/en.json index ab521048ab4..56f9b8fab2c 100644 --- a/portals/devportal/src/main/webapp/site/public/locales/en.json +++ b/portals/devportal/src/main/webapp/site/public/locales/en.json @@ -518,6 +518,11 @@ "LoginDenied.logout": "Logout", "LoginDenied.message": "You don't have sufficient privileges to access the Developer Portal.", "LoginDenied.title": "Error 403 : Forbidden", + "Notification.fetchNotifications.error": "Error occurred while fetching notifications", + "Notification.markAllNotificationsAsRead.error": "Error while marking all notifications as read!", + "Notification.markAllNotificationsAsRead.success": "Marked all notifications as read successfully!", + "Notification.markNotificationAsReadById.error": "Error while marking the notification as read!", + "Notification.markNotificationAsReadById.success": "Marked the notification as read successfully!", "Notification.table.header.actions.title": "Action", "Notification.table.header.markAsRead": "Mark as Read", "Notification.table.header.markAsRead.tooltip": "Mark as Read", @@ -529,8 +534,12 @@ "Notifications.DeleteNotifications.DeleteConfirmation.dialog.cancel": "Cancel", "Notifications.DeleteNotifications.DeleteConfirmation.dialog.title": "Confirm Delete", "Notifications.DeleteNotifications.delete.tooltip": "Delete", - "Notifications.DeleteNotifications.deleteAll.confirm.dialog.confirm.content": "Are you sure you want to delete all Notifications?", - "Notifications.DeleteNotifications.deleteNotificationById.confirm.dialog.confirm.content": "Are you sure you want to delete this Notification?", + "Notifications.DeleteNotifications.deleteAll.confirm.dialog.confirm.content": "Are you sure you want to delete all notifications?", + "Notifications.DeleteNotifications.deleteAllNotifications.error": "Error occurred while deleting notifications", + "Notifications.DeleteNotifications.deleteAllNotifications.success": "All notifications are deleted successfully!", + "Notifications.DeleteNotifications.deleteNotificationById.confirm.dialog.confirm.content": "Are you sure you want to delete this notification?", + "Notifications.DeleteNotifications.deleteNotificationById.error": "Error occurred while deleting the notification", + "Notifications.DeleteNotifications.deleteNotificationById.success": "Notification deleted successfully!", "Notifications.Notifications.page.title": "Notifications", "Notifications.Onboarding.display.message": "You do not have any notifications!", "Notifications.Onboarding.page.title": "Notifications", diff --git a/portals/devportal/src/main/webapp/site/public/theme/settings.json b/portals/devportal/src/main/webapp/site/public/theme/settings.json index 2bb4c2a41de..d8d29e22e19 100644 --- a/portals/devportal/src/main/webapp/site/public/theme/settings.json +++ b/portals/devportal/src/main/webapp/site/public/theme/settings.json @@ -65,7 +65,7 @@ "SUBSCRIPTION_CREATION": "Subscription Creation", "SUBSCRIPTION_UPDATE": "Subscription Update", "SUBSCRIPTION_DELETION": "Subscription Deletion", - "APPLICATION_REGISTRATION_PRODUCTION": "Application Registration Production", - "APPLICATION_REGISTRATION_SANDBOX": "Application Registration Sandbox" + "APPLICATION_REGISTRATION_PRODUCTION": "Application Registration for Production", + "APPLICATION_REGISTRATION_SANDBOX": "Application Registration for Sandbox" } } diff --git a/portals/devportal/src/main/webapp/source/src/app/components/Notifications/DeleteNotifications.jsx b/portals/devportal/src/main/webapp/source/src/app/components/Notifications/DeleteNotifications.jsx index aef9c77086f..bd7b3b0cf53 100644 --- a/portals/devportal/src/main/webapp/source/src/app/components/Notifications/DeleteNotifications.jsx +++ b/portals/devportal/src/main/webapp/source/src/app/components/Notifications/DeleteNotifications.jsx @@ -46,13 +46,24 @@ const DeleteNotifications = ({ notificationId, isDeleteAll, fetchNotifications } const promisedNotificationDelete = Notification.deleteNotificationById(notificationId); promisedNotificationDelete .then(() => { - Alert.info('Notification deleted successfully!'); + Alert.info( + , + ); setOpen(!open); fetchNotifications(); }) .catch((errorResponse) => { console.error(errorResponse); - Alert.error('Error occurred while deleting the notification', errorResponse); + Alert.error( + , + errorResponse, + ); setOpen(!open); }); }; @@ -61,13 +72,24 @@ const DeleteNotifications = ({ notificationId, isDeleteAll, fetchNotifications } const promisedNotificationsDelete = Notification.deleteNotifications(); promisedNotificationsDelete .then(() => { - Alert.info('All Notifications deleted successfully!'); + Alert.info( + , + ); setOpen(!open); fetchNotifications(); }) .catch((errorResponse) => { console.error(errorResponse); - Alert.error('Error occurred while deleting notifications', errorResponse); + Alert.error( + , + errorResponse, + ); setOpen(!open); }); }; @@ -122,12 +144,12 @@ const DeleteNotifications = ({ notificationId, isDeleteAll, fetchNotifications } isDeleteAll ? ( ) : ( ) } diff --git a/portals/devportal/src/main/webapp/source/src/app/components/Notifications/Notifications.jsx b/portals/devportal/src/main/webapp/source/src/app/components/Notifications/Notifications.jsx index 5c8b4536cfd..5226ee60a1e 100644 --- a/portals/devportal/src/main/webapp/source/src/app/components/Notifications/Notifications.jsx +++ b/portals/devportal/src/main/webapp/source/src/app/components/Notifications/Notifications.jsx @@ -93,7 +93,7 @@ const Notifications = () => { const [notifications, setNotifications] = useState(null); const [loading, setLoading] = useState(false); const [sortOption, setSortOption] = useState('newest'); - const [notFound, setnotFound] = useState(false); + const [notFound, setNotFound] = useState(false); const [page, setPage] = useState(0); const [rowsPerPage, setRowsPerPage] = useState(10); const [count, setCount] = useState(0); @@ -109,8 +109,14 @@ const Notifications = () => { }) .catch((error) => { console.error(error); - Alert.error('Error occurred while fetching notifications', error); - setnotFound(true); + Alert.error( + , + error, + ); + setNotFound(true); }) .finally(() => { setLoading(false); @@ -165,13 +171,24 @@ const Notifications = () => { const promisedMarkAsRead = Notification.markNotificationAsReadById(notificationId, body); promisedMarkAsRead .then((response) => { - console.log(response); - Alert.info('Marked the notification as read successfully!'); + console.log(response.notificationId); + Alert.info( + , + ); }) .catch((error) => { console.error(error); - Alert.error('Error while marking the notification as read!', error); - setnotFound(true); + Alert.error( + , + error, + ); + setNotFound(true); }) .finally(() => { fetchNotifications(sortOption === 'newest' ? 'desc' : 'asc', rowsPerPage, page * rowsPerPage); @@ -186,13 +203,24 @@ const Notifications = () => { const promisedMarkAsRead = Notification.markAllNotificationsAsRead(body); promisedMarkAsRead .then((response) => { - console.log(response); - Alert.info('Marked all notifications as read successfully!'); + console.log(response.notificationId); + Alert.info( + , + ); }) .catch((error) => { console.error(error); - Alert.error('Error while marking all notifications as read!', error); - setnotFound(true); + Alert.error( + , + error, + ); + setNotFound(true); }) .finally(() => { fetchNotifications(sortOption === 'newest' ? 'desc' : 'asc', rowsPerPage, page * rowsPerPage); @@ -200,13 +228,13 @@ const Notifications = () => { }; const notificationTypeColors = { - 'API state change': '#a2e8ff', + 'API State Change': '#a2e8ff', 'Application Creation': '#ffa966', 'Subscription Creation': '#eff589', 'Subscription Update': '#f7bef4', 'Subscription Deletion': '#ab93fc', - 'Application Registration Production': '#93fcb8', - 'Application Registration Sandbox': '#fcd693', + 'Application Registration for Production': '#93fcb8', + 'Application Registration for Sandbox': '#fcd693', }; const columns = [ @@ -523,7 +551,7 @@ const Notifications = () => { margin: theme.spacing(0, 1), })} > - Mark All As Read + Mark all as Read diff --git a/portals/publisher/src/main/webapp/site/public/locales/en.json b/portals/publisher/src/main/webapp/site/public/locales/en.json index 5d2af6791dd..826d3d1c877 100644 --- a/portals/publisher/src/main/webapp/site/public/locales/en.json +++ b/portals/publisher/src/main/webapp/site/public/locales/en.json @@ -9051,6 +9051,36 @@ "value": "Error 403 : Forbidden" } ], + "Notification.fetchNotifications.error": [ + { + "type": 0, + "value": "Error occurred while fetching notifications" + } + ], + "Notification.markAllNotificationsAsRead.error": [ + { + "type": 0, + "value": "Error while marking all notifications as read!" + } + ], + "Notification.markAllNotificationsAsRead.success": [ + { + "type": 0, + "value": "Marked all notifications as read successfully!" + } + ], + "Notification.markNotificationAsReadById.error": [ + { + "type": 0, + "value": "Error while marking the notification as read!" + } + ], + "Notification.markNotificationAsReadById.success": [ + { + "type": 0, + "value": "Marked the notification as read successfully!" + } + ], "Notification.onboarding.display.message": [ { "type": 0, @@ -9132,13 +9162,37 @@ "Notifications.DeleteNotifications.deleteAll.confirm.dialog.confirm.content": [ { "type": 0, - "value": "Are you sure you want to delete all Notifications?" + "value": "Are you sure you want to delete all notifications?" + } + ], + "Notifications.DeleteNotifications.deleteAllNotifications.error": [ + { + "type": 0, + "value": "Error occurred while deleting notifications" + } + ], + "Notifications.DeleteNotifications.deleteAllNotifications.success": [ + { + "type": 0, + "value": "All notifications are deleted successfully!" } ], "Notifications.DeleteNotifications.deleteNotificationById.confirm.dialog.confirm.content": [ { "type": 0, - "value": "Are you sure you want to delete this Notification?" + "value": "Are you sure you want to delete this notification?" + } + ], + "Notifications.DeleteNotifications.deleteNotificationById.error": [ + { + "type": 0, + "value": "Error occurred while deleting the notification" + } + ], + "Notifications.DeleteNotifications.deleteNotificationById.success": [ + { + "type": 0, + "value": "Notification deleted successfully!" } ], "Polcies.TextField.Description": [ diff --git a/portals/publisher/src/main/webapp/site/public/locales/raw.en.json b/portals/publisher/src/main/webapp/site/public/locales/raw.en.json index 26373c37894..c7ef2b716c2 100644 --- a/portals/publisher/src/main/webapp/site/public/locales/raw.en.json +++ b/portals/publisher/src/main/webapp/site/public/locales/raw.en.json @@ -4329,6 +4329,21 @@ "LoginDenied.title": { "defaultMessage": "Error 403 : Forbidden" }, + "Notification.fetchNotifications.error": { + "defaultMessage": "Error occurred while fetching notifications" + }, + "Notification.markAllNotificationsAsRead.error": { + "defaultMessage": "Error while marking all notifications as read!" + }, + "Notification.markAllNotificationsAsRead.success": { + "defaultMessage": "Marked all notifications as read successfully!" + }, + "Notification.markNotificationAsReadById.error": { + "defaultMessage": "Error while marking the notification as read!" + }, + "Notification.markNotificationAsReadById.success": { + "defaultMessage": "Marked the notification as read successfully!" + }, "Notification.onboarding.display.message": { "defaultMessage": "You do not have any notifications!" }, @@ -4369,10 +4384,22 @@ "defaultMessage": "Delete" }, "Notifications.DeleteNotifications.deleteAll.confirm.dialog.confirm.content": { - "defaultMessage": "Are you sure you want to delete all Notifications?" + "defaultMessage": "Are you sure you want to delete all notifications?" + }, + "Notifications.DeleteNotifications.deleteAllNotifications.error": { + "defaultMessage": "Error occurred while deleting notifications" + }, + "Notifications.DeleteNotifications.deleteAllNotifications.success": { + "defaultMessage": "All notifications are deleted successfully!" }, "Notifications.DeleteNotifications.deleteNotificationById.confirm.dialog.confirm.content": { - "defaultMessage": "Are you sure you want to delete this Notification?" + "defaultMessage": "Are you sure you want to delete this notification?" + }, + "Notifications.DeleteNotifications.deleteNotificationById.error": { + "defaultMessage": "Error occurred while deleting the notification" + }, + "Notifications.DeleteNotifications.deleteNotificationById.success": { + "defaultMessage": "Notification deleted successfully!" }, "Polcies.TextField.Description": { "defaultMessage": "Description" diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Notifications/DeleteNotifications.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Notifications/DeleteNotifications.jsx index f50ca69a931..e7ba16ecb5f 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Notifications/DeleteNotifications.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Notifications/DeleteNotifications.jsx @@ -42,13 +42,24 @@ const DeleteNotifications = ({ notificationId, fetchNotifications, isDeleteAll } const promisedNotificationDelete = API.deleteNotificationById(notificationId); promisedNotificationDelete .then(() => { - Alert.info('Notification deleted successfully!'); + Alert.info( + , + ); setOpen(!open); fetchNotifications(); }) .catch((errorResponse) => { console.error(errorResponse); - Alert.error('Error occurred while deleting the notification'); + Alert.error( + , + errorResponse, + ); setOpen(!open); }); @@ -58,13 +69,24 @@ const DeleteNotifications = ({ notificationId, fetchNotifications, isDeleteAll } const promisedNotificationsDelete = API.deleteNotifications(); promisedNotificationsDelete .then(() => { - Alert.info('All Notifications deleted successfully!'); + Alert.info( + , + ); setOpen(!open); fetchNotifications(); }) .catch((errorResponse) => { console.error(errorResponse); - Alert.error('Error occurred while deleting notifications'); + Alert.error( + , + errorResponse, + ); setOpen(!open); }); @@ -125,12 +147,12 @@ const DeleteNotifications = ({ notificationId, fetchNotifications, isDeleteAll } isDeleteAll ? ( ) : ( ) } diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Notifications/Notifications.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Notifications/Notifications.jsx index 1de66abc826..723393cfc3f 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Notifications/Notifications.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Notifications/Notifications.jsx @@ -148,6 +148,13 @@ const Notifications = () => { }) .catch((error) => { console.error(error); + Alert.error( + , + error, + ); setnotFound(true); }) .finally(() => { @@ -203,13 +210,24 @@ const Notifications = () => { const promisedMarkAsRead = API.markNotificationAsReadById(notificationId, body); promisedMarkAsRead .then((response) => { - console.log(response); - Alert.info('Marked the notification as read successfully!'); + console.log(response.notificationId); + Alert.info( + , + ); }) .catch((error) => { console.error(error); - Alert.error('Error while marking the notification as read!'); + Alert.error( + , + error, + ); setnotFound(true); }) .finally(() => { @@ -226,13 +244,24 @@ const Notifications = () => { const promisedMarkAsRead = API.markAllNotificationsAsRead(body); promisedMarkAsRead .then((response) => { - console.log(response); - Alert.info('Marked all notifications as read successfully!'); + console.log(response.notificationId); + Alert.info( + , + ); }) .catch((error) => { console.error(error); - Alert.error('Error while marking all notifications as read!'); + Alert.error( + , + error, + ); setnotFound(true); }) .finally(() => { @@ -513,7 +542,7 @@ const Notifications = () => { color='primary' onClick={markAllAsRead} > - Mark All As Read + Mark all as Read