Server side rendering in AI settings
What does this MR do and why?
In the Group and Admin settings, the AI section is implemented in Vue, but most of the settings are in Haml. This mean that as it loads, the page will have most of its content visible (although non-interactive) but the AI settings will appear after all of the other settings and push down the DOM content. To avoid this, we need some form of loading state for the server side.
An easy approach for this would be to render the same header from rails that is the actual Vue mounting point of the settings. So when the page first render, we get some of the layout formatted, and as soon as the JS has loaded, the Vue app mounts over the loading state and becomes interactive. We would get a nice transition from static to dynamic, improve time to first print and would avoid the DOM popping.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
In groups:
Screen_Recording_2024-07-09_at_2.42.03_PM
In admin:
Screen_Recording_2024-07-09_at_2.40.57_PM
How to set up and validate locally
- Make sure you have AI features enabled to test this change https://docs.gitlab.com/ee/development/ai_features/index.html
- Go to your rails console and run
Feature.enable(:ai_settings_vue_admin)
- Navigate to the admin area
- Go in
Settings => General
- Note that you will not see the AI settings if you are on SAAS. You can comment out
ee/app/views/admin/application_settings/_ai_powered.html.haml:1
- Go to the AI settings header
- Refresh the page
- notice the skeleton loader
- Notice the header
AI-powered features
appears after some time - Go to your rails console and run
Feature.enable(:ai_settings_vue_group)
- Navigate to a group where you are the admin and have AI features enabled
- Navigate to
Settings -> General
- Notice the group header for AI-powered features
- Refresh the page
- Notice the skeleton loader
- Notice the settings appear after some time
Note: if you do not see the settings, try to turn off the FF. If you still do not see it, then it can mean either of these criteria is not met:
- Is the group you are looking at has enabled AI features on your GDK? https://docs.gitlab.com/ee/development/ai_features/index.html#recommended-run-gdk-in-saas-mode-and-enable-ai-features-for-a-test-group
- Do you have an ultimate license for your instance?