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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
e9886b57
Commit
e9886b57
authored
Dec 12, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert string concatenations with an array join
parent
78fe37b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
...avascripts/filtered_search/filtered_search_manager.js.es6
+11
-14
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
View file @
e9886b57
...
...
@@ -83,7 +83,7 @@
// We can trust that each param has one & since values containing & will be encoded
// Remove the first character of search as it is always ?
const params = window.location.search.slice(1).split('&');
let inputValue
= ''
;
let inputValue
s = []
;
params.forEach((p) => {
const split = p.split('=');
...
...
@@ -103,8 +103,7 @@
if (validCondition) {
// Parse params based on rules provided in the conditions key of gl.FilteredSearchTokenKeys.get()
inputValue += `${validCondition.key}:${validCondition.conditions[conditionIndex].keyword}`;
inputValue += ' ';
inputValues.push(`${validCondition.key}:${validCondition.conditions[conditionIndex].keyword}`);
} else {
// Sanitize value since URL converts spaces into +
// Replace before decode so that we know what was originally + versus the encoded +
...
...
@@ -122,25 +121,23 @@
quotationsToUse = sanitizedValue.indexOf('"') === -1 ? '"' : '\'';
}
inputValue += valueHasSpace ? `${sanitizedKey}:${symbol}${quotationsToUse}${sanitizedValue}${quotationsToUse}` : `${sanitizedKey}:${symbol}${sanitizedValue}`;
inputValue += ' ';
inputValues.push(valueHasSpace ? `${sanitizedKey}:${symbol}${quotationsToUse}${sanitizedValue}${quotationsToUse}` : `${sanitizedKey}:${symbol}${sanitizedValue}`);
} else if (!match && key === 'search') {
inputValue += sanitizedValue;
inputValue += ' ';
inputValues.push(sanitizedValue);
}
}
});
// Trim the last space value
this.filteredSearchInput.value = inputValue
.trim(
);
this.filteredSearchInput.value = inputValue
s.join(' '
);
if (inputValue
.trim()
) {
if (inputValue
s.length > 0
) {
this.clearSearchButton.classList.remove('hidden');
}
}
search() {
let path
= '?scope=all&utf8=✓'
;
let path
s = []
;
// Check current state
const currentPath = window.location.search;
...
...
@@ -158,7 +155,7 @@
currentState = separatorIndex === -1 ? remaining : remaining.slice(0, separatorIndex);
}
path
+= `&state=${currentState}`
;
path
s.push(`state=${currentState}`)
;
tokens.forEach((token) => {
const match = gl.FilteredSearchTokenKeys.get().filter(t => t.key === token.key)[0];
let tokenPath = '';
...
...
@@ -177,14 +174,14 @@
tokenPath = `${token.key}_${match.param}=${encodeURIComponent(token.value)}`;
}
path
+= `&${tokenPath}`
;
path
s.push(tokenPath)
;
});
if (searchToken) {
path
+= `&search=${encodeURIComponent(searchToken)}`
;
path
s.push(`search=${encodeURIComponent(searchToken)}`)
;
}
window.location =
path
;
window.location =
`?scope=all&utf8=✓&${paths.join('&')}`
;
}
}
...
...
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