You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If two or more jobs are getting deleted successfully then a notification appears saying 'Successfully deleted all selected jobs' and if some jobs fail to get deleted then the notification appears as 'Some jobs were deleted successfully, but the following jobs could not be deleted: (failedJobNames)'
If two or more jobs are getting deleted successfully then a notification appears saying 'Successfully deleted all selected jobs' and if some jobs fail to get deleted then the notification appears as 'Some jobs were deleted successfully, but the following jobs could not be deleted: (failedJobNames)'
How to Test
Go to Open Settings then select Jobs.
Add two or more Jobs.
Select two or more Jobs.
Click on Delete Selected.
Notification will pop up.
PR Type
Enhancement
Description
Handle partial job deletion failures
Show warning with failed job names
Reset selected jobs after deletion
Fix axios.get closing brace formatting
Changes walkthrough 📝
Relevant files
Enhancement
JobsPage.tsx
Enhance multiple job deletion notifications
packages/client/src/pages/jobs/JobsPage.tsx
Extract success and failed job IDs
Display success notification when all succeed
Display warning for partial failures including names
The code skips showing any notification when the response contains errors (type includes "ERROR"), leaving users without feedback on failures.
if(type.indexOf('ERROR')===-1){if(failedIds.length===0){notification.add({color: 'success',message: `Successfully deleted all selected jobs`,});}else{// Map failed job IDs to job namesconstfailedJobNames=jobs.filter((job)=>failedIds.includes(job.id)).map((job)=>job.name).join(', ');notification.add({color: 'warning',message: `Some jobs were deleted successfully, but the following jobs could not be deleted: ${failedJobNames}`,});}
Add a branch for the case when none of the deletions succeeded so you can show an error notification and avoid clearing the selection. This prevents clearing jobs when all deletes fail.
if (failedIds.length === 0) {
notification.add({
color: 'success',
message: `Successfully deleted all selected jobs`,
+ });+} else if (successIds.length === 0) {+ notification.add({+ color: 'error',+ message: `Failed to delete selected jobs`,
});
} else {
// Map failed job IDs to job names
const failedJobNames = jobs
.filter((job) => failedIds.includes(job.id))
.map((job) => job.name)
.join(', ');
notification.add({
color: 'warning',
message: `Some jobs were deleted successfully, but the following jobs could not be deleted: ${failedJobNames}`,
});
}
Suggestion importance[1-10]: 6
__
Why: Adding a branch for successIds.length === 0 improves error feedback when all deletes fail, but is a minor feature enhancement.
Low
Remove redundant expression
Remove this stray boolean expression that has no effect. It appears to be a leftover and should be deleted to prevent confusion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
If two or more jobs are getting deleted successfully then a notification appears saying 'Successfully deleted all selected jobs' and if some jobs fail to get deleted then the notification appears as 'Some jobs were deleted successfully, but the following jobs could not be deleted: (failedJobNames)'
How to Test