Add dashboard status to namespace details and record
What does this MR do and why?
- adds database fields for analysis by data team for when a namespace is in 'enforcement' or 'notification'
- there are no plans to use these fields for anything application related past that.
- allow the freshness of the fields to get stale by 1 day to reduce database churn - agreed upon in #375748
How to test locally
- Setup simulate SaaS and restart GDK - https://docs.gitlab.com/ee/development/ee_features.html#simulate-a-saas-instance
- Create a new top level group that is private
- Verify the new setting for notification is
nil
[3] pry(main)> g = Group.find 79
=> #<Group id:79 @test-free-private>
[5] pry(main)> g.namespace_details.dashboard_notification_at
=> nil
- Set feature flags and application settings
bin/rails c
ApplicationSetting.first.update(dashboard_limit_enabled: true, dashboard_limit: 0, dashboard_notification_limit: 0)
Feature.disable(:free_user_cap)
Feature.enable(:preview_free_user_cap)
- Visit the group overview page where the preview alert will now show and trigger the db update.
- Reload the record and verify it is now set
[10] pry(main)> g.namespace_details.reload
[11] pry(main)> g.namespace_details.dashboard_notification_at
=> Wed, 23 Nov 2022 16:22:48.460785000 UTC +00:00
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #375748
Edited by Doug Stull