PropertiesModel.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI
  5. * (C) Copyright IBM Corp. 2018
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['../../../lib/@waca/dashboard-common/dist/core/Model', './customColors/CustomColorsModel', 'underscore'], function (Model, CustomColors, _) {
  9. var PropertiesModel = Model.extend({
  10. nestedModels: { customColors: CustomColors },
  11. whitelistAttrs: ['dashboardColorSet', 'customColors', 'localCache', 'defaultLocale', 'fredIsRed'],
  12. init: function init(model, options) {
  13. var _this = this;
  14. _.extend(this, options);
  15. if (model) {
  16. _.defaults(model, {
  17. customColors: {},
  18. defaultLocale: 'Default',
  19. fredIsRed: true
  20. });
  21. }
  22. PropertiesModel.inherited('init', this, arguments);
  23. if (this.contentReferences) {
  24. this.contentReferences.push({
  25. type: 'palette',
  26. get: function get() {
  27. // We only want palettes that start with __CM__ to be added to the content references
  28. var value = _this.get('dashboardColorSet');
  29. if (value && value.indexOf('__CM__') === 0) {
  30. return value.split('__CM__')[1];
  31. }
  32. return null;
  33. }
  34. });
  35. }
  36. }
  37. });
  38. return PropertiesModel;
  39. });
  40. //# sourceMappingURL=PropertiesModel.js.map