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
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-06 00:10:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-06 00:10:00 +0300
commitee2aa09a2417755bc9efbedaec48fc62b498f672 (patch)
tree1b85413dc5cc23efef319f96dc8bdb5fb94564a0 /app
parentad41744a177d11ead3268b1ec706e9c26f593060 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/integrations/constants.js5
-rw-r--r--app/assets/javascripts/integrations/edit/components/active_checkbox.vue3
-rw-r--r--app/assets/javascripts/integrations/edit/components/dynamic_field.vue5
-rw-r--r--app/assets/javascripts/integrations/edit/components/integration_form.vue5
-rw-r--r--app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue10
-rw-r--r--app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue5
-rw-r--r--app/assets/javascripts/integrations/integration_settings_form.js23
7 files changed, 37 insertions, 19 deletions
diff --git a/app/assets/javascripts/integrations/constants.js b/app/assets/javascripts/integrations/constants.js
new file mode 100644
index 00000000000..1644f35459b
--- /dev/null
+++ b/app/assets/javascripts/integrations/constants.js
@@ -0,0 +1,5 @@
+export const TEST_INTEGRATION_EVENT = 'testIntegration';
+export const SAVE_INTEGRATION_EVENT = 'saveIntegration';
+export const GET_JIRA_ISSUE_TYPES_EVENT = 'getJiraIssueTypes';
+export const TOGGLE_INTEGRATION_EVENT = 'toggleIntegration';
+export const VALIDATE_INTEGRATION_FORM_EVENT = 'validateIntegrationForm';
diff --git a/app/assets/javascripts/integrations/edit/components/active_checkbox.vue b/app/assets/javascripts/integrations/edit/components/active_checkbox.vue
index f7d7f4aa010..9804a9e15f6 100644
--- a/app/assets/javascripts/integrations/edit/components/active_checkbox.vue
+++ b/app/assets/javascripts/integrations/edit/components/active_checkbox.vue
@@ -1,6 +1,7 @@
<script>
import { GlFormGroup, GlFormCheckbox } from '@gitlab/ui';
import { mapGetters } from 'vuex';
+import { TOGGLE_INTEGRATION_EVENT } from '~/integrations/constants';
import eventHub from '../event_hub';
export default {
@@ -26,7 +27,7 @@ export default {
},
methods: {
onChange(e) {
- eventHub.$emit('toggle', e);
+ eventHub.$emit(TOGGLE_INTEGRATION_EVENT, e);
},
},
};
diff --git a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
index 1fd4083b920..f30298676df 100644
--- a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
+++ b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
@@ -9,6 +9,7 @@ import {
} from '@gitlab/ui';
import { capitalize, lowerCase, isEmpty } from 'lodash';
import { mapGetters } from 'vuex';
+import { VALIDATE_INTEGRATION_FORM_EVENT } from '~/integrations/constants';
import eventHub from '../event_hub';
export default {
@@ -121,10 +122,10 @@ export default {
if (this.isNonEmptyPassword) {
this.model = null;
}
- eventHub.$on('validateForm', this.validateForm);
+ eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
beforeDestroy() {
- eventHub.$off('validateForm', this.validateForm);
+ eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
methods: {
validateForm() {
diff --git a/app/assets/javascripts/integrations/edit/components/integration_form.vue b/app/assets/javascripts/integrations/edit/components/integration_form.vue
index 63f007170d0..707666f11d2 100644
--- a/app/assets/javascripts/integrations/edit/components/integration_form.vue
+++ b/app/assets/javascripts/integrations/edit/components/integration_form.vue
@@ -2,6 +2,7 @@
import { GlButton, GlModalDirective, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import { mapState, mapActions, mapGetters } from 'vuex';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
+import { TEST_INTEGRATION_EVENT, SAVE_INTEGRATION_EVENT } from '~/integrations/constants';
import { integrationLevels } from '../constants';
import eventHub from '../event_hub';
@@ -75,11 +76,11 @@ export default {
]),
onSaveClick() {
this.setIsSaving(true);
- eventHub.$emit('saveIntegration');
+ eventHub.$emit(SAVE_INTEGRATION_EVENT);
},
onTestClick() {
this.setIsTesting(true);
- eventHub.$emit('testIntegration');
+ eventHub.$emit(TEST_INTEGRATION_EVENT);
},
onResetClick() {
this.fetchResetIntegration();
diff --git a/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue b/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue
index 1242493fb57..0521e1eeea5 100644
--- a/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue
+++ b/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue
@@ -1,6 +1,10 @@
<script>
import { GlFormGroup, GlFormCheckbox, GlFormInput, GlSprintf, GlLink } from '@gitlab/ui';
import { mapGetters } from 'vuex';
+import {
+ VALIDATE_INTEGRATION_FORM_EVENT,
+ GET_JIRA_ISSUE_TYPES_EVENT,
+} from '~/integrations/constants';
import eventHub from '../event_hub';
import JiraUpgradeCta from './jira_upgrade_cta.vue';
@@ -77,17 +81,17 @@ export default {
},
},
created() {
- eventHub.$on('validateForm', this.validateForm);
+ eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
beforeDestroy() {
- eventHub.$off('validateForm', this.validateForm);
+ eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
methods: {
validateForm() {
this.validated = true;
},
getJiraIssueTypes() {
- eventHub.$emit('getJiraIssueTypes');
+ eventHub.$emit(GET_JIRA_ISSUE_TYPES_EVENT);
},
},
};
diff --git a/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue b/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue
index 1cc5a185f03..249a3e105b1 100644
--- a/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue
+++ b/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue
@@ -9,6 +9,7 @@ import {
} from '@gitlab/ui';
import { mapGetters } from 'vuex';
import { helpPagePath } from '~/helpers/help_page_helper';
+import { VALIDATE_INTEGRATION_FORM_EVENT } from '~/integrations/constants';
import { s__ } from '~/locale';
import eventHub from '../event_hub';
@@ -118,10 +119,10 @@ export default {
},
},
created() {
- eventHub.$on('validateForm', this.validateForm);
+ eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
beforeDestroy() {
- eventHub.$off('validateForm', this.validateForm);
+ eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
methods: {
validateForm() {
diff --git a/app/assets/javascripts/integrations/integration_settings_form.js b/app/assets/javascripts/integrations/integration_settings_form.js
index dd10caecf28..f33364d5545 100644
--- a/app/assets/javascripts/integrations/integration_settings_form.js
+++ b/app/assets/javascripts/integrations/integration_settings_form.js
@@ -4,6 +4,13 @@ import toast from '~/vue_shared/plugins/global_toast';
import axios from '../lib/utils/axios_utils';
import initForm from './edit';
import eventHub from './edit/event_hub';
+import {
+ TEST_INTEGRATION_EVENT,
+ SAVE_INTEGRATION_EVENT,
+ GET_JIRA_ISSUE_TYPES_EVENT,
+ TOGGLE_INTEGRATION_EVENT,
+ VALIDATE_INTEGRATION_FORM_EVENT,
+} from './constants';
export default class IntegrationSettingsForm {
constructor(formSelector) {
@@ -22,21 +29,19 @@ export default class IntegrationSettingsForm {
document.querySelector('.js-vue-integration-settings'),
document.querySelector('.js-vue-default-integration-settings'),
);
- eventHub.$on('toggle', (active) => {
+ eventHub.$on(TOGGLE_INTEGRATION_EVENT, (active) => {
this.formActive = active;
this.toggleServiceState();
});
- eventHub.$on('testIntegration', () => {
+ eventHub.$on(TEST_INTEGRATION_EVENT, () => {
this.testIntegration();
});
- eventHub.$on('saveIntegration', () => {
+ eventHub.$on(SAVE_INTEGRATION_EVENT, () => {
this.saveIntegration();
});
- eventHub.$on('getJiraIssueTypes', () => {
+ eventHub.$on(GET_JIRA_ISSUE_TYPES_EVENT, () => {
this.getJiraIssueTypes(new FormData(this.$form));
});
-
- eventHub.$emit('formInitialized');
}
saveIntegration() {
@@ -52,7 +57,7 @@ export default class IntegrationSettingsForm {
this.$form.submit();
}, 100);
} else {
- eventHub.$emit('validateForm');
+ eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
this.vue.$store.dispatch('setIsSaving', false);
}
}
@@ -66,7 +71,7 @@ export default class IntegrationSettingsForm {
if (this.$form.checkValidity()) {
this.testSettings(new FormData(this.$form));
} else {
- eventHub.$emit('validateForm');
+ eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
this.vue.$store.dispatch('setIsTesting', false);
}
}
@@ -106,7 +111,7 @@ export default class IntegrationSettingsForm {
},
}) => {
if (error || !issuetypes?.length) {
- eventHub.$emit('validateForm');
+ eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
throw new Error(message);
}