debian-mirror-gitlab/app/views/ci/variables/_variable_row.html.haml

65 lines
3.9 KiB
Text
Raw Normal View History

2018-03-17 18:26:18 +05:30
- form_field = local_assigns.fetch(:form_field, nil)
- variable = local_assigns.fetch(:variable, nil)
- only_key_value = local_assigns.fetch(:only_key_value, false)
- id = variable&.id
2019-07-31 22:56:46 +05:30
- variable_type = variable&.variable_type
2018-03-17 18:26:18 +05:30
- key = variable&.key
- value = variable&.value
2019-02-15 15:39:39 +05:30
- is_protected_default = ci_variable_protected_by_default?
- is_protected = ci_variable_protected?(variable, only_key_value)
2019-09-04 21:01:54 +05:30
- is_masked_default = false
2019-07-07 11:18:12 +05:30
- is_masked = ci_variable_masked?(variable, only_key_value)
2018-03-17 18:26:18 +05:30
- id_input_name = "#{form_field}[variables_attributes][][id]"
- destroy_input_name = "#{form_field}[variables_attributes][][_destroy]"
2019-07-31 22:56:46 +05:30
- variable_type_input_name = "#{form_field}[variables_attributes][][variable_type]"
2018-03-17 18:26:18 +05:30
- key_input_name = "#{form_field}[variables_attributes][][key]"
2018-05-09 12:01:36 +05:30
- value_input_name = "#{form_field}[variables_attributes][][secret_value]"
2018-03-17 18:26:18 +05:30
- protected_input_name = "#{form_field}[variables_attributes][][protected]"
2019-07-07 11:18:12 +05:30
- masked_input_name = "#{form_field}[variables_attributes][][masked]"
2018-03-17 18:26:18 +05:30
%li.js-row.ci-variable-row{ data: { is_persisted: "#{!id.nil?}" } }
2019-07-31 22:56:46 +05:30
.ci-variable-row-body.border-bottom
2018-03-17 18:26:18 +05:30
%input.js-ci-variable-input-id{ type: "hidden", name: id_input_name, value: id }
%input.js-ci-variable-input-destroy{ type: "hidden", name: destroy_input_name }
2019-07-31 22:56:46 +05:30
%select.js-ci-variable-input-variable-type.ci-variable-body-item.form-control.select-control.custom-select.table-section.section-15{ name: variable_type_input_name }
= options_for_select(ci_variable_type_options, variable_type)
2021-04-29 21:17:54 +05:30
%input.js-ci-variable-input-key.ci-variable-body-item.qa-ci-variable-input-key.form-control.gl-form-input.table-section.section-15{ type: "text",
2018-03-17 18:26:18 +05:30
name: key_input_name,
value: key,
placeholder: s_('CiVariables|Input variable key') }
2019-07-31 22:56:46 +05:30
.ci-variable-body-item.gl-show-field-errors.table-section.section-15.border-top-0.p-0
2019-12-21 20:55:43 +05:30
.form-control.js-secret-value-placeholder.qa-ci-variable-input-value.overflow-hidden{ class: ('hide' unless id) }
2019-07-31 22:56:46 +05:30
= '*' * 17
2021-04-29 21:17:54 +05:30
%textarea.js-ci-variable-input-value.js-secret-value.qa-ci-variable-input-value.form-control.gl-form-input{ class: ('hide' if id),
2018-03-17 18:26:18 +05:30
rows: 1,
name: value_input_name,
placeholder: s_('CiVariables|Input variable value') }
= value
2019-07-31 22:56:46 +05:30
%p.masking-validation-error.gl-field-error.hide
= s_("CiVariables|Cannot use Masked Variable with current value")
2021-04-29 21:17:54 +05:30
= link_to sprite_icon('question-o'), help_page_path('ci/variables/README', anchor: 'mask-a-cicd-variable'), target: '_blank', rel: 'noopener noreferrer'
2018-03-17 18:26:18 +05:30
- unless only_key_value
2019-07-31 22:56:46 +05:30
.ci-variable-body-item.ci-variable-protected-item.table-section.section-20.mr-0.border-top-0
2020-07-28 23:09:34 +05:30
.gl-mr-3
2018-03-17 18:26:18 +05:30
= s_("CiVariable|Protected")
2020-01-01 13:55:28 +05:30
= render "shared/buttons/project_feature_toggle", is_checked: is_protected, label: s_("CiVariable|Toggle protected") do
2018-03-17 18:26:18 +05:30
%input{ type: "hidden",
class: 'js-ci-variable-input-protected js-project-feature-toggle-input',
name: protected_input_name,
2019-02-15 15:39:39 +05:30
value: is_protected,
data: { default: is_protected_default.to_s } }
2019-07-31 22:56:46 +05:30
.ci-variable-body-item.ci-variable-masked-item.table-section.section-20.mr-0.border-top-0
2020-07-28 23:09:34 +05:30
.gl-mr-3
2019-07-07 11:18:12 +05:30
= s_("CiVariable|Masked")
2020-01-01 13:55:28 +05:30
= render "shared/buttons/project_feature_toggle", is_checked: is_masked, label: s_("CiVariable|Toggle masked"), class_list: "js-project-feature-toggle project-feature-toggle qa-variable-masked" do
2019-07-07 11:18:12 +05:30
%input{ type: "hidden",
class: 'js-ci-variable-input-masked js-project-feature-toggle-input',
name: masked_input_name,
value: is_masked,
data: { default: is_masked_default.to_s } }
2018-11-08 19:23:39 +05:30
= render_if_exists 'ci/variables/environment_scope', form_field: form_field, variable: variable
2021-04-29 21:17:54 +05:30
%button.gl-button.btn.btn-default.btn-icon.js-row-remove-button.ci-variable-row-remove-button.table-section{ type: 'button', 'aria-label': s_('CiVariables|Remove variable row') }
2020-10-24 23:57:45 +05:30
= sprite_icon('close')