Fixes to Formatting to all Files
This commit is contained in:
parent
f00a971a6d
commit
0ea359d2cf
14 changed files with 32 additions and 202 deletions
|
@ -11,12 +11,8 @@ const Api = {
|
||||||
projectPath: '/api/:version/projects/:id',
|
projectPath: '/api/:version/projects/:id',
|
||||||
projectLabelsPath: '/:namespace_path/:project_path/labels',
|
projectLabelsPath: '/:namespace_path/:project_path/labels',
|
||||||
mergeRequestPath: '/api/:version/projects/:id/merge_requests/:mrid',
|
mergeRequestPath: '/api/:version/projects/:id/merge_requests/:mrid',
|
||||||
mergeRequestChangesPath:
|
mergeRequestChangesPath: '/api/:version/projects/:id/merge_requests/:mrid/changes',
|
||||||
'/api/:version/projects/:id/merge_requests/:mrid/changes',
|
mergeRequestVersionsPath: '/api/:version/projects/:id/merge_requests/:mrid/versions',
|
||||||
mergeRequestVersionsPath:
|
|
||||||
'/api/:version/projects/:id/merge_requests/:mrid/versions',
|
|
||||||
mergeRequestVersionPath:
|
|
||||||
'/api/:version/projects/:id/merge_requests/:mrid/version/:versionid',
|
|
||||||
groupLabelsPath: '/groups/:namespace_path/-/labels',
|
groupLabelsPath: '/groups/:namespace_path/-/labels',
|
||||||
licensePath: '/api/:version/templates/licenses/:key',
|
licensePath: '/api/:version/templates/licenses/:key',
|
||||||
gitignorePath: '/api/:version/templates/gitignores/:key',
|
gitignorePath: '/api/:version/templates/gitignores/:key',
|
||||||
|
@ -96,10 +92,7 @@ const Api = {
|
||||||
|
|
||||||
// Return single project
|
// Return single project
|
||||||
project(projectPath) {
|
project(projectPath) {
|
||||||
const url = Api.buildUrl(Api.projectPath).replace(
|
const url = Api.buildUrl(Api.projectPath).replace(':id', encodeURIComponent(projectPath));
|
||||||
':id',
|
|
||||||
encodeURIComponent(projectPath),
|
|
||||||
);
|
|
||||||
|
|
||||||
return axios.get(url);
|
return axios.get(url);
|
||||||
},
|
},
|
||||||
|
@ -129,15 +122,6 @@ const Api = {
|
||||||
return axios.get(url);
|
return axios.get(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
mergeRequestVersion(projectPath, mergeRequestId, versionId) {
|
|
||||||
const url = Api.buildUrl(Api.mergeRequestVersionPath)
|
|
||||||
.replace(':id', encodeURIComponent(projectPath))
|
|
||||||
.replace(':mrid', mergeRequestId)
|
|
||||||
.replace(':versionid', versionId);
|
|
||||||
|
|
||||||
return axios.get(url);
|
|
||||||
},
|
|
||||||
|
|
||||||
newLabel(namespacePath, projectPath, data, callback) {
|
newLabel(namespacePath, projectPath, data, callback) {
|
||||||
let url;
|
let url;
|
||||||
|
|
||||||
|
@ -146,10 +130,7 @@ const Api = {
|
||||||
.replace(':namespace_path', namespacePath)
|
.replace(':namespace_path', namespacePath)
|
||||||
.replace(':project_path', projectPath);
|
.replace(':project_path', projectPath);
|
||||||
} else {
|
} else {
|
||||||
url = Api.buildUrl(Api.groupLabelsPath).replace(
|
url = Api.buildUrl(Api.groupLabelsPath).replace(':namespace_path', namespacePath);
|
||||||
':namespace_path',
|
|
||||||
namespacePath,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
|
@ -175,10 +156,7 @@ const Api = {
|
||||||
|
|
||||||
commitMultiple(id, data) {
|
commitMultiple(id, data) {
|
||||||
// see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
|
// see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
|
||||||
const url = Api.buildUrl(Api.commitPath).replace(
|
const url = Api.buildUrl(Api.commitPath).replace(':id', encodeURIComponent(id));
|
||||||
':id',
|
|
||||||
encodeURIComponent(id),
|
|
||||||
);
|
|
||||||
return axios.post(url, JSON.stringify(data), {
|
return axios.post(url, JSON.stringify(data), {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
|
|
@ -13,12 +13,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState(['leftPanelCollapsed', 'rightPanelCollapsed', 'viewer', 'delayViewerUpdated']),
|
||||||
'leftPanelCollapsed',
|
|
||||||
'rightPanelCollapsed',
|
|
||||||
'viewer',
|
|
||||||
'delayViewerUpdated',
|
|
||||||
]),
|
|
||||||
...mapGetters(['currentMergeRequest']),
|
...mapGetters(['currentMergeRequest']),
|
||||||
shouldHideEditor() {
|
shouldHideEditor() {
|
||||||
return this.file && this.file.binary && !this.file.raw;
|
return this.file && this.file.binary && !this.file.raw;
|
||||||
|
@ -71,9 +66,7 @@ export default {
|
||||||
|
|
||||||
this.getRawFileData({
|
this.getRawFileData({
|
||||||
path: this.file.path,
|
path: this.file.path,
|
||||||
baseSha: this.currentMergeRequest
|
baseSha: this.currentMergeRequest ? this.currentMergeRequest.baseCommitSha : '',
|
||||||
? this.currentMergeRequest.baseCommitSha
|
|
||||||
: '',
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const viewerPromise = this.delayViewerUpdated
|
const viewerPromise = this.delayViewerUpdated
|
||||||
|
@ -87,14 +80,7 @@ export default {
|
||||||
this.createEditorInstance();
|
this.createEditorInstance();
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
flash(
|
flash('Error setting up monaco. Please try again.', 'alert', document, null, false, true);
|
||||||
'Error setting up monaco. Please try again.',
|
|
||||||
'alert',
|
|
||||||
document,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,10 +56,7 @@ export default {
|
||||||
...mapActions(['toggleTreeOpen', 'updateDelayViewerUpdated']),
|
...mapActions(['toggleTreeOpen', 'updateDelayViewerUpdated']),
|
||||||
clickFile() {
|
clickFile() {
|
||||||
// Manual Action if a tree is selected/opened
|
// Manual Action if a tree is selected/opened
|
||||||
if (
|
if (this.isTree && this.$router.currentRoute.path === `/project${this.file.url}`) {
|
||||||
this.isTree &&
|
|
||||||
this.$router.currentRoute.path === `/project${this.file.url}`
|
|
||||||
) {
|
|
||||||
this.toggleTreeOpen(this.file.path);
|
this.toggleTreeOpen(this.file.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@ export default {
|
||||||
updated() {
|
updated() {
|
||||||
if (!this.$refs.tabsScroller) return;
|
if (!this.$refs.tabsScroller) return;
|
||||||
|
|
||||||
this.showShadow =
|
this.showShadow = this.$refs.tabsScroller.scrollWidth > this.$refs.tabsScroller.offsetWidth;
|
||||||
this.$refs.tabsScroller.scrollWidth > this.$refs.tabsScroller.offsetWidth;
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['updateViewer']),
|
...mapActions(['updateViewer']),
|
||||||
|
|
|
@ -38,10 +38,7 @@ export default class Model {
|
||||||
this.dispose = this.dispose.bind(this);
|
this.dispose = this.dispose.bind(this);
|
||||||
|
|
||||||
eventHub.$on(`editor.update.model.dispose.${this.file.path}`, this.dispose);
|
eventHub.$on(`editor.update.model.dispose.${this.file.path}`, this.dispose);
|
||||||
eventHub.$on(
|
eventHub.$on(`editor.update.model.content.${this.file.path}`, this.updateContent);
|
||||||
`editor.update.model.content.${this.file.path}`,
|
|
||||||
this.updateContent,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get url() {
|
get url() {
|
||||||
|
@ -92,13 +89,7 @@ export default class Model {
|
||||||
this.disposable.dispose();
|
this.disposable.dispose();
|
||||||
this.events.clear();
|
this.events.clear();
|
||||||
|
|
||||||
eventHub.$off(
|
eventHub.$off(`editor.update.model.dispose.${this.file.path}`, this.dispose);
|
||||||
`editor.update.model.dispose.${this.file.path}`,
|
eventHub.$off(`editor.update.model.content.${this.file.path}`, this.updateContent);
|
||||||
this.dispose,
|
|
||||||
);
|
|
||||||
eventHub.$off(
|
|
||||||
`editor.update.model.content.${this.file.path}`,
|
|
||||||
this.updateContent,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,10 +121,7 @@ export default class Editor {
|
||||||
}
|
}
|
||||||
|
|
||||||
setupMonacoTheme() {
|
setupMonacoTheme() {
|
||||||
this.monaco.editor.defineTheme(
|
this.monaco.editor.defineTheme(gitlabTheme.themeName, gitlabTheme.monacoTheme);
|
||||||
gitlabTheme.themeName,
|
|
||||||
gitlabTheme.monacoTheme,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.monaco.editor.setTheme('gitlab');
|
this.monaco.editor.setTheme('gitlab');
|
||||||
}
|
}
|
||||||
|
@ -172,8 +169,6 @@ export default class Editor {
|
||||||
onPositionChange(cb) {
|
onPositionChange(cb) {
|
||||||
if (!this.instance.onDidChangeCursorPosition) return;
|
if (!this.instance.onDidChangeCursorPosition) return;
|
||||||
|
|
||||||
this.disposable.add(
|
this.disposable.add(this.instance.onDidChangeCursorPosition(e => cb(this.instance, e)));
|
||||||
this.instance.onDidChangeCursorPosition(e => cb(this.instance, e)),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,9 +49,6 @@ export default {
|
||||||
getProjectMergeRequestVersions(projectId, mergeRequestId) {
|
getProjectMergeRequestVersions(projectId, mergeRequestId) {
|
||||||
return Api.mergeRequestVersions(projectId, mergeRequestId);
|
return Api.mergeRequestVersions(projectId, mergeRequestId);
|
||||||
},
|
},
|
||||||
getProjectMergeRequestVersion(projectId, mergeRequestId, versionId) {
|
|
||||||
return Api.mergeRequestVersion(projectId, mergeRequestId, versionId);
|
|
||||||
},
|
|
||||||
getBranchData(projectId, currentBranchId) {
|
getBranchData(projectId, currentBranchId) {
|
||||||
return Api.branchSingle(projectId, currentBranchId);
|
return Api.branchSingle(projectId, currentBranchId);
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,8 +6,7 @@ import FilesDecoratorWorker from './workers/files_decorator_worker';
|
||||||
|
|
||||||
export const redirectToUrl = (_, url) => visitUrl(url);
|
export const redirectToUrl = (_, url) => visitUrl(url);
|
||||||
|
|
||||||
export const setInitialData = ({ commit }, data) =>
|
export const setInitialData = ({ commit }, data) => commit(types.SET_INITIAL_DATA, data);
|
||||||
commit(types.SET_INITIAL_DATA, data);
|
|
||||||
|
|
||||||
export const discardAllChanges = ({ state, commit, dispatch }) => {
|
export const discardAllChanges = ({ state, commit, dispatch }) => {
|
||||||
state.changedFiles.forEach(file => {
|
state.changedFiles.forEach(file => {
|
||||||
|
@ -43,14 +42,11 @@ export const createTempEntry = (
|
||||||
) =>
|
) =>
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
const worker = new FilesDecoratorWorker();
|
const worker = new FilesDecoratorWorker();
|
||||||
const fullName =
|
const fullName = name.slice(-1) !== '/' && type === 'tree' ? `${name}/` : name;
|
||||||
name.slice(-1) !== '/' && type === 'tree' ? `${name}/` : name;
|
|
||||||
|
|
||||||
if (state.entries[name]) {
|
if (state.entries[name]) {
|
||||||
flash(
|
flash(
|
||||||
`The name "${name
|
`The name "${name.split('/').pop()}" is already taken in this directory.`,
|
||||||
.split('/')
|
|
||||||
.pop()}" is already taken in this directory.`,
|
|
||||||
'alert',
|
'alert',
|
||||||
document,
|
document,
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -2,7 +2,6 @@ import flash from '~/flash';
|
||||||
import service from '../../services';
|
import service from '../../services';
|
||||||
import * as types from '../mutation_types';
|
import * as types from '../mutation_types';
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export const getMergeRequestData = (
|
export const getMergeRequestData = (
|
||||||
{ commit, state, dispatch },
|
{ commit, state, dispatch },
|
||||||
{ projectId, mergeRequestId, force = false } = {},
|
{ projectId, mergeRequestId, force = false } = {},
|
||||||
|
@ -32,16 +31,12 @@ export const getMergeRequestData = (
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export const getMergeRequestChanges = (
|
export const getMergeRequestChanges = (
|
||||||
{ commit, state, dispatch },
|
{ commit, state, dispatch },
|
||||||
{ projectId, mergeRequestId, force = false } = {},
|
{ projectId, mergeRequestId, force = false } = {},
|
||||||
) =>
|
) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
if (
|
if (!state.projects[projectId].mergeRequests[mergeRequestId].changes.length || force) {
|
||||||
!state.projects[projectId].mergeRequests[mergeRequestId].changes.length ||
|
|
||||||
force
|
|
||||||
) {
|
|
||||||
service
|
service
|
||||||
.getProjectMergeRequestChanges(projectId, mergeRequestId)
|
.getProjectMergeRequestChanges(projectId, mergeRequestId)
|
||||||
.then(res => res.data)
|
.then(res => res.data)
|
||||||
|
@ -67,11 +62,7 @@ export const getMergeRequestVersions = (
|
||||||
{ projectId, mergeRequestId, force = false } = {},
|
{ projectId, mergeRequestId, force = false } = {},
|
||||||
) =>
|
) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
if (
|
if (!state.projects[projectId].mergeRequests[mergeRequestId].versions.length || force) {
|
||||||
!state.projects[projectId].mergeRequests[mergeRequestId].versions
|
|
||||||
.length ||
|
|
||||||
force
|
|
||||||
) {
|
|
||||||
service
|
service
|
||||||
.getProjectMergeRequestVersions(projectId, mergeRequestId)
|
.getProjectMergeRequestVersions(projectId, mergeRequestId)
|
||||||
.then(res => res.data)
|
.then(res => res.data)
|
||||||
|
@ -91,33 +82,3 @@ export const getMergeRequestVersions = (
|
||||||
resolve(state.projects[projectId].mergeRequests[mergeRequestId].versions);
|
resolve(state.projects[projectId].mergeRequests[mergeRequestId].versions);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export const getMergeRequestNotes = (
|
|
||||||
{ commit, state, dispatch },
|
|
||||||
{ projectId, mergeRequestId, force = false } = {},
|
|
||||||
) =>
|
|
||||||
new Promise((resolve, reject) => {
|
|
||||||
if (
|
|
||||||
!state.projects[projectId].mergeRequests[mergeRequestId].notes ||
|
|
||||||
force
|
|
||||||
) {
|
|
||||||
service
|
|
||||||
.getProjectMergeRequestNotes(projectId, mergeRequestId)
|
|
||||||
.then(res => res.data)
|
|
||||||
.then(data => {
|
|
||||||
commit(types.SET_MERGE_REQUEST_NOTES, {
|
|
||||||
projectPath: projectId,
|
|
||||||
mergeRequestId,
|
|
||||||
notes: data,
|
|
||||||
});
|
|
||||||
resolve(data);
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
flash('Error loading merge request notes. Please try again.');
|
|
||||||
reject(new Error(`Merge Request Notes not loaded ${projectId}`));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
resolve(state.projects[projectId].mergeRequests[mergeRequestId].notes);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -23,17 +23,13 @@ export const handleTreeEntryAction = ({ commit, dispatch }, row) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getLastCommitData = (
|
export const getLastCommitData = ({ state, commit, dispatch, getters }, tree = state) => {
|
||||||
{ state, commit, dispatch, getters },
|
|
||||||
tree = state,
|
|
||||||
) => {
|
|
||||||
if (!tree || tree.lastCommitPath === null || !tree.lastCommitPath) return;
|
if (!tree || tree.lastCommitPath === null || !tree.lastCommitPath) return;
|
||||||
|
|
||||||
service
|
service
|
||||||
.getTreeLastCommit(tree.lastCommitPath)
|
.getTreeLastCommit(tree.lastCommitPath)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const lastCommitPath =
|
const lastCommitPath = normalizeHeaders(res.headers)['MORE-LOGS-URL'] || null;
|
||||||
normalizeHeaders(res.headers)['MORE-LOGS-URL'] || null;
|
|
||||||
|
|
||||||
commit(types.SET_LAST_COMMIT_URL, { tree, url: lastCommitPath });
|
commit(types.SET_LAST_COMMIT_URL, { tree, url: lastCommitPath });
|
||||||
|
|
||||||
|
@ -41,11 +37,7 @@ export const getLastCommitData = (
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
data.forEach(lastCommit => {
|
data.forEach(lastCommit => {
|
||||||
const entry = findEntry(
|
const entry = findEntry(tree.tree, lastCommit.type, lastCommit.file_name);
|
||||||
tree.tree,
|
|
||||||
lastCommit.type,
|
|
||||||
lastCommit.file_name,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
commit(types.SET_LAST_COMMIT_DATA, { entry, lastCommit });
|
commit(types.SET_LAST_COMMIT_DATA, { entry, lastCommit });
|
||||||
|
@ -54,15 +46,10 @@ export const getLastCommitData = (
|
||||||
|
|
||||||
dispatch('getLastCommitData', tree);
|
dispatch('getLastCommitData', tree);
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch(() => flash('Error fetching log data.', 'alert', document, null, false, true));
|
||||||
flash('Error fetching log data.', 'alert', document, null, false, true),
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getFiles = (
|
export const getFiles = ({ state, commit, dispatch }, { projectId, branchId } = {}) =>
|
||||||
{ state, commit, dispatch },
|
|
||||||
{ projectId, branchId } = {},
|
|
||||||
) =>
|
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
if (!state.trees[`${projectId}/${branchId}`]) {
|
if (!state.trees[`${projectId}/${branchId}`]) {
|
||||||
const selectedProject = state.projects[projectId];
|
const selectedProject = state.projects[projectId];
|
||||||
|
@ -99,14 +86,7 @@ export const getFiles = (
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
flash(
|
flash('Error loading tree data. Please try again.', 'alert', document, null, false, true);
|
||||||
'Error loading tree data. Please try again.',
|
|
||||||
'alert',
|
|
||||||
document,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
reject(e);
|
reject(e);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,8 +16,6 @@ export const SET_MERGE_REQUEST = 'SET_MERGE_REQUEST';
|
||||||
export const SET_CURRENT_MERGE_REQUEST = 'SET_CURRENT_MERGE_REQUEST';
|
export const SET_CURRENT_MERGE_REQUEST = 'SET_CURRENT_MERGE_REQUEST';
|
||||||
export const SET_MERGE_REQUEST_CHANGES = 'SET_MERGE_REQUEST_CHANGES';
|
export const SET_MERGE_REQUEST_CHANGES = 'SET_MERGE_REQUEST_CHANGES';
|
||||||
export const SET_MERGE_REQUEST_VERSIONS = 'SET_MERGE_REQUEST_VERSIONS';
|
export const SET_MERGE_REQUEST_VERSIONS = 'SET_MERGE_REQUEST_VERSIONS';
|
||||||
export const SET_MERGE_REQUEST_VERSION = 'SET_MERGE_REQUEST_VERSION';
|
|
||||||
export const SET_MERGE_REQUEST_NOTES = 'SET_MERGE_REQUEST_NOTES';
|
|
||||||
|
|
||||||
// Branch Mutation Types
|
// Branch Mutation Types
|
||||||
export const SET_BRANCH = 'SET_BRANCH';
|
export const SET_BRANCH = 'SET_BRANCH';
|
||||||
|
@ -49,6 +47,5 @@ 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_CHANGE = 'SET_FILE_MR_CHANGE';
|
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_VIEWER = 'UPDATE_VIEWER';
|
||||||
export const UPDATE_DELAY_VIEWER_CHANGE = 'UPDATE_DELAY_VIEWER_CHANGE';
|
export const UPDATE_DELAY_VIEWER_CHANGE = 'UPDATE_DELAY_VIEWER_CHANGE';
|
||||||
|
|
|
@ -12,10 +12,7 @@ export default {
|
||||||
[types.TOGGLE_LOADING](state, { entry, forceValue = undefined }) {
|
[types.TOGGLE_LOADING](state, { entry, forceValue = undefined }) {
|
||||||
if (entry.path) {
|
if (entry.path) {
|
||||||
Object.assign(state.entries[entry.path], {
|
Object.assign(state.entries[entry.path], {
|
||||||
loading:
|
loading: forceValue !== undefined ? forceValue : !state.entries[entry.path].loading,
|
||||||
forceValue !== undefined
|
|
||||||
? forceValue
|
|
||||||
: !state.entries[entry.path].loading,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Object.assign(entry, {
|
Object.assign(entry, {
|
||||||
|
@ -84,9 +81,7 @@ export default {
|
||||||
|
|
||||||
if (!foundEntry) {
|
if (!foundEntry) {
|
||||||
Object.assign(state.trees[`${projectId}/${branchId}`], {
|
Object.assign(state.trees[`${projectId}/${branchId}`], {
|
||||||
tree: state.trees[`${projectId}/${branchId}`].tree.concat(
|
tree: state.trees[`${projectId}/${branchId}`].tree.concat(data.treeList),
|
||||||
data.treeList,
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,10 +6,7 @@ export default {
|
||||||
currentMergeRequestId,
|
currentMergeRequestId,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[types.SET_MERGE_REQUEST](
|
[types.SET_MERGE_REQUEST](state, { projectPath, mergeRequestId, mergeRequest }) {
|
||||||
state,
|
|
||||||
{ projectPath, mergeRequestId, mergeRequest },
|
|
||||||
) {
|
|
||||||
// Add client side properties
|
// Add client side properties
|
||||||
Object.assign(mergeRequest, {
|
Object.assign(mergeRequest, {
|
||||||
active: true,
|
active: true,
|
||||||
|
@ -24,37 +21,15 @@ export default {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[types.SET_MERGE_REQUEST_CHANGES](
|
[types.SET_MERGE_REQUEST_CHANGES](state, { projectPath, mergeRequestId, changes }) {
|
||||||
state,
|
|
||||||
{ projectPath, mergeRequestId, changes },
|
|
||||||
) {
|
|
||||||
Object.assign(state.projects[projectPath].mergeRequests[mergeRequestId], {
|
Object.assign(state.projects[projectPath].mergeRequests[mergeRequestId], {
|
||||||
changes,
|
changes,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[types.SET_MERGE_REQUEST_VERSIONS](
|
[types.SET_MERGE_REQUEST_VERSIONS](state, { projectPath, mergeRequestId, versions }) {
|
||||||
state,
|
|
||||||
{ projectPath, mergeRequestId, versions },
|
|
||||||
) {
|
|
||||||
Object.assign(state.projects[projectPath].mergeRequests[mergeRequestId], {
|
Object.assign(state.projects[projectPath].mergeRequests[mergeRequestId], {
|
||||||
versions,
|
versions,
|
||||||
baseCommitSha: versions.length ? versions[0].base_commit_sha : null,
|
baseCommitSha: versions.length ? versions[0].base_commit_sha : null,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[types.SET_MERGE_REQUEST_VERSION](
|
|
||||||
state,
|
|
||||||
{ projectPath, mergeRequestId, changes },
|
|
||||||
) {
|
|
||||||
Object.assign(state.projects[projectPath].mergeRequests[mergeRequestId], {
|
|
||||||
changes,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
[types.SET_MERGE_REQUEST_NOTES](
|
|
||||||
state,
|
|
||||||
{ projectPath, mergeRequestId, notes },
|
|
||||||
) {
|
|
||||||
Object.assign(state.projects[projectPath].mergeRequests[mergeRequestId], {
|
|
||||||
notes,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,11 +24,7 @@ export default {
|
||||||
return this.mr.divergedCommitsCount > 0;
|
return this.mr.divergedCommitsCount > 0;
|
||||||
},
|
},
|
||||||
commitsText() {
|
commitsText() {
|
||||||
return n__(
|
return n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount);
|
||||||
'%d commit behind',
|
|
||||||
'%d commits behind',
|
|
||||||
this.mr.divergedCommitsCount,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
branchNameClipboardData() {
|
branchNameClipboardData() {
|
||||||
// This supports code in app/assets/javascripts/copy_to_clipboard.js that
|
// This supports code in app/assets/javascripts/copy_to_clipboard.js that
|
||||||
|
@ -45,11 +41,6 @@ export default {
|
||||||
isTargetBranchLong() {
|
isTargetBranchLong() {
|
||||||
return this.isBranchTitleLong(this.mr.targetBranch);
|
return this.isBranchTitleLong(this.mr.targetBranch);
|
||||||
},
|
},
|
||||||
webIdePath() {
|
|
||||||
return `${
|
|
||||||
gon.relative_url_root
|
|
||||||
}/-/ide/project${this.mr.statusPath.replace('.json', '')}`;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isBranchTitleLong(branchTitle) {
|
isBranchTitleLong(branchTitle) {
|
||||||
|
@ -105,14 +96,6 @@ export default {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="mr.isOpen">
|
<div v-if="mr.isOpen">
|
||||||
<a
|
|
||||||
:disabled="mr.sourceBranchRemoved"
|
|
||||||
:href="webIdePath"
|
|
||||||
class="btn btn-sm btn-default inline js-web-ide"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
{{ s__("mrWidget|Open in Web IDE") }}
|
|
||||||
</a>
|
|
||||||
<button
|
<button
|
||||||
data-target="#modal_merge_info"
|
data-target="#modal_merge_info"
|
||||||
data-toggle="modal"
|
data-toggle="modal"
|
||||||
|
|
Loading…
Reference in a new issue