superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michel...@apache.org
Subject [incubator-superset] branch master updated: Dashboard filter box default (#6236)
Date Thu, 01 Nov 2018 16:43:13 GMT
This is an automated email from the ASF dual-hosted git repository.

michellet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new d34217e  Dashboard filter box default (#6236)
d34217e is described below

commit d34217ef9714452160bfb7e311e8fc21909ca7c3
Author: michellethomas <michelle.q.thomas@gmail.com>
AuthorDate: Thu Nov 1 09:43:04 2018 -0700

    Dashboard filter box default (#6236)
    
    * Setting default FilterBox date filter to No Filter
    
    * Adding test for FilterBox
---
 .../explore/visualizations/filter_box.js           | 25 ++++++++++++++++++++++
 .../explore/visualizations/index.test.js           |  2 ++
 .../src/visualizations/FilterBox/FilterBox.jsx     |  2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/superset/assets/cypress/integration/explore/visualizations/filter_box.js b/superset/assets/cypress/integration/explore/visualizations/filter_box.js
new file mode 100644
index 0000000..4bba77a
--- /dev/null
+++ b/superset/assets/cypress/integration/explore/visualizations/filter_box.js
@@ -0,0 +1,25 @@
+import { FORM_DATA_DEFAULTS } from './shared.helper';
+
+export default () => describe('FilterBox', () => {
+  const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'filter_box' };
+
+  function verify(formData) {
+    cy.visitChartByParams(JSON.stringify(formData));
+    cy.verifySliceSuccess({ waitAlias: '@getJson' });
+  }
+
+  beforeEach(() => {
+    cy.server();
+    cy.login();
+    cy.route('POST', '/superset/explore_json/**').as('getJson');
+  });
+
+  it('should work with default date filter', () => {
+    verify(VIZ_DEFAULTS);
+    // Filter box should default to having a date filter with no filter selected
+    cy.get('div.filter_box').within(() => {
+      cy.get('span').contains('No filter');
+    });
+  });
+
+});
diff --git a/superset/assets/cypress/integration/explore/visualizations/index.test.js b/superset/assets/cypress/integration/explore/visualizations/index.test.js
index 2f28083..7e140b1 100644
--- a/superset/assets/cypress/integration/explore/visualizations/index.test.js
+++ b/superset/assets/cypress/integration/explore/visualizations/index.test.js
@@ -5,6 +5,7 @@ import BubbleTest from './bubble';
 import CompareTest from './compare';
 import DistBarTest from './dist_bar';
 import DualLineTest from './dual_line';
+import FilterBox from './filter_box';
 import HistogramTest from './histogram';
 import LineTest from './line';
 import PieTest from './pie';
@@ -23,6 +24,7 @@ describe('All Visualizations', () => {
   CompareTest();
   DistBarTest();
   DualLineTest();
+  FilterBox();
   HistogramTest();
   LineTest();
   PieTest();
diff --git a/superset/assets/src/visualizations/FilterBox/FilterBox.jsx b/superset/assets/src/visualizations/FilterBox/FilterBox.jsx
index aa4071e..f5a63f2 100644
--- a/superset/assets/src/visualizations/FilterBox/FilterBox.jsx
+++ b/superset/assets/src/visualizations/FilterBox/FilterBox.jsx
@@ -123,7 +123,7 @@ class FilterBox extends React.Component {
               label={t('Time range')}
               description={t('Select start and end date')}
               onChange={(...args) => { this.changeFilter(TIME_RANGE, ...args); }}
-              value={this.state.selectedValues[TIME_RANGE]}
+              value={this.state.selectedValues[TIME_RANGE] || 'No filter'}
             />
           </div>
         </div>


Mime
View raw message