rustploy-gui 0.1.23

Rustploy — desktop client (glacier-ui) for the Rustploy PaaS daemon
// Projeto aberto (view = project_services): cabeçalho/edição, sub-abas e grade de
// serviços; cada sub-aba pesada mora em seu arquivo.
component {
  resources {
    link(rel = import, href = "project_env.gvb", as = ProjectEnvTab)
    link(rel = import, href = "project_secrets.gvb", as = ProjectSecretsTab)
    link(rel = import, href = "project_jobs.gvb", as = ProjectJobsTab)

    component(name = SemServicosNoProjeto) {
      text(class = u-muted, content = "Nenhum serviço neste projeto ainda.")
    }
  }

  column(class = content) {
    row(class = page-head) {
      column(class = page-head__titles) {
        row(class = proj-bar) {
          button(
            class = "btn btn--ghost",
            on_click = nav_projects,
            disabled = @busy_nav_projects,
            text = "‹ Projetos",
          )

          column(class = u-fill)

          if @editing_project != "true" {
            flow(class = proj-bar__actions) {
              button(
                class = "btn btn--primary btn--sm",
                on_click = open_new_service_window,
                disabled = @busy_open_new_service_window,
                text = "+ Novo serviço",
              )

              button(
                class = "btn btn--ghost btn--sm",
                on_click = edit_project_toggle,
                disabled = @busy_edit_project_toggle,
                text = "Editar projeto",
              )

              if @project_can_delete == "1" {
                button(
                  class = "btn btn--danger btn--sm",
                  on_click = delete_project:@selected_project_id,
                  disabled = @busy_delete_project,
                  text = "Remover projeto",
                )
              }
            }
          }
        }

        if @editing_project == "true" {
          form(
            name = edit_project,
            on_submit = save_project_edit,
            on_validation_error = project_edit_show_validation_errors,
            spacing = 6,
            width = fill,
          ) {
            input(
              class = field__input,
              form_control = edit_project_name,
              rules = required,
              msg = "informe um nome",
              placeholder = "Nome do projeto",
            )

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

            input(
              class = field__input,
              form_control = edit_project_description,
              placeholder = "Descrição (opcional)",
            )

            row(class = env__add) {
              button(type = submit, disabled = @busy_save_project_edit, class = "btn btn--primary", text = Salvar)

              button(
                class = "btn btn--ghost",
                on_click = cancel_project_edit,
                disabled = @busy_cancel_project_edit,
                text = Cancelar,
              )

              text(class = u-muted, content = "@project_action_message")
            }
          }
        } else {
          text(class = page-head__title, content = "@project_name")
          text(class = page-head__subtitle, content = "@project_description")

          text(
            if = @project_action_message,
            not_equals = "",
            class = u-muted,
            content = "@project_action_message",
          )
        }
      }
    }

    // Sub-abas do projeto
    scroll(class = tabs__scroll, direction = horizontal) {
      row(class = tabs__main) {
        TabButton(
          label = Serviços,
          current = @project_tab,
          target = services,
          action = project_tab:services,
        )

        TabButton(
          label = "Variáveis (@project_env_count)",
          current = @project_tab,
          target = env,
          action = project_tab:env,
        )

        TabButton(
          label = "Secrets (@project_secrets_count)",
          current = @project_tab,
          target = secrets,
          action = project_tab:secrets,
        )

        TabButton(
          label = "Jobs (@project_jobs_count)",
          current = @project_tab,
          target = jobs,
          action = project_tab:jobs,
        )
      }
    }

    hr

    if @project_loading == "true" {
      LoadingRow
    }

    if @project_tab == "env" {
      // ── Variáveis de ambiente do projeto ──────────────────────
    ProjectEnvTab(if = @project_loading, not_equals = true)
    }

    if @project_tab == "secrets" {
      // ── Secrets do projeto ──────────────────────────────────────
    ProjectSecretsTab(if = @project_loading, not_equals = true)
    }

    if @project_tab == "jobs" {
      ProjectJobsTab
    }

    if @project_tab == "services" {
      scrollable(
        if = @project_loading,
        not_equals = true,
        direction = vertical,
        class = u-fill-all,
      ) {
        column(class = grid) {
          each @project_services as r (fallback = SemServicosNoProjeto) {
            row(class = grid__row) {
              ServiceCard(:for-each = r.cards, var = c, spread = @c)
            }
          }
        }
      }
    }
  }
}