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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-21 00:14:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-21 00:14:18 +0300
commit76365117183054e95bbb2f3a6392ac333628eacf (patch)
tree579d45ed571d5f65ae0966e2b2badf91cb430cb1 /app/assets/javascripts/integrations
parent39cb2fdf01699eb5ac000c918f469c58dc75f7e8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/integrations')
-rw-r--r--app/assets/javascripts/integrations/constants.js2
-rw-r--r--app/assets/javascripts/integrations/edit/components/dynamic_field.vue19
-rw-r--r--app/assets/javascripts/integrations/edit/components/integration_form.vue17
-rw-r--r--app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue21
-rw-r--r--app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue19
-rw-r--r--app/assets/javascripts/integrations/edit/event_hub.js3
-rw-r--r--app/assets/javascripts/integrations/edit/store/actions.js3
-rw-r--r--app/assets/javascripts/integrations/edit/store/mutation_types.js4
8 files changed, 29 insertions, 59 deletions
diff --git a/app/assets/javascripts/integrations/constants.js b/app/assets/javascripts/integrations/constants.js
index b90658fb13c..b26f6bdd370 100644
--- a/app/assets/javascripts/integrations/constants.js
+++ b/app/assets/javascripts/integrations/constants.js
@@ -1,7 +1,5 @@
import { s__, __ } from '~/locale';
-export const VALIDATE_INTEGRATION_FORM_EVENT = 'validateIntegrationForm';
-
export const integrationLevels = {
GROUP: 'group',
INSTANCE: 'instance',
diff --git a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
index 4b0579a5beb..b4ceec22822 100644
--- a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
+++ b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
@@ -9,8 +9,6 @@ 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 {
name: 'DynamicField',
@@ -70,11 +68,15 @@ export default {
required: false,
default: null,
},
+ isValidated: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
},
data() {
return {
model: this.value,
- validated: false,
};
},
computed: {
@@ -123,22 +125,13 @@ export default {
};
},
valid() {
- return !this.required || !isEmpty(this.model) || this.isNonEmptyPassword || !this.validated;
+ return !this.required || !isEmpty(this.model) || this.isNonEmptyPassword || !this.isValidated;
},
},
created() {
if (this.isNonEmptyPassword) {
this.model = null;
}
- eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
- },
- beforeDestroy() {
- eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
- },
- methods: {
- validateForm() {
- this.validated = true;
- },
},
helpHtmlConfig: {
ADD_ATTR: ['target'], // allow external links, can be removed after https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1427 is implemented
diff --git a/app/assets/javascripts/integrations/edit/components/integration_form.vue b/app/assets/javascripts/integrations/edit/components/integration_form.vue
index c3cc35adfa5..dcdb38d94c8 100644
--- a/app/assets/javascripts/integrations/edit/components/integration_form.vue
+++ b/app/assets/javascripts/integrations/edit/components/integration_form.vue
@@ -5,7 +5,6 @@ import * as Sentry from '@sentry/browser';
import { mapState, mapActions, mapGetters } from 'vuex';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import {
- VALIDATE_INTEGRATION_FORM_EVENT,
I18N_FETCH_TEST_SETTINGS_DEFAULT_ERROR_MESSAGE,
I18N_DEFAULT_ERROR_MESSAGE,
I18N_SUCCESSFUL_CONNECTION_MESSAGE,
@@ -14,7 +13,6 @@ import {
} from '~/integrations/constants';
import { refreshCurrentPage } from '~/lib/utils/url_utility';
import csrf from '~/lib/utils/csrf';
-import eventHub from '../event_hub';
import { testIntegrationSettings } from '../api';
import ActiveCheckbox from './active_checkbox.vue';
import ConfirmationModal from './confirmation_modal.vue';
@@ -57,6 +55,7 @@ export default {
isTesting: false,
isSaving: false,
isResetting: false,
+ isValidated: false,
};
},
computed: {
@@ -107,13 +106,16 @@ export default {
: document.querySelector(INTEGRATION_FORM_SELECTOR);
},
methods: {
- ...mapActions(['setOverride', 'fetchResetIntegration', 'requestJiraIssueTypes']),
+ ...mapActions(['setOverride', 'requestJiraIssueTypes']),
+ setIsValidated() {
+ this.isValidated = true;
+ },
onSaveClick() {
this.isSaving = true;
if (this.integrationActive && !this.form.checkValidity()) {
this.isSaving = false;
- eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
+ this.setIsValidated();
return;
}
@@ -123,14 +125,14 @@ export default {
this.isTesting = true;
if (!this.form.checkValidity()) {
- eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
+ this.setIsValidated();
return;
}
testIntegrationSettings(this.propsSource.testPath, this.getFormData())
.then(({ data: { error, message = I18N_FETCH_TEST_SETTINGS_DEFAULT_ERROR_MESSAGE } }) => {
if (error) {
- eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
+ this.setIsValidated();
this.$toast.show(message);
return;
}
@@ -227,6 +229,7 @@ export default {
v-if="isJira"
:key="`${currentKey}-jira-trigger-fields`"
v-bind="propsSource.triggerFieldsProps"
+ :is-validated="isValidated"
/>
<trigger-fields
v-else-if="propsSource.triggerEvents.length"
@@ -238,11 +241,13 @@ export default {
v-for="field in propsSource.fields"
:key="`${currentKey}-${field.name}`"
v-bind="field"
+ :is-validated="isValidated"
/>
<jira-issues-fields
v-if="isJira && !isInstanceOrGroupLevel"
:key="`${currentKey}-jira-issues-fields`"
v-bind="propsSource.jiraIssuesProps"
+ :is-validated="isValidated"
@request-jira-issue-types="onRequestJiraIssueTypes"
/>
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 99498501f6c..7f2f7620a86 100644
--- a/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue
+++ b/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue
@@ -1,9 +1,7 @@
<script>
import { GlFormGroup, GlFormCheckbox, GlFormInput, GlSprintf, GlLink } from '@gitlab/ui';
import { mapGetters } from 'vuex';
-import { VALIDATE_INTEGRATION_FORM_EVENT } from '~/integrations/constants';
import { s__, __ } from '~/locale';
-import eventHub from '../event_hub';
import JiraUpgradeCta from './jira_upgrade_cta.vue';
export default {
@@ -64,29 +62,22 @@ export default {
required: false,
default: '',
},
+ isValidated: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
},
data() {
return {
enableJiraIssues: this.initialEnableJiraIssues,
projectKey: this.initialProjectKey,
- validated: false,
};
},
computed: {
...mapGetters(['isInheriting']),
validProjectKey() {
- return !this.enableJiraIssues || Boolean(this.projectKey) || !this.validated;
- },
- },
- created() {
- eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
- },
- beforeDestroy() {
- eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
- },
- methods: {
- validateForm() {
- this.validated = true;
+ return !this.enableJiraIssues || Boolean(this.projectKey) || !this.isValidated;
},
},
i18n: {
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 249a3e105b1..df5946b814a 100644
--- a/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue
+++ b/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue
@@ -9,9 +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';
const commentDetailOptions = [
{
@@ -92,10 +90,14 @@ export default {
required: false,
default: '',
},
+ isValidated: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
},
data() {
return {
- validated: false,
triggerCommit: this.initialTriggerCommit,
triggerMergeRequest: this.initialTriggerMergeRequest,
enableComments: this.initialEnableComments,
@@ -115,19 +117,10 @@ export default {
return this.triggerCommit || this.triggerMergeRequest;
},
validIssueTransitionId() {
- return !this.validated || Boolean(this.jiraIssueTransitionId);
+ return !this.isValidated || Boolean(this.jiraIssueTransitionId);
},
},
- created() {
- eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
- },
- beforeDestroy() {
- eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
- },
methods: {
- validateForm() {
- this.validated = true;
- },
showCustomIssueTransitions(currentOption) {
return (
this.jiraIssueTransitionAutomatic === ISSUE_TRANSITION_CUSTOM &&
diff --git a/app/assets/javascripts/integrations/edit/event_hub.js b/app/assets/javascripts/integrations/edit/event_hub.js
deleted file mode 100644
index e31806ad199..00000000000
--- a/app/assets/javascripts/integrations/edit/event_hub.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import createEventHub from '~/helpers/event_hub_factory';
-
-export default createEventHub();
diff --git a/app/assets/javascripts/integrations/edit/store/actions.js b/app/assets/javascripts/integrations/edit/store/actions.js
index 1398b710d1d..d31d3eb9d82 100644
--- a/app/assets/javascripts/integrations/edit/store/actions.js
+++ b/app/assets/javascripts/integrations/edit/store/actions.js
@@ -1,10 +1,8 @@
import {
- VALIDATE_INTEGRATION_FORM_EVENT,
I18N_FETCH_TEST_SETTINGS_DEFAULT_ERROR_MESSAGE,
I18N_DEFAULT_ERROR_MESSAGE,
} from '~/integrations/constants';
import { testIntegrationSettings } from '../api';
-import eventHub from '../event_hub';
import * as types from './mutation_types';
export const setOverride = ({ commit }, override) => commit(types.SET_OVERRIDE, override);
@@ -19,7 +17,6 @@ export const requestJiraIssueTypes = ({ commit, dispatch, getters }, formData) =
data: { issuetypes, error, message = I18N_FETCH_TEST_SETTINGS_DEFAULT_ERROR_MESSAGE },
}) => {
if (error || !issuetypes?.length) {
- eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
throw new Error(message);
}
diff --git a/app/assets/javascripts/integrations/edit/store/mutation_types.js b/app/assets/javascripts/integrations/edit/store/mutation_types.js
index ddf6bef7554..eb74b0b1c73 100644
--- a/app/assets/javascripts/integrations/edit/store/mutation_types.js
+++ b/app/assets/javascripts/integrations/edit/store/mutation_types.js
@@ -1,9 +1,5 @@
export const SET_OVERRIDE = 'SET_OVERRIDE';
-export const SET_IS_RESETTING = 'SET_IS_RESETTING';
export const SET_IS_LOADING_JIRA_ISSUE_TYPES = 'SET_IS_LOADING_JIRA_ISSUE_TYPES';
export const SET_JIRA_ISSUE_TYPES_ERROR_MESSAGE = 'SET_JIRA_ISSUE_TYPES_ERROR_MESSAGE';
export const SET_JIRA_ISSUE_TYPES = 'SET_JIRA_ISSUE_TYPES';
-
-export const REQUEST_RESET_INTEGRATION = 'REQUEST_RESET_INTEGRATION';
-export const RECEIVE_RESET_INTEGRATION_ERROR = 'RECEIVE_RESET_INTEGRATION_ERROR';