Make frontend sort-of-ok

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

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",
"name" => funko.name,
"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>