summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/boards/components/board_card.vue4
-rw-r--r--app/assets/javascripts/boards/index.js2
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue5
-rw-r--r--app/assets/javascripts/deploy_keys/components/action_btn.vue9
-rw-r--r--app/assets/javascripts/deploy_keys/components/app.vue4
-rw-r--r--app/assets/javascripts/groups/components/app.vue4
-rw-r--r--app/assets/javascripts/groups/components/groups.vue7
-rw-r--r--app/assets/javascripts/groups/components/item_actions.vue2
-rw-r--r--app/assets/javascripts/helpers/event_hub_factory.js6
-rw-r--r--app/assets/javascripts/ide/components/repo_editor.vue3
-rw-r--r--app/assets/javascripts/ide/stores/actions/file.js77
-rw-r--r--app/assets/javascripts/sidebar/event_hub.js4
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_tour.vue27
13 files changed, 83 insertions, 71 deletions
diff --git a/app/assets/javascripts/boards/components/board_card.vue b/app/assets/javascripts/boards/components/board_card.vue
index 246d3b9dcd1..e120e058ede 100644
--- a/app/assets/javascripts/boards/components/board_card.vue
+++ b/app/assets/javascripts/boards/components/board_card.vue
@@ -89,10 +89,10 @@ export default {
eventHub.$emit('clearDetailIssue', isMultiSelect);
if (isMultiSelect) {
- eventHub.$emit('newDetailIssue', this.issue, isMultiSelect);
+ eventHub.$emit('newDetailIssue', [this.issue, isMultiSelect]);
}
} else {
- eventHub.$emit('newDetailIssue', this.issue, isMultiSelect);
+ eventHub.$emit('newDetailIssue', [this.issue, isMultiSelect]);
boardsStore.setListDetail(this.list);
}
}
diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js
index a882cd1cdfa..01e01ad6b8e 100644
--- a/app/assets/javascripts/boards/index.js
+++ b/app/assets/javascripts/boards/index.js
@@ -202,7 +202,7 @@ export default () => {
updateTokens() {
this.filterManager.updateTokens();
},
- updateDetailIssue(newIssue, multiSelect = false) {
+ updateDetailIssue([newIssue, multiSelect = false]) {
const { sidebarInfoEndpoint } = newIssue;
if (sidebarInfoEndpoint && newIssue.subscribed === undefined) {
newIssue.setFetchingState('subscriptions', true);
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue b/app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue
index 3c18608eb75..4b15bd55cbd 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue
+++ b/app/assets/javascripts/cycle_analytics/components/stage_nav_item.vue
@@ -25,11 +25,6 @@ export default {
default: '',
required: false,
},
- canEdit: {
- type: Boolean,
- default: false,
- required: false,
- },
},
computed: {
hasValue() {
diff --git a/app/assets/javascripts/deploy_keys/components/action_btn.vue b/app/assets/javascripts/deploy_keys/components/action_btn.vue
index af7c391ab70..c2c90bd472b 100644
--- a/app/assets/javascripts/deploy_keys/components/action_btn.vue
+++ b/app/assets/javascripts/deploy_keys/components/action_btn.vue
@@ -30,9 +30,12 @@ export default {
doAction() {
this.isLoading = true;
- eventHub.$emit(`${this.type}.key`, this.deployKey, () => {
- this.isLoading = false;
- });
+ eventHub.$emit(`${this.type}.key`, [
+ this.deployKey,
+ () => {
+ this.isLoading = false;
+ },
+ ]);
},
},
};
diff --git a/app/assets/javascripts/deploy_keys/components/app.vue b/app/assets/javascripts/deploy_keys/components/app.vue
index 5505704f430..df31ee65b27 100644
--- a/app/assets/javascripts/deploy_keys/components/app.vue
+++ b/app/assets/javascripts/deploy_keys/components/app.vue
@@ -90,13 +90,13 @@ export default {
return new Flash(s__('DeployKeys|Error getting deploy keys'));
});
},
- enableKey(deployKey) {
+ enableKey([deployKey]) {
this.service
.enableKey(deployKey.id)
.then(this.fetchKeys)
.catch(() => new Flash(s__('DeployKeys|Error enabling deploy key')));
},
- disableKey(deployKey, callback) {
+ disableKey([deployKey, callback]) {
if (
// eslint-disable-next-line no-alert
window.confirm(s__('DeployKeys|You are going to remove this deploy key. Are you sure?'))
diff --git a/app/assets/javascripts/groups/components/app.vue b/app/assets/javascripts/groups/components/app.vue
index 0b401f4d732..0f2ee4a5224 100644
--- a/app/assets/javascripts/groups/components/app.vue
+++ b/app/assets/javascripts/groups/components/app.vue
@@ -123,7 +123,7 @@ export default {
this.updateGroups(res, Boolean(filterGroupsBy));
});
},
- fetchPage(page, filterGroupsBy, sortBy, archived) {
+ fetchPage([page, filterGroupsBy, sortBy, archived]) {
this.isLoading = true;
return this.fetchGroups({
@@ -169,7 +169,7 @@ export default {
parentGroup.isOpen = false;
}
},
- showLeaveGroupModal(group, parentGroup) {
+ showLeaveGroupModal([group, parentGroup]) {
const { fullName } = group;
this.targetGroup = group;
this.targetParentGroup = parentGroup;
diff --git a/app/assets/javascripts/groups/components/groups.vue b/app/assets/javascripts/groups/components/groups.vue
index c7acc21378b..daf145d4eca 100644
--- a/app/assets/javascripts/groups/components/groups.vue
+++ b/app/assets/javascripts/groups/components/groups.vue
@@ -35,7 +35,12 @@ export default {
const filterGroupsParam = getParameterByName('filter');
const sortParam = getParameterByName('sort');
const archivedParam = getParameterByName('archived');
- eventHub.$emit(`${this.action}fetchPage`, page, filterGroupsParam, sortParam, archivedParam);
+ eventHub.$emit(`${this.action}fetchPage`, [
+ page,
+ filterGroupsParam,
+ sortParam,
+ archivedParam,
+ ]);
},
},
};
diff --git a/app/assets/javascripts/groups/components/item_actions.vue b/app/assets/javascripts/groups/components/item_actions.vue
index 985ea5a9019..c91551da475 100644
--- a/app/assets/javascripts/groups/components/item_actions.vue
+++ b/app/assets/javascripts/groups/components/item_actions.vue
@@ -37,7 +37,7 @@ export default {
},
methods: {
onLeaveGroup() {
- eventHub.$emit(`${this.action}showLeaveGroupModal`, this.group, this.parentGroup);
+ eventHub.$emit(`${this.action}showLeaveGroupModal`, [this.group, this.parentGroup]);
},
},
};
diff --git a/app/assets/javascripts/helpers/event_hub_factory.js b/app/assets/javascripts/helpers/event_hub_factory.js
index 4d7f7550a94..08cfe40b52d 100644
--- a/app/assets/javascripts/helpers/event_hub_factory.js
+++ b/app/assets/javascripts/helpers/event_hub_factory.js
@@ -3,6 +3,8 @@ import mitt from 'mitt';
export default () => {
const emitter = mitt();
+ const originalEmit = emitter.emit;
+
emitter.once = (event, handler) => {
const wrappedHandler = evt => {
handler(evt);
@@ -11,6 +13,10 @@ export default () => {
emitter.on(event, wrappedHandler);
};
+ emitter.emit = (event, args = []) => {
+ originalEmit(event, args);
+ };
+
emitter.$on = emitter.on;
emitter.$once = emitter.once;
emitter.$off = emitter.off;
diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue
index a7646083428..ac445a1d9f1 100644
--- a/app/assets/javascripts/ide/components/repo_editor.vue
+++ b/app/assets/javascripts/ide/components/repo_editor.vue
@@ -185,7 +185,6 @@ export default {
'setFileLanguage',
'setEditorPosition',
'setFileViewMode',
- 'updateViewer',
'removePendingTab',
'triggerFilesChange',
'addTempImage',
@@ -241,7 +240,7 @@ export default {
});
},
setupEditor() {
- if (!this.file || !this.editor.instance) return;
+ if (!this.file || !this.editor.instance || this.file.loading) return;
const head = this.getStagedFile(this.file.path);
diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js
index 47f9337a288..1ebf14d6eb7 100644
--- a/app/assets/javascripts/ide/stores/actions/file.js
+++ b/app/assets/javascripts/ide/stores/actions/file.js
@@ -65,7 +65,7 @@ export const getFileData = (
if (file.raw || (file.tempFile && !file.prevPath && !fileDeletedAndReadded))
return Promise.resolve();
- commit(types.TOGGLE_LOADING, { entry: file });
+ commit(types.TOGGLE_LOADING, { entry: file, forceValue: true });
const url = joinPaths(
gon.relative_url_root || '/',
@@ -84,10 +84,8 @@ export const getFileData = (
if (data) commit(types.SET_FILE_DATA, { data, file });
if (openFile) commit(types.TOGGLE_FILE_OPEN, path);
if (makeFileActive) dispatch('setFileActive', path);
- commit(types.TOGGLE_LOADING, { entry: file });
})
.catch(() => {
- commit(types.TOGGLE_LOADING, { entry: file });
dispatch('setErrorMessage', {
text: __('An error occurred while loading the file.'),
action: payload =>
@@ -95,6 +93,9 @@ export const getFileData = (
actionText: __('Please try again'),
actionPayload: { path, makeFileActive },
});
+ })
+ .finally(() => {
+ commit(types.TOGGLE_LOADING, { entry: file, forceValue: false });
});
};
@@ -106,45 +107,41 @@ export const getRawFileData = ({ state, commit, dispatch, getters }, { path }) =
const file = state.entries[path];
const stagedFile = state.stagedFiles.find(f => f.path === path);
- return new Promise((resolve, reject) => {
- const fileDeletedAndReadded = getters.isFileDeletedAndReadded(path);
- service
- .getRawFileData(fileDeletedAndReadded ? stagedFile : file)
- .then(raw => {
- if (!(file.tempFile && !file.prevPath && !fileDeletedAndReadded))
- commit(types.SET_FILE_RAW_DATA, { file, raw, fileDeletedAndReadded });
-
- if (file.mrChange && file.mrChange.new_file === false) {
- const baseSha =
- (getters.currentMergeRequest && getters.currentMergeRequest.baseCommitSha) || '';
-
- service
- .getBaseRawFileData(file, baseSha)
- .then(baseRaw => {
- commit(types.SET_FILE_BASE_RAW_DATA, {
- file,
- baseRaw,
- });
- resolve(raw);
- })
- .catch(e => {
- reject(e);
- });
- } else {
- resolve(raw);
- }
- })
- .catch(() => {
- dispatch('setErrorMessage', {
- text: __('An error occurred while loading the file content.'),
- action: payload =>
- dispatch('getRawFileData', payload).then(() => dispatch('setErrorMessage', null)),
- actionText: __('Please try again'),
- actionPayload: { path },
+ const fileDeletedAndReadded = getters.isFileDeletedAndReadded(path);
+ commit(types.TOGGLE_LOADING, { entry: file, forceValue: true });
+ return service
+ .getRawFileData(fileDeletedAndReadded ? stagedFile : file)
+ .then(raw => {
+ if (!(file.tempFile && !file.prevPath && !fileDeletedAndReadded))
+ commit(types.SET_FILE_RAW_DATA, { file, raw, fileDeletedAndReadded });
+
+ if (file.mrChange && file.mrChange.new_file === false) {
+ const baseSha =
+ (getters.currentMergeRequest && getters.currentMergeRequest.baseCommitSha) || '';
+
+ return service.getBaseRawFileData(file, baseSha).then(baseRaw => {
+ commit(types.SET_FILE_BASE_RAW_DATA, {
+ file,
+ baseRaw,
+ });
+ return raw;
});
- reject();
+ }
+ return raw;
+ })
+ .catch(e => {
+ dispatch('setErrorMessage', {
+ text: __('An error occurred while loading the file content.'),
+ action: payload =>
+ dispatch('getRawFileData', payload).then(() => dispatch('setErrorMessage', null)),
+ actionText: __('Please try again'),
+ actionPayload: { path },
});
- });
+ throw e;
+ })
+ .finally(() => {
+ commit(types.TOGGLE_LOADING, { entry: file, forceValue: false });
+ });
};
export const changeFileContent = ({ commit, state, getters }, { path, content }) => {
diff --git a/app/assets/javascripts/sidebar/event_hub.js b/app/assets/javascripts/sidebar/event_hub.js
index f35506fd5de..dd4bd9a5ab7 100644
--- a/app/assets/javascripts/sidebar/event_hub.js
+++ b/app/assets/javascripts/sidebar/event_hub.js
@@ -1,6 +1,6 @@
-import Vue from 'vue';
+import createEventHub from '~/helpers/event_hub_factory';
-const eventHub = new Vue();
+const eventHub = createEventHub();
// TODO: remove eventHub hack after code splitting refactor
window.emitSidebarEvent = (...args) => eventHub.$emit(...args);
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_tour.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_tour.vue
index f6bfb178437..1a2d845fab9 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_tour.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_tour.vue
@@ -1,9 +1,10 @@
<script>
-import { GlPopover, GlDeprecatedButton } from '@gitlab/ui';
+import { GlPopover, GlDeprecatedButton, GlSprintf, GlLink } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import Cookies from 'js-cookie';
import { parseBoolean } from '~/lib/utils/common_utils';
import Tracking from '~/tracking';
+import { s__ } from '~/locale';
const trackingMixin = Tracking.mixin();
@@ -14,10 +15,16 @@ export default {
dismissTrackValue: 20,
showTrackValue: 10,
trackEvent: 'click_button',
+ helpContent: s__(
+ `mrWidget|Use %{linkStart}CI pipelines to test your code%{linkEnd}, simply add a GitLab CI configuration file to your project. It only takes a minute to make your code more secure and robust.`,
+ ),
+ helpURL: 'https://about.gitlab.com/blog/2019/07/12/guide-to-ci-cd-pipelines/',
components: {
GlPopover,
GlDeprecatedButton,
Icon,
+ GlSprintf,
+ GlLink,
},
mixins: [trackingMixin],
props: {
@@ -97,13 +104,13 @@ export default {
<div class="svg-content svg-150 pt-1">
<img :src="pipelineSvgPath" />
</div>
- <p>
- {{
- s__(
- 'mrWidget|Detect issues before deployment with a CI pipeline that continuously tests your code. We created a quick guide that will show you how to create one. Make your code more secure and more robust in just a minute.',
- )
- }}
- </p>
+ <gl-sprintf :message="$options.helpContent">
+ <template #link="{ content }">
+ <gl-link :href="$options.helpURL" target="_blank" class="font-size-inherit">{{
+ content
+ }}</gl-link>
+ </template>
+ </gl-sprintf>
<gl-deprecated-button
ref="ok"
category="primary"
@@ -116,7 +123,7 @@ export default {
:data-track-event="$options.trackEvent"
:data-track-label="trackLabel"
>
- {{ __('Show me how') }}
+ {{ __('Show me how to add a pipeline') }}
</gl-deprecated-button>
<gl-deprecated-button
ref="no-thanks"
@@ -130,7 +137,7 @@ export default {
:data-track-label="trackLabel"
@click="dismissPopover"
>
- {{ __("No thanks, don't show this again") }}
+ {{ __('No thanks') }}
</gl-deprecated-button>
</gl-popover>
</template>