123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2016, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../../lib/@waca/dashboard-common/dist/core/Model'], function (Model) {
- /**
- * Model which represents the event group associated with a widget
- */
- var EventGroupEntry = null;
- EventGroupEntry = Model.extend({
- whitelistAttrs: ['id', 'widgetIds'],
- init: function init() /*attrs, options */{
- EventGroupEntry.inherited('init', this, arguments);
- if (!this.widgetIds) {
- this.widgetIds = [];
- }
- },
- addWidget: function addWidget(id, options) {
- var index = this.widgetIds.indexOf(id);
- if (index < 0) {
- var ids = this.widgetIds.slice();
- ids.push(id);
- this.set({ widgetIds: ids }, options);
- }
- },
- removeWidget: function removeWidget(id, options) {
- var index = this.widgetIds.indexOf(id);
- if (index > -1) {
- var ids = this.widgetIds.filter(function (widgetId) {
- return id !== widgetId;
- });
- this.set({ widgetIds: ids }, options);
- }
- },
- getGroupIndex: function getGroupIndex() {
- var tokens = this.id.split(':');
- return tokens.length === 2 ? parseInt(tokens[1], 10) : 0;
- },
- setGroupIndex: function setGroupIndex(index, options) {
- this.set({ id: this.getPageId() + ':' + index }, options);
- },
- getPageId: function getPageId() {
- return this.id.split(':')[0];
- }
- });
- return EventGroupEntry;
- });
- //# sourceMappingURL=EventGroupEntry.js.map
|