minor GUI refactor

pull/2/head
riley 1 year ago
parent 34a7a97fb4
commit 5fcdd11797

@ -2,30 +2,21 @@
local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/apps/nodered/nodered.sh status"))
local container_running = string.find(string.lower(container_status), "up") and string.find(string.lower(container_status), "(healthy)")
local port=util.trim(util.exec("/usr/libexec/apps/nodered/nodered.sh port"))
-%>
<div class="cbi-value">
<label class="cbi-value-title">Status</label>
<div class="cbi-value-field">
<% if container_running then %>
<button class="cbi-button cbi-button-success" disabled="true"><%= container_status %></button>
<%
if port == "" then
port="1880"
end
-%>
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open nodered%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
<% else %>
<button class="cbi-button cbi-button-negative" disabled="true"><%= container_status %></button>
<% end %>
</div>
</div>
<%
if container_running then
local port=util.trim(util.exec("/usr/libexec/apps/nodered/nodered.sh port"))
if port == "" then
port="1880"
end
-%>
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title">&nbsp;</label>
<div class="cbi-value-field">
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open nodered%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
</div>
</div>
<% end %>

Loading…
Cancel
Save