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
Show 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';
...
@@ -6,6 +6,7 @@ import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
FILTERED_SEARCH_TERM
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
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
FilteredSearch
from
'
~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue
'
;
import
{
AssigneeFilterType
}
from
'
~/boards/constants
'
;
export
default
{
export
default
{
i18n
:
{
i18n
:
{
...
@@ -37,6 +38,7 @@ export default {
...
@@ -37,6 +38,7 @@ export default {
authorUsername
,
authorUsername
,
labelName
,
labelName
,
assigneeUsername
,
assigneeUsername
,
assigneeId
,
search
,
search
,
milestoneTitle
,
milestoneTitle
,
iterationId
,
iterationId
,
...
@@ -63,6 +65,13 @@ export default {
...
@@ -63,6 +65,13 @@ export default {
});
});
}
}
if
(
assigneeId
)
{
filteredSearchValue
.
push
({
type
:
'
assignee
'
,
value
:
{
data
:
assigneeId
,
operator
:
'
=
'
},
});
}
if
(
types
)
{
if
(
types
)
{
filteredSearchValue
.
push
({
filteredSearchValue
.
push
({
type
:
'
type
'
,
type
:
'
type
'
,
...
@@ -211,6 +220,7 @@ export default {
...
@@ -211,6 +220,7 @@ export default {
authorUsername
,
authorUsername
,
labelName
,
labelName
,
assigneeUsername
,
assigneeUsername
,
assigneeId
,
search
,
search
,
milestoneTitle
,
milestoneTitle
,
types
,
types
,
...
@@ -246,6 +256,7 @@ export default {
...
@@ -246,6 +256,7 @@ export default {
author_username
:
authorUsername
,
author_username
:
authorUsername
,
'
label_name[]
'
:
labelName
,
'
label_name[]
'
:
labelName
,
assignee_username
:
assigneeUsername
,
assignee_username
:
assigneeUsername
,
assignee_id
:
assigneeId
,
milestone_title
:
milestoneTitle
,
milestone_title
:
milestoneTitle
,
iteration_id
:
iterationId
,
iteration_id
:
iterationId
,
search
,
search
,
...
@@ -295,7 +306,11 @@ export default {
...
@@ -295,7 +306,11 @@ export default {
filterParams
.
authorUsername
=
filter
.
value
.
data
;
filterParams
.
authorUsername
=
filter
.
value
.
data
;
break
;
break
;
case
'
assignee
'
:
case
'
assignee
'
:
if
(
Object
.
values
(
AssigneeFilterType
).
includes
(
filter
.
value
.
data
))
{
filterParams
.
assigneeId
=
filter
.
value
.
data
;
}
else
{
filterParams
.
assigneeUsername
=
filter
.
value
.
data
;
filterParams
.
assigneeUsername
=
filter
.
value
.
data
;
}
break
;
break
;
case
'
type
'
:
case
'
type
'
:
filterParams
.
types
=
filter
.
value
.
data
;
filterParams
.
types
=
filter
.
value
.
data
;
...
...
app/assets/javascripts/boards/constants.js
View file @
f8ee38c5
...
@@ -119,6 +119,7 @@ export const FilterFields = {
...
@@ -119,6 +119,7 @@ export const FilterFields = {
/* eslint-disable @gitlab/require-i18n-strings */
/* eslint-disable @gitlab/require-i18n-strings */
export
const
AssigneeFilterType
=
{
export
const
AssigneeFilterType
=
{
any
:
'
Any
'
,
any
:
'
Any
'
,
none
:
'
None
'
,
};
};
export
const
MilestoneFilterType
=
{
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';
...
@@ -4,7 +4,7 @@ import { compact } from 'lodash';
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
DEFAULT_
LABEL
_ANY
}
from
'
../constants
'
;
import
{
DEFAULT_
NONE
_ANY
}
from
'
../constants
'
;
import
BaseToken
from
'
./base_token.vue
'
;
import
BaseToken
from
'
./base_token.vue
'
;
...
@@ -36,7 +36,7 @@ export default {
...
@@ -36,7 +36,7 @@ export default {
},
},
computed
:
{
computed
:
{
defaultAuthors
()
{
defaultAuthors
()
{
return
this
.
config
.
defaultAuthors
||
[
DEFAULT_LABEL_ANY
]
;
return
this
.
config
.
defaultAuthors
||
DEFAULT_NONE_ANY
;
},
},
preloadedAuthors
()
{
preloadedAuthors
()
{
return
this
.
config
.
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
...
@@ -34,7 +34,9 @@ RSpec.describe 'Issue board filters', :js do
it
'and submit one as filter'
,
:aggregate_failures
do
it
'and submit one as filter'
,
:aggregate_failures
do
expect
(
find
(
'.board:nth-child(1)'
)).
to
have_selector
(
'.board-card'
,
count:
2
)
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
click_on
user
.
username
filter_submit
.
click
filter_submit
.
click
...
...
spec/frontend/boards/components/board_filtered_search_spec.js
View file @
f8ee38c5
...
@@ -118,6 +118,7 @@ describe('BoardFilteredSearch', () => {
...
@@ -118,6 +118,7 @@ describe('BoardFilteredSearch', () => {
it
(
'
sets the url params to the correct results
'
,
async
()
=>
{
it
(
'
sets the url params to the correct results
'
,
async
()
=>
{
const
mockFilters
=
[
const
mockFilters
=
[
{
type
:
'
author
'
,
value
:
{
data
:
'
root
'
,
operator
:
'
=
'
}
},
{
type
:
'
author
'
,
value
:
{
data
:
'
root
'
,
operator
:
'
=
'
}
},
{
type
:
'
assignee
'
,
value
:
{
data
:
'
root
'
,
operator
:
'
=
'
}
},
{
type
:
'
label
'
,
value
:
{
data
:
'
label
'
,
operator
:
'
=
'
}
},
{
type
:
'
label
'
,
value
:
{
data
:
'
label
'
,
operator
:
'
=
'
}
},
{
type
:
'
label
'
,
value
:
{
data
:
'
label2
'
,
operator
:
'
=
'
}
},
{
type
:
'
label
'
,
value
:
{
data
:
'
label2
'
,
operator
:
'
=
'
}
},
{
type
:
'
milestone
'
,
value
:
{
data
:
'
New Milestone
'
,
operator
:
'
=
'
}
},
{
type
:
'
milestone
'
,
value
:
{
data
:
'
New Milestone
'
,
operator
:
'
=
'
}
},
...
@@ -133,7 +134,26 @@ describe('BoardFilteredSearch', () => {
...
@@ -133,7 +134,26 @@ describe('BoardFilteredSearch', () => {
title
:
''
,
title
:
''
,
replace
:
true
,
replace
:
true
,
url
:
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';
...
@@ -10,10 +10,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
import
{
DEFAULT_NONE_ANY
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
DEFAULT_LABEL_ANY
,
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
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
'
;
import
BaseToken
from
'
~/vue_shared/components/filtered_search_bar/tokens/base_token.vue
'
;
...
@@ -276,7 +273,7 @@ describe('AuthorToken', () => {
...
@@ -276,7 +273,7 @@ describe('AuthorToken', () => {
expect
(
wrapper
.
find
(
GlDropdownDivider
).
exists
()).
toBe
(
false
);
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
({
wrapper
=
createComponent
({
active
:
true
,
active
:
true
,
config
:
{
...
mockAuthorToken
,
preloadedAuthors
:
mockPreloadedAuthors
},
config
:
{
...
mockAuthorToken
,
preloadedAuthors
:
mockPreloadedAuthors
},
...
@@ -287,8 +284,9 @@ describe('AuthorToken', () => {
...
@@ -287,8 +284,9 @@ describe('AuthorToken', () => {
const
suggestions
=
wrapper
.
findAll
(
GlFilteredSearchSuggestion
);
const
suggestions
=
wrapper
.
findAll
(
GlFilteredSearchSuggestion
);
expect
(
suggestions
).
toHaveLength
(
1
+
currentUserLength
);
expect
(
suggestions
).
toHaveLength
(
2
+
currentUserLength
);
expect
(
suggestions
.
at
(
0
).
text
()).
toBe
(
DEFAULT_LABEL_ANY
.
text
);
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
'
,
()
=>
{
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