# 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()

ui.js, line 3949

### Methods

#### apply(checked)

ui.js, line 4251

  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()

ui.js, line 4026

  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)

ui.js, line 3992

  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()

ui.js, line 4298

  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)

ui.js, line 3970

  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.