From fbe93f4b09dc8b3d18d9d1255187fc131e3e410f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Henrik=20=C3=98verland?= Date: Wed, 8 Jan 2020 14:13:52 +0100 Subject: [PATCH] fix: fall back to old types for visualizations (#524) --- src/modules/itemTypes.js | 1 + src/reducers/dashboards.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/modules/itemTypes.js b/src/modules/itemTypes.js index 4d33b6084..f30707372 100644 --- a/src/modules/itemTypes.js +++ b/src/modules/itemTypes.js @@ -13,6 +13,7 @@ import NotInterestedIcon from '@material-ui/icons/NotInterested'; import { getBaseUrl } from './util'; // Item types +export const VISUALIZATION = 'VISUALIZATION'; export const REPORT_TABLE = 'REPORT_TABLE'; export const CHART = 'CHART'; export const MAP = 'MAP'; diff --git a/src/reducers/dashboards.js b/src/reducers/dashboards.js index f224c22b4..d38a1b5cd 100644 --- a/src/reducers/dashboards.js +++ b/src/reducers/dashboards.js @@ -9,6 +9,9 @@ import { isSpacerType, isTextType, emptyTextItemContent, + REPORT_TABLE, + CHART, + VISUALIZATION, } from '../modules/itemTypes'; export const SET_DASHBOARDS = 'SET_DASHBOARDS'; @@ -168,7 +171,18 @@ export const sGetDashboardsSortedByStarred = state => [ export const getCustomDashboards = data => { const uiItems = items => items.map(item => { - const type = isSpacerType(item) ? SPACER : item.type; + let type = isSpacerType(item) ? SPACER : item.type; + + // TODO: temporary fix before 2.34 epic branch is merged + // if "VISUALIZATION", reset to "REPORT_TABLE" or "CHART" + if (type === VISUALIZATION) { + type = item.reportTable + ? REPORT_TABLE + : item.chart + ? CHART + : type; + } + const text = isTextType(item) ? item.text === emptyTextItemContent ? ''