Make frontend sort-of-ok

This commit is contained in:
Roberto Alsina 2024-07-03 15:45:55 -03:00
parent 64778bba19
commit dcd5c615b4
5 changed files with 15 additions and 46 deletions

View File

@ -15,8 +15,10 @@
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Action</th>
<th>Scale</th>
<th>Containers</th>
<th>Images</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="funko-list">

View File

@ -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",
"scale" => funko.scale.to_s,
"containers" => funko.containers.size.to_s,
"images" => funko.images.size.to_s,
}
end

View File

@ -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-")
}
}

View File

@ -1,32 +1,21 @@
<%- result.each do |f| -%>
<tr hx-indicator="#spinner-<%= f["name"] %>">
<td><%= f["name"] %></td>
<%- if f["name"] == "proxy" -%>
<td>Running</td>
<%- else -%>
<td><%= f["status"] %></td>
<%- end -%>
<td><%= f["scale"] %></td>
<td><%= f["containers"] %></td>
<td><%= f["images"] %></td>
<td>
<%- if f["name"] == "proxy" -%>
<%- else -%>
<%- if f["state"] == "running" -%>
<%- if f["scale"].to_i > 0 -%>
<button disabled hx-get="funkos/<%= f["name"] %>/start">Start</button>
<button hx-get="funkos/<%= f["name"] %>/pause" hx-on:htmx:after-request="update_funkos()">Pause</button>
<button hx-get="funkos/<%= f["name"] %>/stop" hx-on:htmx:after-request="update_funkos()">Stop</button>
<button hx-get="funkos/<%= f["name"] %>/restart" hx-on:htmx:after-request="update_funkos()">Restart</button>
<%- end -%>
<%- if f["state"] == "paused" -%>
<%- else -%>
<button hx-get="funkos/<%= f["name"] %>/start" hx-on:htmx:after-request="update_funkos()">Start</button>
<button disabled hx-get="funkos/<%= f["name"] %>/pause">Pause</button>
<button hx-get="funkos/<%= f["name"] %>/stop" hx-on:htmx:after-request="update_funkos()">Stop</button>
<button disabled hx-get="funkos/<%= f["name"] %>/stop" hx-on:htmx:after-request="update_funkos()">Stop</button>
<button hx-get="funkos/<%= f["name"] %>/restart" hx-on:htmx:after-request="update_funkos()">Restart</button>
<%- end -%>
<%- if f["state"] == "stopped" -%>
<button hx-get="funkos/<%= f["name"] %>/start" hx-on:htmx:after-request="update_funkos()">Start</button>
<button disabled hx-get="funkos/<%= f["name"] %>/pause">Pause</button>
<button disabled hx-get="funkos/<%= f["name"] %>/stop">Stop</button>
<button disabled hx-get="funkos/<%= f["name"] %>/restart">Restart</button>
<%- end -%>
<%- end -%>
<img id="spinner-<%= f["name"] %>" src="https://htmx.org/img/bars.svg" class="htmx-indicator">
</td>

View File

@ -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/"