From dcd5c615b432e3ab8f803100b130a2ca167b9eda Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Wed, 3 Jul 2024 15:45:55 -0300 Subject: [PATCH] Make frontend sort-of-ok --- public/index.html | 6 ++++-- src/daemon/funko.cr | 9 ++++----- src/funko.cr | 2 +- src/views/funkos.ecr | 23 ++++++----------------- tinyproxy.conf | 21 --------------------- 5 files changed, 15 insertions(+), 46 deletions(-) diff --git a/public/index.html b/public/index.html index 6ab6859..0cf0243 100644 --- a/public/index.html +++ b/public/index.html @@ -15,8 +15,10 @@ Name - Status - Action + Scale + Containers + Images + Actions diff --git a/src/daemon/funko.cr b/src/daemon/funko.cr index 8192e8a..8d8f433 100644 --- a/src/daemon/funko.cr +++ b/src/daemon/funko.cr @@ -79,12 +79,11 @@ module Funko result = [] of Hash(String, String) funkos.each do |funko| - state = "FIXME" - result << { - "name" => funko.name, - "state" => state, - "status" => "FIXME", + "name" => funko.name, + "scale" => funko.scale.to_s, + "containers" => funko.containers.size.to_s, + "images" => funko.images.size.to_s, } end diff --git a/src/funko.cr b/src/funko.cr index 16a7bbe..9c43a7c 100644 --- a/src/funko.cr +++ b/src/funko.cr @@ -300,7 +300,7 @@ module Funko all: true, ).each { |container| container.@names.each { |name| - names << name.split("-", 2)[1].lstrip("/") if name.starts_with?("/faaso-") + names << name.split("-", 3)[1].lstrip("/") if name.starts_with?("/faaso-") } } diff --git a/src/views/funkos.ecr b/src/views/funkos.ecr index 18de715..d9050aa 100644 --- a/src/views/funkos.ecr +++ b/src/views/funkos.ecr @@ -1,32 +1,21 @@ <%- result.each do |f| -%> "> <%= f["name"] %> - <%- if f["name"] == "proxy" -%> - Running - <%- else -%> - <%= f["status"] %> - <%- end -%> + <%= f["scale"] %> + <%= f["containers"] %> + <%= f["images"] %> <%- if f["name"] == "proxy" -%> <%- else -%> - <%- if f["state"] == "running" -%> + <%- if f["scale"].to_i > 0 -%> - - <%- end -%> - <%- if f["state"] == "paused" -%> + <%- else -%> - - + <%- end -%> - <%- if f["state"] == "stopped" -%> - - - - - <%- end -%> <%- end -%> " src="https://htmx.org/img/bars.svg" class="htmx-indicator"> diff --git a/tinyproxy.conf b/tinyproxy.conf index bca96e0..7931997 100644 --- a/tinyproxy.conf +++ b/tinyproxy.conf @@ -8,24 +8,3 @@ ReverseOnly Yes ReverseMagic Yes ReversePath "/admin/" "http://127.0.0.1:3000/" - ReversePath "/faaso/hello-101807275100116/" "http://hello-101807275100116:3000/" -ReversePath "/faaso/hello-109717610410253/" "http://hello-109717610410253:3000/" -ReversePath "/faaso/hello-115791188481102/" "http://hello-115791188481102:3000/" -ReversePath "/faaso/hello-489850679780/" "http://hello-489850679780:3000/" -ReversePath "/faaso/hello-52122101707950/" "http://hello-52122101707950:3000/" -ReversePath "/faaso/hello-53828586108120/" "http://hello-53828586108120:3000/" -ReversePath "/faaso/hello-5412177121100122/" "http://hello-5412177121100122:3000/" -ReversePath "/faaso/hello-679912011112183/" "http://hello-679912011112183:3000/" -ReversePath "/faaso/hello-687849738368/" "http://hello-687849738368:3000/" -ReversePath "/faaso/hello-689880877456/" "http://hello-689880877456:3000/" -ReversePath "/faaso/hello-6987113768753/" "http://hello-6987113768753:3000/" -ReversePath "/faaso/hello-7273704811390/" "http://hello-7273704811390:3000/" -ReversePath "/faaso/hello-761221081008155/" "http://hello-761221081008155:3000/" -ReversePath "/faaso/hello-9798100678476/" "http://hello-9798100678476:3000/" -ReversePath "/faaso/hello-98103104100103100/" "http://hello-98103104100103100:3000/" -ReversePath "/faaso/hello-e24ojr/" "http://hello-e24ojr:3000/" -ReversePath "/faaso/hello-foo/" "http://hello-foo:3000/" -ReversePath "/faaso/hello-gfvij3/" "http://hello-gfvij3:3000/" -ReversePath "/faaso/hello-ngisvh/" "http://hello-ngisvh:3000/" -ReversePath "/faaso/hello-rqp8o3/" "http://hello-rqp8o3:3000/" -ReversePath "/faaso/hello-xtpu69/" "http://hello-xtpu69:3000/" \ No newline at end of file