Organizations API - support delayed project deletion
What does this MR do and why?
API Changes for !147479 (merged)
Part of #442809 (closed)
Important: This change is behind a feature flag ui_for_organizations
This change makes the necessary API changes to support the Frontend for delayed project deletion. The intention is to utilize the logic currently found in our RESTful Projects API
By itself this change doesn't do much besides expose new data to the GraphQL endpoint and update the mock project data.
CE Environments
Pending deletion is an EE only feature and thus will also return false/nil
data for anything related to pending deletion.
EE Environments
-
isAdjournedDeletionEnabled
is only available on projects tied to groups. It is not enabled for personal projects -
permanent_deletion_date
is the date, X days in the future, that is configured by the project for when the project will be deleted if it is triggered now. -
marked_for_deletion_on
is the date when the deletion was triggered.
Screenshots or screen recordings
CE API Res | EE API Res |
---|---|
How to set up and validate locally
Setup Organizations
important: You only need to do this in your GDK if you haven't yet!
- Access
rails c
- Enable Feature Flag
Feature.enable(:ui_for_organizations)
- 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 in EE
-
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
)
- The first one should be a personal project on your user (ie.
-
Navigate to the GDK home page
ex: 127.0.0.1:3000/
-
Click Organizations in the sidebar
-
Click the Default Organization
-
Click the Manage > Groups and projects in the sidebar
-
Switch list to Projects in the dropdown
-
Check API response from GraphQL for your two projects
-
Ensure
isAdjournedDeletionEnabled
is false andpermanentDeletionDate
is null for your personal project -
Ensure
isAdjournedDeletionEnabled
is true andpermanentDeletionDate
is a date one week out for your group project -
Click the ... for the project you made tied to a group
-
Follow prompts to trigger deletion and then refresh the page
-
Ensure your group project has label pending deletion
-
Ensure the API response in GraphQL for your group project now has a value in
markedForDeletionOn
of today.