Update option descriptions and pre-selection in agent/flow delete modal
What does this MR do and why?
- Changes the text in the agents/flows delete modal for Admin Mode users to the text discussed in this issue.
- For Admin Mode users, changes the pre-selected delete option to be the "hard delete" option, since that was the recommended option (as referenced in the discussion mentioned in the same issue).
- Adds tests for how
deleteFnis called
Changes since reviews (Edit: Dec 17)
- The help text in the delete modal (for users who can hard delete) now shows the item type instead of just "item".
About forceHardDelete
- The value of
forceHardDeletedefaults tofalsewhich is why the "soft delete" option was originally pre-selected. - However, changing it to default
truemeant that users without permission to "hard delete" (and therefore do not see the radio options to change which deletion method to use) would only ever be able to "hard delete" items, which isn't what we want. - I got around this by adding a method
openDeleteModalthat both opens the delete modal and sets the value offorceHardDeletetocanHardDeleteensuring only users who have permission to hard delete can do so
Since the value of forceHardDelete is what the backend uses to apply the deletion method (from how I understand it) and my changes potentially affected that, it felt prudent to add a test to make sure that for users without permission to hard delete, it's always passed as false to the delete function. However, I would love some notes if any on how I implemented this test.
Screenshots or screen recordings
For users who can hard delete
(Edit: This used to have a reference to the GraphQL API and a link to the docs, however after some discussion we've decided to omit it)
For users who cannot hard delete (text not changed, since they don't have the radio options)
How to set up and validate locally
Test deleting agents and flows as both
- A user who can hard delete items (ie. instance admin)
- A user who has the ability to delete items but is not in Admin Mode
In Vue dev tools, check the value of forceHardDelete in <AiCatalogItemActions>
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #582876


