Commit fa3b0241 authored by Tim Zallmann's avatar Tim Zallmann

Fixed new Additions

Automatic Diff Navigation
parent b452bdea
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
</span> </span>
<changed-file-icon <changed-file-icon
:file="file" :file="file"
v-if="file.changed || file.tempFile || file.mrDiff" v-if="file.changed || file.tempFile || file.mrChange"
class="prepend-top-5 pull-right" class="prepend-top-5 pull-right"
/> />
<new-dropdown <new-dropdown
......
...@@ -134,12 +134,12 @@ router.beforeEach((to, from, next) => { ...@@ -134,12 +134,12 @@ router.beforeEach((to, from, next) => {
store.state.entries[change.new_path]; store.state.entries[change.new_path];
if (changeTreeEntry) { if (changeTreeEntry) {
store.dispatch('setFileMrDiff', { store.dispatch('setFileMrChange', {
file: changeTreeEntry, file: changeTreeEntry,
mrDiff: change.diff, mrChange: change,
}); });
if (ind < 5) { if (ind < 10) {
store.dispatch('getFileData', { store.dispatch('getFileData', {
path: change.new_path, path: change.new_path,
makeFileActive: ind === 0, makeFileActive: ind === 0,
......
...@@ -22,7 +22,7 @@ export default class Model { ...@@ -22,7 +22,7 @@ export default class Model {
)), )),
); );
if (this.file.baseRaw) { if (this.file.mrChange) {
this.disposable.add( this.disposable.add(
(this.baseModel = this.monaco.editor.createModel( (this.baseModel = this.monaco.editor.createModel(
this.file.baseRaw, this.file.baseRaw,
......
...@@ -114,6 +114,10 @@ export default class Editor { ...@@ -114,6 +114,10 @@ export default class Editor {
original: model.getBaseModel(), original: model.getBaseModel(),
modified: model.getModel(), modified: model.getModel(),
}); });
this.monaco.editor.createDiffNavigator(this.instance, {
alwaysRevealFirst: true,
});
} }
setupMonacoTheme() { setupMonacoTheme() {
......
...@@ -87,8 +87,8 @@ export const getFileData = ( ...@@ -87,8 +87,8 @@ export const getFileData = (
}); });
}; };
export const setFileMrDiff = ({ state, commit }, { file, mrDiff }) => { export const setFileMrChange = ({ state, commit }, { file, mrChange }) => {
commit(types.SET_FILE_MR_DIFF, { file, mrDiff }); commit(types.SET_FILE_MR_CHANGE, { file, mrChange });
}; };
export const getRawFileData = ( export const getRawFileData = (
...@@ -101,7 +101,7 @@ export const getRawFileData = ( ...@@ -101,7 +101,7 @@ export const getRawFileData = (
.getRawFileData(file) .getRawFileData(file)
.then(raw => { .then(raw => {
commit(types.SET_FILE_RAW_DATA, { file, raw }); commit(types.SET_FILE_RAW_DATA, { file, raw });
if (file.mrDiff) { if (file.mrChange && file.mrChange.new_file === false) {
service service
.getBaseRawFileData(file, baseSha) .getBaseRawFileData(file, baseSha)
.then(baseRaw => { .then(baseRaw => {
......
...@@ -48,7 +48,7 @@ export const TOGGLE_FILE_CHANGED = 'TOGGLE_FILE_CHANGED'; ...@@ -48,7 +48,7 @@ export const TOGGLE_FILE_CHANGED = 'TOGGLE_FILE_CHANGED';
export const SET_CURRENT_BRANCH = 'SET_CURRENT_BRANCH'; export const SET_CURRENT_BRANCH = 'SET_CURRENT_BRANCH';
export const SET_ENTRIES = 'SET_ENTRIES'; export const SET_ENTRIES = 'SET_ENTRIES';
export const CREATE_TMP_ENTRY = 'CREATE_TMP_ENTRY'; export const CREATE_TMP_ENTRY = 'CREATE_TMP_ENTRY';
export const SET_FILE_MR_DIFF = 'SET_FILE_MR_DIFF'; export const SET_FILE_MR_CHANGE = 'SET_FILE_MR_CHANGE';
export const SET_FILE_TARGET_BRANCH = 'SET_FILE_TARGET_BRANCH'; export const SET_FILE_TARGET_BRANCH = 'SET_FILE_TARGET_BRANCH';
export const UPDATE_VIEWER = 'UPDATE_VIEWER'; export const UPDATE_VIEWER = 'UPDATE_VIEWER';
export const UPDATE_DELAY_VIEWER_CHANGE = 'UPDATE_DELAY_VIEWER_CHANGE'; export const UPDATE_DELAY_VIEWER_CHANGE = 'UPDATE_DELAY_VIEWER_CHANGE';
...@@ -66,9 +66,9 @@ export default { ...@@ -66,9 +66,9 @@ export default {
editorColumn, editorColumn,
}); });
}, },
[types.SET_FILE_MR_DIFF](state, { file, mrDiff }) { [types.SET_FILE_MR_CHANGE](state, { file, mrChange }) {
Object.assign(file, { Object.assign(file, {
mrDiff, mrChange,
}); });
}, },
[types.DISCARD_FILE_CHANGES](state, path) { [types.DISCARD_FILE_CHANGES](state, path) {
......
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