diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2018-03-25 20:16:20 +0200 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-03-28 12:17:02 +0200 |
commit | 0ea359d2cfd97f4271f812ba9f216bcf4ae42c20 (patch) | |
tree | 925dfc558b4e17fcc6af3dd68aec5a69612aab5b /app/assets | |
parent | f00a971a6da0407d7df2f4d8d2905a711a437b4d (diff) | |
download | gitlab-ce-0ea359d2cfd97f4271f812ba9f216bcf4ae42c20.tar.gz |
Fixes to Formatting to all Files
Diffstat (limited to 'app/assets')
14 files changed, 32 insertions, 202 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 1515263ea4d..8ad3d18b302 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -11,12 +11,8 @@ const Api = { projectPath: '/api/:version/projects/:id', projectLabelsPath: '/:namespace_path/:project_path/labels', mergeRequestPath: '/api/:version/projects/:id/merge_requests/:mrid', - mergeRequestChangesPath: - '/api/:version/projects/:id/merge_requests/:mrid/changes', - mergeRequestVersionsPath: - '/api/:version/projects/:id/merge_requests/:mrid/versions', - mergeRequestVersionPath: - '/api/:version/projects/:id/merge_requests/:mrid/version/:versionid', + mergeRequestChangesPath: '/api/:version/projects/:id/merge_requests/:mrid/changes', + mergeRequestVersionsPath: '/api/:version/projects/:id/merge_requests/:mrid/versions', groupLabelsPath: '/groups/:namespace_path/-/labels', licensePath: '/api/:version/templates/licenses/:key', gitignorePath: '/api/:version/templates/gitignores/:key', @@ -96,10 +92,7 @@ const Api = { // Return single project project(projectPath) { - const url = Api.buildUrl(Api.projectPath).replace( - ':id', - encodeURIComponent(projectPath), - ); + const url = Api.buildUrl(Api.projectPath).replace(':id', encodeURIComponent(projectPath)); return axios.get(url); }, @@ -129,15 +122,6 @@ const Api = { 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) { let url; @@ -146,10 +130,7 @@ const Api = { .replace(':namespace_path', namespacePath) .replace(':project_path', projectPath); } else { - url = Api.buildUrl(Api.groupLabelsPath).replace( - ':namespace_path', - namespacePath, - ); + url = Api.buildUrl(Api.groupLabelsPath).replace(':namespace_path', namespacePath); } return axios @@ -175,10 +156,7 @@ const Api = { commitMultiple(id, data) { // see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions - const url = Api.buildUrl(Api.commitPath).replace( - ':id', - encodeURIComponent(id), - ); + const url = Api.buildUrl(Api.commitPath).replace(':id', encodeURIComponent(id)); return axios.post(url, JSON.stringify(data), { headers: { 'Content-Type': 'application/json; charset=utf-8', diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue index 002a88b15e5..b6f8f8a1c99 100644 --- a/app/assets/javascripts/ide/components/repo_editor.vue +++ b/app/assets/javascripts/ide/components/repo_editor.vue @@ -13,12 +13,7 @@ export default { }, }, computed: { - ...mapState([ - 'leftPanelCollapsed', - 'rightPanelCollapsed', - 'viewer', - 'delayViewerUpdated', - ]), + ...mapState(['leftPanelCollapsed', 'rightPanelCollapsed', 'viewer', 'delayViewerUpdated']), ...mapGetters(['currentMergeRequest']), shouldHideEditor() { return this.file && this.file.binary && !this.file.raw; @@ -71,9 +66,7 @@ export default { this.getRawFileData({ path: this.file.path, - baseSha: this.currentMergeRequest - ? this.currentMergeRequest.baseCommitSha - : '', + baseSha: this.currentMergeRequest ? this.currentMergeRequest.baseCommitSha : '', }) .then(() => { const viewerPromise = this.delayViewerUpdated @@ -87,14 +80,7 @@ export default { this.createEditorInstance(); }) .catch(err => { - flash( - 'Error setting up monaco. Please try again.', - 'alert', - document, - null, - false, - true, - ); + flash('Error setting up monaco. Please try again.', 'alert', document, null, false, true); throw err; }); }, diff --git a/app/assets/javascripts/ide/components/repo_file.vue b/app/assets/javascripts/ide/components/repo_file.vue index 00e600a1a7f..88a248d5eeb 100644 --- a/app/assets/javascripts/ide/components/repo_file.vue +++ b/app/assets/javascripts/ide/components/repo_file.vue @@ -56,10 +56,7 @@ export default { ...mapActions(['toggleTreeOpen', 'updateDelayViewerUpdated']), clickFile() { // Manual Action if a tree is selected/opened - if ( - this.isTree && - this.$router.currentRoute.path === `/project${this.file.url}` - ) { + if (this.isTree && this.$router.currentRoute.path === `/project${this.file.url}`) { this.toggleTreeOpen(this.file.path); } diff --git a/app/assets/javascripts/ide/components/repo_tabs.vue b/app/assets/javascripts/ide/components/repo_tabs.vue index 37e90d3ba7e..c6973134ba2 100644 --- a/app/assets/javascripts/ide/components/repo_tabs.vue +++ b/app/assets/javascripts/ide/components/repo_tabs.vue @@ -35,8 +35,7 @@ export default { updated() { if (!this.$refs.tabsScroller) return; - this.showShadow = - this.$refs.tabsScroller.scrollWidth > this.$refs.tabsScroller.offsetWidth; + this.showShadow = this.$refs.tabsScroller.scrollWidth > this.$refs.tabsScroller.offsetWidth; }, methods: { ...mapActions(['updateViewer']), diff --git a/app/assets/javascripts/ide/lib/common/model.js b/app/assets/javascripts/ide/lib/common/model.js index 0dd4e009b1d..d7bc3737526 100644 --- a/app/assets/javascripts/ide/lib/common/model.js +++ b/app/assets/javascripts/ide/lib/common/model.js @@ -38,10 +38,7 @@ export default class Model { this.dispose = this.dispose.bind(this); eventHub.$on(`editor.update.model.dispose.${this.file.path}`, this.dispose); - eventHub.$on( - `editor.update.model.content.${this.file.path}`, - this.updateContent, - ); + eventHub.$on(`editor.update.model.content.${this.file.path}`, this.updateContent); } get url() { @@ -92,13 +89,7 @@ export default class Model { this.disposable.dispose(); this.events.clear(); - eventHub.$off( - `editor.update.model.dispose.${this.file.path}`, - this.dispose, - ); - eventHub.$off( - `editor.update.model.content.${this.file.path}`, - this.updateContent, - ); + eventHub.$off(`editor.update.model.dispose.${this.file.path}`, this.dispose); + eventHub.$off(`editor.update.model.content.${this.file.path}`, this.updateContent); } } diff --git a/app/assets/javascripts/ide/lib/editor.js b/app/assets/javascripts/ide/lib/editor.js index fd0c5bafaef..6b4ba30e086 100644 --- a/app/assets/javascripts/ide/lib/editor.js +++ b/app/assets/javascripts/ide/lib/editor.js @@ -121,10 +121,7 @@ export default class Editor { } setupMonacoTheme() { - this.monaco.editor.defineTheme( - gitlabTheme.themeName, - gitlabTheme.monacoTheme, - ); + this.monaco.editor.defineTheme(gitlabTheme.themeName, gitlabTheme.monacoTheme); this.monaco.editor.setTheme('gitlab'); } @@ -172,8 +169,6 @@ export default class Editor { onPositionChange(cb) { if (!this.instance.onDidChangeCursorPosition) return; - this.disposable.add( - this.instance.onDidChangeCursorPosition(e => cb(this.instance, e)), - ); + this.disposable.add(this.instance.onDidChangeCursorPosition(e => cb(this.instance, e))); } } diff --git a/app/assets/javascripts/ide/services/index.js b/app/assets/javascripts/ide/services/index.js index 6e6ebf3169f..4cfabf7b936 100644 --- a/app/assets/javascripts/ide/services/index.js +++ b/app/assets/javascripts/ide/services/index.js @@ -49,9 +49,6 @@ export default { getProjectMergeRequestVersions(projectId, mergeRequestId) { return Api.mergeRequestVersions(projectId, mergeRequestId); }, - getProjectMergeRequestVersion(projectId, mergeRequestId, versionId) { - return Api.mergeRequestVersion(projectId, mergeRequestId, versionId); - }, getBranchData(projectId, currentBranchId) { return Api.branchSingle(projectId, currentBranchId); }, diff --git a/app/assets/javascripts/ide/stores/actions.js b/app/assets/javascripts/ide/stores/actions.js index 83e200f3cc0..0a74f4f8925 100644 --- a/app/assets/javascripts/ide/stores/actions.js +++ b/app/assets/javascripts/ide/stores/actions.js @@ -6,8 +6,7 @@ import FilesDecoratorWorker from './workers/files_decorator_worker'; export const redirectToUrl = (_, url) => visitUrl(url); -export const setInitialData = ({ commit }, data) => - commit(types.SET_INITIAL_DATA, data); +export const setInitialData = ({ commit }, data) => commit(types.SET_INITIAL_DATA, data); export const discardAllChanges = ({ state, commit, dispatch }) => { state.changedFiles.forEach(file => { @@ -43,14 +42,11 @@ export const createTempEntry = ( ) => new Promise(resolve => { const worker = new FilesDecoratorWorker(); - const fullName = - name.slice(-1) !== '/' && type === 'tree' ? `${name}/` : name; + const fullName = name.slice(-1) !== '/' && type === 'tree' ? `${name}/` : name; if (state.entries[name]) { flash( - `The name "${name - .split('/') - .pop()}" is already taken in this directory.`, + `The name "${name.split('/').pop()}" is already taken in this directory.`, 'alert', document, null, diff --git a/app/assets/javascripts/ide/stores/actions/merge_request.js b/app/assets/javascripts/ide/stores/actions/merge_request.js index 5afd8e3b18a..da73034fd7d 100644 --- a/app/assets/javascripts/ide/stores/actions/merge_request.js +++ b/app/assets/javascripts/ide/stores/actions/merge_request.js @@ -2,7 +2,6 @@ import flash from '~/flash'; import service from '../../services'; import * as types from '../mutation_types'; -// eslint-disable-next-line import/prefer-default-export export const getMergeRequestData = ( { commit, state, dispatch }, { projectId, mergeRequestId, force = false } = {}, @@ -32,16 +31,12 @@ export const getMergeRequestData = ( } }); -// eslint-disable-next-line import/prefer-default-export export const getMergeRequestChanges = ( { commit, state, dispatch }, { projectId, mergeRequestId, force = false } = {}, ) => new Promise((resolve, reject) => { - if ( - !state.projects[projectId].mergeRequests[mergeRequestId].changes.length || - force - ) { + if (!state.projects[projectId].mergeRequests[mergeRequestId].changes.length || force) { service .getProjectMergeRequestChanges(projectId, mergeRequestId) .then(res => res.data) @@ -67,11 +62,7 @@ export const getMergeRequestVersions = ( { projectId, mergeRequestId, force = false } = {}, ) => new Promise((resolve, reject) => { - if ( - !state.projects[projectId].mergeRequests[mergeRequestId].versions - .length || - force - ) { + if (!state.projects[projectId].mergeRequests[mergeRequestId].versions.length || force) { service .getProjectMergeRequestVersions(projectId, mergeRequestId) .then(res => res.data) @@ -91,33 +82,3 @@ export const getMergeRequestVersions = ( 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); - } - }); diff --git a/app/assets/javascripts/ide/stores/actions/tree.js b/app/assets/javascripts/ide/stores/actions/tree.js index 97d02cfb8f7..6536be04f0a 100644 --- a/app/assets/javascripts/ide/stores/actions/tree.js +++ b/app/assets/javascripts/ide/stores/actions/tree.js @@ -23,17 +23,13 @@ export const handleTreeEntryAction = ({ commit, dispatch }, row) => { } }; -export const getLastCommitData = ( - { state, commit, dispatch, getters }, - tree = state, -) => { +export const getLastCommitData = ({ state, commit, dispatch, getters }, tree = state) => { if (!tree || tree.lastCommitPath === null || !tree.lastCommitPath) return; service .getTreeLastCommit(tree.lastCommitPath) .then(res => { - const lastCommitPath = - normalizeHeaders(res.headers)['MORE-LOGS-URL'] || null; + const lastCommitPath = normalizeHeaders(res.headers)['MORE-LOGS-URL'] || null; commit(types.SET_LAST_COMMIT_URL, { tree, url: lastCommitPath }); @@ -41,11 +37,7 @@ export const getLastCommitData = ( }) .then(data => { data.forEach(lastCommit => { - const entry = findEntry( - tree.tree, - lastCommit.type, - lastCommit.file_name, - ); + const entry = findEntry(tree.tree, lastCommit.type, lastCommit.file_name); if (entry) { commit(types.SET_LAST_COMMIT_DATA, { entry, lastCommit }); @@ -54,15 +46,10 @@ export const getLastCommitData = ( dispatch('getLastCommitData', tree); }) - .catch(() => - flash('Error fetching log data.', 'alert', document, null, false, true), - ); + .catch(() => flash('Error fetching log data.', 'alert', document, null, false, true)); }; -export const getFiles = ( - { state, commit, dispatch }, - { projectId, branchId } = {}, -) => +export const getFiles = ({ state, commit, dispatch }, { projectId, branchId } = {}) => new Promise((resolve, reject) => { if (!state.trees[`${projectId}/${branchId}`]) { const selectedProject = state.projects[projectId]; @@ -99,14 +86,7 @@ export const getFiles = ( }); }) .catch(e => { - flash( - 'Error loading tree data. Please try again.', - 'alert', - document, - null, - false, - true, - ); + flash('Error loading tree data. Please try again.', 'alert', document, null, false, true); reject(e); }); } else { diff --git a/app/assets/javascripts/ide/stores/mutation_types.js b/app/assets/javascripts/ide/stores/mutation_types.js index 418cebcf2b2..1c5156aac53 100644 --- a/app/assets/javascripts/ide/stores/mutation_types.js +++ b/app/assets/javascripts/ide/stores/mutation_types.js @@ -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_MERGE_REQUEST_CHANGES = 'SET_MERGE_REQUEST_CHANGES'; 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 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 CREATE_TMP_ENTRY = 'CREATE_TMP_ENTRY'; 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'; diff --git a/app/assets/javascripts/ide/stores/mutations.js b/app/assets/javascripts/ide/stores/mutations.js index a3b9d0dac8c..5e5eb831662 100644 --- a/app/assets/javascripts/ide/stores/mutations.js +++ b/app/assets/javascripts/ide/stores/mutations.js @@ -12,10 +12,7 @@ export default { [types.TOGGLE_LOADING](state, { entry, forceValue = undefined }) { if (entry.path) { Object.assign(state.entries[entry.path], { - loading: - forceValue !== undefined - ? forceValue - : !state.entries[entry.path].loading, + loading: forceValue !== undefined ? forceValue : !state.entries[entry.path].loading, }); } else { Object.assign(entry, { @@ -84,9 +81,7 @@ export default { if (!foundEntry) { Object.assign(state.trees[`${projectId}/${branchId}`], { - tree: state.trees[`${projectId}/${branchId}`].tree.concat( - data.treeList, - ), + tree: state.trees[`${projectId}/${branchId}`].tree.concat(data.treeList), }); } }, diff --git a/app/assets/javascripts/ide/stores/mutations/merge_request.js b/app/assets/javascripts/ide/stores/mutations/merge_request.js index 921b2fa8cf7..6ccb74136d9 100644 --- a/app/assets/javascripts/ide/stores/mutations/merge_request.js +++ b/app/assets/javascripts/ide/stores/mutations/merge_request.js @@ -6,10 +6,7 @@ export default { currentMergeRequestId, }); }, - [types.SET_MERGE_REQUEST]( - state, - { projectPath, mergeRequestId, mergeRequest }, - ) { + [types.SET_MERGE_REQUEST](state, { projectPath, mergeRequestId, mergeRequest }) { // Add client side properties Object.assign(mergeRequest, { active: true, @@ -24,37 +21,15 @@ export default { }, }); }, - [types.SET_MERGE_REQUEST_CHANGES]( - state, - { projectPath, mergeRequestId, changes }, - ) { + [types.SET_MERGE_REQUEST_CHANGES](state, { projectPath, mergeRequestId, changes }) { Object.assign(state.projects[projectPath].mergeRequests[mergeRequestId], { changes, }); }, - [types.SET_MERGE_REQUEST_VERSIONS]( - state, - { projectPath, mergeRequestId, versions }, - ) { + [types.SET_MERGE_REQUEST_VERSIONS](state, { projectPath, mergeRequestId, versions }) { Object.assign(state.projects[projectPath].mergeRequests[mergeRequestId], { versions, 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, - }); - }, }; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue index d3d5ef76d2e..bbe7f511cbe 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue @@ -24,11 +24,7 @@ export default { return this.mr.divergedCommitsCount > 0; }, commitsText() { - return n__( - '%d commit behind', - '%d commits behind', - this.mr.divergedCommitsCount, - ); + return n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount); }, branchNameClipboardData() { // This supports code in app/assets/javascripts/copy_to_clipboard.js that @@ -45,11 +41,6 @@ export default { isTargetBranchLong() { return this.isBranchTitleLong(this.mr.targetBranch); }, - webIdePath() { - return `${ - gon.relative_url_root - }/-/ide/project${this.mr.statusPath.replace('.json', '')}`; - }, }, methods: { isBranchTitleLong(branchTitle) { @@ -105,14 +96,6 @@ export default { </div> <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 data-target="#modal_merge_info" data-toggle="modal" |