rustploy-gui 0.1.74

Rustploy — desktop client (glacier-ui) for the Rustploy PaaS daemon
// Aba Secrets do projeto; a condição de carregamento vai na chamada.
component {
  resources {
    // Estados vazios das abas Secrets e Jobs do projeto (`fallback` do
    // <foreach>).
    component(name = SemSecretsNoProjeto) {
      text("{t('project_secrets.no_secret_in_this_project')}", class = u-muted)
    }
  }

  scrollable(
    direction = vertical,
    class = u-fill-all,
    if = @project_loading,
    not_equals = true,
  ) {
  column(class = env--flow) {
    column(class = prose) {
      text(
        "{t('project_secrets.sensitive_values_tokens_passwords_api_keys')}",
        class = "u-muted u-fill",
      )

      text(
        "{t('project_secrets.to_use_it_in_a_service')}",
        class = "u-muted u-fill",
      )

      text(
        "{t('project_secrets.the_real_value_is_only_decrypted')}",
        class = "u-muted u-fill",
      )
    }

    form(
      error_prefix = error_,
      name = secret_add,
      on_submit = secret_add,
      on_validation_error = secret_add_show_validation_errors,
      class = "form form--gap-8",
    ) {
      text("{t('project_secrets.new_secret')}", class = u-label-cap)

      row(class = env__add) {
        input(
          class = "env__input-key u-mono",
          form_control = project_secret_new_name,
          rules = required,
          msg = "{t('common.enter_a_name')}",
          placeholder = "{t('common.name')}",
        )

        input(
          class = env__input,
          form_control = project_secret_new_value,
          rules = required,
          msg = "{t('project_secrets.enter_a_value')}",
          placeholder = "{t('project_secrets.value_encrypted_on_save')}",
        )

        button(
          "{t('project_secrets.save_secret')}",
          type = submit,
          disabled = @busy_secret_add,
          class = "btn btn--primary"
        )
      }

      text(
        "@error_project_secret_new_name",
        class = u-error,
        if = @error_project_secret_new_name,
        not_equals = "",
      )

      text(
        "@error_project_secret_new_value",
        class = u-error,
        if = @error_project_secret_new_value,
        not_equals = "",
      )
    }

    hr

    row(class = env__add, if = @project_secrets_count, not_equals = "0") {
      text("{t('project_env.move_to_service')}", class = env__use-secret)

      select(
        class = form-select,
        :options = project_service_options,
        :value = move_target_service_id,
        on_change = move_target_pick,
        label_field = display,
        value_field = id,
      )
    }

    column(class = kv-list) {
        each @project_secrets as s (fallback = SemSecretsNoProjeto) {
          row(class = kv-list__row) {
            button(
              "✕",
              class = env__del,
              on_click = secret_delete:@s.name,
              disabled = @busy_secret_delete
            )

            button(
              "🔓",
              class = "btn btn--ghost btn--sm",
              on_click = project_secret_to_env:@s.name,
              disabled = @busy_project_secret_to_env,
              tooltip = "{t('environment.secret_to_env')}",
              tooltip_delay = "500ms",
            )

            button(
              "↓",
              class = "btn btn--ghost btn--sm",
              if = @move_target_service_id,
              equals = "",
              disabled = true,
              tooltip = "{t('project_env.choose_service')}",
              tooltip_delay = "500ms",
            )

            button(
              "↓",
              class = "btn btn--ghost btn--sm",
              if = @move_target_service_id,
              not_equals = "",
              on_click = project_secret_to_service:@s.name,
              disabled = @busy_project_secret_to_service,
              tooltip = "{t('project_env.secret_to_service')}",
              tooltip_delay = "500ms",
            )

            button(
              "👁",
              class = "btn btn--ghost btn--sm",
              on_click = secret_reveal:@s.name,
              disabled = @busy_secret_reveal,
              if = @s.revealed,
              equals = false,
              tooltip = "{t('environment.secret_reveal')}",
              tooltip_delay = "500ms",
            )

            button(
              "🙈",
              class = "btn btn--ghost btn--sm",
              on_click = secret_hide:@s.name,
              if = @s.revealed,
              equals = true,
              tooltip = "{t('environment.secret_hide')}",
              tooltip_delay = "500ms",
            )

            button(
              "📋",
              class = "btn btn--ghost btn--sm",
              on_click = secret_copy:@s.ref,
              if = @s.revealed,
              equals = true,
              tooltip = "{t('environment.secret_copy')}",
              tooltip_delay = "500ms",
            )

            text(class = env__sep)
            input(
              class = env__inline-name,
              :value = "@s.bind_name",
              on_change = project_secret_name_change:@s.name,
              placeholder = "{t('common.name')}",
            )
            text(
              "{t('project_secrets.encrypted')}",
              class = "kv-list__val kv-list__val--compact",
              if = @s.revealed,
              equals = false
            )
            text(
              "@s.value",
              class = "kv-list__val kv-list__val--compact",
              if = @s.revealed,
              equals = true
            )
          }
        }
      }
    }
  }
}