// Janela "Novo token do registry": motor Glacier próprio, aberto por open_window a partir do app principal.
screen(title = "Novo token — Rustploy") {
resources {
link(rel = import, href = "components/tab_button.gvb", as = TabButton)
style """
/* Titlebar custom (mesma linguagem visual do app.gv) */
.titlebar { width: fill; height: 32; background: var(--surface); align-y: center; }
.titlebar_drag { width: fill; height: fill; align-y: center; padding: 0 0 0 16; spacing: 9; }
.titlebar_dot { size: 10; color: var(--blue); }
.titlebar_title { size: 12; bold: true; color: var(--muted); }
.win_btn { width: 48; padding: 5 0; color: var(--border); text-align: center; }
.win_close { width: 48; padding: 5 0; color: var(--danger); text-align: center; }
.ntok_screen { width: fill; height: fill; }
.ntok_body { width: fill; height: fill; }
.np_label { size: 11; bold: true; color: var(--muted); }
.np_input { width: fill; }
.np_actions { width: fill; spacing: 10; align-y: center; }
.np_spacer { width: fill; }
.ntok_secret_box {
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 = ntok_screen) {
row(class = titlebar) {
row(class = titlebar_drag, on_press = window:drag) {
text(class = titlebar_dot, content = "●")
text(class = titlebar_title, content = "Novo token — Rustploy")
}
button(class = win_btn, on_click = window:minimize, text = "—")
button(class = win_close, on_click = window:close, text = "✕")
}
scrollable(class = ntok_body, direction = vertical) {
column(class = form_panel) {
// Passo 1: formulário
if @ntok_step == "form" {
text(class = label_cap, content = "NOVO TOKEN DE ACESSO (BASIC AUTH)")
text(
class = muted,
content = "Usado em `docker login`/push/pull contra o registry embutido.",
)
form(
name = ntok_form,
on_submit = ntok_create,
on_validation_error = ntok_apontar,
width = fill,
spacing = 10,
) {
text(class = np_label, content = "NOME")
input(
class = np_input,
form_control = ntok_name,
rules = required,
msg = "informe um nome",
placeholder = "ex.: ci-deploy",
)
text(
class = err,
if = @erro_ntok_name,
not_empty,
content = "@erro_ntok_name",
)
text(class = label_cap, content = "ESCOPO")
row(class = tabs) {
TabButton(
label = "Somente leitura (pull)",
current = @ntok_scope,
target = pull,
action = ntok_scope:pull,
)
TabButton(
label = "Leitura e escrita (push)",
current = @ntok_scope,
target = push,
action = ntok_scope:push,
)
}
text(
if = @ntok_err,
not_equals = "",
class = err,
content = "@ntok_err",
)
row(class = busy_row, if = @ntok_msg, not_equals = "") {
spinner(class = busy_spin, if = @ntok_busy)
text(class = muted, content = "@ntok_msg")
}
row(class = np_actions) {
column(class = np_spacer)
button(
class = btn_ghost,
on_click = window:close,
text = Cancelar,
)
button(type = submit, class = btn_primary, text = "Criar token")
}
}
}
// Passo 2: segredo exibido uma única vez
if @ntok_step == "reveal" {
text(class = label_cap, content = "TOKEN CRIADO — COPIE AGORA")
text(
class = err,
content = """
O segredo não pode ser recuperado depois de fechar esta janela.
""",
)
column(class = ntok_secret_box) {
text(class = np_label, content = "COMANDO DOCKER LOGIN")
text(class = kv_val_fill, content = "@ntok_login_cmd")
row(class = np_actions) {
column(class = np_spacer)
button(
class = copy_btn,
on_click = clipboard:ntok_login_cmd,
text = Copiar,
)
}
}
row(class = np_actions) {
column(class = np_spacer)
button(class = btn_primary, on_click = window:close, text = Fechar)
}
}
}
}
}
}