Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/ide')
-rw-r--r--app/assets/javascripts/ide/commit_icon.js3
-rw-r--r--app/assets/javascripts/ide/components/file_templates/dropdown.vue103
-rw-r--r--app/assets/javascripts/ide/components/new_dropdown/modal.vue6
-rw-r--r--app/assets/javascripts/ide/components/terminal/terminal.vue3
-rw-r--r--app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue6
-rw-r--r--app/assets/javascripts/ide/init_gitlab_web_ide.js3
-rw-r--r--app/assets/javascripts/ide/lib/diff/controller.js6
-rw-r--r--app/assets/javascripts/ide/lib/errors.js6
-rw-r--r--app/assets/javascripts/ide/lib/files.js3
-rw-r--r--app/assets/javascripts/ide/lib/mirror.js3
-rw-r--r--app/assets/javascripts/ide/stores/actions/project.js3
-rw-r--r--app/assets/javascripts/ide/stores/getters.js3
-rw-r--r--app/assets/javascripts/ide/stores/modules/terminal/messages.js3
-rw-r--r--app/assets/javascripts/ide/stores/utils.js9
14 files changed, 37 insertions, 123 deletions
diff --git a/app/assets/javascripts/ide/commit_icon.js b/app/assets/javascripts/ide/commit_icon.js
index 70ee9cff22b..07eef897910 100644
--- a/app/assets/javascripts/ide/commit_icon.js
+++ b/app/assets/javascripts/ide/commit_icon.js
@@ -3,7 +3,8 @@ import { commitItemIconMap } from './constants';
export default (file) => {
if (file.deleted) {
return commitItemIconMap.deleted;
- } else if (file.tempFile && !file.prevPath) {
+ }
+ if (file.tempFile && !file.prevPath) {
return commitItemIconMap.addition;
}
diff --git a/app/assets/javascripts/ide/components/file_templates/dropdown.vue b/app/assets/javascripts/ide/components/file_templates/dropdown.vue
deleted file mode 100644
index f58a35e7624..00000000000
--- a/app/assets/javascripts/ide/components/file_templates/dropdown.vue
+++ /dev/null
@@ -1,103 +0,0 @@
-<!-- eslint-disable vue/multi-word-component-names -->
-<script>
-import { GlIcon, GlLoadingIcon } from '@gitlab/ui';
-import $ from 'jquery';
-// eslint-disable-next-line no-restricted-imports
-import { mapActions, mapState } from 'vuex';
-import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue';
-
-export default {
- components: {
- DropdownButton,
- GlIcon,
- GlLoadingIcon,
- },
- props: {
- data: {
- type: Array,
- required: false,
- default: () => [],
- },
- label: {
- type: String,
- required: true,
- },
- title: {
- type: String,
- required: false,
- default: null,
- },
- isAsyncData: {
- type: Boolean,
- required: false,
- default: false,
- },
- searchable: {
- type: Boolean,
- required: false,
- default: false,
- },
- },
- data() {
- return {
- search: '',
- };
- },
- computed: {
- ...mapState('fileTemplates', ['templates', 'isLoading']),
- outputData() {
- return (this.isAsyncData ? this.templates : this.data).filter((t) => {
- if (!this.searchable) return true;
-
- return t.name.toLowerCase().indexOf(this.search.toLowerCase()) >= 0;
- });
- },
- showLoading() {
- return this.isAsyncData ? this.isLoading : false;
- },
- },
- mounted() {
- $(this.$el).on('show.bs.dropdown', this.fetchTemplatesIfAsync);
- },
- beforeDestroy() {
- $(this.$el).off('show.bs.dropdown', this.fetchTemplatesIfAsync);
- },
- methods: {
- ...mapActions('fileTemplates', ['fetchTemplateTypes']),
- fetchTemplatesIfAsync() {
- if (this.isAsyncData) {
- this.fetchTemplateTypes();
- }
- },
- clickItem(item) {
- this.$emit('click', item);
- },
- },
-};
-</script>
-
-<template>
- <div class="dropdown">
- <dropdown-button :toggle-text="label" data-display="static" />
- <div class="dropdown-menu pb-0">
- <div v-if="title" class="dropdown-title ml-0 mr-0">{{ title }}</div>
- <div v-if="!showLoading && searchable" class="dropdown-input">
- <input
- v-model="search"
- :placeholder="__('Filter...')"
- type="search"
- class="dropdown-input-field"
- />
- <gl-icon name="search" class="dropdown-input-search" />
- </div>
- <div class="dropdown-content">
- <gl-loading-icon v-if="showLoading" size="lg" />
- <ul v-else>
- <li v-for="(item, index) in outputData" :key="index">
- <button type="button" @click="clickItem(item)">{{ item.name }}</button>
- </li>
- </ul>
- </div>
- </div>
- </div>
-</template>
diff --git a/app/assets/javascripts/ide/components/new_dropdown/modal.vue b/app/assets/javascripts/ide/components/new_dropdown/modal.vue
index 854daa20628..741845e3325 100644
--- a/app/assets/javascripts/ide/components/new_dropdown/modal.vue
+++ b/app/assets/javascripts/ide/components/new_dropdown/modal.vue
@@ -32,7 +32,8 @@ export default {
if (this.modalType === modalTypes.tree) {
return __('Create new directory');
- } else if (this.modalType === modalTypes.rename) {
+ }
+ if (this.modalType === modalTypes.rename) {
return entry.type === modalTypes.tree ? __('Rename folder') : __('Rename file');
}
@@ -43,7 +44,8 @@ export default {
if (this.modalType === modalTypes.tree) {
return __('Create directory');
- } else if (this.modalType === modalTypes.rename) {
+ }
+ if (this.modalType === modalTypes.rename) {
return entry.type === modalTypes.tree ? __('Rename folder') : __('Rename file');
}
diff --git a/app/assets/javascripts/ide/components/terminal/terminal.vue b/app/assets/javascripts/ide/components/terminal/terminal.vue
index 9e8b3d87397..b2e90a64758 100644
--- a/app/assets/javascripts/ide/components/terminal/terminal.vue
+++ b/app/assets/javascripts/ide/components/terminal/terminal.vue
@@ -37,7 +37,8 @@ export default {
loadingText() {
if (isStartingStatus(this.status)) {
return __('Starting...');
- } else if (this.status === STOPPING) {
+ }
+ if (this.status === STOPPING) {
return __('Stopping...');
}
diff --git a/app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue b/app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue
index 38e53b64503..332408b9ecf 100644
--- a/app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue
+++ b/app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue
@@ -31,12 +31,14 @@ export default {
icon: '',
text: this.isStarted ? MSG_TERMINAL_SYNC_UPLOADING : MSG_TERMINAL_SYNC_CONNECTING,
};
- } else if (this.isError) {
+ }
+ if (this.isError) {
return {
icon: 'warning',
text: this.message,
};
- } else if (this.isStarted) {
+ }
+ if (this.isStarted) {
return {
icon: 'mobile-issue-close',
text: MSG_TERMINAL_SYNC_RUNNING,
diff --git a/app/assets/javascripts/ide/init_gitlab_web_ide.js b/app/assets/javascripts/ide/init_gitlab_web_ide.js
index 11a0095db92..2e113003f8a 100644
--- a/app/assets/javascripts/ide/init_gitlab_web_ide.js
+++ b/app/assets/javascripts/ide/init_gitlab_web_ide.js
@@ -62,9 +62,8 @@ export const initGitlabWebIDE = async (el) => {
filePath,
mrId,
mrTargetProject: getMRTargetProject(),
- // note: At the time of writing this, forkInfo isn't expected by `@gitlab/web-ide`,
- // but it will be soon.
forkInfo,
+ username: gon.current_username,
links: {
feedbackIssue: GITLAB_WEB_IDE_FEEDBACK_ISSUE,
userPreferences: el.dataset.userPreferencesPath,
diff --git a/app/assets/javascripts/ide/lib/diff/controller.js b/app/assets/javascripts/ide/lib/diff/controller.js
index 7595a1cedf1..ec28845d805 100644
--- a/app/assets/javascripts/ide/lib/diff/controller.js
+++ b/app/assets/javascripts/ide/lib/diff/controller.js
@@ -7,9 +7,11 @@ import DirtyDiffWorker from './diff_worker?worker';
export const getDiffChangeType = (change) => {
if (change.modified) {
return 'modified';
- } else if (change.added) {
+ }
+ if (change.added) {
return 'added';
- } else if (change.removed) {
+ }
+ if (change.removed) {
return 'removed';
}
diff --git a/app/assets/javascripts/ide/lib/errors.js b/app/assets/javascripts/ide/lib/errors.js
index a8a048e588f..5063cf5fd4f 100644
--- a/app/assets/javascripts/ide/lib/errors.js
+++ b/app/assets/javascripts/ide/lib/errors.js
@@ -55,9 +55,11 @@ export const parseCommitError = (e) => {
if (CODEOWNERS_REGEX.test(message)) {
return createCodeownersCommitError(message);
- } else if (BRANCH_CHANGED_REGEX.test(message)) {
+ }
+ if (BRANCH_CHANGED_REGEX.test(message)) {
return createBranchChangedCommitError(message);
- } else if (BRANCH_ALREADY_EXISTS.test(message)) {
+ }
+ if (BRANCH_ALREADY_EXISTS.test(message)) {
return branchAlreadyExistsCommitError(message);
}
diff --git a/app/assets/javascripts/ide/lib/files.js b/app/assets/javascripts/ide/lib/files.js
index 3fdf012bbb2..415e34f56b8 100644
--- a/app/assets/javascripts/ide/lib/files.js
+++ b/app/assets/javascripts/ide/lib/files.js
@@ -35,7 +35,8 @@ export const decorateFiles = ({
const insertParent = (path) => {
if (!path) {
return null;
- } else if (entries[path]) {
+ }
+ if (entries[path]) {
return entries[path];
}
diff --git a/app/assets/javascripts/ide/lib/mirror.js b/app/assets/javascripts/ide/lib/mirror.js
index f437965b25a..286798d7560 100644
--- a/app/assets/javascripts/ide/lib/mirror.js
+++ b/app/assets/javascripts/ide/lib/mirror.js
@@ -32,7 +32,8 @@ const isErrorPayload = (payload) => payload && payload.status_code !== HTTP_STAT
const getErrorFromResponse = (data) => {
if (isErrorResponse(data.error)) {
return { message: data.error.Message };
- } else if (isErrorPayload(data.payload)) {
+ }
+ if (isErrorPayload(data.payload)) {
return { message: data.payload.error_message };
}
diff --git a/app/assets/javascripts/ide/stores/actions/project.js b/app/assets/javascripts/ide/stores/actions/project.js
index f4fa52b2d4d..11e3d8260f7 100644
--- a/app/assets/javascripts/ide/stores/actions/project.js
+++ b/app/assets/javascripts/ide/stores/actions/project.js
@@ -133,7 +133,8 @@ export const loadBranch = ({ dispatch, getters, state }, { projectId, branchId }
if (currentProject?.branches?.[branchId]) {
return Promise.resolve();
- } else if (getters.emptyRepo) {
+ }
+ if (getters.emptyRepo) {
return dispatch('loadEmptyBranch', { projectId, branchId });
}
diff --git a/app/assets/javascripts/ide/stores/getters.js b/app/assets/javascripts/ide/stores/getters.js
index c0f666c6652..74fe61b6e2f 100644
--- a/app/assets/javascripts/ide/stores/getters.js
+++ b/app/assets/javascripts/ide/stores/getters.js
@@ -30,7 +30,8 @@ const getCannotPushCodeViewModel = (state) => {
text: MSG_GO_TO_FORK,
},
};
- } else if (forkPath) {
+ }
+ if (forkPath) {
return {
message: MSG_CANNOT_PUSH_CODE_SHOULD_FORK,
action: {
diff --git a/app/assets/javascripts/ide/stores/modules/terminal/messages.js b/app/assets/javascripts/ide/stores/modules/terminal/messages.js
index ad7ad35a98c..a2b45f9dc62 100644
--- a/app/assets/javascripts/ide/stores/modules/terminal/messages.js
+++ b/app/assets/javascripts/ide/stores/modules/terminal/messages.js
@@ -39,7 +39,8 @@ export const configCheckError = (status, helpUrl) => {
},
false,
);
- } else if (status === HTTP_STATUS_FORBIDDEN) {
+ }
+ if (status === HTTP_STATUS_FORBIDDEN) {
return ERROR_PERMISSION;
}
diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js
index ec661fdb0d6..bac3803e68f 100644
--- a/app/assets/javascripts/ide/stores/utils.js
+++ b/app/assets/javascripts/ide/stores/utils.js
@@ -81,9 +81,11 @@ export const setPageTitleForFile = (state, file) => {
export const commitActionForFile = (file) => {
if (file.prevPath) {
return commitActionTypes.move;
- } else if (file.deleted) {
+ }
+ if (file.deleted) {
return commitActionTypes.delete;
- } else if (file.tempFile) {
+ }
+ if (file.tempFile) {
return commitActionTypes.create;
}
@@ -131,7 +133,8 @@ export const createNewMergeRequestUrl = (projectUrl, source, target) =>
const sortTreesByTypeAndName = (a, b) => {
if (a.type === 'tree' && b.type === 'blob') {
return -1;
- } else if (a.type === 'blob' && b.type === 'tree') {
+ }
+ if (a.type === 'blob' && b.type === 'tree') {
return 1;
}
if (a.name < b.name) return -1;