From 7d258908c67ddd2a269618cd3e27bfec38cb00ed Mon Sep 17 00:00:00 2001 From: Levko Kravets Date: Tue, 27 Feb 2018 18:24:26 +0200 Subject: [PATCH 1/3] getredash/redash#2108 Fix: length limit increased --- client/app/config/dashboard-grid-options.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/app/config/dashboard-grid-options.js b/client/app/config/dashboard-grid-options.js index 5abfe1e551..e109450ff5 100644 --- a/client/app/config/dashboard-grid-options.js +++ b/client/app/config/dashboard-grid-options.js @@ -2,7 +2,7 @@ const dashboardGridOptions = { columns: 6, pushing: true, floating: true, - swapping: true, + swapping: false, width: 'auto', colWidth: 'auto', rowHeight: 50, @@ -12,9 +12,9 @@ const dashboardGridOptions = { isMobile: false, mobileBreakPoint: 800, mobileModeEnabled: true, - minColumns: 1, + minColumns: 6, minRows: 1, - maxRows: 100, + maxRows: 1000, defaultSizeX: 3, defaultSizeY: 3, minSizeX: 1, From f61a74bbee0b14193ddec70c7f1e38e56f489f9c Mon Sep 17 00:00:00 2001 From: Levko Kravets Date: Tue, 27 Feb 2018 18:25:21 +0200 Subject: [PATCH 2/3] Fix: 'Cannot read property of null' JS error when going away from dashboard page --- client/app/directives/gridster-auto-height.js | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/client/app/directives/gridster-auto-height.js b/client/app/directives/gridster-auto-height.js index a51316db7b..639786ec61 100644 --- a/client/app/directives/gridster-auto-height.js +++ b/client/app/directives/gridster-auto-height.js @@ -9,34 +9,36 @@ function gridsterAutoHeight($timeout) { let destroyed = false; function updateHeight() { - const wrapper = $element[0]; - // Query element, but keep selector order - const element = _.chain(attr.gridsterAutoHeight.split(',')) - .map(selector => wrapper.querySelector(selector)) - .filter(_.isObject) - .first() - .value(); - if (element) { - const childrenBounds = _.chain(element.children) - .map(child => child.getBoundingClientRect()) - .reduce((result, bounds) => ({ - left: Math.min(result.left, bounds.left), - top: Math.min(result.top, bounds.top), - right: Math.min(result.right, bounds.right), - bottom: Math.min(result.bottom, bounds.bottom), - })) + if (controller.gridster) { + const wrapper = $element[0]; + // Query element, but keep selector order + const element = _.chain(attr.gridsterAutoHeight.split(',')) + .map(selector => wrapper.querySelector(selector)) + .filter(_.isObject) + .first() .value(); + if (element) { + const childrenBounds = _.chain(element.children) + .map(child => child.getBoundingClientRect()) + .reduce((result, bounds) => ({ + left: Math.min(result.left, bounds.left), + top: Math.min(result.top, bounds.top), + right: Math.min(result.right, bounds.right), + bottom: Math.min(result.bottom, bounds.bottom), + })) + .value(); - const additionalHeight = 100 + _.last(controller.gridster.margins); - const contentsHeight = childrenBounds.bottom - childrenBounds.top; - $timeout(() => { - controller.sizeY = Math.ceil((contentsHeight + additionalHeight) / - controller.gridster.curRowHeight); - }); - } + const additionalHeight = 100 + _.last(controller.gridster.margins); + const contentsHeight = childrenBounds.bottom - childrenBounds.top; + $timeout(() => { + controller.sizeY = Math.ceil((contentsHeight + additionalHeight) / + controller.gridster.curRowHeight); + }); + } - if (!destroyed) { - requestAnimationFrame(updateHeight); + if (!destroyed) { + requestAnimationFrame(updateHeight); + } } } From 7d6244a3224da5e001ca2b5ba8003fdda5a4a748 Mon Sep 17 00:00:00 2001 From: Levko Kravets Date: Tue, 27 Feb 2018 18:25:57 +0200 Subject: [PATCH 3/3] Revisit default options; set auto-height for Table viz by default --- client/app/visualizations/cohort/index.js | 7 +++---- client/app/visualizations/table/index.js | 2 +- client/app/visualizations/word-cloud/index.js | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/app/visualizations/cohort/index.js b/client/app/visualizations/cohort/index.js index 6c1b3c9ee9..13a7ef6387 100644 --- a/client/app/visualizations/cohort/index.js +++ b/client/app/visualizations/cohort/index.js @@ -19,6 +19,8 @@ const DEFAULT_OPTIONS = { stageColumn: 'day_number', totalColumn: 'total', valueColumn: 'value', + + defaultRows: -1, }; function groupData(sortedData) { @@ -221,16 +223,13 @@ export default function init(ngModule) { ngModule.config((VisualizationProvider) => { const editTemplate = ''; - const defaultOptions = { - timeInterval: 'daily', - }; VisualizationProvider.registerVisualization({ type: 'COHORT', name: 'Cohort', renderTemplate: '', editorTemplate: editTemplate, - defaultOptions, + defaultOptions: DEFAULT_OPTIONS, }); }); } diff --git a/client/app/visualizations/table/index.js b/client/app/visualizations/table/index.js index d02499657c..3f87c3861f 100644 --- a/client/app/visualizations/table/index.js +++ b/client/app/visualizations/table/index.js @@ -19,7 +19,7 @@ const DISPLAY_AS_OPTIONS = [ const DEFAULT_OPTIONS = { itemsPerPage: 15, - defaultRows: 14, + defaultRows: -1, defaultColumns: 4, minColumns: 2, }; diff --git a/client/app/visualizations/word-cloud/index.js b/client/app/visualizations/word-cloud/index.js index e614352e9b..6668aeea38 100644 --- a/client/app/visualizations/word-cloud/index.js +++ b/client/app/visualizations/word-cloud/index.js @@ -97,12 +97,17 @@ export default function init(ngModule) { ngModule.directive('wordCloudEditor', wordCloudEditor); ngModule.directive('wordCloudRenderer', wordCloudRenderer); + const defaultOptions = { + defaultRows: -1, + }; + ngModule.config((VisualizationProvider) => { VisualizationProvider.registerVisualization({ type: 'WORD_CLOUD', name: 'Word Cloud', renderTemplate: '', editorTemplate: '', + defaultOptions, }); }); }