rustploy-gui 0.1.14

Rustploy — desktop client (glacier-ui) for the Rustploy PaaS daemon
// Registry — repositórios/tags do registry OCI embutido (Fase 1: só
// push/pull via docker CLI; sem auth ainda).
component {
  resources {
    component(name = SemRepositorios) {
      text(
        if = @registry_repos_count,
        equals = 0,
        class = u-muted,
        content = """
          Nenhum repositório ainda. Faça `docker push` para o registry embutido.
        """,
      )

      text(
        if = @registry_repos_count,
        not_equals = 0,
        class = u-muted,
        content = "Nenhum repositório corresponde à busca.",
      )
    }

    component(name = SemTokens) {
      text(
        class = u-muted,
        content = """
          Nenhum token ainda. Sem token nenhum push/pull é autenticado — crie um
          antes de usar o registry.
        """,
      )
    }
  }

  column(class = "panel panel--fill") {
    row(class = env__head) {
      text(
        class = "u-muted u-fill",
        content = """
          Registry @registry_status_label · @registry_repos_count
          repositório(s) · @registry_storage_human
        """,
      )

      button(
        class = "btn btn--danger",
        if = @registry_status_enabled,
        equals = true,
        on_click = registry_gc,
        disabled = @busy_registry_gc,
        text = "Executar GC",
      )
    }

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

    column(class = "panel panel--fill", if = @registry_selected_repo, equals = "") {
      tableview(
        :items = registry_repos,
        :sort = registry_repos_sort,
        var = r,
        header_class = "table__head table__head-cell",
        row_class = "table__row table__cell table__row--divided",
        class = u-fill-all,
      ) {
        tablecolumn(key = name, label = "REPOSITÓRIO", class = table__col-svc) {
          text(class = "table__cell table__cell--key", content = "@r.name")
        }

        tablecolumn(key = tag_count, label = TAGS, class = table__col-proj)

        tablecolumn(key = size, label = TAMANHO, class = table__col-dur) {
          text(class = u-muted, content = "@r.size")
        }

        tablecolumn(key = created, label = CRIADO, class = table__col-dur) {
          text(class = u-muted, content = "@r.created")
        }

        tablecolumn(label = "AÇÃO", class = table__col-act-2, align = right) {
          row(class = table__col-act-2) {
            button(
              class = "btn btn--ghost btn--xs",
              on_click = registry_open_repo:@r.name,
              disabled = @busy_registry_open_repo,
              text = "≡",
              tooltip = "Ver tags",
            )

            button(
              class = env__del,
              on_click = registry_remove_repo:@r.name,
              disabled = @busy_registry_remove_repo,
              text = "✕",
              tooltip = Remover,
            )
          }
        }

        if @data_loading == "true" {
          LoadingRow
        } else {
          SemRepositorios
        }
      }

      text(
        class = u-label-cap,
        content = "TOKENS DE ACESSO (@registry_tokens_count)",
      )

      row(class = env__head) {
        text(
          class = "u-muted u-fill",
          content = """
            Basic auth (docker login) — o segredo só aparece uma vez, na
            criação.
          """,
        )

        button(
          class = "btn btn--primary",
          on_click = registry_open_token_window,
          disabled = @busy_registry_open_token_window,
          text = "+ Novo token",
        )
      }

      // Sem `height`: a lista é curta e cresce com o painel. O cabeçalho só
      // aparece com algum token — sem nenhum, só o aviso.
      if @registry_tokens is empty {
        SemTokens
      } else {
        tableview(
          :items = registry_tokens,
          var = tk,
          header_class = "table__head table__head-cell",
          row_class = "table__row table__cell table__row--divided",
          width = fill,
        ) {
          tablecolumn(key = name, label = NOME, class = table__col-svc) {
            text(class = "table__cell table__cell--key", content = "@tk.name")
          }

          tablecolumn(key = scope, label = ESCOPO, class = table__col-proj)

          tablecolumn(key = created, label = CRIADO, class = table__col-dur) {
            text(class = u-muted, content = "@tk.created")
          }

          tablecolumn(key = last_used, label = "ÚLTIMO USO", class = table__col-dur) {
            text(class = u-muted, content = "@tk.last_used")
          }

          tablecolumn(label = "AÇÃO", class = table__col-act) {
            button(
              class = env__del,
              on_click = registry_remove_token:@tk.name,
              disabled = @busy_registry_remove_token,
              text = "✕",
              tooltip = Revogar,
            )
          }
        }
      }
    }

    column(
      class = "panel panel--fill",
      if = @registry_selected_repo,
      not_equals = "",
    ) {
      row(class = env__head) {
        text(
          class = "u-muted u-fill",
          content = "@registry_selected_repo — @registry_tags_count tag(s)",
        )

        button(
          class = "btn btn--ghost",
          on_click = registry_close_repo,
          disabled = @busy_registry_close_repo,
          text = "← Voltar",
        )
      }

      tableview(
        :items = registry_tags,
        :sort = registry_tags_sort,
        var = t,
        header_class = "table__head table__head-cell",
        row_class = "table__row table__cell table__row--divided",
        class = u-fill-all,
      ) {
        tablecolumn(key = tag, label = TAG, class = table__col-svc) {
          text(class = "table__cell table__cell--key", content = "@t.tag")
        }

        tablecolumn(key = digest, label = DIGEST, class = table__col-proj) {
          text(class = u-muted, content = "@t.digest")
        }

        tablecolumn(key = size, label = TAMANHO, class = table__col-dur) {
          text(class = u-muted, content = "@t.size")
        }

        tablecolumn(key = updated, label = ATUALIZADA, class = table__col-dur) {
          text(class = u-muted, content = "@t.updated")
        }

        tablecolumn(label = "AÇÃO", class = table__col-act) {
          button(
            class = "btn btn--danger btn--xs",
            on_click = registry_remove_tag:@t.tag,
            disabled = @busy_registry_remove_tag,
            text = Remover,
          )
        }

        if @registry_tags_loading == "true" {
          LoadingRow
        }
      }
    }
  }
}