summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/merge_conflicts
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/merge_conflicts')
-rw-r--r--app/assets/javascripts/merge_conflicts/components/diff_file_editor.js33
-rw-r--r--app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js2
-rw-r--r--app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js2
-rw-r--r--app/assets/javascripts/merge_conflicts/merge_conflict_store.js28
4 files changed, 37 insertions, 28 deletions
diff --git a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js
index 356d8619fed..338fbd9078a 100644
--- a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js
+++ b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js
@@ -6,7 +6,7 @@ import axios from '~/lib/utils/axios_utils';
import { deprecatedCreateFlash as flash } from '~/flash';
import { __ } from '~/locale';
-(global => {
+((global) => {
global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.diffFileEditor = Vue.extend({
@@ -60,19 +60,28 @@ import { __ } from '~/locale';
const DataPromise = axios.get(this.file.content_path);
Promise.all([EditorPromise, DataPromise])
- .then(([{ default: EditorLite }, { data: { content, new_path: path } }]) => {
- const contentEl = this.$el.querySelector('.editor');
+ .then(
+ ([
+ { default: EditorLite },
+ {
+ data: { content, new_path: path },
+ },
+ ]) => {
+ const contentEl = this.$el.querySelector('.editor');
- this.originalContent = content;
- this.fileLoaded = true;
+ this.originalContent = content;
+ this.fileLoaded = true;
- this.editor = new EditorLite().createInstance({
- el: contentEl,
- blobPath: path,
- blobContent: content,
- });
- this.editor.onDidChangeModelContent(debounce(this.saveDiffResolution.bind(this), 250));
- })
+ this.editor = new EditorLite().createInstance({
+ el: contentEl,
+ blobPath: path,
+ blobContent: content,
+ });
+ this.editor.onDidChangeModelContent(
+ debounce(this.saveDiffResolution.bind(this), 250),
+ );
+ },
+ )
.catch(() => {
flash(__('An error occurred while loading the file'));
});
diff --git a/app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js b/app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js
index 827cf5f478d..bc926cb9155 100644
--- a/app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js
+++ b/app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js
@@ -4,7 +4,7 @@ import Vue from 'vue';
import actionsMixin from '../mixins/line_conflict_actions';
import utilsMixin from '../mixins/line_conflict_utils';
-(global => {
+((global) => {
global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.inlineConflictLines = Vue.extend({
diff --git a/app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js b/app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js
index 3cb406b819d..bb306e74825 100644
--- a/app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js
+++ b/app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js
@@ -4,7 +4,7 @@ import Vue from 'vue';
import actionsMixin from '../mixins/line_conflict_actions';
import utilsMixin from '../mixins/line_conflict_utils';
-(global => {
+((global) => {
global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.parallelConflictLines = Vue.extend({
diff --git a/app/assets/javascripts/merge_conflicts/merge_conflict_store.js b/app/assets/javascripts/merge_conflicts/merge_conflict_store.js
index c803774f4a7..693f0b619a8 100644
--- a/app/assets/javascripts/merge_conflicts/merge_conflict_store.js
+++ b/app/assets/javascripts/merge_conflicts/merge_conflict_store.js
@@ -5,7 +5,7 @@ import Vue from 'vue';
import Cookies from 'js-cookie';
import { s__ } from '~/locale';
-(global => {
+((global) => {
global.mergeConflicts = global.mergeConflicts || {};
const diffViewType = Cookies.get('diff_view');
@@ -48,7 +48,7 @@ import { s__ } from '~/locale';
},
decorateFiles(files) {
- files.forEach(file => {
+ files.forEach((file) => {
file.content = '';
file.resolutionData = {};
file.promptDiscardConfirmation = false;
@@ -72,7 +72,7 @@ import { s__ } from '~/locale';
setInlineLine(file) {
file.inlineLines = [];
- file.sections.forEach(section => {
+ file.sections.forEach((section) => {
let currentLineType = 'new';
const { conflict, lines, id } = section;
@@ -80,7 +80,7 @@ import { s__ } from '~/locale';
file.inlineLines.push(this.getHeadHeaderLine(id));
}
- lines.forEach(line => {
+ lines.forEach((line) => {
const { type } = line;
if ((type === 'new' || type === 'old') && currentLineType !== type) {
@@ -102,7 +102,7 @@ import { s__ } from '~/locale';
file.parallelLines = [];
const linesObj = { left: [], right: [] };
- file.sections.forEach(section => {
+ file.sections.forEach((section) => {
const { conflict, lines, id } = section;
if (conflict) {
@@ -110,7 +110,7 @@ import { s__ } from '~/locale';
linesObj.right.push(this.getHeadHeaderLine(id));
}
- lines.forEach(line => {
+ lines.forEach((line) => {
const { type } = line;
if (conflict) {
@@ -156,9 +156,9 @@ import { s__ } from '~/locale';
const { files } = this.state.conflictsData;
let count = 0;
- files.forEach(file => {
+ files.forEach((file) => {
if (file.type === CONFLICT_TYPES.TEXT) {
- file.sections.forEach(section => {
+ file.sections.forEach((section) => {
if (section.conflict) {
count += 1;
}
@@ -287,14 +287,14 @@ import { s__ } from '~/locale';
},
restoreFileLinesState(file) {
- file.inlineLines.forEach(line => {
+ file.inlineLines.forEach((line) => {
if (line.hasConflict || line.isHeader) {
line.isSelected = false;
line.isUnselected = false;
}
});
- file.parallelLines.forEach(lines => {
+ file.parallelLines.forEach((lines) => {
const left = lines[0];
const right = lines[1];
const isLeftMatch = left.hasConflict || left.isHeader;
@@ -362,7 +362,7 @@ import { s__ } from '~/locale';
files: [],
};
- this.state.conflictsData.files.forEach(file => {
+ this.state.conflictsData.files.forEach((file) => {
const addFile = {
old_path: file.old_path,
new_path: file.new_path,
@@ -388,13 +388,13 @@ import { s__ } from '~/locale';
handleSelected(file, sectionId, selection) {
Vue.set(file.resolutionData, sectionId, selection);
- file.inlineLines.forEach(line => {
+ file.inlineLines.forEach((line) => {
if (line.id === sectionId && (line.hasConflict || line.isHeader)) {
this.markLine(line, selection);
}
});
- file.parallelLines.forEach(lines => {
+ file.parallelLines.forEach((lines) => {
const left = lines[0];
const right = lines[1];
const hasSameId = right.id === sectionId || left.id === sectionId;
@@ -426,7 +426,7 @@ import { s__ } from '~/locale';
},
fileTextTypePresent() {
- return this.state.conflictsData.files.some(f => f.type === CONFLICT_TYPES.TEXT);
+ return this.state.conflictsData.files.some((f) => f.type === CONFLICT_TYPES.TEXT);
},
};
})(window.gl || (window.gl = {}));