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
0e75de4b
Commit
0e75de4b
authored
Aug 29, 2017
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up JS.
parent
205a0775
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
33 deletions
+13
-33
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+3
-6
app/assets/javascripts/service_desk_issues/filtered_search.js
...assets/javascripts/service_desk_issues/filtered_search.js
+9
-25
app/assets/javascripts/service_desk_issues/index.js
app/assets/javascripts/service_desk_issues/index.js
+1
-2
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
0e75de4b
...
...
@@ -420,14 +420,11 @@ class FilteredSearchManager {
});
}
// allows for modifying params array when a param can't be included in the URL (e.g. Service Desk)
getAllParams
()
{
let
p
arams
=
gl
.
utils
.
getUrlParamsArray
();
let
urlP
arams
=
gl
.
utils
.
getUrlParamsArray
();
if
(
this
.
modifyUrlParams
)
{
params
=
this
.
modifyUrlParams
(
params
);
}
return
params
;
return
this
.
modifyUrlParams
?
this
.
modifyUrlParams
(
urlParams
)
:
urlParams
;
}
loadSearchParamsFromURL
()
{
...
...
app/assets/javascripts/service_desk_issues/filtered_search.js
View file @
0e75de4b
export
default
class
FilteredSearchServiceDesk
extends
gl
.
FilteredSearchManager
{
constructor
()
{
super
(
'
service_desk
'
);
this
.
cantEdit
=
[
'
author
'
];
this
.
bindCustomCondition
();
}
bindCustomCondition
()
{
this
.
customRemovalValidator
=
function
(
token
)
{
const
originalValue
=
token
.
querySelector
(
'
.value-container
'
).
getAttribute
(
'
data-original-value
'
);
return
originalValue
!==
'
@support-bot
'
;
};
}
customRemovalValidator
(
token
)
{
return
token
.
querySelector
(
'
.value-container
'
).
getAttribute
(
'
data-original-value
'
)
!==
'
@support-bot
'
;
};
canEdit
(
tokenName
)
{
return
t
his
.
cantEdit
.
indexOf
(
tokenName
)
===
-
1
;
return
t
okenName
!==
'
author
'
;
}
modifyUrlParams
(
paramsArray
)
{
const
support_bot_param
=
'
author_username=support-bot
'
;
let
replaced
=
false
;
const
paramKey
=
'
author_username
'
;
// FIXME: Need to grab the value from a data attribute
const
supportBotParamPair
=
`
${
paramKey
}
=support-bot`
;
const
modified
=
paramsArray
.
map
((
param
)
=>
{
const
author_index
=
param
.
indexOf
(
'
author_username
'
);
if
(
author_index
!==
-
1
)
{
replaced
=
true
;
return
support_bot_param
;
}
return
param
;
return
paramsArray
.
map
((
param
)
=>
{
return
param
.
indexOf
(
paramKey
)
!==
-
1
?
param
:
supportBotParamPair
;
});
if
(
!
replaced
)
{
modified
.
push
(
support_bot_param
);
}
return
modified
;
}
}
app/assets/javascripts/service_desk_issues/index.js
View file @
0e75de4b
import
FilteredSearchServiceDesk
from
'
./filtered_search
'
;
// bulk edit?
//
this
.
filteredSearchManager
=
new
FilteredSearchServiceDesk
();
this
.
filteredSearchManager
.
setup
();
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