12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2017, 2020
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../../lib/@waca/dashboard-common/dist/ui/WidgetAddUIHelper', '../../visualizations/definitions/VisDefinitionManager', 'underscore'], function (WidgetAddUIHelper, VisDefinitionManager, _) {
- /**
- * Extension of the WidgetAddUIHelper that allows entries to be built up by querying the list of definitions
- * rather than a static json list
- *
- * This is a LiveWidget version of WidgetAddUIHelper which uses the livewidget and VisDefinitionManager of the livewidget
- */
- var LiveWidgetUIHelper = WidgetAddUIHelper.extend({
- init: function init(params) {
- LiveWidgetUIHelper.inherited('init', this, arguments);
- this.dashboardApi = params.dashboardApi;
- this.iconsFeature = this.dashboardApi.getFeature('Icons');
- },
- /**
- * Build up a livewidget entry for each possible archetype, use the archetype icon as the icon
- * to see in the visualizations drop down
- */
- getEntries: function getEntries() {
- var _this = this;
- var definitionAPI = this.dashboardApi.getFeature('VisDefinitions');
- return _.map(definitionAPI.getList(), function (definition) {
- return {
- label: definition.getLabel(),
- name: definition.getId(),
- icon: _this._getVisualizationIcon(definition),
- type: definition.getType(),
- placeholderIcon: definition.getPlaceholderIconUri(),
- content: {
- title: definition.getId(),
- iconUrl: definition.getIconUri(),
- name: definition.getId(),
- widget: 'dashboard-analytics/widgets/livewidget/LiveWidget',
- options: {
- visId: definition.getId(),
- avatarIcon: definition.getPlaceholderIconUri()
- }
- }
- };
- });
- },
- _getVisualizationIcon: function _getVisualizationIcon(definition) {
- var icon = this.iconsFeature.getIcon(definition.getId());
- icon = icon === undefined ? definition.getIcon() : icon.id;
- return icon;
- }
- });
- return LiveWidgetUIHelper;
- });
- //# sourceMappingURL=LiveWidgetUIHelper.js.map
|