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
724ada81
Commit
724ada81
authored
Jun 21, 2021
by
Miguel Rincon
Committed by
Natalia Tepluhina
Jun 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move to urlParamsToObject to url_utility.js and deprecate it
parent
d2580206
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
158 additions
and
139 deletions
+158
-139
app/assets/javascripts/boards/stores/actions.js
app/assets/javascripts/boards/stores/actions.js
+4
-1
app/assets/javascripts/boards/stores/boards_store.js
app/assets/javascripts/boards/stores/boards_store.js
+4
-7
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+2
-2
app/assets/javascripts/issues_list/components/issuables_list_app.vue
...javascripts/issues_list/components/issuables_list_app.vue
+4
-7
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+0
-47
app/assets/javascripts/lib/utils/url_utility.js
app/assets/javascripts/lib/utils/url_utility.js
+49
-0
app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue
...rs/components/filter_sort/members_filtered_search_bar.vue
+4
-2
app/assets/javascripts/members/components/members_tabs.vue
app/assets/javascripts/members/components/members_tabs.vue
+3
-1
app/assets/javascripts/projects/commits/components/author_select.vue
...javascripts/projects/commits/components/author_select.vue
+3
-2
ee/app/assets/javascripts/analytics/code_review_analytics/filtered_search_code_review_analytics.js
...review_analytics/filtered_search_code_review_analytics.js
+3
-1
ee/app/assets/javascripts/analytics/productivity_analytics/filtered_search_productivity_analytics.js
...ivity_analytics/filtered_search_productivity_analytics.js
+3
-1
ee/app/assets/javascripts/boards/boards_util.js
ee/app/assets/javascripts/boards/boards_util.js
+3
-2
ee/app/assets/javascripts/boards/epic_filtered_search.js
ee/app/assets/javascripts/boards/epic_filtered_search.js
+4
-1
ee/app/assets/javascripts/boards/stores/actions.js
ee/app/assets/javascripts/boards/stores/actions.js
+4
-6
ee/app/assets/javascripts/epics_list/epics_list_bundle.js
ee/app/assets/javascripts/epics_list/epics_list_bundle.js
+4
-5
ee/app/assets/javascripts/integrations/jira/issues_list/jira_issues_list_bundle.js
.../integrations/jira/issues_list/jira_issues_list_bundle.js
+4
-1
ee/app/assets/javascripts/issues_analytics/filtered_search_issues_analytics.js
...ipts/issues_analytics/filtered_search_issues_analytics.js
+4
-1
ee/app/assets/javascripts/issues_analytics/index.js
ee/app/assets/javascripts/issues_analytics/index.js
+3
-1
ee/app/assets/javascripts/requirements/components/requirements_root.vue
...javascripts/requirements/components/requirements_root.vue
+3
-2
ee/app/assets/javascripts/roadmap/roadmap_bundle.js
ee/app/assets/javascripts/roadmap/roadmap_bundle.js
+4
-6
ee/app/assets/javascripts/test_case_list/components/test_case_list_root.vue
...scripts/test_case_list/components/test_case_list_root.vue
+3
-2
ee/app/assets/javascripts/test_case_list/test_case_list_bundle.js
...ssets/javascripts/test_case_list/test_case_list_bundle.js
+4
-5
spec/frontend/lib/utils/common_utils_spec.js
spec/frontend/lib/utils/common_utils_spec.js
+0
-36
spec/frontend/lib/utils/url_utility_spec.js
spec/frontend/lib/utils/url_utility_spec.js
+39
-0
No files found.
app/assets/javascripts/boards/stores/actions.js
View file @
724ada81
...
@@ -18,7 +18,9 @@ import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create
...
@@ -18,7 +18,9 @@ import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create
import
issueMoveListMutation
from
'
ee_else_ce/boards/graphql/issue_move_list.mutation.graphql
'
;
import
issueMoveListMutation
from
'
ee_else_ce/boards/graphql/issue_move_list.mutation.graphql
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
createGqClient
,
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
import
createGqClient
,
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
import
{
convertObjectPropsToCamelCase
,
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
import
{
formatBoardLists
,
formatBoardLists
,
...
@@ -74,6 +76,7 @@ export default {
...
@@ -74,6 +76,7 @@ export default {
performSearch
({
dispatch
})
{
performSearch
({
dispatch
})
{
dispatch
(
dispatch
(
'
setFilters
'
,
'
setFilters
'
,
// eslint-disable-next-line import/no-deprecated
convertObjectPropsToCamelCase
(
urlParamsToObject
(
window
.
location
.
search
)),
convertObjectPropsToCamelCase
(
urlParamsToObject
(
window
.
location
.
search
)),
);
);
...
...
app/assets/javascripts/boards/stores/boards_store.js
View file @
724ada81
...
@@ -7,13 +7,9 @@ import BoardsStoreEE from 'ee_else_ce/boards/stores/boards_store_ee';
...
@@ -7,13 +7,9 @@ import BoardsStoreEE from 'ee_else_ce/boards/stores/boards_store_ee';
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
import
{
parseBoolean
,
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
urlParamsToObject
,
// eslint-disable-next-line import/no-deprecated
getUrlParamsArray
,
import
{
mergeUrlParams
,
urlParamsToObject
,
getUrlParamsArray
}
from
'
~/lib/utils/url_utility
'
;
parseBoolean
,
convertObjectPropsToCamelCase
,
}
from
'
~/lib/utils/common_utils
'
;
import
{
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
{
ListType
,
flashAnimationDuration
}
from
'
../constants
'
;
import
{
ListType
,
flashAnimationDuration
}
from
'
../constants
'
;
import
eventHub
from
'
../eventhub
'
;
import
eventHub
from
'
../eventhub
'
;
import
ListAssignee
from
'
../models/assignee
'
;
import
ListAssignee
from
'
../models/assignee
'
;
...
@@ -601,6 +597,7 @@ const boardsStore = {
...
@@ -601,6 +597,7 @@ const boardsStore = {
getListIssues
(
list
,
emptyIssues
=
true
)
{
getListIssues
(
list
,
emptyIssues
=
true
)
{
const
data
=
{
const
data
=
{
// eslint-disable-next-line import/no-deprecated
...
urlParamsToObject
(
this
.
filter
.
path
),
...
urlParamsToObject
(
this
.
filter
.
path
),
page
:
list
.
page
,
page
:
list
.
page
,
};
};
...
...
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
724ada81
import
{
last
}
from
'
lodash
'
;
import
{
last
}
from
'
lodash
'
;
import
recentSearchesStorageKeys
from
'
ee_else_ce/filtered_search/recent_searches_storage_keys
'
;
import
recentSearchesStorageKeys
from
'
ee_else_ce/filtered_search/recent_searches_storage_keys
'
;
import
IssuableFilteredSearchTokenKeys
from
'
~/filtered_search/issuable_filtered_search_token_keys
'
;
import
IssuableFilteredSearchTokenKeys
from
'
~/filtered_search/issuable_filtered_search_token_keys
'
;
import
{
getParameterByName
,
getUrlParamsArray
}
from
'
~/lib/utils/common_utils
'
;
import
{
getParameterByName
}
from
'
~/lib/utils/common_utils
'
;
import
{
import
{
ENTER_KEY_CODE
,
ENTER_KEY_CODE
,
BACKSPACE_KEY_CODE
,
BACKSPACE_KEY_CODE
,
...
@@ -12,7 +12,7 @@ import {
...
@@ -12,7 +12,7 @@ import {
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
createFlash
from
'
../flash
'
;
import
createFlash
from
'
../flash
'
;
import
{
addClassIfElementExists
}
from
'
../lib/utils/dom_utils
'
;
import
{
addClassIfElementExists
}
from
'
../lib/utils/dom_utils
'
;
import
{
visitUrl
}
from
'
../lib/utils/url_utility
'
;
import
{
visitUrl
,
getUrlParamsArray
}
from
'
../lib/utils/url_utility
'
;
import
FilteredSearchContainer
from
'
./container
'
;
import
FilteredSearchContainer
from
'
./container
'
;
import
DropdownUtils
from
'
./dropdown_utils
'
;
import
DropdownUtils
from
'
./dropdown_utils
'
;
import
eventHub
from
'
./event_hub
'
;
import
eventHub
from
'
./event_hub
'
;
...
...
app/assets/javascripts/issues_list/components/issuables_list_app.vue
View file @
724ada81
...
@@ -8,13 +8,9 @@ import {
...
@@ -8,13 +8,9 @@ import {
import
{
toNumber
,
omit
}
from
'
lodash
'
;
import
{
toNumber
,
omit
}
from
'
lodash
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
import
{
scrollToElement
,
historyPushState
,
getParameterByName
}
from
'
~/lib/utils/common_utils
'
;
scrollToElement
,
// eslint-disable-next-line import/no-deprecated
urlParamsToObject
,
import
{
setUrlParams
,
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
historyPushState
,
getParameterByName
,
}
from
'
~/lib/utils/common_utils
'
;
import
{
setUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
initManualOrdering
from
'
~/manual_ordering
'
;
import
initManualOrdering
from
'
~/manual_ordering
'
;
import
FilteredSearchBar
from
'
~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue
'
;
import
FilteredSearchBar
from
'
~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue
'
;
...
@@ -271,6 +267,7 @@ export default {
...
@@ -271,6 +267,7 @@ export default {
});
});
},
},
getQueryObject
()
{
getQueryObject
()
{
// eslint-disable-next-line import/no-deprecated
return
urlParamsToObject
(
window
.
location
.
search
);
return
urlParamsToObject
(
window
.
location
.
search
);
},
},
onPaginate
(
newPage
)
{
onPaginate
(
newPage
)
{
...
...
app/assets/javascripts/lib/utils/common_utils.js
View file @
724ada81
...
@@ -162,53 +162,6 @@ export const parseUrlPathname = (url) => {
...
@@ -162,53 +162,6 @@ export const parseUrlPathname = (url) => {
return
parsedUrl
.
pathname
.
charAt
(
0
)
===
'
/
'
?
parsedUrl
.
pathname
:
`/
${
parsedUrl
.
pathname
}
`
;
return
parsedUrl
.
pathname
.
charAt
(
0
)
===
'
/
'
?
parsedUrl
.
pathname
:
`/
${
parsedUrl
.
pathname
}
`
;
};
};
const
splitPath
=
(
path
=
''
)
=>
path
.
replace
(
/^
\?
/
,
''
).
split
(
'
&
'
);
export
const
urlParamsToArray
=
(
path
=
''
)
=>
splitPath
(
path
)
.
filter
((
param
)
=>
param
.
length
>
0
)
.
map
((
param
)
=>
{
const
split
=
param
.
split
(
'
=
'
);
return
[
decodeURI
(
split
[
0
]),
split
[
1
]].
join
(
'
=
'
);
});
export
const
getUrlParamsArray
=
()
=>
urlParamsToArray
(
window
.
location
.
search
);
/**
* Accepts encoding string which includes query params being
* sent to URL.
*
* @param {string} path Query param string
*
* @returns {object} Query params object containing key-value pairs
* with both key and values decoded into plain string.
*/
export
const
urlParamsToObject
=
(
path
=
''
)
=>
splitPath
(
path
).
reduce
((
dataParam
,
filterParam
)
=>
{
if
(
filterParam
===
''
)
{
return
dataParam
;
}
const
data
=
dataParam
;
let
[
key
,
value
]
=
filterParam
.
split
(
'
=
'
);
key
=
/%
\w
+/g
.
test
(
key
)
?
decodeURIComponent
(
key
)
:
key
;
const
isArray
=
key
.
includes
(
'
[]
'
);
key
=
key
.
replace
(
'
[]
'
,
''
);
value
=
decodeURIComponent
(
value
.
replace
(
/
\+
/g
,
'
'
));
if
(
isArray
)
{
if
(
!
data
[
key
])
{
data
[
key
]
=
[];
}
data
[
key
].
push
(
value
);
}
else
{
data
[
key
]
=
value
;
}
return
data
;
},
{});
export
const
isMetaKey
=
(
e
)
=>
e
.
metaKey
||
e
.
ctrlKey
||
e
.
altKey
||
e
.
shiftKey
;
export
const
isMetaKey
=
(
e
)
=>
e
.
metaKey
||
e
.
ctrlKey
||
e
.
altKey
||
e
.
shiftKey
;
// Identify following special clicks
// Identify following special clicks
...
...
app/assets/javascripts/lib/utils/url_utility.js
View file @
724ada81
...
@@ -409,6 +409,55 @@ export function getWebSocketUrl(path) {
...
@@ -409,6 +409,55 @@ export function getWebSocketUrl(path) {
return
`
${
getWebSocketProtocol
()}
//
${
joinPaths
(
window
.
location
.
host
,
path
)}
`
;
return
`
${
getWebSocketProtocol
()}
//
${
joinPaths
(
window
.
location
.
host
,
path
)}
`
;
}
}
const
splitPath
=
(
path
=
''
)
=>
path
.
replace
(
/^
\?
/
,
''
).
split
(
'
&
'
);
export
const
urlParamsToArray
=
(
path
=
''
)
=>
splitPath
(
path
)
.
filter
((
param
)
=>
param
.
length
>
0
)
.
map
((
param
)
=>
{
const
split
=
param
.
split
(
'
=
'
);
return
[
decodeURI
(
split
[
0
]),
split
[
1
]].
join
(
'
=
'
);
});
export
const
getUrlParamsArray
=
()
=>
urlParamsToArray
(
window
.
location
.
search
);
/**
* Accepts encoding string which includes query params being
* sent to URL.
*
* @param {string} path Query param string
*
* @returns {object} Query params object containing key-value pairs
* with both key and values decoded into plain string.
*
* @deprecated Please use `queryToObject(query, { gatherArrays: true });` instead. See https://gitlab.com/gitlab-org/gitlab/-/issues/328845
*/
export
const
urlParamsToObject
=
(
path
=
''
)
=>
splitPath
(
path
).
reduce
((
dataParam
,
filterParam
)
=>
{
if
(
filterParam
===
''
)
{
return
dataParam
;
}
const
data
=
dataParam
;
let
[
key
,
value
]
=
filterParam
.
split
(
'
=
'
);
key
=
/%
\w
+/g
.
test
(
key
)
?
decodeURIComponent
(
key
)
:
key
;
const
isArray
=
key
.
includes
(
'
[]
'
);
key
=
key
.
replace
(
'
[]
'
,
''
);
value
=
decodeURIComponent
(
value
.
replace
(
/
\+
/g
,
'
'
));
if
(
isArray
)
{
if
(
!
data
[
key
])
{
data
[
key
]
=
[];
}
data
[
key
].
push
(
value
);
}
else
{
data
[
key
]
=
value
;
}
return
data
;
},
{});
/**
/**
* Convert search query into an object
* Convert search query into an object
*
*
...
...
app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue
View file @
724ada81
<
script
>
<
script
>
import
{
GlFilteredSearchToken
}
from
'
@gitlab/ui
'
;
import
{
GlFilteredSearchToken
}
from
'
@gitlab/ui
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
getParameterByName
,
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
import
{
getParameterByName
}
from
'
~/lib/utils/common_utils
'
;
import
{
setUrlParams
}
from
'
~/lib/utils/url_utility
'
;
// eslint-disable-next-line import/no-deprecated
import
{
setUrlParams
,
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
SEARCH_TOKEN_TYPE
,
SORT_PARAM
}
from
'
~/members/constants
'
;
import
{
SEARCH_TOKEN_TYPE
,
SORT_PARAM
}
from
'
~/members/constants
'
;
import
{
OPERATOR_IS_ONLY
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
import
{
OPERATOR_IS_ONLY
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
...
@@ -64,6 +65,7 @@ export default {
...
@@ -64,6 +65,7 @@ export default {
},
},
},
},
created
()
{
created
()
{
// eslint-disable-next-line import/no-deprecated
const
query
=
urlParamsToObject
(
window
.
location
.
search
);
const
query
=
urlParamsToObject
(
window
.
location
.
search
);
const
tokens
=
this
.
tokens
const
tokens
=
this
.
tokens
...
...
app/assets/javascripts/members/components/members_tabs.vue
View file @
724ada81
<
script
>
<
script
>
import
{
GlTabs
,
GlTab
,
GlBadge
}
from
'
@gitlab/ui
'
;
import
{
GlTabs
,
GlTab
,
GlBadge
}
from
'
@gitlab/ui
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
MEMBER_TYPES
}
from
'
../constants
'
;
import
{
MEMBER_TYPES
}
from
'
../constants
'
;
import
MembersApp
from
'
./app.vue
'
;
import
MembersApp
from
'
./app.vue
'
;
...
@@ -55,6 +56,7 @@ export default {
...
@@ -55,6 +56,7 @@ export default {
},
},
}),
}),
urlParams
()
{
urlParams
()
{
// eslint-disable-next-line import/no-deprecated
return
Object
.
keys
(
urlParamsToObject
(
window
.
location
.
search
));
return
Object
.
keys
(
urlParamsToObject
(
window
.
location
.
search
));
},
},
activeTabIndexCalculatedFromUrlParams
()
{
activeTabIndexCalculatedFromUrlParams
()
{
...
...
app/assets/javascripts/projects/commits/components/author_select.vue
View file @
724ada81
...
@@ -9,8 +9,8 @@ import {
...
@@ -9,8 +9,8 @@ import {
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
{
debounce
}
from
'
lodash
'
;
import
{
debounce
}
from
'
lodash
'
;
import
{
mapState
,
mapActions
}
from
'
vuex
'
;
import
{
mapState
,
mapActions
}
from
'
vuex
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
redirectTo
,
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
const
tooltipMessage
=
__
(
'
Searching by both author and message is currently not supported.
'
);
const
tooltipMessage
=
__
(
'
Searching by both author and message is currently not supported.
'
);
...
@@ -52,6 +52,7 @@ export default {
...
@@ -52,6 +52,7 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
fetchAuthors
();
this
.
fetchAuthors
();
// eslint-disable-next-line import/no-deprecated
const
params
=
urlParamsToObject
(
window
.
location
.
search
);
const
params
=
urlParamsToObject
(
window
.
location
.
search
);
const
{
search
:
searchParam
,
author
:
authorParam
}
=
params
;
const
{
search
:
searchParam
,
author
:
authorParam
}
=
params
;
const
commitsSearchInput
=
this
.
projectCommitsEl
.
querySelector
(
'
#commits-search
'
);
const
commitsSearchInput
=
this
.
projectCommitsEl
.
querySelector
(
'
#commits-search
'
);
...
...
ee/app/assets/javascripts/analytics/code_review_analytics/filtered_search_code_review_analytics.js
View file @
724ada81
import
FilteredSearchManager
from
'
ee_else_ce/filtered_search/filtered_search_manager
'
;
import
FilteredSearchManager
from
'
ee_else_ce/filtered_search/filtered_search_manager
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
CodeReviewAnalyticsFilteredSearchTokenKeys
from
'
./code_review_analytics_filtered_search_token_keys
'
;
import
CodeReviewAnalyticsFilteredSearchTokenKeys
from
'
./code_review_analytics_filtered_search_token_keys
'
;
import
store
from
'
./store
'
;
import
store
from
'
./store
'
;
...
@@ -24,6 +25,7 @@ export default class FilteredSearchCodeReviewAnalytics extends FilteredSearchMan
...
@@ -24,6 +25,7 @@ export default class FilteredSearchCodeReviewAnalytics extends FilteredSearchMan
* Updates filters in code review analytics store
* Updates filters in code review analytics store
*/
*/
updateObject
=
(
path
)
=>
{
updateObject
=
(
path
)
=>
{
// eslint-disable-next-line import/no-deprecated
const
filters
=
urlParamsToObject
(
path
);
const
filters
=
urlParamsToObject
(
path
);
const
{
selectedLabels
:
selectedLabelList
,
selectedMilestone
}
=
transformFilters
(
filters
);
const
{
selectedLabels
:
selectedLabelList
,
selectedMilestone
}
=
transformFilters
(
filters
);
...
...
ee/app/assets/javascripts/analytics/productivity_analytics/filtered_search_productivity_analytics.js
View file @
724ada81
import
FilteredSearchManager
from
'
ee_else_ce/filtered_search/filtered_search_manager
'
;
import
FilteredSearchManager
from
'
ee_else_ce/filtered_search/filtered_search_manager
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
ProductivityAnalyticsFilteredSearchTokenKeys
from
'
./productivity_analytics_filtered_search_token_keys
'
;
import
ProductivityAnalyticsFilteredSearchTokenKeys
from
'
./productivity_analytics_filtered_search_token_keys
'
;
import
store
from
'
./store
'
;
import
store
from
'
./store
'
;
...
@@ -23,6 +24,7 @@ export default class FilteredSearchProductivityAnalytics extends FilteredSearchM
...
@@ -23,6 +24,7 @@ export default class FilteredSearchProductivityAnalytics extends FilteredSearchM
* Updates filters in productivity analytics store
* Updates filters in productivity analytics store
*/
*/
updateObject
=
(
path
)
=>
{
updateObject
=
(
path
)
=>
{
// eslint-disable-next-line import/no-deprecated
const
filters
=
urlParamsToObject
(
path
);
const
filters
=
urlParamsToObject
(
path
);
store
.
dispatch
(
'
filters/setFilters
'
,
filters
);
store
.
dispatch
(
'
filters/setFilters
'
,
filters
);
};
};
...
...
ee/app/assets/javascripts/boards/boards_util.js
View file @
724ada81
import
{
FiltersInfo
as
FiltersInfoCE
}
from
'
~/boards/boards_util
'
;
import
{
FiltersInfo
as
FiltersInfoCE
}
from
'
~/boards/boards_util
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
objectToQuery
}
from
'
~/lib/utils/url_utility
'
;
import
{
objectToQuery
,
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
import
{
EPIC_LANE_BASE_HEIGHT
,
EPIC_LANE_BASE_HEIGHT
,
IterationFilterType
,
IterationFilterType
,
...
@@ -93,6 +93,7 @@ export function formatEpicListsPageInfo(lists) {
...
@@ -93,6 +93,7 @@ export function formatEpicListsPageInfo(lists) {
export
function
transformBoardConfig
(
boardConfig
)
{
export
function
transformBoardConfig
(
boardConfig
)
{
const
updatedBoardConfig
=
{};
const
updatedBoardConfig
=
{};
// eslint-disable-next-line import/no-deprecated
const
passedFilterParams
=
urlParamsToObject
(
window
.
location
.
search
);
const
passedFilterParams
=
urlParamsToObject
(
window
.
location
.
search
);
const
updateScopeObject
=
(
key
,
value
=
''
)
=>
{
const
updateScopeObject
=
(
key
,
value
=
''
)
=>
{
if
(
value
===
null
||
value
===
''
)
return
;
if
(
value
===
null
||
value
===
''
)
return
;
...
...
ee/app/assets/javascripts/boards/epic_filtered_search.js
View file @
724ada81
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
EpicFilteredSearch
from
'
ee_component/boards/components/epic_filtered_search.vue
'
;
import
EpicFilteredSearch
from
'
ee_component/boards/components/epic_filtered_search.vue
'
;
import
store
from
'
~/boards/stores
'
;
import
store
from
'
~/boards/stores
'
;
import
{
urlParamsToObject
,
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
export
default
(
apolloProvider
)
=>
{
export
default
(
apolloProvider
)
=>
{
const
el
=
document
.
getElementById
(
'
js-board-filtered-search
'
);
const
el
=
document
.
getElementById
(
'
js-board-filtered-search
'
);
// eslint-disable-next-line import/no-deprecated
const
rawFilterParams
=
urlParamsToObject
(
window
.
location
.
search
);
const
rawFilterParams
=
urlParamsToObject
(
window
.
location
.
search
);
const
initialFilterParams
=
{
const
initialFilterParams
=
{
...
convertObjectPropsToCamelCase
(
rawFilterParams
,
{}),
...
convertObjectPropsToCamelCase
(
rawFilterParams
,
{}),
...
...
ee/app/assets/javascripts/boards/stores/actions.js
View file @
724ada81
...
@@ -15,12 +15,9 @@ import boardsStore from '~/boards/stores/boards_store';
...
@@ -15,12 +15,9 @@ import boardsStore from '~/boards/stores/boards_store';
import
*
as
typesCE
from
'
~/boards/stores/mutation_types
'
;
import
*
as
typesCE
from
'
~/boards/stores/mutation_types
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
import
{
historyPushState
,
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
historyPushState
,
// eslint-disable-next-line import/no-deprecated
convertObjectPropsToCamelCase
,
import
{
mergeUrlParams
,
removeParams
,
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
urlParamsToObject
,
}
from
'
~/lib/utils/common_utils
'
;
import
{
mergeUrlParams
,
removeParams
}
from
'
~/lib/utils/url_utility
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
import
{
fullEpicId
,
fullEpicId
,
...
@@ -123,6 +120,7 @@ export default {
...
@@ -123,6 +120,7 @@ export default {
performSearch
({
dispatch
,
getters
})
{
performSearch
({
dispatch
,
getters
})
{
dispatch
(
dispatch
(
'
setFilters
'
,
'
setFilters
'
,
// eslint-disable-next-line import/no-deprecated
convertObjectPropsToCamelCase
(
urlParamsToObject
(
window
.
location
.
search
)),
convertObjectPropsToCamelCase
(
urlParamsToObject
(
window
.
location
.
search
)),
);
);
...
...
ee/app/assets/javascripts/epics_list/epics_list_bundle.js
View file @
724ada81
...
@@ -3,11 +3,9 @@ import VueApollo from 'vue-apollo';
...
@@ -3,11 +3,9 @@ import VueApollo from 'vue-apollo';
import
{
IssuableStates
}
from
'
~/issuable_list/constants
'
;
import
{
IssuableStates
}
from
'
~/issuable_list/constants
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
import
{
parseBoolean
,
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
urlParamsToObject
,
// eslint-disable-next-line import/no-deprecated
parseBoolean
,
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
convertObjectPropsToCamelCase
,
}
from
'
~/lib/utils/common_utils
'
;
import
EpicsListApp
from
'
./components/epics_list_root.vue
'
;
import
EpicsListApp
from
'
./components/epics_list_root.vue
'
;
...
@@ -43,6 +41,7 @@ export default function initEpicsList({ mountPointSelector }) {
...
@@ -43,6 +41,7 @@ export default function initEpicsList({ mountPointSelector }) {
emptyStatePath
,
emptyStatePath
,
}
=
mountPointEl
.
dataset
;
}
=
mountPointEl
.
dataset
;
// eslint-disable-next-line import/no-deprecated
const
rawFilterParams
=
urlParamsToObject
(
window
.
location
.
search
);
const
rawFilterParams
=
urlParamsToObject
(
window
.
location
.
search
);
const
initialFilterParams
=
{
const
initialFilterParams
=
{
...
convertObjectPropsToCamelCase
(
rawFilterParams
,
{
...
convertObjectPropsToCamelCase
(
rawFilterParams
,
{
...
...
ee/app/assets/javascripts/integrations/jira/issues_list/jira_issues_list_bundle.js
View file @
724ada81
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
IssuableStates
}
from
'
~/issuable_list/constants
'
;
import
{
IssuableStates
}
from
'
~/issuable_list/constants
'
;
import
{
urlParamsToObject
,
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
JiraIssuesListApp
from
'
./components/jira_issues_list_root.vue
'
;
import
JiraIssuesListApp
from
'
./components/jira_issues_list_root.vue
'
;
import
apolloProvider
from
'
./graphql
'
;
import
apolloProvider
from
'
./graphql
'
;
...
@@ -20,6 +22,7 @@ export default function initJiraIssuesList({ mountPointSelector }) {
...
@@ -20,6 +22,7 @@ export default function initJiraIssuesList({ mountPointSelector }) {
}
=
mountPointEl
.
dataset
;
}
=
mountPointEl
.
dataset
;
const
initialFilterParams
=
Object
.
assign
(
const
initialFilterParams
=
Object
.
assign
(
// eslint-disable-next-line import/no-deprecated
convertObjectPropsToCamelCase
(
urlParamsToObject
(
window
.
location
.
search
.
substring
(
1
)),
{
convertObjectPropsToCamelCase
(
urlParamsToObject
(
window
.
location
.
search
.
substring
(
1
)),
{
dropKeys
:
[
'
scope
'
,
'
utf8
'
,
'
state
'
,
'
sort
'
],
// These keys are unsupported/unnecessary
dropKeys
:
[
'
scope
'
,
'
utf8
'
,
'
state
'
,
'
sort
'
],
// These keys are unsupported/unnecessary
}),
}),
...
...
ee/app/assets/javascripts/issues_analytics/filtered_search_issues_analytics.js
View file @
724ada81
import
FilteredSearchManager
from
'
ee_else_ce/filtered_search/filtered_search_manager
'
;
import
FilteredSearchManager
from
'
ee_else_ce/filtered_search/filtered_search_manager
'
;
import
IssuableFilteredSearchTokenKeys
from
'
ee_else_ce/filtered_search/issuable_filtered_search_token_keys
'
;
import
IssuableFilteredSearchTokenKeys
from
'
ee_else_ce/filtered_search/issuable_filtered_search_token_keys
'
;
import
FilteredSearchTokenKeys
from
'
~/filtered_search/filtered_search_token_keys
'
;
import
FilteredSearchTokenKeys
from
'
~/filtered_search/filtered_search_token_keys
'
;
import
{
historyPushState
,
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
import
{
historyPushState
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
issueAnalyticsStore
from
'
./stores
'
;
import
issueAnalyticsStore
from
'
./stores
'
;
...
@@ -35,6 +37,7 @@ export default class FilteredSearchIssueAnalytics extends FilteredSearchManager
...
@@ -35,6 +37,7 @@ export default class FilteredSearchIssueAnalytics extends FilteredSearchManager
updateObject
=
(
path
)
=>
{
updateObject
=
(
path
)
=>
{
historyPushState
(
path
);
historyPushState
(
path
);
// eslint-disable-next-line import/no-deprecated
const
filters
=
urlParamsToObject
(
path
);
const
filters
=
urlParamsToObject
(
path
);
issueAnalyticsStore
.
dispatch
(
'
issueAnalytics/setFilters
'
,
filters
);
issueAnalyticsStore
.
dispatch
(
'
issueAnalytics/setFilters
'
,
filters
);
};
};
...
...
ee/app/assets/javascripts/issues_analytics/index.js
View file @
724ada81
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
IssuesAnalytics
from
'
./components/issues_analytics.vue
'
;
import
IssuesAnalytics
from
'
./components/issues_analytics.vue
'
;
import
store
from
'
./stores
'
;
import
store
from
'
./stores
'
;
...
@@ -18,6 +19,7 @@ export default () => {
...
@@ -18,6 +19,7 @@ export default () => {
}
=
el
.
dataset
;
}
=
el
.
dataset
;
// Set default filters from URL
// Set default filters from URL
// eslint-disable-next-line import/no-deprecated
const
filters
=
urlParamsToObject
(
window
.
location
.
search
);
const
filters
=
urlParamsToObject
(
window
.
location
.
search
);
store
.
dispatch
(
'
issueAnalytics/setFilters
'
,
filters
);
store
.
dispatch
(
'
issueAnalytics/setFilters
'
,
filters
);
...
...
ee/app/assets/javascripts/requirements/components/requirements_root.vue
View file @
724ada81
...
@@ -3,8 +3,8 @@ import { GlPagination, GlAlert } from '@gitlab/ui';
...
@@ -3,8 +3,8 @@ import { GlPagination, GlAlert } from '@gitlab/ui';
import
Api
from
'
~/api
'
;
import
Api
from
'
~/api
'
;
import
createFlash
,
{
FLASH_TYPES
}
from
'
~/flash
'
;
import
createFlash
,
{
FLASH_TYPES
}
from
'
~/flash
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
updateHistory
,
setUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
{
updateHistory
,
setUrlParams
,
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
Tracking
from
'
~/tracking
'
;
import
Tracking
from
'
~/tracking
'
;
...
@@ -331,6 +331,7 @@ export default {
...
@@ -331,6 +331,7 @@ export default {
*/
*/
updateUrl
()
{
updateUrl
()
{
const
{
href
,
search
}
=
window
.
location
;
const
{
href
,
search
}
=
window
.
location
;
// eslint-disable-next-line import/no-deprecated
const
queryParams
=
urlParamsToObject
(
search
);
const
queryParams
=
urlParamsToObject
(
search
);
const
{
const
{
filterBy
,
filterBy
,
...
...
ee/app/assets/javascripts/roadmap/roadmap_bundle.js
View file @
724ada81
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
mapActions
}
from
'
vuex
'
;
import
{
mapActions
}
from
'
vuex
'
;
import
{
import
{
parseBoolean
,
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
parseBoolean
,
// eslint-disable-next-line import/no-deprecated
urlParamsToObject
,
import
{
visitUrl
,
mergeUrlParams
,
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
convertObjectPropsToCamelCase
,
}
from
'
~/lib/utils/common_utils
'
;
import
{
visitUrl
,
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
EpicItem
from
'
./components/epic_item.vue
'
;
import
EpicItem
from
'
./components/epic_item.vue
'
;
...
@@ -67,6 +64,7 @@ export default () => {
...
@@ -67,6 +64,7 @@ export default () => {
supportedPresetTypes
.
indexOf
(
dataset
.
presetType
)
>
-
1
supportedPresetTypes
.
indexOf
(
dataset
.
presetType
)
>
-
1
?
dataset
.
presetType
?
dataset
.
presetType
:
PRESET_TYPES
.
MONTHS
;
:
PRESET_TYPES
.
MONTHS
;
// eslint-disable-next-line import/no-deprecated
const
rawFilterParams
=
urlParamsToObject
(
window
.
location
.
search
.
substring
(
1
));
const
rawFilterParams
=
urlParamsToObject
(
window
.
location
.
search
.
substring
(
1
));
const
filterParams
=
{
const
filterParams
=
{
...
convertObjectPropsToCamelCase
(
rawFilterParams
,
{
...
convertObjectPropsToCamelCase
(
rawFilterParams
,
{
...
...
ee/app/assets/javascripts/test_case_list/components/test_case_list_root.vue
View file @
724ada81
...
@@ -5,8 +5,8 @@ import Api from '~/api';
...
@@ -5,8 +5,8 @@ import Api from '~/api';
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
IssuableList
from
'
~/issuable_list/components/issuable_list_root.vue
'
;
import
IssuableList
from
'
~/issuable_list/components/issuable_list_root.vue
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
// eslint-disable-next-line import/no-deprecated
import
{
updateHistory
,
setUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
{
updateHistory
,
setUrlParams
,
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
{
OPERATOR_IS_ONLY
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
import
{
OPERATOR_IS_ONLY
}
from
'
~/vue_shared/components/filtered_search_bar/constants
'
;
...
@@ -143,6 +143,7 @@ export default {
...
@@ -143,6 +143,7 @@ export default {
},
},
methods
:
{
methods
:
{
updateUrl
()
{
updateUrl
()
{
// eslint-disable-next-line import/no-deprecated
const
queryParams
=
urlParamsToObject
(
window
.
location
.
search
);
const
queryParams
=
urlParamsToObject
(
window
.
location
.
search
);
const
{
authorUsername
,
labelName
,
search
}
=
this
.
filterParams
||
{};
const
{
authorUsername
,
labelName
,
search
}
=
this
.
filterParams
||
{};
const
{
currentState
,
sortedBy
,
currentPage
,
prevPageCursor
,
nextPageCursor
}
=
this
;
const
{
currentState
,
sortedBy
,
currentPage
,
prevPageCursor
,
nextPageCursor
}
=
this
;
...
...
ee/app/assets/javascripts/test_case_list/test_case_list_bundle.js
View file @
724ada81
...
@@ -2,11 +2,9 @@ import Vue from 'vue';
...
@@ -2,11 +2,9 @@ import Vue from 'vue';
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
import
{
convertObjectPropsToCamelCase
,
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
urlParamsToObject
,
// eslint-disable-next-line import/no-deprecated
convertObjectPropsToCamelCase
,
import
{
urlParamsToObject
}
from
'
~/lib/utils/url_utility
'
;
parseBoolean
,
}
from
'
~/lib/utils/common_utils
'
;
import
TestCaseListApp
from
'
./components/test_case_list_root.vue
'
;
import
TestCaseListApp
from
'
./components/test_case_list_root.vue
'
;
...
@@ -35,6 +33,7 @@ const initTestCaseList = ({ mountPointSelector }) => {
...
@@ -35,6 +33,7 @@ const initTestCaseList = ({ mountPointSelector }) => {
}
=
mountPointEl
.
dataset
;
}
=
mountPointEl
.
dataset
;
const
initialFilterParams
=
Object
.
assign
(
const
initialFilterParams
=
Object
.
assign
(
// eslint-disable-next-line import/no-deprecated
convertObjectPropsToCamelCase
(
urlParamsToObject
(
window
.
location
.
search
.
substring
(
1
)),
{
convertObjectPropsToCamelCase
(
urlParamsToObject
(
window
.
location
.
search
.
substring
(
1
)),
{
dropKeys
:
[
'
scope
'
,
'
utf8
'
,
'
state
'
,
'
sort
'
],
// These keys are unsupported/unnecessary
dropKeys
:
[
'
scope
'
,
'
utf8
'
,
'
state
'
,
'
sort
'
],
// These keys are unsupported/unnecessary
}),
}),
...
...
spec/frontend/lib/utils/common_utils_spec.js
View file @
724ada81
...
@@ -26,42 +26,6 @@ describe('common_utils', () => {
...
@@ -26,42 +26,6 @@ describe('common_utils', () => {
});
});
});
});
describe
(
'
urlParamsToArray
'
,
()
=>
{
it
(
'
returns empty array for empty querystring
'
,
()
=>
{
expect
(
commonUtils
.
urlParamsToArray
(
''
)).
toEqual
([]);
});
it
(
'
should decode params
'
,
()
=>
{
expect
(
commonUtils
.
urlParamsToArray
(
'
?label_name%5B%5D=test
'
)[
0
]).
toBe
(
'
label_name[]=test
'
);
});
it
(
'
should remove the question mark from the search params
'
,
()
=>
{
const
paramsArray
=
commonUtils
.
urlParamsToArray
(
'
?test=thing
'
);
expect
(
paramsArray
[
0
][
0
]).
not
.
toBe
(
'
?
'
);
});
});
describe
(
'
urlParamsToObject
'
,
()
=>
{
it
(
'
parses path for label with trailing +
'
,
()
=>
{
expect
(
commonUtils
.
urlParamsToObject
(
'
label_name[]=label%2B
'
,
{})).
toEqual
({
label_name
:
[
'
label+
'
],
});
});
it
(
'
parses path for milestone with trailing +
'
,
()
=>
{
expect
(
commonUtils
.
urlParamsToObject
(
'
milestone_title=A%2B
'
,
{})).
toEqual
({
milestone_title
:
'
A+
'
,
});
});
it
(
'
parses path for search terms with spaces
'
,
()
=>
{
expect
(
commonUtils
.
urlParamsToObject
(
'
search=two+words
'
,
{})).
toEqual
({
search
:
'
two words
'
,
});
});
});
describe
(
'
handleLocationHash
'
,
()
=>
{
describe
(
'
handleLocationHash
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
jest
.
spyOn
(
window
.
document
,
'
getElementById
'
);
jest
.
spyOn
(
window
.
document
,
'
getElementById
'
);
...
...
spec/frontend/lib/utils/url_utility_spec.js
View file @
724ada81
...
@@ -650,6 +650,45 @@ describe('URL utility', () => {
...
@@ -650,6 +650,45 @@ describe('URL utility', () => {
});
});
});
});
describe
(
'
urlParamsToArray
'
,
()
=>
{
it
(
'
returns empty array for empty querystring
'
,
()
=>
{
expect
(
urlUtils
.
urlParamsToArray
(
''
)).
toEqual
([]);
});
it
(
'
should decode params
'
,
()
=>
{
expect
(
urlUtils
.
urlParamsToArray
(
'
?label_name%5B%5D=test
'
)[
0
]).
toBe
(
'
label_name[]=test
'
);
});
it
(
'
should remove the question mark from the search params
'
,
()
=>
{
const
paramsArray
=
urlUtils
.
urlParamsToArray
(
'
?test=thing
'
);
expect
(
paramsArray
[
0
][
0
]).
not
.
toBe
(
'
?
'
);
});
});
describe
(
'
urlParamsToObject
'
,
()
=>
{
it
(
'
parses path for label with trailing +
'
,
()
=>
{
// eslint-disable-next-line import/no-deprecated
expect
(
urlUtils
.
urlParamsToObject
(
'
label_name[]=label%2B
'
,
{})).
toEqual
({
label_name
:
[
'
label+
'
],
});
});
it
(
'
parses path for milestone with trailing +
'
,
()
=>
{
// eslint-disable-next-line import/no-deprecated
expect
(
urlUtils
.
urlParamsToObject
(
'
milestone_title=A%2B
'
,
{})).
toEqual
({
milestone_title
:
'
A+
'
,
});
});
it
(
'
parses path for search terms with spaces
'
,
()
=>
{
// eslint-disable-next-line import/no-deprecated
expect
(
urlUtils
.
urlParamsToObject
(
'
search=two+words
'
,
{})).
toEqual
({
search
:
'
two words
'
,
});
});
});
describe
(
'
queryToObject
'
,
()
=>
{
describe
(
'
queryToObject
'
,
()
=>
{
it
.
each
`
it
.
each
`
case | query | options | result
case | query | options | result
...
...
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