Commit 41f7cee9 authored by Fatih Acet's avatar Fatih Acet

Show loading button while Ajax request is in progress.

parent b79378ca
...@@ -11,6 +11,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider { ...@@ -11,6 +11,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
hasError : false, hasError : false,
isParallel : diffViewType === 'parallel', isParallel : diffViewType === 'parallel',
diffViewType : diffViewType, diffViewType : diffViewType,
isSubmitting : false,
conflictsData : {}, conflictsData : {},
resolutionData : {} resolutionData : {}
} }
...@@ -34,6 +35,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider { ...@@ -34,6 +35,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
} }
vueInstance.conflictsData = data; vueInstance.conflictsData = data;
vueInstance.isSubmitting = false;
} }
...@@ -233,7 +235,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider { ...@@ -233,7 +235,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
isAllResolved() { isAllResolved() {
return this.getConflictsCount() === this.getResolvedCount(); return !this.vueInstance.isSubmitting && this.getConflictsCount() === this.getResolvedCount();
} }
......
...@@ -31,6 +31,17 @@ window.MergeConflictResolver = class MergeConflictResolver { ...@@ -31,6 +31,17 @@ window.MergeConflictResolver = class MergeConflictResolver {
} }
setComputedProperties() {
const dp = this.dataProvider;
return {
conflictsCount() { return dp.getConflictsCount() },
resolvedCount() { return dp.getResolvedCount() },
allResolved() { return dp.isAllResolved() }
}
}
fetchData() { fetchData() {
const dp = this.dataProvider; const dp = this.dataProvider;
...@@ -47,21 +58,19 @@ window.MergeConflictResolver = class MergeConflictResolver { ...@@ -47,21 +58,19 @@ window.MergeConflictResolver = class MergeConflictResolver {
} }
setComputedProperties() {
const dp = this.dataProvider;
return {
conflictsCount() { return dp.getConflictsCount() },
resolvedCount() { return dp.getResolvedCount() },
allResolved() { return dp.isAllResolved() }
}
}
commit() { commit() {
this.vue.isSubmitting = true;
$.post('./resolve_conflicts', this.dataProvider.getCommitData()) $.post('./resolve_conflicts', this.dataProvider.getCommitData())
.then( (data) => { .done( (data) => {
window.location.href = data.redirect_to window.location.href = data.redirect_to;
})
.error(() => {
new Flash('Something went wrong!');
}) })
.always(() => {
this.vue.isSubmitting = false;
});
} }
} }
...@@ -137,4 +137,8 @@ $unselected_line: #f8f8f8; ...@@ -137,4 +137,8 @@ $unselected_line: #f8f8f8;
outline: none; outline: none;
} }
} }
.btn-success .fa-spinner {
color: #FFF;
}
} }
...@@ -126,8 +126,10 @@ ...@@ -126,8 +126,10 @@
%textarea.form-control.js-commit-message{":disabled" => "!allResolved", "v-model" => "conflictsData.commitMessage"} %textarea.form-control.js-commit-message{":disabled" => "!allResolved", "v-model" => "conflictsData.commitMessage"}
{{{conflictsData.commitMessage}}} {{{conflictsData.commitMessage}}}
%button{type: 'button', class: 'btn btn-success js-submit-button', ":disabled" => "!allResolved", "@click" => "commit()"} %button{type: "button", class: "btn btn-success js-submit-button", ":disabled" => "!allResolved", "@click" => "commit()"}
Commit conflict resolution %span Commit conflict resolution
%a.fa.fa-spin.fa-spinner{":class" => "{'hidden': !isSubmitting}"}
/ %button{type: 'button', class: 'btn btn-cancel'} / FIXME: Hardcoded path
/ Cancel %a.btn.btn-cancel{"href" => "diffs"}
Cancel
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment