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
f8ee38c5
Commit
f8ee38c5
authored
Jan 13, 2022
by
Scott Stern
Committed by
Mark Florian
Jan 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add assignee wildcard id on new filtered search
Addresses
https://gitlab.com/gitlab-org/gitlab/-/issues/349569
.
parent
0c3b6bf0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
12 deletions
+48
-12
app/assets/javascripts/boards/components/board_filtered_search.vue
...s/javascripts/boards/components/board_filtered_search.vue
+16
-1
app/assets/javascripts/boards/constants.js
app/assets/javascripts/boards/constants.js
+1
-0
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue
...ed/components/filtered_search_bar/tokens/author_token.vue
+2
-2
spec/features/boards/board_filters_spec.rb
spec/features/boards/board_filters_spec.rb
+3
-1
spec/frontend/boards/components/board_filtered_search_spec.js
.../frontend/boards/components/board_filtered_search_spec.js
+21
-1
spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js
...omponents/filtered_search_bar/tokens/author_token_spec.js
+5
-7
No files found.
app/assets/javascripts/boards/components/board_filtered_search.vue
View file @
f8ee38c5
...
...
@@ -6,6 +6,7 @@ import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
import
{
__
}
from
'
~/locale
'
;
import
{
FILTERED_SEARCH_TERM
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
import
FilteredSearch
from
'
~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue
'
;
import
{
AssigneeFilterType
}
from
'
~/boards/constants
'
;
export
default
{
i18n
:
{
...
...
@@ -37,6 +38,7 @@ export default {
authorUsername
,
labelName
,
assigneeUsername
,
assigneeId
,
search
,
milestoneTitle
,
iterationId
,
...
...
@@ -63,6 +65,13 @@ export default {
});
}
if
(
assigneeId
)
{
filteredSearchValue
.
push
({
type
:
'
assignee
'
,
value
:
{
data
:
assigneeId
,
operator
:
'
=
'
},
});
}
if
(
types
)
{
filteredSearchValue
.
push
({
type
:
'
type
'
,
...
...
@@ -211,6 +220,7 @@ export default {
authorUsername
,
labelName
,
assigneeUsername
,
assigneeId
,
search
,
milestoneTitle
,
types
,
...
...
@@ -246,6 +256,7 @@ export default {
author_username
:
authorUsername
,
'
label_name[]
'
:
labelName
,
assignee_username
:
assigneeUsername
,
assignee_id
:
assigneeId
,
milestone_title
:
milestoneTitle
,
iteration_id
:
iterationId
,
search
,
...
...
@@ -295,7 +306,11 @@ export default {
filterParams
.
authorUsername
=
filter
.
value
.
data
;
break
;
case
'
assignee
'
:
filterParams
.
assigneeUsername
=
filter
.
value
.
data
;
if
(
Object
.
values
(
AssigneeFilterType
).
includes
(
filter
.
value
.
data
))
{
filterParams
.
assigneeId
=
filter
.
value
.
data
;
}
else
{
filterParams
.
assigneeUsername
=
filter
.
value
.
data
;
}
break
;
case
'
type
'
:
filterParams
.
types
=
filter
.
value
.
data
;
...
...
app/assets/javascripts/boards/constants.js
View file @
f8ee38c5
...
...
@@ -119,6 +119,7 @@ export const FilterFields = {
/* eslint-disable @gitlab/require-i18n-strings */
export
const
AssigneeFilterType
=
{
any
:
'
Any
'
,
none
:
'
None
'
,
};
export
const
MilestoneFilterType
=
{
...
...
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue
View file @
f8ee38c5
...
...
@@ -4,7 +4,7 @@ import { compact } from 'lodash';
import
createFlash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
DEFAULT_
LABEL
_ANY
}
from
'
../constants
'
;
import
{
DEFAULT_
NONE
_ANY
}
from
'
../constants
'
;
import
BaseToken
from
'
./base_token.vue
'
;
...
...
@@ -36,7 +36,7 @@ export default {
},
computed
:
{
defaultAuthors
()
{
return
this
.
config
.
defaultAuthors
||
[
DEFAULT_LABEL_ANY
]
;
return
this
.
config
.
defaultAuthors
||
DEFAULT_NONE_ANY
;
},
preloadedAuthors
()
{
return
this
.
config
.
preloadedAuthors
||
[];
...
...
spec/features/boards/board_filters_spec.rb
View file @
f8ee38c5
...
...
@@ -34,7 +34,9 @@ RSpec.describe 'Issue board filters', :js do
it
'and submit one as filter'
,
:aggregate_failures
do
expect
(
find
(
'.board:nth-child(1)'
)).
to
have_selector
(
'.board-card'
,
count:
2
)
expect_filtered_search_dropdown_results
(
filter_dropdown
,
3
)
wait_for_requests
expect_filtered_search_dropdown_results
(
filter_dropdown
,
4
)
click_on
user
.
username
filter_submit
.
click
...
...
spec/frontend/boards/components/board_filtered_search_spec.js
View file @
f8ee38c5
...
...
@@ -118,6 +118,7 @@ describe('BoardFilteredSearch', () => {
it
(
'
sets the url params to the correct results
'
,
async
()
=>
{
const
mockFilters
=
[
{
type
:
'
author
'
,
value
:
{
data
:
'
root
'
,
operator
:
'
=
'
}
},
{
type
:
'
assignee
'
,
value
:
{
data
:
'
root
'
,
operator
:
'
=
'
}
},
{
type
:
'
label
'
,
value
:
{
data
:
'
label
'
,
operator
:
'
=
'
}
},
{
type
:
'
label
'
,
value
:
{
data
:
'
label2
'
,
operator
:
'
=
'
}
},
{
type
:
'
milestone
'
,
value
:
{
data
:
'
New Milestone
'
,
operator
:
'
=
'
}
},
...
...
@@ -133,7 +134,26 @@ describe('BoardFilteredSearch', () => {
title
:
''
,
replace
:
true
,
url
:
'
http://test.host/?author_username=root&label_name[]=label&label_name[]=label2&milestone_title=New+Milestone&iteration_id=3341&types=INCIDENT&weight=2&release_tag=v1.0.0
'
,
'
http://test.host/?author_username=root&label_name[]=label&label_name[]=label2&assignee_username=root&milestone_title=New+Milestone&iteration_id=3341&types=INCIDENT&weight=2&release_tag=v1.0.0
'
,
});
});
describe
(
'
when assignee is passed a wildcard value
'
,
()
=>
{
const
url
=
(
arg
)
=>
`http://test.host/?assignee_id=
${
arg
}
`
;
it
.
each
([
[
'
None
'
,
url
(
'
None
'
)],
[
'
Any
'
,
url
(
'
Any
'
)],
])(
'
sets the url param %s
'
,
(
assigneeParam
,
expected
)
=>
{
const
mockFilters
=
[{
type
:
'
assignee
'
,
value
:
{
data
:
assigneeParam
,
operator
:
'
=
'
}
}];
jest
.
spyOn
(
urlUtility
,
'
updateHistory
'
);
findFilteredSearch
().
vm
.
$emit
(
'
onFilter
'
,
mockFilters
);
expect
(
urlUtility
.
updateHistory
).
toHaveBeenCalledWith
({
title
:
''
,
replace
:
true
,
url
:
expected
,
});
});
});
});
...
...
spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js
View file @
f8ee38c5
...
...
@@ -10,10 +10,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import
createFlash
from
'
~/flash
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
DEFAULT_LABEL_ANY
,
DEFAULT_NONE_ANY
,
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
import
{
DEFAULT_NONE_ANY
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
import
AuthorToken
from
'
~/vue_shared/components/filtered_search_bar/tokens/author_token.vue
'
;
import
BaseToken
from
'
~/vue_shared/components/filtered_search_bar/tokens/base_token.vue
'
;
...
...
@@ -276,7 +273,7 @@ describe('AuthorToken', () => {
expect
(
wrapper
.
find
(
GlDropdownDivider
).
exists
()).
toBe
(
false
);
});
it
(
'
renders `DEFAULT_
LABEL
_ANY` as default suggestions
'
,
async
()
=>
{
it
(
'
renders `DEFAULT_
NONE
_ANY` as default suggestions
'
,
async
()
=>
{
wrapper
=
createComponent
({
active
:
true
,
config
:
{
...
mockAuthorToken
,
preloadedAuthors
:
mockPreloadedAuthors
},
...
...
@@ -287,8 +284,9 @@ describe('AuthorToken', () => {
const
suggestions
=
wrapper
.
findAll
(
GlFilteredSearchSuggestion
);
expect
(
suggestions
).
toHaveLength
(
1
+
currentUserLength
);
expect
(
suggestions
.
at
(
0
).
text
()).
toBe
(
DEFAULT_LABEL_ANY
.
text
);
expect
(
suggestions
).
toHaveLength
(
2
+
currentUserLength
);
expect
(
suggestions
.
at
(
0
).
text
()).
toBe
(
DEFAULT_NONE_ANY
[
0
].
text
);
expect
(
suggestions
.
at
(
1
).
text
()).
toBe
(
DEFAULT_NONE_ANY
[
1
].
text
);
});
it
(
'
emits listeners in the base-token
'
,
()
=>
{
...
...
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