Skip to content

Organizations - Support delayed project deletion

Zack Cuddy requested to merge 442809-org-delayed-project-deletion into master

What does this MR do and why?

Closes #442809 (closed)
Built on top of API changes !147949 (merged)
Implements this workflow: https://docs.gitlab.com/ee/user/project/working_with_projects.html#delayed-project-deletion
Important: This change is behind a feature flag ui_for_organizations

This change adds UI support for Delayed Project Deletion in Organizations. This includes help text in the modal footer, proper deletion toasts, and the ability to fully delete a project that is scheduled to be deleted.

The potential flows are as follows:

CE Environments

a. In CE environments, delayed deletion is not possible. Thus there is no help text in the modal footer, projects are deleted immediately, and the toasts simply states the project is in the process of being deleted.

EE Environments

a. If delayed project deletion is disabled, it behaves the same as CE environment above.
b. If delayed project deletion is enabled, attempting to delete will show help text in the modal footer of when the project will be deleted, the project will then be marked as pending deletion, and the toast will re-affirm when the project will be fully deleted.
c. If delayed project deletion is enabled and the project is already scheduled to be deleted, a deletion action will then follow the CE environment behavior above and fully delete the project.

Screenshots or screen recordings

Screen_Recording_2024-04-04_at_9.33.48_AM

How to set up and validate locally

Setup Organizations

important: You only need to do this in your GDK if you haven't yet!

  1. Access rails c
  2. Enable Feature Flag Feature.enable(:ui_for_organizations)
  3. Create the default organization and add root to it
you = User.find_by_username('root')
default_organization = Organizations::Organization.default_organization
Organizations::OrganizationUser.create!(organization_id: default_organization.id, user_id: you.id)

Testing

  1. Create two test projects
    • The first one should be a personal project on your user (ie. root)
    • The second one should be a project tied to a group (ie. Flight)
  2. Navigate to the GDK home page ex: 127.0.0.1:3000/
  3. Click Organizations in the sidebar
  4. Click the Default Organization
  5. Click the Manage > Groups and projects in the sidebar
  6. Switch list to Projects in the dropdown

No delay deletion

  1. Click the ... for the personal project you made
  2. Ensure no help text appears below the input box in the modal
  3. Fill out input and click delete
  4. Ensure alert appears that says project is in the process of being deleted
  5. Ensure project is no longer in the list

Delayed deletion

  1. Click the ... for the project you made tied to a group
  2. Ensure help text appears below the input box in the modal, stating when the project will be deleted and a learn more link
  3. Fill out input and click delete
  4. Ensure alert appears that says the project will be deleted on x date.
  5. Ensure project is still in the list with a pending deletion tag
  6. Click the ... again for the project you made tied to a group
  7. Ensure no help text appears below the input box in the modal
  8. Fill out input and click delete
  9. Ensure alert appears that says project is in the process of being deleted
  10. Ensure project is no longer in the list

Related to #442809 (closed)

Edited by Zack Cuddy

Merge request reports