Better detection of possible funkos
This commit is contained in:
17
src/funko.cr
17
src/funko.cr
@ -72,18 +72,25 @@ module Funko
|
||||
def self.from_docker : Array(Funko)
|
||||
docker_api = Docr::API.new(Docr::Client.new)
|
||||
names = [] of String
|
||||
funko_containers = docker_api.containers.list(
|
||||
|
||||
# Get all containers that look like funkos
|
||||
docker_api.containers.list(
|
||||
all: true,
|
||||
).each { |container|
|
||||
p! container.@names
|
||||
container.@names.each { |name|
|
||||
names << name.split("-", 2)[1].lstrip("/") if name.starts_with?("/faaso-")
|
||||
}
|
||||
}
|
||||
|
||||
pp! names
|
||||
|
||||
from_names(names.to_a.sort!)
|
||||
# Now get all images that look like funkos, since
|
||||
# we can start them just fine.
|
||||
docker_api.images.list.each { |image|
|
||||
next if image.@repo_tags.nil?
|
||||
image.@repo_tags.as(Array(String)).each { |tag|
|
||||
names << tag.split("-", 2)[1].split(":", 2)[0] if tag.starts_with?("faaso-")
|
||||
}
|
||||
}
|
||||
from_names(names.to_set.to_a.sort!)
|
||||
end
|
||||
|
||||
# Setup the target directory `path` with all the files needed
|
||||
|
@ -1,25 +1,32 @@
|
||||
<%- result.each do |f| -%>
|
||||
<tr>
|
||||
<td><%= f["name"] %></td>
|
||||
<td><%= f["status"] %></td>
|
||||
<%- if f["name"] == "proxy" -%>
|
||||
<td>Running</td>
|
||||
<%- else -%>
|
||||
<td><%= f["status"] %></td>
|
||||
<%- end -%>
|
||||
<td>
|
||||
<%- if f["state"] == "running" -%>
|
||||
<button disabled>Start</button>
|
||||
<button>Pause</button>
|
||||
<button>Stop</button>
|
||||
<button>Restart</button>
|
||||
<%- end -%>
|
||||
<%- if f["state"] == "paused" -%>
|
||||
<button>Start</button>
|
||||
<button disabled>Pause</button>
|
||||
<button>Stop</button>
|
||||
<button>Restart</button>
|
||||
<%- end -%>
|
||||
<%- if f["state"] == "stopped" -%>
|
||||
<button>Start</button>
|
||||
<button disabled>Pause</button>
|
||||
<button disabled>Stop</button>
|
||||
<button disabled>Restart</button>
|
||||
<%- if f["name"] == "proxy" -%>
|
||||
<%- else -%>
|
||||
<%- if f["state"] == "running" -%>
|
||||
<button disabled>Start</button>
|
||||
<button>Pause</button>
|
||||
<button>Stop</button>
|
||||
<button>Restart</button>
|
||||
<%- end -%>
|
||||
<%- if f["state"] == "paused" -%>
|
||||
<button>Start</button>
|
||||
<button disabled>Pause</button>
|
||||
<button>Stop</button>
|
||||
<button>Restart</button>
|
||||
<%- end -%>
|
||||
<%- if f["state"] == "stopped" -%>
|
||||
<button>Start</button>
|
||||
<button disabled>Pause</button>
|
||||
<button disabled>Stop</button>
|
||||
<button disabled>Restart</button>
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
</td>
|
||||
</tr>
|
||||
|
Reference in New Issue
Block a user