Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Application tables: Refactor useEntityModal #1235

Merged
merged 19 commits into from
Aug 3, 2023
Merged

✨ Application tables: Refactor useEntityModal #1235

merged 19 commits into from
Aug 3, 2023

Conversation

gildub
Copy link
Contributor

@gildub gildub commented Jul 29, 2023

Replace useEntityModal with in-file state.

See #1234 for details

Also:

  • Add missing notification when managing applications credentials.
  • Application-form: Replace Alert with Notification

@codecov
Copy link

codecov bot commented Jul 29, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.02% ⚠️

Comparison is base (9d59bd2) 44.03% compared to head (dbc138e) 44.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1235      +/-   ##
==========================================
- Coverage   44.03%   44.02%   -0.02%     
==========================================
  Files         177      177              
  Lines        4524     4516       -8     
  Branches     1009     1037      +28     
==========================================
- Hits         1992     1988       -4     
+ Misses       2521     2453      -68     
- Partials       11       75      +64     
Flag Coverage Δ
client 44.02% <0.00%> (-0.02%) ⬇️
server ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
client/src/app/api/rest.ts 54.94% <0.00%> (+0.31%) ⬆️
...s/components/application-form/application-form.tsx 55.66% <0.00%> (-0.16%) ⬇️
...ntities/components/identity-form/identity-form.tsx 56.32% <0.00%> (-0.13%) ⬇️

... and 27 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gildub gildub self-assigned this Jul 29, 2023
@gildub gildub changed the title ✨ Application tables removes use entity modal ✨ Application tables: Remove useEntityModal Jul 29, 2023
@gildub gildub changed the title ✨ Application tables: Remove useEntityModal ✨ Application tables: Refactor useEntityModal Aug 1, 2023
@gildub gildub requested review from ibolton336 and sjd78 August 1, 2023 15:47
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Copy link
Member

@ibolton336 ibolton336 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change requested for old forEach / array.push style we are stylistically moving away from.

Comment on lines 669 to 674
let ids: number[] = [];
applicationsToDelete.forEach((application) => {
if (application.id) ids.push(application.id);
});
if (ids) bulkDeleteApplication({ ids: ids });
setApplicationsToDelete([]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let ids: number[] = [];
applicationsToDelete.forEach((application) => {
if (application.id) ids.push(application.id);
});
if (ids) bulkDeleteApplication({ ids: ids });
setApplicationsToDelete([]);
const ids = applicationsToDelete
.filter(application=>application?.id)
.map(application => application.id)
//TODO should have some sort of loading state / error state before closing the modal just incase the bulk delete fails. Then we could move the setApplicatoinsToDelete to a success/error callback after the async operation rather than it being synchronous as it sits here.
if (ids) bulkDeleteApplication({ ids: ids });
setApplicationsToDelete([]);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ibolton336, that's a good opportunity indeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ibolton336, good idea to move setApplicationsToDelete to the success/error callbacks.
We don't really need to handle loading or error state when deleting items, the notification whether the delete operation is successful or fails, by providing information to the user.

@gildub gildub requested a review from ibolton336 August 3, 2023 14:13
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Signed-off-by: Gilles Dubreuil <gdubreui@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants