Commit df160d9f authored by Michael Kozono's avatar Michael Kozono

Merge branch 'justin_ho-remove-integration_form_refactor-feature-flag' into 'master'

Remove integration_form_refactor feature flag

See merge request gitlab-org/gitlab!37160
parents 4eeb6114 5df6628a
<script>
import { mapGetters } from 'vuex';
import eventHub from '../event_hub';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { GlFormGroup, GlToggle } from '@gitlab/ui';
export default {
......@@ -10,7 +9,6 @@ export default {
GlFormGroup,
GlToggle,
},
mixins: [glFeatureFlagsMixin()],
props: {
initialActivated: {
type: Boolean,
......@@ -40,28 +38,13 @@ export default {
</script>
<template>
<div v-if="glFeatures.integrationFormRefactor">
<gl-form-group :label="__('Enable integration')" label-for="service[active]">
<gl-toggle
v-model="activated"
name="service[active]"
class="gl-display-block gl-line-height-0"
:disabled="isInheriting"
@change="onToggle"
/>
</gl-form-group>
</div>
<div v-else>
<div class="form-group row" role="group">
<label for="service[active]" class="col-form-label col-sm-2">{{ __('Active') }}</label>
<div class="col-sm-10 pt-1">
<gl-toggle
v-model="activated"
name="service[active]"
:disabled="isInheriting"
@change="onToggle"
/>
</div>
</div>
</div>
<gl-form-group :label="__('Enable integration')" label-for="service[active]">
<gl-toggle
v-model="activated"
name="service[active]"
class="gl-display-block gl-line-height-0"
:disabled="isInheriting"
@change="onToggle"
/>
</gl-form-group>
</template>
<script>
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { mapGetters } from 'vuex';
import { s__ } from '~/locale';
import { GlFormGroup, GlFormCheckbox, GlFormRadio } from '@gitlab/ui';
......@@ -26,7 +25,6 @@ export default {
GlFormCheckbox,
GlFormRadio,
},
mixins: [glFeatureFlagsMixin()],
props: {
initialTriggerCommit: {
type: Boolean,
......@@ -65,7 +63,7 @@ export default {
</script>
<template>
<div v-if="glFeatures.integrationFormRefactor">
<div>
<gl-form-group
:label="__('Trigger')"
label-for="service[trigger]"
......@@ -130,73 +128,4 @@ export default {
</gl-form-radio>
</gl-form-group>
</div>
<div v-else class="form-group row pt-2" role="group">
<label for="service[trigger]" class="col-form-label col-sm-2 pt-0">{{ __('Trigger') }}</label>
<div class="col-sm-10">
<label class="weight-normal mb-2">
{{
s__(
'Integrations|When a Jira issue is mentioned in a commit or merge request a remote link and comment (if enabled) will be created.',
)
}}
</label>
<input name="service[commit_events]" type="hidden" :value="triggerCommit || false" />
<gl-form-checkbox v-model="triggerCommit" :disabled="isInheriting">
{{ __('Commit') }}
</gl-form-checkbox>
<input
name="service[merge_requests_events]"
type="hidden"
:value="triggerMergeRequest || false"
/>
<gl-form-checkbox v-model="triggerMergeRequest" :disabled="isInheriting">
{{ __('Merge request') }}
</gl-form-checkbox>
<div
v-show="triggerCommit || triggerMergeRequest"
class="mt-4"
data-testid="comment-settings"
>
<label>
{{ s__('Integrations|Comment settings:') }}
</label>
<input
name="service[comment_on_event_enabled]"
type="hidden"
:value="enableComments || false"
/>
<gl-form-checkbox v-model="enableComments" :disabled="isInheriting">
{{ s__('Integrations|Enable comments') }}
</gl-form-checkbox>
<div v-show="enableComments" class="mt-4" data-testid="comment-detail">
<label>
{{ s__('Integrations|Comment detail:') }}
</label>
<input
v-if="isInheriting"
name="service[comment_detail]"
type="hidden"
:value="commentDetail"
/>
<gl-form-radio
v-for="commentDetailOption in commentDetailOptions"
:key="commentDetailOption.value"
v-model="commentDetail"
:value="commentDetailOption.value"
:disabled="isInheriting"
>
{{ commentDetailOption.label }}
<template #help>
{{ commentDetailOption.help }}
</template>
</gl-form-radio>
</div>
</div>
</div>
</div>
</template>
......@@ -5,9 +5,6 @@ class Admin::ServicesController < Admin::ApplicationController
before_action :service, only: [:edit, :update]
before_action :whitelist_query_limiting, only: [:index]
before_action only: :edit do
push_frontend_feature_flag(:integration_form_refactor, default_enabled: true)
end
def index
@services = Service.find_or_create_templates.sort_by(&:title)
......
......@@ -8,9 +8,6 @@ module IntegrationsActions
before_action :not_found, unless: :integrations_enabled?
before_action :integration, only: [:edit, :update, :test]
before_action only: :edit do
push_frontend_feature_flag(:integration_form_refactor, default_enabled: true)
end
end
def edit
......
......@@ -12,7 +12,6 @@ class Projects::ServicesController < Projects::ApplicationController
before_action :set_deprecation_notice_for_prometheus_service, only: [:edit, :update]
before_action :redirect_deprecated_prometheus_service, only: [:update]
before_action only: :edit do
push_frontend_feature_flag(:integration_form_refactor, default_enabled: true)
push_frontend_feature_flag(:jira_issues_integration, @project, { default_enabled: true })
end
......
......@@ -35,19 +35,6 @@ module ServicesHelper
"#{event}_events"
end
def service_event_action_field_name(action)
"#{action}_on_event_enabled"
end
def event_action_title(action)
case action
when "comment"
s_("ProjectService|Comment")
else
action.humanize
end
end
def service_save_button(disabled: false)
button_tag(class: 'btn btn-success', type: 'submit', disabled: disabled, data: { qa_selector: 'save_changes_button' }) do
icon('spinner spin', class: 'hidden js-btn-spinner') +
......@@ -95,10 +82,6 @@ module ServicesHelper
end
end
def integration_form_refactor?
Feature.enabled?(:integration_form_refactor, @project, default_enabled: true)
end
def integration_form_data(integration)
{
id: integration.id,
......@@ -116,23 +99,13 @@ module ServicesHelper
end
def trigger_events_for_service(integration)
return [] unless integration_form_refactor?
ServiceEventSerializer.new(service: integration).represent(integration.configurable_events).to_json
end
def fields_for_service(integration)
return [] unless integration_form_refactor?
ServiceFieldSerializer.new(service: integration).represent(integration.global_fields).to_json
end
def show_service_trigger_events?(integration)
return false if integration.is_a?(JiraService) || integration_form_refactor?
integration.configurable_events.present?
end
def project_jira_issues_integration?
false
end
......
- name = field[:name]
- title = field[:title] || name.humanize
- value = @service.send(name)
- type = field[:type]
- placeholder = field[:placeholder]
- autocomplete = field[:autocomplete]
- required = field[:required]
- choices = field[:choices]
- default_choice = field[:default_choice]
- help = field[:help]
.form-group.row
- if type == "password" && value.present?
= form.label name, _("Enter new %{field_title}") % { field_title: title.downcase }, class: "col-form-label col-sm-2"
- else
= form.label name, title, class: "col-form-label col-sm-2"
.col-sm-10
- if type == 'text'
= form.text_field name, class: "form-control", autocomplete: autocomplete, placeholder: placeholder, required: required, data: { qa_selector: "#{name.downcase.gsub('\s', '')}_field" }
- elsif type == 'textarea'
= form.text_area name, rows: 5, class: "form-control", placeholder: placeholder, required: required
- elsif type == 'checkbox'
= form.check_box name
- elsif type == 'select'
= form.select name, options_for_select(choices, value || default_choice), {}, { class: "form-control"}
- elsif type == 'password'
= form.password_field name, autocomplete: "new-password", placeholder: placeholder, class: "form-control", required: value.blank? && required, data: { qa_selector: "#{name.downcase.gsub('\s', '')}_field" }
- if help
%span.form-text.text-muted= help
......@@ -11,28 +11,3 @@
- if @admin_integration
.js-vue-admin-integration-settings{ data: integration_form_data(@admin_integration) }
.js-vue-integration-settings{ data: integration_form_data(integration) }
- if show_service_trigger_events?(integration)
.form-group.row
%label.col-form-label.col-sm-2= _('Trigger')
.col-sm-10
- integration.configurable_events.each do |event|
.form-group
.form-check
= form.check_box service_event_field_name(event), class: 'form-check-input'
= form.label service_event_field_name(event), class: 'form-check-label' do
%strong
= event.humanize
- field = integration.event_field(event)
- if field
= form.text_field field[:name], class: "form-control", placeholder: field[:placeholder]
%p.text-muted
= integration.class.event_description(event)
- unless integration_form_refactor?
- integration.global_fields.each do |field|
= render 'shared/field', form: form, field: field
......@@ -18313,9 +18313,6 @@ msgstr ""
msgid "ProjectService|%{service_title}: status on"
msgstr ""
msgid "ProjectService|Comment"
msgstr ""
msgid "ProjectService|Event will be triggered by a push to the repository"
msgstr ""
......
......@@ -7,11 +7,11 @@ module QA
module Settings
module Services
class Jenkins < QA::Page::Base
view 'app/views/shared/_field.html.haml' do
element :jenkins_url_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern
element :project_name_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern
element :username_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern
element :password_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern
view 'app/assets/javascripts/integrations/edit/components/dynamic_field.vue' do
element :jenkins_url_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern
element :project_name_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern
element :username_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern
element :password_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern
end
view 'app/helpers/services_helper.rb' do
......
......@@ -3,11 +3,6 @@
require 'spec_helper'
RSpec.describe ServicesHelper do
describe 'event_action_title' do
it { expect(event_action_title('comment')).to eq 'Comment' }
it { expect(event_action_title('something')).to eq 'Something' }
end
describe '#integration_form_data' do
subject { helper.integration_form_data(integration) }
......
......@@ -7,8 +7,6 @@ RSpec.describe 'projects/services/_form' do
let(:user) { create(:admin) }
before do
stub_feature_flags(integration_form_refactor: false)
assign(:project, project)
allow(controller).to receive(:current_user).and_return(user)
......@@ -29,8 +27,6 @@ RSpec.describe 'projects/services/_form' do
render
expect(rendered).to have_content('Event will be triggered when a commit is created/updated')
expect(rendered).to have_content('Event will be triggered when a merge request is created/updated/merged')
expect(rendered).to have_css("input[name='redirect_to'][value='/services']", count: 1, visible: false)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment