rustploy-gui 0.1.72

Rustploy — desktop client (glacier-ui) for the Rustploy PaaS daemon
// Janela "Novo token do registry": motor Glacier próprio, aberto por open_window a partir do app principal.
screen(title = "{t('new_registry_token_window.new_token_rustploy')}") {
  resources {

    style """
    .dialog__secret {
      width: fill;
      background: var(--raised);
      border_radius: 4;
      border_width: 1;
      border_color: var(--accent);
      padding: 12;
      spacing: 8;
    }
    """

    script(src = "scripts/new_registry_token_window.luau")
  }

  column(class = dialog__screen) {
    row(class = titlebar) {
      row(class = titlebar__drag, on_press = window:drag) {
        text("●", class = titlebar__dot)
        text(
          "{t('new_registry_token_window.new_token_rustploy')}",
          class = titlebar__title
        )
      }

      button(
        "—",
        class = titlebar__btn,
        on_click = window:minimize
      )
      button(
        "✕",
        class = "titlebar__btn titlebar__btn--close",
        on_click = window:close
      )
    }

    scrollable(class = dialog__body, direction = vertical) {
      column(class = form-panel) {
        // Passo 1: formulário
        if @new_registry_token_step == "form" {
          text(
            "{t('new_registry_token_window.new_access_token_basic_auth')}",
            class = u-label-cap
          )

          text(
            "{t('new_registry_token_window.used_in_docker_login_push')}",
            class = u-muted,
          )

          form(
            error_prefix = error_,
            name = new_registry_token_form,
            on_submit = new_registry_token_create,
            on_validation_error = new_registry_token_show_validation_errors,
            class = "form form--gap-10",
          ) {
            field(label = "{t('common.name')}", error = @error_new_registry_token_name) {
              input(
                class = dialog__input,
                form_control = new_registry_token_name,
                rules = required,
                msg = "{t('common.enter_a_name')}",
                placeholder = "{t('new_registry_token_window.e_g_ci_deploy')}",
              )
            }

            field(label = "{t('common.scope')}", label_class = u-label-cap) {
              scroll(class = tabs__scroll, direction = horizontal) {
                tabbar(
                  :value = new_registry_token_scope,
                  active = @new_registry_token_scope,
                  :items = new_registry_token_scopes,
                  tab_class = tabs__tab,
                  tab_active_class = "tabs__tab tabs__tab--active",
                  padding = "9 16",
                  size = 14,
                )
              }
            }

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

            row(
              class = busy-row,
              if = @new_registry_token_message,
              not_equals = ""
            ) {
              spinner(class = busy-row__spin, if = @new_registry_token_busy)
              text("@new_registry_token_message", class = u-muted)
            }

            row(class = dialog__actions) {
              column(class = u-fill)

              button(
                "{t('common.cancel')}",
                class = "btn btn--ghost",
                on_click = window:close
              )

              button(
                "{t('new_registry_token_window.create_token')}",
                type = submit,
                disabled = @busy_new_registry_token_create,
                class = "btn btn--primary"
              )
            }
          }
        }

        // Passo 2: segredo exibido uma única vez
        if @new_registry_token_step == "reveal" {
          text(
            "{t('new_registry_token_window.token_created_copy_it_now')}",
            class = u-label-cap
          )

          text(
            "{t('new_registry_token_window.the_secret_cannot_be_recovered_after')}",
            class = u-error,
          )

          text("@new_registry_token_message", if = @new_registry_token_message, not_equals = "", class = u-ok)

          column(class = dialog__secret) {
            field(label = "{t('new_registry_token_window.docker_login_command')}") {
              inputgroup(action = "{t('common.copy')}", on_action = "copy_ctx:new_registry_token_login_command") {
                input(:value = new_registry_token_login_command, readonly = true)
              }
            }
          }

          row(class = dialog__actions) {
            column(class = u-fill)
            button(
              "{t('common.close')}",
              class = "btn btn--primary",
              on_click = window:close
            )
          }
        }
      }
    }
  }
}