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
|
|
|
|
- key = variable&.key
|
|
|
|
- value = variable&.value
|
2018-10-31 19:12:22 +00:00
|
|
|
- is_protected_default = Gitlab::CurrentSettings.current_application_settings.protected_ci_variables
|
|
|
|
- is_protected = variable && !only_key_value ? variable.protected : is_protected_default
|
2018-01-26 06:25:26 +00:00
|
|
|
|
|
|
|
- id_input_name = "#{form_field}[variables_attributes][][id]"
|
|
|
|
- destroy_input_name = "#{form_field}[variables_attributes][][_destroy]"
|
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]"
|
|
|
|
|
|
|
|
%li.js-row.ci-variable-row{ data: { is_persisted: "#{!id.nil?}" } }
|
|
|
|
.ci-variable-row-body
|
|
|
|
%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 }
|
2018-04-20 17:18:18 +00:00
|
|
|
%input.js-ci-variable-input-key.ci-variable-body-item.qa-ci-variable-input-key.form-control{ type: "text",
|
2018-01-26 06:25:26 +00:00
|
|
|
name: key_input_name,
|
|
|
|
value: key,
|
|
|
|
placeholder: s_('CiVariables|Input variable key') }
|
|
|
|
.ci-variable-body-item
|
2018-04-20 17:18:18 +00:00
|
|
|
.form-control.js-secret-value-placeholder.qa-ci-variable-input-value{ class: ('hide' unless id) }
|
2018-01-26 06:25:26 +00:00
|
|
|
= '*' * 20
|
2018-04-20 17:18:18 +00:00
|
|
|
%textarea.js-ci-variable-input-value.js-secret-value.qa-ci-variable-input-value.form-control{ 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
|
|
|
|
- unless only_key_value
|
|
|
|
.ci-variable-body-item.ci-variable-protected-item
|
|
|
|
.append-right-default
|
|
|
|
= s_("CiVariable|Protected")
|
|
|
|
%button{ type: 'button',
|
|
|
|
class: "js-project-feature-toggle project-feature-toggle #{'is-checked' if is_protected}",
|
|
|
|
"aria-label": s_("CiVariable|Toggle protected") }
|
|
|
|
%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 } }
|
2018-01-26 06:25:26 +00:00
|
|
|
%span.toggle-icon
|
|
|
|
= sprite_icon('status_success_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-checked')
|
|
|
|
= sprite_icon('status_failed_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-unchecked')
|
2018-06-08 17:35:29 +00:00
|
|
|
= render_if_exists 'ci/variables/environment_scope', form_field: form_field, variable: variable
|
2018-01-26 06:25:26 +00:00
|
|
|
%button.js-row-remove-button.ci-variable-row-remove-button{ type: 'button', 'aria-label': s_('CiVariables|Remove variable row') }
|
|
|
|
= icon('minus-circle')
|