rustploy-gui 0.1.25

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

  column(class = env, if = @project_loading, not_equals = true) {
    row(class = env__head) {
      text(
        class = "u-muted u-fill",
        content = """
          Herdadas por todos os serviços deste projeto no deploy — as
          do serviço têm precedência.
        """,
      )

      button(
        class = "btn btn--ghost btn--wide",
        on_click = project_env_export,
        disabled = @busy_project_env_export,
        text = Exportar,
      )

      text(content = " ")

      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 = Fechar,
        )
      } else {
        button(class = tabs__tab, on_click = project_env_text_toggle, disabled = @busy_project_env_text_toggle, text = .env)
      }
    }

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

      if @project_env_new_is_secret == "true" {
        row(class = env__add) {
          input(
            class = env__input,
            form_control = project_env_new_value,
            placeholder = "nome do secret",
          )

          button(
            class = "btn btn--blue btn--wide",
            on_click = project_env_secret_toggle,
            disabled = @busy_project_env_secret_toggle,
            text = "usar secret",
          )
        }

        text(
          if = @project_secrets,
          empty = "",
          class = u-muted,
          content = "Nenhum secret cadastrado — crie um na aba Secrets.",
        )

        row(class = env__add, if = @project_secrets, not_empty) {
          text(class = u-muted, content = "Secrets do projeto: ")

          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 = value,
          )

          button(
            class = tabs__tab,
            on_click = project_env_secret_toggle,
            disabled = @busy_project_env_secret_toggle,
            text = "usar secret",
          )
        }
      }

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

    text(
      class = u-error,
      if = @error_project_env_new_key,
      not_empty,
      content = "@error_project_env_new_key",
    )

    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,
                  content = "⋮ ",
                )

                text(class = u-muted, content = "@e.value")
              }
            } else {
              row(class = "kv-list__row kv-list__row--dragging") {
                text(
                  class = "env__drag-handle env__drag-handle--dragging",
                  drag_handle = true,
                  content = "⋮ ",
                )

                button(
                  class = env__del,
                  on_click = project_env_delete:@e.key,
                  disabled = @busy_project_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 {
            if @e.kind == "comment" {
              row(class = kv-list__row) {
                text(
                  class = env__drag-handle,
                  drag_handle = true,
                  content = "⋮ ",
                )

                text(class = u-muted, content = "@e.value")
              }
            } else {
              row(class = kv-list__row) {
                text(
                  class = env__drag-handle,
                  drag_handle = true,
                  content = "⋮ ",
                )

                button(
                  class = env__del,
                  on_click = project_env_delete:@e.key,
                  disabled = @busy_project_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 @project_env_text_open == "true" {
          text(
            class = u-muted,
            content = "Cole/edite no formato KEY=VALUE (# comentário).",
          )

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

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

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