rustploy-gui 0.1.2

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

  column(class = env_wrap) {
    row(class = env_head) {
      text(class = muted_fill, content = "@svc_env_count variável(eis)")
      button(class = btn_export, on_click = env_export, text = Exportar)
      text(content = " ")

      if @env_text_open == "true" {
        button(
          class = btn_export_on,
          on_click = env_text_toggle,
          text = Fechar,
        )
      } else {
        button(class = tab, on_click = env_text_toggle, text = .env)
      }
    }

    form(name = env_add, on_submit = env_add, width = fill, spacing = 8) {
      row(class = env_add) {
        input(
          class = env_in_key,
          form_control = env_new_key,
          placeholder = KEY,
        )
      }

      row(class = env_add) {
        input(
          class = env_in_val,
          form_control = env_new_val,
          placeholder = value,
        )
      }

      row(class = env_add) {
        button(class = btn_primary, on_click = env_add, text = Adicionar)
      }
    }

    text(
      class = muted_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 = @erro_env_new_key,
      not_equals = "",
      class = err,
      content = "@erro_env_new_key",
    )

    scrollable(direction = vertical, class = env_list_scroll) {
      column(class = kv_list) {
        template(
          :for-each = svc_env,
          var = e,
          on_reorder = env_reorder,
          reorder_key = key,
          foreach_fallback = SemVariaveisDoServico,
        ) {
          if @e.__dragging == "true" {
            row(class = kv_row_drag, if = @e.kind, equals = comment) {
              text(
                class = "env_drag_handle env_dragging",
                drag_handle = true,
                content = "⋮ ",
              )

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

            row(class = kv_row_drag, else) {
              text(
                class = "env_drag_handle env_dragging",
                drag_handle = true,
                content = "⋮ ",
              )

              button(
                class = env_del,
                on_click = env_del:@e.key,
                text = "✕",
              )

              text(class = env_sep)
              text(class = env_key, content = "@e.key_display")
              text(class = kv_val_fill, content = "@e.value")
            }
          } else {
            row(class = kv_row, if = @e.kind, equals = comment) {
              text(
                class = env_drag_handle,
                drag_handle = true,
                content = "⋮ ",
              )

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

            row(class = kv_row, else) {
              text(
                class = env_drag_handle,
                drag_handle = true,
                content = "⋮ ",
              )

              button(
                class = env_del,
                on_click = env_del:@e.key,
                text = "✕",
              )

              text(class = env_sep)
              text(class = env_key, content = "@e.key_display")
              text(class = kv_val_fill, content = "@e.value")
            }
          }
        }

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

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

          row(class = env_add) {
            button(
              class = btn_primary,
              on_click = env_import,
              text = Salvar,
            )

            button(
              class = btn_ghost,
              on_click = env_text_cancel,
              text = Cancelar,
            )
          }
        }
      }
    }
  }
}