You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/07/16 20:29:56 UTC

[GitHub] hughhhh closed pull request #5375: Add `IS NOT NULL` and `IS NULL` as filter options

hughhhh closed pull request #5375: Add `IS NOT NULL` and `IS NULL` as filter options
URL: https://github.com/apache/incubator-superset/pull/5375
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/src/explore/AdhocFilter.js b/superset/assets/src/explore/AdhocFilter.js
index dfaef55209..dc3599c201 100644
--- a/superset/assets/src/explore/AdhocFilter.js
+++ b/superset/assets/src/explore/AdhocFilter.js
@@ -21,6 +21,8 @@ const OPERATORS_TO_SQL = {
   'not in': 'not in',
   LIKE: 'like',
   regex: 'regex',
+  'IS NOT NULL': 'IS NOT NULL',
+  'IS NULL': 'IS NULL',
 };
 
 function translateToSql(adhocMetric, { useSimple } = {}) {
@@ -84,6 +86,13 @@ export default class AdhocFilter {
 
   isValid() {
     if (this.expressionType === EXPRESSION_TYPES.SIMPLE) {
+      if (this.operator === 'IS NOT NULL' || this.operator === 'IS NULL') {
+        return !!(
+          this.operator &&
+          this.subject
+        );
+      }
+
       return !!(
         this.operator &&
         this.subject &&
diff --git a/superset/assets/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx b/superset/assets/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx
index 222772a464..94535cdea7 100644
--- a/superset/assets/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx
+++ b/superset/assets/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx
@@ -274,6 +274,7 @@ export default class AdhocFilterEditPopoverSimpleTabContent extends React.Compon
                 showHeader={false}
                 noResultsText={t('type a value here')}
                 refFunc={this.multiComparatorRef}
+                disabled={adhocFilter.operator === 'IS NOT NULL' || adhocFilter.operator === 'IS NULL'}
               /> :
               <input
                 ref={this.focusComparator}
diff --git a/superset/assets/src/explore/components/AdhocMetricEditPopover.jsx b/superset/assets/src/explore/components/AdhocMetricEditPopover.jsx
index 344e22a49c..d55105e06f 100644
--- a/superset/assets/src/explore/components/AdhocMetricEditPopover.jsx
+++ b/superset/assets/src/explore/components/AdhocMetricEditPopover.jsx
@@ -200,7 +200,6 @@ export default class AdhocMetricEditPopover extends React.Component {
 
     const stateIsValid = adhocMetric.isValid();
     const hasUnsavedChanges = !adhocMetric.equals(propsAdhocMetric);
-
     return (
       <Popover
         id="metrics-edit-popover"
diff --git a/superset/assets/src/explore/constants.js b/superset/assets/src/explore/constants.js
index 39d7063782..30e1565306 100644
--- a/superset/assets/src/explore/constants.js
+++ b/superset/assets/src/explore/constants.js
@@ -18,6 +18,8 @@ export const OPERATORS = {
   'not in': 'not in',
   LIKE: 'LIKE',
   regex: 'regex',
+  'IS NOT NULL': 'IS NOT NULL',
+  'IS NULL': 'IS NULL',
 };
 
 export const TABLE_ONLY_OPERATORS = [OPERATORS.LIKE];


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org