MirrorObserver
Method summary
name | description |
---|---|
dispose | Dispose an active MirrorObserver, this will stop the client from requesting the mirror any longer and the server will clean it up at a later time. |
notify | Add a mirror progress callback. Will be called when there is any progress update for the MirrorObserver. Note that during the lifetime of a MirrorObserver there may be several mirror requests, as scenarios are executed or data is modified. All states are transient, a CANCELLED state should signal that the current request is cancelled but a new mirror request will be submitted when the scenarios and data are ready. |
onError | Add an error callback. Will be called if the mirror request fails to be sent, if it fails during processing. |
start | Start the MirrorObserver and return an instance that can be disposed. |
withAllScenarios | Specify the mirror should be created for all scenarios in the view's selection. |
withFirstScenario | Specify the mirror should be created for the first scenario in the view's selection. |
withScenarios | Specify the mirror should be created for a given set of scenarios from the view's selection. |
Constructor
Parameters:
Name | Type | Description |
---|---|---|
view | View | |
tableNames | Array.<string> |
Example
insight.getView()
.withMirrorTables(['my_table_1', 'my_table_2'])
.withAllScenarios()
.notify(myNotifyFunc) // Handle progress updates for the mirror operation
.onError(myErrorFunc) // Handle any error creating the mirror
.start()
Methods
- dispose ( )
-
Dispose an active MirrorObserver, this will stop the client from requesting the mirror any longer and the server will clean it up at a later time.
Example
Back to Toplet mirror = insight.getView() .withMirrorTables(['my_table_1', 'my_table_2']) .withAllScenarios() .start(); mirror.dispose();
- notify ( callback ) → {MirrorObserver}
-
Add a mirror progress callback. Will be called when there is any progress update for the MirrorObserver. Note that during the lifetime of a MirrorObserver there may be several mirror requests, as scenarios are executed or data is modified. All states are transient, a CANCELLED state should signal that the current request is cancelled but a new mirror request will be submitted when the scenarios and data are ready.
Parameters:
Name Type Description callback MirrorObserver.MirrorNotifyCallback Called whenever new mirror progress is available. Returns:Type Description MirrorObserver - onError ( callback ) → {MirrorObserver}
-
Add an error callback. Will be called if the mirror request fails to be sent, if it fails during processing.
Parameters:
Name Type Description callback MirrorObserver.MirrorErrorCallback Gets called with an Error object containing a message from the server. Returns:Type Description MirrorObserver - start ( ) → {MirrorObserver}
-
Start the MirrorObserver and return an instance that can be disposed.
Returns:Type Description MirrorObserver - withAllScenarios ( ) → {MirrorObserver}
-
Specify the mirror should be created for all scenarios in the view's selection.
Returns:Type Description MirrorObserver Example
Back to Topinsight.getView() .withMirrorTables('table-1') .withAllScenarios()
- withFirstScenario ( ) → {MirrorObserver}
-
Specify the mirror should be created for the first scenario in the view's selection.
Returns:Type Description MirrorObserver Example
Back to Topinsight.getView() .withMirrorTables('table-1') .withFirstScenario()
- withScenarios ( scenarios ) → {MirrorObserver}
-
Specify the mirror should be created for a given set of scenarios from the view's selection.
Parameters:
Name Type Argument Description scenarios string | Array.<string> repeatable List of scenarios to mirror Returns:Type Description MirrorObserver Example
Back to Topinsight.getView() .withMirrorTables('table-1') .withScenarios([0, 2])
Type Definitions
- MirrorErrorCallback ( error )
-
Error callbacks will be called if the mirror request fails to be sent or if it fails during processing.
Parameters:
Name Type Description error Error Properties
Name Type Description message string The error message returned from the server Example
Back to Topinsight.getView() .withMirrorTables('table-1') .onError((err) => { console.log(err.message); })
- MirrorNotifyCallback ( mirrorRequestStatus )
-
Called whenever new mirror progress is available.
Parameters:
Name Type Description mirrorRequestStatus MirrorObserver.MirrorRequestStatus Object containing the mirror request state, progress and assigned selectionId Example
Back to Topinsight.getView() .withMirrorTables('table-1') .notify((mirrorRequestStatus) => { if (mirrorRequestStatus.state === insight.enums.MirrorObserverState.COMPLETED) { console.log(`Completed, with assigned selection id: ${mirrorRequestStatus.selectionId}.`); } else if (mirrorRequestStatus.state === insight.enums.MirrorObserverState.CANCELLED) { console.log(`Waiting for scenario to be ready before mirroring.`); } else if (mirrorRequestStatus.state === insight.enums.MirrorObserverState.IN_PROGRESS) { console.log(`In progress, ${mirrorRequestStatus.percent}% complete.`); } })
- MirrorRequestStatus - { object }
-
The mirror request state, progress and selectionId.
Properties:
Name Type Description state insight.enums.MirrorObserverState The overall state of the current mirror request. Note that during the lifetime of a MirrorObserver there may be several mirror requests, as scenarios are executed or data is modified. All states are transient, a CANCELLED state should signal that the current request is cancelled but a new mirror request will be submitted when the scenarios and data are ready. percent number Percentage complete of the mirror request, 0-100 selectionId string The selectionId for the mirror request, generated by the server message string Message sent from the server, could be empty in the case of the IN_PROGRESS state
© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.