component {
resources {
component(name = SemVariaveis) {
text("{t('common.no_variables')}", class = u-muted)
}
}
column(class = env, if = @project_loading, not_equals = true) {
row(class = env__head) {
text(
"{t('project_env.inherited_by_all_services_of_this')}",
class = "u-muted u-fill",
)
button(
class = "btn btn--ghost btn--wide",
on_click = project_env_export,
disabled = @busy_project_env_export,
text = "{t('common.export')}",
)
text(" ")
if @project_env_text_open == "true" {
button(
class = "btn btn--blue btn--wide",
on_click = project_env_text_toggle,
disabled = @busy_project_env_text_toggle,
text = "{t('common.close')}",
)
} else {
button(class = tabs__tab, on_click = project_env_text_toggle, disabled = @busy_project_env_text_toggle, text = "{t('common.env')}")
}
}
row(class = env__add) {
text("{t('project_env.move_to_service')}", class = u-muted)
select(
class = form-select,
:options = project_service_options,
:value = move_target_service_id,
on_change = move_target_pick,
placeholder = "{t('project_env.choose_service')}",
label_field = display,
value_field = id,
)
}
form(
name = project_env_add,
on_submit = project_env_add,
on_validation_error = project_env_show_validation_errors,
class = "form form--gap-8",
) {
row(class = env__add) {
input(
class = env__input,
form_control = project_env_new_key,
rules = required,
msg = "{t('common.enter_the_key')}",
placeholder = "{t('common.key')}",
)
}
if @project_env_new_is_secret == "true" {
row(class = env__add) {
input(
class = env__input,
form_control = project_env_new_value,
placeholder = "{t('project_env.secret_name')}",
)
button(
class = "btn btn--blue btn--wide",
on_click = project_env_secret_toggle,
disabled = @busy_project_env_secret_toggle,
text = "{t('project_env.use_secret')}",
)
}
text(
"{t('project_env.no_secret_registered_create_one')}",
if = @project_secrets,
empty = "",
class = u-muted,
)
row(class = env__add, if = @project_secrets, not_empty) {
text("{t('project_env.project_secrets_xa0')}", class = u-muted)
button(
class = "btn btn--ghost btn--xs",
:for_each = project_secrets,
var = s,
on_click = secret_use:@s.name,
disabled = @busy_secret_use,
text = @s.name_display,
)
}
} else {
row(class = env__add) {
input(
class = env__input,
form_control = project_env_new_value,
placeholder = "{t('common.value')}",
)
button(
class = tabs__tab,
on_click = project_env_secret_toggle,
disabled = @busy_project_env_secret_toggle,
text = "{t('project_env.use_secret')}",
)
}
}
row {
button(type = submit, disabled = @busy_project_env_add, class = "btn btn--primary", text = "{t('common.add')}")
}
}
text(
"@error_project_env_new_key",
class = u-error,
if = @error_project_env_new_key,
not_empty,
)
scrollable(direction = vertical, class = u-fill-all) {
column(class = kv-list) {
template(
:for_each = project_env,
foreach_fallback = SemVariaveis,
var = e,
on_reorder = project_env_reorder,
reorder_key = key,
) {
if @e.__dragging == "true" {
if @e.kind == "comment" {
row(class = "kv-list__row kv-list__row--dragging") {
text(
"⋮ ",
class = "env__drag-handle env__drag-handle--dragging",
drag_handle = true,
)
text("@e.value", class = u-muted)
}
} else {
row(class = "kv-list__row kv-list__row--dragging") {
text(
"⋮ ",
class = "env__drag-handle env__drag-handle--dragging",
drag_handle = true,
)
button(
class = env__del,
on_click = project_env_delete:@e.key,
disabled = @busy_project_env_delete,
text = "✕",
)
text(class = env__sep)
text("@e.key_display", class = env__key)
text("@e.value", class = "kv-list__val kv-list__val--compact")
}
}
} else {
if @e.kind == "comment" {
row(class = kv-list__row) {
text(
"⋮ ",
class = env__drag-handle,
drag_handle = true,
)
text("@e.value", class = u-muted)
}
} else {
row(class = kv-list__row) {
text(
"⋮ ",
class = env__drag-handle,
drag_handle = true,
)
button(
class = env__del,
on_click = project_env_delete:@e.key,
disabled = @busy_project_env_delete,
text = "✕",
)
button(
class = "btn btn--ghost btn--sm",
on_click = project_env_to_secret:@e.key,
disabled = @busy_project_env_to_secret,
if = @e.kind,
equals = plain,
text = "🔒",
tooltip = "{t('environment.to_secret')}",
)
button(
class = "btn btn--ghost btn--sm",
on_click = project_env_to_service:@e.key,
disabled = @busy_project_env_to_service,
if = @e.kind,
equals = plain,
text = "↓",
tooltip = "{t('project_env.env_to_service')}",
)
button(
class = "btn btn--ghost btn--sm",
on_click = project_secret_to_env:@e.secret_name,
disabled = @busy_project_secret_to_env,
if = @e.kind,
equals = secret,
text = "🔓",
tooltip = "{t('environment.secret_to_env')}",
)
text(class = env__sep)
text("@e.key_display", class = env__key)
text("@e.value", class = "kv-list__val kv-list__val--compact")
}
}
}
}
if @project_env_text_open == "true" {
text(
"{t('common.paste_edit_in_the_key')}",
class = u-muted,
)
textarea(
class = env__editor,
font = mono,
:value = project_env_text,
placeholder = "{t('common.key_value_comment')}",
)
row(class = env__add) {
button(
class = "btn btn--primary",
on_click = project_env_import,
disabled = @busy_project_env_import,
text = "{t('common.save')}",
)
button(
class = "btn btn--ghost",
on_click = project_env_text_cancel,
disabled = @busy_project_env_text_cancel,
text = "{t('common.cancel')}",
)
}
}
}
}
}
}