summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-09-30 16:23:38 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-10-13 14:16:35 -0500
commitcebad0fb60c90ff64cf16b022d262381aff5bf4f (patch)
treed83a774c456df5121a59d25e374fd36d132655f5
parent197ac5ebbfd8ca7fbcb79776fd25ca0e213376c4 (diff)
downloadgitlab-ce-cebad0fb60c90ff64cf16b022d262381aff5bf4f.tar.gz
Do not show Diff view switcher if all files are can be only resolved with an editor
-rw-r--r--app/assets/javascripts/merge_conflicts/merge_conflict_store.js.es612
-rw-r--r--app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js.es63
-rw-r--r--app/views/projects/merge_requests/conflicts/_commit_stats.html.haml2
3 files changed, 15 insertions, 2 deletions
diff --git a/app/assets/javascripts/merge_conflicts/merge_conflict_store.js.es6 b/app/assets/javascripts/merge_conflicts/merge_conflict_store.js.es6
index e1f862797f5..e31cac49d44 100644
--- a/app/assets/javascripts/merge_conflicts/merge_conflict_store.js.es6
+++ b/app/assets/javascripts/merge_conflicts/merge_conflict_store.js.es6
@@ -425,6 +425,18 @@
setSubmitState(state) {
this.state.isSubmitting = state;
+ },
+
+ fileTextTypePresent() {
+ let found = false;
+
+ this.state.conflictsData.files.find((f) => {
+ if (f.type === CONFLICT_TYPES.TEXT) {
+ return found = true;
+ }
+ });
+
+ return found;
}
};
diff --git a/app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js.es6 b/app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js.es6
index b5123e22f7a..449b4d2209a 100644
--- a/app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js.es6
+++ b/app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js.es6
@@ -21,7 +21,8 @@ $(() => {
computed: {
conflictsCountText() { return mergeConflictsStore.getConflictsCountText() },
readyToCommit() { return mergeConflictsStore.isReadyToCommit() },
- commitButtonText() { return mergeConflictsStore.getCommitButtonText() }
+ commitButtonText() { return mergeConflictsStore.getCommitButtonText() },
+ showDiffViewTypeSwitcher() { return mergeConflictsStore.fileTextTypePresent() }
},
created() {
mergeConflictsService
diff --git a/app/views/projects/merge_requests/conflicts/_commit_stats.html.haml b/app/views/projects/merge_requests/conflicts/_commit_stats.html.haml
index a3831d5a34e..7222b8ae4d3 100644
--- a/app/views/projects/merge_requests/conflicts/_commit_stats.html.haml
+++ b/app/views/projects/merge_requests/conflicts/_commit_stats.html.haml
@@ -1,5 +1,5 @@
.content-block.oneline-block.files-changed{"v-if" => "!isLoading && !hasError"}
- .inline-parallel-buttons
+ .inline-parallel-buttons{"v-if" => "showDiffViewTypeSwitcher"}
.btn-group
%a.btn{ |
":class" => "{'active': !isParallel}", |