Commit 75f69274 authored by Filipa Lacerda's avatar Filipa Lacerda

Removes merge conflicts vue code from globalnamespace

parent 7fc47fae
/* eslint-disable no-param-reassign, comma-dangle */ /* eslint-disable no-param-reassign */
import Vue from 'vue'; 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 = global.mergeConflicts || {};
global.mergeConflicts.inlineConflictLines = Vue.extend({ global.mergeConflicts.inlineConflictLines = Vue.extend({
props: { props: {
file: Object file: Object,
}, },
mixins: [global.mergeConflicts.utils, global.mergeConflicts.actions], mixins: [utilsMixin, actionsMixin],
}); });
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
/* eslint-disable no-param-reassign, comma-dangle */ /* eslint-disable no-param-reassign, comma-dangle */
import Vue from 'vue'; 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 = global.mergeConflicts || {};
...@@ -9,7 +11,7 @@ import Vue from 'vue'; ...@@ -9,7 +11,7 @@ import Vue from 'vue';
props: { props: {
file: Object file: Object
}, },
mixins: [global.mergeConflicts.utils, global.mergeConflicts.actions], mixins: [utilsMixin, actionsMixin],
template: ` template: `
<table> <table>
<tr class="line_holder parallel" v-for="section in file.parallelLines"> <tr class="line_holder parallel" v-for="section in file.parallelLines">
......
/* eslint-disable no-param-reassign, comma-dangle */
import axios from '../lib/utils/axios_utils'; import axios from '../lib/utils/axios_utils';
((global) => { export default class MergeConflictsService {
global.mergeConflicts = global.mergeConflicts || {};
class mergeConflictsService {
constructor(options) { constructor(options) {
this.conflictsPath = options.conflictsPath; this.conflictsPath = options.conflictsPath;
this.resolveConflictsPath = options.resolveConflictsPath; this.resolveConflictsPath = options.resolveConflictsPath;
...@@ -17,7 +13,4 @@ import axios from '../lib/utils/axios_utils'; ...@@ -17,7 +13,4 @@ import axios from '../lib/utils/axios_utils';
submitResolveConflicts(data) { submitResolveConflicts(data) {
return axios.post(this.resolveConflictsPath, data); return axios.post(this.resolveConflictsPath, data);
} }
} }
global.mergeConflicts.mergeConflictsService = mergeConflictsService;
})(window.gl || (window.gl = {}));
...@@ -5,7 +5,7 @@ import Vue from 'vue'; ...@@ -5,7 +5,7 @@ import Vue from 'vue';
import Flash from '../flash'; import Flash from '../flash';
import initIssuableSidebar from '../init_issuable_sidebar'; import initIssuableSidebar from '../init_issuable_sidebar';
import './merge_conflict_store'; import './merge_conflict_store';
import './merge_conflict_service'; import MergeConflictsService from './merge_conflict_service';
import './mixins/line_conflict_utils'; import './mixins/line_conflict_utils';
import './mixins/line_conflict_actions'; import './mixins/line_conflict_actions';
import './components/diff_file_editor'; import './components/diff_file_editor';
...@@ -17,7 +17,7 @@ export default function initMergeConflicts() { ...@@ -17,7 +17,7 @@ export default function initMergeConflicts() {
const INTERACTIVE_RESOLVE_MODE = 'interactive'; const INTERACTIVE_RESOLVE_MODE = 'interactive';
const conflictsEl = document.querySelector('#conflicts'); const conflictsEl = document.querySelector('#conflicts');
const mergeConflictsStore = gl.mergeConflicts.mergeConflictsStore; const mergeConflictsStore = gl.mergeConflicts.mergeConflictsStore;
const mergeConflictsService = new gl.mergeConflicts.mergeConflictsService({ const mergeConflictsService = new MergeConflictsService({
conflictsPath: conflictsEl.dataset.conflictsPath, conflictsPath: conflictsEl.dataset.conflictsPath,
resolveConflictsPath: conflictsEl.dataset.resolveConflictsPath resolveConflictsPath: conflictsEl.dataset.resolveConflictsPath
}); });
......
/* eslint-disable no-param-reassign, comma-dangle */ export default {
((global) => {
global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.actions = {
methods: { methods: {
handleSelected(file, sectionId, selection) { handleSelected(file, sectionId, selection) {
gl.mergeConflicts.mergeConflictsStore.handleSelected(file, sectionId, selection); gl.mergeConflicts.mergeConflictsStore.handleSelected(file, sectionId, selection);
} },
} },
}; };
})(window.gl || (window.gl = {}));
/* eslint-disable no-param-reassign, quote-props, comma-dangle */ export default {
((global) => {
global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.utils = {
methods: { methods: {
lineCssClass(line) { lineCssClass(line) {
return { return {
'head': line.isHead, head: line.isHead,
'origin': line.isOrigin, origin: line.isOrigin,
'match': line.hasMatch, match: line.hasMatch,
'selected': line.isSelected, selected: line.isSelected,
'unselected': line.isUnselected unselected: line.isUnselected,
}; };
} },
} },
}; };
})(window.gl || (window.gl = {}));
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