You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2020/10/27 04:48:29 UTC

[incubator-superset] branch master updated: fix: multiple issues with FilterPopover (#11412)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin 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 5b968e9  fix: multiple issues with FilterPopover (#11412)
5b968e9 is described below

commit 5b968e9651de93388eee338b32dad98b7df19047
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Oct 26 21:48:06 2020 -0700

    fix: multiple issues with FilterPopover (#11412)
    
    * fix: Custom SQL in FilterPopover
    
    * Also fix #11394
    
    * linting
    
    * fix tests
---
 .../cypress-base/cypress/integration/explore/advanced.test.ts    | 2 +-
 .../src/explore/components/AdhocFilterEditPopover.jsx            | 9 +++++----
 .../explore/components/AdhocFilterEditPopoverSqlTabContent.jsx   | 6 +++---
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/superset-frontend/cypress-base/cypress/integration/explore/advanced.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/advanced.test.ts
index b0504bd..c0ffbad 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/advanced.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/explore/advanced.test.ts
@@ -87,7 +87,7 @@ describe('Annotations', () => {
         .within(() => {
           cy.get('input').type('y=1400000');
         });
-      cy.get('button').contains('OK').click();
+      cy.get('button').contains('OK').click({ force: true });
     });
 
     cy.get('button[data-test="run-query-button"]').click();
diff --git a/superset-frontend/src/explore/components/AdhocFilterEditPopover.jsx b/superset-frontend/src/explore/components/AdhocFilterEditPopover.jsx
index a6650d4..34f885c 100644
--- a/superset-frontend/src/explore/components/AdhocFilterEditPopover.jsx
+++ b/superset-frontend/src/explore/components/AdhocFilterEditPopover.jsx
@@ -20,6 +20,7 @@ import React from 'react';
 import PropTypes from 'prop-types';
 import { Tab, Tabs } from 'react-bootstrap';
 import Button from 'src/components/Button';
+import { t } from '@superset-ui/core';
 
 import columnType from '../propTypes/columnType';
 import adhocMetricType from '../propTypes/adhocMetricType';
@@ -178,6 +179,9 @@ export default class AdhocFilterEditPopover extends React.Component {
           </Tab>
         </Tabs>
         <div>
+          <Button buttonSize="small" onClick={this.props.onClose} cta>
+            {t('Close')}
+          </Button>
           <Button
             data-test="adhoc-filter-edit-popover-save-button"
             disabled={!stateIsValid}
@@ -189,10 +193,7 @@ export default class AdhocFilterEditPopover extends React.Component {
             onClick={this.onSave}
             cta
           >
-            Save
-          </Button>
-          <Button buttonSize="small" onClick={this.props.onClose} cta>
-            Close
+            {t('Save')}
           </Button>
           <i
             role="button"
diff --git a/superset-frontend/src/explore/components/AdhocFilterEditPopoverSqlTabContent.jsx b/superset-frontend/src/explore/components/AdhocFilterEditPopoverSqlTabContent.jsx
index c8ea487..702c46d 100644
--- a/superset-frontend/src/explore/components/AdhocFilterEditPopoverSqlTabContent.jsx
+++ b/superset-frontend/src/explore/components/AdhocFilterEditPopoverSqlTabContent.jsx
@@ -68,7 +68,7 @@ export default class AdhocFilterEditPopoverSqlTabContent extends React.Component
   onSqlExpressionClauseChange(clause) {
     this.props.onChange(
       this.props.adhocFilter.duplicateWith({
-        clause: clause && clause.clause,
+        clause,
         expressionType: EXPRESSION_TYPES.SQL,
       }),
     );
@@ -123,9 +123,9 @@ export default class AdhocFilterEditPopoverSqlTabContent extends React.Component
             className="filter-edit-clause-dropdown"
           />
           <span className="filter-edit-clause-info">
-            <strong>Where</strong> filters by columns.
+            <strong>WHERE</strong> {t('filters by columns')}
             <br />
-            <strong>Having</strong> filters by metrics.
+            <strong>HAVING</strong> {t('filters by metrics')}
           </span>
         </FormGroup>
         <FormGroup>