HeliosToEndorUpgrade.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use strict';
  2. /*
  3. *+------------------------------------------------------------------------+
  4. *| Licensed Materials - Property of IBM
  5. *| IBM Cognos Products: BI Dashboard
  6. *| (C) Copyright IBM Corp. 2018
  7. *|
  8. *| US Government Users Restricted Rights - Use, duplication or disclosure
  9. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *+------------------------------------------------------------------------+
  11. */
  12. define(['underscore', '../../../lib/@waca/core-client/js/core-client/ui/core/Class', '../../../lib/@waca/upgrades/UpgradeBase', './TextWidgetTypesUpgradeHelper', './ConditionalPaletteUpgradeHelper', './SinglePageDashboardsUpgradeHelper'], function (_, Class, UpgradeBase, textWidgetTypesUpgradeHelper, conditionalPaletteUpgradeHelper, singlePageDashboardsUpgradeHelper) {
  13. /**
  14. * Upgrade old depricated text widget classes to the standard font/size classes. Remove these classes and definitions from the themes and stylesheets.
  15. * Upgrade conditionalPalette: In the R releases we saved the actual hex values in the conditional format part of the widget spec. On upgrade, we now match those hex values to one of our system CondtionalPalettes to get the palette name and set the widget property accordingly.
  16. * Upgrade existing single page dashboards to tabbed dashboards with the tabs hidden.
  17. **/
  18. var Upgrade = Class.extend([UpgradeBase], {
  19. init: function init() {
  20. this.VERSION = 1010;
  21. this.textWidgetTypesUpgradeHelper = new textWidgetTypesUpgradeHelper();
  22. this.conditionalPaletteUpgradeHelper = new conditionalPaletteUpgradeHelper();
  23. this.singlePageDashboardsUpgradeHelper = new singlePageDashboardsUpgradeHelper();
  24. },
  25. /**
  26. * Perform upgrade
  27. *
  28. * @param {object} spec - spec to perform upgrade on
  29. *
  30. * @return {Promise} Promise to be resolved when upgrade performed
  31. */
  32. up: function up(spec) {
  33. var _this = this;
  34. this.dashboardApi = this.data.dashboardApi;
  35. return this.textWidgetTypesUpgradeHelper.upgrade(spec).then(function (spec) {
  36. return _this.conditionalPaletteUpgradeHelper.upgrade(spec, _this.dashboardApi);
  37. }).then(function (spec) {
  38. return _this.singlePageDashboardsUpgradeHelper.upgrade(spec);
  39. });
  40. },
  41. down: function down(spec) {
  42. // no downgrade at this time; return as is
  43. return Promise.resolve(spec);
  44. }
  45. });
  46. return new Upgrade();
  47. });
  48. //# sourceMappingURL=HeliosToEndorUpgrade.js.map