tiles
TileCollection : d2/sdk/utils/landingpage/tiles
Tile definition collection. Each tile definition describes its priority, association type, pre-requisite and finally a view that is used as the representation of the tile. Based on priority a particular definition is picked from this collection to finally render D2 Smart View landing page.
Extends: Backbone.Collection
See: WidgetConstants for some related pre-defined constants.
New definitions could be added to this collection by means of extension.
Example (to register an extension, add in extension.json)
{
"d2/sdk/utils/landingpage/tiles": {
"extensions": {
"mybundle": {
"mybundle/utils/landingpage/my.tiles"
}
}
}
}
Example (whereas my.tiles.js is defined as)
define(['d2/sdk/utils/widget.constants', 'i18n!mybundle/utils/landingpage/impl/nls/lang'], function(widgetConstants, lang){
'use strict';
function validateURLShortcutConfig(widgetConfig, options) {
var validation = {status: true};
if (!widgetConfig.widgetParams && !widgetConfig.widgetParams.open_url) {
validation.status = false; // It will be considered as a validation error
validation.errorMessage = lang.openUrlWidgetMissing;
}
return validation;
}
// See 'LandingTile' documentation for all possible properties with their usage
return [
{type: 'CreateFile', icon: 'icon-new', isShortcut: true, tileConfigType: widgetConstants.TileConfigTypes.NONE}, // widget configuration-less shortcut tile
{type: 'OpenURLWidget', icon: 'icon-url', isShortcut: true, validateConfig: validateURLShortcutConfig}, // shortcut tile that needs & validates a widget configuration
{
// A widget tile that relies on the default widget validation
type: 'CheckoutDocumentWidget',
icon: 'title-checkout',
tileView: 'mybundle/widgets/newcheckout',
errMissingWidgetConfig: lang.checkoutWidgetMissing,
applicationScope: 'checkedout'
}
// Any other definition
];
});
- TileCollection :
d2/sdk/utils/landingpage/tiles
- ~ShortcutType :
enum
- ~LandingTile :
Object
- ~ConfigValidatorCallback ⇒
ConfigValidatorReturnType
- ~ConfigValidatorReturnType :
Object
- ~TileOptionBuilderCallback ⇒
void
- ~ShortcutClickHandler ⇒
void
- ~ShortcutType :
TileCollection~ShortcutType : enum
OOTB D2SV shortcut types
Kind: inner enum of TileCollection
Properties
Name | Description |
---|---|
CreateFile | New file shortcut |
UploadFile | Import files shortcut |
CreateUploadFile | Combined New/Import file shortcut |
UploadFolder | Import folder shortcut |
QueryFormObject | Query form shortcur |
QueryObject | Saved query/search shortcut |
TileCollection~LandingTile : Object
Kind: inner typedef of TileCollection
Properties
Name | Type | Default | Description |
---|---|---|---|
[sequence] | number | 1000 | Priority of this definition. For matching |
type | string | Association type of this tile. It should be set with a value from the enumeration | |
icon | string | CSS class name of the icon to be shown on the tile. For non-shortcut tiles, the icon is shown in the tile header. | |
[isShortcut] | boolean | false | Whether it's shortcut tile or widget tile? |
[tileConfigType] | TileConfigTypes | TileConfigTypes.WIDGET | Tiles that don't require a widget config should set it to |
[tileView] | string | Not required for shortcut tiles. For other tiles it should point to a folder implementing the view to be associated with this tile. E.g For a path | |
[clickHandler] | ShortcutClickHandler | Callback to be executed only for those shortcut tiles that neither specifies an | |
[validateConfig] | ConfigValidatorCallback | Callback to validate the resolved widget config. | |
[buildTileOptions] | TileOptionBuilderCallback | Callback to build tile options that would be passed to the | |
[errMissingWidgetName] | string | The error to be shown if a tile definition requires a widget config but the corresponding D2 Smart View landing page configuraiton fails to specify a name for it. If unspecified, a generic error message is shown. | |
[errMissingWidgetConfig] | string | The error to be shown if a tile definition requires a widget config but a suitable widget configuration could not be resolved for some reason. | |
[applicationScope] | string | The application scope in which this tile will expand into. Tile expansion is enabled only if this value matches one of the registered application scope perspectives's id. See ApplicationScopePerspectives. For shortcut tiles, clicking anywhere in the tile activates the expansion. For list type of tiles, the tile header or a dedicated 'Expand' button could be clicked to activate the expansion. |
TileCollection~ConfigValidatorCallback ⇒ ConfigValidatorReturnType
Callback function that validates a widget configuration for a tile
Kind: inner typedef of TileCollection
Param | Type | Description |
---|---|---|
widgetConfig | Object | The widget configuration being validated |
[options] | Object | Any additional context specific data that is not part of |
TileCollection~ConfigValidatorReturnType : Object
Kind: inner typedef of TileCollection
Properties
Name | Type | Description |
---|---|---|
status | boolean |
|
[errorMessage] | string | Error message to be shown in UI if the validation failed. |
TileCollection~TileOptionBuilderCallback ⇒ void
Callback function that builds options for a tile
Kind: inner typedef of TileCollection
Param | Type | Description |
---|---|---|
tile | Object | Parsed tile object from D2 Smart View landing page configuration. New properties could be attached to this object as part of forming additional option. |
[widgetConfig] | Object | Any relevant wieget configuration, applicable only if the tile requires a widget configuration. |
TileCollection~ShortcutClickHandler ⇒ void
Callback to handle click event for a shortcut tile
Kind: inner typedef of TileCollection
Param | Type | Description |
---|---|---|
options | object | The options container. |
options.context | Context |
|
options.widgetName | string | Name of the widget configuration if the shortcut is of type |
options.widgetParams | object | Any parameters associated with the resolved widget configuration. Applicable only if the shortcut is of type |