<%= render Viral::Pagy::PaginationComponent.new(
diff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erb
index 0f82030447..1b04a85729 100644
--- a/app/views/groups/show.html.erb
+++ b/app/views/groups/show.html.erb
@@ -1,19 +1,19 @@
<%= render Viral::PageHeaderComponent.new(title: @group.name, id: @group.puid, subtitle: @group.description) do |component| %>
<%= component.icon do %>
<%= viral_avatar(
- name: @group.name,
- colour_string: "#{@group.name}-#{@group.id}",
- size: :large
- ) %>
+ name: @group.name,
+ colour_string: "#{@group.name}-#{@group.id}",
+ size: :large,
+ ) %>
<% end %>
<%= component.with_buttons do %>
<% if allowed_to?(:new?, @group) %>
<%= link_to t(:"groups.show.create_subgroup_button"),
- new_group_path(parent_id: @group.id),
- class: "button button--size-default button--state-default" %>
+ new_group_path(parent_id: @group.id),
+ class: "button button--size-default button--state-default" %>
<%= link_to t(:"groups.show.create_project_button"),
- new_project_path(group_id: @group.id),
- class: "button button--size-default button--state-primary ml-2" %>
+ new_project_path(group_id: @group.id),
+ class: "button button--size-default button--state-primary ml-2" %>
<% end %>
<% end %>
<% end %>
@@ -23,44 +23,58 @@
<%= t(:".tabs.subgroups_and_projects") %>
<% end %>
<%= tabs.with_tab(url: group_path(@group, tab: "shared_namespaces"), controls: "group-projects", selected: @tab == "shared_namespaces") do %>
- <%= t(:'.tabs.shared_namespaces') %>
+ <%= t(:".tabs.shared_namespaces") %>
<% end %>
<%= tabs.with_tab_content do %>
- <%= turbo_frame_tag "group_show_tab_content", "data-turbo-temporary": true, src: (
- if @tab == "shared_namespaces"
- group_shared_namespaces_path(@group, format: :turbo_stream)
- else
- group_subgroups_path(@group, format: :turbo_stream)
- end
- ) do %>
-
-
- <% 10.times do %>
-
+
+ <% if @tab == "shared_namespaces" %>
+ <%= turbo_frame_tag "group_show_tab_content", "data-turbo-temporary": true, src: group_shared_namespaces_path(@group, format: :turbo_stream) do %>
+
+
+ <% 10.times do %>
+
-
-
- |
+
+
+ |
-
+
+ <% end %>
+
+
<% end %>
-
-
- <% end %>
+ <% else %>
+
+ <%= search_form_for @q, url: group_path(@group), html: { "data-controller": "filters" } do |f| %>
+ <%= f.label :name_or_puid_cont, t("general.search.name_puid"), class: "sr-only" %>
+
+
+ <%= viral_icon(name: "magnifying_glass", classes: "h-5 w-5") %>
+
+ <%= f.search_field :name_or_puid_cont,
+ "data-action": "filters#submit",
+ class:
+ "block w-full p-2.5 pl-10 text-sm text-slate-900 border border-slate-300 rounded-lg bg-slate-50 focus:ring-primary-500 focus:border-primary-500 dark:bg-slate-700 dark:border-slate-600 dark:placeholder-slate-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500",
+ placeholder: t("general.search.name_puid") %>
+
+ <% end %>
+
+ <%= render "groups/subgroups/index", locals: { namespaces: @namespaces } %>
+ <% end %>
+
<% end %>
<% end %>
-
diff --git a/app/views/groups/subgroups/_index.html.erb b/app/views/groups/subgroups/_index.html.erb
new file mode 100644
index 0000000000..1ba13fbc81
--- /dev/null
+++ b/app/views/groups/subgroups/_index.html.erb
@@ -0,0 +1,20 @@
+
+
+ <% if @namespaces.length > 0 %>
+ <%= render NamespaceTreeContainerComponent.new(
+ namespaces: @namespaces,
+ path: "group_subgroups_path",
+ path_args: {
+ group_id: @group.full_path,
+ },
+ type: [Group.sti_name, Namespaces::ProjectNamespace.sti_name],
+ ) %>
+ <%= render Viral::Pagy::FullComponent.new(@pagy, item: "Subgroups and projects") %>
+ <% else %>
+ <%= viral_empty(
+ title: t(:"groups.show.subgroups.no_subgroups.title"),
+ description: t(:"groups.show.subgroups.no_subgroups.description"),
+ icon_name: :squares_2x2,
+ ) %>
+ <% end %>
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2159877c69..73369e4564 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -580,6 +580,8 @@ en:
project: Create new project
screen_reader:
close: Close
+ search:
+ name_puid: Search by name or ID
groups:
activity:
title: Group activity
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index ef9f21b03b..525d6a40b8 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -580,6 +580,8 @@ fr:
project: Create new project
screen_reader:
close: Close
+ search:
+ name_puid: Search by name or ID
groups:
activity:
title: Group activity
diff --git a/test/controllers/groups/subgroups_controller_test.rb b/test/controllers/groups/subgroups_controller_test.rb
index 4883ea56b7..4f4f062b9e 100644
--- a/test/controllers/groups/subgroups_controller_test.rb
+++ b/test/controllers/groups/subgroups_controller_test.rb
@@ -8,12 +8,6 @@ class SubgroupsControllerTest < ActionDispatch::IntegrationTest
sign_in users(:john_doe)
@group = groups(:group_one)
end
-
- test 'should redirect to groups index when html format requested' do
- get group_subgroups_url(@group)
- assert_redirected_to group_url(@group)
- end
-
test 'should get fragment of namesapce tree' do
get group_subgroups_url(@group), params: { parent_id: @group.id, format: :turbo_stream }
assert_response :ok
diff --git a/test/system/groups_test.rb b/test/system/groups_test.rb
index 7624e6ff87..2fa507d9f2 100644
--- a/test/system/groups_test.rb
+++ b/test/system/groups_test.rb
@@ -132,11 +132,9 @@ def setup
click_on I18n.t('groups.sidebar.settings')
click_link I18n.t('groups.sidebar.general')
- within all('form[action="/group-1"]')[0] do
- fill_in I18n.t('activerecord.attributes.group.name'), with: group_name
- fill_in I18n.t('activerecord.attributes.group.description'), with: group_description
- click_on I18n.t('groups.edit.details.submit')
- end
+ fill_in I18n.t('activerecord.attributes.group.name'), with: group_name
+ fill_in I18n.t('activerecord.attributes.group.description'), with: group_description
+ click_on I18n.t('groups.edit.details.submit')
assert_text I18n.t('groups.update.success', group_name:)
@@ -389,7 +387,9 @@ def setup
assert_selector 'h1', text: @group.name
assert_selector 'a.active', text: I18n.t(:'groups.show.tabs.subgroups_and_projects')
- assert_selector 'li.namespace-entry', count: 21
+ assert_selector 'li.namespace-entry', count: 20
+ click_on I18n.t(:'components.pagination.next')
+ assert_selector 'li.namespace-entry', count: 1
click_on I18n.t(:'groups.show.tabs.shared_namespaces')
assert_selector 'a.active', text: I18n.t(:'groups.show.tabs.shared_namespaces')
@@ -403,4 +403,12 @@ def setup
assert_selector 'div.namespace-entry-contents', count: 0
assert_text I18n.t('groups.show.shared_namespaces.no_shared.title')
end
+
+ test 'search subgroups and projects' do
+ @group = groups(:group_one)
+ visit group_url(@group)
+ assert_text I18n.t(:'components.pagination.next')
+ fill_in I18n.t('general.search.name_puid'), with: 'project 2'
+ assert_selector 'li.namespace-entry', count: 5
+ end
end