Skip to content

Commit

Permalink
Update the code
Browse files Browse the repository at this point in the history
  • Loading branch information
HelaniUdara committed May 13, 2024
1 parent 3960220 commit d2a09a0
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand All @@ -62,7 +59,7 @@ function WFRejectionPopup(props) {
/>
)
}
saveButtonText='Confirm Reject'
saveButtonText='Confirm Rejection'
triggerButtonText={(
<>
<ClearIcon />
Expand Down
13 changes: 11 additions & 2 deletions portals/devportal/src/main/webapp/site/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,24 @@ const DeleteNotifications = ({ notificationId, isDeleteAll, fetchNotifications }
const promisedNotificationDelete = Notification.deleteNotificationById(notificationId);
promisedNotificationDelete
.then(() => {
Alert.info('Notification deleted successfully!');
Alert.info(
<FormattedMessage
id='Notifications.DeleteNotifications.deleteNotificationById.success'
defaultMessage='Notification deleted successfully!'
/>,
);
setOpen(!open);
fetchNotifications();
})
.catch((errorResponse) => {
console.error(errorResponse);
Alert.error('Error occurred while deleting the notification', errorResponse);
Alert.error(
<FormattedMessage
id='Notifications.DeleteNotifications.deleteNotificationById.error'
defaultMessage='Error occurred while deleting the notification'
/>,
errorResponse,
);
setOpen(!open);
});
};
Expand All @@ -61,13 +72,24 @@ const DeleteNotifications = ({ notificationId, isDeleteAll, fetchNotifications }
const promisedNotificationsDelete = Notification.deleteNotifications();
promisedNotificationsDelete
.then(() => {
Alert.info('All Notifications deleted successfully!');
Alert.info(
<FormattedMessage
id='Notifications.DeleteNotifications.deleteAllNotifications.success'
defaultMessage='All notifications are deleted successfully!'
/>,
);
setOpen(!open);
fetchNotifications();
})
.catch((errorResponse) => {
console.error(errorResponse);
Alert.error('Error occurred while deleting notifications', errorResponse);
Alert.error(
<FormattedMessage
id='Notifications.DeleteNotifications.deleteAllNotifications.error'
defaultMessage='Error occurred while deleting notifications'
/>,
errorResponse,
);
setOpen(!open);
});
};
Expand Down Expand Up @@ -122,12 +144,12 @@ const DeleteNotifications = ({ notificationId, isDeleteAll, fetchNotifications }
isDeleteAll ? (
<FormattedMessage
id='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?'
/>
) : (
<FormattedMessage
id='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?'
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -109,8 +109,14 @@ const Notifications = () => {
})
.catch((error) => {
console.error(error);
Alert.error('Error occurred while fetching notifications', error);
setnotFound(true);
Alert.error(
<FormattedMessage
id='Notification.fetchNotifications.error'
defaultMessage='Error occurred while fetching notifications'
/>,
error,
);
setNotFound(true);
})
.finally(() => {
setLoading(false);
Expand Down Expand Up @@ -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(
<FormattedMessage
id='Notification.markNotificationAsReadById.success'
defaultMessage='Marked the notification as read successfully!'
/>,
);
})
.catch((error) => {
console.error(error);
Alert.error('Error while marking the notification as read!', error);
setnotFound(true);
Alert.error(
<FormattedMessage
id='Notification.markNotificationAsReadById.error'
defaultMessage='Error while marking the notification as read!'
/>,
error,
);
setNotFound(true);
})
.finally(() => {
fetchNotifications(sortOption === 'newest' ? 'desc' : 'asc', rowsPerPage, page * rowsPerPage);
Expand All @@ -186,27 +203,38 @@ 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(
<FormattedMessage
id='Notification.markAllNotificationsAsRead.success'
defaultMessage='Marked all notifications as read successfully!'
/>,
);
})
.catch((error) => {
console.error(error);
Alert.error('Error while marking all notifications as read!', error);
setnotFound(true);
Alert.error(
<FormattedMessage
id='Notification.markAllNotificationsAsRead.error'
defaultMessage='Error while marking all notifications as read!'
/>,
error,
);
setNotFound(true);
})
.finally(() => {
fetchNotifications(sortOption === 'newest' ? 'desc' : 'asc', rowsPerPage, page * rowsPerPage);
});
};

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 = [
Expand Down Expand Up @@ -523,7 +551,7 @@ const Notifications = () => {
margin: theme.spacing(0, 1),
})}
>
Mark All As Read
Mark all as Read
</Button>
</Box>
</Box>
Expand Down
58 changes: 56 additions & 2 deletions portals/publisher/src/main/webapp/site/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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": [
Expand Down
31 changes: 29 additions & 2 deletions portals/publisher/src/main/webapp/site/public/locales/raw.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
},
Expand Down Expand Up @@ -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"
Expand Down
Loading

0 comments on commit d2a09a0

Please sign in to comment.