diff options
Diffstat (limited to 'documentation/jsapi/LuCI.uci.html')
-rw-r--r-- | documentation/jsapi/LuCI.uci.html | 4176 |
1 files changed, 4176 insertions, 0 deletions
diff --git a/documentation/jsapi/LuCI.uci.html b/documentation/jsapi/LuCI.uci.html new file mode 100644 index 0000000000..8a0e3e98f9 --- /dev/null +++ b/documentation/jsapi/LuCI.uci.html @@ -0,0 +1,4176 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Class: uci</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Class: uci</h1> + + + + + + +<section> + +<header> + + <h2><span class="attribs"><span class="type-signature"></span></span> + <span class="ancestors"><a href="LuCI.html">LuCI</a>.</span>uci</h2> + + <div class="class-description"><p>The <code>LuCI.uci</code> class utilizes <a href="LuCI.rpc.html"><code>LuCI.rpc</code></a> to declare low level +remote UCI <code>ubus</code> procedures and implements a local caching and data +manipulation layer on top to allow for synchroneous operations on +UCI configuration data.</p></div> + + +</header> + +<article> + <div class="container-overview"> + + + + + + + + + + + + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line4">line 4</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + + <h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(config, type, name<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h4> + + + + + + +<div class="description"> + <p>Adds a new section of the given type to the given configuration, +optionally named according to the given name.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The name of the configuration to add the section to.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>type</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The type of the section to add.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>name</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>The name of the section to add. If the name is omitted, an anonymous +section will be added instead.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line269">line 269</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns the section ID of the newly added section which is equivalent +to the given name for non-anonymous sections.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">string</span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="apply"><span class="type-signature"></span>apply<span class="signature">(timeout<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<number>}</span></h4> + + + + + + +<div class="description"> + <p>Instructs the remote <code>ubus</code> UCI api to commit all saved changes with +rollback protection and attempts to confirm the pending commit +operation to cancel the rollback timer.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + <th>Default</th> + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>timeout</code></td> + + + <td class="type"> + + +<span class="param-type">number</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + 10 + + </td> + + + <td class="description last"><p>Override the confirmation timeout after which a rollback is triggered.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line858">line 858</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns a promise resolving/rejecting with the <code>ubus</code> RPC status code.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise.<number></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="changes"><span class="type-signature"></span>changes<span class="signature">()</span><span class="type-signature"> → {Promise.<Object.<string, Array.<<a href="LuCI.uci.html#.ChangeRecord">LuCI.uci.ChangeRecord</a>>>>}</span></h4> + + + + + + +<div class="description"> + <p>Fetches uncommitted UCI changes from the remote <code>ubus</code> RPC api.</p> +</div> + + + + + + + + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line938">line 938</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns a promise resolving to an object containing the configuration +names as keys and arrays of related change records as values.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise.<Object.<string, Array.<<a href="LuCI.uci.html#.ChangeRecord">LuCI.uci.ChangeRecord</a>>>></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="createSID"><span class="type-signature"></span>createSID<span class="signature">(config)</span><span class="type-signature"> → {string}</span></h4> + + + + + + +<div class="description"> + <p>Generates a new, unique section ID for the given configuration.</p> +<p>Note that the generated ID is temporary, it will get replaced by an +identifier in the form <code>cfgXXXXXX</code> once the configuration is saved +by the remote <code>ubus</code> UCI api.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The configuration to generate the new section ID for.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line88">line 88</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>A newly generated, unique section ID in the form <code>newXXXXXX</code> +where <code>X</code> denotes a hexadecimal digit.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">string</span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(config, sid, option<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {null|string|Array.<string>|<a href="LuCI.uci.html#.SectionObject">LuCI.uci.SectionObject</a>}</span></h4> + + + + + + +<div class="description"> + <p>Gets the value of the given option within the specified section +of the given configuration or the entire section object if the +option name is omitted.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The name of the configuration to read the value from.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>sid</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The name or ID of the section to read.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>option</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>The option name to read the value from. If the option name is +omitted or <code>null</code>, the entire section is returned instead.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line443">line 443</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <ul> +<li>Returns a string containing the option value in case of a +plain UCI option.</li> +<li>Returns an array of strings containing the option values in +case of <code>option</code> pointing to an UCI list.</li> +<li>Returns a <a href="LuCI.uci.html#.SectionObject"><code>section object</code></a> if +the <code>option</code> argument has been omitted or is <code>null</code>.</li> +<li>Returns <code>null</code> if the config, section or option has not been +found or if the corresponding configuration is not loaded.</li> +</ul> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">null</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">Array.<string></span> +| + +<span class="param-type"><a href="LuCI.uci.html#.SectionObject">LuCI.uci.SectionObject</a></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="get_first"><span class="type-signature"></span>get_first<span class="signature">(config, type<span class="signature-attributes">opt</span>, option<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {null|string|Array.<string>|<a href="LuCI.uci.html#.SectionObject">LuCI.uci.SectionObject</a>}</span></h4> + + + + + + +<div class="description"> + <p>Gets the value of the given option or the entire section object of +the first found section of the specified type or the first found +section of the entire configuration if no type is specfied.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The name of the configuration to read the value from.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>type</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>The type of the first section to find. If it is <code>null</code>, the first +section of the entire config is read, otherwise the first section +matching the given type.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>option</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>The option name to read the value from. If the option name is +omitted or <code>null</code>, the entire section is returned instead.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line618">line 618</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <ul> +<li>Returns a string containing the option value in case of a +plain UCI option.</li> +<li>Returns an array of strings containing the option values in +case of <code>option</code> pointing to an UCI list.</li> +<li>Returns a <a href="LuCI.uci.html#.SectionObject"><code>section object</code></a> if +the <code>option</code> argument has been omitted or is <code>null</code>.</li> +<li>Returns <code>null</code> if the config, section or option has not been +found or if the corresponding configuration is not loaded.</li> +</ul> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">null</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">Array.<string></span> +| + +<span class="param-type"><a href="LuCI.uci.html#.SectionObject">LuCI.uci.SectionObject</a></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="load"><span class="type-signature"></span>load<span class="signature">(config)</span><span class="type-signature"> → {Promise.<Array.<string>>}</span></h4> + + + + + + +<div class="description"> + <p>Loads the given UCI configurations from the remote <code>ubus</code> api.</p> +<p>Loaded configurations are cached and only loaded once. Subsequent +load operations of the same configurations will return the cached +data.</p> +<p>To force reloading a configuration, it has to be unloaded with +<a href="LuCI.uci.html#unload"><code>uci.unload()</code></a> first.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> +| + +<span class="param-type">Array.<string></span> + + + + </td> + + + + + + <td class="description last"><p>The name of the configuration or an array of configuration +names to load.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line205">line 205</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns a promise resolving to the names of the configurations +that have been successfully loaded.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise.<Array.<string>></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="move"><span class="type-signature"></span>move<span class="signature">(config, sid1, sid2<span class="signature-attributes">opt</span>, after<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<div class="description"> + <p>Move the first specified section within the given configuration +before or after the second specified section.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + <th>Default</th> + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>The configuration to move the section within.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>sid1</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>The ID of the section to move within the configuration.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>sid2</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"><p>The ID of the target section for the move operation. If the +<code>after</code> argument is <code>false</code> or not specified, the section named by +<code>sid1</code> will be moved before this target section, if the <code>after</code> +argument is <code>true</code>, the <code>sid1</code> section will be moved after this +section.</p> +<p>When the <code>sid2</code> argument is <code>null</code>, the section specified by <code>sid1</code> +is moved to the end of the configuration.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>after</code></td> + + + <td class="type"> + + +<span class="param-type">boolean</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + false + + </td> + + + <td class="description last"><p>When <code>true</code>, the section <code>sid1</code> is moved after the section <code>sid2</code>, +when <code>false</code>, the section <code>sid1</code> is moved before <code>sid2</code>.</p> +<p>If <code>sid2</code> is null, then this parameter has no effect and the section +<code>sid1</code> is moved to the end of the configuration instead.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line718">line 718</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns <code>true</code> when the section was successfully moved, or <code>false</code> +when either the section specified by <code>sid1</code> or by <code>sid2</code> is not found.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(config, sid)</span><span class="type-signature"></span></h4> + + + + + + +<div class="description"> + <p>Removes the section with the given ID from the given configuration.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The name of the configuration to remove the section from.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>sid</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The ID of the section to remove.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line296">line 296</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + <h4 class="name" id="resolveSID"><span class="type-signature"></span>resolveSID<span class="signature">(config, sid)</span><span class="type-signature"> → {string|null}</span></h4> + + + + + + +<div class="description"> + <p>Resolves a given section ID in extended notation to the internal +section ID value.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The configuration to resolve the section ID for.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>sid</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The section ID to resolve. If the ID is in the form <code>@typename[#]</code>, +it will get resolved to an internal anonymous ID in the forms +<code>cfgXXXXXX</code>/<code>newXXXXXX</code> or to the name of a section in case it points +to a named section. When the given ID is not in extended notation, +it will be returned as-is.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line119">line 119</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns the resolved section ID or the original given ID if it was +not in extended notation. Returns <code>null</code> when an extended ID could +not be resolved to existing section ID.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">string</span> +| + +<span class="param-type">null</span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> → {Array.<string>}</span></h4> + + + + + + +<div class="description"> + <p>Submits all local configuration changes to the remove <code>ubus</code> api, +adds, removes and reorders remote sections as needed and reloads +all loaded configurations to resynchronize the local state with +the remote configuration values.</p> +</div> + + + + + + + + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line772">line 772</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns a promise resolving to an array of configuration names which +have been reloaded by the save operation.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Array.<string></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="sections"><span class="type-signature"></span>sections<span class="signature">(config, type<span class="signature-attributes">opt</span>, cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<<a href="LuCI.uci.html#.SectionObject">LuCI.uci.SectionObject</a>>}</span></h4> + + + + + + +<div class="description"> + <p>Enumerates the sections of the given configuration, optionally +filtered by type.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The name of the configuration to enumerate the sections for.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>type</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>Enumerate only sections of the given type. If omitted, enumerate +all sections.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>cb</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="LuCI.uci.html#~sectionsFn">LuCI.uci~sectionsFn</a></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>An optional callback to invoke for each enumerated section.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line384">line 384</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns a sorted array of the section objects within the given +configuration, filtered by type of a type has been specified.</p> +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Array.<<a href="LuCI.uci.html#.SectionObject">LuCI.uci.SectionObject</a>></span> + + + </dd> +</dl> + + + + + + + + + + + + + + <h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(config, sid, option, value)</span><span class="type-signature"></span></h4> + + + + + + +<div class="description"> + <p>Sets the value of the given option within the specified section +of the given configuration.</p> +<p>If either config, section or option is null, or if <code>option</code> begins +with a dot, the function will do nothing.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The name of the configuration to set the option value in.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>sid</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The name or ID of the section to set the option value in.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>option</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The option name to set the value for.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">null</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">Array.<string></span> + + + + </td> + + + + + + <td class="description last"><p>The option value to set. If the value is <code>null</code> or an empty string, +the option will be removed, otherwise it will be set or overwritten +with the given value.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line516">line 516</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + <h4 class="name" id="set_first"><span class="type-signature"></span>set_first<span class="signature">(config, type<span class="signature-attributes">opt</span>, option, value)</span><span class="type-signature"></span></h4> + + + + + + +<div class="description"> + <p>Sets the value of the given option within the first found section +of the given configuration matching the specified type or within +the first section of the entire config when no type has is specified.</p> +<p>If either config, type or option is null, or if <code>option</code> begins +with a dot, the function will do nothing.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The name of the configuration to set the option value in.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>type</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>The type of the first section to find. If it is <code>null</code>, the first +section of the entire config is written to, otherwise the first +section matching the given type is used.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>option</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The option name to set the value for.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">null</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">Array.<string></span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The option value to set. If the value is <code>null</code> or an empty string, +the option will be removed, otherwise it will be set or overwritten +with the given value.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line653">line 653</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + <h4 class="name" id="unload"><span class="type-signature"></span>unload<span class="signature">(config)</span><span class="type-signature"></span></h4> + + + + + + +<div class="description"> + <p>Unloads the given UCI configurations from the local cache.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> +| + +<span class="param-type">Array.<string></span> + + + + </td> + + + + + + <td class="description last"><p>The name of the configuration or an array of configuration +names to unload.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line237">line 237</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + <h4 class="name" id="unset"><span class="type-signature"></span>unset<span class="signature">(config, sid, option)</span><span class="type-signature"></span></h4> + + + + + + +<div class="description"> + <p>Remove the given option within the specified section of the given +configuration.</p> +<p>This function is a convenience wrapper around +<code>uci.set(config, section, option, null)</code>.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The name of the configuration to remove the option from.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>sid</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The name or ID of the section to remove the option from.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>option</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The name of the option to remove.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line587">line 587</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + <h4 class="name" id="unset_first"><span class="type-signature"></span>unset_first<span class="signature">(config, type<span class="signature-attributes">opt</span>, option)</span><span class="type-signature"></span></h4> + + + + + + +<div class="description"> + <p>Removes the given option within the first found section of the given +configuration matching the specified type or within the first section +of the entire config when no type has is specified.</p> +<p>This function is a convenience wrapper around +<code>uci.set_first(config, type, option, null)</code>.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>config</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The name of the configuration to set the option value in.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>type</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + + <td class="description last"><p>The type of the first section to find. If it is <code>null</code>, the first +section of the entire config is written to, otherwise the first +section matching the given type is used.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>option</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"><p>The option name to set the value for.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line683">line 683</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Type Definitions</h3> + + + +<h4 class="name" id=".ChangeRecord">ChangeRecord</h4> + + + + +<div class="description"> + <p>An UCI change record is a plain array containing the change operation +name as first element, the affected section ID as second argument +and an optional third and fourth argument whose meanings depend on +the operation.</p> +</div> + + + + <h5>Type:</h5> + <ul> + <li> + +<span class="param-type">Array.<string></span> + + + </li> + </ul> + + + + + + <h5 class="subsection-title">Properties:</h5> + + + +<table class="props"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>0</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The operation name - may be one of <code>add</code>, <code>set</code>, <code>remove</code>, <code>order</code>, +<code>list-add</code>, <code>list-del</code> or <code>rename</code>.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>1</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The section ID targeted by the operation.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>2</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The meaning of the third element depends on the operation.</p> +<ul> +<li>For <code>add</code> it is type of the section that has been added</li> +<li>For <code>set</code> it either is the option name if a fourth element exists, +or the type of a named section which has been added when the change +entry only contains three elements.</li> +<li>For <code>remove</code> it contains the name of the option that has been +removed.</li> +<li>For <code>order</code> it specifies the new sort index of the section.</li> +<li>For <code>list-add</code> it contains the name of the list option a new value +has been added to.</li> +<li>For <code>list-del</code> it contains the name of the list option a value has +been removed from.</li> +<li>For <code>rename</code> it contains the name of the option that has been +renamed if a fourth element exists, else it contains the new name +a section has been renamed to if the change entry only contains +three elements.</li> +</ul></td> + </tr> + + + + <tr> + + <td class="name"><code>4</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The meaning of the fourth element depends on the operation.</p> +<ul> +<li>For <code>set</code> it is the value an option has been set to.</li> +<li>For <code>list-add</code> it is the new value that has been added to a +list option.</li> +<li>For <code>rename</code> it is the new name of an option that has been +renamed.</li> +</ul></td> + </tr> + + + </tbody> +</table> + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line887">line 887</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + +<h4 class="name" id=".SectionObject">SectionObject</h4> + + + + +<div class="description"> + <p>A section object represents the options and their corresponding values +enclosed within a configuration section, as well as some additional +meta data such as sort indexes and internal ID.</p> +<p>Any internal metadata fields are prefixed with a dot which is isn't +an allowed character for normal option names.</p> +</div> + + + + <h5>Type:</h5> + <ul> + <li> + +<span class="param-type">Object.<string, (boolean|number|string|Array.<string>)></span> + + + </li> + </ul> + + + + + + <h5 class="subsection-title">Properties:</h5> + + + +<table class="props"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>.anonymous</code></td> + + + <td class="type"> + + +<span class="param-type">boolean</span> + + + + </td> + + + + + + <td class="description last"><p>The <code>.anonymous</code> property specifies whether the configuration is +anonymous (<code>true</code>) or named (<code>false</code>).</p></td> + </tr> + + + + <tr> + + <td class="name"><code>.index</code></td> + + + <td class="type"> + + +<span class="param-type">number</span> + + + + </td> + + + + + + <td class="description last"><p>The <code>.index</code> property specifes the sort order of the section.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>.name</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The <code>.name</code> property holds the name of the section object. It may be +either an anonymous ID in the form <code>cfgXXXXXX</code> or <code>newXXXXXX</code> with <code>X</code> +being a hexadecimal digit or a string holding the name of the section.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>.type</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The <code>.type</code> property contains the type of the corresponding uci +section.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>*</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> +| + +<span class="param-type">Array.<string></span> + + + + </td> + + + + + + <td class="description last"><p>A section object may contain an arbitrary number of further properties +representing the uci option enclosed in the section.</p> +<p>All option property names will be in the form <code>[A-Za-z0-9_]+</code> and +either contain a string value or an array of strings, in case the +underlying option is an UCI list.</p></td> + </tr> + + + </tbody> +</table> + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line316">line 316</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + <h4 class="name" id="~sectionsFn"><span class="type-signature"></span>sectionsFn<span class="signature">(section, sid)</span><span class="type-signature"></span></h4> + + + + + + +<div class="description"> + <p>The sections callback is invoked for each section found within +the given configuration and receives the section object and its +associated name as arguments.</p> +</div> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>section</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="LuCI.uci.html#.SectionObject">LuCI.uci.SectionObject</a></span> + + + + </td> + + + + + + <td class="description last"><p>The section object.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>sid</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"><p>The name or ID of the section.</p></td> + </tr> + + + </tbody> +</table> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="uci.js.html">uci.js</a>, <a href="uci.js.html#line352">line 352</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + +</article> + +</section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LuCI.html">LuCI</a></li><li><a href="LuCI.Class.html">Class</a></li><li><a href="LuCI.dom.html">dom</a></li><li><a href="LuCI.fs.html">fs</a></li><li><a href="LuCI.Headers.html">Headers</a></li><li><a href="LuCI.Network.html">Network</a></li><li><a href="LuCI.Network.Device.html">Device</a></li><li><a href="LuCI.Network.Hosts.html">Hosts</a></li><li><a href="LuCI.Network.Protocol.html">Protocol</a></li><li><a href="LuCI.Network.WifiDevice.html">WifiDevice</a></li><li><a href="LuCI.Network.WifiNetwork.html">WifiNetwork</a></li><li><a href="LuCI.Poll.html">Poll</a></li><li><a href="LuCI.Request.html">Request</a></li><li><a href="LuCI.Request.poll.html">poll</a></li><li><a href="LuCI.Response.html">Response</a></li><li><a href="LuCI.rpc.html">rpc</a></li><li><a href="LuCI.uci.html">uci</a></li><li><a href="LuCI.view.html">view</a></li><li><a href="LuCI.XHR.html">XHR</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Nov 05 2019 09:33:05 GMT+0100 (Central European Standard Time) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html>
\ No newline at end of file |