Commit c2da7ba0 authored by Scott Hampton's avatar Scott Hampton

Created an admin form for required ci template

Created a form for the user to select an instance template
for CI configuration to require that pipeline to run
after every pipeline on the instance.
parent 3c4bc595
import $ from 'jquery';
export default class CiTemplate {
constructor() {
this.$input = $('#required_template_name');
this.$dropdown = $('.js-ci-template-dropdown');
this.$dropdownToggle = this.$dropdown.find('.dropdown-toggle-text');
this.initDropdown();
}
initDropdown() {
this.$dropdown.glDropdown({
data: this.formatDropdownList(),
selectable: true,
filterable: true,
allowClear: true,
toggleLabel: item => item.name,
search: {
fields: ['name'],
},
clicked: clickEvent => this.updateInputValue(clickEvent),
text: item => item.name,
});
this.setDropdownToggle();
}
formatDropdownList() {
return {
Reset: [
{
name: 'None',
id: '',
},
'divider',
],
...this.$dropdown.data('data'),
};
}
setDropdownToggle() {
const initialValue = this.$input.val();
if (initialValue) {
this.$dropdownToggle.text(initialValue);
}
}
updateInputValue({ selectedObj, e }) {
e.preventDefault();
this.$input.val(selectedObj.id);
}
}
import CiTemplate from './ci_template';
document.addEventListener('DOMContentLoaded', () => new CiTemplate());
= form_for @application_setting, url: admin_application_settings_path(anchor: 'js-required-pipeline-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.form-group
= f.label :shared_runners_text, s_('AdminSettings|Select a pipeline configuration file'), class: 'text-muted'
= dropdown_tag("Select a template", options: { toggle_class: 'js-ci-template-dropdown w-100', title: "Apply a template", filter: true, placeholder: "Filter", data: { data: gitlab_ci_ymls(nil) } } )
= f.text_field :shared_runners_text, value: @application_setting.shared_runners_text, id: 'required_template_name', class: 'hidden'
= f.submit _('Save changes'), class: "btn btn-success"
......@@ -13,6 +13,17 @@
.settings-content
= render 'ci_cd'
%section.settings.as-required-pipeline.no-animate#js-required-pipeline-settings{ class: ('expanded' if expanded_by_default?)}
.settings-header
%h4
= _('Required pipeline configuration')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand')
%p
= ('Set an instance-wide auto included pipeline configuration. This pipeline configuration will be run after the project\'s own configuration.')
.settings-content
= render 'required_pipeline'
- if Gitlab.config.registry.enabled
%section.settings.as-registry.no-animate#js-registry-settings{ class: ('expanded' if expanded_by_default?) }
.settings-header
......
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