Commit fa3b0241 authored by Tim Zallmann's avatar Tim Zallmann

Fixed new Additions

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