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
Boxiang Sun
gitlab-ce
Commits
08a09c6b
Commit
08a09c6b
authored
Apr 17, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove IIFEs in filtered_search_bundle.js
parent
eeaeb275
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1825 additions
and
1855 deletions
+1825
-1855
app/assets/javascripts/filtered_search/dropdown_hint.js
app/assets/javascripts/filtered_search/dropdown_hint.js
+60
-62
app/assets/javascripts/filtered_search/dropdown_non_user.js
app/assets/javascripts/filtered_search/dropdown_non_user.js
+37
-39
app/assets/javascripts/filtered_search/dropdown_user.js
app/assets/javascripts/filtered_search/dropdown_user.js
+52
-54
app/assets/javascripts/filtered_search/dropdown_utils.js
app/assets/javascripts/filtered_search/dropdown_utils.js
+148
-150
app/assets/javascripts/filtered_search/filtered_search_dropdown.js
...s/javascripts/filtered_search/filtered_search_dropdown.js
+96
-98
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
...ripts/filtered_search/filtered_search_dropdown_manager.js
+148
-150
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+387
-389
app/assets/javascripts/filtered_search/filtered_search_token_keys.js
...javascripts/filtered_search/filtered_search_token_keys.js
+83
-85
app/assets/javascripts/filtered_search/filtered_search_tokenizer.js
.../javascripts/filtered_search/filtered_search_tokenizer.js
+49
-51
spec/javascripts/filtered_search/dropdown_user_spec.js
spec/javascripts/filtered_search/dropdown_user_spec.js
+46
-48
spec/javascripts/filtered_search/dropdown_utils_spec.js
spec/javascripts/filtered_search/dropdown_utils_spec.js
+222
-224
spec/javascripts/filtered_search/filtered_search_dropdown_manager_spec.js
.../filtered_search/filtered_search_dropdown_manager_spec.js
+71
-73
spec/javascripts/filtered_search/filtered_search_manager_spec.js
...vascripts/filtered_search/filtered_search_manager_spec.js
+196
-198
spec/javascripts/filtered_search/filtered_search_token_keys_spec.js
...cripts/filtered_search/filtered_search_token_keys_spec.js
+103
-105
spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js
...scripts/filtered_search/filtered_search_tokenizer_spec.js
+127
-129
No files found.
app/assets/javascripts/filtered_search/dropdown_hint.js
View file @
08a09c6b
...
...
@@ -2,8 +2,7 @@ import Filter from '~/droplab/plugins/filter';
require
(
'
./filtered_search_dropdown
'
);
(()
=>
{
class
DropdownHint
extends
gl
.
FilteredSearchDropdown
{
class
DropdownHint
extends
gl
.
FilteredSearchDropdown
{
constructor
(
droplab
,
dropdown
,
input
,
filter
)
{
super
(
droplab
,
dropdown
,
input
,
filter
);
this
.
config
=
{
...
...
@@ -76,8 +75,7 @@ require('./filtered_search_dropdown');
init
()
{
this
.
droplab
.
addHook
(
this
.
input
,
this
.
dropdown
,
[
Filter
],
this
.
config
).
init
();
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
DropdownHint
=
DropdownHint
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
DropdownHint
=
DropdownHint
;
app/assets/javascripts/filtered_search/dropdown_non_user.js
View file @
08a09c6b
...
...
@@ -5,8 +5,7 @@ import Filter from '~/droplab/plugins/filter';
require
(
'
./filtered_search_dropdown
'
);
(()
=>
{
class
DropdownNonUser
extends
gl
.
FilteredSearchDropdown
{
class
DropdownNonUser
extends
gl
.
FilteredSearchDropdown
{
constructor
(
droplab
,
dropdown
,
input
,
filter
,
endpoint
,
symbol
)
{
super
(
droplab
,
dropdown
,
input
,
filter
);
this
.
symbol
=
symbol
;
...
...
@@ -45,8 +44,7 @@ require('./filtered_search_dropdown');
this
.
droplab
.
addHook
(
this
.
input
,
this
.
dropdown
,
[
Ajax
,
Filter
],
this
.
config
).
init
();
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
DropdownNonUser
=
DropdownNonUser
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
DropdownNonUser
=
DropdownNonUser
;
app/assets/javascripts/filtered_search/dropdown_user.js
View file @
08a09c6b
...
...
@@ -4,8 +4,7 @@ import AjaxFilter from '~/droplab/plugins/ajax_filter';
require
(
'
./filtered_search_dropdown
'
);
(()
=>
{
class
DropdownUser
extends
gl
.
FilteredSearchDropdown
{
class
DropdownUser
extends
gl
.
FilteredSearchDropdown
{
constructor
(
droplab
,
dropdown
,
input
,
filter
)
{
super
(
droplab
,
dropdown
,
input
,
filter
);
this
.
config
=
{
...
...
@@ -65,8 +64,7 @@ require('./filtered_search_dropdown');
init
()
{
this
.
droplab
.
addHook
(
this
.
input
,
this
.
dropdown
,
[
AjaxFilter
],
this
.
config
).
init
();
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
DropdownUser
=
DropdownUser
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
DropdownUser
=
DropdownUser
;
app/assets/javascripts/filtered_search/dropdown_utils.js
View file @
08a09c6b
import
FilteredSearchContainer
from
'
./container
'
;
(()
=>
{
class
DropdownUtils
{
class
DropdownUtils
{
static
getEscapedText
(
text
)
{
let
escapedText
=
text
;
const
hasSpace
=
text
.
indexOf
(
'
'
)
!==
-
1
;
...
...
@@ -176,8 +175,7 @@ import FilteredSearchContainer from './container';
right
,
};
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
DropdownUtils
=
DropdownUtils
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
DropdownUtils
=
DropdownUtils
;
app/assets/javascripts/filtered_search/filtered_search_dropdown.js
View file @
08a09c6b
(()
=>
{
const
DATA_DROPDOWN_TRIGGER
=
'
data-dropdown-trigger
'
;
const
DATA_DROPDOWN_TRIGGER
=
'
data-dropdown-trigger
'
;
class
FilteredSearchDropdown
{
class
FilteredSearchDropdown
{
constructor
(
droplab
,
dropdown
,
input
,
filter
)
{
this
.
droplab
=
droplab
;
this
.
hookId
=
input
&&
input
.
id
;
...
...
@@ -117,8 +116,7 @@
hook
.
list
.
render
(
results
);
}
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchDropdown
=
FilteredSearchDropdown
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchDropdown
=
FilteredSearchDropdown
;
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
View file @
08a09c6b
import
DropLab
from
'
~/droplab/drop_lab
'
;
import
FilteredSearchContainer
from
'
./container
'
;
(()
=>
{
class
FilteredSearchDropdownManager
{
class
FilteredSearchDropdownManager
{
constructor
(
baseEndpoint
=
''
,
page
)
{
this
.
container
=
FilteredSearchContainer
.
container
;
this
.
baseEndpoint
=
baseEndpoint
.
replace
(
/
\/
$/
,
''
);
...
...
@@ -184,8 +183,7 @@ import FilteredSearchContainer from './container';
destroyDroplab
()
{
this
.
droplab
.
destroy
();
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchDropdownManager
=
FilteredSearchDropdownManager
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchDropdownManager
=
FilteredSearchDropdownManager
;
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
08a09c6b
...
...
@@ -6,8 +6,7 @@ import RecentSearchesStore from './stores/recent_searches_store';
import
RecentSearchesService
from
'
./services/recent_searches_service
'
;
import
eventHub
from
'
./event_hub
'
;
(()
=>
{
class
FilteredSearchManager
{
class
FilteredSearchManager
{
constructor
(
page
)
{
this
.
container
=
FilteredSearchContainer
.
container
;
this
.
filteredSearchInput
=
this
.
container
.
querySelector
(
'
.filtered-search
'
);
...
...
@@ -487,8 +486,7 @@ import eventHub from './event_hub';
this
.
filteredSearchInput
.
dispatchEvent
(
new
CustomEvent
(
'
input
'
));
this
.
search
();
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchManager
=
FilteredSearchManager
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchManager
=
FilteredSearchManager
;
app/assets/javascripts/filtered_search/filtered_search_token_keys.js
View file @
08a09c6b
(()
=>
{
const
tokenKeys
=
[{
const
tokenKeys
=
[{
key
:
'
author
'
,
type
:
'
string
'
,
param
:
'
username
'
,
symbol
:
'
@
'
,
},
{
},
{
key
:
'
assignee
'
,
type
:
'
string
'
,
param
:
'
username
'
,
symbol
:
'
@
'
,
},
{
},
{
key
:
'
milestone
'
,
type
:
'
string
'
,
param
:
'
title
'
,
symbol
:
'
%
'
,
},
{
},
{
key
:
'
label
'
,
type
:
'
array
'
,
param
:
'
name[]
'
,
symbol
:
'
~
'
,
}];
}];
const
alternativeTokenKeys
=
[{
const
alternativeTokenKeys
=
[{
key
:
'
label
'
,
type
:
'
string
'
,
param
:
'
name
'
,
symbol
:
'
~
'
,
}];
}];
const
tokenKeysWithAlternative
=
tokenKeys
.
concat
(
alternativeTokenKeys
);
const
tokenKeysWithAlternative
=
tokenKeys
.
concat
(
alternativeTokenKeys
);
const
conditions
=
[{
const
conditions
=
[{
url
:
'
assignee_id=0
'
,
tokenKey
:
'
assignee
'
,
value
:
'
none
'
,
},
{
},
{
url
:
'
milestone_title=No+Milestone
'
,
tokenKey
:
'
milestone
'
,
value
:
'
none
'
,
},
{
},
{
url
:
'
milestone_title=%23upcoming
'
,
tokenKey
:
'
milestone
'
,
value
:
'
upcoming
'
,
},
{
},
{
url
:
'
milestone_title=%23started
'
,
tokenKey
:
'
milestone
'
,
value
:
'
started
'
,
},
{
},
{
url
:
'
label_name[]=No+Label
'
,
tokenKey
:
'
label
'
,
value
:
'
none
'
,
}];
}];
class
FilteredSearchTokenKeys
{
class
FilteredSearchTokenKeys
{
static
get
()
{
return
tokenKeys
;
}
...
...
@@ -93,8 +92,7 @@
return
conditions
.
find
(
condition
=>
condition
.
tokenKey
===
key
&&
condition
.
value
===
value
)
||
null
;
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchTokenKeys
=
FilteredSearchTokenKeys
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchTokenKeys
=
FilteredSearchTokenKeys
;
app/assets/javascripts/filtered_search/filtered_search_tokenizer.js
View file @
08a09c6b
require
(
'
./filtered_search_token_keys
'
);
(()
=>
{
class
FilteredSearchTokenizer
{
class
FilteredSearchTokenizer
{
static
processTokens
(
input
)
{
const
allowedKeys
=
gl
.
FilteredSearchTokenKeys
.
get
().
map
(
i
=>
i
.
key
);
// Regex extracts `(token):(symbol)(value)`
...
...
@@ -51,8 +50,7 @@ require('./filtered_search_token_keys');
searchToken
,
};
}
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchTokenizer
=
FilteredSearchTokenizer
;
})();
window
.
gl
=
window
.
gl
||
{};
gl
.
FilteredSearchTokenizer
=
FilteredSearchTokenizer
;
spec/javascripts/filtered_search/dropdown_user_spec.js
View file @
08a09c6b
...
...
@@ -3,8 +3,7 @@ require('~/filtered_search/filtered_search_tokenizer');
require
(
'
~/filtered_search/filtered_search_dropdown
'
);
require
(
'
~/filtered_search/dropdown_user
'
);
(()
=>
{
describe
(
'
Dropdown User
'
,
()
=>
{
describe
(
'
Dropdown User
'
,
()
=>
{
describe
(
'
getSearchInput
'
,
()
=>
{
let
dropdownUser
;
...
...
@@ -67,5 +66,4 @@ require('~/filtered_search/dropdown_user');
window
.
gon
=
{};
});
});
});
})();
});
spec/javascripts/filtered_search/dropdown_utils_spec.js
View file @
08a09c6b
...
...
@@ -3,8 +3,7 @@ require('~/filtered_search/dropdown_utils');
require
(
'
~/filtered_search/filtered_search_tokenizer
'
);
require
(
'
~/filtered_search/filtered_search_dropdown_manager
'
);
(()
=>
{
describe
(
'
Dropdown Utils
'
,
()
=>
{
describe
(
'
Dropdown Utils
'
,
()
=>
{
describe
(
'
getEscapedText
'
,
()
=>
{
it
(
'
should return same word when it has no space
'
,
()
=>
{
const
escaped
=
gl
.
DropdownUtils
.
getEscapedText
(
'
textWithoutSpace
'
);
...
...
@@ -306,5 +305,4 @@ require('~/filtered_search/filtered_search_dropdown_manager');
});
});
});
});
})();
});
spec/javascripts/filtered_search/filtered_search_dropdown_manager_spec.js
View file @
08a09c6b
...
...
@@ -3,8 +3,7 @@ require('~/filtered_search/filtered_search_visual_tokens');
require
(
'
~/filtered_search/filtered_search_tokenizer
'
);
require
(
'
~/filtered_search/filtered_search_dropdown_manager
'
);
(()
=>
{
describe
(
'
Filtered Search Dropdown Manager
'
,
()
=>
{
describe
(
'
Filtered Search Dropdown Manager
'
,
()
=>
{
describe
(
'
addWordToInput
'
,
()
=>
{
function
getInputValue
()
{
return
document
.
querySelector
(
'
.filtered-search
'
).
value
;
...
...
@@ -97,5 +96,4 @@ require('~/filtered_search/filtered_search_dropdown_manager');
});
});
});
});
})();
});
spec/javascripts/filtered_search/filtered_search_manager_spec.js
View file @
08a09c6b
...
...
@@ -6,8 +6,7 @@ require('~/filtered_search/filtered_search_dropdown_manager');
require
(
'
~/filtered_search/filtered_search_manager
'
);
const
FilteredSearchSpecHelper
=
require
(
'
../helpers/filtered_search_spec_helper
'
);
(()
=>
{
describe
(
'
Filtered Search Manager
'
,
()
=>
{
describe
(
'
Filtered Search Manager
'
,
()
=>
{
let
input
;
let
manager
;
let
tokensContainer
;
...
...
@@ -272,5 +271,4 @@ const FilteredSearchSpecHelper = require('../helpers/filtered_search_spec_helper
expect
(
document
.
querySelector
(
'
.filtered-search-box
'
).
classList
.
contains
(
'
focus
'
)).
toEqual
(
false
);
});
});
});
})();
});
spec/javascripts/filtered_search/filtered_search_token_keys_spec.js
View file @
08a09c6b
require
(
'
~/extensions/array
'
);
require
(
'
~/filtered_search/filtered_search_token_keys
'
);
(()
=>
{
describe
(
'
Filtered Search Token Keys
'
,
()
=>
{
describe
(
'
Filtered Search Token Keys
'
,
()
=>
{
describe
(
'
get
'
,
()
=>
{
let
tokenKeys
;
...
...
@@ -106,5 +105,4 @@ require('~/filtered_search/filtered_search_token_keys');
expect
(
result
).
toEqual
(
conditions
[
0
]);
});
});
});
})();
});
spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js
View file @
08a09c6b
...
...
@@ -2,8 +2,7 @@ require('~/extensions/array');
require
(
'
~/filtered_search/filtered_search_token_keys
'
);
require
(
'
~/filtered_search/filtered_search_tokenizer
'
);
(()
=>
{
describe
(
'
Filtered Search Tokenizer
'
,
()
=>
{
describe
(
'
Filtered Search Tokenizer
'
,
()
=>
{
describe
(
'
processTokens
'
,
()
=>
{
it
(
'
returns for input containing only search value
'
,
()
=>
{
const
results
=
gl
.
FilteredSearchTokenizer
.
processTokens
(
'
searchTerm
'
);
...
...
@@ -131,5 +130,4 @@ require('~/filtered_search/filtered_search_tokenizer');
expect
(
results
.
tokens
[
0
].
symbol
).
toBe
(
'
~
'
);
});
});
});
})();
});
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