From 360b0eb483232d4a3636a04d75ee9f178928116f Mon Sep 17 00:00:00 2001 From: riley Date: Wed, 13 Sep 2023 13:13:40 -0400 Subject: [PATCH] Major reformat of docker.htm for readability --- luasrc/view/tasks/docker.htm | 101 ++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 44 deletions(-) diff --git a/luasrc/view/tasks/docker.htm b/luasrc/view/tasks/docker.htm index 454bf21..b412f33 100644 --- a/luasrc/view/tasks/docker.htm +++ b/luasrc/view/tasks/docker.htm @@ -1,57 +1,70 @@ +<% +local taskd = require "luci.model.tasks" +local status = taskd.status(self.task_id) + +-- Check if a task is running +local task_running = status.running -<% if self.task_start_failed then %> -
<%:Another task running, try again later.%> <%:Click here to check running task%>
+-- Check for a task start failure +if self.task_start_failed then +%> +
+ <%:Another task running, try again later.%> + + <%:Click here to check running task%> + +
<% end %> <%+cbi/map%> -<% -local task_running = false -local taskd = require "luci.model.tasks" -local status = taskd.status(self.task_id) -task_running = status.running --%> +
<% -if not task_running then -%> - <% - local util = require "luci.util" - local container_status = util.trim(util.exec(self.script_path.." status")) - local container_status_lower = string.lower(util.trim(util.exec(self.script_path.." status"))) - local container_install = not string.match(container_status_lower, " is not installed$") + if not task_running then + local util = require "luci.util" + + local container_status = util.trim(util.exec(self.script_path.." status")) + local container_status_lower = string.lower(container_status) + + local container_install = not string.match(container_status_lower, " is not installed$") local container_running = string.match(string.lower(container_status), "^up .* (seconds|minutes|hours)") - if container_install then - -%> - - <% - if container_running then - -%> - - - - <% else %> - - - - <% end - else %> - - <% end -else - %> - + + if container_install then +%> + <% -end + if container_running then +%> + + +<% + else +%> + + +<% + end + else +%> + +<% + end + else +%> + +<% + end %>
<%+tasks/embed%> -<% -if self.auto_show_task and task_running then --%> - -<% -end + +<% +if self.auto_show_task and task_running then +%> + +<% +end %>