Class: changes

LuCI.ui. changes

The changes class encapsulates logic for visualizing, applying, confirming and reverting staged UCI changesets.

This class is automatically instantiated as part of LuCI.ui. To use it in views, use 'require ui' and refer to ui.changes. To import it in external JavaScript, use L.require("ui").then(...) and access the changes property of the class instance value.

new LuCI.ui.changes()

Methods

apply(checked)

Apply the staged configuration changes.

Start applying staged configuration changes and open a modal dialog with a progress indication to prevent interaction with the view during the apply process. The modal dialog will be automatically closed and the current view reloaded once the apply process is complete.

Name Type Default Description
checked boolean false optional

Whether to perform a checked (true) configuration apply or an unchecked (false) one. In case of a checked apply, the configuration changes must be confirmed within a specific time interval, otherwise the device will begin to roll back the changes in order to restore the previous settings.

displayChanges()

Display the current changelog.

Open a modal dialog visualizing the currently staged UCI changes and offer options to revert or apply the shown changes.

renderChangeIndicator(changes)

Update the change count indicator.

This function updates the UCI change count indicator from the given UCI changeset structure.

Name Type Description
changes Object.<string, Array.<LuCI.uci.ChangeRecord>>

The UCI changeset to count.

revert()

Revert the staged configuration changes.

Start reverting staged configuration changes and open a modal dialog with a progress indication to prevent interaction with the view during the revert process. The modal dialog will be automatically closed and the current view reloaded once the revert process is complete.

setIndicator(numChanges)

Set the change count indicator.

This function updates or hides the UCI change count indicator, depending on the passed change count. When the count is greater than 0, the change indicator is displayed or updated, otherwise it is removed.

Name Type Description
numChanges number

The number of changes to indicate.