Commit e1085b25 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'issue_325742' into 'master'

Prevent executing expensive query to show group issues zero state view

See merge request gitlab-org/gitlab!57411
parents 69f1919c 8d06b52e
...@@ -5,32 +5,29 @@ ...@@ -5,32 +5,29 @@
= content_for :meta_tags do = content_for :meta_tags do
= auto_discovery_link_tag(:atom, safe_params.merge(rss_url_options).to_h, title: "#{@group.name} issues") = auto_discovery_link_tag(:atom, safe_params.merge(rss_url_options).to_h, title: "#{@group.name} issues")
- if group_issues_count(state: 'all') == 0 .top-area
= render 'shared/empty_states/issues', project_select_button: true = render 'shared/issuable/nav', type: :issues
- else .nav-controls
.top-area = render 'shared/issuable/feed_buttons'
= render 'shared/issuable/nav', type: :issues
.nav-controls
= render 'shared/issuable/feed_buttons'
- if @can_bulk_update - if @can_bulk_update
= render_if_exists 'shared/issuable/bulk_update_button', type: :issues = render_if_exists 'shared/issuable/bulk_update_button', type: :issues
= render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", type: :issues, with_feature_enabled: 'issues', with_shared: false, include_projects_in_subgroups: true = render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", type: :issues, with_feature_enabled: 'issues', with_shared: false, include_projects_in_subgroups: true
= render 'shared/issuable/search_bar', type: :issues = render 'shared/issuable/search_bar', type: :issues
- if @can_bulk_update - if @can_bulk_update
= render_if_exists 'shared/issuable/group_bulk_update_sidebar', group: @group, type: :issues = render_if_exists 'shared/issuable/group_bulk_update_sidebar', group: @group, type: :issues
- if Feature.enabled?(:vue_issuables_list, @group) - if Feature.enabled?(:vue_issuables_list, @group) && @issues.to_a.any?
- if use_startup_call? - if use_startup_call?
- add_page_startup_api_call(api_v4_groups_issues_path(id: @group.id, params: startup_call_params)) - add_page_startup_api_call(api_v4_groups_issues_path(id: @group.id, params: startup_call_params))
.js-issuables-list{ data: { endpoint: expose_url(api_v4_groups_issues_path(id: @group.id)), .js-issuables-list{ data: { endpoint: expose_url(api_v4_groups_issues_path(id: @group.id)),
'can-bulk-edit': @can_bulk_update.to_json, 'can-bulk-edit': @can_bulk_update.to_json,
'empty-state-meta': { svg_path: image_path('illustrations/issues.svg') }, 'empty-state-meta': { svg_path: image_path('illustrations/issues.svg') },
'sort-key': @sort, 'sort-key': @sort,
type: 'issues', type: 'issues',
'scoped-labels-available': scoped_labels_available?(@group).to_json } } 'scoped-labels-available': scoped_labels_available?(@group).to_json } }
- else - else
= render 'shared/issues' = render 'shared/issues', project_select_button: true
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
= render partial: 'projects/issues/issue', collection: @issues = render partial: 'projects/issues/issue', collection: @issues
= paginate @issues, theme: "gitlab" = paginate @issues, theme: "gitlab"
- else - else
= render 'shared/empty_states/issues' - project_select_button = local_assigns.fetch(:project_select_button, false)
= render 'shared/empty_states/issues', project_select_button: project_select_button
...@@ -108,7 +108,7 @@ RSpec.describe 'Group issues page' do ...@@ -108,7 +108,7 @@ RSpec.describe 'Group issues page' do
it 'shows projects only with issues feature enabled', :js do it 'shows projects only with issues feature enabled', :js do
find('.empty-state .js-lazy-loaded') find('.empty-state .js-lazy-loaded')
find('.new-project-item-link').click find('.empty-state .new-project-item-link').click
page.within('.select2-results') do page.within('.select2-results') do
expect(page).to have_content(project.full_name) expect(page).to have_content(project.full_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment