Add group selection view for group templates tab when no group context is available
Summary
Add a new view to the group templates tab that is displayed when no group is selected. This view should include a dropdown to select the target group, allowing users to scope the template list to a specific group.
Background
Currently, when creating a project outside of a group context, the group templates tab attempts to show templates from every accessible group, resulting in expensive queries and a poor user experience. As part of the refactoring effort (see parent epic), we are constraining template discovery to a specific group scope.
When a user navigates to the group templates tab without a group context (e.g., creating a project at the top level), we need a way for them to select which group's templates they want to browse.
See the investigation in #296815 (closed) (now closed as won't fix) for full context on the architectural decision.
Proposal
- When the
constrain_group_project_templatesfeature flag is enabled and no group context is available:- Display a new view on the group templates tab with a message explaining that a group must be selected
- Provide a dropdown to select from groups the user has access to that have custom project templates configured
- Once a group is selected, load and display that group's templates using the new finder
- When a group context is already available (e.g., creating a project within a group):
- Continue to show templates for that group directly (no change to current behavior)
Design considerations
- The dropdown should only list groups that have custom project templates configured
- Consider using an existing group selector component for consistency
- Selecting a group should reload the page with
namespace_id=group.idappended to the URL querystring values - Ensure the selected group persists during the session or page interaction
Acceptance criteria
- New view is displayed on the group templates tab when no group context is present and the feature flag is enabled
- Dropdown lists groups with custom project templates that the user can access
- Selecting a group loads and displays that group's templates
- Existing behavior is preserved when a group context is available
- Feature specs cover the new view and group selection flow
- Accessible and consistent with GitLab UI patterns