Commit 96825378 authored by Justin Ho's avatar Justin Ho

Hide old form when feature flag is enabled

Add checkbox titles to fix spec
parent c976e8d3
<script> <script>
import { startCase, isEmpty } from 'lodash'; import { capitalize, lowerCase, isEmpty } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import { GlFormGroup, GlFormCheckbox, GlFormInput, GlFormSelect, GlFormTextarea } from '@gitlab/ui'; import { GlFormGroup, GlFormCheckbox, GlFormInput, GlFormSelect, GlFormTextarea } from '@gitlab/ui';
...@@ -73,14 +73,15 @@ export default { ...@@ -73,14 +73,15 @@ export default {
return this.isPassword && !isEmpty(this.value); return this.isPassword && !isEmpty(this.value);
}, },
label() { label() {
const title = this.title || startCase(this.name);
if (this.isNonEmptyPassword) { if (this.isNonEmptyPassword) {
return sprintf(__('Enter new %{field_title}'), { return sprintf(__('Enter new %{field_title}'), {
password: title, field_title: this.humanizedTitle,
}); });
} }
return title; return this.humanizedTitle;
},
humanizedTitle() {
return this.title || capitalize(lowerCase(this.name));
}, },
passwordRequired() { passwordRequired() {
return isEmpty(this.value) && this.required; return isEmpty(this.value) && this.required;
...@@ -118,7 +119,9 @@ export default { ...@@ -118,7 +119,9 @@ export default {
<gl-form-group :label="label" :label-for="fieldId" :description="help"> <gl-form-group :label="label" :label-for="fieldId" :description="help">
<template v-if="isCheckbox"> <template v-if="isCheckbox">
<input :name="fieldName" type="hidden" value="false" /> <input :name="fieldName" type="hidden" value="false" />
<gl-form-checkbox v-model="model" v-bind="sharedProps" /> <gl-form-checkbox v-model="model" v-bind="sharedProps">
{{ humanizedTitle }}
</gl-form-checkbox>
</template> </template>
<gl-form-select v-else-if="isSelect" v-model="model" v-bind="sharedProps" :options="options" /> <gl-form-select v-else-if="isSelect" v-model="model" v-bind="sharedProps" :options="options" />
<gl-form-textarea <gl-form-textarea
......
...@@ -34,5 +34,6 @@ commit_events: @service.commit_events.to_s, enable_comments: @service.comment_on ...@@ -34,5 +34,6 @@ commit_events: @service.commit_events.to_s, enable_comments: @service.comment_on
%p.text-muted %p.text-muted
= @service.class.event_description(event) = @service.class.event_description(event)
- @service.global_fields.each do |field| - if Feature.disabled?(:integration_form_refactor)
= render 'shared/field', form: form, field: field - @service.global_fields.each do |field|
= render 'shared/field', form: form, field: field
...@@ -6,6 +6,8 @@ describe 'Admin activates Prometheus' do ...@@ -6,6 +6,8 @@ describe 'Admin activates Prometheus' do
let(:admin) { create(:user, :admin) } let(:admin) { create(:user, :admin) }
before do before do
stub_feature_flags(integration_form_refactor: false)
sign_in(admin) sign_in(admin)
visit(admin_application_settings_services_path) visit(admin_application_settings_services_path)
......
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