rustploy-gui 0.1.57

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(
        "{t('docker_registry.no_repository_yet_run_docker_push')}",
        if = @registry_repos_count,
        equals = 0,
        class = u-muted,
      )

      text(
        "{t('docker_registry.no_repository_matches_the_search')}",
        if = @registry_repos_count,
        not_equals = 0,
        class = u-muted,
      )
    }

    component(name = SemTokens) {
      text(
        "{t('docker_registry.no_token_yet_without_a_token')}",
        class = u-muted,
      )
    }
  }

  column(class = "panel panel--fill") {
    row(class = env__head) {
      text(
        "{t('docker_registry.registry_repository_ies', registry_status_label=registry_status_label, registry_repos_count=registry_repos_count, registry_storage_human=registry_storage_human)}",
        class = "u-muted u-fill",
      )

      button(
        class = "btn btn--danger",
        if = @registry_status_enabled,
        equals = true,
        on_click = registry_gc,
        disabled = @busy_registry_gc,
        text = "{t('docker_registry.run_gc')}",
      )
    }

    // Retenção de tags: só faz sentido com o registry ligado.
    column(class = form-panel, if = @registry_status_enabled, equals = true) {
      toggle(
        :checked = registry_retention_form_enabled,
        on_toggle = field:registry_retention_form_enabled,
        label = "{t('docker_registry.retention_toggle')}",
      )

      row(class = env__add) {
        text("{t('docker_registry.retention_keep')}", class = u-label-cap)

        spinbox(
          field_class = field__spin,
          form_control = registry_retention_form_keep_last,
          :value = registry_retention_form_keep_last,
          min = 1,
          max = 1000,
          width = 90,
          placeholder = 10,
        )

        button(
          class = "btn btn--primary",
          on_click = registry_retention_save,
          disabled = @busy_registry_retention_save,
          text = "{t('common.save_2')}",
        )
      }

      text("{t('docker_registry.retention_hint')}", class = u-muted)
    }

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

    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 = "{t('common.repository')}",
          class = table__col-svc
        ) {
          text(
            "@r.name",
            class = "table__cell table__cell--key"
          )
        }

        tablecolumn(
          key = tag_count,
          label = "{t('common.tags')}",
          class = table__col-proj)

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

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

        tablecolumn(
          label = "{t('common.action')}",
          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 = "{t('docker_registry.view_tags')}",
            )

            button(
              class = env__del,
              on_click = registry_remove_repo:@r.name,
              disabled = @busy_registry_remove_repo,
              text = "✕",
              tooltip = "{t('common.remove')}",
            )
          }
        }

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

      text(
        "{t('docker_registry.access_tokens', registry_tokens_count=registry_tokens_count)}",
        class = u-label-cap,
      )

      row(class = env__head) {
        text(
          "{t('docker_registry.basic_auth_docker_login_the_secret')}",
          class = "u-muted u-fill",
        )

        button(
          class = "btn btn--primary",
          on_click = registry_open_token_window,
          disabled = @busy_registry_open_token_window,
          text = "{t('docker_registry.new_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 = "{t('common.name')}",
            class = table__col-svc
          ) {
            text(
              "@tk.name",
              class = "table__cell table__cell--key")
          }

          tablecolumn(
            key = scope,
            label = "{t('common.scope')}",
            class = table__col-proj
          )

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

          tablecolumn(
            key = last_used,
            label = "{t('docker_registry.last_used')}",
            class = table__col-dur
          ) {
            text(
              "@tk.last_used",
              class = u-muted
            )
          }

          tablecolumn(
            label = "{t('common.action')}",
            class = table__col-act
          ) {
            button(
              class = env__del,
              on_click = registry_remove_token:@tk.name,
              disabled = @busy_registry_remove_token,
              text = "✕",
              tooltip = "{t('docker_registry.revoke')}",
            )
          }
        }
      }
    }

    column(
      class = "panel panel--fill",
      if = @registry_selected_repo,
      not_equals = "",
    ) {
      row(class = env__head) {
        text(
          "{t('docker_registry.tag_s', registry_selected_repo=registry_selected_repo, registry_tags_count=registry_tags_count)}",
          class = "u-muted u-fill",
        )

        button(
          class = "btn btn--ghost",
          on_click = registry_close_repo,
          disabled = @busy_registry_close_repo,
          text = "{t('docker_registry.back')}",
        )
      }

      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 = "{t('docker_registry.tag')}",
          class = table__col-svc
        ) {
          text(
            "@t.tag",
            class = "table__cell table__cell--key"
          )
        }

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

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

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

        tablecolumn(
          label = "{t('common.action')}",
          class = table__col-act
        ) {
          button(
            class = "btn btn--danger btn--xs",
            on_click = registry_remove_tag:@t.tag,
            disabled = @busy_registry_remove_tag,
            text = "{t('common.remove')}",
          )
        }

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