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
1a9c7d3f
Commit
1a9c7d3f
authored
May 25, 2017
by
Alfredo Sumaran
Committed by
Phil Hughes
May 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow multiple assignees to be chosen from dropdown filters
parent
4e2209f1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
46 deletions
+56
-46
app/assets/javascripts/filtered_search/filtered_search_bundle.js
...ets/javascripts/filtered_search/filtered_search_bundle.js
+1
-1
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
...ripts/filtered_search/filtered_search_dropdown_manager.js
+1
-1
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+1
-1
app/assets/javascripts/filtered_search/filtered_search_token_keys_issues_ee.js
...s/filtered_search/filtered_search_token_keys_issues_ee.js
+14
-9
spec/javascripts/filtered_search/filtered_search_token_keys_with_weights_spec.js
...ed_search/filtered_search_token_keys_with_weights_spec.js
+39
-34
No files found.
app/assets/javascripts/filtered_search/filtered_search_bundle.js
View file @
1a9c7d3f
...
...
@@ -10,4 +10,4 @@ import './filtered_search_tokenizer';
import
'
./filtered_search_visual_tokens
'
;
// EE-only
import
'
./filtered_search_token_keys_
with_weights
'
;
import
'
./filtered_search_token_keys_
issues_ee
'
;
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
View file @
1a9c7d3f
...
...
@@ -11,7 +11,7 @@ class FilteredSearchDropdownManager {
this
.
page
=
page
;
if
(
this
.
page
===
'
issues
'
||
this
.
page
===
'
boards
'
)
{
this
.
filteredSearchTokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
;
this
.
filteredSearchTokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
;
}
this
.
setupMapping
();
...
...
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
1a9c7d3f
...
...
@@ -14,7 +14,7 @@ class FilteredSearchManager {
this
.
filteredSearchTokenKeys
=
gl
.
FilteredSearchTokenKeys
;
if
(
page
===
'
issues
'
||
page
===
'
boards
'
)
{
this
.
filteredSearchTokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
;
this
.
filteredSearchTokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
;
}
this
.
recentSearchesStore
=
new
RecentSearchesStore
({
...
...
app/assets/javascripts/filtered_search/filtered_search_token_keys_
with_weights
.js
→
app/assets/javascripts/filtered_search/filtered_search_token_keys_
issues_ee
.js
View file @
1a9c7d3f
...
...
@@ -18,15 +18,20 @@ const weightConditions = [{
value
:
'
any
'
,
}];
class
FilteredSearchTokenKeys
WithWeights
extends
gl
.
FilteredSearchTokenKeys
{
class
FilteredSearchTokenKeys
IssuesEE
extends
gl
.
FilteredSearchTokenKeys
{
static
get
()
{
const
tokenKeys
=
Array
.
from
(
super
.
get
());
// Enable multiple assignees
const
assigneeTokenKey
=
tokenKeys
.
find
(
tk
=>
tk
.
key
===
'
assignee
'
);
assigneeTokenKey
.
type
=
'
array
'
;
tokenKeys
.
push
(
weightTokenKey
);
return
tokenKeys
;
}
static
getKeys
()
{
const
tokenKeys
=
FilteredSearchTokenKeys
WithWeights
.
get
();
const
tokenKeys
=
FilteredSearchTokenKeys
IssuesEE
.
get
();
return
tokenKeys
.
map
(
i
=>
i
.
key
);
}
...
...
@@ -40,18 +45,18 @@ class FilteredSearchTokenKeysWithWeights extends gl.FilteredSearchTokenKeys {
}
static
searchByKey
(
key
)
{
const
tokenKeys
=
FilteredSearchTokenKeys
WithWeights
.
get
();
const
tokenKeys
=
FilteredSearchTokenKeys
IssuesEE
.
get
();
return
tokenKeys
.
find
(
tokenKey
=>
tokenKey
.
key
===
key
)
||
null
;
}
static
searchBySymbol
(
symbol
)
{
const
tokenKeys
=
FilteredSearchTokenKeys
WithWeights
.
get
();
const
tokenKeys
=
FilteredSearchTokenKeys
IssuesEE
.
get
();
return
tokenKeys
.
find
(
tokenKey
=>
tokenKey
.
symbol
===
symbol
)
||
null
;
}
static
searchByKeyParam
(
keyParam
)
{
const
tokenKeys
=
FilteredSearchTokenKeys
WithWeights
.
get
();
const
alternativeTokenKeys
=
FilteredSearchTokenKeys
WithWeights
.
getAlternatives
();
const
tokenKeys
=
FilteredSearchTokenKeys
IssuesEE
.
get
();
const
alternativeTokenKeys
=
FilteredSearchTokenKeys
IssuesEE
.
getAlternatives
();
const
tokenKeysWithAlternative
=
tokenKeys
.
concat
(
alternativeTokenKeys
);
return
tokenKeysWithAlternative
.
find
((
tokenKey
)
=>
{
...
...
@@ -66,16 +71,16 @@ class FilteredSearchTokenKeysWithWeights extends gl.FilteredSearchTokenKeys {
}
static
searchByConditionUrl
(
url
)
{
const
conditions
=
FilteredSearchTokenKeys
WithWeights
.
getConditions
();
const
conditions
=
FilteredSearchTokenKeys
IssuesEE
.
getConditions
();
return
conditions
.
find
(
condition
=>
condition
.
url
===
url
)
||
null
;
}
static
searchByConditionKeyValue
(
key
,
value
)
{
const
conditions
=
FilteredSearchTokenKeys
WithWeights
.
getConditions
();
const
conditions
=
FilteredSearchTokenKeys
IssuesEE
.
getConditions
();
return
conditions
.
find
(
condition
=>
condition
.
tokenKey
===
key
&&
condition
.
value
===
value
)
||
null
;
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchTokenKeys
WithWeights
=
FilteredSearchTokenKeysWithWeights
;
gl
.
FilteredSearchTokenKeys
IssuesEE
=
FilteredSearchTokenKeysIssuesEE
;
spec/javascripts/filtered_search/filtered_search_token_keys_with_weights_spec.js
View file @
1a9c7d3f
import
'
~/extensions/array
'
;
import
'
~/filtered_search/filtered_search_token_keys_
with_weights
'
;
import
'
~/filtered_search/filtered_search_token_keys_
issues_ee
'
;
(()
=>
{
describe
(
'
Filtered Search Token Keys
With Weights
'
,
()
=>
{
describe
(
'
Filtered Search Token Keys
(Issues EE)
'
,
()
=>
{
const
weightTokenKey
=
{
key
:
'
weight
'
,
type
:
'
string
'
,
...
...
@@ -15,7 +15,7 @@ import '~/filtered_search/filtered_search_token_keys_with_weights';
let
tokenKeys
;
beforeEach
(()
=>
{
tokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
();
tokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
();
});
it
(
'
should return tokenKeys
'
,
()
=>
{
...
...
@@ -32,16 +32,21 @@ import '~/filtered_search/filtered_search_token_keys_with_weights';
});
it
(
'
should always return the same array
'
,
()
=>
{
const
tokenKeys2
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
();
const
tokenKeys2
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
();
expect
(
tokenKeys
).
toEqual
(
tokenKeys2
);
});
it
(
'
should return assignee as an array
'
,
()
=>
{
const
assignee
=
tokenKeys
.
find
(
tokenKey
=>
tokenKey
.
key
===
'
assignee
'
);
expect
(
assignee
.
type
).
toEqual
(
'
array
'
);
});
});
describe
(
'
getKeys
'
,
()
=>
{
it
(
'
should return keys
'
,
()
=>
{
const
getKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
getKeys
();
const
keys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
().
map
(
i
=>
i
.
key
);
const
getKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
getKeys
();
const
keys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
().
map
(
i
=>
i
.
key
);
keys
.
forEach
((
key
,
i
)
=>
{
expect
(
key
).
toEqual
(
getKeys
[
i
]);
...
...
@@ -53,7 +58,7 @@ import '~/filtered_search/filtered_search_token_keys_with_weights';
let
conditions
;
beforeEach
(()
=>
{
conditions
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
getConditions
();
conditions
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
getConditions
();
});
it
(
'
should return conditions
'
,
()
=>
{
...
...
@@ -72,89 +77,89 @@ import '~/filtered_search/filtered_search_token_keys_with_weights';
describe
(
'
searchByKey
'
,
()
=>
{
it
(
'
should return null when key not found
'
,
()
=>
{
const
tokenKey
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchByKey
(
'
notakey
'
);
const
tokenKey
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByKey
(
'
notakey
'
);
expect
(
tokenKey
===
null
).
toBe
(
true
);
});
it
(
'
should return tokenKey when found by key
'
,
()
=>
{
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
();
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchByKey
(
tokenKeys
[
0
].
key
);
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
();
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByKey
(
tokenKeys
[
0
].
key
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return weight tokenKey when found by weight key
'
,
()
=>
{
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
();
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
();
const
match
=
tokenKeys
.
find
(
tk
=>
tk
.
key
===
weightTokenKey
.
key
);
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchByKey
(
weightTokenKey
.
key
);
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByKey
(
weightTokenKey
.
key
);
expect
(
result
).
toEqual
(
match
);
});
});
describe
(
'
searchBySymbol
'
,
()
=>
{
it
(
'
should return null when symbol not found
'
,
()
=>
{
const
tokenKey
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchBySymbol
(
'
notasymbol
'
);
const
tokenKey
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchBySymbol
(
'
notasymbol
'
);
expect
(
tokenKey
===
null
).
toBe
(
true
);
});
it
(
'
should return tokenKey when found by symbol
'
,
()
=>
{
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
();
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchBySymbol
(
tokenKeys
[
0
].
symbol
);
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
();
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchBySymbol
(
tokenKeys
[
0
].
symbol
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return weight tokenKey when found by weight symbol
'
,
()
=>
{
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
();
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
();
const
match
=
tokenKeys
.
find
(
tk
=>
tk
.
key
===
weightTokenKey
.
key
);
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchBySymbol
(
weightTokenKey
.
symbol
);
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchBySymbol
(
weightTokenKey
.
symbol
);
expect
(
result
).
toEqual
(
match
);
});
});
describe
(
'
searchByKeyParam
'
,
()
=>
{
it
(
'
should return null when key param not found
'
,
()
=>
{
const
tokenKey
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchByKeyParam
(
'
notakeyparam
'
);
const
tokenKey
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByKeyParam
(
'
notakeyparam
'
);
expect
(
tokenKey
===
null
).
toBe
(
true
);
});
it
(
'
should return tokenKey when found by key param
'
,
()
=>
{
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
();
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
();
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByKeyParam
(
`
${
tokenKeys
[
0
].
key
}
_
${
tokenKeys
[
0
].
param
}
`
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return alternative tokenKey when found by key param
'
,
()
=>
{
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
getAlternatives
();
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
getAlternatives
();
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByKeyParam
(
`
${
tokenKeys
[
0
].
key
}
_
${
tokenKeys
[
0
].
param
}
`
);
expect
(
result
).
toEqual
(
tokenKeys
[
0
]);
});
it
(
'
should return weight tokenKey when found by weight key param
'
,
()
=>
{
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
get
();
const
tokenKeys
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
get
();
const
match
=
tokenKeys
.
find
(
tk
=>
tk
.
key
===
weightTokenKey
.
key
);
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchByKeyParam
(
weightTokenKey
.
key
);
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByKeyParam
(
weightTokenKey
.
key
);
expect
(
result
).
toEqual
(
match
);
});
});
describe
(
'
searchByConditionUrl
'
,
()
=>
{
it
(
'
should return null when condition url not found
'
,
()
=>
{
const
condition
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
searchByConditionUrl
(
null
);
const
condition
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByConditionUrl
(
null
);
expect
(
condition
===
null
).
toBe
(
true
);
});
it
(
'
should return condition when found by url
'
,
()
=>
{
const
conditions
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
getConditions
();
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
const
conditions
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
getConditions
();
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByConditionUrl
(
conditions
[
0
].
url
);
expect
(
result
).
toBe
(
conditions
[
0
]);
});
it
(
'
should return weight condition when found by weight url
'
,
()
=>
{
const
conditions
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
getConditions
();
const
conditions
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
getConditions
();
const
weightConditions
=
conditions
.
filter
(
c
=>
c
.
tokenKey
===
'
weight
'
);
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByConditionUrl
(
weightConditions
[
0
].
url
);
expect
(
result
).
toBe
(
weightConditions
[
0
]);
});
...
...
@@ -162,22 +167,22 @@ import '~/filtered_search/filtered_search_token_keys_with_weights';
describe
(
'
searchByConditionKeyValue
'
,
()
=>
{
it
(
'
should return null when condition tokenKey and value not found
'
,
()
=>
{
const
condition
=
gl
.
FilteredSearchTokenKeys
WithWeights
const
condition
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByConditionKeyValue
(
null
,
null
);
expect
(
condition
===
null
).
toBe
(
true
);
});
it
(
'
should return condition when found by tokenKey and value
'
,
()
=>
{
const
conditions
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
getConditions
();
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
const
conditions
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
getConditions
();
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByConditionKeyValue
(
conditions
[
0
].
tokenKey
,
conditions
[
0
].
value
);
expect
(
result
).
toEqual
(
conditions
[
0
]);
});
it
(
'
should return weight condition when found by weight tokenKey and value
'
,
()
=>
{
const
conditions
=
gl
.
FilteredSearchTokenKeys
WithWeights
.
getConditions
();
const
conditions
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
getConditions
();
const
weightConditions
=
conditions
.
filter
(
c
=>
c
.
tokenKey
===
'
weight
'
);
const
result
=
gl
.
FilteredSearchTokenKeys
WithWeights
const
result
=
gl
.
FilteredSearchTokenKeys
IssuesEE
.
searchByConditionKeyValue
(
weightConditions
[
0
].
tokenKey
,
weightConditions
[
0
].
value
);
expect
(
result
).
toEqual
(
weightConditions
[
0
]);
});
...
...
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