1 <% export("cbi_apply_xhr", function(id, configs, redirect) -%>
2 <fieldset class="cbi-section" id="cbi-apply-<%=id%>">
3 <legend><%:Applying changes%></legend>
4 <script type="text/javascript">//<![CDATA[
5 var apply_xhr = new XHR();
7 apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "restart", table.concat(configs, ","))%>', null,
9 var checkfinish = function() {
10 apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "status")%>', null,
12 if( x.responseText == 'finish' )
14 var e = document.getElementById('cbi-apply-<%=id%>-status');
17 e.innerHTML = '<%:Configuration applied.%>';
18 window.setTimeout(function() {
19 e.parentNode.style.display = 'none';
20 <% if redirect then %>location.href='<%=redirect%>';<% end %>
26 var e = document.getElementById('cbi-apply-<%=id%>-status');
27 if( e && x.responseText ) e.innerHTML = x.responseText;
29 window.setTimeout(checkfinish, 1000);
35 window.setTimeout(checkfinish, 1000);
40 <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
41 <span id="cbi-apply-<%=id%>-status"><%:Waiting for router...%></span>