Commit c279c66d authored by Phil Hughes's avatar Phil Hughes

Merge branch 'gl-remove-window-scope' into 'master'

Removes merge conflicts vue code from globalnamespace

See merge request gitlab-org/gitlab-ce!19750
parents 5aaae753 3e11cbeb
/* 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({
mixins: [global.mergeConflicts.utils, global.mergeConflicts.actions], mixins: [utilsMixin, actionsMixin],
props: { props: {
file: { file: {
type: Object, type: Object,
......
/* 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 || {};
global.mergeConflicts.parallelConflictLines = Vue.extend({ global.mergeConflicts.parallelConflictLines = Vue.extend({
mixins: [global.mergeConflicts.utils, global.mergeConflicts.actions], mixins: [utilsMixin, actionsMixin],
props: { props: {
file: { file: {
type: Object, type: Object,
......
/* 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 || {}; constructor(options) {
this.conflictsPath = options.conflictsPath;
class mergeConflictsService { this.resolveConflictsPath = options.resolveConflictsPath;
constructor(options) { }
this.conflictsPath = options.conflictsPath;
this.resolveConflictsPath = options.resolveConflictsPath;
}
fetchConflictsData() {
return axios.get(this.conflictsPath);
}
submitResolveConflicts(data) { fetchConflictsData() {
return axios.post(this.resolveConflictsPath, data); return axios.get(this.conflictsPath);
}
} }
global.mergeConflicts.mergeConflictsService = mergeConflictsService; submitResolveConflicts(data) {
})(window.gl || (window.gl = {})); return axios.post(this.resolveConflictsPath, data);
}
}
...@@ -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 {
methods: {
((global) => { handleSelected(file, sectionId, selection) {
global.mergeConflicts = global.mergeConflicts || {}; gl.mergeConflicts.mergeConflictsStore.handleSelected(file, sectionId, selection);
},
global.mergeConflicts.actions = { },
methods: { };
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 {
methods: {
((global) => { lineCssClass(line) {
global.mergeConflicts = global.mergeConflicts || {}; return {
head: line.isHead,
global.mergeConflicts.utils = { origin: line.isOrigin,
methods: { match: line.hasMatch,
lineCssClass(line) { selected: line.isSelected,
return { unselected: line.isUnselected,
'head': line.isHead, };
'origin': line.isOrigin, },
'match': line.hasMatch, },
'selected': line.isSelected, };
'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