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
Tatuya Kamada
gitlab-ce
Commits
c2295fbd
Commit
c2295fbd
authored
Aug 02, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render right sidebar and handle request error.
parent
261d47bc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
15 deletions
+45
-15
app/assets/javascripts/merge_conflict_data_provider.js.es6
app/assets/javascripts/merge_conflict_data_provider.js.es6
+20
-6
app/assets/javascripts/merge_conflict_resolver.js.es6
app/assets/javascripts/merge_conflict_resolver.js.es6
+12
-4
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+4
-1
app/views/projects/merge_requests/conflicts.html.haml
app/views/projects/merge_requests/conflicts.html.haml
+9
-4
No files found.
app/assets/javascripts/merge_conflict_data_provider.js.es6
View file @
c2295fbd
...
...
@@ -8,6 +8,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
return {
isLoading : true,
hasError : false,
isParallel : diffViewType === 'parallel',
diffViewType : diffViewType,
conflictsData : {},
...
...
@@ -18,12 +19,19 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
decorateData(vueInstance, data) {
this.vueInstance = vueInstance;
data.shortCommitSha = data.commit_sha.slice(0, 7);
data.commitMesage = data.commit_message;
this.setParallelLines(data);
this.setInlineLines(data);
this.updateResolutionsData(data);
if (data.type === 'error') {
vueInstance.hasError = true;
data.errorMessage = data.message;
}
else {
data.shortCommitSha = data.commit_sha.slice(0, 7);
data.commitMesage = data.commit_message;
this.setParallelLines(data);
this.setInlineLines(data);
this.updateResolutionsData(data);
}
vueInstance.conflictsData = data;
}
...
...
@@ -166,7 +174,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
vi.diffView = newType;
vi.isParallel = newType === 'parallel';
$.cookie('diff_view', newType); // TODO: Make sure that cookie path added.
$('.container-fluid').toggleClass('container-limited');
$('.cont
ent-wrapper .cont
ainer-fluid').toggleClass('container-limited');
}
...
...
@@ -270,4 +278,10 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
}
}
handleFailedRequest(vueInstance, data) {
vueInstance.hasError = true;
vueInstance.conflictsData.errorMessage = 'Something went wrong!';
}
}
app/assets/javascripts/merge_conflict_resolver.js.es6
View file @
c2295fbd
...
...
@@ -29,10 +29,18 @@ window.MergeConflictResolver = class MergeConflictResolver {
fetchData() {
$.get('./conflicts.json').done( (data) => {
this.dataProvider.decorateData(this.vue, data);
this.vue.isLoading = false;
})
const dp = this.dataProvider;
$.get('./conflicts.json')
.done( (data) => {
dp.decorateData(this.vue, data);
})
.error( (data) => {
dp.handleFailedRequest(this.vue, data);
})
.always( () => {
this.vue.isLoading = false;
})
}
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
c2295fbd
...
...
@@ -141,7 +141,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
begin
render
json:
Gitlab
::
Conflict
::
FileCollection
.
new
(
@merge_request
)
rescue
Gitlab
::
Conflict
::
Parser
::
ParserError
,
Gitlab
::
Conflict
::
FileCollection
::
ConflictSideMissing
=>
e
render
json:
{
message:
'Unable to resolve conflicts in the web interface for this merge request'
}
render
json:
{
message:
'Unable to resolve conflicts in the web interface for this merge request'
,
type:
'error'
}
end
end
end
...
...
app/views/projects/merge_requests/conflicts.haml
→
app/views/projects/merge_requests/conflicts.h
tml.h
aml
View file @
c2295fbd
...
...
@@ -2,14 +2,19 @@
=
render
"projects/merge_requests/show/mr_title"
.merge-request-details.issuable-details
{
data:
{
id:
@merge_request
.
project
.
id
}}
.merge-request-details.issuable-details
=
render
"projects/merge_requests/show/mr_box"
=
render
'shared/issuable/sidebar'
,
issuable:
@merge_request
#conflicts
.loading
{
"v-if"
=>
"isLoading"
}
.loading
{
"v-if"
=>
"isLoading"
}
%i
.fa.fa-spinner.fa-spin
.content-block.oneline-block.files-changed
{
"v-if"
=>
"!isLoading"
}
.content-block.oneline-block
{
"v-if"
=>
"hasError"
}
%p
{{conflictsData.errorMessage}}
.content-block.oneline-block.files-changed
{
"v-if"
=>
"!isLoading && !hasError"
}
.inline-parallel-buttons
.btn-group
%a
.btn
{
|
...
...
@@ -30,7 +35,7 @@
into
%strong
{{conflictsData.target_branch}}
.files-wrapper
{
"v-if"
=>
"!isLoading"
}
.files-wrapper
{
"v-if"
=>
"!isLoading && !hasError"
}
.files
{
"v-if"
=>
"isParallel"
}
.diff-file.file-holder.conflict.parallel-view
{
"v-for"
=>
"file in conflictsData.files"
}
.file-title
...
...
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