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

feat: show confirm modal instead of popconfirm when deleting endpoint #2678

Merged

Conversation

agatha197
Copy link
Contributor

@agatha197 agatha197 commented Sep 2, 2024

TL;DR

Improved the delete functionality for endpoints in the EndpointListPage component.

What changed?

  • Replaced the Popconfirm component with a modal confirmation dialog for deleting endpoints.
  • Removed the terminatingModelService state and directly used the row data for deletion.
  • Updated the error handling and success messages for the terminate mutation.
  • Simplified the delete button's onClick handler.

How to test?

  1. Navigate to the EndpointListPage.
  2. Attempt to delete an endpoint by clicking the delete button.
  3. Verify that a modal confirmation dialog appears.
  4. Confirm the deletion and check if the endpoint is removed successfully.
  5. Test error scenarios by mocking a failed deletion and verify error messages.

Why make this change?

This change enhances the user experience by providing a more robust and consistent deletion process. The modal confirmation offers better visibility and control over the deletion action, while the improved error handling ensures users receive accurate feedback on the operation's success or failure.

Copy link

graphite-app bot commented Sep 2, 2024

Your org requires the Graphite merge queue for merging into main

Add the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Contributor Author

agatha197 commented Sep 2, 2024

@github-actions github-actions bot added the size:L 100~500 LoC label Sep 2, 2024
@agatha197 agatha197 force-pushed the bugfix/cannot-delete-model-service-if-routing-exists branch from 7128c6f to 2acc770 Compare September 3, 2024 03:32
Copy link

github-actions bot commented Sep 3, 2024

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
5.37% (-0% 🔻)
329/6122
🔴 Branches
5.02% (-0% 🔻)
211/4202
🔴 Functions 3.08% 62/2013
🔴 Lines
5.27% (-0% 🔻)
315/5978

Test suite run success

83 tests passing in 9 suites.

Report generated by 🧪jest coverage report action from f3491db

@agatha197 agatha197 force-pushed the bugfix/cannot-delete-model-service-if-routing-exists branch 2 times, most recently from ac4b98b to 0e78489 Compare September 3, 2024 15:43
@agatha197 agatha197 changed the title fix: can't delete model service if routing exists refactor: improve model service termination process Sep 3, 2024
@agatha197 agatha197 changed the title refactor: improve model service termination process feat: show confirm modal instead of popconfirm when deleting endpoint Sep 3, 2024
@yomybaby yomybaby force-pushed the bugfix/cannot-delete-model-service-if-routing-exists branch from 0e78489 to 24132e9 Compare September 4, 2024 10:08
Comment on lines 369 to 375
_.map(getDeleteRoutingIds(endpoint_id), (routing_id) =>
baiSignedRequestWithPromise({
method: 'DELETE',
url: '/services/' + endpoint_id + '/routings/' + routing_id,
client: baiClient,
}),
),
Copy link
Member

Choose a reason for hiding this comment

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

Is deleting routings before deleting services required? or not? @agatha197

@yomybaby yomybaby force-pushed the bugfix/cannot-delete-model-service-if-routing-exists branch 2 times, most recently from c30caa7 to 1286ee6 Compare September 4, 2024 11:09
@yomybaby yomybaby self-assigned this Sep 4, 2024
@yomybaby yomybaby marked this pull request as ready for review September 4, 2024 11:10
Copy link
Member

@yomybaby yomybaby left a comment

Choose a reason for hiding this comment

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

LGTM
(I refactor and pushed commits. )

Copy link

graphite-app bot commented Sep 4, 2024

Merge activity

…#2678)

### TL;DR

Improved the delete functionality for endpoints in the EndpointListPage component.

### What changed?

- **Replaced the Popconfirm component with a modal confirmation dialog for deleting endpoints.**
- Removed the `terminatingModelService` state and directly used the row data for deletion.
- Updated the error handling and success messages for the terminate mutation.
- Simplified the delete button's onClick handler.

### How to test?

1. Navigate to the EndpointListPage.
2. Attempt to delete an endpoint by clicking the delete button.
3. Verify that a modal confirmation dialog appears.
4. Confirm the deletion and check if the endpoint is removed successfully.
5. Test error scenarios by mocking a failed deletion and verify error messages.

### Why make this change?

This change enhances the user experience by providing a more robust and consistent deletion process. The modal confirmation offers better visibility and control over the deletion action, while the improved error handling ensures users receive accurate feedback on the operation's success or failure.
@yomybaby yomybaby force-pushed the bugfix/cannot-delete-model-service-if-routing-exists branch from 1286ee6 to f3491db Compare September 4, 2024 11:13
@graphite-app graphite-app bot merged commit f3491db into main Sep 4, 2024
6 checks passed
@graphite-app graphite-app bot deleted the bugfix/cannot-delete-model-service-if-routing-exists branch September 4, 2024 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L 100~500 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants