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
cf8ae790
Commit
cf8ae790
authored
Nov 07, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add filter params to search
parent
71dc5af9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
...avascripts/filtered_search/filtered_search_manager.js.es6
+24
-12
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
View file @
cf8ae790
...
@@ -5,15 +5,19 @@
...
@@ -5,15 +5,19 @@
const validTokenKeys = [{
const validTokenKeys = [{
key: 'author',
key: 'author',
type: 'string',
type: 'string',
param: 'id',
},{
},{
key: 'assignee',
key: 'assignee',
type: 'string'
type: 'string',
param: 'id',
},{
},{
key: 'milestone',
key: 'milestone',
type: 'string'
type: 'string',
param: 'title',
},{
},{
key: 'label',
key: 'label',
type: 'array'
type: 'array',
param: 'name%5B%5D',
},];
},];
class FilteredSearchManager {
class FilteredSearchManager {
...
@@ -53,14 +57,14 @@
...
@@ -53,14 +57,14 @@
const tokenValue = i.slice(colonIndex + 1);
const tokenValue = i.slice(colonIndex + 1);
const match = validTokenKeys.filter((v) => {
const match = validTokenKeys.filter((v) => {
return v.
name
=== tokenKey;
return v.
key
=== tokenKey;
})[0];
})[0];
if (match) {
if (match
&& tokenValue.length > 0
) {
this.tokens.push =
{
this.tokens.push(
{
key: match.key,
key: match.key,
value: tokenValue,
value: tokenValue,
}
;
})
;
}
}
} else {
} else {
searchTerms += i + ' ';
searchTerms += i + ' ';
...
@@ -72,8 +76,11 @@
...
@@ -72,8 +76,11 @@
}
}
printTokens() {
printTokens() {
console.log(this.tokens);
console.log('tokens:')
console.log(this.searchToken);
this.tokens.forEach((token) => {
console.log(token);
})
console.log('search: ' + this.searchToken);
}
}
checkForEnter(event) {
checkForEnter(event) {
...
@@ -88,8 +95,13 @@
...
@@ -88,8 +95,13 @@
console.log('search');
console.log('search');
let path = '?scope=all&state=opened&utf8=✓';
let path = '?scope=all&state=opened&utf8=✓';
this.tokens.foreach((token) => {
this.tokens.forEach((token) => {
const param = validTokenKeys.find((t) => {
return t.key === token.key;
}).param;
path += `&${token.key}_${param}=${token.value}`;
});
});
if (this.searchToken) {
if (this.searchToken) {
...
...
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