new LuCI.view()
Methods
-
addFooter(){DocumentFragment}
luci.js, line 2905 -
Renders a standard page action footer if any of the
handleSave()
,handleSaveApply()
orhandleReset()
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
andReset
triggering thehandleSave()
,handleSaveApply()
andhandleReset()
functions respectively.When any of these
handle*()
functions is overwritten withnull
by a view extending this class, the corresponding button will not be rendered.Returns:
Type Description DocumentFragment Returns a DocumentFragment
containing the footer bar with buttons for each correspondinghandle*()
action or an emptyDocumentFragment
if all threehandle*()
methods are overwritten withnull
. -
handleReset(ev){*|Promise.<*>}
luci.js, line 2871 -
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
form.Map()
based forms - it will iterate all forms present in the view and invoke theMap.reset()
method on each form.Views not using
Map
instances or requiring other special logic should overwritehandleReset()
with a custom implementation.To disable the
Reset
page footer button, views extending this base class should overwrite thehandleReset
function withnull
.The invocation of this function is wrapped by
Promise.resolve()
so it may return Promises if needed.Name Type Description ev
Event The DOM event that triggered the function.
Returns:
Type Description * | 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(ev){*|Promise.<*>}
luci.js, line 2790 -
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
form.Map()
based forms - it will iterate all forms present in the view and invoke theMap.save()
method on each form.Views not using
Map
instances or requiring other special logic should overwritehandleSave()
with a custom implementation.To disable the
Save
page footer button, views extending this base class should overwrite thehandleSave
function withnull
.The invocation of this function is wrapped by
Promise.resolve()
so it may return Promises if needed.Name Type Description ev
Event The DOM event that triggered the function.
Returns:
Type Description * | 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(ev){*|Promise.<*>}
luci.js, line 2834 -
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
form.Map()
based forms - it will first invokeview.handleSave()
and then callui.changes.apply()
to start the modal config apply and page reload flow.Views not using
Map
instances or requiring other special logic should overwritehandleSaveApply()
with a custom implementation.To disable the
Save & Apply
page footer button, views extending this base class should overwrite thehandleSaveApply
function withnull
.The invocation of this function is wrapped by
Promise.resolve()
so it may return Promises if needed.Name Type Description ev
Event The DOM event that triggered the function.
Returns:
Type Description * | 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. -
abstractload(){*|Promise.<*>}
luci.js, line 2725 -
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.
Returns:
Type Description * | Promise.<*> May return any value or a Promise resolving to any value. -
abstractrender(load_results){Node|Promise.<Node>}
luci.js, line 2757 -
The render function is invoked after the
load()
function and responsible for setting up the view contents. It must return a DOMNode
orDocumentFragment
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
dom.append()
.This function is supposed to be overwritten by subclasses, the default implementation does nothing.
Name Type Description load_results
* | null This function will receive the return value of the
view.load()
function as first argument.Returns:
Type Description Node | Promise.<Node> Should return a DOM Node
value or aPromise
resolving to aNode
value.