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
e5732925
Commit
e5732925
authored
Apr 05, 2019
by
Winnie Hellmann
Committed by
Phil Hughes
Apr 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove EE-specific parts from FilteredSearchManager
parent
a881ffad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
43 deletions
+30
-43
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+6
-27
app/assets/javascripts/filtered_search/recent_searches_storage_keys.js
...vascripts/filtered_search/recent_searches_storage_keys.js
+4
-0
ee/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
...ts/filtered_search/issuable_filtered_search_token_keys.js
+13
-13
ee/app/assets/javascripts/filtered_search/recent_searches_storage_keys.js
...vascripts/filtered_search/recent_searches_storage_keys.js
+6
-0
ee/spec/javascripts/filtered_search/issues_filtered_search_token_keys_spec.js
...filtered_search/issues_filtered_search_token_keys_spec.js
+1
-3
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
e5732925
import
_
from
'
underscore
'
;
import
{
getParameterByName
,
getUrlParamsArray
}
from
'
~/lib/utils/common_utils
'
;
import
IssuableFilteredSearchTokenKeys
from
'
~/filtered_search/issuable_filtered_search_token_keys
'
;
import
recentSearchesStorageKeys
from
'
ee_else_ce/filtered_search/recent_searches_storage_keys
'
;
import
{
visitUrl
}
from
'
../lib/utils/url_utility
'
;
import
Flash
from
'
../flash
'
;
import
FilteredSearchContainer
from
'
./container
'
;
...
...
@@ -36,13 +37,11 @@ export default class FilteredSearchManager {
this
.
tokensContainer
=
this
.
container
.
querySelector
(
'
.tokens-container
'
);
this
.
filteredSearchTokenKeys
=
filteredSearchTokenKeys
;
this
.
stateFiltersSelector
=
stateFiltersSelector
;
this
.
recentsStorageKeyNames
=
{
issues
:
'
issue-recent-searches
'
,
merge_requests
:
'
merge-request-recent-searches
'
,
};
// EE specific setup
this
.
initEE
();
const
{
multipleAssignees
}
=
this
.
filteredSearchInput
.
dataset
;
if
(
multipleAssignees
&&
this
.
filteredSearchTokenKeys
.
enableMultipleAssignees
)
{
this
.
filteredSearchTokenKeys
.
enableMultipleAssignees
();
}
this
.
recentSearchesStore
=
new
RecentSearchesStore
({
isLocalStorageAvailable
:
RecentSearchesService
.
isAvailable
(),
...
...
@@ -54,30 +53,10 @@ export default class FilteredSearchManager {
const
fullPath
=
this
.
searchHistoryDropdownElement
?
this
.
searchHistoryDropdownElement
.
dataset
.
fullPath
:
'
project
'
;
const
recentSearchesKey
=
`
${
fullPath
}
-
${
this
.
recentsStorageKeyName
s
[
this
.
page
]}
`
;
const
recentSearchesKey
=
`
${
fullPath
}
-
${
recentSearchesStorageKey
s
[
this
.
page
]}
`
;
this
.
recentSearchesService
=
new
RecentSearchesService
(
recentSearchesKey
);
}
/**
* Do EE specific initializations
*/
initEE
()
{
// Setup token keys for multiple-assignees support
if
(
typeof
this
.
filteredSearchTokenKeys
.
init
===
'
function
'
)
{
this
.
filteredSearchTokenKeys
.
init
({
multipleAssignees
:
this
.
filteredSearchInput
.
dataset
.
multipleAssignees
,
});
}
// Add localStorage key name for Epics recent searches
this
.
recentsStorageKeyNames
.
epics
=
'
epics-recent-searches
'
;
// Update `isGroup` from DOM info
if
(
this
.
filteredSearchInput
)
{
this
.
isGroup
=
!!
this
.
filteredSearchInput
.
getAttribute
(
'
data-group-id
'
);
}
}
setup
()
{
// Fetch recent searches from localStorage
this
.
fetchingRecentSearchesPromise
=
this
.
recentSearchesService
...
...
app/assets/javascripts/filtered_search/recent_searches_storage_keys.js
0 → 100644
View file @
e5732925
export
default
{
issues
:
'
issue-recent-searches
'
,
merge_requests
:
'
merge-request-recent-searches
'
,
};
ee/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
View file @
e5732925
...
...
@@ -29,23 +29,23 @@ const weightConditions = [
/**
* Filter tokens for issues in EE.
*
* @type {FilteredSearchTokenKeys}
*/
const
IssuesFilteredSearchTokenKeysEE
=
new
FilteredSearchTokenKeys
(
[...
tokenKeys
,
weightTokenKey
],
alternativeTokenKeys
,
[...
conditions
,
...
weightConditions
],
);
class
IssuesFilteredSearchTokenKeysEE
extends
FilteredSearchTokenKeys
{
constructor
()
{
super
([...
tokenKeys
,
weightTokenKey
],
alternativeTokenKeys
,
[
...
conditions
,
...
weightConditions
,
]);
}
// cannot be an arrow function because it needs FilteredSearchTokenKeys instance
IssuesFilteredSearchTokenKeysEE
.
init
=
function
init
(
availableFeatures
)
{
// Enable multiple assignees when available
if
(
availableFeatures
&&
availableFeatures
.
multipleAssignees
)
{
/**
* Changes assignee token to accept multiple values.
*/
enableMultipleAssignees
(
)
{
const
assigneeTokenKey
=
this
.
tokenKeys
.
find
(
tk
=>
tk
.
key
===
'
assignee
'
);
assigneeTokenKey
.
type
=
'
array
'
;
assigneeTokenKey
.
param
=
'
username[]
'
;
}
}
;
}
export
default
IssuesFilteredSearchTokenKeysEE
;
export
default
new
IssuesFilteredSearchTokenKeysEE
()
;
ee/app/assets/javascripts/filtered_search/recent_searches_storage_keys.js
0 → 100644
View file @
e5732925
import
recentSearchesStorageKeysCE
from
'
~/filtered_search/recent_searches_storage_keys
'
;
export
default
{
...
recentSearchesStorageKeysCE
,
epics
:
'
epics-recent-searches
'
,
};
ee/spec/javascripts/filtered_search/issues_filtered_search_token_keys_spec.js
View file @
e5732925
...
...
@@ -14,9 +14,7 @@ describe('Filtered Search Token Keys (Issues EE)', () => {
let
tokenKeys
;
beforeEach
(()
=>
{
IssuableFilteredSearchTokenKeys
.
init
({
multipleAssignees
:
true
,
});
IssuableFilteredSearchTokenKeys
.
enableMultipleAssignees
();
tokenKeys
=
IssuableFilteredSearchTokenKeys
.
get
();
});
...
...
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