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
05076d7d
Commit
05076d7d
authored
Feb 02, 2018
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace $.get in diff file editor with axios
parent
f88fbd2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
app/assets/javascripts/merge_conflicts/components/diff_file_editor.js
...avascripts/merge_conflicts/components/diff_file_editor.js
+11
-10
No files found.
app/assets/javascripts/merge_conflicts/components/diff_file_editor.js
View file @
05076d7d
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
/* global ace */
/* global ace */
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Flash
from
'
../../flash
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
flash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
((
global
)
=>
{
((
global
)
=>
{
global
.
mergeConflicts
=
global
.
mergeConflicts
||
{};
global
.
mergeConflicts
=
global
.
mergeConflicts
||
{};
...
@@ -49,27 +51,26 @@ import Flash from '../../flash';
...
@@ -49,27 +51,26 @@ import Flash from '../../flash';
loadEditor
()
{
loadEditor
()
{
this
.
loading
=
true
;
this
.
loading
=
true
;
$
.
get
(
this
.
file
.
content_path
)
axios
.
get
(
this
.
file
.
content_path
)
.
done
((
file
)
=>
{
.
then
(({
data
}
)
=>
{
const
content
=
this
.
$el
.
querySelector
(
'
pre
'
);
const
content
=
this
.
$el
.
querySelector
(
'
pre
'
);
const
fileContent
=
document
.
createTextNode
(
file
.
content
);
const
fileContent
=
document
.
createTextNode
(
data
.
content
);
content
.
textContent
=
fileContent
.
textContent
;
content
.
textContent
=
fileContent
.
textContent
;
this
.
originalContent
=
file
.
content
;
this
.
originalContent
=
data
.
content
;
this
.
fileLoaded
=
true
;
this
.
fileLoaded
=
true
;
this
.
editor
=
ace
.
edit
(
content
);
this
.
editor
=
ace
.
edit
(
content
);
this
.
editor
.
$blockScrolling
=
Infinity
;
// Turn off annoying warning
this
.
editor
.
$blockScrolling
=
Infinity
;
// Turn off annoying warning
this
.
editor
.
getSession
().
setMode
(
`ace/mode/
${
file
.
blob_ace_mode
}
`
);
this
.
editor
.
getSession
().
setMode
(
`ace/mode/
${
data
.
blob_ace_mode
}
`
);
this
.
editor
.
on
(
'
change
'
,
()
=>
{
this
.
editor
.
on
(
'
change
'
,
()
=>
{
this
.
saveDiffResolution
();
this
.
saveDiffResolution
();
});
});
this
.
saveDiffResolution
();
this
.
saveDiffResolution
();
this
.
loading
=
false
;
})
})
.
fail
(()
=>
{
.
catch
(()
=>
{
new
Flash
(
'
Failed to load the file, please try again.
'
);
flash
(
__
(
'
An error occurred while loading the file
'
));
})
.
always
(()
=>
{
this
.
loading
=
false
;
this
.
loading
=
false
;
});
});
},
},
...
...
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