rustploy-gui 0.1.2

Rustploy — desktop client (glacier-ui) for the Rustploy PaaS daemon
// Card de serviço da aba "Serviços" de um projeto — o análogo do ProjectCard.
component {
  props {
    prop(name = id)
    prop(name = name)
    prop(name = port)
    prop(name = status_color)
    prop(name = status_label)
    prop(name = cpu)
    prop(name = mem)
    prop(name = filler)
    prop(name = container_name)
    prop(name = container_id)
    prop(name = container_extra)
  }

  resources {
    style """
    .card_stats    {
      width: fill;
      spacing: 12;
    }

    .card_stat     {
      width: fill;
      spacing: 4;
    }

    .card_stat_num {
      size: 18;
      bold: true;
      color: var(--text-2);
    }

    .card_ctr {
      width: fill;
      spacing: 6;
    }

    .card_actions  {
      width: fill;
      spacing: 8;
    }

    .card_stop     {
      width: fill;
      color: var(--border);
      padding: 9 10;
      text-align: center;
      border-radius: 5
    }

    .c_name {
      size: 16;
      bold: true;
      color: var(--text);
    }

    .c_port {
      size: 12; color: var(--muted);
    }

    .fill {
      width: fill;
    }

    .align-y-center {
      alignY: end;
    }

    """
  }

  column(if = @filler, equals = 1, class = card_filler)

  column(else, class = card) {
    row(class = card_head) {
      row(class = "fill align-y-center") {
        text(class = c_name, content = "@name")
        text(class = c_port, content = ":@port")
      }

      rp-badge(color = @status_color, label = @status_label)
    }

    row(class = card_ctr) {
      text(class = muted, content = "name: @container_name")
    }

    row {
      text(class = muted, content = "id: @container_id")

      text(
        class = muted,
        if = @container_extra,
        not_equals = "",
        content = "extra: @container_extra",
      )
    }

    hr

    row(class = card_stats) {
      column(class = card_stat) {
        text(class = label_cap, content = "CPU")
        text(class = card_stat_num, content = "@cpu")
      }

      column(class = card_stat) {
        text(class = label_cap, content = "MEM")
        text(class = card_stat_num, content = "@mem")
      }
    }

    // Ações empilhadas: 3 botões numa linha só transbordam no tamanho mínimo
    // de janela (grade de 3 colunas).
    button(class = card_open, on_click = open_service:@id, text = "Abrir  ›")

    row(class = card_actions) {
      button(class = card_stop, on_click = svc_stop_id:@id, text = Parar)

      button(
        class = card_remove,
        on_click = stop_delete_service:@id,
        text = Remover,
      )
    }
  }
}