From 89a50c2f8f45a4d5a1bfbc2eb8e29e5836feeccb Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 2 Apr 2020 21:50:07 +0200 Subject: [PATCH] docs: update js api docs Signed-off-by: Jo-Philipp Wich --- .../{LuCI.Class.html => LuCI.baseclass.html} | 494 +-- docs/jsapi/LuCI.dom.html | 492 +-- docs/jsapi/LuCI.fs.html | 480 ++- .../{LuCI.Headers.html => LuCI.headers.html} | 470 +- docs/jsapi/LuCI.html | 768 ++-- ...k.Device.html => LuCI.network.Device.html} | 526 +-- ...ork.Hosts.html => LuCI.network.Hosts.html} | 484 +-- ...otocol.html => LuCI.network.Protocol.html} | 742 ++-- ...vice.html => LuCI.network.WifiDevice.html} | 508 +-- ...ork.html => LuCI.network.WifiNetwork.html} | 560 +-- .../{LuCI.Network.html => LuCI.network.html} | 664 +-- docs/jsapi/{LuCI.Poll.html => LuCI.poll.html} | 470 +- .../{LuCI.Request.html => LuCI.request.html} | 506 +-- ...quest.poll.html => LuCI.request.poll.html} | 484 +-- ...{LuCI.Response.html => LuCI.response.html} | 476 ++- docs/jsapi/LuCI.rpc.html | 484 +-- docs/jsapi/LuCI.uci.html | 496 +-- docs/jsapi/LuCI.ui.AbstractElement.html | 478 ++- docs/jsapi/LuCI.ui.Checkbox.html | 478 ++- docs/jsapi/LuCI.ui.ComboButton.html | 476 ++- docs/jsapi/LuCI.ui.Combobox.html | 476 ++- docs/jsapi/LuCI.ui.Dropdown.html | 482 +-- docs/jsapi/LuCI.ui.DynamicList.html | 480 ++- docs/jsapi/LuCI.ui.FileUpload.html | 476 ++- docs/jsapi/LuCI.ui.Hiddenfield.html | 476 ++- docs/jsapi/LuCI.ui.Select.html | 476 ++- docs/jsapi/LuCI.ui.Textarea.html | 476 ++- docs/jsapi/LuCI.ui.Textfield.html | 476 ++- docs/jsapi/LuCI.ui.changes.html | 470 +- docs/jsapi/LuCI.ui.html | 486 +-- docs/jsapi/LuCI.ui.tabs.html | 464 +- docs/jsapi/LuCI.view.html | 472 +- docs/jsapi/{LuCI.XHR.html => LuCI.xhr.html} | 486 +-- docs/jsapi/fs.js.html | 466 +- docs/jsapi/index.html | 458 +- docs/jsapi/luci.js.html | 3792 +++++++++-------- docs/jsapi/network.js.html | 680 ++- docs/jsapi/rpc.js.html | 464 +- docs/jsapi/uci.js.html | 461 +- docs/jsapi/ui.js.html | 678 +-- 40 files changed, 12100 insertions(+), 11631 deletions(-) rename docs/jsapi/{LuCI.Class.html => LuCI.baseclass.html} (72%) rename docs/jsapi/{LuCI.Headers.html => LuCI.headers.html} (69%) rename docs/jsapi/{LuCI.Network.Device.html => LuCI.network.Device.html} (75%) rename docs/jsapi/{LuCI.Network.Hosts.html => LuCI.network.Hosts.html} (73%) rename docs/jsapi/{LuCI.Network.Protocol.html => LuCI.network.Protocol.html} (79%) rename docs/jsapi/{LuCI.Network.WifiDevice.html => LuCI.network.WifiDevice.html} (74%) rename docs/jsapi/{LuCI.Network.WifiNetwork.html => LuCI.network.WifiNetwork.html} (80%) rename docs/jsapi/{LuCI.Network.html => LuCI.network.html} (82%) rename docs/jsapi/{LuCI.Poll.html => LuCI.poll.html} (71%) rename docs/jsapi/{LuCI.Request.html => LuCI.request.html} (74%) rename docs/jsapi/{LuCI.Request.poll.html => LuCI.request.poll.html} (71%) rename docs/jsapi/{LuCI.Response.html => LuCI.response.html} (71%) rename docs/jsapi/{LuCI.XHR.html => LuCI.xhr.html} (72%) diff --git a/docs/jsapi/LuCI.Class.html b/docs/jsapi/LuCI.baseclass.html similarity index 72% rename from docs/jsapi/LuCI.Class.html rename to docs/jsapi/LuCI.baseclass.html index cc34d3319..01e84ba58 100644 --- a/docs/jsapi/LuCI.Class.html +++ b/docs/jsapi/LuCI.baseclass.html @@ -2,7 +2,7 @@ - Class: Class + Class: baseclass @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • + -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Class

    +

    Class: baseclass

    @@ -1696,10 +1704,10 @@

    LuCI. - Class + baseclass

    -

    LuCI.Class is the abstract base class all LuCI classes inherit from.

    +

    LuCI.baseclass is the abstract base class all LuCI classes inherit from.

    It provides simple means to create subclasses of given classes and implements prototypal inheritance.

    @@ -1713,9 +1721,9 @@ implements prototypal inheritance.

    -

    +

    - new LuCI.Class() + new LuCI.baseclass()

    @@ -1800,7 +1808,7 @@ implements prototypal inheritance.

    - staticLuCI.Class.extend(properties){LuCI.Class} + staticLuCI.baseclass.extend(properties){LuCI.baseclass}

    @@ -1926,11 +1934,11 @@ subclass.

    - LuCI.Class + LuCI.baseclass - Returns a new LuCI.Class sublassed from this class, extended + Returns a new LuCI.baseclass sublassed from this class, extended by the given properties and with its prototype set to this base class to enable inheritance. The resulting value represents a class constructor and can be instantiated with new. @@ -1950,7 +1958,7 @@ class constructor and can be instantiated with new.

    - staticLuCI.Class.instantiate(params, new_args){LuCI.Class} + staticLuCI.baseclass.instantiate(params, new_args){LuCI.baseclass}

    @@ -2114,11 +2122,11 @@ as-is in order to instantiate the new subclass.

    - LuCI.Class + LuCI.baseclass - Returns a new LuCI.Class instance extended by the given + Returns a new LuCI.baseclass instance extended by the given properties with its prototype set to this base class to enable inheritance. @@ -2137,7 +2145,7 @@ enable inheritance.

    - staticLuCI.Class.isSubclass(classValue){boolean} + staticLuCI.baseclass.isSubclass(classValue){boolean}

    @@ -2190,7 +2198,7 @@ enable inheritance. -LuCI.Class +LuCI.baseclass @@ -2284,7 +2292,7 @@ a subclass of this class'.

    - staticLuCI.Class.singleton(properties, new_args){LuCI.Class} + staticLuCI.baseclass.singleton(properties, new_args){LuCI.baseclass}

    @@ -2305,7 +2313,7 @@ a subclass of this class'. the additional optional arguments passed to this function and returns the resulting subclassed Class instance.

    This function serves as a convenience shortcut for -Class.extend() and subsequent +Class.extend() and subsequent new.

    @@ -2453,11 +2461,11 @@ as-is in order to instantiate the new subclass.

    - LuCI.Class + LuCI.baseclass - Returns a new LuCI.Class instance extended by the given + Returns a new LuCI.baseclass instance extended by the given properties with its prototype set to this base class to enable inheritance. @@ -2934,7 +2942,7 @@ and the values extracted from the args array beginning with
    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.dom.html b/docs/jsapi/LuCI.dom.html index abf438601..c050ca0be 100644 --- a/docs/jsapi/LuCI.dom.html +++ b/docs/jsapi/LuCI.dom.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1720,7 +1728,7 @@ external JavaScript, use L.require("fs").then(...).

      - fs.js, line 145 + fs.js, line 147 @@ -1805,7 +1813,7 @@ external JavaScript, use L.require("fs").then(...).

      - fs.js, line 266 + fs.js, line 268 @@ -2023,7 +2031,7 @@ results or rejecting with an error stating the failure reason. @@ -2301,7 +2309,7 @@ failure reason. @@ -2451,7 +2459,7 @@ of the given file or [] on failure. @@ -2597,7 +2605,7 @@ rejecting with an error stating the failure reason. @@ -2744,7 +2752,7 @@ rejecting with an error stating the failure reason. @@ -2946,7 +2954,7 @@ reason. @@ -3092,7 +3100,7 @@ the failure reason. @@ -3238,7 +3246,7 @@ rejecting with an error stating the failure reason. @@ -3390,7 +3398,7 @@ on failure. @@ -4079,7 +4087,7 @@ the failure reason.
      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/LuCI.Headers.html b/docs/jsapi/LuCI.headers.html similarity index 69% rename from docs/jsapi/LuCI.Headers.html rename to docs/jsapi/LuCI.headers.html index b86cc17b0..4a03cef57 100644 --- a/docs/jsapi/LuCI.Headers.html +++ b/docs/jsapi/LuCI.headers.html @@ -2,7 +2,7 @@ - Class: Headers + Class: headers @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Headers

    +

    Class: headers

    @@ -1696,7 +1704,7 @@

    LuCI. - Headers + headers

    The Headers class is an internal utility class exposed in HTTP @@ -1712,14 +1720,14 @@ response objects using the response.headers property.

    -

    +

    - new LuCI.Headers() + new LuCI.headers()

    @@ -2107,7 +2115,7 @@ Note: Header-Names are case-insensitive.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.html b/docs/jsapi/LuCI.html index 5bf4e3262..d7cf33ced 100644 --- a/docs/jsapi/LuCI.html +++ b/docs/jsapi/LuCI.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • + -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1831,7 +1839,7 @@ accessible using the global L variable.

      Classes

      -
      Class
      +
      baseclass
      dom
      @@ -1840,19 +1848,19 @@ accessible using the global L variable.

      fs
      -
      Headers
      +
      headers
      -
      Network
      +
      network
      -
      Poll
      +
      poll
      -
      Request
      +
      request
      -
      Response
      +
      response
      rpc
      @@ -1867,7 +1875,7 @@ accessible using the global L variable.

      view
      -
      XHR
      +
      xhr
      @@ -1879,6 +1887,102 @@ accessible using the global L variable.

      +
      +
      +

      Class

      +
      + + +
      +
      + +
      +

      Legacy L.Class class alias. New view code should use 'require baseclass'; +to request the LuCI.baseclass class.

      +
      + + + +
      + + + + + + + +
      Deprecated
      • Yes
      + + + + + + + + + + + + + + + +
      + + + +
      + + + +
      +
      +

      dom

      +
      + + +
      +
      + +
      +

      Legacy L.dom class alias. New view code should use 'require dom'; +to request the LuCI.dom class.

      +
      + + + +
      + + + + + + + +
      Deprecated
      • Yes
      + + + + + + + + + + + + + + + +
      + + + +
      + + +

      env

      @@ -1916,6 +2020,150 @@ as request timeouts, base URLs etc.

      + +
      + + + + + + + +
      +
      +

      Poll

      +
      + + +
      +
      + +
      +

      Legacy L.Poll class alias. New view code should use 'require poll'; +to request the LuCI.poll class.

      +
      + + + +
      + + + + + + + +
      Deprecated
      • Yes
      + + + + + + + + + + + + + + + +
      + + + +
      + + + +
      +
      +

      Request

      +
      + + +
      +
      + +
      +

      Legacy L.Request class alias. New view code should use 'require request'; +to request the LuCI.request class.

      +
      + + + +
      + + + + + + + +
      Deprecated
      • Yes
      + + + + + + + + + + + + + + + +
      + + + +
      + + + +
      +
      +

      view

      +
      + + +
      +
      + +
      +

      Legacy L.view class alias. New view code should use 'require view'; +to request the LuCI.view class.

      +
      + + + +
      + + + + + + + +
      Deprecated
      • Yes
      + + + + + + + + + + + + + +
      @@ -1940,7 +2188,7 @@ as request timeouts, base URLs etc.

      @@ -2152,7 +2400,7 @@ as parameters.

      @@ -2391,7 +2639,7 @@ argument or copied from the given error instance.

      @@ -2404,7 +2652,7 @@ argument or copied from the given error instance.

      Issues a GET request to the given url and invokes the specified callback function. The function is a wrapper around -Request.request().

      +Request.request().

      @@ -2603,7 +2851,7 @@ callback function. The function is a wrapper around @@ -2706,7 +2954,7 @@ when it didn't run to begin with. @@ -2899,7 +3147,7 @@ has no sub-features. @@ -3054,7 +3302,7 @@ not null, else returns false. @@ -3154,7 +3402,7 @@ not null, else returns false. @@ -3311,7 +3559,7 @@ slashes and any of the other characters mentioned above.

      @@ -3498,7 +3746,7 @@ slashes and any of the other characters mentioned above.

      @@ -3511,7 +3759,7 @@ slashes and any of the other characters mentioned above.

      Register a polling HTTP request that invokes the specified callback function. The function is a wrapper around -Request.poll.add().

      +Request.poll.add().

      @@ -3779,7 +4027,7 @@ default, regardless of the parameters specified with args.

      Returns the internally created function that has been passed to -Request.poll.add(). This value can +Request.poll.add(). This value can be passed to Poll.remove() to remove the polling request. @@ -3803,7 +4051,7 @@ polling request. @@ -3816,7 +4064,7 @@ polling request.

      Issues a POST request to the given url and invokes the specified callback function. The function is a wrapper around -Request.request(). The request is +Request.request(). The request is sent using application/x-www-form-urlencoded encoding and will contain a field token with the current value of LuCI.env.token by default.

      @@ -4018,7 +4266,7 @@ by default.

      @@ -4252,12 +4500,12 @@ argument or copied from the given error instance.

      - require(name){Promise.<LuCI#Class>} + require(name){Promise.<LuCI.baseclass>}

      @@ -4395,7 +4643,7 @@ circular dependencies.

      -

      Throws NetworkError when the underlying LuCI.Request +

      Throws NetworkError when the underlying LuCI.request call failed.

      @@ -4489,7 +4737,7 @@ class instance.

      - Promise.<LuCI#Class> + Promise.<LuCI.baseclass> @@ -4515,7 +4763,7 @@ class instance.

      @@ -4686,7 +4934,7 @@ to the given default value on error. @@ -4843,7 +5091,7 @@ slashes and any of the other characters mentioned above.

      @@ -4946,7 +5194,7 @@ when it was already running. @@ -5163,7 +5411,7 @@ addresses or numeric values respectively.

      @@ -5311,7 +5559,7 @@ it could not be found. @@ -5461,7 +5709,7 @@ space and returned as array.

      @@ -5624,7 +5872,7 @@ slashes and any of the other characters mentioned above.

      @@ -5795,7 +6043,7 @@ else null.

      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/LuCI.Network.Device.html b/docs/jsapi/LuCI.network.Device.html similarity index 75% rename from docs/jsapi/LuCI.Network.Device.html rename to docs/jsapi/LuCI.network.Device.html index 3ce2664cc..bef9b0849 100644 --- a/docs/jsapi/LuCI.Network.Device.html +++ b/docs/jsapi/LuCI.network.Device.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Device

    +

    Class: Device

    @@ -1694,7 +1702,7 @@

    - LuCI.Network. + LuCI.network. Device

    @@ -1714,12 +1722,12 @@ device and allows querying device details such as packet statistics or MTU.

    <

    - new LuCI.Network.Device() + new LuCI.network.Device()

    @@ -1804,7 +1812,7 @@ device and allows querying device details such as packet statistics or MTU.

    <
    @@ -1908,7 +1916,7 @@ device is not a Linux bridge. @@ -2009,7 +2017,7 @@ enabled, else false. @@ -2110,7 +2118,7 @@ for non-wifi devices or operation mode and ssid for wifi ones. @@ -2210,7 +2218,7 @@ for non-wifi devices or operation mode and ssid for wifi ones. @@ -2310,7 +2318,7 @@ for non-wifi devices or operation mode and ssid for wifi ones. @@ -2414,7 +2422,7 @@ e.g. for non-ethernet tunnel devices. @@ -2514,7 +2522,7 @@ e.g. for non-ethernet tunnel devices. @@ -2609,12 +2617,12 @@ e.g. for non-ethernet tunnel devices.

    - getNetwork(){null|LuCI.Network.Protocol} + getNetwork(){null|LuCI.network.Protocol}

    @@ -2691,7 +2699,7 @@ e.g. for non-ethernet tunnel devices. null | - LuCI.Network.Protocol + LuCI.network.Protocol @@ -2714,12 +2722,12 @@ assigned to any logical interface.

    - getNetworks(){Array.<LuCI.Network.Protocol>} + getNetworks(){Array.<LuCI.network.Protocol>}

    @@ -2793,7 +2801,7 @@ assigned to any logical interface. - Array.<LuCI.Network.Protocol> + Array.<LuCI.network.Protocol> @@ -2815,12 +2823,12 @@ logical interfaces this device is assigned to.

    - getPorts(){null|Array.<LuCI.Network.Device>} + getPorts(){null|Array.<LuCI.network.Device>}

    @@ -2897,7 +2905,7 @@ logical interfaces this device is assigned to. null | - Array.<LuCI.Network.Device> + Array.<LuCI.network.Device> @@ -2925,7 +2933,7 @@ a Linux bridge. @@ -3025,7 +3033,7 @@ a Linux bridge. @@ -3125,7 +3133,7 @@ a Linux bridge. @@ -3226,7 +3234,7 @@ the operation mode and SSID for wifi devices. @@ -3326,7 +3334,7 @@ the operation mode and SSID for wifi devices. @@ -3426,7 +3434,7 @@ the operation mode and SSID for wifi devices. @@ -3535,7 +3543,7 @@ the operation mode and SSID for wifi devices. @@ -3631,12 +3639,12 @@ the operation mode and SSID for wifi devices.

    - getWifiNetwork(){null|LuCI.Network.WifiNetwork} + getWifiNetwork(){null|LuCI.network.WifiNetwork}

    @@ -3713,7 +3721,7 @@ the operation mode and SSID for wifi devices. null | - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork @@ -3741,7 +3749,7 @@ is not a wireless device. @@ -3842,7 +3850,7 @@ else false. @@ -3943,7 +3951,7 @@ else false. @@ -4052,7 +4060,7 @@ when it is down or absent.
    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.Network.Hosts.html b/docs/jsapi/LuCI.network.Hosts.html similarity index 73% rename from docs/jsapi/LuCI.Network.Hosts.html rename to docs/jsapi/LuCI.network.Hosts.html index b6138acc7..16d52ba34 100644 --- a/docs/jsapi/LuCI.Network.Hosts.html +++ b/docs/jsapi/LuCI.network.Hosts.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • + -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Hosts

    +

    Class: Hosts

    @@ -1694,12 +1702,12 @@

    - LuCI.Network. + LuCI.network. Hosts

    -

    The LuCI.Network.Hosts class encapsulates host information aggregated +

    The LuCI.network.Hosts class encapsulates host information aggregated from multiple sources and provides convenience functions to access the host information by different criteria.

    @@ -1715,12 +1723,12 @@ host information by different criteria.

    - new LuCI.Network.Hosts() + new LuCI.network.Hosts()

    @@ -1805,7 +1813,7 @@ host information by different criteria.

    @@ -1955,7 +1963,7 @@ the corresponding host. @@ -2105,7 +2113,7 @@ the corresponding host. @@ -2255,7 +2263,7 @@ the corresponding host. @@ -2405,7 +2413,7 @@ the corresponding host. @@ -2555,7 +2563,7 @@ the corresponding host. @@ -2705,7 +2713,7 @@ the corresponding host. @@ -2855,7 +2863,7 @@ the corresponding host. @@ -3033,7 +3041,7 @@ is used as hint.
    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.Network.Protocol.html b/docs/jsapi/LuCI.network.Protocol.html similarity index 79% rename from docs/jsapi/LuCI.Network.Protocol.html rename to docs/jsapi/LuCI.network.Protocol.html index c104314ec..80db046f8 100644 --- a/docs/jsapi/LuCI.Network.Protocol.html +++ b/docs/jsapi/LuCI.network.Protocol.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • + -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Protocol

    +

    Class: Protocol

    @@ -1694,7 +1702,7 @@

    - LuCI.Network. + LuCI.network. Protocol

    @@ -1714,12 +1722,12 @@ subclasses which describe logical UCI networks defined by config interface

    - new LuCI.Network.Protocol() + new LuCI.network.Protocol()

    @@ -1804,7 +1812,7 @@ subclasses which describe logical UCI networks defined by config interface
    @@ -1852,16 +1860,16 @@ subclasses which describe logical UCI networks defined by config interface -LuCI.Network.Protocol +LuCI.network.Protocol | -LuCI.Network.Device +LuCI.network.Device | -LuCI.Network.WifiDevice +LuCI.network.WifiDevice | -LuCI.Network.WifiNetwork +LuCI.network.WifiNetwork | string @@ -1876,7 +1884,7 @@ subclasses which describe logical UCI networks defined by config interface

    The object or device name to add to the logical interface. In case the given argument is not a string, it is resolved though the -Network.getIfnameOf() function.

    +Network.getIfnameOf() function.

    @@ -1965,7 +1973,7 @@ interface or if the logical interface is virtual. @@ -2014,16 +2022,16 @@ object.

    -LuCI.Network.Protocol +LuCI.network.Protocol | -LuCI.Network.Device +LuCI.network.Device | -LuCI.Network.WifiDevice +LuCI.network.WifiDevice | -LuCI.Network.WifiNetwork +LuCI.network.WifiNetwork | string @@ -2038,7 +2046,7 @@ object.

    The object or device name to check. In case the given argument is not a string, it is resolved though the -Network.getIfnameOf() function.

    +Network.getIfnameOf() function.

    @@ -2126,7 +2134,7 @@ device or false if not. @@ -2236,7 +2244,7 @@ the interface removal will be aborted. @@ -2284,16 +2292,16 @@ the interface removal will be aborted. -LuCI.Network.Protocol +LuCI.network.Protocol | -LuCI.Network.Device +LuCI.network.Device | -LuCI.Network.WifiDevice +LuCI.network.WifiDevice | -LuCI.Network.WifiNetwork +LuCI.network.WifiNetwork | string @@ -2308,7 +2316,7 @@ the interface removal will be aborted.

    The object or device name to remove from the logical interface. In case the given argument is not a string, it is resolved though the -Network.getIfnameOf() function.

    +Network.getIfnameOf() function.

    @@ -2397,7 +2405,7 @@ interface or if the logical interface is virtual. @@ -2544,12 +2552,12 @@ not found. @@ -2624,7 +2632,7 @@ interface.

    - LuCI.Network.Device + LuCI.network.Device @@ -2646,12 +2654,12 @@ expected Linux network device according to the configuration.

    - getDevices(){null|Array.<LuCI.Network.Device>} + getDevices(){null|Array.<LuCI.network.Device>}

    @@ -2729,7 +2737,7 @@ interface.

    null | - Array.<LuCI.Network.Device> + Array.<LuCI.network.Device> @@ -2758,7 +2766,7 @@ virtual and not a bridge. @@ -2859,7 +2867,7 @@ protocol backend. @@ -2960,7 +2968,7 @@ protocol backend. @@ -2977,7 +2985,7 @@ of the underlying logical interface failed, e.g. due to bad configuration or network connectivity issues.

    This function will translate the found error codes to human readable messages using the descriptions registered by -Network.registerErrorCode() +Network.registerErrorCode() and fall back to "Unknown error (%s)" where %s is replaced by the error code in case no translation can be found.

    @@ -3068,7 +3076,7 @@ error code in case no translation can be found.

    @@ -3172,7 +3180,7 @@ if it isn't applicable to the associated protocol. @@ -3274,7 +3282,7 @@ default route or null if no default route was found. @@ -3376,7 +3384,7 @@ default route or null if no default route was found. @@ -3478,7 +3486,7 @@ default route or null if no default route was found. @@ -3582,7 +3590,7 @@ it could not be determined. @@ -3686,7 +3694,7 @@ in CIDR notation or null if no IPv6 addresses were set. @@ -3788,7 +3796,7 @@ follows the order of the addresses in ubus runtime information. - network.js, line 2236 + network.js, line 2239 @@ -3892,7 +3900,7 @@ handler or null if no prefix is present. @@ -3996,7 +4004,7 @@ or null if no IPv4 addresses were set. @@ -4093,12 +4101,12 @@ follows the order of the addresses in ubus runtime information.

    - getL2Device(){LuCI.Network.Device} + getL2Device(){LuCI.network.Device}

    @@ -4173,7 +4181,7 @@ with this logical interface.

    - LuCI.Network.Device + LuCI.network.Device @@ -4195,12 +4203,12 @@ network device currently associated with the logical interface. @@ -4275,7 +4283,7 @@ with this logical interface.

    - LuCI.Network.Device + LuCI.network.Device @@ -4302,7 +4310,7 @@ network device currently associated with the logical interface. @@ -4403,7 +4411,7 @@ routes spawned by the associated logical interface. @@ -4503,7 +4511,7 @@ routes spawned by the associated logical interface. @@ -4607,7 +4615,7 @@ protocol handler or null if no IPv4 addresses were set. @@ -4709,7 +4717,7 @@ function, e.g. odhcp6c for the dhcpv6 prototocol. @@ -4722,7 +4730,7 @@ function, e.g. odhcp6c for the dhcpv6 prototocol.

    Get the name of this network protocol class.

    This function will be overwritten by subclasses created by -Network.registerProtocol().

    +Network.registerProtocol().

    @@ -4812,7 +4820,7 @@ function, e.g. odhcp6c for the dhcpv6 prototocol. @@ -4825,7 +4833,7 @@ function, e.g. odhcp6c for the dhcpv6 prototocol.

    Get the type of the underlying interface.

    This function actually is a convenience wrapper around -proto.get("type") and is mainly used by other LuCI.Network code +proto.get("type") and is mainly used by other LuCI.network code to check whether the interface is declared as bridge in UCI.

    @@ -4919,7 +4927,7 @@ interface or null if no type option is set. @@ -5019,7 +5027,7 @@ interface or null if no type option is set. @@ -5127,7 +5135,7 @@ handler didn't request a zone. @@ -5234,7 +5242,7 @@ is an alias or null if it is not an alias interface. @@ -5323,152 +5331,6 @@ or false when the logical interface is no bridge. - - - - -
    -
    -

    - - abstractisCreateable(ifname){Promise.<(null|string)>} -

    - - - - -
    - - -
    -
    - - -
    -

    Check function for the protocol handler if a new interface is createable.

    -

    This function should be overwritten by protocol specific subclasses.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    ifname - - -string - - - - - -

    The name of the interface to be created.

    - - - -
    - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - - - - - - - - - - - - - - - - - - - -
    TypeDescription
    - - Promise.<(null|string)> - - - Returns null if new interface is createable, else returns (error) message.
    - - - -
    @@ -5482,7 +5344,7 @@ or false when the logical interface is no bridge. @@ -5587,7 +5449,7 @@ or not (false). @@ -5688,7 +5550,7 @@ has no network devices attached.

    @@ -5797,7 +5659,7 @@ or not (false). @@ -5901,7 +5763,7 @@ returns true.

    @@ -6001,7 +5863,7 @@ returns true.

    @@ -6108,7 +5970,7 @@ dynamic interfaces (true) or not (false). @@ -6262,7 +6124,7 @@ configuration.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.Network.WifiDevice.html b/docs/jsapi/LuCI.network.WifiDevice.html similarity index 74% rename from docs/jsapi/LuCI.Network.WifiDevice.html rename to docs/jsapi/LuCI.network.WifiDevice.html index 5bde32805..ab2b904c3 100644 --- a/docs/jsapi/LuCI.Network.WifiDevice.html +++ b/docs/jsapi/LuCI.network.WifiDevice.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: WifiDevice

    +

    Class: WifiDevice

    @@ -1694,7 +1702,7 @@

    - LuCI.Network. + LuCI.network. WifiDevice

    @@ -1715,12 +1723,12 @@ well as methods for enumerating related wireless networks.

    - new LuCI.Network.WifiDevice() + new LuCI.network.WifiDevice()

    @@ -1800,12 +1808,12 @@ well as methods for enumerating related wireless networks.

    - addWifiNetwork(options){Promise.<(null|LuCI.Network.WifiNetwork)>} + addWifiNetwork(options){Promise.<(null|LuCI.network.WifiNetwork)>}

    @@ -1932,7 +1940,7 @@ configuration and sets its options to the provided values.

    - Promise.<(null|LuCI.Network.WifiNetwork)> + Promise.<(null|LuCI.network.WifiNetwork)> @@ -1960,7 +1968,7 @@ were invalid. @@ -2112,7 +2120,7 @@ with this wireless radio device. @@ -2264,7 +2272,7 @@ not found. @@ -2375,7 +2383,7 @@ known mode values are: @@ -2485,7 +2493,7 @@ known mode values are: @@ -2585,7 +2593,7 @@ known mode values are: @@ -2682,12 +2690,12 @@ for the wireless phy.

    - getScanList(){Promise.<Array.<LuCI.Network.WifiScanResult>>} + getScanList(){Promise.<Array.<LuCI.network.WifiScanResult>>}

    @@ -2762,7 +2770,7 @@ nearby networks.

    - Promise.<Array.<LuCI.Network.WifiScanResult>> + Promise.<Array.<LuCI.network.WifiScanResult>> @@ -2784,12 +2792,12 @@ describing the networks found in the vincinity.

    - getWifiNetwork(network){Promise.<LuCI.Network.WifiNetwork>} + getWifiNetwork(network){Promise.<LuCI.network.WifiNetwork>}

    @@ -2911,7 +2919,7 @@ corresponding configuration section through ubus runtime informatio - Promise.<LuCI.Network.WifiNetwork> + Promise.<LuCI.network.WifiNetwork> @@ -2935,12 +2943,12 @@ this radio device.

    - getWifiNetworks(){Promise.<Array.<LuCI.Network.WifiNetwork>>} + getWifiNetworks(){Promise.<Array.<LuCI.network.WifiNetwork>>}

    @@ -3014,7 +3022,7 @@ this radio device. - Promise.<Array.<LuCI.Network.WifiNetwork>> + Promise.<Array.<LuCI.network.WifiNetwork>> @@ -3042,7 +3050,7 @@ radio device. @@ -3144,7 +3152,7 @@ UCI configuration. @@ -3245,7 +3253,7 @@ runtime state.

    @@ -3399,7 +3407,7 @@ configuration.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.Network.WifiNetwork.html b/docs/jsapi/LuCI.network.WifiNetwork.html similarity index 80% rename from docs/jsapi/LuCI.Network.WifiNetwork.html rename to docs/jsapi/LuCI.network.WifiNetwork.html index e43432ba7..3942a108a 100644 --- a/docs/jsapi/LuCI.Network.WifiNetwork.html +++ b/docs/jsapi/LuCI.network.WifiNetwork.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: WifiNetwork

    +

    Class: WifiNetwork

    @@ -1694,7 +1702,7 @@

    - LuCI.Network. + LuCI.network. WifiNetwork

    @@ -1716,12 +1724,12 @@ such networks in parallel.

    - new LuCI.Network.WifiNetwork() + new LuCI.network.WifiNetwork()

    @@ -1806,7 +1814,7 @@ such networks in parallel.

    @@ -2077,7 +2085,7 @@ are passed. @@ -2229,7 +2237,7 @@ not found. @@ -2330,7 +2338,7 @@ information. @@ -2431,7 +2439,7 @@ encryption state could not be found in ubus runtime information. - network.js, line 3617 + network.js, line 3603 @@ -2544,7 +2552,7 @@ state. Possible returned values are: @@ -2646,7 +2654,7 @@ translated string.

    @@ -2742,12 +2750,12 @@ information.

    - getAssocList(){Promise.<Array.<LuCI.Network.WifiPeerEntry>>} + getAssocList(){Promise.<Array.<LuCI.network.WifiPeerEntry>>}

    @@ -2821,7 +2829,7 @@ information. - Promise.<Array.<LuCI.Network.WifiPeerEntry>> + Promise.<Array.<LuCI.network.WifiPeerEntry>> @@ -2848,7 +2856,7 @@ with this network. @@ -2954,7 +2962,7 @@ is not available. @@ -3057,7 +3065,7 @@ is not available. @@ -3161,7 +3169,7 @@ or null if it cannot be determined. @@ -3257,12 +3265,12 @@ information or 00 if it cannot be determined. @@ -3336,7 +3344,7 @@ information or 00 if it cannot be determined. - LuCI.Network.Device + LuCI.network.Device @@ -3363,7 +3371,7 @@ device associted with this wireless network. @@ -3468,7 +3476,7 @@ available. @@ -3571,7 +3579,7 @@ name, depending on which information is available. @@ -3674,7 +3682,7 @@ radio and network index numbers.

    @@ -3779,7 +3787,7 @@ associated network device, e.g. when not configured or up. @@ -3883,7 +3891,7 @@ is not in mesh mode. @@ -3990,7 +3998,7 @@ is not in mesh mode. @@ -4085,12 +4093,12 @@ is not in mesh mode.

    - getNetwork(){null|LuCI.Network.Protocol} + getNetwork(){null|LuCI.network.Protocol}

    @@ -4167,7 +4175,7 @@ is not in mesh mode. null | - LuCI.Network.Protocol + LuCI.network.Protocol @@ -4195,7 +4203,7 @@ interface. @@ -4291,12 +4299,12 @@ attached to.

    - getNetworks(){Array.<LuCI.Network.Protocol>} + getNetworks(){Array.<LuCI.network.Protocol>}

    @@ -4370,7 +4378,7 @@ attached to.

    - Array.<LuCI.Network.Protocol> + Array.<LuCI.network.Protocol> @@ -4397,7 +4405,7 @@ logical interfaces this wireless network is attached to. @@ -4498,7 +4506,7 @@ information or 0 if it cannot be determined. @@ -4600,7 +4608,7 @@ internal network ID, depending on which information is available. @@ -4704,7 +4712,7 @@ information or null if it cannot be determined. @@ -4807,7 +4815,7 @@ noise and signal (SNR), divided by 5. @@ -4909,7 +4917,7 @@ by ubus runtime state. @@ -5013,7 +5021,7 @@ in mesh mode. @@ -5117,7 +5125,7 @@ in mesh mode. @@ -5216,12 +5224,12 @@ cannot be determined.

    - getWifiDevice(){null|LuCI.Network.WifiDevice} + getWifiDevice(){null|LuCI.network.WifiDevice}

    @@ -5298,7 +5306,7 @@ cannot be determined. null | - LuCI.Network.WifiDevice + LuCI.network.WifiDevice @@ -5326,7 +5334,7 @@ found. @@ -5430,7 +5438,7 @@ or null if it cannot be determined. @@ -5531,7 +5539,7 @@ deauthenticating clients, otherwise false. @@ -5633,7 +5641,7 @@ UCI configuration. @@ -5738,7 +5746,7 @@ instance.

    @@ -5892,7 +5900,7 @@ configuration.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.Network.html b/docs/jsapi/LuCI.network.html similarity index 82% rename from docs/jsapi/LuCI.Network.html rename to docs/jsapi/LuCI.network.html index 67a6d1b98..60b16624c 100644 --- a/docs/jsapi/LuCI.Network.html +++ b/docs/jsapi/LuCI.network.html @@ -2,7 +2,7 @@ - Class: Network + Class: network @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Network

    +

    Class: network

    @@ -1696,10 +1704,10 @@

    LuCI. - Network + network

    -

    The LuCI.Network class combines data from multiple ubus apis to +

    The LuCI.network class combines data from multiple ubus apis to provide an abstraction of the current network configuration state.

    It provides methods to enumerate interfaces and devices, to query current configuration details and to manipulate settings.

    @@ -1714,14 +1722,14 @@ current configuration details and to manipulate settings.

    -

    +

    - new LuCI.Network() + new LuCI.network()

    @@ -1790,19 +1798,19 @@ current configuration details and to manipulate settings.

    Classes

    -
    Device
    +
    Device
    -
    Hosts
    +
    Hosts
    -
    Protocol
    +
    Protocol
    -
    WifiDevice
    +
    WifiDevice
    -
    WifiNetwork
    +
    WifiNetwork
    @@ -1820,12 +1828,12 @@ current configuration details and to manipulate settings.

    - addNetwork(name, options){Promise.<(null|LuCI.Network.Protocol)>} + addNetwork(name, options){Promise.<(null|LuCI.network.Protocol)>}

    @@ -1983,7 +1991,7 @@ update in an existing, empty network.

    - Promise.<(null|LuCI.Network.Protocol)> + Promise.<(null|LuCI.network.Protocol)> @@ -2007,12 +2015,12 @@ existed.

    - addWifiNetwork(options){Promise.<(null|LuCI.Network.WifiNetwork)>} + addWifiNetwork(options){Promise.<(null|LuCI.network.WifiNetwork)>}

    @@ -2134,7 +2142,7 @@ name the new network belongs to.

    - Promise.<(null|LuCI.Network.WifiNetwork)> + Promise.<(null|LuCI.network.WifiNetwork)> @@ -2162,7 +2170,7 @@ were invalid or if the associated radio device could not be found. @@ -2310,7 +2318,7 @@ references to it were successfully deleted from the configuration or @@ -2460,7 +2468,7 @@ be found. @@ -2561,7 +2569,7 @@ from the remote ubus apis.

    @@ -2572,7 +2580,7 @@ from the remote ubus apis.

    -

    Converts a given encryption entry +

    Converts a given encryption entry into a human readable string such as mixed WPA/WPA2 PSK (TKIP, CCMP) or WPA3 SAE (CCMP).

    @@ -2611,7 +2619,7 @@ or WPA3 SAE (CCMP).

    -LuCI.Network.WifiEncryption +LuCI.network.WifiEncryption @@ -2707,12 +2715,12 @@ or WPA3 SAE (CCMP).

    - getDevice(name){Promise.<(null|LuCI.Network.Device)>} + getDevice(name){Promise.<(null|LuCI.network.Device)>}

    @@ -2723,7 +2731,7 @@ or WPA3 SAE (CCMP).

    -

    Get a Device instance describing the +

    Get a Device instance describing the given network device.

    @@ -2832,7 +2840,7 @@ given network device.

    - Promise.<(null|LuCI.Network.Device)> + Promise.<(null|LuCI.network.Device)> @@ -2855,12 +2863,12 @@ be found.

    - getDevices(){Promise.<Array.<LuCI.Network.Device>>} + getDevices(){Promise.<Array.<LuCI.network.Device>>}

    @@ -2934,7 +2942,7 @@ be found. - Promise.<Array.<LuCI.Network.Device>> + Promise.<Array.<LuCI.network.Device>> @@ -2961,7 +2969,7 @@ instances describing the network devices found on the system. @@ -3057,12 +3065,12 @@ instances describing the network devices found on the system.

    - getHostHints(){Promise.<LuCI.Network.Hosts>} + getHostHints(){Promise.<LuCI.network.Hosts>}

    @@ -3076,7 +3084,7 @@ instances describing the network devices found on the system.

    Queries aggregated information about known hosts.

    This function aggregates information from various sources such as DHCP lease databases, ARP and IPv6 neighbour entries, wireless -association list etc. and returns a Hosts +association list etc. and returns a Hosts class instance describing the found hosts.

    @@ -3140,7 +3148,7 @@ class instance describing the found hosts.

    - Promise.<LuCI.Network.Hosts> + Promise.<LuCI.network.Hosts> @@ -3166,7 +3174,7 @@ class instance describing the found hosts.

    @@ -3214,16 +3222,16 @@ class instance describing the found hosts.

    -LuCI.Network.Protocol +LuCI.network.Protocol | -LuCI.Network.Device +LuCI.network.Device | -LuCI.Network.WifiDevice +LuCI.network.WifiDevice | -LuCI.Network.WifiNetwork +LuCI.network.WifiNetwork | string @@ -3322,12 +3330,12 @@ object could not be converted to a name.

    - getNetwork(name){Promise.<(null|LuCI.Network.Protocol)>} + getNetwork(name){Promise.<(null|LuCI.network.Protocol)>}

    @@ -3338,7 +3346,7 @@ object could not be converted to a name.
    -

    Get a Protocol instance describing +

    Get a Protocol instance describing the network with the given name.

    @@ -3447,12 +3455,12 @@ the network with the given name.

    - Promise.<(null|LuCI.Network.Protocol)> + Promise.<(null|LuCI.network.Protocol)> Returns a promise resolving to a -Protocol subclass instance describing +Protocol subclass instance describing the network or null if the network did not exist. @@ -3470,12 +3478,12 @@ the network or null if the network did not exist.

    - getNetworks(){Promise.<Array.<LuCI.Network.Protocol>>} + getNetworks(){Promise.<Array.<LuCI.network.Protocol>>}

    @@ -3549,12 +3557,12 @@ the network or null if the network did not exist. - Promise.<Array.<LuCI.Network.Protocol>> + Promise.<Array.<LuCI.network.Protocol>> Returns a promise resolving to a name-sorted array of -Protocol subclass instances +Protocol subclass instances describing all known networks. @@ -3572,12 +3580,12 @@ describing all known networks.

    - getProtocol(protoname, netname){null|LuCI.Network.Protocol} + getProtocol(protoname, netname){null|LuCI.network.Protocol}

    @@ -3588,7 +3596,7 @@ describing all known networks.
    -

    Instantiates the given Protocol backend, +

    Instantiates the given Protocol backend, optionally using the given network name.

    @@ -3750,7 +3758,7 @@ without the need for an existing interface.

    null | - LuCI.Network.Protocol + LuCI.network.Protocol @@ -3772,12 +3780,12 @@ protocol isn't known.

    - getProtocols(){Array.<LuCI.Network.Protocol>} + getProtocols(){Array.<LuCI.network.Protocol>}

    @@ -3788,7 +3796,7 @@ protocol isn't known.
    -

    Obtains instances of all known Protocol +

    Obtains instances of all known Protocol backend classes.

    @@ -3852,7 +3860,7 @@ backend classes.

    - Array.<LuCI.Network.Protocol> + Array.<LuCI.network.Protocol> @@ -3873,12 +3881,12 @@ backend classes.

    - getSwitchTopologies(){Promise.<Object.<string, LuCI.Network.SwitchTopology>>} + getSwitchTopologies(){Promise.<Object.<string, LuCI.network.SwitchTopology>>}

    @@ -3952,14 +3960,14 @@ backend classes.

    - Promise.<Object.<string, LuCI.Network.SwitchTopology>> + Promise.<Object.<string, LuCI.network.SwitchTopology>> Returns a promise resolving to an object containing the topologies of each switch. The object keys correspond to the name of the switches such as switch0, the values are -SwitchTopology objects describing +SwitchTopology objects describing the layout. @@ -3977,12 +3985,12 @@ the layout.

    - getWAN6Networks(){Promise.<Array.<LuCI.Network.Protocol>>} + getWAN6Networks(){Promise.<Array.<LuCI.network.Protocol>>}

    @@ -4058,7 +4066,7 @@ and returns them as array.

    - Promise.<Array.<LuCI.Network.Protocol>> + Promise.<Array.<LuCI.network.Protocol>> @@ -4080,12 +4088,12 @@ instances describing the found IPv6 default route interfaces.

    - getWANNetworks(){Promise.<Array.<LuCI.Network.Protocol>>} + getWANNetworks(){Promise.<Array.<LuCI.network.Protocol>>}

    @@ -4161,7 +4169,7 @@ and returns them as array.

    - Promise.<Array.<LuCI.Network.Protocol>> + Promise.<Array.<LuCI.network.Protocol>> @@ -4183,12 +4191,12 @@ instances describing the found default route interfaces.

    - getWifiDevice(devname){Promise.<(null|LuCI.Network.WifiDevice)>} + getWifiDevice(devname){Promise.<(null|LuCI.network.WifiDevice)>}

    @@ -4199,7 +4207,7 @@ instances describing the found default route interfaces.
    -

    Get a WifiDevice instance describing +

    Get a WifiDevice instance describing the given wireless radio.

    @@ -4309,7 +4317,7 @@ for the first mac80211 phy on the system.

    - Promise.<(null|LuCI.Network.WifiDevice)> + Promise.<(null|LuCI.network.WifiDevice)> @@ -4332,12 +4340,12 @@ be found.

    - getWifiDevices(){Promise.<Array.<LuCI.Network.WifiDevice>>} + getWifiDevices(){Promise.<Array.<LuCI.network.WifiDevice>>}

    @@ -4411,7 +4419,7 @@ be found. - Promise.<Array.<LuCI.Network.WifiDevice>> + Promise.<Array.<LuCI.network.WifiDevice>> @@ -4435,12 +4443,12 @@ the configuration.

    - getWifiNetwork(netname){Promise.<(null|LuCI.Network.WifiNetwork)>} + getWifiNetwork(netname){Promise.<(null|LuCI.network.WifiNetwork)>}

    @@ -4451,7 +4459,7 @@ the configuration.
    -

    Get a WifiNetwork instance describing +

    Get a WifiNetwork instance describing the given wireless network.

    @@ -4563,7 +4571,7 @@ corresponding configuration section through ubus runtime informatio - Promise.<(null|LuCI.Network.WifiNetwork)> + Promise.<(null|LuCI.network.WifiNetwork)> @@ -4586,12 +4594,12 @@ be found.

    - getWifiNetworks(){Promise.<Array.<LuCI.Network.WifiNetwork>>} + getWifiNetworks(){Promise.<Array.<LuCI.network.WifiNetwork>>}

    @@ -4602,7 +4610,7 @@ be found.
    -

    Get an array of all WifiNetwork +

    Get an array of all WifiNetwork instances describing the wireless networks present on the system.

    @@ -4666,7 +4674,7 @@ instances describing the wireless networks present on the system.

    - Promise.<Array.<LuCI.Network.WifiNetwork>> + Promise.<Array.<LuCI.network.WifiNetwork>> @@ -4694,7 +4702,7 @@ are found. @@ -4844,7 +4852,7 @@ else returns false. @@ -5041,7 +5049,7 @@ if the given netmask value was invalid. @@ -5239,7 +5247,7 @@ value of 32 for IPv4 or 128 for IPv6. @@ -5411,7 +5419,7 @@ description for the given code. @@ -5524,12 +5532,12 @@ such as 6in4-wan or tun0.

    - registerProtocol(protoname, methods){LuCI.Network.Protocol} + registerProtocol(protoname, methods){LuCI.network.Protocol}

    @@ -5540,10 +5548,10 @@ such as 6in4-wan or tun0.

    -

    Registers a new Protocol subclass +

    Registers a new Protocol subclass with the given methods and returns the resulting subclass value.

    This functions internally calls -Class.extend() on the Network.Protocol +Class.extend() on the Network.Protocol base class.

    @@ -5615,7 +5623,7 @@ base class.

    The member methods and values of the new Protocol subclass to -be passed to Class.extend().

    +be passed to Class.extend().

    @@ -5676,7 +5684,7 @@ be passed to Class.extend().< - LuCI.Network.Protocol + LuCI.network.Protocol @@ -5702,7 +5710,7 @@ be passed to Class.extend().< @@ -5873,7 +5881,7 @@ rename could not be found.
    -

    LuCI.Network.SwitchTopologyObject.<string, (Object|Array)>

    +

    LuCI.network.SwitchTopologyObject.<string, (Object|Array)>

    @@ -6005,7 +6013,7 @@ function (CPU ports only)
  • -

    LuCI.Network.WifiEncryptionObject.<string, (boolean|Array.<(number|string)>)>

    +

    LuCI.network.WifiEncryptionObject.<string, (boolean|Array.<(number|string)>)>

    @@ -6250,7 +6258,7 @@ WEP network.

    -

    LuCI.Network.WifiPeerEntryObject.<string, (boolean|number|string|LuCI.Network.WifiRateEntry)>

    +

    LuCI.network.WifiPeerEntryObject.<string, (boolean|number|string|LuCI.network.WifiRateEntry)>

    @@ -6913,7 +6921,7 @@ string ('') or absent if not applicable or supported by the driver. -LuCI.Network.WifiRateEntry +LuCI.network.WifiRateEntry @@ -6942,7 +6950,7 @@ string ('') or absent if not applicable or supported by the driver. -LuCI.Network.WifiRateEntry +LuCI.network.WifiRateEntry @@ -6996,7 +7004,7 @@ string ('') or absent if not applicable or supported by the driver.
    -

    LuCI.Network.WifiRateEntryObject.<string, (boolean|number)>

    +

    LuCI.network.WifiRateEntryObject.<string, (boolean|number)>

    @@ -7474,7 +7482,7 @@ Only applicable to VHT rates.

    -

    LuCI.Network.WifiScanResultObject.<string, (number|string|LuCI.Network.WifiEncryption)>

    +

    LuCI.network.WifiScanResultObject.<string, (number|string|LuCI.network.WifiEncryption)>

    @@ -7686,7 +7694,7 @@ conjunction with quality to calculate a quality percentage.

    -LuCI.Network.WifiEncryption +LuCI.network.WifiEncryption @@ -7747,7 +7755,7 @@ conjunction with quality to calculate a quality percentage.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time) diff --git a/docs/jsapi/LuCI.Poll.html b/docs/jsapi/LuCI.poll.html similarity index 71% rename from docs/jsapi/LuCI.Poll.html rename to docs/jsapi/LuCI.poll.html index 0952abd55..26a588a68 100644 --- a/docs/jsapi/LuCI.Poll.html +++ b/docs/jsapi/LuCI.poll.html @@ -2,7 +2,7 @@ - Class: Poll + Class: poll @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Poll

    +

    Class: poll

    @@ -1696,7 +1704,7 @@

    LuCI. - Poll + poll

    The Poll class allows registering and unregistering poll actions, @@ -1713,14 +1721,14 @@ loop.

    -

    +

    - new LuCI.Poll() + new LuCI.poll()

    @@ -2490,7 +2498,7 @@ run to begin with.
    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.Request.html b/docs/jsapi/LuCI.request.html similarity index 74% rename from docs/jsapi/LuCI.Request.html rename to docs/jsapi/LuCI.request.html index b3cbe7cbf..a505568cb 100644 --- a/docs/jsapi/LuCI.Request.html +++ b/docs/jsapi/LuCI.request.html @@ -2,7 +2,7 @@ - Class: Request + Class: request @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Request

    +

    Class: request

    @@ -1696,7 +1704,7 @@

    LuCI. - Request + request

    The Request class allows initiating HTTP requests and provides utilities @@ -1712,14 +1720,14 @@ for dealing with responses.

    -

    +

    - new LuCI.Request() + new LuCI.request()

    @@ -1788,7 +1796,7 @@ for dealing with responses.

    Classes

    -
    poll
    +
    poll
    @@ -1806,7 +1814,7 @@ for dealing with responses.

    - addInterceptor(interceptorFn){LuCI.Request.interceptorFn} + addInterceptor(interceptorFn){LuCI.request.interceptorFn}

    @@ -1862,7 +1870,7 @@ implementing request retries before returning a failure.

    -LuCI.Request.interceptorFn +LuCI.request.interceptorFn @@ -1933,7 +1941,7 @@ implementing request retries before returning a failure.

    - LuCI.Request.interceptorFn + LuCI.request.interceptorFn @@ -2100,7 +2108,7 @@ if it already was absolute.

    - get(target, options){Promise.<LuCI.Response>} + get(target, options){Promise.<LuCI.response>}

    @@ -2181,7 +2189,7 @@ if it already was absolute. -LuCI.Request.RequestOptions +LuCI.request.RequestOptions @@ -2259,7 +2267,7 @@ if it already was absolute. - Promise.<LuCI.Response> + Promise.<LuCI.response> @@ -2280,7 +2288,7 @@ if it already was absolute.

    - post(target, data, options){Promise.<LuCI.Response>} + post(target, data, options){Promise.<LuCI.response>}

    @@ -2378,7 +2386,7 @@ if it already was absolute. -

    The request data to send, see LuCI.Request.RequestOptions for details.

    +

    The request data to send, see LuCI.request.RequestOptions for details.

    @@ -2391,7 +2399,7 @@ if it already was absolute. -LuCI.Request.RequestOptions +LuCI.request.RequestOptions @@ -2469,7 +2477,7 @@ if it already was absolute. - Promise.<LuCI.Response> + Promise.<LuCI.response> @@ -2545,7 +2553,7 @@ function.

    -LuCI.Request.interceptorFn +LuCI.request.interceptorFn @@ -2637,7 +2645,7 @@ function.

    - request(target, options){Promise.<LuCI.Response>} + request(target, options){Promise.<LuCI.response>}

    @@ -2718,7 +2726,7 @@ function.

    -LuCI.Request.RequestOptions +LuCI.request.RequestOptions @@ -2796,7 +2804,7 @@ function.

    - Promise.<LuCI.Response> + Promise.<LuCI.response> @@ -2823,7 +2831,7 @@ function.

    - LuCI.Request.interceptorFn(res) + LuCI.request.interceptorFn(res)

    @@ -2877,7 +2885,7 @@ these functions have been registered.

    -LuCI.Response +LuCI.response @@ -2938,7 +2946,7 @@ these functions have been registered.

    -

    LuCI.Request.RequestOptionsObject

    +

    LuCI.request.RequestOptionsObject

    @@ -3425,7 +3433,7 @@ instances as sole argument during the HTTP request transfer.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.Request.poll.html b/docs/jsapi/LuCI.request.poll.html similarity index 71% rename from docs/jsapi/LuCI.Request.poll.html rename to docs/jsapi/LuCI.request.poll.html index 7a993ab57..b1c040599 100644 --- a/docs/jsapi/LuCI.Request.poll.html +++ b/docs/jsapi/LuCI.request.poll.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: poll

    +

    Class: poll

    @@ -1694,13 +1702,13 @@

    - LuCI.Request. + LuCI.request. poll

    The Request.poll class provides some convience wrappers around -LuCI.Poll mainly to simplify registering repeating HTTP +LuCI.poll mainly to simplify registering repeating HTTP request calls as polling functions.

    @@ -1715,7 +1723,7 @@ request calls as polling functions.

    - new LuCI.Request.poll() + new LuCI.request.poll()

    @@ -1816,7 +1824,7 @@ request calls as polling functions.

    -

    Alias for LuCI.Poll.active().

    +

    Alias for LuCI.poll.active().

    @@ -1981,7 +1989,7 @@ to invoke whenever a response for the request is received.

    -LuCI.Request.RequestOptions +LuCI.request.RequestOptions @@ -2011,7 +2019,7 @@ to invoke whenever a response for the request is received.

    -LuCI.Request.poll~callbackFn +LuCI.request.poll~callbackFn @@ -2028,7 +2036,7 @@ to invoke whenever a response for the request is received.

    -

    Callback function to +

    Callback function to invoke for each HTTP reply.

    @@ -2156,7 +2164,7 @@ invoke for each HTTP reply.

    Remove a polling request that has been previously added using add(). This function is essentially a wrapper around -LuCI.Poll.remove().

    +LuCI.poll.remove().

    @@ -2203,7 +2211,7 @@ This function is essentially a wrapper around -

    The poll function returned by add().

    +

    The poll function returned by add().

    @@ -2301,7 +2309,7 @@ This function is essentially a wrapper around
    -

    Alias for LuCI.Poll.start().

    +

    Alias for LuCI.poll.start().

    @@ -2372,7 +2380,7 @@ This function is essentially a wrapper around
    -

    Alias for LuCI.Poll.stop().

    +

    Alias for LuCI.poll.stop().

    @@ -2488,7 +2496,7 @@ out.

    -LuCI.Response +LuCI.response @@ -2609,7 +2617,7 @@ else null.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.Response.html b/docs/jsapi/LuCI.response.html similarity index 71% rename from docs/jsapi/LuCI.Response.html rename to docs/jsapi/LuCI.response.html index a861348b3..a6f76a997 100644 --- a/docs/jsapi/LuCI.Response.html +++ b/docs/jsapi/LuCI.response.html @@ -2,7 +2,7 @@ - Class: Response + Class: response @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: Response

    +

    Class: response

    @@ -1696,7 +1704,7 @@

    LuCI. - Response + response

    The Response class is an internal utility class representing HTTP responses.

    @@ -1711,14 +1719,14 @@
    -

    +

    - new LuCI.Response() + new LuCI.response()

    @@ -1839,7 +1847,7 @@
    -

    headersLuCI.Headers

    +

    headersLuCI.headers

    @@ -2172,7 +2180,7 @@

    - clone(content){LuCI.Response} + clone(content){LuCI.response}

    @@ -2306,7 +2314,7 @@ using String() and treated as response text.

    - LuCI.Response + LuCI.response @@ -2567,7 +2575,7 @@ using String() and treated as response text.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/LuCI.rpc.html b/docs/jsapi/LuCI.rpc.html index 2b421cdc9..372aa5212 100644 --- a/docs/jsapi/LuCI.rpc.html +++ b/docs/jsapi/LuCI.rpc.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1728,7 +1736,7 @@ it in external JavaScript, use L.require("ui").then(...) @@ -1813,7 +1821,7 @@ it in external JavaScript, use L.require("ui").then(...) @@ -1922,7 +1930,7 @@ an array of strings or null for unset values. @@ -2023,7 +2031,7 @@ not meet the validation constraints. @@ -2193,7 +2201,7 @@ registered.

      @@ -2294,7 +2302,7 @@ widget markup. @@ -2451,7 +2459,7 @@ as dirty.

      @@ -2606,7 +2614,7 @@ trigger input value validation.

      @@ -2731,7 +2739,7 @@ or null values.

      @@ -2987,7 +2995,7 @@ corresponding <input> element.

      An expression describing the input data validation constraints. It defaults to string which will allow any value. -SeeLuCI.validation for details on the expression format.

      +See LuCI.validation for details on the expression format.

      @@ -3076,7 +3084,7 @@ converted to a string and treated as validation error message.

      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/LuCI.ui.Checkbox.html b/docs/jsapi/LuCI.ui.Checkbox.html index 79fa47f08..2554607b9 100644 --- a/docs/jsapi/LuCI.ui.Checkbox.html +++ b/docs/jsapi/LuCI.ui.Checkbox.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1720,7 +1728,7 @@ external JavaScript, use L.require("ui").then(...).

      - ui.js, line 2925 + ui.js, line 2929 @@ -1848,7 +1856,7 @@ external JavaScript, use L.require("ui").then(...).

      - ui.js, line 3105 + ui.js, line 3109 @@ -1950,7 +1958,7 @@ will be rendered.

      The contents to add to the notification banner. This should be a DOM node or a document fragment in most cases. The value is passed as-is -to the L.dom.content() function - refer to its documentation for +to the dom.content() function - refer to its documentation for applicable values.

      @@ -2078,7 +2086,7 @@ banner element.

      @@ -2392,7 +2400,7 @@ trigger field validation or to bind it to further events. @@ -2529,7 +2537,7 @@ default.

      @@ -2755,7 +2763,7 @@ valid function value. @@ -2903,7 +2911,7 @@ requested indicator was not found. @@ -2979,7 +2987,7 @@ handler as-is without the need to bind it first.

      @@ -3221,7 +3229,7 @@ accepted by LuCI.dom.content().

      @@ -3424,7 +3432,7 @@ or rejecting with null when the connectivity check timed out. @@ -3695,7 +3703,7 @@ changes were made. @@ -3796,7 +3804,7 @@ the dialog. Valid values for the classes depend on the underlying theme.

      The contents to add to the modal dialog. This should be a DOM node or a document fragment in most cases. The value is passed as-is to the -L.dom.content() function - refer to its documentation for applicable +dom.content() function - refer to its documentation for applicable values.

      @@ -3924,7 +3932,7 @@ element.

      @@ -4282,7 +4290,7 @@ cancelled by the user.
      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/LuCI.ui.tabs.html b/docs/jsapi/LuCI.ui.tabs.html index ec5f92ffb..16d23dcfe 100644 --- a/docs/jsapi/LuCI.ui.tabs.html +++ b/docs/jsapi/LuCI.ui.tabs.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1724,7 +1732,7 @@ external JavaScript, use L.require("ui").then(...) and ac @@ -1809,7 +1817,7 @@ external JavaScript, use L.require("ui").then(...) and ac @@ -1938,7 +1946,7 @@ DOM node.

      @@ -2091,7 +2099,7 @@ DOM node.

      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/LuCI.view.html b/docs/jsapi/LuCI.view.html index 200f00ea5..456beee2a 100644 --- a/docs/jsapi/LuCI.view.html +++ b/docs/jsapi/LuCI.view.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1685,7 +1693,7 @@
    -

    Class: XHR

    +

    Class: xhr

    @@ -1696,13 +1704,13 @@

    LuCI. - XHR + xhr

    -

    The LuCI.XHR class is a legacy compatibility shim for the +

    The LuCI.xhr class is a legacy compatibility shim for the functionality formerly provided by xhr.js. It is registered as global window.XHR symbol for compatibility with legacy code.

    -

    New code should use LuCI.Request instead to implement HTTP +

    New code should use LuCI.request instead to implement HTTP request handling.

    @@ -1715,14 +1723,14 @@ request handling.

    -

    +

    - new LuCI.XHR() + new LuCI.xhr()

    @@ -1809,7 +1817,7 @@ request handling.

    @@ -1883,7 +1891,7 @@ request handling.

    @@ -1986,7 +1994,7 @@ already completed. @@ -2063,7 +2071,7 @@ finishes or timed out.

    @@ -2306,7 +2314,7 @@ finishes or timed out.

    @@ -2549,7 +2557,7 @@ finishes or timed out.

    @@ -2659,7 +2667,7 @@ when invoked.

    - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
    diff --git a/docs/jsapi/fs.js.html b/docs/jsapi/fs.js.html index 292a521ba..3839d60fb 100644 --- a/docs/jsapi/fs.js.html +++ b/docs/jsapi/fs.js.html @@ -43,8 +43,18 @@ Members +
  • Class
  • + +
  • dom
  • +
  • env
  • +
  • Poll
  • + +
  • Request
  • + +
  • view
  • +
      @@ -106,9 +116,9 @@
    -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1694,6 +1702,8 @@
      'use strict';
       'require rpc';
      +'require request';
      +'require baseclass';
       
       /**
        * @typedef {Object} FileStatEntry
      @@ -1846,7 +1856,7 @@ function handleCgiIoReply(res) {
        * To import the class in views, use `'require fs'`, to import it in
        * external JavaScript, use `L.require("fs").then(...)`.
        */
      -var FileSystem = L.Class.extend(/** @lends LuCI.fs.prototype */ {
      +var FileSystem = baseclass.extend(/** @lends LuCI.fs.prototype */ {
       	/**
       	 * Obtains a listing of the specified directory.
       	 *
      @@ -2051,7 +2061,7 @@ var FileSystem = L.Class.extend(/** @lends LuCI.fs.prototype */ {
       		var postdata = 'sessionid=%s&path=%s'
       			.format(encodeURIComponent(L.env.sessionid), encodeURIComponent(path));
       
      -		return L.Request.post(L.env.cgi_base + '/cgi-download', postdata, {
      +		return request.post(L.env.cgi_base + '/cgi-download', postdata, {
       			headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
       			responseType: (type == 'blob') ? 'blob' : 'text'
       		}).then(handleCgiIoReply.bind({ type: type }));
      @@ -2111,7 +2121,7 @@ var FileSystem = L.Class.extend(/** @lends LuCI.fs.prototype */ {
       		var postdata = 'sessionid=%s&command=%s'
       			.format(encodeURIComponent(L.env.sessionid), cmdstr);
       
      -		return L.Request.post(L.env.cgi_base + '/cgi-exec', postdata, {
      +		return request.post(L.env.cgi_base + '/cgi-exec', postdata, {
       			headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
       			responseType: (type == 'blob') ? 'blob' : 'text'
       		}).then(handleCgiIoReply.bind({ type: type }));
      @@ -2131,7 +2141,7 @@ return FileSystem;
               
       
               
      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/index.html b/docs/jsapi/index.html index 6760e4bb8..127e4e59e 100644 --- a/docs/jsapi/index.html +++ b/docs/jsapi/index.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1720,7 +1728,7 @@
      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/luci.js.html b/docs/jsapi/luci.js.html index f5e0c81d0..7455146df 100644 --- a/docs/jsapi/luci.js.html +++ b/docs/jsapi/luci.js.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1751,12 +1759,12 @@ }; /** - * @class Class + * @class baseclass * @hideconstructor * @memberof LuCI * @classdesc * - * `LuCI.Class` is the abstract base class all LuCI classes inherit from. + * `LuCI.baseclass` is the abstract base class all LuCI classes inherit from. * * It provides simple means to create subclasses of given classes and * implements prototypal inheritance. @@ -1766,14 +1774,14 @@ * Extends this base class with the properties described in * `properties` and returns a new subclassed Class instance * - * @memberof LuCI.Class + * @memberof LuCI.baseclass * * @param {Object<string, *>} properties * An object describing the properties to add to the new * subclass. * - * @returns {LuCI.Class} - * Returns a new LuCI.Class sublassed from this class, extended + * @returns {LuCI.baseclass} + * Returns a new LuCI.baseclass sublassed from this class, extended * by the given properties and with its prototype set to this base * class to enable inheritance. The resulting value represents a * class constructor and can be instantiated with `new`. @@ -1819,10 +1827,10 @@ * and returns the resulting subclassed Class instance. * * This function serves as a convenience shortcut for - * {@link LuCI.Class.extend Class.extend()} and subsequent + * {@link LuCI.baseclass.extend Class.extend()} and subsequent * `new`. * - * @memberof LuCI.Class + * @memberof LuCI.baseclass * * @param {Object<string, *>} properties * An object describing the properties to add to the new @@ -1832,8 +1840,8 @@ * Specifies arguments to be passed to the subclass constructor * as-is in order to instantiate the new subclass. * - * @returns {LuCI.Class} - * Returns a new LuCI.Class instance extended by the given + * @returns {LuCI.baseclass} + * Returns a new LuCI.baseclass instance extended by the given * properties with its prototype set to this base class to * enable inheritance. */ @@ -1846,7 +1854,7 @@ * Calls the class constructor using `new` with the given argument * array being passed as variadic parameters to the constructor. * - * @memberof LuCI.Class + * @memberof LuCI.baseclass * * @param {Array<*>} params * An array of arbitrary values which will be passed as arguments @@ -1856,8 +1864,8 @@ * Specifies arguments to be passed to the subclass constructor * as-is in order to instantiate the new subclass. * - * @returns {LuCI.Class} - * Returns a new LuCI.Class instance extended by the given + * @returns {LuCI.baseclass} + * Returns a new LuCI.baseclass instance extended by the given * properties with its prototype set to this base class to * enable inheritance. */ @@ -1877,9 +1885,9 @@ /** * Checks whether the given class value is a subclass of this class. * - * @memberof LuCI.Class + * @memberof LuCI.baseclass * - * @param {LuCI.Class} classValue + * @param {LuCI.baseclass} classValue * The class object to test. * * @returns {boolean} @@ -1899,7 +1907,7 @@ * `offset` and prepend any further given optional parameters to * the beginning of the resulting array copy. * - * @memberof LuCI.Class + * @memberof LuCI.baseclass * @instance * * @param {Array<*>} args @@ -1938,7 +1946,7 @@ * Calls the `key()` method with parameters `arg1` and `arg2` * when found within one of the parent classes. * - * @memberof LuCI.Class + * @memberof LuCI.baseclass * @instance * * @param {string} key @@ -2022,7 +2030,7 @@ /** - * @class + * @class headers * @memberof LuCI * @hideconstructor * @classdesc @@ -2030,8 +2038,8 @@ * The `Headers` class is an internal utility class exposed in HTTP * response objects using the `response.headers` property. */ - var Headers = Class.extend(/** @lends LuCI.Headers.prototype */ { - __name__: 'LuCI.XHR.Headers', + var Headers = Class.extend(/** @lends LuCI.headers.prototype */ { + __name__: 'LuCI.Headers', __init__: function(xhr) { var hdrs = this.headers = {}; xhr.getAllResponseHeaders().split(/\r\n/).forEach(function(line) { @@ -2046,7 +2054,7 @@ * Note: Header-Names are case-insensitive. * * @instance - * @memberof LuCI.Headers + * @memberof LuCI.headers * @param {string} name * The header name to check * @@ -2062,7 +2070,7 @@ * Note: Header-Names are case-insensitive. * * @instance - * @memberof LuCI.Headers + * @memberof LuCI.headers * @param {string} name * The header name to read * @@ -2076,7 +2084,7 @@ }); /** - * @class + * @class response * @memberof LuCI * @hideconstructor * @classdesc @@ -2084,12 +2092,12 @@ * The `Response` class is an internal utility class representing HTTP responses. */ var Response = Class.extend({ - __name__: 'LuCI.XHR.Response', + __name__: 'LuCI.Response', __init__: function(xhr, url, duration, headers, content) { /** * Describes whether the response is successful (status codes `200..299`) or not * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @name ok * @type {boolean} */ @@ -2098,7 +2106,7 @@ /** * The numeric HTTP status code of the response * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @name status * @type {number} */ @@ -2107,7 +2115,7 @@ /** * The HTTP status description message of the response * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @name statusText * @type {string} */ @@ -2116,16 +2124,16 @@ /** * The HTTP headers of the response * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @name headers - * @type {LuCI.Headers} + * @type {LuCI.headers} */ this.headers = (headers != null) ? headers : new Headers(xhr); /** * The total duration of the HTTP request in milliseconds * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @name duration * @type {number} */ @@ -2134,7 +2142,7 @@ /** * The final URL of the request, i.e. after following redirects. * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @name url * @type {string} */ @@ -2177,13 +2185,13 @@ * of the cloned instance. * * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @param {*} [content] * Override the content of the cloned response. Object values will be * treated as JSON response data, all other types will be converted * using `String()` and treated as response text. * - * @returns {LuCI.Response} + * @returns {LuCI.response} * The cloned `Response` instance. */ clone: function(content) { @@ -2200,7 +2208,7 @@ * Access the response content as JSON data. * * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @throws {SyntaxError} * Throws `SyntaxError` if the content isn't valid JSON. * @@ -2218,7 +2226,7 @@ * Access the response content as string. * * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @returns {string} * The response content. */ @@ -2233,7 +2241,7 @@ * Access the response content as blob. * * @instance - * @memberof LuCI.Response + * @memberof LuCI.response * @returns {Blob} * The response content as blob. */ @@ -2294,7 +2302,7 @@ } /** - * @class + * @class request * @memberof LuCI * @hideconstructor * @classdesc @@ -2302,8 +2310,8 @@ * The `Request` class allows initiating HTTP requests and provides utilities * for dealing with responses. */ - var Request = Class.singleton(/** @lends LuCI.Request.prototype */ { - __name__: 'LuCI.Request', + var Request = Class.singleton(/** @lends LuCI.request.prototype */ { + __name__: 'LuCI.request', interceptors: [], @@ -2311,7 +2319,7 @@ * Turn the given relative URL into an absolute URL if necessary. * * @instance - * @memberof LuCI.Request + * @memberof LuCI.request * @param {string} url * The URL to convert. * @@ -2328,7 +2336,7 @@ /** * @typedef {Object} RequestOptions - * @memberof LuCI.Request + * @memberof LuCI.request * * @property {string} [method=GET] * The HTTP method to use, e.g. `GET` or `POST`. @@ -2376,14 +2384,14 @@ * Initiate an HTTP request to the given target. * * @instance - * @memberof LuCI.Request + * @memberof LuCI.request * @param {string} target * The URL to request. * - * @param {LuCI.Request.RequestOptions} [options] + * @param {LuCI.request.RequestOptions} [options] * Additional options to configure the request. * - * @returns {Promise<LuCI.Response>} + * @returns {Promise<LuCI.response>} * The resulting HTTP response. */ request: function(target, options) { @@ -2525,14 +2533,14 @@ * Initiate an HTTP GET request to the given target. * * @instance - * @memberof LuCI.Request + * @memberof LuCI.request * @param {string} target * The URL to request. * - * @param {LuCI.Request.RequestOptions} [options] + * @param {LuCI.request.RequestOptions} [options] * Additional options to configure the request. * - * @returns {Promise<LuCI.Response>} + * @returns {Promise<LuCI.response>} * The resulting HTTP response. */ get: function(url, options) { @@ -2543,17 +2551,17 @@ * Initiate an HTTP POST request to the given target. * * @instance - * @memberof LuCI.Request + * @memberof LuCI.request * @param {string} target * The URL to request. * * @param {*} [data] - * The request data to send, see {@link LuCI.Request.RequestOptions} for details. + * The request data to send, see {@link LuCI.request.RequestOptions} for details. * - * @param {LuCI.Request.RequestOptions} [options] + * @param {LuCI.request.RequestOptions} [options] * Additional options to configure the request. * - * @returns {Promise<LuCI.Response>} + * @returns {Promise<LuCI.response>} * The resulting HTTP response. */ post: function(url, data, options) { @@ -2563,8 +2571,8 @@ /** * Interceptor functions are invoked whenever an HTTP reply is received, in the order * these functions have been registered. - * @callback LuCI.Request.interceptorFn - * @param {LuCI.Response} res + * @callback LuCI.request.interceptorFn + * @param {LuCI.response} res * The HTTP response object */ @@ -2575,11 +2583,11 @@ * implementing request retries before returning a failure. * * @instance - * @memberof LuCI.Request - * @param {LuCI.Request.interceptorFn} interceptorFn + * @memberof LuCI.request + * @param {LuCI.request.interceptorFn} interceptorFn * The interceptor function to register. * - * @returns {LuCI.Request.interceptorFn} + * @returns {LuCI.request.interceptorFn} * The registered function. */ addInterceptor: function(interceptorFn) { @@ -2594,8 +2602,8 @@ * function. * * @instance - * @memberof LuCI.Request - * @param {LuCI.Request.interceptorFn} interceptorFn + * @memberof LuCI.request + * @param {LuCI.request.interceptorFn} interceptorFn * The interceptor function to remove. * * @returns {boolean} @@ -2611,12 +2619,12 @@ /** * @class - * @memberof LuCI.Request + * @memberof LuCI.request * @hideconstructor * @classdesc * * The `Request.poll` class provides some convience wrappers around - * {@link LuCI.Poll} mainly to simplify registering repeating HTTP + * {@link LuCI.poll} mainly to simplify registering repeating HTTP * request calls as polling functions. */ poll: { @@ -2625,8 +2633,8 @@ * polled request is received or when the polled request timed * out. * - * @callback LuCI.Request.poll~callbackFn - * @param {LuCI.Response} res + * @callback LuCI.request.poll~callbackFn + * @param {LuCI.response} res * The HTTP response object. * * @param {*} data @@ -2642,18 +2650,18 @@ * to invoke whenever a response for the request is received. * * @instance - * @memberof LuCI.Request.poll + * @memberof LuCI.request.poll * @param {number} interval * The poll interval in seconds. * * @param {string} url * The URL to request on each poll. * - * @param {LuCI.Request.RequestOptions} [options] + * @param {LuCI.request.RequestOptions} [options] * Additional options to configure the request. * - * @param {LuCI.Request.poll~callbackFn} [callback] - * {@link LuCI.Request.poll~callbackFn Callback} function to + * @param {LuCI.request.poll~callbackFn} [callback] + * {@link LuCI.request.poll~callbackFn Callback} function to * invoke for each HTTP reply. * * @throws {TypeError} @@ -2689,12 +2697,12 @@ /** * Remove a polling request that has been previously added using `add()`. * This function is essentially a wrapper around - * {@link LuCI.Poll.remove LuCI.Poll.remove()}. + * {@link LuCI.poll.remove LuCI.poll.remove()}. * * @instance - * @memberof LuCI.Request.poll + * @memberof LuCI.request.poll * @param {function} entry - * The poll function returned by {@link LuCI.Request.poll#add add()}. + * The poll function returned by {@link LuCI.request.poll#add add()}. * * @returns {boolean} * Returns `true` if any function has been removed, else `false`. @@ -2702,33 +2710,33 @@ remove: function(entry) { return Poll.remove(entry) }, /** - * Alias for {@link LuCI.Poll.start LuCI.Poll.start()}. + * Alias for {@link LuCI.poll.start LuCI.poll.start()}. * * @instance - * @memberof LuCI.Request.poll + * @memberof LuCI.request.poll */ start: function() { return Poll.start() }, /** - * Alias for {@link LuCI.Poll.stop LuCI.Poll.stop()}. + * Alias for {@link LuCI.poll.stop LuCI.poll.stop()}. * * @instance - * @memberof LuCI.Request.poll + * @memberof LuCI.request.poll */ stop: function() { return Poll.stop() }, /** - * Alias for {@link LuCI.Poll.active LuCI.Poll.active()}. + * Alias for {@link LuCI.poll.active LuCI.poll.active()}. * * @instance - * @memberof LuCI.Request.poll + * @memberof LuCI.request.poll */ active: function() { return Poll.active() } } }); /** - * @class + * @class poll * @memberof LuCI * @hideconstructor * @classdesc @@ -2737,8 +2745,8 @@ * as well as starting, stopping and querying the state of the polling * loop. */ - var Poll = Class.singleton(/** @lends LuCI.Poll.prototype */ { - __name__: 'LuCI.Poll', + var Poll = Class.singleton(/** @lends LuCI.poll.prototype */ { + __name__: 'LuCI.poll', queue: [], @@ -2747,7 +2755,7 @@ * already started at this point, it will be implicitely started. * * @instance - * @memberof LuCI.Poll + * @memberof LuCI.poll * @param {function} fn * The function to invoke on each poll interval. * @@ -2766,7 +2774,7 @@ interval = window.L ? window.L.env.pollinterval : null; if (isNaN(interval) || typeof(fn) != 'function') - throw new TypeError('Invalid argument to LuCI.Poll.add()'); + throw new TypeError('Invalid argument to LuCI.poll.add()'); for (var i = 0; i < this.queue.length; i++) if (this.queue[i].fn === fn) @@ -2791,7 +2799,7 @@ * are registered, the polling loop is implicitely stopped. * * @instance - * @memberof LuCI.Poll + * @memberof LuCI.poll * @param {function} fn * The function to remove. * @@ -2804,7 +2812,7 @@ */ remove: function(fn) { if (typeof(fn) != 'function') - throw new TypeError('Invalid argument to LuCI.Poll.remove()'); + throw new TypeError('Invalid argument to LuCI.poll.remove()'); var len = this.queue.length; @@ -2823,7 +2831,7 @@ * to the `document` object upon successful start. * * @instance - * @memberof LuCI.Poll + * @memberof LuCI.poll * @returns {boolean} * Returns `true` if polling has been started (or if no functions * where registered) or `false` when the polling loop already runs. @@ -2848,7 +2856,7 @@ * to the `document` object upon successful stop. * * @instance - * @memberof LuCI.Poll + * @memberof LuCI.poll * @returns {boolean} * Returns `true` if polling has been stopped or `false` if it din't * run to begin with. @@ -2885,7 +2893,7 @@ * Test whether the polling loop is running. * * @instance - * @memberof LuCI.Poll + * @memberof LuCI.poll * @returns {boolean} - Returns `true` if polling is active, else `false`. */ active: function() { @@ -2893,1831 +2901,1887 @@ } }); + /** + * @class dom + * @memberof LuCI + * @hideconstructor + * @classdesc + * + * The `dom` class provides convenience method for creating and + * manipulating DOM elements. + * + * To import the class in views, use `'require dom'`, to import it in + * external JavaScript, use `L.require("dom").then(...)`. + */ + var DOM = Class.singleton(/* @lends LuCI.dom.prototype */ { + __name__: 'LuCI.DOM', - var dummyElem = null, - domParser = null, - originalCBIInit = null, - rpcBaseURL = null, - sysFeatures = null, - classes = {}; - - var LuCI = Class.extend(/** @lends LuCI.prototype */ { - __name__: 'LuCI', - __init__: function(env) { - - document.querySelectorAll('script[src*="/luci.js"]').forEach(function(s) { - if (env.base_url == null || env.base_url == '') { - var m = (s.getAttribute('src') || '').match(/^(.*)\/luci\.js(?:\?v=([^?]+))?$/); - if (m) { - env.base_url = m[1]; - env.resource_version = m[2]; - } - } - }); - - if (env.base_url == null) - this.error('InternalError', 'Cannot find url of luci.js'); - - env.cgi_base = env.scriptname.replace(/\/[^\/]+$/, ''); - - Object.assign(this.env, env); - - document.addEventListener('poll-start', function(ev) { - document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) { - e.style.display = (e.id == 'xhr_poll_status_off') ? 'none' : ''; - }); - }); + /** + * Tests whether the given argument is a valid DOM `Node`. + * + * @instance + * @memberof LuCI.dom + * @param {*} e + * The value to test. + * + * @returns {boolean} + * Returns `true` if the value is a DOM `Node`, else `false`. + */ + elem: function(e) { + return (e != null && typeof(e) == 'object' && 'nodeType' in e); + }, - document.addEventListener('poll-stop', function(ev) { - document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) { - e.style.display = (e.id == 'xhr_poll_status_on') ? 'none' : ''; - }); - }); + /** + * Parses a given string as HTML and returns the first child node. + * + * @instance + * @memberof LuCI.dom + * @param {string} s + * A string containing an HTML fragment to parse. Note that only + * the first result of the resulting structure is returned, so an + * input value of `<div>foo</div> <div>bar</div>` will only return + * the first `div` element node. + * + * @returns {Node} + * Returns the first DOM `Node` extracted from the HTML fragment or + * `null` on parsing failures or if no element could be found. + */ + parse: function(s) { + var elem; - var domReady = new Promise(function(resolveFn, rejectFn) { - document.addEventListener('DOMContentLoaded', resolveFn); - }); + try { + domParser = domParser || new DOMParser(); + elem = domParser.parseFromString(s, 'text/html').body.firstChild; + } + catch(e) {} - Promise.all([ - domReady, - this.require('ui'), - this.require('rpc'), - this.require('form'), - this.probeRPCBaseURL() - ]).then(this.setupDOM.bind(this)).catch(this.error); + if (!elem) { + try { + dummyElem = dummyElem || document.createElement('div'); + dummyElem.innerHTML = s; + elem = dummyElem.firstChild; + } + catch (e) {} + } - originalCBIInit = window.cbi_init; - window.cbi_init = function() {}; + return elem || null; }, /** - * Captures the current stack trace and throws an error of the - * specified type as a new exception. Also logs the exception as - * error to the debug console if it is available. + * Tests whether a given `Node` matches the given query selector. + * + * This function is a convenience wrapper around the standard + * `Node.matches("selector")` function with the added benefit that + * the `node` argument may be a non-`Node` value, in which case + * this function simply returns `false`. * * @instance - * @memberof LuCI + * @memberof LuCI.dom + * @param {*} node + * The `Node` argument to test the selector against. * - * @param {Error|string} [type=Error] - * Either a string specifying the type of the error to throw or an - * existing `Error` instance to copy. + * @param {string} [selector] + * The query selector expression to test against the given node. * - * @param {string} [fmt=Unspecified error] - * A format string which is used to form the error message, together - * with all subsequent optional arguments. + * @returns {boolean} + * Returns `true` if the given node matches the specified selector + * or `false` when the node argument is no valid DOM `Node` or the + * selector didn't match. + */ + matches: function(node, selector) { + var m = this.elem(node) ? node.matches || node.msMatchesSelector : null; + return m ? m.call(node, selector) : false; + }, + + /** + * Returns the closest parent node that matches the given query + * selector expression. * - * @param {...*} [args] - * Zero or more variable arguments to the supplied format string. + * This function is a convenience wrapper around the standard + * `Node.closest("selector")` function with the added benefit that + * the `node` argument may be a non-`Node` value, in which case + * this function simply returns `null`. * - * @throws {Error} - * Throws the created error object with the captured stack trace - * appended to the message and the type set to the given type - * argument or copied from the given error instance. + * @instance + * @memberof LuCI.dom + * @param {*} node + * The `Node` argument to find the closest parent for. + * + * @param {string} [selector] + * The query selector expression to test against each parent. + * + * @returns {Node|null} + * Returns the closest parent node matching the selector or + * `null` when the node argument is no valid DOM `Node` or the + * selector didn't match any parent. */ - raise: function(type, fmt /*, ...*/) { - var e = null, - msg = fmt ? String.prototype.format.apply(fmt, this.varargs(arguments, 2)) : null, - stack = null; + parent: function(node, selector) { + if (this.elem(node) && node.closest) + return node.closest(selector); - if (type instanceof Error) { - e = type; + while (this.elem(node)) + if (this.matches(node, selector)) + return node; + else + node = node.parentNode; - if (msg) - e.message = msg + ': ' + e.message; - } - else { - try { throw new Error('stacktrace') } - catch (e2) { stack = (e2.stack || '').split(/\n/) } + return null; + }, - e = new (window[type || 'Error'] || Error)(msg || 'Unspecified error'); - e.name = type || 'Error'; - } + /** + * Appends the given children data to the given node. + * + * @instance + * @memberof LuCI.dom + * @param {*} node + * The `Node` argument to append the children to. + * + * @param {*} [children] + * The childrens to append to the given node. + * + * When `children` is an array, then each item of the array + * will be either appended as child element or text node, + * depending on whether the item is a DOM `Node` instance or + * some other non-`null` value. Non-`Node`, non-`null` values + * will be converted to strings first before being passed as + * argument to `createTextNode()`. + * + * When `children` is a function, it will be invoked with + * the passed `node` argument as sole parameter and the `append` + * function will be invoked again, with the given `node` argument + * as first and the return value of the `children` function as + * second parameter. + * + * When `children` is is a DOM `Node` instance, it will be + * appended to the given `node`. + * + * When `children` is any other non-`null` value, it will be + * converted to a string and appened to the `innerHTML` property + * of the given `node`. + * + * @returns {Node|null} + * Returns the last children `Node` appended to the node or `null` + * if either the `node` argument was no valid DOM `node` or if the + * `children` was `null` or didn't result in further DOM nodes. + */ + append: function(node, children) { + if (!this.elem(node)) + return null; - stack = (stack || []).map(function(frame) { - frame = frame.replace(/(.*?)@(.+):(\d+):(\d+)/g, 'at $1 ($2:$3:$4)').trim(); - return frame ? ' ' + frame : ''; - }); + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) + if (this.elem(children[i])) + node.appendChild(children[i]); + else if (children !== null && children !== undefined) + node.appendChild(document.createTextNode('' + children[i])); - if (!/^ at /.test(stack[0])) - stack.shift(); + return node.lastChild; + } + else if (typeof(children) === 'function') { + return this.append(node, children(node)); + } + else if (this.elem(children)) { + return node.appendChild(children); + } + else if (children !== null && children !== undefined) { + node.innerHTML = '' + children; + return node.lastChild; + } - if (/\braise /.test(stack[0])) - stack.shift(); + return null; + }, - if (/\berror /.test(stack[0])) - stack.shift(); + /** + * Replaces the content of the given node with the given children. + * + * This function first removes any children of the given DOM + * `Node` and then adds the given given children following the + * rules outlined below. + * + * @instance + * @memberof LuCI.dom + * @param {*} node + * The `Node` argument to replace the children of. + * + * @param {*} [children] + * The childrens to replace into the given node. + * + * When `children` is an array, then each item of the array + * will be either appended as child element or text node, + * depending on whether the item is a DOM `Node` instance or + * some other non-`null` value. Non-`Node`, non-`null` values + * will be converted to strings first before being passed as + * argument to `createTextNode()`. + * + * When `children` is a function, it will be invoked with + * the passed `node` argument as sole parameter and the `append` + * function will be invoked again, with the given `node` argument + * as first and the return value of the `children` function as + * second parameter. + * + * When `children` is is a DOM `Node` instance, it will be + * appended to the given `node`. + * + * When `children` is any other non-`null` value, it will be + * converted to a string and appened to the `innerHTML` property + * of the given `node`. + * + * @returns {Node|null} + * Returns the last children `Node` appended to the node or `null` + * if either the `node` argument was no valid DOM `node` or if the + * `children` was `null` or didn't result in further DOM nodes. + */ + content: function(node, children) { + if (!this.elem(node)) + return null; - if (stack.length) - e.message += '\n' + stack.join('\n'); + var dataNodes = node.querySelectorAll('[data-idref]'); - if (window.console && console.debug) - console.debug(e); + for (var i = 0; i < dataNodes.length; i++) + delete this.registry[dataNodes[i].getAttribute('data-idref')]; - throw e; + while (node.firstChild) + node.removeChild(node.firstChild); + + return this.append(node, children); }, /** - * A wrapper around {@link LuCI#raise raise()} which also renders - * the error either as modal overlay when `ui.js` is already loaed - * or directly into the view body. + * Sets attributes or registers event listeners on element nodes. * * @instance - * @memberof LuCI + * @memberof LuCI.dom + * @param {*} node + * The `Node` argument to set the attributes or add the event + * listeners for. When the given `node` value is not a valid + * DOM `Node`, the function returns and does nothing. + * + * @param {string|Object<string, *>} key + * Specifies either the attribute or event handler name to use, + * or an object containing multiple key, value pairs which are + * each added to the node as either attribute or event handler, + * depending on the respective value. * - * @param {Error|string} [type=Error] - * Either a string specifying the type of the error to throw or an - * existing `Error` instance to copy. + * @param {*} [val] + * Specifies the attribute value or event handler function to add. + * If the `key` parameter is an `Object`, this parameter will be + * ignored. * - * @param {string} [fmt=Unspecified error] - * A format string which is used to form the error message, together - * with all subsequent optional arguments. + * When `val` is of type function, it will be registered as event + * handler on the given `node` with the `key` parameter being the + * event name. * - * @param {...*} [args] - * Zero or more variable arguments to the supplied format string. + * When `val` is of type object, it will be serialized as JSON and + * added as attribute to the given `node`, using the given `key` + * as attribute name. * - * @throws {Error} - * Throws the created error object with the captured stack trace - * appended to the message and the type set to the given type - * argument or copied from the given error instance. + * When `val` is of any other type, it will be added as attribute + * to the given `node` as-is, with the underlying `setAttribute()` + * call implicitely turning it into a string. */ - error: function(type, fmt /*, ...*/) { - try { - L.raise.apply(L, Array.prototype.slice.call(arguments)); - } - catch (e) { - if (!e.reported) { - if (L.ui) - L.ui.addNotification(e.name || _('Runtime error'), - E('pre', {}, e.message), 'danger'); - else - L.dom.content(document.querySelector('#maincontent'), - E('pre', { 'class': 'alert-message error' }, e.message)); + attr: function(node, key, val) { + if (!this.elem(node)) + return null; - e.reported = true; - } + var attr = null; - throw e; + if (typeof(key) === 'object' && key !== null) + attr = key; + else if (typeof(key) === 'string') + attr = {}, attr[key] = val; + + for (key in attr) { + if (!attr.hasOwnProperty(key) || attr[key] == null) + continue; + + switch (typeof(attr[key])) { + case 'function': + node.addEventListener(key, attr[key]); + break; + + case 'object': + node.setAttribute(key, JSON.stringify(attr[key])); + break; + + default: + node.setAttribute(key, attr[key]); + } } }, /** - * Return a bound function using the given `self` as `this` context - * and any further arguments as parameters to the bound function. + * Creates a new DOM `Node` from the given `html`, `attr` and + * `data` parameters. + * + * This function has multiple signatures, it can be either invoked + * in the form `create(html[, attr[, data]])` or in the form + * `create(html[, data])`. The used variant is determined from the + * type of the second argument. * * @instance - * @memberof LuCI + * @memberof LuCI.dom + * @param {*} html + * Describes the node to create. * - * @param {function} fn - * The function to bind. + * When the value of `html` is of type array, a `DocumentFragment` + * node is created and each item of the array is first converted + * to a DOM `Node` by passing it through `create()` and then added + * as child to the fragment. * - * @param {*} self - * The value to bind as `this` context to the specified function. + * When the value of `html` is a DOM `Node` instance, no new + * element will be created but the node will be used as-is. * - * @param {...*} [args] - * Zero or more variable arguments which are bound to the function - * as parameters. + * When the value of `html` is a string starting with `<`, it will + * be passed to `dom.parse()` and the resulting value is used. * - * @returns {function} - * Returns the bound function. + * When the value of `html` is any other string, it will be passed + * to `document.createElement()` for creating a new DOM `Node` of + * the given name. + * + * @param {Object<string, *>} [attr] + * Specifies an Object of key, value pairs to set as attributes + * or event handlers on the created node. Refer to + * {@link LuCI.dom#attr dom.attr()} for details. + * + * @param {*} [data] + * Specifies children to append to the newly created element. + * Refer to {@link LuCI.dom#append dom.append()} for details. + * + * @throws {InvalidCharacterError} + * Throws an `InvalidCharacterError` when the given `html` + * argument contained malformed markup (such as not escaped + * `&` characters in XHTML mode) or when the given node name + * in `html` contains characters which are not legal in DOM + * element names, such as spaces. + * + * @returns {Node} + * Returns the newly created `Node`. */ - bind: function(fn, self /*, ... */) { - return Function.prototype.bind.apply(fn, this.varargs(arguments, 2, self)); + create: function() { + var html = arguments[0], + attr = arguments[1], + data = arguments[2], + elem; + + if (!(attr instanceof Object) || Array.isArray(attr)) + data = attr, attr = null; + + if (Array.isArray(html)) { + elem = document.createDocumentFragment(); + for (var i = 0; i < html.length; i++) + elem.appendChild(this.create(html[i])); + } + else if (this.elem(html)) { + elem = html; + } + else if (html.charCodeAt(0) === 60) { + elem = this.parse(html); + } + else { + elem = document.createElement(html); + } + + if (!elem) + return null; + + this.attr(elem, attr); + this.append(elem, data); + + return elem; }, + registry: {}, + /** - * Load an additional LuCI JavaScript class and its dependencies, - * instantiate it and return the resulting class instance. Each - * class is only loaded once. Subsequent attempts to load the same - * class will return the already instantiated class. + * Attaches or detaches arbitrary data to and from a DOM `Node`. + * + * This function is useful to attach non-string values or runtime + * data that is not serializable to DOM nodes. To decouple data + * from the DOM, values are not added directly to nodes, but + * inserted into a registry instead which is then referenced by a + * string key stored as `data-idref` attribute in the node. + * + * This function has multiple signatures and is sensitive to the + * number of arguments passed to it. + * + * - `dom.data(node)` - + * Fetches all data associated with the given node. + * - `dom.data(node, key)` - + * Fetches a specific key associated with the given node. + * - `dom.data(node, key, val)` - + * Sets a specific key to the given value associated with the + * given node. + * - `dom.data(node, null)` - + * Clears any data associated with the node. + * - `dom.data(node, key, null)` - + * Clears the given key associated with the node. * * @instance - * @memberof LuCI - * - * @param {string} name - * The name of the class to load in dotted notation. Dots will - * be replaced by spaces and joined with the runtime-determined - * base URL of LuCI.js to form an absolute URL to load the class - * file from. + * @memberof LuCI.dom + * @param {Node} node + * The DOM `Node` instance to set or retrieve the data for. * - * @throws {DependencyError} - * Throws a `DependencyError` when the class to load includes - * circular dependencies. - * - * @throws {NetworkError} - * Throws `NetworkError` when the underlying {@link LuCI.Request} - * call failed. - * - * @throws {SyntaxError} - * Throws `SyntaxError` when the loaded class file code cannot - * be interpreted by `eval`. + * @param {string|null} [key] + * This is either a string specifying the key to retrieve, or + * `null` to unset the entire node data. * - * @throws {TypeError} - * Throws `TypeError` when the class file could be loaded and - * interpreted, but when invoking its code did not yield a valid - * class instance. + * @param {*|null} [val] + * This is either a non-`null` value to set for a given key or + * `null` to remove the given `key` from the specified node. * - * @returns {Promise<LuCI#Class>} - * Returns the instantiated class. + * @returns {*} + * Returns the get or set value, or `null` when no value could + * be found. */ - require: function(name, from) { - var L = this, url = null, from = from || []; + data: function(node, key, val) { + if (!node || !node.getAttribute) + return null; - /* Class already loaded */ - if (classes[name] != null) { - /* Circular dependency */ - if (from.indexOf(name) != -1) - L.raise('DependencyError', - 'Circular dependency: class "%s" depends on "%s"', - name, from.join('" which depends on "')); - - return Promise.resolve(classes[name]); - } - - url = '%s/%s.js%s'.format(L.env.base_url, name.replace(/\./g, '/'), (L.env.resource_version ? '?v=' + L.env.resource_version : '')); - from = [ name ].concat(from); + var id = node.getAttribute('data-idref'); - var compileClass = function(res) { - if (!res.ok) - L.raise('NetworkError', - 'HTTP error %d while loading class file "%s"', res.status, url); + /* clear all data */ + if (arguments.length > 1 && key == null) { + if (id != null) { + node.removeAttribute('data-idref'); + val = this.registry[id] + delete this.registry[id]; + return val; + } - var source = res.text(), - requirematch = /^require[ \t]+(\S+)(?:[ \t]+as[ \t]+([a-zA-Z_]\S*))?$/, - strictmatch = /^use[ \t]+strict$/, - depends = [], - args = ''; + return null; + } - /* find require statements in source */ - for (var i = 0, off = -1, quote = -1, esc = false; i < source.length; i++) { - var chr = source.charCodeAt(i); + /* clear a key */ + else if (arguments.length > 2 && key != null && val == null) { + if (id != null) { + val = this.registry[id][key]; + delete this.registry[id][key]; + return val; + } - if (esc) { - esc = false; - } - else if (chr == 92) { - esc = true; - } - else if (chr == quote) { - var s = source.substring(off, i), - m = requirematch.exec(s); + return null; + } - if (m) { - var dep = m[1], as = m[2] || dep.replace(/[^a-zA-Z0-9_]/g, '_'); - depends.push(L.require(dep, from)); - args += ', ' + as; - } - else if (!strictmatch.exec(s)) { - break; - } + /* set a key */ + else if (arguments.length > 2 && key != null && val != null) { + if (id == null) { + do { id = Math.floor(Math.random() * 0xffffffff).toString(16) } + while (this.registry.hasOwnProperty(id)); - off = -1; - quote = -1; - } - else if (quote == -1 && (chr == 34 || chr == 39)) { - off = i + 1; - quote = chr; - } + node.setAttribute('data-idref', id); + this.registry[id] = {}; } - /* load dependencies and instantiate class */ - return Promise.all(depends).then(function(instances) { - var _factory, _class; + return (this.registry[id][key] = val); + } - try { - _factory = eval( - '(function(window, document, L%s) { %s })\n\n//# sourceURL=%s\n' - .format(args, source, res.url)); - } - catch (error) { - L.raise('SyntaxError', '%s\n in %s:%s', - error.message, res.url, error.lineNumber || '?'); - } + /* get all data */ + else if (arguments.length == 1) { + if (id != null) + return this.registry[id]; - _factory.displayName = toCamelCase(name + 'ClassFactory'); - _class = _factory.apply(_factory, [window, document, L].concat(instances)); + return null; + } - if (!Class.isSubclass(_class)) - L.error('TypeError', '"%s" factory yields invalid constructor', name); + /* get a key */ + else if (arguments.length == 2) { + if (id != null) + return this.registry[id][key]; + } - if (_class.displayName == 'AnonymousClass') - _class.displayName = toCamelCase(name + 'Class'); + return null; + }, - var ptr = Object.getPrototypeOf(L), - parts = name.split(/\./), - instance = new _class(); + /** + * Binds the given class instance ot the specified DOM `Node`. + * + * This function uses the `dom.data()` facility to attach the + * passed instance of a Class to a node. This is needed for + * complex widget elements or similar where the corresponding + * class instance responsible for the element must be retrieved + * from DOM nodes obtained by `querySelector()` or similar means. + * + * @instance + * @memberof LuCI.dom + * @param {Node} node + * The DOM `Node` instance to bind the class to. + * + * @param {Class} inst + * The Class instance to bind to the node. + * + * @throws {TypeError} + * Throws a `TypeError` when the given instance argument isn't + * a valid Class instance. + * + * @returns {Class} + * Returns the bound class instance. + */ + bindClassInstance: function(node, inst) { + if (!(inst instanceof Class)) + L.error('TypeError', 'Argument must be a class instance'); - for (var i = 0; ptr && i < parts.length - 1; i++) - ptr = ptr[parts[i]]; + return this.data(node, '_class', inst); + }, - if (ptr) - ptr[parts[i]] = instance; + /** + * Finds a bound class instance on the given node itself or the + * first bound instance on its closest parent node. + * + * @instance + * @memberof LuCI.dom + * @param {Node} node + * The DOM `Node` instance to start from. + * + * @returns {Class|null} + * Returns the founds class instance if any or `null` if no bound + * class could be found on the node itself or any of its parents. + */ + findClassInstance: function(node) { + var inst = null; - classes[name] = instance; + do { + inst = this.data(node, '_class'); + node = node.parentNode; + } + while (!(inst instanceof Class) && node != null); - return instance; - }); - }; + return inst; + }, - /* Request class file */ - classes[name] = Request.get(url, { cache: true }).then(compileClass); + /** + * Finds a bound class instance on the given node itself or the + * first bound instance on its closest parent node and invokes + * the specified method name on the found class instance. + * + * @instance + * @memberof LuCI.dom + * @param {Node} node + * The DOM `Node` instance to start from. + * + * @param {string} method + * The name of the method to invoke on the found class instance. + * + * @param {...*} params + * Additional arguments to pass to the invoked method as-is. + * + * @returns {*|null} + * Returns the return value of the invoked method if a class + * instance and method has been found. Returns `null` if either + * no bound class instance could be found, or if the found + * instance didn't have the requested `method`. + */ + callClassMethod: function(node, method /*, ... */) { + var inst = this.findClassInstance(node); - return classes[name]; + if (inst == null || typeof(inst[method]) != 'function') + return null; + + return inst[method].apply(inst, inst.varargs(arguments, 2)); }, - /* DOM setup */ - probeRPCBaseURL: function() { - if (rpcBaseURL == null) { - try { - rpcBaseURL = window.sessionStorage.getItem('rpcBaseURL'); - } - catch (e) { } - } + /** + * The ignore callback function is invoked by `isEmpty()` for each + * child node to decide whether to ignore a child node or not. + * + * When this function returns `false`, the node passed to it is + * ignored, else not. + * + * @callback LuCI.dom~ignoreCallbackFn + * @param {Node} node + * The child node to test. + * + * @returns {boolean} + * Boolean indicating whether to ignore the node or not. + */ - if (rpcBaseURL == null) { - var rpcFallbackURL = this.url('admin/ubus'); + /** + * Tests whether a given DOM `Node` instance is empty or appears + * empty. + * + * Any element child nodes which have the CSS class `hidden` set + * or for which the optionally passed `ignoreFn` callback function + * returns `false` are ignored. + * + * @instance + * @memberof LuCI.dom + * @param {Node} node + * The DOM `Node` instance to test. + * + * @param {LuCI.dom~ignoreCallbackFn} [ignoreFn] + * Specifies an optional function which is invoked for each child + * node to decide whether the child node should be ignored or not. + * + * @returns {boolean} + * Returns `true` if the node does not have any children or if + * any children node either has a `hidden` CSS class or a `false` + * result when testing it using the given `ignoreFn`. + */ + isEmpty: function(node, ignoreFn) { + for (var child = node.firstElementChild; child != null; child = child.nextElementSibling) + if (!child.classList.contains('hidden') && (!ignoreFn || !ignoreFn(child))) + return false; - rpcBaseURL = Request.get(this.env.ubuspath).then(function(res) { - return (rpcBaseURL = (res.status == 400) ? L.env.ubuspath : rpcFallbackURL); - }, function() { - return (rpcBaseURL = rpcFallbackURL); - }).then(function(url) { - try { - window.sessionStorage.setItem('rpcBaseURL', url); - } - catch (e) { } + return true; + } + }); - return url; - }); - } + /** + * @class view + * @memberof LuCI + * @hideconstructor + * @classdesc + * + * The `view` class forms the basis of views and provides a standard + * set of methods to inherit from. + */ + var View = Class.extend(/* @lends LuCI.view.prototype */ { + __name__: 'LuCI.View', - return Promise.resolve(rpcBaseURL); - }, + __init__: function() { + var vp = document.getElementById('view'); - probeSystemFeatures: function() { - var sessionid = classes.rpc.getSessionID(); + DOM.content(vp, E('div', { 'class': 'spinning' }, _('Loading view…'))); - if (sysFeatures == null) { - try { - var data = JSON.parse(window.sessionStorage.getItem('sysFeatures')); + return Promise.resolve(this.load()) + .then(L.bind(this.render, this)) + .then(L.bind(function(nodes) { + var vp = document.getElementById('view'); - if (this.isObject(data) && this.isObject(data[sessionid])) - sysFeatures = data[sessionid]; - } - catch (e) {} - } + DOM.content(vp, nodes); + DOM.append(vp, this.addFooter()); + }, this)).catch(L.error); + }, - if (!this.isObject(sysFeatures)) { - sysFeatures = classes.rpc.declare({ - object: 'luci', - method: 'getFeatures', - expect: { '': {} } - })().then(function(features) { - try { - var data = {}; - data[sessionid] = features; + /** + * The load function is invoked before the view is rendered. + * + * The invocation of this function is wrapped by + * `Promise.resolve()` so it may return Promises if needed. + * + * The return value of the function (or the resolved values + * of the promise returned by it) will be passed as first + * argument to `render()`. + * + * This function is supposed to be overwritten by subclasses, + * the default implementation does nothing. + * + * @instance + * @abstract + * @memberof LuCI.view + * + * @returns {*|Promise<*>} + * May return any value or a Promise resolving to any value. + */ + load: function() {}, - window.sessionStorage.setItem('sysFeatures', JSON.stringify(data)); - } - catch (e) {} + /** + * The render function is invoked after the + * {@link LuCI.view#load load()} function and responsible + * for setting up the view contents. It must return a DOM + * `Node` or `DocumentFragment` holding the contents to + * insert into the view area. + * + * The invocation of this function is wrapped by + * `Promise.resolve()` so it may return Promises if needed. + * + * The return value of the function (or the resolved values + * of the promise returned by it) will be inserted into the + * main content area using + * {@link LuCI.dom#append dom.append()}. + * + * This function is supposed to be overwritten by subclasses, + * the default implementation does nothing. + * + * @instance + * @abstract + * @memberof LuCI.view + * @param {*|null} load_results + * This function will receive the return value of the + * {@link LuCI.view#load view.load()} function as first + * argument. + * + * @returns {Node|Promise<Node>} + * Should return a DOM `Node` value or a `Promise` resolving + * to a `Node` value. + */ + render: function() {}, - sysFeatures = features; + /** + * The handleSave function is invoked when the user clicks + * the `Save` button in the page action footer. + * + * The default implementation should be sufficient for most + * views using {@link form#Map form.Map()} based forms - it + * will iterate all forms present in the view and invoke + * the {@link form#Map#save Map.save()} method on each form. + * + * Views not using `Map` instances or requiring other special + * logic should overwrite `handleSave()` with a custom + * implementation. + * + * To disable the `Save` page footer button, views extending + * this base class should overwrite the `handleSave` function + * with `null`. + * + * The invocation of this function is wrapped by + * `Promise.resolve()` so it may return Promises if needed. + * + * @instance + * @memberof LuCI.view + * @param {Event} ev + * The DOM event that triggered the function. + * + * @returns {*|Promise<*>} + * Any return values of this function are discarded, but + * passed through `Promise.resolve()` to ensure that any + * returned promise runs to completion before the button + * is reenabled. + */ + handleSave: function(ev) { + var tasks = []; - return features; + document.getElementById('maincontent') + .querySelectorAll('.cbi-map').forEach(function(map) { + tasks.push(DOM.callClassMethod(map, 'save')); }); - } - return Promise.resolve(sysFeatures); + return Promise.all(tasks); }, /** - * Test whether a particular system feature is available, such as - * hostapd SAE support or an installed firewall. The features are - * queried once at the beginning of the LuCI session and cached in - * `SessionStorage` throughout the lifetime of the associated tab or - * browser window. + * The handleSaveApply function is invoked when the user clicks + * the `Save & Apply` button in the page action footer. + * + * The default implementation should be sufficient for most + * views using {@link form#Map form.Map()} based forms - it + * will first invoke + * {@link LuCI.view.handleSave view.handleSave()} and then + * call {@link ui#changes#apply ui.changes.apply()} to start the + * modal config apply and page reload flow. + * + * Views not using `Map` instances or requiring other special + * logic should overwrite `handleSaveApply()` with a custom + * implementation. + * + * To disable the `Save & Apply` page footer button, views + * extending this base class should overwrite the + * `handleSaveApply` function with `null`. + * + * The invocation of this function is wrapped by + * `Promise.resolve()` so it may return Promises if needed. * * @instance - * @memberof LuCI + * @memberof LuCI.view + * @param {Event} ev + * The DOM event that triggered the function. + * + * @returns {*|Promise<*>} + * Any return values of this function are discarded, but + * passed through `Promise.resolve()` to ensure that any + * returned promise runs to completion before the button + * is reenabled. + */ + handleSaveApply: function(ev, mode) { + return this.handleSave(ev).then(function() { + L.ui.changes.apply(mode == '0'); + }); + }, + + /** + * The handleReset function is invoked when the user clicks + * the `Reset` button in the page action footer. * - * @param {string} feature - * The feature to test. For detailed list of known feature flags, - * see `/modules/luci-base/root/usr/libexec/rpcd/luci`. + * The default implementation should be sufficient for most + * views using {@link form#Map form.Map()} based forms - it + * will iterate all forms present in the view and invoke + * the {@link form#Map#save Map.reset()} method on each form. * - * @param {string} [subfeature] - * Some feature classes like `hostapd` provide sub-feature flags, - * such as `sae` or `11w` support. The `subfeature` argument can - * be used to query these. + * Views not using `Map` instances or requiring other special + * logic should overwrite `handleReset()` with a custom + * implementation. * - * @return {boolean|null} - * Return `true` if the queried feature (and sub-feature) is available - * or `false` if the requested feature isn't present or known. - * Return `null` when a sub-feature was queried for a feature which - * has no sub-features. + * To disable the `Reset` page footer button, views extending + * this base class should overwrite the `handleReset` function + * with `null`. + * + * The invocation of this function is wrapped by + * `Promise.resolve()` so it may return Promises if needed. + * + * @instance + * @memberof LuCI.view + * @param {Event} ev + * The DOM event that triggered the function. + * + * @returns {*|Promise<*>} + * Any return values of this function are discarded, but + * passed through `Promise.resolve()` to ensure that any + * returned promise runs to completion before the button + * is reenabled. */ - hasSystemFeature: function() { - var ft = sysFeatures[arguments[0]]; + handleReset: function(ev) { + var tasks = []; - if (arguments.length == 2) - return this.isObject(ft) ? ft[arguments[1]] : null; + document.getElementById('maincontent') + .querySelectorAll('.cbi-map').forEach(function(map) { + tasks.push(DOM.callClassMethod(map, 'reset')); + }); - return (ft != null && ft != false); + return Promise.all(tasks); }, - /* private */ - notifySessionExpiry: function() { - Poll.stop(); - - L.ui.showModal(_('Session expired'), [ - E('div', { class: 'alert-message warning' }, - _('A new login is required since the authentication session expired.')), - E('div', { class: 'right' }, - E('div', { - class: 'btn primary', - click: function() { - var loc = window.location; - window.location = loc.protocol + '//' + loc.host + loc.pathname + loc.search; - } - }, _('To login…'))) - ]); - - L.raise('SessionError', 'Login session is expired'); - }, + /** + * Renders a standard page action footer if any of the + * `handleSave()`, `handleSaveApply()` or `handleReset()` + * functions are defined. + * + * The default implementation should be sufficient for most + * views - it will render a standard page footer with action + * buttons labeled `Save`, `Save & Apply` and `Reset` + * triggering the `handleSave()`, `handleSaveApply()` and + * `handleReset()` functions respectively. + * + * When any of these `handle*()` functions is overwritten + * with `null` by a view extending this class, the + * corresponding button will not be rendered. + * + * @instance + * @memberof LuCI.view + * @returns {DocumentFragment} + * Returns a `DocumentFragment` containing the footer bar + * with buttons for each corresponding `handle*()` action + * or an empty `DocumentFragment` if all three `handle*()` + * methods are overwritten with `null`. + */ + addFooter: function() { + var footer = E([]); + + var saveApplyBtn = this.handleSaveApply ? new L.ui.ComboButton('0', { + 0: [ _('Save & Apply') ], + 1: [ _('Apply unchecked') ] + }, { + classes: { + 0: 'btn cbi-button cbi-button-apply important', + 1: 'btn cbi-button cbi-button-negative important' + }, + click: L.ui.createHandlerFn(this, 'handleSaveApply') + }).render() : E([]); + + if (this.handleSaveApply || this.handleSave || this.handleReset) { + footer.appendChild(E('div', { 'class': 'cbi-page-actions control-group' }, [ + saveApplyBtn, ' ', + this.handleSave ? E('button', { + 'class': 'cbi-button cbi-button-save', + 'click': L.ui.createHandlerFn(this, 'handleSave') + }, [ _('Save') ]) : '', ' ', + this.handleReset ? E('button', { + 'class': 'cbi-button cbi-button-reset', + 'click': L.ui.createHandlerFn(this, 'handleReset') + }, [ _('Reset') ]) : '' + ])); + } - /* private */ - setupDOM: function(res) { - var domEv = res[0], - uiClass = res[1], - rpcClass = res[2], - formClass = res[3], - rpcBaseURL = res[4]; + return footer; + } + }); - rpcClass.setBaseURL(rpcBaseURL); - rpcClass.addInterceptor(function(msg, req) { - if (!L.isObject(msg) || !L.isObject(msg.error) || msg.error.code != -32002) - return; + var dummyElem = null, + domParser = null, + originalCBIInit = null, + rpcBaseURL = null, + sysFeatures = null; + + /* "preload" builtin classes to make the available via require */ + var classes = { + baseclass: Class, + dom: DOM, + poll: Poll, + request: Request, + view: View + }; - if (!L.isObject(req) || (req.object == 'session' && req.method == 'access')) - return; + var LuCI = Class.extend(/** @lends LuCI.prototype */ { + __name__: 'LuCI', + __init__: function(env) { - return rpcClass.declare({ - 'object': 'session', - 'method': 'access', - 'params': [ 'scope', 'object', 'function' ], - 'expect': { access: true } - })('uci', 'luci', 'read').catch(L.notifySessionExpiry); + document.querySelectorAll('script[src*="/luci.js"]').forEach(function(s) { + if (env.base_url == null || env.base_url == '') { + var m = (s.getAttribute('src') || '').match(/^(.*)\/luci\.js(?:\?v=([^?]+))?$/); + if (m) { + env.base_url = m[1]; + env.resource_version = m[2]; + } + } }); - Request.addInterceptor(function(res) { - var isDenied = false; + if (env.base_url == null) + this.error('InternalError', 'Cannot find url of luci.js'); - if (res.status == 403 && res.headers.get('X-LuCI-Login-Required') == 'yes') - isDenied = true; + env.cgi_base = env.scriptname.replace(/\/[^\/]+$/, ''); - if (!isDenied) - return; + Object.assign(this.env, env); - L.notifySessionExpiry(); + document.addEventListener('poll-start', function(ev) { + document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) { + e.style.display = (e.id == 'xhr_poll_status_off') ? 'none' : ''; + }); }); - return this.probeSystemFeatures().finally(this.initDOM); - }, + document.addEventListener('poll-stop', function(ev) { + document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) { + e.style.display = (e.id == 'xhr_poll_status_on') ? 'none' : ''; + }); + }); - /* private */ - initDOM: function() { - originalCBIInit(); - Poll.start(); - document.dispatchEvent(new CustomEvent('luci-loaded')); + var domReady = new Promise(function(resolveFn, rejectFn) { + document.addEventListener('DOMContentLoaded', resolveFn); + }); + + Promise.all([ + domReady, + this.require('ui'), + this.require('rpc'), + this.require('form'), + this.probeRPCBaseURL() + ]).then(this.setupDOM.bind(this)).catch(this.error); + + originalCBIInit = window.cbi_init; + window.cbi_init = function() {}; }, /** - * The `env` object holds environment settings used by LuCI, such - * as request timeouts, base URLs etc. + * Captures the current stack trace and throws an error of the + * specified type as a new exception. Also logs the exception as + * error to the debug console if it is available. * * @instance * @memberof LuCI - */ - env: {}, - - /** - * Construct a relative URL path from the given prefix and parts. - * The resulting URL is guaranteed to only contain the characters - * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well - * as `/` for the path separator. * - * @instance - * @memberof LuCI + * @param {Error|string} [type=Error] + * Either a string specifying the type of the error to throw or an + * existing `Error` instance to copy. * - * @param {string} [prefix] - * The prefix to join the given parts with. If the `prefix` is - * omitted, it defaults to an empty string. + * @param {string} [fmt=Unspecified error] + * A format string which is used to form the error message, together + * with all subsequent optional arguments. * - * @param {string[]} [parts] - * An array of parts to join into an URL path. Parts may contain - * slashes and any of the other characters mentioned above. + * @param {...*} [args] + * Zero or more variable arguments to the supplied format string. * - * @return {string} - * Return the joined URL path. + * @throws {Error} + * Throws the created error object with the captured stack trace + * appended to the message and the type set to the given type + * argument or copied from the given error instance. */ - path: function(prefix, parts) { - var url = [ prefix || '' ]; + raise: function(type, fmt /*, ...*/) { + var e = null, + msg = fmt ? String.prototype.format.apply(fmt, this.varargs(arguments, 2)) : null, + stack = null; - for (var i = 0; i < parts.length; i++) - if (/^(?:[a-zA-Z0-9_.%,;-]+\/)*[a-zA-Z0-9_.%,;-]+$/.test(parts[i])) - url.push('/', parts[i]); + if (type instanceof Error) { + e = type; - if (url.length === 1) - url.push('/'); + if (msg) + e.message = msg + ': ' + e.message; + } + else { + try { throw new Error('stacktrace') } + catch (e2) { stack = (e2.stack || '').split(/\n/) } - return url.join(''); + e = new (window[type || 'Error'] || Error)(msg || 'Unspecified error'); + e.name = type || 'Error'; + } + + stack = (stack || []).map(function(frame) { + frame = frame.replace(/(.*?)@(.+):(\d+):(\d+)/g, 'at $1 ($2:$3:$4)').trim(); + return frame ? ' ' + frame : ''; + }); + + if (!/^ at /.test(stack[0])) + stack.shift(); + + if (/\braise /.test(stack[0])) + stack.shift(); + + if (/\berror /.test(stack[0])) + stack.shift(); + + if (stack.length) + e.message += '\n' + stack.join('\n'); + + if (window.console && console.debug) + console.debug(e); + + throw e; }, /** - * Construct an URL pathrelative to the script path of the server - * side LuCI application (usually `/cgi-bin/luci`). - * - * The resulting URL is guaranteed to only contain the characters - * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well - * as `/` for the path separator. + * A wrapper around {@link LuCI#raise raise()} which also renders + * the error either as modal overlay when `ui.js` is already loaed + * or directly into the view body. * * @instance * @memberof LuCI * - * @param {string[]} [parts] - * An array of parts to join into an URL path. Parts may contain - * slashes and any of the other characters mentioned above. + * @param {Error|string} [type=Error] + * Either a string specifying the type of the error to throw or an + * existing `Error` instance to copy. * - * @return {string} - * Returns the resulting URL path. + * @param {string} [fmt=Unspecified error] + * A format string which is used to form the error message, together + * with all subsequent optional arguments. + * + * @param {...*} [args] + * Zero or more variable arguments to the supplied format string. + * + * @throws {Error} + * Throws the created error object with the captured stack trace + * appended to the message and the type set to the given type + * argument or copied from the given error instance. */ - url: function() { - return this.path(this.env.scriptname, arguments); + error: function(type, fmt /*, ...*/) { + try { + L.raise.apply(L, Array.prototype.slice.call(arguments)); + } + catch (e) { + if (!e.reported) { + if (L.ui) + L.ui.addNotification(e.name || _('Runtime error'), + E('pre', {}, e.message), 'danger'); + else + DOM.content(document.querySelector('#maincontent'), + E('pre', { 'class': 'alert-message error' }, e.message)); + + e.reported = true; + } + + throw e; + } }, /** - * Construct an URL path relative to the global static resource path - * of the LuCI ui (usually `/luci-static/resources`). - * - * The resulting URL is guaranteed to only contain the characters - * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well - * as `/` for the path separator. + * Return a bound function using the given `self` as `this` context + * and any further arguments as parameters to the bound function. * * @instance * @memberof LuCI * - * @param {string[]} [parts] - * An array of parts to join into an URL path. Parts may contain - * slashes and any of the other characters mentioned above. + * @param {function} fn + * The function to bind. * - * @return {string} - * Returns the resulting URL path. + * @param {*} self + * The value to bind as `this` context to the specified function. + * + * @param {...*} [args] + * Zero or more variable arguments which are bound to the function + * as parameters. + * + * @returns {function} + * Returns the bound function. */ - resource: function() { - return this.path(this.env.resource, arguments); + bind: function(fn, self /*, ... */) { + return Function.prototype.bind.apply(fn, this.varargs(arguments, 2, self)); }, /** - * Construct an URL path relative to the media resource path of the - * LuCI ui (usually `/luci-static/$theme_name`). - * - * The resulting URL is guaranteed to only contain the characters - * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well - * as `/` for the path separator. + * Load an additional LuCI JavaScript class and its dependencies, + * instantiate it and return the resulting class instance. Each + * class is only loaded once. Subsequent attempts to load the same + * class will return the already instantiated class. * * @instance * @memberof LuCI * - * @param {string[]} [parts] - * An array of parts to join into an URL path. Parts may contain - * slashes and any of the other characters mentioned above. - * - * @return {string} - * Returns the resulting URL path. - */ - media: function() { - return this.path(this.env.media, arguments); - }, - - /** - * Return the complete URL path to the current view. + * @param {string} name + * The name of the class to load in dotted notation. Dots will + * be replaced by spaces and joined with the runtime-determined + * base URL of LuCI.js to form an absolute URL to load the class + * file from. * - * @instance - * @memberof LuCI + * @throws {DependencyError} + * Throws a `DependencyError` when the class to load includes + * circular dependencies. * - * @return {string} - * Returns the URL path to the current view. - */ - location: function() { - return this.path(this.env.scriptname, this.env.requestpath); - }, - - - /** - * Tests whether the passed argument is a JavaScript object. - * This function is meant to be an object counterpart to the - * standard `Array.isArray()` function. + * @throws {NetworkError} + * Throws `NetworkError` when the underlying {@link LuCI.request} + * call failed. * - * @instance - * @memberof LuCI + * @throws {SyntaxError} + * Throws `SyntaxError` when the loaded class file code cannot + * be interpreted by `eval`. * - * @param {*} [val] - * The value to test + * @throws {TypeError} + * Throws `TypeError` when the class file could be loaded and + * interpreted, but when invoking its code did not yield a valid + * class instance. * - * @return {boolean} - * Returns `true` if the given value is of type object and - * not `null`, else returns `false`. + * @returns {Promise<LuCI.baseclass>} + * Returns the instantiated class. */ - isObject: function(val) { - return (val != null && typeof(val) == 'object'); - }, + require: function(name, from) { + var L = this, url = null, from = from || []; - /** - * Return an array of sorted object keys, optionally sorted by - * a different key or a different sorting mode. - * - * @instance - * @memberof LuCI - * - * @param {object} obj - * The object to extract the keys from. If the given value is - * not an object, the function will return an empty array. - * - * @param {string} [key] - * Specifies the key to order by. This is mainly useful for - * nested objects of objects or objects of arrays when sorting - * shall not be performed by the primary object keys but by - * some other key pointing to a value within the nested values. - * - * @param {string} [sortmode] - * May be either `addr` or `num` to override the natural - * lexicographic sorting with a sorting suitable for IP/MAC style - * addresses or numeric values respectively. - * - * @return {string[]} - * Returns an array containing the sorted keys of the given object. - */ - sortedKeys: function(obj, key, sortmode) { - if (obj == null || typeof(obj) != 'object') - return []; + /* Class already loaded */ + if (classes[name] != null) { + /* Circular dependency */ + if (from.indexOf(name) != -1) + L.raise('DependencyError', + 'Circular dependency: class "%s" depends on "%s"', + name, from.join('" which depends on "')); - return Object.keys(obj).map(function(e) { - var v = (key != null) ? obj[e][key] : e; + return Promise.resolve(classes[name]); + } - switch (sortmode) { - case 'addr': - v = (v != null) ? v.replace(/(?:^|[.:])([0-9a-fA-F]{1,4})/g, - function(m0, m1) { return ('000' + m1.toLowerCase()).substr(-4) }) : null; - break; + url = '%s/%s.js%s'.format(L.env.base_url, name.replace(/\./g, '/'), (L.env.resource_version ? '?v=' + L.env.resource_version : '')); + from = [ name ].concat(from); - case 'num': - v = (v != null) ? +v : null; - break; + var compileClass = function(res) { + if (!res.ok) + L.raise('NetworkError', + 'HTTP error %d while loading class file "%s"', res.status, url); + + var source = res.text(), + requirematch = /^require[ \t]+(\S+)(?:[ \t]+as[ \t]+([a-zA-Z_]\S*))?$/, + strictmatch = /^use[ \t]+strict$/, + depends = [], + args = ''; + + /* find require statements in source */ + for (var i = 0, off = -1, quote = -1, esc = false; i < source.length; i++) { + var chr = source.charCodeAt(i); + + if (esc) { + esc = false; + } + else if (chr == 92) { + esc = true; + } + else if (chr == quote) { + var s = source.substring(off, i), + m = requirematch.exec(s); + + if (m) { + var dep = m[1], as = m[2] || dep.replace(/[^a-zA-Z0-9_]/g, '_'); + depends.push(L.require(dep, from)); + args += ', ' + as; + } + else if (!strictmatch.exec(s)) { + break; + } + + off = -1; + quote = -1; + } + else if (quote == -1 && (chr == 34 || chr == 39)) { + off = i + 1; + quote = chr; + } } - return [ e, v ]; - }).filter(function(e) { - return (e[1] != null); - }).sort(function(a, b) { - return (a[1] > b[1]); - }).map(function(e) { - return e[0]; - }); - }, + /* load dependencies and instantiate class */ + return Promise.all(depends).then(function(instances) { + var _factory, _class; - /** - * Converts the given value to an array. If the given value is of - * type array, it is returned as-is, values of type object are - * returned as one-element array containing the object, empty - * strings and `null` values are returned as empty array, all other - * values are converted using `String()`, trimmed, split on white - * space and returned as array. - * - * @instance - * @memberof LuCI - * - * @param {*} val - * The value to convert into an array. - * - * @return {Array<*>} - * Returns the resulting array. - */ - toArray: function(val) { - if (val == null) - return []; - else if (Array.isArray(val)) - return val; - else if (typeof(val) == 'object') - return [ val ]; + try { + _factory = eval( + '(function(window, document, L%s) { %s })\n\n//# sourceURL=%s\n' + .format(args, source, res.url)); + } + catch (error) { + L.raise('SyntaxError', '%s\n in %s:%s', + error.message, res.url, error.lineNumber || '?'); + } - var s = String(val).trim(); + _factory.displayName = toCamelCase(name + 'ClassFactory'); + _class = _factory.apply(_factory, [window, document, L].concat(instances)); - if (s == '') - return []; + if (!Class.isSubclass(_class)) + L.error('TypeError', '"%s" factory yields invalid constructor', name); - return s.split(/\s+/); - }, + if (_class.displayName == 'AnonymousClass') + _class.displayName = toCamelCase(name + 'Class'); - /** - * Returns a promise resolving with either the given value or or with - * the given default in case the input value is a rejecting promise. - * - * @instance - * @memberof LuCI - * - * @param {*} value - * The value to resolve the promise with. - * - * @param {*} defvalue - * The default value to resolve the promise with in case the given - * input value is a rejecting promise. - * - * @returns {Promise<*>} - * Returns a new promise resolving either to the given input value or - * to the given default value on error. - */ - resolveDefault: function(value, defvalue) { - return Promise.resolve(value).catch(function() { return defvalue }); - }, + var ptr = Object.getPrototypeOf(L), + parts = name.split(/\./), + instance = new _class(); - /** - * The request callback function is invoked whenever an HTTP - * reply to a request made using the `L.get()`, `L.post()` or - * `L.poll()` function is timed out or received successfully. - * - * @instance - * @memberof LuCI - * - * @callback LuCI.requestCallbackFn - * @param {XMLHTTPRequest} xhr - * The XMLHTTPRequest instance used to make the request. - * - * @param {*} data - * The response JSON if the response could be parsed as such, - * else `null`. - * - * @param {number} duration - * The total duration of the request in milliseconds. - */ + for (var i = 0; ptr && i < parts.length - 1; i++) + ptr = ptr[parts[i]]; - /** - * Issues a GET request to the given url and invokes the specified - * callback function. The function is a wrapper around - * {@link LuCI.Request#request Request.request()}. + if (ptr) + ptr[parts[i]] = instance; + + classes[name] = instance; + + return instance; + }); + }; + + /* Request class file */ + classes[name] = Request.get(url, { cache: true }).then(compileClass); + + return classes[name]; + }, + + /* DOM setup */ + probeRPCBaseURL: function() { + if (rpcBaseURL == null) { + try { + rpcBaseURL = window.sessionStorage.getItem('rpcBaseURL'); + } + catch (e) { } + } + + if (rpcBaseURL == null) { + var rpcFallbackURL = this.url('admin/ubus'); + + rpcBaseURL = Request.get(this.env.ubuspath).then(function(res) { + return (rpcBaseURL = (res.status == 400) ? L.env.ubuspath : rpcFallbackURL); + }, function() { + return (rpcBaseURL = rpcFallbackURL); + }).then(function(url) { + try { + window.sessionStorage.setItem('rpcBaseURL', url); + } + catch (e) { } + + return url; + }); + } + + return Promise.resolve(rpcBaseURL); + }, + + probeSystemFeatures: function() { + var sessionid = classes.rpc.getSessionID(); + + if (sysFeatures == null) { + try { + var data = JSON.parse(window.sessionStorage.getItem('sysFeatures')); + + if (this.isObject(data) && this.isObject(data[sessionid])) + sysFeatures = data[sessionid]; + } + catch (e) {} + } + + if (!this.isObject(sysFeatures)) { + sysFeatures = classes.rpc.declare({ + object: 'luci', + method: 'getFeatures', + expect: { '': {} } + })().then(function(features) { + try { + var data = {}; + data[sessionid] = features; + + window.sessionStorage.setItem('sysFeatures', JSON.stringify(data)); + } + catch (e) {} + + sysFeatures = features; + + return features; + }); + } + + return Promise.resolve(sysFeatures); + }, + + /** + * Test whether a particular system feature is available, such as + * hostapd SAE support or an installed firewall. The features are + * queried once at the beginning of the LuCI session and cached in + * `SessionStorage` throughout the lifetime of the associated tab or + * browser window. * - * @deprecated * @instance * @memberof LuCI * - * @param {string} url - * The URL to request. - * - * @param {Object<string, string>} [args] - * Additional query string arguments to append to the URL. + * @param {string} feature + * The feature to test. For detailed list of known feature flags, + * see `/modules/luci-base/root/usr/libexec/rpcd/luci`. * - * @param {LuCI.requestCallbackFn} cb - * The callback function to invoke when the request finishes. + * @param {string} [subfeature] + * Some feature classes like `hostapd` provide sub-feature flags, + * such as `sae` or `11w` support. The `subfeature` argument can + * be used to query these. * - * @return {Promise<null>} - * Returns a promise resolving to `null` when concluded. + * @return {boolean|null} + * Return `true` if the queried feature (and sub-feature) is available + * or `false` if the requested feature isn't present or known. + * Return `null` when a sub-feature was queried for a feature which + * has no sub-features. */ - get: function(url, args, cb) { - return this.poll(null, url, args, cb, false); + hasSystemFeature: function() { + var ft = sysFeatures[arguments[0]]; + + if (arguments.length == 2) + return this.isObject(ft) ? ft[arguments[1]] : null; + + return (ft != null && ft != false); + }, + + /* private */ + notifySessionExpiry: function() { + Poll.stop(); + + L.ui.showModal(_('Session expired'), [ + E('div', { class: 'alert-message warning' }, + _('A new login is required since the authentication session expired.')), + E('div', { class: 'right' }, + E('div', { + class: 'btn primary', + click: function() { + var loc = window.location; + window.location = loc.protocol + '//' + loc.host + loc.pathname + loc.search; + } + }, _('To login…'))) + ]); + + L.raise('SessionError', 'Login session is expired'); + }, + + /* private */ + setupDOM: function(res) { + var domEv = res[0], + uiClass = res[1], + rpcClass = res[2], + formClass = res[3], + rpcBaseURL = res[4]; + + rpcClass.setBaseURL(rpcBaseURL); + + rpcClass.addInterceptor(function(msg, req) { + if (!L.isObject(msg) || !L.isObject(msg.error) || msg.error.code != -32002) + return; + + if (!L.isObject(req) || (req.object == 'session' && req.method == 'access')) + return; + + return rpcClass.declare({ + 'object': 'session', + 'method': 'access', + 'params': [ 'scope', 'object', 'function' ], + 'expect': { access: true } + })('uci', 'luci', 'read').catch(L.notifySessionExpiry); + }); + + Request.addInterceptor(function(res) { + var isDenied = false; + + if (res.status == 403 && res.headers.get('X-LuCI-Login-Required') == 'yes') + isDenied = true; + + if (!isDenied) + return; + + L.notifySessionExpiry(); + }); + + return this.probeSystemFeatures().finally(this.initDOM); + }, + + /* private */ + initDOM: function() { + originalCBIInit(); + Poll.start(); + document.dispatchEvent(new CustomEvent('luci-loaded')); }, /** - * Issues a POST request to the given url and invokes the specified - * callback function. The function is a wrapper around - * {@link LuCI.Request#request Request.request()}. The request is - * sent using `application/x-www-form-urlencoded` encoding and will - * contain a field `token` with the current value of `LuCI.env.token` - * by default. + * The `env` object holds environment settings used by LuCI, such + * as request timeouts, base URLs etc. * - * @deprecated * @instance * @memberof LuCI + */ + env: {}, + + /** + * Construct a relative URL path from the given prefix and parts. + * The resulting URL is guaranteed to only contain the characters + * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well + * as `/` for the path separator. * - * @param {string} url - * The URL to request. + * @instance + * @memberof LuCI * - * @param {Object<string, string>} [args] - * Additional post arguments to append to the request body. + * @param {string} [prefix] + * The prefix to join the given parts with. If the `prefix` is + * omitted, it defaults to an empty string. * - * @param {LuCI.requestCallbackFn} cb - * The callback function to invoke when the request finishes. + * @param {string[]} [parts] + * An array of parts to join into an URL path. Parts may contain + * slashes and any of the other characters mentioned above. * - * @return {Promise<null>} - * Returns a promise resolving to `null` when concluded. + * @return {string} + * Return the joined URL path. */ - post: function(url, args, cb) { - return this.poll(null, url, args, cb, true); + path: function(prefix, parts) { + var url = [ prefix || '' ]; + + for (var i = 0; i < parts.length; i++) + if (/^(?:[a-zA-Z0-9_.%,;-]+\/)*[a-zA-Z0-9_.%,;-]+$/.test(parts[i])) + url.push('/', parts[i]); + + if (url.length === 1) + url.push('/'); + + return url.join(''); }, /** - * Register a polling HTTP request that invokes the specified - * callback function. The function is a wrapper around - * {@link LuCI.Request.poll#add Request.poll.add()}. + * Construct an URL pathrelative to the script path of the server + * side LuCI application (usually `/cgi-bin/luci`). + * + * The resulting URL is guaranteed to only contain the characters + * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well + * as `/` for the path separator. * - * @deprecated * @instance * @memberof LuCI * - * @param {number} interval - * The poll interval to use. If set to a value less than or equal - * to `0`, it will default to the global poll interval configured - * in `LuCI.env.pollinterval`. - * - * @param {string} url - * The URL to request. - * - * @param {Object<string, string>} [args] - * Specifies additional arguments for the request. For GET requests, - * the arguments are appended to the URL as query string, for POST - * requests, they'll be added to the request body. + * @param {string[]} [parts] + * An array of parts to join into an URL path. Parts may contain + * slashes and any of the other characters mentioned above. * - * @param {LuCI.requestCallbackFn} cb - * The callback function to invoke whenever a request finishes. + * @return {string} + * Returns the resulting URL path. + */ + url: function() { + return this.path(this.env.scriptname, arguments); + }, + + /** + * Construct an URL path relative to the global static resource path + * of the LuCI ui (usually `/luci-static/resources`). * - * @param {boolean} [post=false] - * When set to `false` or not specified, poll requests will be made - * using the GET method. When set to `true`, POST requests will be - * issued. In case of POST requests, the request body will contain - * an argument `token` with the current value of `LuCI.env.token` by - * default, regardless of the parameters specified with `args`. + * The resulting URL is guaranteed to only contain the characters + * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well + * as `/` for the path separator. * - * @return {function} - * Returns the internally created function that has been passed to - * {@link LuCI.Request.poll#add Request.poll.add()}. This value can - * be passed to {@link LuCI.Poll.remove Poll.remove()} to remove the - * polling request. + * @instance + * @memberof LuCI + * + * @param {string[]} [parts] + * An array of parts to join into an URL path. Parts may contain + * slashes and any of the other characters mentioned above. + * + * @return {string} + * Returns the resulting URL path. */ - poll: function(interval, url, args, cb, post) { - if (interval !== null && interval <= 0) - interval = this.env.pollinterval; - - var data = post ? { token: this.env.token } : null, - method = post ? 'POST' : 'GET'; - - if (!/^(?:\/|\S+:\/\/)/.test(url)) - url = this.url(url); - - if (args != null) - data = Object.assign(data || {}, args); - - if (interval !== null) - return Request.poll.add(interval, url, { method: method, query: data }, cb); - else - return Request.request(url, { method: method, query: data }) - .then(function(res) { - var json = null; - if (/^application\/json\b/.test(res.headers.get('Content-Type'))) - try { json = res.json() } catch(e) {} - cb(res.xhr, json, res.duration); - }); + resource: function() { + return this.path(this.env.resource, arguments); }, /** - * Deprecated wrapper around {@link LuCI.Poll.remove Poll.remove()}. + * Construct an URL path relative to the media resource path of the + * LuCI ui (usually `/luci-static/$theme_name`). + * + * The resulting URL is guaranteed to only contain the characters + * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well + * as `/` for the path separator. * - * @deprecated * @instance * @memberof LuCI * - * @param {function} entry - * The polling function to remove. + * @param {string[]} [parts] + * An array of parts to join into an URL path. Parts may contain + * slashes and any of the other characters mentioned above. * - * @return {boolean} - * Returns `true` when the function has been removed or `false` if - * it could not be found. + * @return {string} + * Returns the resulting URL path. */ - stop: function(entry) { return Poll.remove(entry) }, + media: function() { + return this.path(this.env.media, arguments); + }, /** - * Deprecated wrapper around {@link LuCI.Poll.stop Poll.stop()}. + * Return the complete URL path to the current view. * - * @deprecated * @instance * @memberof LuCI * - * @return {boolean} - * Returns `true` when the polling loop has been stopped or `false` - * when it didn't run to begin with. + * @return {string} + * Returns the URL path to the current view. */ - halt: function() { return Poll.stop() }, + location: function() { + return this.path(this.env.scriptname, this.env.requestpath); + }, + /** - * Deprecated wrapper around {@link LuCI.Poll.start Poll.start()}. + * Tests whether the passed argument is a JavaScript object. + * This function is meant to be an object counterpart to the + * standard `Array.isArray()` function. * - * @deprecated * @instance * @memberof LuCI * + * @param {*} [val] + * The value to test + * * @return {boolean} - * Returns `true` when the polling loop has been started or `false` - * when it was already running. + * Returns `true` if the given value is of type object and + * not `null`, else returns `false`. */ - run: function() { return Poll.start() }, - + isObject: function(val) { + return (val != null && typeof(val) == 'object'); + }, /** - * @class + * Return an array of sorted object keys, optionally sorted by + * a different key or a different sorting mode. + * + * @instance * @memberof LuCI - * @hideconstructor - * @classdesc * - * The `dom` class provides convenience method for creating and - * manipulating DOM elements. + * @param {object} obj + * The object to extract the keys from. If the given value is + * not an object, the function will return an empty array. + * + * @param {string} [key] + * Specifies the key to order by. This is mainly useful for + * nested objects of objects or objects of arrays when sorting + * shall not be performed by the primary object keys but by + * some other key pointing to a value within the nested values. + * + * @param {string} [sortmode] + * May be either `addr` or `num` to override the natural + * lexicographic sorting with a sorting suitable for IP/MAC style + * addresses or numeric values respectively. + * + * @return {string[]} + * Returns an array containing the sorted keys of the given object. */ - dom: Class.singleton(/* @lends LuCI.dom.prototype */ { - __name__: 'LuCI.DOM', - - /** - * Tests whether the given argument is a valid DOM `Node`. - * - * @instance - * @memberof LuCI.dom - * @param {*} e - * The value to test. - * - * @returns {boolean} - * Returns `true` if the value is a DOM `Node`, else `false`. - */ - elem: function(e) { - return (e != null && typeof(e) == 'object' && 'nodeType' in e); - }, + sortedKeys: function(obj, key, sortmode) { + if (obj == null || typeof(obj) != 'object') + return []; - /** - * Parses a given string as HTML and returns the first child node. - * - * @instance - * @memberof LuCI.dom - * @param {string} s - * A string containing an HTML fragment to parse. Note that only - * the first result of the resulting structure is returned, so an - * input value of `<div>foo</div> <div>bar</div>` will only return - * the first `div` element node. - * - * @returns {Node} - * Returns the first DOM `Node` extracted from the HTML fragment or - * `null` on parsing failures or if no element could be found. - */ - parse: function(s) { - var elem; + return Object.keys(obj).map(function(e) { + var v = (key != null) ? obj[e][key] : e; - try { - domParser = domParser || new DOMParser(); - elem = domParser.parseFromString(s, 'text/html').body.firstChild; - } - catch(e) {} + switch (sortmode) { + case 'addr': + v = (v != null) ? v.replace(/(?:^|[.:])([0-9a-fA-F]{1,4})/g, + function(m0, m1) { return ('000' + m1.toLowerCase()).substr(-4) }) : null; + break; - if (!elem) { - try { - dummyElem = dummyElem || document.createElement('div'); - dummyElem.innerHTML = s; - elem = dummyElem.firstChild; - } - catch (e) {} + case 'num': + v = (v != null) ? +v : null; + break; } - return elem || null; - }, - - /** - * Tests whether a given `Node` matches the given query selector. - * - * This function is a convenience wrapper around the standard - * `Node.matches("selector")` function with the added benefit that - * the `node` argument may be a non-`Node` value, in which case - * this function simply returns `false`. - * - * @instance - * @memberof LuCI.dom - * @param {*} node - * The `Node` argument to test the selector against. - * - * @param {string} [selector] - * The query selector expression to test against the given node. - * - * @returns {boolean} - * Returns `true` if the given node matches the specified selector - * or `false` when the node argument is no valid DOM `Node` or the - * selector didn't match. - */ - matches: function(node, selector) { - var m = this.elem(node) ? node.matches || node.msMatchesSelector : null; - return m ? m.call(node, selector) : false; - }, + return [ e, v ]; + }).filter(function(e) { + return (e[1] != null); + }).sort(function(a, b) { + return (a[1] > b[1]); + }).map(function(e) { + return e[0]; + }); + }, - /** - * Returns the closest parent node that matches the given query - * selector expression. - * - * This function is a convenience wrapper around the standard - * `Node.closest("selector")` function with the added benefit that - * the `node` argument may be a non-`Node` value, in which case - * this function simply returns `null`. - * - * @instance - * @memberof LuCI.dom - * @param {*} node - * The `Node` argument to find the closest parent for. - * - * @param {string} [selector] - * The query selector expression to test against each parent. - * - * @returns {Node|null} - * Returns the closest parent node matching the selector or - * `null` when the node argument is no valid DOM `Node` or the - * selector didn't match any parent. - */ - parent: function(node, selector) { - if (this.elem(node) && node.closest) - return node.closest(selector); + /** + * Converts the given value to an array. If the given value is of + * type array, it is returned as-is, values of type object are + * returned as one-element array containing the object, empty + * strings and `null` values are returned as empty array, all other + * values are converted using `String()`, trimmed, split on white + * space and returned as array. + * + * @instance + * @memberof LuCI + * + * @param {*} val + * The value to convert into an array. + * + * @return {Array<*>} + * Returns the resulting array. + */ + toArray: function(val) { + if (val == null) + return []; + else if (Array.isArray(val)) + return val; + else if (typeof(val) == 'object') + return [ val ]; - while (this.elem(node)) - if (this.matches(node, selector)) - return node; - else - node = node.parentNode; + var s = String(val).trim(); - return null; - }, + if (s == '') + return []; - /** - * Appends the given children data to the given node. - * - * @instance - * @memberof LuCI.dom - * @param {*} node - * The `Node` argument to append the children to. - * - * @param {*} [children] - * The childrens to append to the given node. - * - * When `children` is an array, then each item of the array - * will be either appended as child element or text node, - * depending on whether the item is a DOM `Node` instance or - * some other non-`null` value. Non-`Node`, non-`null` values - * will be converted to strings first before being passed as - * argument to `createTextNode()`. - * - * When `children` is a function, it will be invoked with - * the passed `node` argument as sole parameter and the `append` - * function will be invoked again, with the given `node` argument - * as first and the return value of the `children` function as - * second parameter. - * - * When `children` is is a DOM `Node` instance, it will be - * appended to the given `node`. - * - * When `children` is any other non-`null` value, it will be - * converted to a string and appened to the `innerHTML` property - * of the given `node`. - * - * @returns {Node|null} - * Returns the last children `Node` appended to the node or `null` - * if either the `node` argument was no valid DOM `node` or if the - * `children` was `null` or didn't result in further DOM nodes. - */ - append: function(node, children) { - if (!this.elem(node)) - return null; + return s.split(/\s+/); + }, - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) - if (this.elem(children[i])) - node.appendChild(children[i]); - else if (children !== null && children !== undefined) - node.appendChild(document.createTextNode('' + children[i])); - - return node.lastChild; - } - else if (typeof(children) === 'function') { - return this.append(node, children(node)); - } - else if (this.elem(children)) { - return node.appendChild(children); - } - else if (children !== null && children !== undefined) { - node.innerHTML = '' + children; - return node.lastChild; - } - - return null; - }, - - /** - * Replaces the content of the given node with the given children. - * - * This function first removes any children of the given DOM - * `Node` and then adds the given given children following the - * rules outlined below. - * - * @instance - * @memberof LuCI.dom - * @param {*} node - * The `Node` argument to replace the children of. - * - * @param {*} [children] - * The childrens to replace into the given node. - * - * When `children` is an array, then each item of the array - * will be either appended as child element or text node, - * depending on whether the item is a DOM `Node` instance or - * some other non-`null` value. Non-`Node`, non-`null` values - * will be converted to strings first before being passed as - * argument to `createTextNode()`. - * - * When `children` is a function, it will be invoked with - * the passed `node` argument as sole parameter and the `append` - * function will be invoked again, with the given `node` argument - * as first and the return value of the `children` function as - * second parameter. - * - * When `children` is is a DOM `Node` instance, it will be - * appended to the given `node`. - * - * When `children` is any other non-`null` value, it will be - * converted to a string and appened to the `innerHTML` property - * of the given `node`. - * - * @returns {Node|null} - * Returns the last children `Node` appended to the node or `null` - * if either the `node` argument was no valid DOM `node` or if the - * `children` was `null` or didn't result in further DOM nodes. - */ - content: function(node, children) { - if (!this.elem(node)) - return null; - - var dataNodes = node.querySelectorAll('[data-idref]'); - - for (var i = 0; i < dataNodes.length; i++) - delete this.registry[dataNodes[i].getAttribute('data-idref')]; - - while (node.firstChild) - node.removeChild(node.firstChild); - - return this.append(node, children); - }, - - /** - * Sets attributes or registers event listeners on element nodes. - * - * @instance - * @memberof LuCI.dom - * @param {*} node - * The `Node` argument to set the attributes or add the event - * listeners for. When the given `node` value is not a valid - * DOM `Node`, the function returns and does nothing. - * - * @param {string|Object<string, *>} key - * Specifies either the attribute or event handler name to use, - * or an object containing multiple key, value pairs which are - * each added to the node as either attribute or event handler, - * depending on the respective value. - * - * @param {*} [val] - * Specifies the attribute value or event handler function to add. - * If the `key` parameter is an `Object`, this parameter will be - * ignored. - * - * When `val` is of type function, it will be registered as event - * handler on the given `node` with the `key` parameter being the - * event name. - * - * When `val` is of type object, it will be serialized as JSON and - * added as attribute to the given `node`, using the given `key` - * as attribute name. - * - * When `val` is of any other type, it will be added as attribute - * to the given `node` as-is, with the underlying `setAttribute()` - * call implicitely turning it into a string. - */ - attr: function(node, key, val) { - if (!this.elem(node)) - return null; - - var attr = null; - - if (typeof(key) === 'object' && key !== null) - attr = key; - else if (typeof(key) === 'string') - attr = {}, attr[key] = val; - - for (key in attr) { - if (!attr.hasOwnProperty(key) || attr[key] == null) - continue; - - switch (typeof(attr[key])) { - case 'function': - node.addEventListener(key, attr[key]); - break; - - case 'object': - node.setAttribute(key, JSON.stringify(attr[key])); - break; - - default: - node.setAttribute(key, attr[key]); - } - } - }, - - /** - * Creates a new DOM `Node` from the given `html`, `attr` and - * `data` parameters. - * - * This function has multiple signatures, it can be either invoked - * in the form `create(html[, attr[, data]])` or in the form - * `create(html[, data])`. The used variant is determined from the - * type of the second argument. - * - * @instance - * @memberof LuCI.dom - * @param {*} html - * Describes the node to create. - * - * When the value of `html` is of type array, a `DocumentFragment` - * node is created and each item of the array is first converted - * to a DOM `Node` by passing it through `create()` and then added - * as child to the fragment. - * - * When the value of `html` is a DOM `Node` instance, no new - * element will be created but the node will be used as-is. - * - * When the value of `html` is a string starting with `<`, it will - * be passed to `dom.parse()` and the resulting value is used. - * - * When the value of `html` is any other string, it will be passed - * to `document.createElement()` for creating a new DOM `Node` of - * the given name. - * - * @param {Object<string, *>} [attr] - * Specifies an Object of key, value pairs to set as attributes - * or event handlers on the created node. Refer to - * {@link LuCI.dom#attr dom.attr()} for details. - * - * @param {*} [data] - * Specifies children to append to the newly created element. - * Refer to {@link LuCI.dom#append dom.append()} for details. - * - * @throws {InvalidCharacterError} - * Throws an `InvalidCharacterError` when the given `html` - * argument contained malformed markup (such as not escaped - * `&` characters in XHTML mode) or when the given node name - * in `html` contains characters which are not legal in DOM - * element names, such as spaces. - * - * @returns {Node} - * Returns the newly created `Node`. - */ - create: function() { - var html = arguments[0], - attr = arguments[1], - data = arguments[2], - elem; - - if (!(attr instanceof Object) || Array.isArray(attr)) - data = attr, attr = null; - - if (Array.isArray(html)) { - elem = document.createDocumentFragment(); - for (var i = 0; i < html.length; i++) - elem.appendChild(this.create(html[i])); - } - else if (this.elem(html)) { - elem = html; - } - else if (html.charCodeAt(0) === 60) { - elem = this.parse(html); - } - else { - elem = document.createElement(html); - } - - if (!elem) - return null; - - this.attr(elem, attr); - this.append(elem, data); - - return elem; - }, - - registry: {}, - - /** - * Attaches or detaches arbitrary data to and from a DOM `Node`. - * - * This function is useful to attach non-string values or runtime - * data that is not serializable to DOM nodes. To decouple data - * from the DOM, values are not added directly to nodes, but - * inserted into a registry instead which is then referenced by a - * string key stored as `data-idref` attribute in the node. - * - * This function has multiple signatures and is sensitive to the - * number of arguments passed to it. - * - * - `dom.data(node)` - - * Fetches all data associated with the given node. - * - `dom.data(node, key)` - - * Fetches a specific key associated with the given node. - * - `dom.data(node, key, val)` - - * Sets a specific key to the given value associated with the - * given node. - * - `dom.data(node, null)` - - * Clears any data associated with the node. - * - `dom.data(node, key, null)` - - * Clears the given key associated with the node. - * - * @instance - * @memberof LuCI.dom - * @param {Node} node - * The DOM `Node` instance to set or retrieve the data for. - * - * @param {string|null} [key] - * This is either a string specifying the key to retrieve, or - * `null` to unset the entire node data. - * - * @param {*|null} [val] - * This is either a non-`null` value to set for a given key or - * `null` to remove the given `key` from the specified node. - * - * @returns {*} - * Returns the get or set value, or `null` when no value could - * be found. - */ - data: function(node, key, val) { - if (!node || !node.getAttribute) - return null; - - var id = node.getAttribute('data-idref'); - - /* clear all data */ - if (arguments.length > 1 && key == null) { - if (id != null) { - node.removeAttribute('data-idref'); - val = this.registry[id] - delete this.registry[id]; - return val; - } - - return null; - } - - /* clear a key */ - else if (arguments.length > 2 && key != null && val == null) { - if (id != null) { - val = this.registry[id][key]; - delete this.registry[id][key]; - return val; - } - - return null; - } - - /* set a key */ - else if (arguments.length > 2 && key != null && val != null) { - if (id == null) { - do { id = Math.floor(Math.random() * 0xffffffff).toString(16) } - while (this.registry.hasOwnProperty(id)); - - node.setAttribute('data-idref', id); - this.registry[id] = {}; - } - - return (this.registry[id][key] = val); - } - - /* get all data */ - else if (arguments.length == 1) { - if (id != null) - return this.registry[id]; - - return null; - } - - /* get a key */ - else if (arguments.length == 2) { - if (id != null) - return this.registry[id][key]; - } - - return null; - }, - - /** - * Binds the given class instance ot the specified DOM `Node`. - * - * This function uses the `dom.data()` facility to attach the - * passed instance of a Class to a node. This is needed for - * complex widget elements or similar where the corresponding - * class instance responsible for the element must be retrieved - * from DOM nodes obtained by `querySelector()` or similar means. - * - * @instance - * @memberof LuCI.dom - * @param {Node} node - * The DOM `Node` instance to bind the class to. - * - * @param {Class} inst - * The Class instance to bind to the node. - * - * @throws {TypeError} - * Throws a `TypeError` when the given instance argument isn't - * a valid Class instance. - * - * @returns {Class} - * Returns the bound class instance. - */ - bindClassInstance: function(node, inst) { - if (!(inst instanceof Class)) - L.error('TypeError', 'Argument must be a class instance'); - - return this.data(node, '_class', inst); - }, - - /** - * Finds a bound class instance on the given node itself or the - * first bound instance on its closest parent node. - * - * @instance - * @memberof LuCI.dom - * @param {Node} node - * The DOM `Node` instance to start from. - * - * @returns {Class|null} - * Returns the founds class instance if any or `null` if no bound - * class could be found on the node itself or any of its parents. - */ - findClassInstance: function(node) { - var inst = null; - - do { - inst = this.data(node, '_class'); - node = node.parentNode; - } - while (!(inst instanceof Class) && node != null); - - return inst; - }, - - /** - * Finds a bound class instance on the given node itself or the - * first bound instance on its closest parent node and invokes - * the specified method name on the found class instance. - * - * @instance - * @memberof LuCI.dom - * @param {Node} node - * The DOM `Node` instance to start from. - * - * @param {string} method - * The name of the method to invoke on the found class instance. - * - * @param {...*} params - * Additional arguments to pass to the invoked method as-is. - * - * @returns {*|null} - * Returns the return value of the invoked method if a class - * instance and method has been found. Returns `null` if either - * no bound class instance could be found, or if the found - * instance didn't have the requested `method`. - */ - callClassMethod: function(node, method /*, ... */) { - var inst = this.findClassInstance(node); - - if (inst == null || typeof(inst[method]) != 'function') - return null; - - return inst[method].apply(inst, inst.varargs(arguments, 2)); - }, - - /** - * The ignore callback function is invoked by `isEmpty()` for each - * child node to decide whether to ignore a child node or not. - * - * When this function returns `false`, the node passed to it is - * ignored, else not. - * - * @callback LuCI.dom~ignoreCallbackFn - * @param {Node} node - * The child node to test. - * - * @returns {boolean} - * Boolean indicating whether to ignore the node or not. - */ - - /** - * Tests whether a given DOM `Node` instance is empty or appears - * empty. - * - * Any element child nodes which have the CSS class `hidden` set - * or for which the optionally passed `ignoreFn` callback function - * returns `false` are ignored. - * - * @instance - * @memberof LuCI.dom - * @param {Node} node - * The DOM `Node` instance to test. - * - * @param {LuCI.dom~ignoreCallbackFn} [ignoreFn] - * Specifies an optional function which is invoked for each child - * node to decide whether the child node should be ignored or not. - * - * @returns {boolean} - * Returns `true` if the node does not have any children or if - * any children node either has a `hidden` CSS class or a `false` - * result when testing it using the given `ignoreFn`. - */ - isEmpty: function(node, ignoreFn) { - for (var child = node.firstElementChild; child != null; child = child.nextElementSibling) - if (!child.classList.contains('hidden') && (!ignoreFn || !ignoreFn(child))) - return false; - - return true; - } - }), - - Poll: Poll, - Class: Class, - Request: Request, + /** + * Returns a promise resolving with either the given value or or with + * the given default in case the input value is a rejecting promise. + * + * @instance + * @memberof LuCI + * + * @param {*} value + * The value to resolve the promise with. + * + * @param {*} defvalue + * The default value to resolve the promise with in case the given + * input value is a rejecting promise. + * + * @returns {Promise<*>} + * Returns a new promise resolving either to the given input value or + * to the given default value on error. + */ + resolveDefault: function(value, defvalue) { + return Promise.resolve(value).catch(function() { return defvalue }); + }, /** - * @class + * The request callback function is invoked whenever an HTTP + * reply to a request made using the `L.get()`, `L.post()` or + * `L.poll()` function is timed out or received successfully. + * + * @instance * @memberof LuCI - * @hideconstructor - * @classdesc * - * The `view` class forms the basis of views and provides a standard - * set of methods to inherit from. + * @callback LuCI.requestCallbackFn + * @param {XMLHTTPRequest} xhr + * The XMLHTTPRequest instance used to make the request. + * + * @param {*} data + * The response JSON if the response could be parsed as such, + * else `null`. + * + * @param {number} duration + * The total duration of the request in milliseconds. */ - view: Class.extend(/* @lends LuCI.view.prototype */ { - __name__: 'LuCI.View', - __init__: function() { - var vp = document.getElementById('view'); - - L.dom.content(vp, E('div', { 'class': 'spinning' }, _('Loading view…'))); + /** + * Issues a GET request to the given url and invokes the specified + * callback function. The function is a wrapper around + * {@link LuCI.request#request Request.request()}. + * + * @deprecated + * @instance + * @memberof LuCI + * + * @param {string} url + * The URL to request. + * + * @param {Object<string, string>} [args] + * Additional query string arguments to append to the URL. + * + * @param {LuCI.requestCallbackFn} cb + * The callback function to invoke when the request finishes. + * + * @return {Promise<null>} + * Returns a promise resolving to `null` when concluded. + */ + get: function(url, args, cb) { + return this.poll(null, url, args, cb, false); + }, - return Promise.resolve(this.load()) - .then(L.bind(this.render, this)) - .then(L.bind(function(nodes) { - var vp = document.getElementById('view'); + /** + * Issues a POST request to the given url and invokes the specified + * callback function. The function is a wrapper around + * {@link LuCI.request#request Request.request()}. The request is + * sent using `application/x-www-form-urlencoded` encoding and will + * contain a field `token` with the current value of `LuCI.env.token` + * by default. + * + * @deprecated + * @instance + * @memberof LuCI + * + * @param {string} url + * The URL to request. + * + * @param {Object<string, string>} [args] + * Additional post arguments to append to the request body. + * + * @param {LuCI.requestCallbackFn} cb + * The callback function to invoke when the request finishes. + * + * @return {Promise<null>} + * Returns a promise resolving to `null` when concluded. + */ + post: function(url, args, cb) { + return this.poll(null, url, args, cb, true); + }, - L.dom.content(vp, nodes); - L.dom.append(vp, this.addFooter()); - }, this)).catch(L.error); - }, + /** + * Register a polling HTTP request that invokes the specified + * callback function. The function is a wrapper around + * {@link LuCI.request.poll#add Request.poll.add()}. + * + * @deprecated + * @instance + * @memberof LuCI + * + * @param {number} interval + * The poll interval to use. If set to a value less than or equal + * to `0`, it will default to the global poll interval configured + * in `LuCI.env.pollinterval`. + * + * @param {string} url + * The URL to request. + * + * @param {Object<string, string>} [args] + * Specifies additional arguments for the request. For GET requests, + * the arguments are appended to the URL as query string, for POST + * requests, they'll be added to the request body. + * + * @param {LuCI.requestCallbackFn} cb + * The callback function to invoke whenever a request finishes. + * + * @param {boolean} [post=false] + * When set to `false` or not specified, poll requests will be made + * using the GET method. When set to `true`, POST requests will be + * issued. In case of POST requests, the request body will contain + * an argument `token` with the current value of `LuCI.env.token` by + * default, regardless of the parameters specified with `args`. + * + * @return {function} + * Returns the internally created function that has been passed to + * {@link LuCI.request.poll#add Request.poll.add()}. This value can + * be passed to {@link LuCI.poll.remove Poll.remove()} to remove the + * polling request. + */ + poll: function(interval, url, args, cb, post) { + if (interval !== null && interval <= 0) + interval = this.env.pollinterval; - /** - * The load function is invoked before the view is rendered. - * - * The invocation of this function is wrapped by - * `Promise.resolve()` so it may return Promises if needed. - * - * The return value of the function (or the resolved values - * of the promise returned by it) will be passed as first - * argument to `render()`. - * - * This function is supposed to be overwritten by subclasses, - * the default implementation does nothing. - * - * @instance - * @abstract - * @memberof LuCI.view - * - * @returns {*|Promise<*>} - * May return any value or a Promise resolving to any value. - */ - load: function() {}, + var data = post ? { token: this.env.token } : null, + method = post ? 'POST' : 'GET'; - /** - * The render function is invoked after the - * {@link LuCI.view#load load()} function and responsible - * for setting up the view contents. It must return a DOM - * `Node` or `DocumentFragment` holding the contents to - * insert into the view area. - * - * The invocation of this function is wrapped by - * `Promise.resolve()` so it may return Promises if needed. - * - * The return value of the function (or the resolved values - * of the promise returned by it) will be inserted into the - * main content area using - * {@link LuCI.dom#append dom.append()}. - * - * This function is supposed to be overwritten by subclasses, - * the default implementation does nothing. - * - * @instance - * @abstract - * @memberof LuCI.view - * @param {*|null} load_results - * This function will receive the return value of the - * {@link LuCI.view#load view.load()} function as first - * argument. - * - * @returns {Node|Promise<Node>} - * Should return a DOM `Node` value or a `Promise` resolving - * to a `Node` value. - */ - render: function() {}, + if (!/^(?:\/|\S+:\/\/)/.test(url)) + url = this.url(url); - /** - * The handleSave function is invoked when the user clicks - * the `Save` button in the page action footer. - * - * The default implementation should be sufficient for most - * views using {@link form#Map form.Map()} based forms - it - * will iterate all forms present in the view and invoke - * the {@link form#Map#save Map.save()} method on each form. - * - * Views not using `Map` instances or requiring other special - * logic should overwrite `handleSave()` with a custom - * implementation. - * - * To disable the `Save` page footer button, views extending - * this base class should overwrite the `handleSave` function - * with `null`. - * - * The invocation of this function is wrapped by - * `Promise.resolve()` so it may return Promises if needed. - * - * @instance - * @memberof LuCI.view - * @param {Event} ev - * The DOM event that triggered the function. - * - * @returns {*|Promise<*>} - * Any return values of this function are discarded, but - * passed through `Promise.resolve()` to ensure that any - * returned promise runs to completion before the button - * is reenabled. - */ - handleSave: function(ev) { - var tasks = []; + if (args != null) + data = Object.assign(data || {}, args); - document.getElementById('maincontent') - .querySelectorAll('.cbi-map').forEach(function(map) { - tasks.push(L.dom.callClassMethod(map, 'save')); + if (interval !== null) + return Request.poll.add(interval, url, { method: method, query: data }, cb); + else + return Request.request(url, { method: method, query: data }) + .then(function(res) { + var json = null; + if (/^application\/json\b/.test(res.headers.get('Content-Type'))) + try { json = res.json() } catch(e) {} + cb(res.xhr, json, res.duration); }); + }, - return Promise.all(tasks); - }, + /** + * Deprecated wrapper around {@link LuCI.poll.remove Poll.remove()}. + * + * @deprecated + * @instance + * @memberof LuCI + * + * @param {function} entry + * The polling function to remove. + * + * @return {boolean} + * Returns `true` when the function has been removed or `false` if + * it could not be found. + */ + stop: function(entry) { return Poll.remove(entry) }, - /** - * The handleSaveApply function is invoked when the user clicks - * the `Save & Apply` button in the page action footer. - * - * The default implementation should be sufficient for most - * views using {@link form#Map form.Map()} based forms - it - * will first invoke - * {@link LuCI.view.handleSave view.handleSave()} and then - * call {@link ui#changes#apply ui.changes.apply()} to start the - * modal config apply and page reload flow. - * - * Views not using `Map` instances or requiring other special - * logic should overwrite `handleSaveApply()` with a custom - * implementation. - * - * To disable the `Save & Apply` page footer button, views - * extending this base class should overwrite the - * `handleSaveApply` function with `null`. - * - * The invocation of this function is wrapped by - * `Promise.resolve()` so it may return Promises if needed. - * - * @instance - * @memberof LuCI.view - * @param {Event} ev - * The DOM event that triggered the function. - * - * @returns {*|Promise<*>} - * Any return values of this function are discarded, but - * passed through `Promise.resolve()` to ensure that any - * returned promise runs to completion before the button - * is reenabled. - */ - handleSaveApply: function(ev, mode) { - return this.handleSave(ev).then(function() { - L.ui.changes.apply(mode == '0'); - }); - }, + /** + * Deprecated wrapper around {@link LuCI.poll.stop Poll.stop()}. + * + * @deprecated + * @instance + * @memberof LuCI + * + * @return {boolean} + * Returns `true` when the polling loop has been stopped or `false` + * when it didn't run to begin with. + */ + halt: function() { return Poll.stop() }, - /** - * The handleReset function is invoked when the user clicks - * the `Reset` button in the page action footer. - * - * The default implementation should be sufficient for most - * views using {@link form#Map form.Map()} based forms - it - * will iterate all forms present in the view and invoke - * the {@link form#Map#save Map.reset()} method on each form. - * - * Views not using `Map` instances or requiring other special - * logic should overwrite `handleReset()` with a custom - * implementation. - * - * To disable the `Reset` page footer button, views extending - * this base class should overwrite the `handleReset` function - * with `null`. - * - * The invocation of this function is wrapped by - * `Promise.resolve()` so it may return Promises if needed. - * - * @instance - * @memberof LuCI.view - * @param {Event} ev - * The DOM event that triggered the function. - * - * @returns {*|Promise<*>} - * Any return values of this function are discarded, but - * passed through `Promise.resolve()` to ensure that any - * returned promise runs to completion before the button - * is reenabled. - */ - handleReset: function(ev) { - var tasks = []; + /** + * Deprecated wrapper around {@link LuCI.poll.start Poll.start()}. + * + * @deprecated + * @instance + * @memberof LuCI + * + * @return {boolean} + * Returns `true` when the polling loop has been started or `false` + * when it was already running. + */ + run: function() { return Poll.start() }, - document.getElementById('maincontent') - .querySelectorAll('.cbi-map').forEach(function(map) { - tasks.push(L.dom.callClassMethod(map, 'reset')); - }); + /** + * Legacy `L.dom` class alias. New view code should use `'require dom';` + * to request the `LuCI.dom` class. + * + * @instance + * @memberof LuCI + * @deprecated + */ + dom: DOM, - return Promise.all(tasks); - }, + /** + * Legacy `L.view` class alias. New view code should use `'require view';` + * to request the `LuCI.view` class. + * + * @instance + * @memberof LuCI + * @deprecated + */ + view: View, - /** - * Renders a standard page action footer if any of the - * `handleSave()`, `handleSaveApply()` or `handleReset()` - * functions are defined. - * - * The default implementation should be sufficient for most - * views - it will render a standard page footer with action - * buttons labeled `Save`, `Save & Apply` and `Reset` - * triggering the `handleSave()`, `handleSaveApply()` and - * `handleReset()` functions respectively. - * - * When any of these `handle*()` functions is overwritten - * with `null` by a view extending this class, the - * corresponding button will not be rendered. - * - * @instance - * @memberof LuCI.view - * @returns {DocumentFragment} - * Returns a `DocumentFragment` containing the footer bar - * with buttons for each corresponding `handle*()` action - * or an empty `DocumentFragment` if all three `handle*()` - * methods are overwritten with `null`. - */ - addFooter: function() { - var footer = E([]); - - var saveApplyBtn = this.handleSaveApply ? new L.ui.ComboButton('0', { - 0: [ _('Save & Apply') ], - 1: [ _('Apply unchecked') ] - }, { - classes: { - 0: 'btn cbi-button cbi-button-apply important', - 1: 'btn cbi-button cbi-button-negative important' - }, - click: L.ui.createHandlerFn(this, 'handleSaveApply') - }).render() : E([]); - - if (this.handleSaveApply || this.handleSave || this.handleReset) { - footer.appendChild(E('div', { 'class': 'cbi-page-actions control-group' }, [ - saveApplyBtn, ' ', - this.handleSave ? E('button', { - 'class': 'cbi-button cbi-button-save', - 'click': L.ui.createHandlerFn(this, 'handleSave') - }, [ _('Save') ]) : '', ' ', - this.handleReset ? E('button', { - 'class': 'cbi-button cbi-button-reset', - 'click': L.ui.createHandlerFn(this, 'handleReset') - }, [ _('Reset') ]) : '' - ])); - } + /** + * Legacy `L.Poll` class alias. New view code should use `'require poll';` + * to request the `LuCI.poll` class. + * + * @instance + * @memberof LuCI + * @deprecated + */ + Poll: Poll, - return footer; - } - }) + /** + * Legacy `L.Request` class alias. New view code should use `'require request';` + * to request the `LuCI.request` class. + * + * @instance + * @memberof LuCI + * @deprecated + */ + Request: Request, + + /** + * Legacy `L.Class` class alias. New view code should use `'require baseclass';` + * to request the `LuCI.baseclass` class. + * + * @instance + * @memberof LuCI + * @deprecated + */ + Class: Class }); /** - * @class + * @class xhr * @memberof LuCI * @deprecated * @classdesc * - * The `LuCI.XHR` class is a legacy compatibility shim for the + * The `LuCI.xhr` class is a legacy compatibility shim for the * functionality formerly provided by `xhr.js`. It is registered as global * `window.XHR` symbol for compatibility with legacy code. * - * New code should use {@link LuCI.Request} instead to implement HTTP + * New code should use {@link LuCI.request} instead to implement HTTP * request handling. */ - var XHR = Class.extend(/** @lends LuCI.XHR.prototype */ { - __name__: 'LuCI.XHR', + var XHR = Class.extend(/** @lends LuCI.xhr.prototype */ { + __name__: 'LuCI.xhr', __init__: function() { if (window.console && console.debug) console.debug('Direct use XHR() is deprecated, please use L.Request instead'); @@ -4735,7 +4799,7 @@ * * @instance * @deprecated - * @memberof LuCI.XHR + * @memberof LuCI.xhr * * @param {string} url * The URL to request @@ -4762,7 +4826,7 @@ * * @instance * @deprecated - * @memberof LuCI.XHR + * @memberof LuCI.xhr * * @param {string} url * The URL to request @@ -4793,7 +4857,7 @@ * * @instance * @deprecated - * @memberof LuCI.XHR + * @memberof LuCI.xhr */ cancel: function() { delete this.active }, @@ -4802,7 +4866,7 @@ * * @instance * @deprecated - * @memberof LuCI.XHR + * @memberof LuCI.xhr * * @returns {boolean} * Returns `true` if the request is still running or `false` if it @@ -4817,7 +4881,7 @@ * * @instance * @deprecated - * @memberof LuCI.XHR + * @memberof LuCI.xhr */ abort: function() {}, @@ -4828,7 +4892,7 @@ * * @instance * @deprecated - * @memberof LuCI.XHR + * @memberof LuCI.xhr * * @throws {InternalError} * Throws an `InternalError` with the message `Not implemented` @@ -4860,7 +4924,7 @@
      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/network.js.html b/docs/jsapi/network.js.html index 07aca9add..51277d671 100644 --- a/docs/jsapi/network.js.html +++ b/docs/jsapi/network.js.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1696,6 +1704,8 @@ 'require uci'; 'require rpc'; 'require validation'; +'require baseclass'; +'require firewall'; var proto_errors = { CONNECT_FAILED: _('Connection attempt failed'), @@ -2326,18 +2336,18 @@ function enumerateNetworks() { var Hosts, Network, Protocol, Device, WifiDevice, WifiNetwork; /** - * @class + * @class network * @memberof LuCI * @hideconstructor * @classdesc * - * The `LuCI.Network` class combines data from multiple `ubus` apis to + * The `LuCI.network` class combines data from multiple `ubus` apis to * provide an abstraction of the current network configuration state. * * It provides methods to enumerate interfaces and devices, to query * current configuration details and to manipulate settings. */ -Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { +Network = baseclass.extend(/** @lends LuCI.network.prototype */ { /** * Converts the given prefix size in bits to a netmask. * @@ -2380,8 +2390,8 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * such as the used key management protocols, active ciphers and * protocol versions. * - * @typedef {Object<string, boolean|Array<number|string>>} LuCI.Network.WifiEncryption - * @memberof LuCI.Network + * @typedef {Object<string, boolean|Array<number|string>>} LuCI.network.WifiEncryption + * @memberof LuCI.network * * @property {boolean} enabled * Specifies whether any kind of encryption, such as `WEP` or `WPA` is @@ -2415,13 +2425,13 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { */ /** - * Converts a given {@link LuCI.Network.WifiEncryption encryption entry} + * Converts a given {@link LuCI.network.WifiEncryption encryption entry} * into a human readable string such as `mixed WPA/WPA2 PSK (TKIP, CCMP)` * or `WPA3 SAE (CCMP)`. * * @method * - * @param {LuCI.Network.WifiEncryption} encryption + * @param {LuCI.network.WifiEncryption} encryption * The wireless encryption entry to convert. * * @returns {null|string} @@ -2443,7 +2453,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { }, /** - * Instantiates the given {@link LuCI.Network.Protocol Protocol} backend, + * Instantiates the given {@link LuCI.network.Protocol Protocol} backend, * optionally using the given network name. * * @param {string} protoname @@ -2455,7 +2465,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * but it is allowed to omit it, e.g. to query protocol capabilities * without the need for an existing interface. * - * @returns {null|LuCI.Network.Protocol} + * @returns {null|LuCI.network.Protocol} * Returns the instantiated protocol backend class or `null` if the given * protocol isn't known. */ @@ -2468,10 +2478,10 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { }, /** - * Obtains instances of all known {@link LuCI.Network.Protocol Protocol} + * Obtains instances of all known {@link LuCI.network.Protocol Protocol} * backend classes. * - * @returns {Array<LuCI.Network.Protocol>} + * @returns {Array<LuCI.network.Protocol>} * Returns an array of protocol class instances. */ getProtocols: function() { @@ -2484,7 +2494,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { }, /** - * Registers a new {@link LuCI.Network.Protocol Protocol} subclass + * Registers a new {@link LuCI.network.Protocol Protocol} subclass * with the given methods and returns the resulting subclass value. * * This functions internally calls @@ -2498,7 +2508,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * The member methods and values of the new `Protocol` subclass to * be passed to {@link LuCI.Class.extend Class.extend()}. * - * @returns {LuCI.Network.Protocol} + * @returns {LuCI.network.Protocol} * Returns the new `Protocol` subclass. */ registerProtocol: function(protoname, methods) { @@ -2587,7 +2597,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * An object of uci option values to set on the new network or to * update in an existing, empty network. * - * @returns {Promise<null|LuCI.Network.Protocol>} + * @returns {Promise<null|LuCI.network.Protocol>} * Returns a promise resolving to the `Protocol` subclass instance * describing the added network or resolving to `null` if the name * was invalid or if a non-empty network of the given name already @@ -2619,15 +2629,15 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { }, /** - * Get a {@link LuCI.Network.Protocol Protocol} instance describing + * Get a {@link LuCI.network.Protocol Protocol} instance describing * the network with the given name. * * @param {string} name * The logical interface name of the network get, e.g. `lan` or `wan`. * - * @returns {Promise<null|LuCI.Network.Protocol>} + * @returns {Promise<null|LuCI.network.Protocol>} * Returns a promise resolving to a - * {@link LuCI.Network.Protocol Protocol} subclass instance describing + * {@link LuCI.network.Protocol Protocol} subclass instance describing * the network or `null` if the network did not exist. */ getNetwork: function(name) { @@ -2650,9 +2660,9 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { /** * Gets an array containing all known networks. * - * @returns {Promise<Array<LuCI.Network.Protocol>>} + * @returns {Promise<Array<LuCI.network.Protocol>>} * Returns a promise resolving to a name-sorted array of - * {@link LuCI.Network.Protocol Protocol} subclass instances + * {@link LuCI.network.Protocol Protocol} subclass instances * describing all known networks. */ getNetworks: function() { @@ -2675,8 +2685,9 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { var requireFirewall = Promise.resolve(L.require('firewall')).catch(function() {}), network = this.instantiateNetwork(name); - return Promise.all([ requireFirewall, initNetworkState() ]).then(function() { - var uciInterface = uci.get('network', name); + return Promise.all([ requireFirewall, initNetworkState() ]).then(function(res) { + var uciInterface = uci.get('network', name), + firewall = res[0]; if (uciInterface != null && uciInterface['.type'] == 'interface') { return Promise.resolve(network ? network.deleteConfiguration() : null).then(function() { @@ -2711,8 +2722,8 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { uci.unset('wireless', s['.name'], 'network'); }); - if (L.firewall) - return L.firewall.deleteNetwork(name).then(function() { return true }); + if (firewall) + return firewall.deleteNetwork(name).then(function() { return true }); return true; }).catch(function() { @@ -2790,13 +2801,13 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { }, /** - * Get a {@link LuCI.Network.Device Device} instance describing the + * Get a {@link LuCI.network.Device Device} instance describing the * given network device. * * @param {string} name * The name of the network device to get, e.g. `eth0` or `br-lan`. * - * @returns {Promise<null|LuCI.Network.Device>} + * @returns {Promise<null|LuCI.network.Device>} * Returns a promise resolving to the `Device` instance describing * the network device or `null` if the given device name could not * be found. @@ -2820,7 +2831,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { /** * Get a sorted list of all found network devices. * - * @returns {Promise<Array<LuCI.Network.Device>>} + * @returns {Promise<Array<LuCI.network.Device>>} * Returns a promise resolving to a sorted array of `Device` class * instances describing the network devices found on the system. */ @@ -2945,14 +2956,14 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { }, /** - * Get a {@link LuCI.Network.WifiDevice WifiDevice} instance describing + * Get a {@link LuCI.network.WifiDevice WifiDevice} instance describing * the given wireless radio. * * @param {string} devname * The configuration name of the wireless radio to lookup, e.g. `radio0` * for the first mac80211 phy on the system. * - * @returns {Promise<null|LuCI.Network.WifiDevice>} + * @returns {Promise<null|LuCI.network.WifiDevice>} * Returns a promise resolving to the `WifiDevice` instance describing * the underlying radio device or `null` if the wireless radio could not * be found. @@ -2971,7 +2982,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { /** * Obtain a list of all configured radio devices. * - * @returns {Promise<Array<LuCI.Network.WifiDevice>>} + * @returns {Promise<Array<LuCI.network.WifiDevice>>} * Returns a promise resolving to an array of `WifiDevice` instances * describing the wireless radios configured in the system. * The order of the array corresponds to the order of the radios in @@ -2992,7 +3003,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { }, /** - * Get a {@link LuCI.Network.WifiNetwork WifiNetwork} instance describing + * Get a {@link LuCI.network.WifiNetwork WifiNetwork} instance describing * the given wireless network. * * @param {string} netname @@ -3001,7 +3012,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * or a Linux network device name like `wlan0` which is resolved to the * corresponding configuration section through `ubus` runtime information. * - * @returns {Promise<null|LuCI.Network.WifiNetwork>} + * @returns {Promise<null|LuCI.network.WifiNetwork>} * Returns a promise resolving to the `WifiNetwork` instance describing * the wireless network or `null` if the corresponding network could not * be found. @@ -3012,10 +3023,10 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { }, /** - * Get an array of all {@link LuCI.Network.WifiNetwork WifiNetwork} + * Get an array of all {@link LuCI.network.WifiNetwork WifiNetwork} * instances describing the wireless networks present on the system. * - * @returns {Promise<Array<LuCI.Network.WifiNetwork>>} + * @returns {Promise<Array<LuCI.network.WifiNetwork>>} * Returns a promise resolving to an array of `WifiNetwork` instances * describing the wireless networks. The array will be empty if no networks * are found. @@ -3045,7 +3056,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * must at least contain a `device` property which is set to the radio * name the new network belongs to. * - * @returns {Promise<null|LuCI.Network.WifiNetwork>} + * @returns {Promise<null|LuCI.network.WifiNetwork>} * Returns a promise resolving to a `WifiNetwork` instance describing * the newly added wireless network or `null` if the given options * were invalid or if the associated radio device could not be found. @@ -3166,7 +3177,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * This function looks up all networks having a default `0.0.0.0/0` route * and returns them as array. * - * @returns {Promise<Array<LuCI.Network.Protocol>>} + * @returns {Promise<Array<LuCI.network.Protocol>>} * Returns a promise resolving to an array of `Protocol` subclass * instances describing the found default route interfaces. */ @@ -3191,7 +3202,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * This function looks up all networks having a default `::/0` route * and returns them as array. * - * @returns {Promise<Array<LuCI.Network.Protocol>>} + * @returns {Promise<Array<LuCI.network.Protocol>>} * Returns a promise resolving to an array of `Protocol` subclass * instances describing the found IPv6 default route interfaces. */ @@ -3215,7 +3226,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * connections and external port labels of a switch. * * @typedef {Object<string, Object|Array>} SwitchTopology - * @memberof LuCI.Network + * @memberof LuCI.network * * @property {Object<number, string>} netdevs * The `netdevs` property points to an object describing the CPU port @@ -3237,11 +3248,11 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { /** * Returns the topologies of all swconfig switches found on the system. * - * @returns {Promise<Object<string, LuCI.Network.SwitchTopology>>} + * @returns {Promise<Object<string, LuCI.network.SwitchTopology>>} * Returns a promise resolving to an object containing the topologies * of each switch. The object keys correspond to the name of the switches * such as `switch0`, the values are - * {@link LuCI.Network.SwitchTopology SwitchTopology} objects describing + * {@link LuCI.network.SwitchTopology SwitchTopology} objects describing * the layout. */ getSwitchTopologies: function() { @@ -3332,7 +3343,7 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { /** * Obtains the the network device name of the given object. * - * @param {LuCI.Network.Protocol|LuCI.Network.Device|LuCI.Network.WifiDevice|LuCI.Network.WifiNetwork|string} obj + * @param {LuCI.network.Protocol|LuCI.network.Device|LuCI.network.WifiDevice|LuCI.network.WifiNetwork|string} obj * The object to get the device name from. * * @returns {null|string} @@ -3361,10 +3372,10 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { * * This function aggregates information from various sources such as * DHCP lease databases, ARP and IPv6 neighbour entries, wireless - * association list etc. and returns a {@link LuCI.Network.Hosts Hosts} + * association list etc. and returns a {@link LuCI.network.Hosts Hosts} * class instance describing the found hosts. * - * @returns {Promise<LuCI.Network.Hosts>} + * @returns {Promise<LuCI.network.Hosts>} * Returns a `Hosts` instance describing host known on the system. */ getHostHints: function() { @@ -3376,15 +3387,15 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { /** * @class - * @memberof LuCI.Network + * @memberof LuCI.network * @hideconstructor * @classdesc * - * The `LuCI.Network.Hosts` class encapsulates host information aggregated + * The `LuCI.network.Hosts` class encapsulates host information aggregated * from multiple sources and provides convenience functions to access the * host information by different criteria. */ -Hosts = L.Class.extend(/** @lends LuCI.Network.Hosts.prototype */ { +Hosts = baseclass.extend(/** @lends LuCI.network.Hosts.prototype */ { __init__: function(hosts) { this.hosts = hosts; }, @@ -3542,7 +3553,7 @@ Hosts = L.Class.extend(/** @lends LuCI.Network.Hosts.prototype */ { /** * @class - * @memberof LuCI.Network + * @memberof LuCI.network * @hideconstructor * @classdesc * @@ -3550,7 +3561,7 @@ Hosts = L.Class.extend(/** @lends LuCI.Network.Hosts.prototype */ { * subclasses which describe logical UCI networks defined by `config * interface` sections in `/etc/config/network`. */ -Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { +Protocol = baseclass.extend(/** @lends LuCI.network.Protocol.prototype */ { __init__: function(name) { this.sid = name; }, @@ -3627,7 +3638,7 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { * Get the name of this network protocol class. * * This function will be overwritten by subclasses created by - * {@link LuCI.Network#registerProtocol Network.registerProtocol()}. + * {@link LuCI.network#registerProtocol Network.registerProtocol()}. * * @abstract * @returns {string} @@ -3661,7 +3672,7 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { * Get the type of the underlying interface. * * This function actually is a convenience wrapper around - * `proto.get("type")` and is mainly used by other `LuCI.Network` code + * `proto.get("type")` and is mainly used by other `LuCI.network` code * to check whether the interface is declared as bridge in UCI. * * @returns {null|string} @@ -3945,7 +3956,7 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { * * This function will translate the found error codes to human readable * messages using the descriptions registered by - * {@link LuCI.Network#registerErrorCode Network.registerErrorCode()} + * {@link LuCI.network#registerErrorCode Network.registerErrorCode()} * and fall back to `"Unknown error (%s)"` where `%s` is replaced by the * error code in case no translation can be found. * @@ -3996,23 +4007,6 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { return null; }, - /** - * Check function for the protocol handler if a new interface is createable. - * - * This function should be overwritten by protocol specific subclasses. - * - * @abstract - * - * @param {string} ifname - * The name of the interface to be created. - * - * @returns {Promise<null|string>} - * Returns `null` if new interface is createable, else returns (error) message. - */ - isCreateable: function(ifname) { - return Promise.resolve(null); - }, - /** * Checks whether the protocol functionality is installed. * @@ -4146,10 +4140,10 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { /** * Add the given network device to the logical interface. * - * @param {LuCI.Network.Protocol|LuCI.Network.Device|LuCI.Network.WifiDevice|LuCI.Network.WifiNetwork|string} device + * @param {LuCI.network.Protocol|LuCI.network.Device|LuCI.network.WifiDevice|LuCI.network.WifiNetwork|string} device * The object or device name to add to the logical interface. In case the * given argument is not a string, it is resolved though the - * {@link LuCI.Network#getIfnameOf Network.getIfnameOf()} function. + * {@link LuCI.network#getIfnameOf Network.getIfnameOf()} function. * * @returns {boolean} * Returns `true` if the device name has been added or `false` if any @@ -4173,10 +4167,10 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { /** * Remove the given network device from the logical interface. * - * @param {LuCI.Network.Protocol|LuCI.Network.Device|LuCI.Network.WifiDevice|LuCI.Network.WifiNetwork|string} device + * @param {LuCI.network.Protocol|LuCI.network.Device|LuCI.network.WifiDevice|LuCI.network.WifiNetwork|string} device * The object or device name to remove from the logical interface. In case * the given argument is not a string, it is resolved though the - * {@link LuCI.Network#getIfnameOf Network.getIfnameOf()} function. + * {@link LuCI.network#getIfnameOf Network.getIfnameOf()} function. * * @returns {boolean} * Returns `true` if the device name has been added or `false` if any @@ -4206,7 +4200,7 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { * Returns the Linux network device associated with this logical * interface. * - * @returns {LuCI.Network.Device} + * @returns {LuCI.network.Device} * Returns a `Network.Device` class instance representing the * expected Linux network device according to the configuration. */ @@ -4214,7 +4208,7 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { if (this.isVirtual()) { var ifname = '%s-%s'.format(this.getProtocol(), this.sid); _state.isTunnel[this.getProtocol() + '-' + this.sid] = true; - return L.network.instantiateDevice(ifname, this); + return Network.prototype.instantiateDevice(ifname, this); } else if (this.isBridge()) { var ifname = 'br-%s'.format(this.sid); @@ -4226,12 +4220,12 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { for (var i = 0; i < ifnames.length; i++) { var m = ifnames[i].match(/^([^:/]+)/); - return ((m && m[1]) ? L.network.instantiateDevice(m[1], this) : null); + return ((m && m[1]) ? Network.prototype.instantiateDevice(m[1], this) : null); } ifname = getWifiNetidByNetname(this.sid); - return (ifname != null ? L.network.instantiateDevice(ifname[0], this) : null); + return (ifname != null ? Network.prototype.instantiateDevice(ifname[0], this) : null); } }, @@ -4239,33 +4233,33 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { * Returns the layer 2 linux network device currently associated * with this logical interface. * - * @returns {LuCI.Network.Device} + * @returns {LuCI.network.Device} * Returns a `Network.Device` class instance representing the Linux * network device currently associated with the logical interface. */ getL2Device: function() { var ifname = this._ubus('device'); - return (ifname != null ? L.network.instantiateDevice(ifname, this) : null); + return (ifname != null ? Network.prototype.instantiateDevice(ifname, this) : null); }, /** * Returns the layer 3 linux network device currently associated * with this logical interface. * - * @returns {LuCI.Network.Device} + * @returns {LuCI.network.Device} * Returns a `Network.Device` class instance representing the Linux * network device currently associated with the logical interface. */ getL3Device: function() { var ifname = this._ubus('l3_device'); - return (ifname != null ? L.network.instantiateDevice(ifname, this) : null); + return (ifname != null ? Network.prototype.instantiateDevice(ifname, this) : null); }, /** * Returns a list of network sub-devices associated with this logical * interface. * - * @returns {null|Array<LuCI.Network.Device>} + * @returns {null|Array<LuCI.network.Device>} * Returns an array of of `Network.Device` class instances representing * the sub-devices attached to this logical interface or `null` if the * logical interface does not support sub-devices, e.g. because it is @@ -4285,7 +4279,7 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { var m = ifnames[i].match(/^([^:/]+)/); if (m != null) - rv.push(L.network.instantiateDevice(m[1], this)); + rv.push(Network.prototype.instantiateDevice(m[1], this)); } var uciWifiIfaces = uci.sections('wireless', 'wifi-iface'); @@ -4303,7 +4297,7 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { var netid = getWifiNetidBySid(uciWifiIfaces[i]['.name']); if (netid != null) - rv.push(L.network.instantiateDevice(netid[0], this)); + rv.push(Network.prototype.instantiateDevice(netid[0], this)); } } @@ -4316,10 +4310,10 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { * Checks whether this logical interface contains the given device * object. * - * @param {LuCI.Network.Protocol|LuCI.Network.Device|LuCI.Network.WifiDevice|LuCI.Network.WifiNetwork|string} device + * @param {LuCI.network.Protocol|LuCI.network.Device|LuCI.network.WifiDevice|LuCI.network.WifiNetwork|string} device * The object or device name to check. In case the given argument is not * a string, it is resolved though the - * {@link LuCI.Network#getIfnameOf Network.getIfnameOf()} function. + * {@link LuCI.network#getIfnameOf Network.getIfnameOf()} function. * * @returns {boolean} * Returns `true` when this logical interface contains the given network @@ -4378,14 +4372,14 @@ Protocol = L.Class.extend(/** @lends LuCI.Network.Protocol.prototype */ { /** * @class - * @memberof LuCI.Network + * @memberof LuCI.network * @hideconstructor * @classdesc * * A `Network.Device` class instance represents an underlying Linux network * device and allows querying device details such as packet statistics or MTU. */ -Device = L.Class.extend(/** @lends LuCI.Network.Device.prototype */ { +Device = baseclass.extend(/** @lends LuCI.network.Device.prototype */ { __init__: function(ifname, network) { var wif = getWifiSidByIfname(ifname); @@ -4565,7 +4559,7 @@ Device = L.Class.extend(/** @lends LuCI.Network.Device.prototype */ { /** * Get the associated bridge ports of the device. * - * @returns {null|Array<LuCI.Network.Device>} + * @returns {null|Array<LuCI.network.Device>} * Returns an array of `Network.Device` instances representing the ports * (slave interfaces) of the bridge or `null` when this device isn't * a Linux bridge. @@ -4578,7 +4572,7 @@ Device = L.Class.extend(/** @lends LuCI.Network.Device.prototype */ { return null; for (var i = 0; i < br.ifnames.length; i++) - rv.push(L.network.instantiateDevice(br.ifnames[i].name)); + rv.push(Network.prototype.instantiateDevice(br.ifnames[i].name)); rv.sort(deviceSort); @@ -4694,7 +4688,7 @@ Device = L.Class.extend(/** @lends LuCI.Network.Device.prototype */ { /** * Get the primary logical interface this device is assigned to. * - * @returns {null|LuCI.Network.Protocol} + * @returns {null|LuCI.network.Protocol} * Returns a `Network.Protocol` instance representing the logical * interface this device is attached to or `null` if it is not * assigned to any logical interface. @@ -4706,7 +4700,7 @@ Device = L.Class.extend(/** @lends LuCI.Network.Device.prototype */ { /** * Get the logical interfaces this device is assigned to. * - * @returns {Array<LuCI.Network.Protocol>} + * @returns {Array<LuCI.network.Protocol>} * Returns an array of `Network.Protocol` instances representing the * logical interfaces this device is assigned to. */ @@ -4729,7 +4723,7 @@ Device = L.Class.extend(/** @lends LuCI.Network.Device.prototype */ { /** * Get the related wireless network this device is related to. * - * @returns {null|LuCI.Network.WifiNetwork} + * @returns {null|LuCI.network.WifiNetwork} * Returns a `Network.WifiNetwork` instance representing the wireless * network corresponding to this network device or `null` if this device * is not a wireless device. @@ -4741,7 +4735,7 @@ Device = L.Class.extend(/** @lends LuCI.Network.Device.prototype */ { /** * @class - * @memberof LuCI.Network + * @memberof LuCI.network * @hideconstructor * @classdesc * @@ -4749,7 +4743,7 @@ Device = L.Class.extend(/** @lends LuCI.Network.Device.prototype */ { * present on the system and provides wireless capability information as * well as methods for enumerating related wireless networks. */ -WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { +WifiDevice = baseclass.extend(/** @lends LuCI.network.WifiDevice.prototype */ { __init__: function(name, radiostate) { var uciWifiDevice = uci.get('wireless', name); @@ -4901,8 +4895,8 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { * A wireless scan result object describes a neighbouring wireless * network found in the vincinity. * - * @typedef {Object<string, number|string|LuCI.Network.WifiEncryption>} WifiScanResult - * @memberof LuCI.Network + * @typedef {Object<string, number|string|LuCI.network.WifiEncryption>} WifiScanResult + * @memberof LuCI.network * * @property {string} ssid * The SSID / Mesh ID of the network. @@ -4927,7 +4921,7 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { * The maximum possible quality level of the signal, can be used in * conjunction with `quality` to calculate a quality percentage. * - * @property {LuCI.Network.WifiEncryption} encryption + * @property {LuCI.network.WifiEncryption} encryption * The encryption used by the wireless network. */ @@ -4935,7 +4929,7 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { * Trigger a wireless scan on this radio device and obtain a list of * nearby networks. * - * @returns {Promise<Array<LuCI.Network.WifiScanResult>>} + * @returns {Promise<Array<LuCI.network.WifiScanResult>>} * Returns a promise resolving to an array of scan result objects * describing the networks found in the vincinity. */ @@ -4966,14 +4960,14 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { * or a Linux network device name like `wlan0` which is resolved to the * corresponding configuration section through `ubus` runtime information. * - * @returns {Promise<LuCI.Network.WifiNetwork>} + * @returns {Promise<LuCI.network.WifiNetwork>} * Returns a promise resolving to a `Network.WifiNetwork` instance * representing the wireless network and rejecting with `null` if * the given network could not be found or is not associated with * this radio device. */ getWifiNetwork: function(network) { - return L.network.getWifiNetwork(network).then(L.bind(function(networkInstance) { + return Network.prototype.getWifiNetwork(network).then(L.bind(function(networkInstance) { var uciWifiIface = (networkInstance.sid ? uci.get('wireless', networkInstance.sid) : null); if (uciWifiIface == null || uciWifiIface['.type'] != 'wifi-iface' || uciWifiIface.device != this.sid) @@ -4986,13 +4980,13 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { /** * Get all wireless networks associated with this wireless radio device. * - * @returns {Promise<Array<LuCI.Network.WifiNetwork>>} + * @returns {Promise<Array<LuCI.network.WifiNetwork>>} * Returns a promise resolving to an array of `Network.WifiNetwork` * instances respresenting the wireless networks associated with this * radio device. */ getWifiNetworks: function() { - return L.network.getWifiNetworks().then(L.bind(function(networks) { + return Network.prototype.getWifiNetworks().then(L.bind(function(networks) { var rv = []; for (var i = 0; i < networks.length; i++) @@ -5010,7 +5004,7 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { * @param {Object<string, string|string[]>} [options] * The options to set for the newly added wireless network. * - * @returns {Promise<null|LuCI.Network.WifiNetwork>} + * @returns {Promise<null|LuCI.network.WifiNetwork>} * Returns a promise resolving to a `WifiNetwork` instance describing * the newly added wireless network or `null` if the given options * were invalid. @@ -5021,7 +5015,7 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { options.device = this.sid; - return L.network.addWifiNetwork(options); + return Network.prototype.addWifiNetwork(options); }, /** @@ -5064,7 +5058,7 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { /** * @class - * @memberof LuCI.Network + * @memberof LuCI.network * @hideconstructor * @classdesc * @@ -5073,7 +5067,7 @@ WifiDevice = L.Class.extend(/** @lends LuCI.Network.WifiDevice.prototype */ { * the runtime state of the network. Most radio devices support multiple * such networks in parallel. */ -WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { +WifiNetwork = baseclass.extend(/** @lends LuCI.network.WifiNetwork.prototype */ { __init__: function(sid, radioname, radiostate, netid, netstate, hostapd) { this.sid = sid; this.netid = netid; @@ -5256,7 +5250,7 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { /** * Get the corresponding wifi radio device. * - * @returns {null|LuCI.Network.WifiDevice} + * @returns {null|LuCI.network.WifiDevice} * Returns a `Network.WifiDevice` instance representing the corresponding * wifi radio device or `null` if the related radio device could not be * found. @@ -5267,7 +5261,7 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { if (radioname == null) return Promise.reject(); - return L.network.getWifiDevice(radioname); + return Network.prototype.getWifiDevice(radioname); }, /** @@ -5379,8 +5373,8 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { * A wireless peer entry describes the properties of a remote wireless * peer associated with a local network. * - * @typedef {Object<string, boolean|number|string|LuCI.Network.WifiRateEntry>} WifiPeerEntry - * @memberof LuCI.Network + * @typedef {Object<string, boolean|number|string|LuCI.network.WifiRateEntry>} WifiPeerEntry + * @memberof LuCI.network * * @property {string} mac * The MAC address (BSSID). @@ -5478,10 +5472,10 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { * - `DEEP SLEEP` * - `UNKNOWN` * - * @property {LuCI.Network.WifiRateEntry} rx + * @property {LuCI.network.WifiRateEntry} rx * Describes the receiving wireless rate from the peer. * - * @property {LuCI.Network.WifiRateEntry} tx + * @property {LuCI.network.WifiRateEntry} tx * Describes the transmitting wireless rate to the peer. */ @@ -5490,7 +5484,7 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { * transmission rate to or from a peer. * * @typedef {Object<string, boolean|number>} WifiRateEntry - * @memberof LuCI.Network + * @memberof LuCI.network * * @property {number} [drop_misc] * The amount of received misc. packages that have been dropped, e.g. @@ -5547,7 +5541,7 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { /** * Fetch the list of associated peers. * - * @returns {Promise<Array<LuCI.Network.WifiPeerEntry>>} + * @returns {Promise<Array<LuCI.network.WifiPeerEntry>>} * Returns a promise resolving to an array of wireless peers associated * with this network. */ @@ -5735,7 +5729,7 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { /** * Get the primary logical interface this wireless network is attached to. * - * @returns {null|LuCI.Network.Protocol} + * @returns {null|LuCI.network.Protocol} * Returns a `Network.Protocol` instance representing the logical * interface or `null` if this network is not attached to any logical * interface. @@ -5747,7 +5741,7 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { /** * Get the logical interfaces this wireless network is attached to. * - * @returns {Array<LuCI.Network.Protocol>} + * @returns {Array<LuCI.network.Protocol>} * Returns an array of `Network.Protocol` instances representing the * logical interfaces this wireless network is attached to. */ @@ -5761,7 +5755,7 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { if (uciInterface == null || uciInterface['.type'] != 'interface') continue; - networks.push(L.network.instantiateNetwork(networkNames[i])); + networks.push(Network.prototype.instantiateNetwork(networkNames[i])); } networks.sort(networkSort); @@ -5772,12 +5766,12 @@ WifiNetwork = L.Class.extend(/** @lends LuCI.Network.WifiNetwork.prototype */ { /** * Get the associated Linux network device. * - * @returns {LuCI.Network.Device} + * @returns {LuCI.network.Device} * Returns a `Network.Device` instance representing the Linux network * device associted with this wireless network. */ getDevice: function() { - return L.network.instantiateDevice(this.getIfname()); + return Network.prototype.instantiateDevice(this.getIfname()); }, /** @@ -5844,7 +5838,7 @@ return Network;
      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/rpc.js.html b/docs/jsapi/rpc.js.html index 983f091fb..48e5a95e9 100644 --- a/docs/jsapi/rpc.js.html +++ b/docs/jsapi/rpc.js.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1693,6 +1701,8 @@
      'use strict';
      +'require baseclass';
      +'require request';
       
       var rpcRequestID = 1,
           rpcSessionID = L.env.sessionid || '00000000000000000000000000000000',
      @@ -1708,7 +1718,7 @@ var rpcRequestID = 1,
        * The `LuCI.rpc` class provides high level ubus JSON-RPC abstractions
        * and means for listing and invoking remove RPC methods.
        */
      -return L.Class.extend(/** @lends LuCI.rpc.prototype */ {
      +return baseclass.extend(/** @lends LuCI.rpc.prototype */ {
       	/* privates */
       	call: function(req, cb, nobatch) {
       		var q = '';
      @@ -1729,7 +1739,7 @@ return L.Class.extend(/** @lends LuCI.rpc.prototype */ {
       			q += '/%s.%s'.format(req.params[1], req.params[2]);
       		}
       
      -		return L.Request.post(rpcBaseURL + q, req, {
      +		return request.post(rpcBaseURL + q, req, {
       			timeout: (L.env.rpctimeout || 20) * 1000,
       			nobatch: nobatch,
       			credentials: true
      @@ -2181,7 +2191,7 @@ return L.Class.extend(/** @lends LuCI.rpc.prototype */ {
               
       
               
      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/uci.js.html b/docs/jsapi/uci.js.html index 1f320f98a..fe3fd48b9 100644 --- a/docs/jsapi/uci.js.html +++ b/docs/jsapi/uci.js.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1694,6 +1702,7 @@
      'use strict';
       'require rpc';
      +'require baseclass';
       
       /**
        * @class uci
      @@ -1706,7 +1715,7 @@
        * manipulation layer on top to allow for synchroneous operations on
        * UCI configuration data.
        */
      -return L.Class.extend(/** @lends LuCI.uci.prototype */ {
      +return baseclass.extend(/** @lends LuCI.uci.prototype */ {
       	__init__: function() {
       		this.state = {
       			newidx:  0,
      @@ -2647,7 +2656,7 @@ return L.Class.extend(/** @lends LuCI.uci.prototype */ {
               
       
               
      - Documentation generated by JSDoc 3.6.3 on Tue Mar 31 2020 21:30:33 GMT+0200 (Central European Summer Time) + Documentation generated by JSDoc 3.6.3 on Thu Apr 02 2020 21:30:57 GMT+0200 (Central European Summer Time)
      diff --git a/docs/jsapi/ui.js.html b/docs/jsapi/ui.js.html index 96b3006f0..015a955a2 100644 --- a/docs/jsapi/ui.js.html +++ b/docs/jsapi/ui.js.html @@ -43,8 +43,18 @@ Members +
    • Class
    • + +
    • dom
    • +
    • env
    • +
    • Poll
    • + +
    • Request
    • + +
    • view
    • +
      @@ -106,9 +116,9 @@
  • -
  • +
  • - LuCI.Class + LuCI.baseclass
      @@ -246,9 +256,9 @@
  • -
  • +
  • - LuCI.Headers + LuCI.headers
      @@ -274,9 +284,9 @@
  • -
  • +
  • - LuCI.Network + LuCI.network
      @@ -368,9 +378,9 @@
  • -
  • +
  • - LuCI.Network.Device + LuCI.network.Device
      @@ -436,9 +446,9 @@
  • -
  • +
  • - LuCI.Network.Hosts + LuCI.network.Hosts
      @@ -476,9 +486,9 @@
  • -
  • +
  • - LuCI.Network.Protocol + LuCI.network.Protocol
      @@ -580,9 +588,9 @@
  • -
  • +
  • - LuCI.Network.WifiDevice + LuCI.network.WifiDevice
      @@ -630,9 +638,9 @@
  • -
  • +
  • - LuCI.Network.WifiNetwork + LuCI.network.WifiNetwork
      @@ -728,9 +736,9 @@
  • -
  • +
  • - LuCI.Poll + LuCI.poll
      @@ -762,9 +770,9 @@
  • -
  • +
  • - LuCI.Request + LuCI.request
      @@ -804,9 +812,9 @@
  • -
  • +
  • - LuCI.Request.poll + LuCI.request.poll
      @@ -842,26 +850,26 @@
  • -
  • +
  • - LuCI.Response + LuCI.response
      @@ -1646,9 +1654,9 @@
  • -
  • +
  • - LuCI.XHR + LuCI.xhr
      @@ -1693,9 +1701,13 @@
      'use strict';
      +'require validation';
      +'require baseclass';
      +'require request';
      +'require poll';
      +'require dom';
       'require rpc';
       'require uci';
      -'require validation';
       'require fs';
       
       var modalDiv = null,
      @@ -1723,7 +1735,7 @@ var modalDiv = null,
        * it in external JavaScript, use `L.require("ui").then(...)` and access the
        * `AbstractElement` property of the class instance value.
        */
      -var UIElement = L.Class.extend(/** @lends LuCI.ui.AbstractElement.prototype */ {
      +var UIElement = baseclass.extend(/** @lends LuCI.ui.AbstractElement.prototype */ {
       	/**
       	 * @typedef {Object} InitOptions
       	 * @memberof LuCI.ui.AbstractElement
      @@ -1742,7 +1754,7 @@ var UIElement = L.Class.extend(/** @lends LuCI.ui.AbstractElement.prototype */ {
       	 * @property {string} [datatype=string]
       	 * An expression describing the input data validation constraints.
       	 * It defaults to `string` which will allow any value.
      -	 * See{@link LuCI.validation} for details on the expression format.
      +	 * See {@link LuCI.validation} for details on the expression format.
       	 *
       	 * @property {function} [validator]
       	 * Specifies a custom validator function which is invoked after the
      @@ -1763,7 +1775,7 @@ var UIElement = L.Class.extend(/** @lends LuCI.ui.AbstractElement.prototype */ {
       	 * an array of strings or `null` for unset values.
       	 */
       	getValue: function() {
      -		if (L.dom.matches(this.node, 'select') || L.dom.matches(this.node, 'input'))
      +		if (dom.matches(this.node, 'select') || dom.matches(this.node, 'input'))
       			return this.node.value;
       
       		return null;
      @@ -1781,7 +1793,7 @@ var UIElement = L.Class.extend(/** @lends LuCI.ui.AbstractElement.prototype */ {
       	 * or `null` values.
       	 */
       	setValue: function(value) {
      -		if (L.dom.matches(this.node, 'select') || L.dom.matches(this.node, 'input'))
      +		if (dom.matches(this.node, 'select') || dom.matches(this.node, 'input'))
       			this.node.value = value;
       	},
       
      @@ -1879,7 +1891,7 @@ var UIElement = L.Class.extend(/** @lends LuCI.ui.AbstractElement.prototype */ {
       		if (!datatype && !validate)
       			return;
       
      -		this.vfunc = L.ui.addValidator.apply(L.ui, [
      +		this.vfunc = UI.prototype.addValidator.apply(UI.prototype, [
       			targetNode, datatype || 'string',
       			optional, validate
       		].concat(events));
      @@ -2041,7 +2053,7 @@ var UITextfield = UIElement.extend(/** @lends LuCI.ui.Textfield.prototype */ {
       		this.setUpdateEvents(inputEl, 'keyup', 'blur');
       		this.setChangeEvents(inputEl, 'change');
       
      -		L.dom.bindClassInstance(frameEl, this);
      +		dom.bindClassInstance(frameEl, this);
       
       		return frameEl;
       	},
      @@ -2157,7 +2169,7 @@ var UITextarea = UIElement.extend(/** @lends LuCI.ui.Textarea.prototype */ {
       		this.setUpdateEvents(inputEl, 'keyup', 'blur');
       		this.setChangeEvents(inputEl, 'change');
       
      -		L.dom.bindClassInstance(frameEl, this);
      +		dom.bindClassInstance(frameEl, this);
       
       		return frameEl;
       	},
      @@ -2262,7 +2274,7 @@ var UICheckbox = UIElement.extend(/** @lends LuCI.ui.Checkbox.prototype */ {
       		this.setUpdateEvents(frameEl.lastElementChild.previousElementSibling, 'click', 'blur');
       		this.setChangeEvents(frameEl.lastElementChild.previousElementSibling, 'change');
       
      -		L.dom.bindClassInstance(frameEl, this);
      +		dom.bindClassInstance(frameEl, this);
       
       		return frameEl;
       	},
      @@ -2457,7 +2469,7 @@ var UISelect = UIElement.extend(/** @lends LuCI.ui.Select.prototype */ {
       			}
       		}
       
      -		L.dom.bindClassInstance(frameEl, this);
      +		dom.bindClassInstance(frameEl, this);
       
       		return frameEl;
       	},
      @@ -2670,7 +2682,7 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ {
       		for (var i = 0; i < keys.length; i++) {
       			var label = this.choices[keys[i]];
       
      -			if (L.dom.elem(label))
      +			if (dom.elem(label))
       				label = label.cloneNode(true);
       
       			sb.lastElementChild.appendChild(E('li', {
      @@ -2689,8 +2701,8 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ {
       			});
       
       			if (this.options.datatype || this.options.validate)
      -				L.ui.addValidator(createEl, this.options.datatype || 'string',
      -				                  true, this.options.validate, 'blur', 'keyup');
      +				UI.prototype.addValidator(createEl, this.options.datatype || 'string',
      +				                          true, this.options.validate, 'blur', 'keyup');
       
       			sb.lastElementChild.appendChild(E('li', { 'data-value': '-' }, createEl));
       		}
      @@ -2773,7 +2785,7 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ {
       		else
       			sb.removeAttribute('empty');
       
      -		L.dom.content(more, (ndisplay == this.options.display_items)
      +		dom.content(more, (ndisplay == this.options.display_items)
       			? (this.options.select_placeholder || this.options.placeholder) : '···');
       
       
      @@ -2812,7 +2824,7 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ {
       		this.setUpdateEvents(sb, 'cbi-dropdown-open', 'cbi-dropdown-close');
       		this.setChangeEvents(sb, 'cbi-dropdown-change', 'cbi-dropdown-close');
       
      -		L.dom.bindClassInstance(sb, this);
      +		dom.bindClassInstance(sb, this);
       
       		return sb;
       	},
      @@ -3037,7 +3049,7 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ {
       			else
       				sb.removeAttribute('empty');
       
      -			L.dom.content(more, (ndisplay === this.options.display_items)
      +			dom.content(more, (ndisplay === this.options.display_items)
       				? (this.options.select_placeholder || this.options.placeholder) : '···');
       		}
       		else {
      @@ -3711,7 +3723,7 @@ var UIComboButton = UIDropdown.extend(/** @lends LuCI.ui.ComboButton.prototype *
       		var sb = ev.currentTarget,
       		    t = ev.target;
       
      -		if (sb.hasAttribute('open') || L.dom.matches(t, '.cbi-dropdown > span.open'))
      +		if (sb.hasAttribute('open') || dom.matches(t, '.cbi-dropdown > span.open'))
       			return UIDropdown.prototype.handleClick.apply(this, arguments);
       
       		if (this.options.click)
      @@ -3827,14 +3839,14 @@ var UIDynamicList = UIElement.extend(/** @lends LuCI.ui.DynamicList.prototype */
       			dl.lastElementChild.appendChild(E('div', { 'class': 'btn cbi-button cbi-button-add' }, '+'));
       
       			if (this.options.datatype || this.options.validate)
      -				L.ui.addValidator(inputEl, this.options.datatype || 'string',
      -				                  true, this.options.validate, 'blur', 'keyup');
      +				UI.prototype.addValidator(inputEl, this.options.datatype || 'string',
      +				                          true, this.options.validate, 'blur', 'keyup');
       		}
       
       		for (var i = 0; i < this.values.length; i++) {
       			var label = this.choices ? this.choices[this.values[i]] : null;
       
      -			if (L.dom.elem(label))
      +			if (dom.elem(label))
       				label = label.cloneNode(true);
       
       			this.addItem(dl, this.values[i], label);
      @@ -3854,7 +3866,7 @@ var UIDynamicList = UIElement.extend(/** @lends LuCI.ui.DynamicList.prototype */
       		this.setUpdateEvents(dl, 'cbi-dynlist-change');
       		this.setChangeEvents(dl, 'cbi-dynlist-change');
       
      -		L.dom.bindClassInstance(dl, this);
      +		dom.bindClassInstance(dl, this);
       
       		return dl;
       	},
      @@ -4066,7 +4078,7 @@ var UIDynamicList = UIElement.extend(/** @lends LuCI.ui.DynamicList.prototype */
       	 */
       	addChoices: function(values, labels) {
       		var dl = this.node.lastElementChild.firstElementChild;
      -		L.dom.callClassMethod(dl, 'addChoices', values, labels);
      +		dom.callClassMethod(dl, 'addChoices', values, labels);
       	},
       
       	/**
      @@ -4079,7 +4091,7 @@ var UIDynamicList = UIElement.extend(/** @lends LuCI.ui.DynamicList.prototype */
       	 */
       	clearChoices: function() {
       		var dl = this.node.lastElementChild.firstElementChild;
      -		L.dom.callClassMethod(dl, 'clearChoices');
      +		dom.callClassMethod(dl, 'clearChoices');
       	}
       });
       
      @@ -4133,7 +4145,7 @@ var UIHiddenfield = UIElement.extend(/** @lends LuCI.ui.Hiddenfield.prototype */
       	bind: function(hiddenEl) {
       		this.node = hiddenEl;
       
      -		L.dom.bindClassInstance(hiddenEl, this);
      +		dom.bindClassInstance(hiddenEl, this);
       
       		return hiddenEl;
       	},
      @@ -4229,7 +4241,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       		this.setUpdateEvents(browserEl, 'cbi-fileupload-select', 'cbi-fileupload-cancel');
       		this.setChangeEvents(browserEl, 'cbi-fileupload-select', 'cbi-fileupload-cancel');
       
      -		L.dom.bindClassInstance(browserEl, this);
      +		dom.bindClassInstance(browserEl, this);
       
       		return browserEl;
       	},
      @@ -4252,7 +4264,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       			return this.bind(E('div', { 'id': this.options.id }, [
       				E('button', {
       					'class': 'btn',
      -					'click': L.ui.createHandlerFn(this, 'handleFileBrowser')
      +					'click': UI.prototype.createHandlerFn(this, 'handleFileBrowser')
       				}, label),
       				E('div', {
       					'class': 'cbi-filebrowser'
      @@ -4351,7 +4363,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       		data.append('filename', path + '/' + filename);
       		data.append('filedata', fileinput.files[0]);
       
      -		return L.Request.post(L.env.cgi_base + '/cgi-upload', data, {
      +		return request.post(L.env.cgi_base + '/cgi-upload', data, {
       			progress: L.bind(function(btn, ev) {
       				btn.firstChild.data = '%.2f%%'.format((ev.loaded / ev.total) * 100);
       			}, this, ev.target)
      @@ -4383,7 +4395,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       			    hidden = this.node.lastElementChild;
       
       			if (path == hidden.value) {
      -				L.dom.content(button, _('Select file…'));
      +				dom.content(button, _('Select file…'));
       				hidden.value = '';
       			}
       
      @@ -4435,7 +4447,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       				E('div', {}, E('input', { 'type': 'text', 'placeholder': _('Filename') })),
       				E('button', {
       					'class': 'btn cbi-button-save',
      -					'click': L.ui.createHandlerFn(this, 'handleUpload', path, list),
      +					'click': UI.prototype.createHandlerFn(this, 'handleUpload', path, list),
       					'disabled': true
       				}, [ _('Upload file') ])
       			])
      @@ -4472,7 +4484,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       					E('a', {
       						'href': '#',
       						'style': selected ? 'font-weight:bold' : null,
      -						'click': L.ui.createHandlerFn(this, 'handleSelect',
      +						'click': UI.prototype.createHandlerFn(this, 'handleSelect',
       							entrypath, list[i].type != 'directory' ? list[i] : null)
       					}, '%h'.format(list[i].name))
       				]),
      @@ -4488,11 +4500,11 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       				E('div', [
       					selected ? E('button', {
       						'class': 'btn',
      -						'click': L.ui.createHandlerFn(this, 'handleReset')
      +						'click': UI.prototype.createHandlerFn(this, 'handleReset')
       					}, [ _('Deselect') ]) : '',
       					this.options.enable_remove ? E('button', {
       						'class': 'btn cbi-button-negative',
      -						'click': L.ui.createHandlerFn(this, 'handleDelete', entrypath, list[i])
      +						'click': UI.prototype.createHandlerFn(this, 'handleDelete', entrypath, list[i])
       					}, [ _('Delete') ]) : ''
       				])
       			]));
      @@ -4506,16 +4518,16 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       
       		for (var i = 0; i < dirs.length; i++) {
       			cur = cur ? cur + '/' + dirs[i] : dirs[i];
      -			L.dom.append(breadcrumb, [
      +			dom.append(breadcrumb, [
       				i ? ' » ' : '',
       				E('a', {
       					'href': '#',
      -					'click': L.ui.createHandlerFn(this, 'handleSelect', cur || '/', null)
      +					'click': UI.prototype.createHandlerFn(this, 'handleSelect', cur || '/', null)
       				}, dirs[i] != '' ? '%h'.format(dirs[i]) : E('em', '(root)')),
       			]);
       		}
       
      -		L.dom.content(container, [
      +		dom.content(container, [
       			breadcrumb,
       			rows,
       			E('div', { 'class': 'right' }, [
      @@ -4523,7 +4535,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       				E('a', {
       					'href': '#',
       					'class': 'btn',
      -					'click': L.ui.createHandlerFn(this, 'handleCancel')
      +					'click': UI.prototype.createHandlerFn(this, 'handleCancel')
       				}, _('Cancel'))
       			]),
       		]);
      @@ -4548,18 +4560,18 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       		    hidden = this.node.lastElementChild;
       
       		hidden.value = '';
      -		L.dom.content(button, _('Select file…'));
      +		dom.content(button, _('Select file…'));
       
       		this.handleCancel(ev);
       	},
       
       	/** @private */
       	handleSelect: function(path, fileStat, ev) {
      -		var browser = L.dom.parent(ev.target, '.cbi-filebrowser'),
      +		var browser = dom.parent(ev.target, '.cbi-filebrowser'),
       		    ul = browser.querySelector('ul');
       
       		if (fileStat == null) {
      -			L.dom.content(ul, E('em', { 'class': 'spinning' }, _('Loading directory contents…')));
      +			dom.content(ul, E('em', { 'class': 'spinning' }, _('Loading directory contents…')));
       			L.resolveDefault(fs.list(path), []).then(L.bind(this.renderListing, this, browser, path));
       		}
       		else {
      @@ -4568,7 +4580,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       
       			path = this.canonicalizePath(path);
       
      -			L.dom.content(button, [
      +			dom.content(button, [
       				this.iconForType(fileStat.type),
       				' %s (%1000mB)'.format(this.truncatePath(path), fileStat.size)
       			]);
      @@ -4595,7 +4607,7 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
       
       		return L.resolveDefault(fs.list(path), []).then(L.bind(function(button, browser, path, list) {
       			document.querySelectorAll('.cbi-filebrowser.open').forEach(function(browserEl) {
      -				L.dom.findClassInstance(browserEl).handleCancel(ev);
      +				dom.findClassInstance(browserEl).handleCancel(ev);
       			});
       
       			button.style.display = 'none';
      @@ -4626,14 +4638,14 @@ var UIFileUpload = UIElement.extend(/** @lends LuCI.ui.FileUpload.prototype */ {
        * To import the class in views, use `'require ui'`, to import it in
        * external JavaScript, use `L.require("ui").then(...)`.
        */
      -return L.Class.extend(/** @lends LuCI.ui.prototype */ {
      +var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
       	__init__: function() {
       		modalDiv = document.body.appendChild(
      -			L.dom.create('div', { id: 'modal_overlay' },
      -				L.dom.create('div', { class: 'modal', role: 'dialog', 'aria-modal': true })));
      +			dom.create('div', { id: 'modal_overlay' },
      +				dom.create('div', { class: 'modal', role: 'dialog', 'aria-modal': true })));
       
       		tooltipDiv = document.body.appendChild(
      -			L.dom.create('div', { class: 'cbi-tooltip' }));
      +			dom.create('div', { class: 'cbi-tooltip' }));
       
       		/* setup old aliases */
       		L.showModal = this.showModal;
      @@ -4671,7 +4683,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       	 * @param {*} contents
       	 * The contents to add to the modal dialog. This should be a DOM node or
       	 * a document fragment in most cases. The value is passed as-is to the
      -	 * `L.dom.content()` function - refer to its documentation for applicable
      +	 * `dom.content()` function - refer to its documentation for applicable
       	 * values.
       	 *
       	 * @param {...string} [classes]
      @@ -4689,8 +4701,8 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       		for (var i = 2; i < arguments.length; i++)
       			dlg.classList.add(arguments[i]);
       
      -		L.dom.content(dlg, L.dom.create('h4', {}, title));
      -		L.dom.append(dlg, children);
      +		dom.content(dlg, dom.create('h4', {}, title));
      +		dom.append(dlg, children);
       
       		document.body.classList.add('modal-overlay-active');
       
      @@ -4786,7 +4798,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       	 * @param {*} contents
       	 * The contents to add to the notification banner. This should be a DOM
       	 * node or a document fragment in most cases. The value is passed as-is
      -	 * to the `L.dom.content()` function - refer to its documentation for
      +	 * to the `dom.content()` function - refer to its documentation for
       	 * applicable values.
       	 *
       	 * @param {...string} [classes]
      @@ -4813,7 +4825,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       					'class': 'btn',
       					'style': 'margin-left:auto; margin-top:auto',
       					'click': function(ev) {
      -						L.dom.parent(ev.target, '.alert-message').classList.add('fade-out');
      +						dom.parent(ev.target, '.alert-message').classList.add('fade-out');
       					},
       
       				}, [ _('Dismiss') ])
      @@ -4821,9 +4833,9 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       		]);
       
       		if (title != null)
      -			L.dom.append(msg.firstElementChild, E('h4', {}, title));
      +			dom.append(msg.firstElementChild, E('h4', {}, title));
       
      -		L.dom.append(msg.firstElementChild, children);
      +		dom.append(msg.firstElementChild, children);
       
       		for (var i = 2; i < arguments.length; i++)
       			msg.classList.add(arguments[i]);
      @@ -4965,11 +4977,11 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       				]));
       
       				if ((i+2) < items.length)
      -					children.push(L.dom.elem(sep) ? sep.cloneNode(true) : sep);
      +					children.push(dom.elem(sep) ? sep.cloneNode(true) : sep);
       			}
       		}
       
      -		L.dom.content(node, children);
      +		dom.content(node, children);
       
       		return node;
       	},
      @@ -4989,7 +5001,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       	 * external JavaScript, use `L.require("ui").then(...)` and access the
       	 * `tabs` property of the class instance value.
       	 */
      -	tabs: L.Class.singleton(/* @lends LuCI.ui.tabs.prototype */ {
      +	tabs: baseclass.singleton(/* @lends LuCI.ui.tabs.prototype */ {
       		/** @private */
       		init: function() {
       			var groups = [], prevGroup = null, currGroup = null;
      @@ -4997,7 +5009,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       			document.querySelectorAll('[data-tab]').forEach(function(tab) {
       				var parent = tab.parentNode;
       
      -				if (L.dom.matches(tab, 'li') && L.dom.matches(parent, 'ul.cbi-tabmenu'))
      +				if (dom.matches(tab, 'li') && dom.matches(parent, 'ul.cbi-tabmenu'))
       					return;
       
       				if (!parent.hasAttribute('data-tab-group'))
      @@ -5115,7 +5127,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       		 * Returns `true` if the pane is empty, else `false`.
       		 */
       		isEmptyPane: function(pane) {
      -			return L.dom.isEmpty(pane, function(n) { return n.classList.contains('cbi-tab-descr') });
      +			return dom.isEmpty(pane, function(n) { return n.classList.contains('cbi-tab-descr') });
       		},
       
       		/** @private */
      @@ -5224,11 +5236,11 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       			});
       
       			group.childNodes.forEach(function(pane) {
      -				if (L.dom.matches(pane, '[data-tab]')) {
      +				if (dom.matches(pane, '[data-tab]')) {
       					if (pane.getAttribute('data-tab') === name) {
       						pane.setAttribute('data-tab-active', 'true');
       						pane.dispatchEvent(new CustomEvent('cbi-tab-active', { detail: { tab: name } }));
      -						L.ui.tabs.setActiveTabId(pane, index);
      +						UI.prototype.tabs.setActiveTabId(pane, index);
       					}
       					else {
       						pane.setAttribute('data-tab-active', 'false');
      @@ -5270,7 +5282,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       	 */
       	uploadFile: function(path, progressStatusNode) {
       		return new Promise(function(resolveFn, rejectFn) {
      -			L.ui.showModal(_('Uploading file…'), [
      +			UI.prototype.showModal(_('Uploading file…'), [
       				E('p', _('Please select the file to upload.')),
       				E('div', { 'style': 'display:flex' }, [
       					E('div', { 'class': 'left', 'style': 'flex:1' }, [
      @@ -5278,7 +5290,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       							type: 'file',
       							style: 'display:none',
       							change: function(ev) {
      -								var modal = L.dom.parent(ev.target, '.modal'),
      +								var modal = dom.parent(ev.target, '.modal'),
       								    body = modal.querySelector('p'),
       								    upload = modal.querySelector('.cbi-button-action.important'),
       								    file = ev.currentTarget.files[0];
      @@ -5286,7 +5298,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       								if (file == null)
       									return;
       
      -								L.dom.content(body, [
      +								dom.content(body, [
       									E('ul', {}, [
       										E('li', {}, [ '%s: %s'.format(_('Name'), file.name.replace(/^.*[\\\/]/, '')) ]),
       										E('li', {}, [ '%s: %1024mB'.format(_('Size'), file.size) ])
      @@ -5308,7 +5320,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       						E('button', {
       							'class': 'btn',
       							'click': function() {
      -								L.ui.hideModal();
      +								UI.prototype.hideModal();
       								rejectFn(new Error('Upload has been cancelled'));
       							}
       						}, [ _('Cancel') ]),
      @@ -5317,14 +5329,14 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       							'class': 'btn cbi-button-action important',
       							'disabled': true,
       							'click': function(ev) {
      -								var input = L.dom.parent(ev.target, '.modal').querySelector('input[type="file"]');
      +								var input = dom.parent(ev.target, '.modal').querySelector('input[type="file"]');
       
       								if (!input.files[0])
       									return;
       
       								var progress = E('div', { 'class': 'cbi-progressbar', 'title': '0%' }, E('div', { 'style': 'width:0' }));
       
      -								L.ui.showModal(_('Uploading file…'), [ progress ]);
      +								UI.prototype.showModal(_('Uploading file…'), [ progress ]);
       
       								var data = new FormData();
       
      @@ -5334,7 +5346,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       
       								var filename = input.files[0].name;
       
      -								L.Request.post(L.env.cgi_base + '/cgi-upload', data, {
      +								request.post(L.env.cgi_base + '/cgi-upload', data, {
       									timeout: 0,
       									progress: function(pev) {
       										var percent = (pev.loaded / pev.total) * 100;
      @@ -5348,10 +5360,10 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       								}).then(function(res) {
       									var reply = res.json();
       
      -									L.ui.hideModal();
      +									UI.prototype.hideModal();
       
       									if (L.isObject(reply) && reply.failure) {
      -										L.ui.addNotification(null, E('p', _('Upload request failed: %s').format(reply.message)));
      +										UI.prototype.addNotification(null, E('p', _('Upload request failed: %s').format(reply.message)));
       										rejectFn(new Error(reply.failure));
       									}
       									else {
      @@ -5359,7 +5371,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       										resolveFn(reply);
       									}
       								}, function(err) {
      -									L.ui.hideModal();
      +									UI.prototype.hideModal();
       									rejectFn(err);
       								});
       							}
      @@ -5420,7 +5432,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       		var ipaddrs = arguments.length ? arguments : [ window.location.host ];
       
       		window.setTimeout(L.bind(function() {
      -			L.Poll.add(L.bind(function() {
      +			poll.add(L.bind(function() {
       				var tasks = [], reachable = false;
       
       				for (var i = 0; i < 2; i++)
      @@ -5430,7 +5442,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       
       				return Promise.all(tasks).then(function() {
       					if (reachable) {
      -						L.Poll.stop();
      +						poll.stop();
       						window.location = reachable;
       					}
       				});
      @@ -5452,7 +5464,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       	 * external JavaScript, use `L.require("ui").then(...)` and access the
       	 * `changes` property of the class instance value.
       	 */
      -	changes: L.Class.singleton(/* @lends LuCI.ui.changes.prototype */ {
      +	changes: baseclass.singleton(/* @lends LuCI.ui.changes.prototype */ {
       		init: function() {
       			if (!L.env.sessionid)
       				return;
      @@ -5485,7 +5497,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       			}
       
       			if (n > 0) {
      -				L.dom.content(i, [ _('Unsaved Changes'), ': ', n ]);
      +				dom.content(i, [ _('Unsaved Changes'), ': ', n ]);
       				i.classList.add('flash');
       				i.style.display = '';
       				document.dispatchEvent(new CustomEvent('uci-new-changes'));
      @@ -5544,7 +5556,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       		 */
       		displayChanges: function() {
       			var list = E('div', { 'class': 'uci-change-list' }),
      -			    dlg = L.ui.showModal(_('Configuration') + ' / ' + _('Changes'), [
      +			    dlg = UI.prototype.showModal(_('Configuration') + ' / ' + _('Changes'), [
       				E('div', { 'class': 'cbi-section' }, [
       					E('strong', _('Legend:')),
       					E('div', { 'class': 'uci-change-legend' }, [
      @@ -5560,7 +5572,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       					E('div', { 'class': 'right' }, [
       						E('button', {
       							'class': 'btn',
      -							'click': L.ui.hideModal
      +							'click': UI.prototype.hideModal
       						}, [ _('Dismiss') ]), ' ',
       						E('button', {
       							'class': 'cbi-button cbi-button-positive important',
      @@ -5613,24 +5625,24 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       		/** @private */
       		displayStatus: function(type, content) {
       			if (type) {
      -				var message = L.ui.showModal('', '');
      +				var message = UI.prototype.showModal('', '');
       
       				message.classList.add('alert-message');
       				DOMTokenList.prototype.add.apply(message.classList, type.split(/\s+/));
       
       				if (content)
      -					L.dom.content(message, content);
      +					dom.content(message, content);
       
       				if (!this.was_polling) {
      -					this.was_polling = L.Request.poll.active();
      -					L.Request.poll.stop();
      +					this.was_polling = request.poll.active();
      +					request.poll.stop();
       				}
       			}
       			else {
      -				L.ui.hideModal();
      +				UI.prototype.hideModal();
       
       				if (this.was_polling)
      -					L.Request.poll.start();
      +					request.poll.start();
       			}
       		},
       
      @@ -5643,21 +5655,21 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       
       				var call = function(r, data, duration) {
       					if (r.status === 204) {
      -						L.ui.changes.displayStatus('warning', [
      +						UI.prototype.changes.displayStatus('warning', [
       							E('h4', _('Configuration changes have been rolled back!')),
       							E('p', _('The device could not be reached within %d seconds after applying the pending changes, which caused the configuration to be rolled back for safety reasons. If you believe that the configuration changes are correct nonetheless, perform an unchecked configuration apply. Alternatively, you can dismiss this warning and edit changes before attempting to apply again, or revert all pending changes to keep the currently working configuration state.').format(L.env.apply_rollback)),
       							E('div', { 'class': 'right' }, [
       								E('button', {
       									'class': 'btn',
      -									'click': L.bind(L.ui.changes.displayStatus, L.ui.changes, false)
      +									'click': L.bind(UI.prototype.changes.displayStatus, UI.prototype.changes, false)
       								}, [ _('Dismiss') ]), ' ',
       								E('button', {
       									'class': 'btn cbi-button-action important',
      -									'click': L.bind(L.ui.changes.revert, L.ui.changes)
      +									'click': L.bind(UI.prototype.changes.revert, UI.prototype.changes)
       								}, [ _('Revert changes') ]), ' ',
       								E('button', {
       									'class': 'btn cbi-button-negative important',
      -									'click': L.bind(L.ui.changes.apply, L.ui.changes, false)
      +									'click': L.bind(UI.prototype.changes.apply, UI.prototype.changes, false)
       								}, [ _('Apply unchecked') ])
       							])
       						]);
      @@ -5667,7 +5679,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       
       					var delay = isNaN(duration) ? 0 : Math.max(1000 - duration, 0);
       					window.setTimeout(function() {
      -						L.Request.request(L.url('admin/uci/confirm'), {
      +						request.request(L.url('admin/uci/confirm'), {
       							method: 'post',
       							timeout: L.env.apply_timeout * 1000,
       							query: { sid: L.env.sessionid, token: L.env.token }
      @@ -5698,19 +5710,19 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       			var call = function(r, data, duration) {
       				if (Date.now() >= deadline) {
       					window.clearTimeout(tt);
      -					L.ui.changes.rollback(checked);
      +					UI.prototype.changes.rollback(checked);
       					return;
       				}
       				else if (r && (r.status === 200 || r.status === 204)) {
       					document.dispatchEvent(new CustomEvent('uci-applied'));
       
      -					L.ui.changes.setIndicator(0);
      -					L.ui.changes.displayStatus('notice',
      +					UI.prototype.changes.setIndicator(0);
      +					UI.prototype.changes.displayStatus('notice',
       						E('p', _('Configuration changes applied.')));
       
       					window.clearTimeout(tt);
       					window.setTimeout(function() {
      -						//L.ui.changes.displayStatus(false);
      +						//UI.prototype.changes.displayStatus(false);
       						window.location = window.location.href.split('#')[0];
       					}, L.env.apply_display * 1000);
       
      @@ -5719,10 +5731,10 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       
       				var delay = isNaN(duration) ? 0 : Math.max(1000 - duration, 0);
       				window.setTimeout(function() {
      -					L.Request.request(L.url('admin/uci/confirm'), {
      +					request.request(L.url('admin/uci/confirm'), {
       						method: 'post',
       						timeout: L.env.apply_timeout * 1000,
      -						query: L.ui.changes.confirm_auth
      +						query: UI.prototype.changes.confirm_auth
       					}).then(call, call);
       				}, delay);
       			};
      @@ -5730,7 +5742,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       			var tick = function() {
       				var now = Date.now();
       
      -				L.ui.changes.displayStatus('notice spinning',
      +				UI.prototype.changes.displayStatus('notice spinning',
       					E('p', _('Applying configuration changes… %ds')
       						.format(Math.max(Math.floor((deadline - Date.now()) / 1000), 0))));
       
      @@ -5771,32 +5783,32 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       			this.displayStatus('notice spinning',
       				E('p', _('Starting configuration apply…')));
       
      -			L.Request.request(L.url('admin/uci', checked ? 'apply_rollback' : 'apply_unchecked'), {
      +			request.request(L.url('admin/uci', checked ? 'apply_rollback' : 'apply_unchecked'), {
       				method: 'post',
       				query: { sid: L.env.sessionid, token: L.env.token }
       			}).then(function(r) {
       				if (r.status === (checked ? 200 : 204)) {
       					var tok = null; try { tok = r.json(); } catch(e) {}
       					if (checked && tok !== null && typeof(tok) === 'object' && typeof(tok.token) === 'string')
      -						L.ui.changes.confirm_auth = tok;
      +						UI.prototype.changes.confirm_auth = tok;
       
      -					L.ui.changes.confirm(checked, Date.now() + L.env.apply_rollback * 1000);
      +					UI.prototype.changes.confirm(checked, Date.now() + L.env.apply_rollback * 1000);
       				}
       				else if (checked && r.status === 204) {
      -					L.ui.changes.displayStatus('notice',
      +					UI.prototype.changes.displayStatus('notice',
       						E('p', _('There are no changes to apply')));
       
       					window.setTimeout(function() {
      -						L.ui.changes.displayStatus(false);
      +						UI.prototype.changes.displayStatus(false);
       					}, L.env.apply_display * 1000);
       				}
       				else {
      -					L.ui.changes.displayStatus('warning',
      +					UI.prototype.changes.displayStatus('warning',
       						E('p', _('Apply request failed with status <code>%h</code>')
       							.format(r.responseText || r.statusText || r.status)));
       
       					window.setTimeout(function() {
      -						L.ui.changes.displayStatus(false);
      +						UI.prototype.changes.displayStatus(false);
       					}, L.env.apply_display * 1000);
       				}
       			});
      @@ -5818,29 +5830,29 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       			this.displayStatus('notice spinning',
       				E('p', _('Reverting configuration…')));
       
      -			L.Request.request(L.url('admin/uci/revert'), {
      +			request.request(L.url('admin/uci/revert'), {
       				method: 'post',
       				query: { sid: L.env.sessionid, token: L.env.token }
       			}).then(function(r) {
       				if (r.status === 200) {
       					document.dispatchEvent(new CustomEvent('uci-reverted'));
       
      -					L.ui.changes.setIndicator(0);
      -					L.ui.changes.displayStatus('notice',
      +					UI.prototype.changes.setIndicator(0);
      +					UI.prototype.changes.displayStatus('notice',
       						E('p', _('Changes have been reverted.')));
       
       					window.setTimeout(function() {
      -						//L.ui.changes.displayStatus(false);
      +						//UI.prototype.changes.displayStatus(false);
       						window.location = window.location.href.split('#')[0];
       					}, L.env.apply_display * 1000);
       				}
       				else {
      -					L.ui.changes.displayStatus('warning',
      +					UI.prototype.changes.displayStatus('warning',
       						E('p', _('Revert request failed with status <code>%h</code>')
       							.format(r.statusText || r.status)));
       
       					window.setTimeout(function() {
      -						L.ui.changes.displayStatus(false);
      +						UI.prototype.changes.displayStatus(false);
       					}, L.env.apply_display * 1000);
       				}
       			});
      @@ -5891,7 +5903,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       			events.push('blur', 'keyup');
       
       		try {
      -			var cbiValidator = L.validation.create(field, type, optional, vfunc),
      +			var cbiValidator = validation.create(field, type, optional, vfunc),
       			    validatorFn = cbiValidator.validate.bind(cbiValidator);
       
       			for (var i = 0; i < events.length; i++)
      @@ -5972,6 +5984,8 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
       	Hiddenfield: UIHiddenfield,
       	FileUpload: UIFileUpload
       });
      +
      +return UI;
       
      @@ -5984,7 +5998,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ { -- 2.25.1