diff options
Diffstat (limited to 'app/assets/javascripts/ide/stores')
33 files changed, 164 insertions, 146 deletions
diff --git a/app/assets/javascripts/ide/stores/actions.js b/app/assets/javascripts/ide/stores/actions.js index d62dfc35d15..bf94f9d31c8 100644 --- a/app/assets/javascripts/ide/stores/actions.js +++ b/app/assets/javascripts/ide/stores/actions.js @@ -1,19 +1,19 @@ -import Vue from 'vue'; import { escape } from 'lodash'; -import { __, sprintf } from '~/locale'; -import { visitUrl } from '~/lib/utils/url_utility'; +import Vue from 'vue'; import { deprecatedCreateFlash as flash } from '~/flash'; -import { performanceMarkAndMeasure } from '~/performance/utils'; +import { visitUrl } from '~/lib/utils/url_utility'; +import { __, sprintf } from '~/locale'; import { WEBIDE_MARK_FETCH_BRANCH_DATA_START, WEBIDE_MARK_FETCH_BRANCH_DATA_FINISH, WEBIDE_MEASURE_FETCH_BRANCH_DATA, } from '~/performance/constants'; -import * as types from './mutation_types'; -import { decorateFiles } from '../lib/files'; +import { performanceMarkAndMeasure } from '~/performance/utils'; import { stageKeys, commitActionTypes } from '../constants'; -import service from '../services'; import eventHub from '../eventhub'; +import { decorateFiles } from '../lib/files'; +import service from '../services'; +import * as types from './mutation_types'; export const redirectToUrl = (self, url) => visitUrl(url); diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js index 42668dec63a..d1e40920ebc 100644 --- a/app/assets/javascripts/ide/stores/actions/file.js +++ b/app/assets/javascripts/ide/stores/actions/file.js @@ -1,16 +1,16 @@ import { joinPaths, escapeFileUrl } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; -import { performanceMarkAndMeasure } from '~/performance/utils'; import { WEBIDE_MARK_FETCH_FILE_DATA_START, WEBIDE_MARK_FETCH_FILE_DATA_FINISH, WEBIDE_MEASURE_FETCH_FILE_DATA, } from '~/performance/constants'; +import { performanceMarkAndMeasure } from '~/performance/utils'; +import { viewerTypes, stageKeys, commitActionTypes } from '../../constants'; import eventHub from '../../eventhub'; import service from '../../services'; import * as types from '../mutation_types'; import { setPageTitleForFile } from '../utils'; -import { viewerTypes, stageKeys, commitActionTypes } from '../../constants'; export const closeFile = ({ commit, state, dispatch, getters }, file) => { const { path } = file; @@ -120,10 +120,6 @@ export const getFileData = ( }); }; -export const setFileMrChange = ({ commit }, { file, mrChange }) => { - commit(types.SET_FILE_MERGE_REQUEST_CHANGE, { file, mrChange }); -}; - export const getRawFileData = ({ state, commit, dispatch, getters }, { path }) => { const file = state.entries[path]; const stagedFile = state.stagedFiles.find((f) => f.path === path); diff --git a/app/assets/javascripts/ide/stores/actions/merge_request.js b/app/assets/javascripts/ide/stores/actions/merge_request.js index 8215cba7ccf..753f6b9cd47 100644 --- a/app/assets/javascripts/ide/stores/actions/merge_request.js +++ b/app/assets/javascripts/ide/stores/actions/merge_request.js @@ -1,8 +1,8 @@ import { deprecatedCreateFlash as flash } from '~/flash'; import { __ } from '~/locale'; +import { leftSidebarViews, PERMISSION_READ_MR, MAX_MR_FILES_AUTO_OPEN } from '../../constants'; import service from '../../services'; import * as types from '../mutation_types'; -import { leftSidebarViews, PERMISSION_READ_MR } from '../../constants'; export const getMergeRequestsForBranch = ( { commit, state, getters }, @@ -147,70 +147,96 @@ export const getMergeRequestVersions = ( } }); -export const openMergeRequest = ( - { dispatch, state, getters }, - { projectId, targetProjectId, mergeRequestId } = {}, -) => - dispatch('getMergeRequestData', { - projectId, - targetProjectId, - mergeRequestId, - }) - .then((mr) => { - dispatch('setCurrentBranchId', mr.source_branch); - - return dispatch('getBranchData', { - projectId, - branchId: mr.source_branch, - }).then(() => { - const branch = getters.findBranch(projectId, mr.source_branch); - - return dispatch('getFiles', { - projectId, - branchId: mr.source_branch, - ref: branch.commit.id, +export const openMergeRequestChanges = async ({ dispatch, getters, state, commit }, changes) => { + const entryChanges = changes + .map((change) => ({ entry: state.entries[change.new_path], change })) + .filter((x) => x.entry); + + const pathsToOpen = entryChanges + .slice(0, MAX_MR_FILES_AUTO_OPEN) + .map(({ change }) => change.new_path); + + // If there are no changes with entries, do nothing. + if (!entryChanges.length) { + return; + } + + dispatch('updateActivityBarView', leftSidebarViews.review.name); + + entryChanges.forEach(({ change, entry }) => { + commit(types.SET_FILE_MERGE_REQUEST_CHANGE, { file: entry, mrChange: change }); + }); + + // Open paths in order as they appear in MR changes + pathsToOpen.forEach((path) => { + commit(types.TOGGLE_FILE_OPEN, path); + }); + + // Activate first path. + // We don't `getFileData` here since the editor component kicks that off. Otherwise, we'd fetch twice. + const [firstPath, ...remainingPaths] = pathsToOpen; + await dispatch('router/push', getters.getUrlForPath(firstPath)); + await dispatch('setFileActive', firstPath); + + // Lastly, eagerly fetch the remaining paths for improved user experience. + await Promise.all( + remainingPaths.map(async (path) => { + try { + await dispatch('getFileData', { + path, + makeFileActive: false, }); - }); - }) - .then(() => - dispatch('getMergeRequestVersions', { - projectId, - targetProjectId, - mergeRequestId, - }), - ) - .then(() => - dispatch('getMergeRequestChanges', { - projectId, - targetProjectId, - mergeRequestId, - }), - ) - .then((mrChanges) => { - if (mrChanges.changes.length) { - dispatch('updateActivityBarView', leftSidebarViews.review.name); + await dispatch('getRawFileData', { path }); + } catch (e) { + // If one of the file fetches fails, we dont want to blow up the rest of them. + // eslint-disable-next-line no-console + console.error('[gitlab] An unexpected error occurred fetching MR file data', e); } + }), + ); +}; - mrChanges.changes.forEach((change, ind) => { - const changeTreeEntry = state.entries[change.new_path]; +export const openMergeRequest = async ( + { dispatch, getters }, + { projectId, targetProjectId, mergeRequestId } = {}, +) => { + try { + const mr = await dispatch('getMergeRequestData', { + projectId, + targetProjectId, + mergeRequestId, + }); - if (changeTreeEntry) { - dispatch('setFileMrChange', { - file: changeTreeEntry, - mrChange: change, - }); + dispatch('setCurrentBranchId', mr.source_branch); - if (ind < 10) { - dispatch('getFileData', { - path: change.new_path, - makeFileActive: ind === 0, - openFile: true, - }); - } - } - }); - }) - .catch((e) => { - flash(__('Error while loading the merge request. Please try again.')); - throw e; + await dispatch('getBranchData', { + projectId, + branchId: mr.source_branch, + }); + + const branch = getters.findBranch(projectId, mr.source_branch); + + await dispatch('getFiles', { + projectId, + branchId: mr.source_branch, + ref: branch.commit.id, }); + + await dispatch('getMergeRequestVersions', { + projectId, + targetProjectId, + mergeRequestId, + }); + + const { changes } = await dispatch('getMergeRequestChanges', { + projectId, + targetProjectId, + mergeRequestId, + }); + + await dispatch('openMergeRequestChanges', changes); + } catch (e) { + flash(__('Error while loading the merge request. Please try again.')); + throw e; + } +}; diff --git a/app/assets/javascripts/ide/stores/actions/project.js b/app/assets/javascripts/ide/stores/actions/project.js index 27f6848f1d6..120a577d44a 100644 --- a/app/assets/javascripts/ide/stores/actions/project.js +++ b/app/assets/javascripts/ide/stores/actions/project.js @@ -1,8 +1,8 @@ import { escape } from 'lodash'; import { deprecatedCreateFlash as flash } from '~/flash'; import { __, sprintf } from '~/locale'; -import service from '../../services'; import api from '../../../api'; +import service from '../../services'; import * as types from '../mutation_types'; export const getProjectData = ({ commit, state }, { namespace, projectId, force = false } = {}) => diff --git a/app/assets/javascripts/ide/stores/actions/tree.js b/app/assets/javascripts/ide/stores/actions/tree.js index 150dfcb2726..f46d3cbe946 100644 --- a/app/assets/javascripts/ide/stores/actions/tree.js +++ b/app/assets/javascripts/ide/stores/actions/tree.js @@ -1,14 +1,14 @@ import { defer } from 'lodash'; -import { performanceMarkAndMeasure } from '~/performance/utils'; import { WEBIDE_MARK_FETCH_FILES_FINISH, WEBIDE_MEASURE_FETCH_FILES, WEBIDE_MARK_FETCH_FILES_START, } from '~/performance/constants'; +import { performanceMarkAndMeasure } from '~/performance/utils'; import { __ } from '../../../locale'; +import { decorateFiles } from '../../lib/files'; import service from '../../services'; import * as types from '../mutation_types'; -import { decorateFiles } from '../../lib/files'; export const toggleTreeOpen = ({ commit }, path) => { commit(types.TOGGLE_TREE_OPEN, path); diff --git a/app/assets/javascripts/ide/stores/getters.js b/app/assets/javascripts/ide/stores/getters.js index 59e8d37a92a..9b93fc74f76 100644 --- a/app/assets/javascripts/ide/stores/getters.js +++ b/app/assets/javascripts/ide/stores/getters.js @@ -1,13 +1,14 @@ -import { getChangesCountForFiles, filePathMatches } from './utils'; +import Api from '~/api'; +import { addNumericSuffix } from '~/ide/utils'; import { leftSidebarViews, packageJsonPath, + DEFAULT_PERMISSIONS, PERMISSION_READ_MR, PERMISSION_CREATE_MR, PERMISSION_PUSH_CODE, } from '../constants'; -import { addNumericSuffix } from '~/ide/utils'; -import Api from '~/api'; +import { getChangesCountForFiles, filePathMatches } from './utils'; export const activeFile = (state) => state.openFiles.find((file) => file.active) || null; @@ -150,7 +151,7 @@ export const getDiffInfo = (state, getters) => (path) => { }; export const findProjectPermissions = (state, getters) => (projectId) => - getters.findProject(projectId)?.userPermissions || {}; + getters.findProject(projectId)?.userPermissions || DEFAULT_PERMISSIONS; export const canReadMergeRequests = (state, getters) => Boolean(getters.findProjectPermissions(state.currentProjectId)[PERMISSION_READ_MR]); diff --git a/app/assets/javascripts/ide/stores/index.js b/app/assets/javascripts/ide/stores/index.js index d543209716a..b660ff178a2 100644 --- a/app/assets/javascripts/ide/stores/index.js +++ b/app/assets/javascripts/ide/stores/index.js @@ -1,19 +1,19 @@ import Vue from 'vue'; import Vuex from 'vuex'; -import state from './state'; import * as actions from './actions'; import * as getters from './getters'; -import mutations from './mutations'; -import commitModule from './modules/commit'; -import pipelines from './modules/pipelines'; -import mergeRequests from './modules/merge_requests'; import branches from './modules/branches'; -import fileTemplates from './modules/file_templates'; -import paneModule from './modules/pane'; import clientsideModule from './modules/clientside'; -import routerModule from './modules/router'; +import commitModule from './modules/commit'; import editorModule from './modules/editor'; import { setupFileEditorsSync } from './modules/editor/setup'; +import fileTemplates from './modules/file_templates'; +import mergeRequests from './modules/merge_requests'; +import paneModule from './modules/pane'; +import pipelines from './modules/pipelines'; +import routerModule from './modules/router'; +import mutations from './mutations'; +import state from './state'; Vue.use(Vuex); diff --git a/app/assets/javascripts/ide/stores/modules/branches/actions.js b/app/assets/javascripts/ide/stores/modules/branches/actions.js index 74a4cd9848b..57a63749d7c 100644 --- a/app/assets/javascripts/ide/stores/modules/branches/actions.js +++ b/app/assets/javascripts/ide/stores/modules/branches/actions.js @@ -1,5 +1,5 @@ -import { __ } from '~/locale'; import Api from '~/api'; +import { __ } from '~/locale'; import * as types from './mutation_types'; export const requestBranches = ({ commit }) => commit(types.REQUEST_BRANCHES); diff --git a/app/assets/javascripts/ide/stores/modules/branches/index.js b/app/assets/javascripts/ide/stores/modules/branches/index.js index deda95cd0c9..4b7d6d2998b 100644 --- a/app/assets/javascripts/ide/stores/modules/branches/index.js +++ b/app/assets/javascripts/ide/stores/modules/branches/index.js @@ -1,6 +1,6 @@ -import state from './state'; import * as actions from './actions'; import mutations from './mutations'; +import state from './state'; export default { namespaced: true, diff --git a/app/assets/javascripts/ide/stores/modules/commit/actions.js b/app/assets/javascripts/ide/stores/modules/commit/actions.js index 29b9a8a9521..29555799074 100644 --- a/app/assets/javascripts/ide/stores/modules/commit/actions.js +++ b/app/assets/javascripts/ide/stores/modules/commit/actions.js @@ -1,14 +1,14 @@ -import { sprintf, __ } from '~/locale'; import { deprecatedCreateFlash as flash } from '~/flash'; -import * as rootTypes from '../../mutation_types'; -import { createCommitPayload, createNewMergeRequestUrl } from '../../utils'; -import service from '../../../services'; -import * as types from './mutation_types'; -import consts from './constants'; +import { addNumericSuffix } from '~/ide/utils'; +import { sprintf, __ } from '~/locale'; import { leftSidebarViews } from '../../../constants'; import eventHub from '../../../eventhub'; import { parseCommitError } from '../../../lib/errors'; -import { addNumericSuffix } from '~/ide/utils'; +import service from '../../../services'; +import * as rootTypes from '../../mutation_types'; +import { createCommitPayload, createNewMergeRequestUrl } from '../../utils'; +import { COMMIT_TO_CURRENT_BRANCH } from './constants'; +import * as types from './mutation_types'; export const updateCommitMessage = ({ commit }, message) => { commit(types.UPDATE_COMMIT_MESSAGE, message); @@ -112,7 +112,7 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo // Pull commit options out because they could change // During some of the pre and post commit processing const { shouldCreateMR, shouldHideNewMrOption, isCreatingNewBranch, branchName } = getters; - const newBranch = state.commitAction !== consts.COMMIT_TO_CURRENT_BRANCH; + const newBranch = state.commitAction !== COMMIT_TO_CURRENT_BRANCH; const stageFilesPromise = rootState.stagedFiles.length ? Promise.resolve() : dispatch('stageAllChanges', null, { root: true }); @@ -206,7 +206,7 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo dispatch('updateViewer', 'editor', { root: true }); } }) - .then(() => dispatch('updateCommitAction', consts.COMMIT_TO_CURRENT_BRANCH)) + .then(() => dispatch('updateCommitAction', COMMIT_TO_CURRENT_BRANCH)) .then(() => { if (newBranch) { const path = rootGetters.activeFile ? rootGetters.activeFile.path : ''; diff --git a/app/assets/javascripts/ide/stores/modules/commit/constants.js b/app/assets/javascripts/ide/stores/modules/commit/constants.js index c6c3701effe..9f4299e5537 100644 --- a/app/assets/javascripts/ide/stores/modules/commit/constants.js +++ b/app/assets/javascripts/ide/stores/modules/commit/constants.js @@ -1,7 +1,2 @@ -const COMMIT_TO_CURRENT_BRANCH = '1'; -const COMMIT_TO_NEW_BRANCH = '2'; - -export default { - COMMIT_TO_CURRENT_BRANCH, - COMMIT_TO_NEW_BRANCH, -}; +export const COMMIT_TO_CURRENT_BRANCH = '1'; +export const COMMIT_TO_NEW_BRANCH = '2'; diff --git a/app/assets/javascripts/ide/stores/modules/commit/getters.js b/app/assets/javascripts/ide/stores/modules/commit/getters.js index 2301cf23f9f..f5e367e16f5 100644 --- a/app/assets/javascripts/ide/stores/modules/commit/getters.js +++ b/app/assets/javascripts/ide/stores/modules/commit/getters.js @@ -1,5 +1,5 @@ import { sprintf, n__, __ } from '../../../../locale'; -import consts from './constants'; +import { COMMIT_TO_NEW_BRANCH } from './constants'; const BRANCH_SUFFIX_COUNT = 5; const createTranslatedTextForFiles = (files, text) => { @@ -48,7 +48,7 @@ export const preBuiltCommitMessage = (state, _, rootState) => { .join('\n'); }; -export const isCreatingNewBranch = (state) => state.commitAction === consts.COMMIT_TO_NEW_BRANCH; +export const isCreatingNewBranch = (state) => state.commitAction === COMMIT_TO_NEW_BRANCH; export const shouldHideNewMrOption = (_state, getters, _rootState, rootGetters) => !getters.isCreatingNewBranch && diff --git a/app/assets/javascripts/ide/stores/modules/commit/index.js b/app/assets/javascripts/ide/stores/modules/commit/index.js index 5cec73bde2e..c5a39249348 100644 --- a/app/assets/javascripts/ide/stores/modules/commit/index.js +++ b/app/assets/javascripts/ide/stores/modules/commit/index.js @@ -1,7 +1,7 @@ -import state from './state'; -import mutations from './mutations'; import * as actions from './actions'; import * as getters from './getters'; +import mutations from './mutations'; +import state from './state'; export default { namespaced: true, diff --git a/app/assets/javascripts/ide/stores/modules/editor/index.js b/app/assets/javascripts/ide/stores/modules/editor/index.js index 8a7437b427d..b601f0e79d4 100644 --- a/app/assets/javascripts/ide/stores/modules/editor/index.js +++ b/app/assets/javascripts/ide/stores/modules/editor/index.js @@ -1,7 +1,7 @@ import * as actions from './actions'; import * as getters from './getters'; -import state from './state'; import mutations from './mutations'; +import state from './state'; export default { namespaced: true, diff --git a/app/assets/javascripts/ide/stores/modules/editor/setup.js b/app/assets/javascripts/ide/stores/modules/editor/setup.js index 9f3163aa6f5..5899706e38a 100644 --- a/app/assets/javascripts/ide/stores/modules/editor/setup.js +++ b/app/assets/javascripts/ide/stores/modules/editor/setup.js @@ -1,5 +1,5 @@ -import eventHub from '~/ide/eventhub'; import { commitActionTypes } from '~/ide/constants'; +import eventHub from '~/ide/eventhub'; const removeUnusedFileEditors = (store) => { Object.keys(store.state.editor.fileEditors) diff --git a/app/assets/javascripts/ide/stores/modules/file_templates/actions.js b/app/assets/javascripts/ide/stores/modules/file_templates/actions.js index 6800f824da0..bc96ec267b5 100644 --- a/app/assets/javascripts/ide/stores/modules/file_templates/actions.js +++ b/app/assets/javascripts/ide/stores/modules/file_templates/actions.js @@ -1,8 +1,8 @@ import Api from '~/api'; -import { __ } from '~/locale'; import { normalizeHeaders } from '~/lib/utils/common_utils'; -import * as types from './mutation_types'; +import { __ } from '~/locale'; import eventHub from '../../../eventhub'; +import * as types from './mutation_types'; export const requestTemplateTypes = ({ commit }) => commit(types.REQUEST_TEMPLATE_TYPES); export const receiveTemplateTypesError = ({ commit, dispatch }) => { diff --git a/app/assets/javascripts/ide/stores/modules/file_templates/getters.js b/app/assets/javascripts/ide/stores/modules/file_templates/getters.js index 0613fe9b12b..9708e5e588c 100644 --- a/app/assets/javascripts/ide/stores/modules/file_templates/getters.js +++ b/app/assets/javascripts/ide/stores/modules/file_templates/getters.js @@ -1,5 +1,5 @@ -import { leftSidebarViews } from '../../../constants'; import { __ } from '~/locale'; +import { leftSidebarViews } from '../../../constants'; export const templateTypes = () => [ { diff --git a/app/assets/javascripts/ide/stores/modules/file_templates/index.js b/app/assets/javascripts/ide/stores/modules/file_templates/index.js index 383ff5db392..5f850b8b86a 100644 --- a/app/assets/javascripts/ide/stores/modules/file_templates/index.js +++ b/app/assets/javascripts/ide/stores/modules/file_templates/index.js @@ -1,7 +1,7 @@ -import createState from './state'; import * as actions from './actions'; import * as getters from './getters'; import mutations from './mutations'; +import createState from './state'; export default () => ({ namespaced: true, diff --git a/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js b/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js index 299f7a883d2..8446b93d14a 100644 --- a/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js +++ b/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js @@ -1,5 +1,5 @@ -import { __ } from '../../../../locale'; import Api from '../../../../api'; +import { __ } from '../../../../locale'; import { scopes } from './constants'; import * as types from './mutation_types'; diff --git a/app/assets/javascripts/ide/stores/modules/merge_requests/index.js b/app/assets/javascripts/ide/stores/modules/merge_requests/index.js index 04e7e0f08f1..d858a855d9e 100644 --- a/app/assets/javascripts/ide/stores/modules/merge_requests/index.js +++ b/app/assets/javascripts/ide/stores/modules/merge_requests/index.js @@ -1,6 +1,6 @@ -import state from './state'; import * as actions from './actions'; import mutations from './mutations'; +import state from './state'; export default { namespaced: true, diff --git a/app/assets/javascripts/ide/stores/modules/pipelines/actions.js b/app/assets/javascripts/ide/stores/modules/pipelines/actions.js index 2c2034d76d0..60561292c9d 100644 --- a/app/assets/javascripts/ide/stores/modules/pipelines/actions.js +++ b/app/assets/javascripts/ide/stores/modules/pipelines/actions.js @@ -1,10 +1,10 @@ -import Visibility from 'visibilityjs'; import axios from 'axios'; +import Visibility from 'visibilityjs'; import httpStatus from '../../../../lib/utils/http_status'; -import { __ } from '../../../../locale'; import Poll from '../../../../lib/utils/poll'; -import service from '../../../services'; +import { __ } from '../../../../locale'; import { rightSidebarViews } from '../../../constants'; +import service from '../../../services'; import * as types from './mutation_types'; let eTagPoll; diff --git a/app/assets/javascripts/ide/stores/modules/pipelines/index.js b/app/assets/javascripts/ide/stores/modules/pipelines/index.js index b44c3141b81..b48f63887ca 100644 --- a/app/assets/javascripts/ide/stores/modules/pipelines/index.js +++ b/app/assets/javascripts/ide/stores/modules/pipelines/index.js @@ -1,7 +1,7 @@ -import state from './state'; import * as actions from './actions'; -import mutations from './mutations'; import * as getters from './getters'; +import mutations from './mutations'; +import state from './state'; export default { namespaced: true, diff --git a/app/assets/javascripts/ide/stores/modules/router/index.js b/app/assets/javascripts/ide/stores/modules/router/index.js index 68c81bb4509..1d5af1d4fe5 100644 --- a/app/assets/javascripts/ide/stores/modules/router/index.js +++ b/app/assets/javascripts/ide/stores/modules/router/index.js @@ -1,6 +1,6 @@ -import state from './state'; -import mutations from './mutations'; import * as actions from './actions'; +import mutations from './mutations'; +import state from './state'; export default { namespaced: true, diff --git a/app/assets/javascripts/ide/stores/modules/terminal/actions/checks.js b/app/assets/javascripts/ide/stores/modules/terminal/actions/checks.js index b2c1ddd877c..91645a34a3d 100644 --- a/app/assets/javascripts/ide/stores/modules/terminal/actions/checks.js +++ b/app/assets/javascripts/ide/stores/modules/terminal/actions/checks.js @@ -1,9 +1,9 @@ import Api from '~/api'; import httpStatus from '~/lib/utils/http_status'; -import * as types from '../mutation_types'; -import * as messages from '../messages'; -import { CHECK_CONFIG, CHECK_RUNNERS, RETRY_RUNNERS_INTERVAL } from '../constants'; import * as terminalService from '../../../../services/terminals'; +import { CHECK_CONFIG, CHECK_RUNNERS, RETRY_RUNNERS_INTERVAL } from '../constants'; +import * as messages from '../messages'; +import * as types from '../mutation_types'; export const requestConfigCheck = ({ commit }) => { commit(types.REQUEST_CHECK, CHECK_CONFIG); diff --git a/app/assets/javascripts/ide/stores/modules/terminal/actions/session_controls.js b/app/assets/javascripts/ide/stores/modules/terminal/actions/session_controls.js index aa460859b4c..6c9be6d10c9 100644 --- a/app/assets/javascripts/ide/stores/modules/terminal/actions/session_controls.js +++ b/app/assets/javascripts/ide/stores/modules/terminal/actions/session_controls.js @@ -1,10 +1,10 @@ +import { deprecatedCreateFlash as flash } from '~/flash'; import axios from '~/lib/utils/axios_utils'; import httpStatus from '~/lib/utils/http_status'; -import { deprecatedCreateFlash as flash } from '~/flash'; -import * as types from '../mutation_types'; -import * as messages from '../messages'; import * as terminalService from '../../../../services/terminals'; import { STARTING, STOPPING, STOPPED } from '../constants'; +import * as messages from '../messages'; +import * as types from '../mutation_types'; export const requestStartSession = ({ commit }) => { commit(types.SET_SESSION_STATUS, STARTING); diff --git a/app/assets/javascripts/ide/stores/modules/terminal/actions/session_status.js b/app/assets/javascripts/ide/stores/modules/terminal/actions/session_status.js index 3ab1817e662..da10894c2c6 100644 --- a/app/assets/javascripts/ide/stores/modules/terminal/actions/session_status.js +++ b/app/assets/javascripts/ide/stores/modules/terminal/actions/session_status.js @@ -1,7 +1,7 @@ -import axios from '~/lib/utils/axios_utils'; import { deprecatedCreateFlash as flash } from '~/flash'; -import * as types from '../mutation_types'; +import axios from '~/lib/utils/axios_utils'; import * as messages from '../messages'; +import * as types from '../mutation_types'; import { isEndingStatus } from '../utils'; export const pollSessionStatus = ({ state, dispatch, commit }) => { diff --git a/app/assets/javascripts/ide/stores/modules/terminal/messages.js b/app/assets/javascripts/ide/stores/modules/terminal/messages.js index 967ba80cd2c..ec05ca84754 100644 --- a/app/assets/javascripts/ide/stores/modules/terminal/messages.js +++ b/app/assets/javascripts/ide/stores/modules/terminal/messages.js @@ -1,6 +1,6 @@ import { escape } from 'lodash'; -import { __, sprintf } from '~/locale'; import httpStatus from '~/lib/utils/http_status'; +import { __, sprintf } from '~/locale'; export const UNEXPECTED_ERROR_CONFIG = __( 'An unexpected error occurred while checking the project environment.', diff --git a/app/assets/javascripts/ide/stores/modules/terminal_sync/actions.js b/app/assets/javascripts/ide/stores/modules/terminal_sync/actions.js index 006800f58c2..a2cb0666a99 100644 --- a/app/assets/javascripts/ide/stores/modules/terminal_sync/actions.js +++ b/app/assets/javascripts/ide/stores/modules/terminal_sync/actions.js @@ -1,5 +1,5 @@ -import * as types from './mutation_types'; import mirror, { canConnect } from '../../../lib/mirror'; +import * as types from './mutation_types'; export const upload = ({ rootState, commit }) => { commit(types.START_LOADING); diff --git a/app/assets/javascripts/ide/stores/modules/terminal_sync/index.js b/app/assets/javascripts/ide/stores/modules/terminal_sync/index.js index 795c2fad724..a0685293839 100644 --- a/app/assets/javascripts/ide/stores/modules/terminal_sync/index.js +++ b/app/assets/javascripts/ide/stores/modules/terminal_sync/index.js @@ -1,6 +1,6 @@ -import state from './state'; import * as actions from './actions'; import mutations from './mutations'; +import state from './state'; export default () => ({ namespaced: true, diff --git a/app/assets/javascripts/ide/stores/mutations.js b/app/assets/javascripts/ide/stores/mutations.js index 6ed6798a5b6..576f861a090 100644 --- a/app/assets/javascripts/ide/stores/mutations.js +++ b/app/assets/javascripts/ide/stores/mutations.js @@ -1,10 +1,10 @@ import Vue from 'vue'; import * as types from './mutation_types'; -import projectMutations from './mutations/project'; -import mergeRequestMutation from './mutations/merge_request'; +import branchMutations from './mutations/branch'; import fileMutations from './mutations/file'; +import mergeRequestMutation from './mutations/merge_request'; +import projectMutations from './mutations/project'; import treeMutations from './mutations/tree'; -import branchMutations from './mutations/branch'; import { sortTree, swapInParentTreeWithSorting, diff --git a/app/assets/javascripts/ide/stores/mutations/file.js b/app/assets/javascripts/ide/stores/mutations/file.js index 4446971d5d6..fa9830a7469 100644 --- a/app/assets/javascripts/ide/stores/mutations/file.js +++ b/app/assets/javascripts/ide/stores/mutations/file.js @@ -1,7 +1,7 @@ +import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; +import { diffModes } from '../../constants'; import * as types from '../mutation_types'; import { sortTree } from '../utils'; -import { diffModes } from '../../constants'; -import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; export default { [types.SET_FILE_ACTIVE](state, { path, active }) { diff --git a/app/assets/javascripts/ide/stores/plugins/terminal_sync.js b/app/assets/javascripts/ide/stores/plugins/terminal_sync.js index d925a5f7567..944a034fe97 100644 --- a/app/assets/javascripts/ide/stores/plugins/terminal_sync.js +++ b/app/assets/javascripts/ide/stores/plugins/terminal_sync.js @@ -1,8 +1,8 @@ import { debounce } from 'lodash'; -import eventHub from '~/ide/eventhub'; import { commitActionTypes } from '~/ide/constants'; -import terminalSyncModule from '../modules/terminal_sync'; +import eventHub from '~/ide/eventhub'; import { isEndingStatus, isRunningStatus } from '../modules/terminal/utils'; +import terminalSyncModule from '../modules/terminal_sync'; const UPLOAD_DEBOUNCE = 200; diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index 04eacf271b8..4019703b296 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -1,10 +1,10 @@ -import { commitActionTypes } from '../constants'; import { relativePathToAbsolute, isAbsolute, isRootRelative, isBlobUrl, } from '~/lib/utils/url_utility'; +import { commitActionTypes } from '../constants'; export const dataStructure = () => ({ id: '', |