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
05a3479c
Commit
05a3479c
authored
Jan 30, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted labels_select.js to axios
parent
d5041184
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
85 deletions
+85
-85
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+85
-85
No files found.
app/assets/javascripts/labels_select.js
View file @
05a3479c
...
@@ -2,9 +2,12 @@
...
@@ -2,9 +2,12 @@
/* global Issuable */
/* global Issuable */
/* global ListLabel */
/* global ListLabel */
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
{
__
}
from
'
./locale
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
IssuableBulkUpdateActions
from
'
./issuable_bulk_update_actions
'
;
import
IssuableBulkUpdateActions
from
'
./issuable_bulk_update_actions
'
;
import
DropdownUtils
from
'
./filtered_search/dropdown_utils
'
;
import
DropdownUtils
from
'
./filtered_search/dropdown_utils
'
;
import
CreateLabelDropdown
from
'
./create_label
'
;
import
CreateLabelDropdown
from
'
./create_label
'
;
import
flash
from
'
./flash
'
;
export
default
class
LabelsSelect
{
export
default
class
LabelsSelect
{
constructor
(
els
,
options
=
{})
{
constructor
(
els
,
options
=
{})
{
...
@@ -82,12 +85,8 @@ export default class LabelsSelect {
...
@@ -82,12 +85,8 @@ export default class LabelsSelect {
}
}
$loading
.
removeClass
(
'
hidden
'
).
fadeIn
();
$loading
.
removeClass
(
'
hidden
'
).
fadeIn
();
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
return
$
.
ajax
({
axios
.
put
(
issueUpdateURL
,
data
)
type
:
'
PUT
'
,
.
then
(({
data
})
=>
{
url
:
issueUpdateURL
,
dataType
:
'
JSON
'
,
data
:
data
}).
done
(
function
(
data
)
{
var
labelCount
,
template
,
labelTooltipTitle
,
labelTitles
;
var
labelCount
,
template
,
labelTooltipTitle
,
labelTitles
;
$loading
.
fadeOut
();
$loading
.
fadeOut
();
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
...
@@ -128,15 +127,15 @@ export default class LabelsSelect {
...
@@ -128,15 +127,15 @@ export default class LabelsSelect {
$
(
'
.has-tooltip
'
,
$value
).
tooltip
({
$
(
'
.has-tooltip
'
,
$value
).
tooltip
({
container
:
'
body
'
container
:
'
body
'
});
});
});
})
.
catch
(()
=>
flash
(
__
(
'
Error saving label update.
'
)));
};
};
$dropdown
.
glDropdown
({
$dropdown
.
glDropdown
({
showMenuAbove
:
showMenuAbove
,
showMenuAbove
:
showMenuAbove
,
data
:
function
(
term
,
callback
)
{
data
:
function
(
term
,
callback
)
{
return
$
.
ajax
({
axios
.
get
(
labelUrl
)
url
:
labelUrl
.
then
((
res
)
=>
{
}).
done
(
function
(
data
)
{
let
data
=
_
.
chain
(
res
.
data
).
groupBy
(
function
(
label
)
{
data
=
_
.
chain
(
data
).
groupBy
(
function
(
label
)
{
return
label
.
title
;
return
label
.
title
;
}).
map
(
function
(
label
)
{
}).
map
(
function
(
label
)
{
var
color
;
var
color
;
...
@@ -174,7 +173,8 @@ export default class LabelsSelect {
...
@@ -174,7 +173,8 @@ export default class LabelsSelect {
if
(
showMenuAbove
)
{
if
(
showMenuAbove
)
{
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
}
}
});
})
.
catch
(()
=>
flash
(
__
(
'
Error fetching labels.
'
)));
},
},
renderRow
:
function
(
label
,
instance
)
{
renderRow
:
function
(
label
,
instance
)
{
var
$a
,
$li
,
color
,
colorEl
,
indeterminate
,
removesAll
,
selectedClass
,
spacing
,
i
,
marked
,
dropdownName
,
dropdownValue
;
var
$a
,
$li
,
color
,
colorEl
,
indeterminate
,
removesAll
,
selectedClass
,
spacing
,
i
,
marked
,
dropdownName
,
dropdownValue
;
...
...
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