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-06-03 21:08:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-03 21:08:54 +0300
commit27484d14658e92177e059ef905e9562c71ad9a3f (patch)
tree085e2a2720796fab97079e964ddf18ce391ad5f1 /app/assets/javascripts/integrations
parentf5f6cb45c73c8aa059c3006a3696014522a41a4b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/integrations')
-rw-r--r--app/assets/javascripts/integrations/constants.js34
-rw-r--r--app/assets/javascripts/integrations/edit/components/integration_form.vue4
-rw-r--r--app/assets/javascripts/integrations/edit/components/sections/trigger.vue26
-rw-r--r--app/assets/javascripts/integrations/edit/components/trigger_field.vue46
-rw-r--r--app/assets/javascripts/integrations/edit/index.js2
5 files changed, 111 insertions, 1 deletions
diff --git a/app/assets/javascripts/integrations/constants.js b/app/assets/javascripts/integrations/constants.js
index b9975eed716..87e9f818f96 100644
--- a/app/assets/javascripts/integrations/constants.js
+++ b/app/assets/javascripts/integrations/constants.js
@@ -30,12 +30,46 @@ export const integrationFormSections = {
CONNECTION: 'connection',
JIRA_TRIGGER: 'jira_trigger',
JIRA_ISSUES: 'jira_issues',
+ TRIGGER: 'trigger',
};
export const integrationFormSectionComponents = {
[integrationFormSections.CONNECTION]: 'IntegrationSectionConnection',
[integrationFormSections.JIRA_TRIGGER]: 'IntegrationSectionJiraTrigger',
[integrationFormSections.JIRA_ISSUES]: 'IntegrationSectionJiraIssues',
+ [integrationFormSections.TRIGGER]: 'IntegrationSectionTrigger',
+};
+
+export const integrationTriggerEvents = {
+ PUSH: 'push_events',
+ ISSUE: 'issues_events',
+ CONFIDENTIAL_ISSUE: 'confidential_issues_events',
+ MERGE_REQUEST: 'merge_requests_events',
+ NOTE: 'note_events',
+ CONFIDENTIAL_NOTE: 'confidential_note_events',
+ TAG_PUSH: 'tag_push_events',
+ PIPELINE: 'pipeline_events',
+ WIKI_PAGE: 'wiki_page_events',
+};
+
+export const integrationTriggerEventTitles = {
+ [integrationTriggerEvents.PUSH]: s__('IntegrationEvents|A push is made to the repository'),
+ [integrationTriggerEvents.ISSUE]: s__(
+ 'IntegrationEvents|An issue is created, updated, or closed',
+ ),
+ [integrationTriggerEvents.CONFIDENTIAL_ISSUE]: s__(
+ 'IntegrationEvents|A confidential issue is created, updated, or closed',
+ ),
+ [integrationTriggerEvents.MERGE_REQUEST]: s__(
+ 'IntegrationEvents|A merge request is created, updated, or merged',
+ ),
+ [integrationTriggerEvents.NOTE]: s__('IntegrationEvents|A comment is added on an issue'),
+ [integrationTriggerEvents.CONFIDENTIAL_NOTE]: s__(
+ 'IntegrationEvents|A comment is added on a confidential issue',
+ ),
+ [integrationTriggerEvents.TAG_PUSH]: s__('IntegrationEvents|A tag is pushed to the repository'),
+ [integrationTriggerEvents.PIPELINE]: s__('IntegrationEvents|A pipeline status changes'),
+ [integrationTriggerEvents.WIKI_PAGE]: s__('IntegrationEvents|A wiki page is created or updated'),
};
export const billingPlans = {
diff --git a/app/assets/javascripts/integrations/edit/components/integration_form.vue b/app/assets/javascripts/integrations/edit/components/integration_form.vue
index 9f43360fb73..f751dc6c7a1 100644
--- a/app/assets/javascripts/integrations/edit/components/integration_form.vue
+++ b/app/assets/javascripts/integrations/edit/components/integration_form.vue
@@ -49,6 +49,10 @@ export default {
import(
/* webpackChunkName: 'integrationSectionJiraTrigger' */ '~/integrations/edit/components/sections/jira_trigger.vue'
),
+ IntegrationSectionTrigger: () =>
+ import(
+ /* webpackChunkName: 'integrationSectionTrigger' */ '~/integrations/edit/components/sections/trigger.vue'
+ ),
GlBadge,
GlButton,
GlForm,
diff --git a/app/assets/javascripts/integrations/edit/components/sections/trigger.vue b/app/assets/javascripts/integrations/edit/components/sections/trigger.vue
new file mode 100644
index 00000000000..9af5070d4cf
--- /dev/null
+++ b/app/assets/javascripts/integrations/edit/components/sections/trigger.vue
@@ -0,0 +1,26 @@
+<script>
+import { mapGetters } from 'vuex';
+
+import TriggerField from '../trigger_field.vue';
+
+export default {
+ name: 'IntegrationSectionTrigger',
+ components: {
+ TriggerField,
+ },
+ computed: {
+ ...mapGetters(['currentKey', 'propsSource']),
+ },
+};
+</script>
+
+<template>
+ <div>
+ <trigger-field
+ v-for="event in propsSource.triggerEvents"
+ :key="`${currentKey}-trigger-fields-${event.name}`"
+ :event="event"
+ class="gl-mb-3"
+ />
+ </div>
+</template>
diff --git a/app/assets/javascripts/integrations/edit/components/trigger_field.vue b/app/assets/javascripts/integrations/edit/components/trigger_field.vue
new file mode 100644
index 00000000000..dc5ae2f3a3d
--- /dev/null
+++ b/app/assets/javascripts/integrations/edit/components/trigger_field.vue
@@ -0,0 +1,46 @@
+<script>
+import { GlFormCheckbox } from '@gitlab/ui';
+import { mapGetters } from 'vuex';
+
+import { integrationTriggerEventTitles } from '~/integrations/constants';
+
+export default {
+ name: 'TriggerField',
+ components: {
+ GlFormCheckbox,
+ },
+ props: {
+ event: {
+ type: Object,
+ required: false,
+ default: () => ({}),
+ },
+ },
+ data() {
+ return {
+ value: false,
+ };
+ },
+ computed: {
+ ...mapGetters(['isInheriting']),
+ name() {
+ return `service[${this.event.name}]`;
+ },
+ title() {
+ return integrationTriggerEventTitles[this.event.name];
+ },
+ },
+ mounted() {
+ this.value = this.event.value || false;
+ },
+};
+</script>
+
+<template>
+ <div>
+ <input :name="name" type="hidden" :value="value" />
+ <gl-form-checkbox v-model="value" :disabled="isInheriting">
+ {{ title }}
+ </gl-form-checkbox>
+ </div>
+</template>
diff --git a/app/assets/javascripts/integrations/edit/index.js b/app/assets/javascripts/integrations/edit/index.js
index 69097ecb8ab..2360588ab39 100644
--- a/app/assets/javascripts/integrations/edit/index.js
+++ b/app/assets/javascripts/integrations/edit/index.js
@@ -83,7 +83,7 @@ function parseDatasetToProps(data) {
learnMorePath,
aboutPricingUrl,
triggerEvents: JSON.parse(triggerEvents),
- sections: JSON.parse(sections, { deep: true }),
+ sections: JSON.parse(sections),
fields: convertObjectPropsToCamelCase(JSON.parse(fields), { deep: true }),
inheritFromId: parseInt(inheritFromId, 10),
integrationLevel,