rustploy-gui 0.1.21

Rustploy — desktop client (glacier-ui) for the Rustploy PaaS daemon
// Environment
component {
  resources {
    component(name = SemVariaveisDoServico) {
      text(class = u-muted, content = "Nenhuma variável.")
    }
  }

  column(class = env) {
    row(class = env__head) {
      text(class = "u-muted u-fill", content = "@service_env_count variável(eis)")
      button(class = "btn btn--ghost btn--wide", on_click = env_export, disabled = @busy_env_export, text = Exportar)
      text(content = " ")

      if @env_text_open == "true" {
        button(
          class = "btn btn--blue btn--wide",
          on_click = env_text_toggle,
          disabled = @busy_env_text_toggle,
          text = Fechar,
        )
      } else {
        button(class = tabs__tab, on_click = env_text_toggle, disabled = @busy_env_text_toggle, text = .env)
      }
    }

    form(
      name = env_add,
      on_submit = env_add,
      on_validation_error = env_show_validation_errors,
      width = fill,
      spacing = 8,
    ) {
      row(class = env__add) {
        input(
          class = env__input,
          form_control = env_new_key,
          rules = required,
          msg = "informe a chave",
          placeholder = KEY,
        )
      }

      row(class = env__add) {
        input(
          class = env__input,
          form_control = env_new_value,
          placeholder = value,
        )
      }

      row(class = env__add) {
        button(type = submit, disabled = @busy_env_add, class = "btn btn--primary", text = Adicionar)
      }
    }

    text(
      class = "u-muted u-fill",
      content = """
        Para um valor sensível, use um secret do projeto: escreva
        <secret:NOME> ou secret:NOME como valor aqui ou no editor .env —
        as duas formas valem. O secret é criado na aba Secrets do projeto,
        só é decifrado no deploy, e na lista aparece com 🔒.
      """,
    )

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

    scrollable(direction = vertical, class = u-fill-all) {
      column(class = kv-list) {
        template(
          :for-each = service_env,
          var = e,
          on_reorder = env_reorder,
          reorder_key = key,
          foreach_fallback = SemVariaveisDoServico,
        ) {
          if @e.__dragging == "true" {
            row(class = "kv-list__row kv-list__row--dragging", if = @e.kind, equals = comment) {
              text(
                class = "env__drag-handle env__drag-handle--dragging",
                drag_handle = true,
                content = "⋮ ",
              )

              text(class = u-muted, content = "@e.value")
            }

            row(class = "kv-list__row kv-list__row--dragging", else) {
              text(
                class = "env__drag-handle env__drag-handle--dragging",
                drag_handle = true,
                content = "⋮ ",
              )

              button(
                class = env__del,
                on_click = env_delete:@e.key,
                disabled = @busy_env_delete,
                text = "✕",
              )

              text(class = env__sep)
              text(class = env__key, content = "@e.key_display")
              text(class = "kv-list__val kv-list__val--compact", content = "@e.value")
            }
          } else {
            row(class = kv-list__row, if = @e.kind, equals = comment) {
              text(
                class = env__drag-handle,
                drag_handle = true,
                content = "⋮ ",
              )

              text(class = u-muted, content = "@e.value")
            }

            row(class = kv-list__row, else) {
              text(
                class = env__drag-handle,
                drag_handle = true,
                content = "⋮ ",
              )

              button(
                class = env__del,
                on_click = env_delete:@e.key,
                disabled = @busy_env_delete,
                text = "✕",
              )

              text(class = env__sep)
              text(class = env__key, content = "@e.key_display")
              text(class = "kv-list__val kv-list__val--compact", content = "@e.value")
            }
          }
        }

        if @env_text_open == "true" {
          text(
            class = u-muted,
            content = "Cole/edite no formato KEY=VALUE (# comentário).",
          )

          textarea(
            class = env__editor,
            font = mono,
            :value = service_env_text,
            placeholder = "KEY=VALUE   (# comentário)",
          )

          row(class = env__add) {
            button(
              class = "btn btn--primary",
              on_click = env_import,
              disabled = @busy_env_import,
              text = Salvar,
            )

            button(
              class = "btn btn--ghost",
              on_click = env_text_cancel,
              disabled = @busy_env_text_cancel,
              text = Cancelar,
            )
          }
        }
      }
    }
  }
}