2018-01-26 06:25:26 +00:00
|
|
|
- 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-05-06 13:11:42 +00:00
|
|
|
- variable_type = variable&.variable_type
|
2018-01-26 06:25:26 +00:00
|
|
|
- key = variable&.key
|
|
|
|
- value = variable&.value
|
2018-12-04 13:40:47 +00:00
|
|
|
- is_protected_default = ci_variable_protected_by_default?
|
|
|
|
- is_protected = ci_variable_protected?(variable, only_key_value)
|
2019-05-07 19:37:29 +00:00
|
|
|
- is_masked_default = false
|
2019-03-29 15:46:31 +00:00
|
|
|
- is_masked = ci_variable_masked?(variable, only_key_value)
|
2018-01-26 06:25:26 +00:00
|
|
|
|
|
|
|
- id_input_name = "#{form_field}[variables_attributes][][id]"
|
|
|
|
- destroy_input_name = "#{form_field}[variables_attributes][][_destroy]"
|
2019-05-06 13:11:42 +00:00
|
|
|
- variable_type_input_name = "#{form_field}[variables_attributes][][variable_type]"
|
2018-03-22 11:08:16 +00:00
|
|
|
- key_input_name = "#{form_field}[variables_attributes][][key]"
|
2018-03-16 15:59:06 +00:00
|
|
|
- value_input_name = "#{form_field}[variables_attributes][][secret_value]"
|
2018-01-26 06:25:26 +00:00
|
|
|
- protected_input_name = "#{form_field}[variables_attributes][][protected]"
|
2019-03-29 15:46:31 +00:00
|
|
|
- masked_input_name = "#{form_field}[variables_attributes][][masked]"
|
2018-01-26 06:25:26 +00:00
|
|
|
|
|
|
|
%li.js-row.ci-variable-row{ data: { is_persisted: "#{!id.nil?}" } }
|
2019-05-03 11:12:58 +00:00
|
|
|
.ci-variable-row-body.border-bottom
|
2018-01-26 06:25:26 +00:00
|
|
|
%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-05-20 11:52:02 +00:00
|
|
|
%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 }
|
2019-05-06 13:11:42 +00:00
|
|
|
= options_for_select(ci_variable_type_options, variable_type)
|
2021-04-09 18:09:24 +00:00
|
|
|
%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-01-26 06:25:26 +00:00
|
|
|
name: key_input_name,
|
|
|
|
value: key,
|
|
|
|
placeholder: s_('CiVariables|Input variable key') }
|
2019-05-03 11:12:58 +00:00
|
|
|
.ci-variable-body-item.gl-show-field-errors.table-section.section-15.border-top-0.p-0
|
2019-09-25 18:06:17 +00:00
|
|
|
.form-control.js-secret-value-placeholder.qa-ci-variable-input-value.overflow-hidden{ class: ('hide' unless id) }
|
2019-05-03 11:12:58 +00:00
|
|
|
= '*' * 17
|
2021-04-09 18:09:24 +00:00
|
|
|
%textarea.js-ci-variable-input-value.js-secret-value.qa-ci-variable-input-value.form-control.gl-form-input{ class: ('hide' if id),
|
2018-01-26 06:25:26 +00:00
|
|
|
rows: 1,
|
|
|
|
name: value_input_name,
|
|
|
|
placeholder: s_('CiVariables|Input variable value') }
|
|
|
|
= value
|
2019-04-09 03:16:52 +00:00
|
|
|
%p.masking-validation-error.gl-field-error.hide
|
|
|
|
= s_("CiVariables|Cannot use Masked Variable with current value")
|
2021-04-03 00:09:02 +00:00
|
|
|
= link_to sprite_icon('question-o'), help_page_path('ci/variables/README', anchor: 'mask-a-cicd-variable'), target: '_blank', rel: 'noopener noreferrer'
|
2018-01-26 06:25:26 +00:00
|
|
|
- unless only_key_value
|
2019-05-03 11:12:58 +00:00
|
|
|
.ci-variable-body-item.ci-variable-protected-item.table-section.section-20.mr-0.border-top-0
|
2020-07-07 15:08:49 +00:00
|
|
|
.gl-mr-3
|
2018-01-26 06:25:26 +00:00
|
|
|
= s_("CiVariable|Protected")
|
2019-12-05 18:07:51 +00:00
|
|
|
= render "shared/buttons/project_feature_toggle", is_checked: is_protected, label: s_("CiVariable|Toggle protected") do
|
2018-01-26 06:25:26 +00:00
|
|
|
%input{ type: "hidden",
|
|
|
|
class: 'js-ci-variable-input-protected js-project-feature-toggle-input',
|
|
|
|
name: protected_input_name,
|
2018-10-31 19:12:22 +00:00
|
|
|
value: is_protected,
|
|
|
|
data: { default: is_protected_default.to_s } }
|
2019-05-03 11:12:58 +00:00
|
|
|
.ci-variable-body-item.ci-variable-masked-item.table-section.section-20.mr-0.border-top-0
|
2020-07-07 15:08:49 +00:00
|
|
|
.gl-mr-3
|
2019-03-29 15:46:31 +00:00
|
|
|
= s_("CiVariable|Masked")
|
2019-12-05 18:07:51 +00:00
|
|
|
= 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-03-29 15:46:31 +00:00
|
|
|
%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 } }
|
|
|
|
= render_if_exists 'ci/variables/environment_scope', form_field: form_field, variable: variable
|
2021-04-10 03:09:09 +00:00
|
|
|
%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-07-30 09:09:36 +00:00
|
|
|
= sprite_icon('close')
|