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
a32065ee
Commit
a32065ee
authored
Feb 02, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted protected_branch_edit.js to use axios
parent
e6cd217d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
22 deletions
+18
-22
app/assets/javascripts/protected_branches/protected_branch_edit.js
...s/javascripts/protected_branches/protected_branch_edit.js
+18
-22
No files found.
app/assets/javascripts/protected_branches/protected_branch_edit.js
View file @
a32065ee
/* eslint-disable no-new */
import
Flash
from
'
../flash
'
;
import
flash
from
'
../flash
'
;
import
axios
from
'
../lib/utils/axios_utils
'
;
import
ProtectedBranchAccessDropdown
from
'
./protected_branch_access_dropdown
'
;
export
default
class
ProtectedBranchEdit
{
...
...
@@ -38,29 +38,25 @@ export default class ProtectedBranchEdit {
this
.
$allowedToMergeDropdown
.
disable
();
this
.
$allowedToPushDropdown
.
disable
();
$
.
ajax
({
type
:
'
POST
'
,
url
:
this
.
$wrap
.
data
(
'
url
'
),
dataType
:
'
json
'
,
data
:
{
_method
:
'
PATCH
'
,
protected_branch
:
{
merge_access_levels_attributes
:
[{
id
:
this
.
$allowedToMergeDropdown
.
data
(
'
access-level-id
'
),
access_level
:
$allowedToMergeInput
.
val
(),
}],
push_access_levels_attributes
:
[{
id
:
this
.
$allowedToPushDropdown
.
data
(
'
access-level-id
'
),
access_level
:
$allowedToPushInput
.
val
(),
}],
},
axios
.
patch
(
this
.
$wrap
.
data
(
'
url
'
),
{
protected_branch
:
{
merge_access_levels_attributes
:
[{
id
:
this
.
$allowedToMergeDropdown
.
data
(
'
access-level-id
'
),
access_level
:
$allowedToMergeInput
.
val
(),
}],
push_access_levels_attributes
:
[{
id
:
this
.
$allowedToPushDropdown
.
data
(
'
access-level-id
'
),
access_level
:
$allowedToPushInput
.
val
(),
}],
},
error
()
{
new
Flash
(
'
Failed to update branch!
'
,
'
alert
'
,
document
.
querySelector
(
'
.js-protected-branches-list
'
)
);
},
}).
always
(()
=>
{
}).
then
(()
=>
{
this
.
$allowedToMergeDropdown
.
enable
(
);
this
.
$allowedToPushDropdown
.
enable
();
}).
catch
(()
=>
{
this
.
$allowedToMergeDropdown
.
enable
();
this
.
$allowedToPushDropdown
.
enable
();
flash
(
'
Failed to update branch!
'
,
'
alert
'
,
document
.
querySelector
(
'
.js-protected-branches-list
'
));
});
}
}
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