summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-10-10 01:20:53 -0500
committerMike Greiling <mike@pixelcog.com>2018-10-10 01:57:50 -0500
commit69b7c032ec7445730c02129d66146218833f47aa (patch)
tree188e1623ed150e67d7918ee377c3d325ff30f225 /app
parent550f55745a3be5f86bafaf25b3bcc90beba8e2ac (diff)
downloadgitlab-ce-69b7c032ec7445730c02129d66146218833f47aa.tar.gz
Prettify ide modules
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue14
-rw-r--r--app/assets/javascripts/ide/components/commit_sidebar/stage_button.vue5
-rw-r--r--app/assets/javascripts/ide/components/ide_side_bar.vue8
-rw-r--r--app/assets/javascripts/ide/components/merge_requests/list.vue8
-rw-r--r--app/assets/javascripts/ide/components/nav_dropdown_button.vue4
-rw-r--r--app/assets/javascripts/ide/components/panes/right.vue17
-rw-r--r--app/assets/javascripts/ide/components/repo_editor.vue7
-rw-r--r--app/assets/javascripts/ide/components/shared/tokened_input.vue4
-rw-r--r--app/assets/javascripts/ide/index.js5
-rw-r--r--app/assets/javascripts/ide/lib/diff/diff.js14
-rw-r--r--app/assets/javascripts/ide/lib/diff/diff_worker.js2
-rw-r--r--app/assets/javascripts/ide/stores/actions/merge_request.js94
-rw-r--r--app/assets/javascripts/ide/stores/actions/project.js36
-rw-r--r--app/assets/javascripts/ide/stores/modules/merge_requests/actions.js3
14 files changed, 93 insertions, 128 deletions
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue b/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue
index d376a004e84..699fa7dc937 100644
--- a/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue
+++ b/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue
@@ -38,14 +38,18 @@ export default {
return this.modifiedFilesLength ? 'multi-file-modified' : '';
},
additionsTooltip() {
- return sprintf(n__('1 %{type} addition', '%{count} %{type} additions', this.addedFilesLength), {
- type: this.title.toLowerCase(),
- count: this.addedFilesLength,
- });
+ return sprintf(
+ n__('1 %{type} addition', '%{count} %{type} additions', this.addedFilesLength),
+ {
+ type: this.title.toLowerCase(),
+ count: this.addedFilesLength,
+ },
+ );
},
modifiedTooltip() {
return sprintf(
- n__('1 %{type} modification', '%{count} %{type} modifications', this.modifiedFilesLength), {
+ n__('1 %{type} modification', '%{count} %{type} modifications', this.modifiedFilesLength),
+ {
type: this.title.toLowerCase(),
count: this.modifiedFilesLength,
},
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/stage_button.vue b/app/assets/javascripts/ide/components/commit_sidebar/stage_button.vue
index 8a1836a5c92..adf4b479c97 100644
--- a/app/assets/javascripts/ide/components/commit_sidebar/stage_button.vue
+++ b/app/assets/javascripts/ide/components/commit_sidebar/stage_button.vue
@@ -25,10 +25,7 @@ export default {
return `discard-file-${this.path}`;
},
modalTitle() {
- return sprintf(
- __('Discard changes to %{path}?'),
- { path: this.path },
- );
+ return sprintf(__('Discard changes to %{path}?'), { path: this.path });
},
},
methods: {
diff --git a/app/assets/javascripts/ide/components/ide_side_bar.vue b/app/assets/javascripts/ide/components/ide_side_bar.vue
index f99ff6d6da8..dc84ee12f1e 100644
--- a/app/assets/javascripts/ide/components/ide_side_bar.vue
+++ b/app/assets/javascripts/ide/components/ide_side_bar.vue
@@ -24,13 +24,7 @@ export default {
IdeProjectHeader,
},
computed: {
- ...mapState([
- 'loading',
- 'currentActivityView',
- 'changedFiles',
- 'stagedFiles',
- 'lastCommitMsg',
- ]),
+ ...mapState(['loading', 'currentActivityView', 'changedFiles', 'stagedFiles', 'lastCommitMsg']),
...mapGetters(['currentProject', 'someUncommitedChanges']),
showSuccessMessage() {
return (
diff --git a/app/assets/javascripts/ide/components/merge_requests/list.vue b/app/assets/javascripts/ide/components/merge_requests/list.vue
index c8343e77860..f5e42e87f1b 100644
--- a/app/assets/javascripts/ide/components/merge_requests/list.vue
+++ b/app/assets/javascripts/ide/components/merge_requests/list.vue
@@ -37,14 +37,10 @@ export default {
return this.hasSearchFocus && !this.search && !this.currentSearchType;
},
type() {
- return this.currentSearchType
- ? this.currentSearchType.type
- : '';
+ return this.currentSearchType ? this.currentSearchType.type : '';
},
searchTokens() {
- return this.currentSearchType
- ? [this.currentSearchType]
- : [];
+ return this.currentSearchType ? [this.currentSearchType] : [];
},
},
watch: {
diff --git a/app/assets/javascripts/ide/components/nav_dropdown_button.vue b/app/assets/javascripts/ide/components/nav_dropdown_button.vue
index 7f98769d484..6cee4e9a8f0 100644
--- a/app/assets/javascripts/ide/components/nav_dropdown_button.vue
+++ b/app/assets/javascripts/ide/components/nav_dropdown_button.vue
@@ -13,9 +13,7 @@ export default {
computed: {
...mapState(['currentBranchId', 'currentMergeRequestId']),
mergeRequestLabel() {
- return this.currentMergeRequestId
- ? `!${this.currentMergeRequestId}`
- : EMPTY_LABEL;
+ return this.currentMergeRequestId ? `!${this.currentMergeRequestId}` : EMPTY_LABEL;
},
branchLabel() {
return this.currentBranchId || EMPTY_LABEL;
diff --git a/app/assets/javascripts/ide/components/panes/right.vue b/app/assets/javascripts/ide/components/panes/right.vue
index bd07f372177..10aa96dffaf 100644
--- a/app/assets/javascripts/ide/components/panes/right.vue
+++ b/app/assets/javascripts/ide/components/panes/right.vue
@@ -43,34 +43,25 @@ export default {
{
show: this.currentMergeRequestId,
title: __('Merge Request'),
- views: [
- rightSidebarViews.mergeRequestInfo,
- ],
+ views: [rightSidebarViews.mergeRequestInfo],
icon: 'text-description',
},
{
show: true,
title: __('Pipelines'),
- views: [
- rightSidebarViews.pipelines,
- rightSidebarViews.jobsDetail,
- ],
+ views: [rightSidebarViews.pipelines, rightSidebarViews.jobsDetail],
icon: 'rocket',
},
{
show: this.showLivePreview,
title: __('Live preview'),
- views: [
- rightSidebarViews.clientSidePreview,
- ],
+ views: [rightSidebarViews.clientSidePreview],
icon: 'live-preview',
},
];
},
tabs() {
- return this.defaultTabs
- .concat(this.extensionTabs)
- .filter(tab => tab.show);
+ return this.defaultTabs.concat(this.extensionTabs).filter(tab => tab.show);
},
tabViews() {
return _.flatten(this.tabs.map(tab => tab.views));
diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue
index b2599128213..7b0f717962e 100644
--- a/app/assets/javascripts/ide/components/repo_editor.vue
+++ b/app/assets/javascripts/ide/components/repo_editor.vue
@@ -25,12 +25,7 @@ export default {
...mapState('rightPane', {
rightPaneIsOpen: 'isOpen',
}),
- ...mapState([
- 'rightPanelCollapsed',
- 'viewer',
- 'panelResizing',
- 'currentActivityView',
- ]),
+ ...mapState(['rightPanelCollapsed', 'viewer', 'panelResizing', 'currentActivityView']),
...mapGetters([
'currentMergeRequest',
'getStagedFile',
diff --git a/app/assets/javascripts/ide/components/shared/tokened_input.vue b/app/assets/javascripts/ide/components/shared/tokened_input.vue
index a7a12f6785d..30010957a16 100644
--- a/app/assets/javascripts/ide/components/shared/tokened_input.vue
+++ b/app/assets/javascripts/ide/components/shared/tokened_input.vue
@@ -30,9 +30,7 @@ export default {
},
computed: {
placeholderText() {
- return this.tokens.length
- ? ''
- : this.placeholder;
+ return this.tokens.length ? '' : this.placeholder;
},
},
watch: {
diff --git a/app/assets/javascripts/ide/index.js b/app/assets/javascripts/ide/index.js
index c0550116633..7a5a227db30 100644
--- a/app/assets/javascripts/ide/index.js
+++ b/app/assets/javascripts/ide/index.js
@@ -21,10 +21,7 @@ Vue.use(Translate);
export function initIde(el, options = {}) {
if (!el) return null;
- const {
- extraInitialData = () => ({}),
- rootComponent = ide,
- } = options;
+ const { extraInitialData = () => ({}), rootComponent = ide } = options;
return new Vue({
el,
diff --git a/app/assets/javascripts/ide/lib/diff/diff.js b/app/assets/javascripts/ide/lib/diff/diff.js
index 0e37f5c4704..9b7ed68b893 100644
--- a/app/assets/javascripts/ide/lib/diff/diff.js
+++ b/app/assets/javascripts/ide/lib/diff/diff.js
@@ -11,14 +11,16 @@ export const computeDiff = (originalContent, newContent) => {
if (findOnLine) {
Object.assign(findOnLine, change, {
modified: true,
- endLineNumber: (lineNumber + change.count) - 1,
+ endLineNumber: lineNumber + change.count - 1,
});
} else if ('added' in change || 'removed' in change) {
- acc.push(Object.assign({}, change, {
- lineNumber,
- modified: undefined,
- endLineNumber: (lineNumber + change.count) - 1,
- }));
+ acc.push(
+ Object.assign({}, change, {
+ lineNumber,
+ modified: undefined,
+ endLineNumber: lineNumber + change.count - 1,
+ }),
+ );
}
if (!change.removed) {
diff --git a/app/assets/javascripts/ide/lib/diff/diff_worker.js b/app/assets/javascripts/ide/lib/diff/diff_worker.js
index 78b2eab6399..77416a8de9d 100644
--- a/app/assets/javascripts/ide/lib/diff/diff_worker.js
+++ b/app/assets/javascripts/ide/lib/diff/diff_worker.js
@@ -1,7 +1,7 @@
import { computeDiff } from './diff';
// eslint-disable-next-line no-restricted-globals
-self.addEventListener('message', (e) => {
+self.addEventListener('message', e => {
const { data } = e;
// eslint-disable-next-line no-restricted-globals
diff --git a/app/assets/javascripts/ide/stores/actions/merge_request.js b/app/assets/javascripts/ide/stores/actions/merge_request.js
index 187f8c75d07..3ac2f8b3698 100644
--- a/app/assets/javascripts/ide/stores/actions/merge_request.js
+++ b/app/assets/javascripts/ide/stores/actions/merge_request.js
@@ -116,57 +116,57 @@ export const openMergeRequest = (
targetProjectId,
mergeRequestId,
})
- .then(mr => {
- dispatch('setCurrentBranchId', mr.source_branch);
+ .then(mr => {
+ dispatch('setCurrentBranchId', mr.source_branch);
- dispatch('getBranchData', {
- projectId,
- branchId: mr.source_branch,
- });
+ dispatch('getBranchData', {
+ projectId,
+ branchId: mr.source_branch,
+ });
- return dispatch('getFiles', {
- projectId,
- branchId: mr.source_branch,
- });
- })
- .then(() =>
- dispatch('getMergeRequestVersions', {
- projectId,
- targetProjectId,
- mergeRequestId,
- }),
- )
- .then(() =>
- dispatch('getMergeRequestChanges', {
- projectId,
- targetProjectId,
- mergeRequestId,
- }),
- )
- .then(mrChanges => {
- if (mrChanges.changes.length) {
- dispatch('updateActivityBarView', activityBarViews.review);
- }
+ return dispatch('getFiles', {
+ projectId,
+ branchId: mr.source_branch,
+ });
+ })
+ .then(() =>
+ dispatch('getMergeRequestVersions', {
+ projectId,
+ targetProjectId,
+ mergeRequestId,
+ }),
+ )
+ .then(() =>
+ dispatch('getMergeRequestChanges', {
+ projectId,
+ targetProjectId,
+ mergeRequestId,
+ }),
+ )
+ .then(mrChanges => {
+ if (mrChanges.changes.length) {
+ dispatch('updateActivityBarView', activityBarViews.review);
+ }
- mrChanges.changes.forEach((change, ind) => {
- const changeTreeEntry = state.entries[change.new_path];
+ mrChanges.changes.forEach((change, ind) => {
+ const changeTreeEntry = state.entries[change.new_path];
- if (changeTreeEntry) {
- dispatch('setFileMrChange', {
- file: changeTreeEntry,
- mrChange: change,
- });
-
- if (ind < 10) {
- dispatch('getFileData', {
- path: change.new_path,
- makeFileActive: ind === 0,
+ if (changeTreeEntry) {
+ dispatch('setFileMrChange', {
+ file: changeTreeEntry,
+ mrChange: change,
});
+
+ if (ind < 10) {
+ dispatch('getFileData', {
+ path: change.new_path,
+ makeFileActive: ind === 0,
+ });
+ }
}
- }
+ });
+ })
+ .catch(e => {
+ flash(__('Error while loading the merge request. Please try again.'));
+ throw e;
});
- })
- .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 543dc6c0461..2cb08ab2945 100644
--- a/app/assets/javascripts/ide/stores/actions/project.js
+++ b/app/assets/javascripts/ide/stores/actions/project.js
@@ -125,10 +125,7 @@ export const showBranchNotFoundError = ({ dispatch }, branchId) => {
});
};
-export const openBranch = (
- { dispatch, state },
- { projectId, branchId, basePath },
-) => {
+export const openBranch = ({ dispatch, state }, { projectId, branchId, basePath }) => {
dispatch('setCurrentBranchId', branchId);
dispatch('getBranchData', {
@@ -136,23 +133,20 @@ export const openBranch = (
branchId,
});
- return (
- dispatch('getFiles', {
- projectId,
- branchId,
- })
- .then(() => {
- if (basePath) {
- const path = basePath.slice(-1) === '/' ? basePath.slice(0, -1) : basePath;
- const treeEntryKey = Object.keys(state.entries).find(
- key => key === path && !state.entries[key].pending,
- );
- const treeEntry = state.entries[treeEntryKey];
+ return dispatch('getFiles', {
+ projectId,
+ branchId,
+ }).then(() => {
+ if (basePath) {
+ const path = basePath.slice(-1) === '/' ? basePath.slice(0, -1) : basePath;
+ const treeEntryKey = Object.keys(state.entries).find(
+ key => key === path && !state.entries[key].pending,
+ );
+ const treeEntry = state.entries[treeEntryKey];
- if (treeEntry) {
- dispatch('handleTreeEntryAction', treeEntry);
- }
+ if (treeEntry) {
+ dispatch('handleTreeEntryAction', treeEntry);
}
- })
- );
+ }
+ });
};
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 baa2497ec5b..4565c11a83f 100644
--- a/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
+++ b/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
@@ -3,8 +3,7 @@ import Api from '../../../../api';
import { scopes } from './constants';
import * as types from './mutation_types';
-export const requestMergeRequests = ({ commit }) =>
- commit(types.REQUEST_MERGE_REQUESTS);
+export const requestMergeRequests = ({ commit }) => commit(types.REQUEST_MERGE_REQUESTS);
export const receiveMergeRequestsError = ({ commit, dispatch }, { type, search }) => {
dispatch(
'setErrorMessage',