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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a873d20f
Commit
a873d20f
authored
Feb 13, 2018
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace $.getJSON with axios in mirrorPull
parent
1d237d4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
app/assets/javascripts/mirrors/mirror_pull.js
app/assets/javascripts/mirrors/mirror_pull.js
+17
-14
No files found.
app/assets/javascripts/mirrors/mirror_pull.js
View file @
a873d20f
...
...
@@ -2,6 +2,8 @@ import _ from 'underscore';
import
Flash
from
'
../flash
'
;
import
AUTH_METHOD
from
'
./constants
'
;
import
{
backOff
}
from
'
../lib/utils/common_utils
'
;
import
{
__
}
from
'
../locale
'
;
import
axios
from
'
../lib/utils/axios_utils
'
;
export
default
class
MirrorPull
{
constructor
(
formSelector
)
{
...
...
@@ -67,20 +69,20 @@ export default class MirrorPull {
// Make backOff polling to get data
backOff
((
next
,
stop
)
=>
{
$
.
getJSON
(
`
${
projectMirrorSSHEndpoint
}
?ssh_url=
${
repositoryUrl
}
`
)
.
done
((
res
,
statusText
,
header
)
=>
{
if
(
header
.
status
===
204
)
{
this
.
backOffRequestCounter
=
this
.
backOffRequestCounter
+=
1
;
if
(
this
.
backOffRequestCounter
<
3
)
{
next
();
}
else
{
stop
(
res
);
}
axios
.
get
(
`
${
projectMirrorSSHEndpoint
}
?ssh_url=
${
repositoryUrl
}
`
)
.
then
(({
data
,
status
})
=>
{
if
(
status
===
204
)
{
this
.
backOffRequestCounter
=
this
.
backOffRequestCounter
+=
1
;
if
(
this
.
backOffRequestCounter
<
3
)
{
next
();
}
else
{
stop
(
res
);
stop
(
data
);
}
})
.
fail
(
stop
);
}
else
{
stop
(
data
);
}
})
.
catch
(
stop
);
})
.
then
((
res
)
=>
{
$btnLoadSpinner
.
addClass
(
'
hidden
'
);
...
...
@@ -90,10 +92,11 @@ export default class MirrorPull {
this
.
showSSHInformation
(
res
);
}
})
.
catch
((
res
)
=>
{
.
catch
((
{
response
}
)
=>
{
// Show failure message when there's an error and re-enable Detect host keys button
const
failureMessage
=
res
.
responseJSON
?
res
.
responseJSON
.
message
:
'
Something went wrong on our end.
'
;
const
failureMessage
=
res
ponse
.
data
?
response
.
data
.
message
:
__
(
'
An error occurred while detecting host keys
'
)
;
Flash
(
failureMessage
);
// eslint-disable-line
$btnLoadSpinner
.
addClass
(
'
hidden
'
);
this
.
$btnDetectHostKeys
.
enable
();
});
...
...
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