Token Panel
Overview
Component Name: gpii.firstDiscovery.panel.token
File: panels.js
This panel saves the user's preferences to the GPII Preferences Server using the GPII Preferences Server API and displays the token returned by the server. This token identifies the saved preferences so that they can be applied to other devices or edited using another preferences editor.
Using the Token Panel
Option 1: In the
Auxiliary Schema,
specify the name of the panel as the type
property of the panel
section:
"token": {
"type": "gpii.firstDiscovery.token",
"panel": {
"type": "gpii.firstDiscovery.panel.token",
"container": ".gpiic-fd-prefsEditor-panel-token",
"template": "%templatePrefix/token.html",
"message": "%messagePrefix/token.json"
}
}
Option 2: Outside the context of the First Discovery Tool, developers may wish to create a standalone component:
var myPanel = gpii.firstDiscovery.panel.token(container, options);
Grades
This component uses the following base grades:
Supported Events
This component supports the following events:
Event | Type | Description | Parameters |
---|---|---|---|
onSuccess |
default | Fired when the ajax request to the Preferences Server is successful |
|
onError |
default | Fired when the ajax request to the Preferences Server is failed |
|
Methods
Method | Description | Parameters |
---|---|---|
showTokenText |
Displays the server returned token. | A string of token text. |
savePrefsToServer |
Sends ajax request to the Preferences Server to save preferences. | none |
Options
This component can be configured using the following options:
Name | Description | Values | Default |
---|---|---|---|
saveRequestConfig |
To config the endpoint, method and view for sending ajax request to the server. (see: Preferences Server to understand view ) |
A object with ajax request configurations |
|
Selectors
One of the options that can be provided to Infusion components is a set of CSS-based selectors identifying where in the DOM different elements can be found. Components use a DOM Binder to access the named elements.
The value for the selectors
option is itself a Javascript object containing name/value pairs:
selectors: {
selector1Name: "selector 1 string",
selector2Name: "selector 2 string",
...
}
Selector Name | Description | Default |
---|---|---|
message |
The container to display the panel instruction. | ".gpiic-fd-token-message" |
token |
The textarea to display the server returned token. | ".gpiic-fd-token" |
Dependencies
<script type="text/javascript" src="src/lib/infusion/infusion-custom.js"></script>
<script type="text/javascript" src="src/js/msgLookup.js"></script>
<script type="text/javascript" src="src/js/tooltip.js"></script>
<script type="text/javascript" src="src/js/panels.js"></script>