Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2861c45f
Commit
2861c45f
authored
Apr 22, 2021
by
Terri Chu
Committed by
Dmitry Gruzd
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search: Always show scope tabs regardless of tab selected
parent
df225b39
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
3 deletions
+68
-3
ee/app/services/ee/search_service.rb
ee/app/services/ee/search_service.rb
+4
-0
ee/app/views/search/_category_elasticsearch.html.haml
ee/app/views/search/_category_elasticsearch.html.haml
+1
-1
ee/changelogs/unreleased/326470-global-search-lock-the-order-of-the-scope-tabs.yml
...326470-global-search-lock-the-order-of-the-scope-tabs.yml
+5
-0
ee/spec/controllers/ee/search_controller_spec.rb
ee/spec/controllers/ee/search_controller_spec.rb
+58
-2
No files found.
ee/app/services/ee/search_service.rb
View file @
2861c45f
...
...
@@ -23,5 +23,9 @@ module EE
def
show_epics?
search_service
.
allowed_scopes
.
include?
(
'epics'
)
end
def
show_elasticsearch_tabs?
::
Gitlab
::
CurrentSettings
.
search_using_elasticsearch?
(
scope:
search_service
.
elasticsearchable_scope
)
end
end
end
ee/app/views/search/_category_elasticsearch.html.haml
View file @
2861c45f
-
if
search_service
.
use_elasticsearch
?
-
if
search_service
.
show_elasticsearch_tabs
?
=
search_filter_link
'notes'
,
_
(
"Comments"
)
=
search_filter_link
'blobs'
,
_
(
"Code"
),
data:
{
qa_selector:
'code_tab'
}
=
search_filter_link
'commits'
,
_
(
"Commits"
)
...
...
ee/changelogs/unreleased/326470-global-search-lock-the-order-of-the-scope-tabs.yml
0 → 100644
View file @
2861c45f
---
title
:
Lock the order of the Search scope tabs
merge_request
:
59777
author
:
type
:
fixed
ee/spec/controllers/ee/search_controller_spec.rb
View file @
2861c45f
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
SearchController
do
RSpec
.
describe
SearchController
,
:elastic
do
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
...
...
@@ -10,7 +10,7 @@ RSpec.describe SearchController do
end
describe
'GET #show'
do
context
'unique users tracking'
,
:elastic
do
context
'unique users tracking'
do
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
allow
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
).
to
receive
(
:track_event
)
...
...
@@ -70,5 +70,61 @@ RSpec.describe SearchController do
end
end
end
shared_examples
'renders the elasticsearch tabs if elasticsearch is enabled'
do
using
RSpec
::
Parameterized
::
TableSyntax
render_views
subject
{
get
:show
,
params:
request_params
,
format: :html
}
where
(
:scope
)
{
%w[projects issues merge_requests milestones epics notes blobs commits wiki_blobs users]
}
with_them
do
context
'when elasticsearch is enabled'
do
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
end
it
'shows the elasticsearch tabs'
do
subject
expect
(
response
.
body
).
to
have_link
(
'Code'
)
expect
(
response
.
body
).
to
have_link
(
'Wiki'
)
expect
(
response
.
body
).
to
have_link
(
'Comments'
)
expect
(
response
.
body
).
to
have_link
(
'Commits'
)
end
end
context
'when elasticsearch is disabled'
do
before
do
stub_ee_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
it
'does not show the elasticsearch tabs'
do
subject
expect
(
response
.
body
).
not_to
have_link
(
'Code'
)
expect
(
response
.
body
).
not_to
have_link
(
'Wiki'
)
expect
(
response
.
body
).
not_to
have_link
(
'Comments'
)
expect
(
response
.
body
).
not_to
have_link
(
'Commits'
)
end
end
end
end
context
'global search'
do
let
(
:request_params
)
{
{
scope:
scope
,
search:
'term'
}
}
it_behaves_like
'renders the elasticsearch tabs if elasticsearch is enabled'
end
context
'group search'
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:request_params
)
{
{
group_id:
group
.
id
,
scope:
scope
,
search:
'term'
}
}
it_behaves_like
'renders the elasticsearch tabs if elasticsearch is enabled'
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment