'use strict'; /* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| IBM Cognos Products: BI Dashboard *| (C) Copyright IBM Corp. 2017 *| *| US Government Users Restricted Rights - Use, duplication or disclosure *| restricted by GSA ADP Schedule Contract with IBM Corp. *+------------------------------------------------------------------------+ */ define(['underscore', '../../../lib/@waca/core-client/js/core-client/ui/core/Class', '../../../lib/@waca/upgrades/UpgradeBase', './utils/WidgetUpgradeUtils'], function (_, Class, UpgradeBase, WidgetUpgradeUtils) { var HEATMAP_VISID = 'com.ibm.vis.rave2heat'; var Upgrade = Class.extend([UpgradeBase], { init: function init() { this.VERSION = 1006; }, /** * Perform upgrade * * @param {object} spec - spec to perform upgrade on * * @return {Promise} Promise to be resolved when upgrade performed */ up: function up(spec) { if (!spec) { return Promise.resolve(spec); } if (!WidgetUpgradeUtils.specHasWidgets(spec)) { return Promise.resolve(spec); } _.each(spec.widgets, function (model) { this.upgradePieChartDonutRadiusProperty(model); this.upgradeHeatmapAxisLabelProperty(model); }.bind(this)); return Promise.resolve(spec); }, upgradePieChartDonutRadiusProperty: function upgradePieChartDonutRadiusProperty(model) { var pieHasHoleProp = WidgetUpgradeUtils.findProperty('pie.has.hole', model.properties); if (pieHasHoleProp && pieHasHoleProp.value === true) { var donutRadius = WidgetUpgradeUtils.findProperty('donutRadius', model.properties); if (!donutRadius) { model.properties.push({ id: 'donutRadius', value: 0.50 }); } } }, upgradeHeatmapAxisLabelProperty: function upgradeHeatmapAxisLabelProperty(model) { if (model.visId === HEATMAP_VISID) { // Ensure r7 specific properties are set first to ensure it's not overwritten by post-r7 defaults // r7 has default set to 'bottom' while r8 has default set to 'top' WidgetUpgradeUtils.setDefaultProperty(model, 'itemAxis.alignment', 'bottom'); // r7 has default set to 'rotate90' while r9 has default set to 'automatic' WidgetUpgradeUtils.setDefaultProperty(model, 'itemAxis.labels.layoutMode', 'rotate90'); } }, down: function down(spec) { // no downgrade at this time; return as is return Promise.resolve(spec); } }); return new Upgrade(); }); //# sourceMappingURL=VIDA_breakingchanges.js.map