Add text input field to trigger_field.vue
requested to merge 384886-support-entering-channels-in-new-integrations-form-trigger-section-frontend into master
What does this MR do and why?
Adds an extra text input field to each trigger for an integration:
- This is used to specify which
channel
should the message be posted on for each trigger. - The field will only show when the trigger is selected.
Note: This is not a user-facing change (yet) since the backend that defines the sections will be added separately.
Screenshots or screen recordings
Old UI (without sections) | New UI (with sections, without field) | New UI (with sections, with field) |
---|---|---|
How to set up and validate locally
- Apply this patch to add sections to the
GitLab for Slack app
integration.
diff --git a/ee/app/helpers/ee/integrations_helper.rb b/ee/app/helpers/ee/integrations_helper.rb
index 5479bea1c883..39b5115ecec0 100644
--- a/ee/app/helpers/ee/integrations_helper.rb
+++ b/ee/app/helpers/ee/integrations_helper.rb
@@ -26,7 +26,7 @@ def integration_form_data(integration, project: nil, group: nil)
if integration.is_a?(::Integrations::GitlabSlackApplication)
form_data[:upgrade_slack_url] = add_to_slack_link(project, slack_app_id)
- form_data[:should_upgrade_slack] = integration.slack_integration.upgrade_needed? ? 'true' : 'false'
+ # form_data[:should_upgrade_slack] = integration.slack_integration.upgrade_needed? ? 'true' : 'false'
end
form_data
diff --git a/ee/app/models/integrations/gitlab_slack_application.rb b/ee/app/models/integrations/gitlab_slack_application.rb
index faf86cfa2511..6dcc972d268e 100644
--- a/ee/app/models/integrations/gitlab_slack_application.rb
+++ b/ee/app/models/integrations/gitlab_slack_application.rb
@@ -53,6 +53,7 @@ def testable?
# flow has been completed, which causes the integration to become activated/enabled.
override :editable?
def editable?
+ return true
activated? && Feature.enabled?(:integration_slack_app_notifications, project)
end
@@ -63,6 +64,22 @@ def fields
super
end
+ override :sections
+ def sections
+ [
+ {
+ type: SECTION_TYPE_TRIGGER,
+ title: s_('Integrations|Trigger'),
+ description: s_('Integrations|An event will be triggered when one of the following items happen.')
+ },
+ {
+ type: SECTION_TYPE_CONFIGURATION,
+ title: s_('Integrations|Notification settings'),
+ description: s_('Integrations|Configure the scope of notifications.')
+ }
+ ]
+ end
+
override :configurable_events
def configurable_events
return [] unless editable?
- Go to Project > Settings > Integrations > GitLab for Slack app. For example,
http://127.0.0.1:3000/gitlab-org/gitlab-test/-/settings/integrations/gitlab_slack_application/edit
.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #384886 (closed)
Edited by Justin Ho Tuan Duong