<commit_before><%#
LuCI - Lua Configuration Interface
Copyright 2008 <NAME> <<EMAIL>>
Copyright 2008 <NAME> <<EMAIL>>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

$Id$

-%>

<div class="cbi-map" id="cbi-<%=self.config%>">
	<% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
	<% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
	<%- if self._apply then -%>
		<fieldset class="cbi-section" id="cbi-apply-<%=self.config%>">
			<legend><%:Applying changes%></legend>
			<ul class="cbi-apply"><%-
				local fp = self._apply()
				self._apply = nil
				local line = fp:read()
				while line do
					write("<li>" .. pcdata(line) .. "</li>\n")
					line = fp:read()
				end
				fp:close()
			-%></ul>
		</fieldset>
		<script type="text/javascript">
			window.setTimeout(function() {
				var e = document.getElementById('cbi-apply-<%=self.config%>');
				if(e) e.style.display = 'none';
			}, 750);
		</script>
	<%- end -%>
	<%- self:render_children() %>
	<br />
</div><commit_msg>libs/cbi: interface with service control backend to trigger service reload asynchronously<commit_after><%#
LuCI - Lua Configuration Interface
Copyright 2008 <NAME> <<EMAIL>>
Copyright 2008 <NAME> <<EMAIL>>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

$Id$

-%>

<div class="cbi-map" id="cbi-<%=self.config%>">
	<% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
	<% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
	<%- if self._apply then -%>
		<fieldset class="cbi-section" id="cbi-apply-<%=self.config%>">
			<legend><%:Applying changes%></legend>
			<script type="text/javascript"><![CDATA[
				var apply_xhr = new XHR();

				apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "restart", table.concat(self.parsechain, ","))%>', null,
					function() {
						var intv = window.setInterval(
							function() {
								apply_xhr.abort();
								apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "status")%>', null,
									function(x) {
										if( x.responseText == 'finish' )
										{
											window.clearInterval(intv);

											var e = document.getElementById('cbi-apply-<%=self.config%>-status');
											if( e )
											{
												e.innerHTML = '<%:Configuration applied.%>';
												window.setTimeout(function() { e.parentNode.style.display = 'none' }, 1000);
											}
										}
										else
										{
											var e = document.getElementById('cbi-apply-<%=self.config%>-status');
											if( e && x.responseText ) e.innerHTML = x.responseText;

										}
									}
								);
							}, 1000
						)
					}
				);
			]]></script>

			<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
			<span id="cbi-apply-<%=self.config%>-status"><%:Waiting for router...%></span>
		</fieldset>
	<%- end -%>
	<%- self:render_children() %>
	<br />
</div>
{'fraction_non_alphanumeric': 0.1976065382370111, 'fraction_numerical': 0.012551079976649154, 'mean_word_length': 3.0894988066825775, 'pattern_counts': {'":': 0, '<': 90, '<?xml version=': 0, '>': 94, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7226887', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1153, 'n_words': 256}