small-package/luci-app-nginx-manager/luasrc/view/nginx-manager/index.htm

65 lines
3.2 KiB
HTML

<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
<% if self.title and #self.title > 0 then -%>
<legend><%=self.title%></legend>
<%- end %>
<% if self.description and #self.description > 0 then -%>
<div class="cbi-section-descr"><%=self.description%></div>
<%- end %>
<div class="cbi-value" style="border-bottom: 1px solid #ddd;border-radius: 0px">
<label class="cbi-value-title"><%= translate("Restart the nginx") %></label>
<div class="cbi-value-field" style="padding:unset">
<input class="btn cbi-button cbi-button-reload" id="restart" type="button" size="0" onclick="check_status('restart')" value="<%:Restart%>" />
</div>
<label class="cbi-value-title"><%= translate("Reload the nginx") %></label>
<div class="cbi-value-field" style="padding:unset">
<input class="btn cbi-button cbi-button-reload" id="reload" type="button" size="0" onclick="check_status('reload')" value="<%:Reload%>" />
</div>
</div>
<% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
<%- section = k; isempty = false -%>
<% if not self.anonymous then -%>
<div class="cbi-section-remove" style="display: flex;flex-flow: row nowrap;justify-content: space-between">
<span style="font-size:1.15rem;color:#32325d;font-weight:bold;letter-spacing:0.1rem;padding:1rem 1.5rem;"><%=section:upper()%></span>
<input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" onclick="this.form.cbi_state='del-section'; return true" value="<%:Delete%>" class="cbi-button" />
</div>
<%- end %>
<%+cbi/tabmenu%>
<fieldset class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>" style="border-bottom: 1px solid #ddd;border-radius: 0px">
<%+cbi/ucisection%>
</fieldset>
<%- end %>
<% if isempty then -%>
<em><%:This section contains no values yet%><br /><br /></em>
<%- end %>
<% if self.addremove then -%>
<% if self.template_addremove then include(self.template_addremove) else -%>
<div class="cbi-section-create">
<% if self.anonymous then -%>
<input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
<%- else -%>
<% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
<input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" />
<input type="submit" class="cbi-button cbi-button-add" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" />
<% if self.invalid_cts then -%>
<br /><%:Invalid%></div>
<%- end %>
<%- end %>
</div>
<%- end %>
<%- end %>
</fieldset>
<style>.cbi-value-field {padding: 11.2px;}.cbi-tabmenu {border-bottom: unset !important;}</style>
<script type="text/javascript">
function check_status(mode) {
const tb = document.getElementById(mode);
tb.disabled = true;
XHR.get('<%=url([[admin]], [[services]], [[nginx-manager]], [[setstatus]])%>', {mode: mode}, (x, r) => {
tb.disabled = false;
});
}
</script>