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
Léo-Paul Géneau
gitlab-ce
Commits
9846332f
Commit
9846332f
authored
Jan 26, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convered compare.js to axios
parent
33517d54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
26 deletions
+21
-26
app/assets/javascripts/compare.js
app/assets/javascripts/compare.js
+21
-26
No files found.
app/assets/javascripts/compare.js
View file @
9846332f
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, object-shorthand, consistent-return, no-unused-vars, comma-dangle, vars-on-top, prefer-template, max-len */
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, object-shorthand, consistent-return, no-unused-vars, comma-dangle, vars-on-top, prefer-template, max-len */
import
{
localTimeAgo
}
from
'
./lib/utils/datetime_utility
'
;
import
{
localTimeAgo
}
from
'
./lib/utils/datetime_utility
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
export
default
class
Compare
{
export
default
class
Compare
{
constructor
(
opts
)
{
constructor
(
opts
)
{
...
@@ -41,17 +42,14 @@ export default class Compare {
...
@@ -41,17 +42,14 @@ export default class Compare {
}
}
getTargetProject
()
{
getTargetProject
()
{
return
$
.
ajax
({
$
(
'
.mr_target_commit
'
).
empty
();
url
:
this
.
opts
.
targetProjectUrl
,
data
:
{
return
axios
.
get
(
this
.
opts
.
targetProjectUrl
,
{
target_project_id
:
$
(
"
input[name='merge_request[target_project_id]']
"
).
val
()
params
:
{
},
target_project_id
:
$
(
"
input[name='merge_request[target_project_id]']
"
).
val
(),
beforeSend
:
function
()
{
return
$
(
'
.mr_target_commit
'
).
empty
();
},
},
success
:
function
(
html
)
{
}).
then
(({
data
})
=>
{
return
$
(
'
.js-target-branch-dropdown .dropdown-content
'
).
html
(
html
);
$
(
'
.js-target-branch-dropdown .dropdown-content
'
).
html
(
data
);
}
});
});
}
}
...
@@ -68,22 +66,19 @@ export default class Compare {
...
@@ -68,22 +66,19 @@ export default class Compare {
});
});
}
}
static
sendAjax
(
url
,
loading
,
target
,
data
)
{
static
sendAjax
(
url
,
loading
,
target
,
params
)
{
var
$target
;
const
$target
=
$
(
target
);
$target
=
$
(
target
);
return
$
.
ajax
({
loading
.
show
();
url
:
url
,
$target
.
empty
();
data
:
data
,
beforeSend
:
function
()
{
return
axios
.
get
(
url
,
{
loading
.
show
();
params
,
return
$target
.
empty
();
}).
then
(({
data
})
=>
{
},
loading
.
hide
();
success
:
function
(
html
)
{
$target
.
html
(
data
);
loading
.
hide
();
var
className
=
'
.
'
+
$target
[
0
].
className
.
replace
(
'
'
,
'
.
'
);
$target
.
html
(
html
);
localTimeAgo
(
$
(
'
.js-timeago
'
,
className
));
var
className
=
'
.
'
+
$target
[
0
].
className
.
replace
(
'
'
,
'
.
'
);
localTimeAgo
(
$
(
'
.js-timeago
'
,
className
));
}
});
});
}
}
}
}
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