You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/01/16 06:07:14 UTC

[superset] branch 1.0 updated (c4e6bae -> c38a5fc)

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

villebro pushed a change to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git.


    from c4e6bae  add rc3 changelog entries
     new 7e0eedc  fix: Popover closes on change of dropdowns values (#12410)
     new ae6e540  fix: Add MAX_SQL_ROW value to LIMIT_DROPDOWN (#12555)
     new 5786513  fix(viz): missing groupby and broken adhoc metrics for boxplot (#12556)
     new 147f750  fix: height on grid results (#12558)
     new c38a5fc  fix: case expression should not have double quotes (#12562)

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/SqlLab/components/SqlEditor.jsx            | 10 +--
 .../components/FilterableTable/FilterableTable.tsx | 74 +++++++++++-----------
 .../src/components/Select/OnPasteSelect.jsx        |  9 +--
 .../src/components/Select/SupersetStyledSelect.tsx | 17 ++++-
 .../dashboard/components/RefreshIntervalModal.tsx  |  1 +
 .../explore/components/controls/SelectControl.jsx  |  8 ++-
 .../src/visualizations/FilterBox/FilterBox.jsx     |  1 +
 superset/common/query_context.py                   |  3 +-
 superset/common/query_object.py                    |  6 +-
 superset/connectors/sqla/models.py                 |  3 +-
 .../configs/datasets/examples/FCC_2018_Survey.yaml | 26 ++++----
 11 files changed, 91 insertions(+), 67 deletions(-)


[superset] 04/05: fix: height on grid results (#12558)

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 147f750829c3c67889598b2d933f62e4a4b10aa5
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Fri Jan 15 13:54:55 2021 -0800

    fix: height on grid results (#12558)
---
 .../components/FilterableTable/FilterableTable.tsx | 74 +++++++++++-----------
 1 file changed, 38 insertions(+), 36 deletions(-)

diff --git a/superset-frontend/src/components/FilterableTable/FilterableTable.tsx b/superset-frontend/src/components/FilterableTable/FilterableTable.tsx
index 5b51f99..67bea7f 100644
--- a/superset-frontend/src/components/FilterableTable/FilterableTable.tsx
+++ b/superset-frontend/src/components/FilterableTable/FilterableTable.tsx
@@ -463,43 +463,45 @@ export default class FilterableTable extends PureComponent<
 
     // fix height of filterable table
     return (
-      <ScrollSync>
-        {({ onScroll, scrollTop }) => (
-          <div
-            style={{ height }}
-            className="filterable-table-container Table"
-            data-test="filterable-table-container"
-            ref={this.container}
-          >
-            <div className="LeftColumn">
-              <Grid
-                cellRenderer={this.renderGridCellHeader}
-                columnCount={orderedColumnKeys.length}
-                columnWidth={getColumnWidth}
-                height={rowHeight}
-                rowCount={1}
-                rowHeight={rowHeight}
-                scrollTop={scrollTop}
-                width={this.totalTableWidth}
-              />
-            </div>
-            <div className="RightColumn">
-              <Grid
-                cellRenderer={this.renderGridCell}
-                columnCount={orderedColumnKeys.length}
-                columnWidth={getColumnWidth}
-                height={totalTableHeight - rowHeight}
-                onScroll={onScroll}
-                overscanColumnCount={overscanColumnCount}
-                overscanRowCount={overscanRowCount}
-                rowCount={this.list.size}
-                rowHeight={rowHeight}
-                width={this.totalTableWidth}
-              />
+      <StyledFilterableTable>
+        <ScrollSync>
+          {({ onScroll, scrollTop }) => (
+            <div
+              style={{ height }}
+              className="filterable-table-container Table"
+              data-test="filterable-table-container"
+              ref={this.container}
+            >
+              <div className="LeftColumn">
+                <Grid
+                  cellRenderer={this.renderGridCellHeader}
+                  columnCount={orderedColumnKeys.length}
+                  columnWidth={getColumnWidth}
+                  height={rowHeight}
+                  rowCount={1}
+                  rowHeight={rowHeight}
+                  scrollTop={scrollTop}
+                  width={this.totalTableWidth}
+                />
+              </div>
+              <div className="RightColumn">
+                <Grid
+                  cellRenderer={this.renderGridCell}
+                  columnCount={orderedColumnKeys.length}
+                  columnWidth={getColumnWidth}
+                  height={totalTableHeight - rowHeight}
+                  onScroll={onScroll}
+                  overscanColumnCount={overscanColumnCount}
+                  overscanRowCount={overscanRowCount}
+                  rowCount={this.list.size}
+                  rowHeight={rowHeight}
+                  width={this.totalTableWidth}
+                />
+              </div>
             </div>
-          </div>
-        )}
-      </ScrollSync>
+          )}
+        </ScrollSync>
+      </StyledFilterableTable>
     );
   }
 


[superset] 01/05: fix: Popover closes on change of dropdowns values (#12410)

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 7e0eedccf88e82b56670d4c74b56ff6237937361
Author: Geido <60...@users.noreply.github.com>
AuthorDate: Thu Jan 14 19:33:20 2021 +0100

    fix: Popover closes on change of dropdowns values (#12410)
---
 .../src/components/Select/OnPasteSelect.jsx             |  9 ++-------
 .../src/components/Select/SupersetStyledSelect.tsx      | 17 +++++++++++++++--
 .../src/dashboard/components/RefreshIntervalModal.tsx   |  1 +
 .../src/explore/components/controls/SelectControl.jsx   |  8 ++++++--
 .../src/visualizations/FilterBox/FilterBox.jsx          |  1 +
 5 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/superset-frontend/src/components/Select/OnPasteSelect.jsx b/superset-frontend/src/components/Select/OnPasteSelect.jsx
index 5fcd597..e178a0a 100644
--- a/superset-frontend/src/components/Select/OnPasteSelect.jsx
+++ b/superset-frontend/src/components/Select/OnPasteSelect.jsx
@@ -76,13 +76,7 @@ export default class OnPasteSelect extends React.Component {
 
   render() {
     const { selectWrap: SelectComponent, ...restProps } = this.props;
-    return (
-      <SelectComponent
-        {...restProps}
-        onPaste={this.onPaste}
-        menuPortalTarget={document.body}
-      />
-    );
+    return <SelectComponent {...restProps} onPaste={this.onPaste} />;
   }
 }
 
@@ -98,6 +92,7 @@ OnPasteSelect.propTypes = {
   value: PropTypes.any,
   isValidNewOption: PropTypes.func,
   noResultsText: PropTypes.string,
+  forceOverflow: PropTypes.bool,
 };
 OnPasteSelect.defaultProps = {
   separator: [',', '\n', '\t', ';'],
diff --git a/superset-frontend/src/components/Select/SupersetStyledSelect.tsx b/superset-frontend/src/components/Select/SupersetStyledSelect.tsx
index fdbf5e2..20afd0e 100644
--- a/superset-frontend/src/components/Select/SupersetStyledSelect.tsx
+++ b/superset-frontend/src/components/Select/SupersetStyledSelect.tsx
@@ -91,6 +91,7 @@ export type SupersetStyledSelectProps<
   valueRenderedAsLabel?: boolean;
   // callback for paste event
   onPaste?: (e: SyntheticEvent) => void;
+  forceOverflow?: boolean;
   // for simplier theme overrides
   themeConfig?: PartialThemeConfig;
   stylesConfig?: PartialStylesConfig;
@@ -146,6 +147,7 @@ function styled<
       multi = false, // same as `isMulti`, used for backward compatibility
       clearable, // same as `isClearable`
       sortable = true, // whether to enable drag & drop sorting
+      forceOverflow, // whether the dropdown should be forcefully overflowing
 
       // react-select props
       className = DEFAULT_CLASS_NAME,
@@ -177,6 +179,7 @@ function styled<
         }
         return optionRenderer ? optionRenderer(option) : getOptionLabel(option);
       },
+
       ...restProps
     } = selectProps;
 
@@ -216,8 +219,6 @@ function styled<
       Object.assign(restProps, sortableContainerProps);
     }
 
-    stylesConfig.menuPortal = base => ({ ...base, zIndex: 9999 });
-
     // When values are rendered as labels, adjust valueContainer padding
     const valueRenderedAsLabel =
       valueRenderedAsLabel_ === undefined ? isMulti : valueRenderedAsLabel_;
@@ -243,6 +244,18 @@ function styled<
       });
     }
 
+    // handle forcing dropdown overflow
+    // use only when setting overflow:visible isn't possible on the container element
+    if (forceOverflow) {
+      Object.assign(restProps, {
+        closeMenuOnScroll: (e: Event) => {
+          const target = e.target as HTMLElement;
+          return target && !target.classList?.contains('Select__menu-list');
+        },
+        menuPosition: 'fixed',
+      });
+    }
+
     // Make sure always return StateManager for the refs.
     // To get the real `Select` component, keep tap into `obj.select`:
     //   - for normal <Select /> component: StateManager -> Select,
diff --git a/superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx b/superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx
index 0f77f00..9be1dd7 100644
--- a/superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx
+++ b/superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx
@@ -120,6 +120,7 @@ class RefreshIntervalModal extends React.PureComponent<
               options={options}
               value={{ value: refreshFrequency }}
               onChange={this.handleFrequencyChange}
+              forceOverflow
             />
             {showRefreshWarning && (
               <RefreshWarningContainer>
diff --git a/superset-frontend/src/explore/components/controls/SelectControl.jsx b/superset-frontend/src/explore/components/controls/SelectControl.jsx
index 62e0826..799ded9 100644
--- a/superset-frontend/src/explore/components/controls/SelectControl.jsx
+++ b/superset-frontend/src/explore/components/controls/SelectControl.jsx
@@ -56,6 +56,7 @@ const propTypes = {
   menuPortalTarget: PropTypes.element,
   menuPosition: PropTypes.string,
   menuPlacement: PropTypes.string,
+  forceOverflow: PropTypes.bool,
 };
 
 const defaultProps = {
@@ -218,7 +219,6 @@ export default class SelectControl extends React.PureComponent {
       filterOption,
       isLoading,
       menuPlacement,
-      menuPosition,
       name,
       noResultsText,
       onFocus,
@@ -227,6 +227,9 @@ export default class SelectControl extends React.PureComponent {
       value,
       valueKey,
       valueRenderer,
+      forceOverflow,
+      menuPortalTarget,
+      menuPosition,
     } = this.props;
 
     const optionsRemaining = this.optionsRemaining();
@@ -251,7 +254,8 @@ export default class SelectControl extends React.PureComponent {
       isMulti,
       labelKey: 'label',
       menuPlacement,
-      menuPortalTarget: document.body,
+      forceOverflow,
+      menuPortalTarget,
       menuPosition,
       name: `select-${name}`,
       noResultsText,
diff --git a/superset-frontend/src/visualizations/FilterBox/FilterBox.jsx b/superset-frontend/src/visualizations/FilterBox/FilterBox.jsx
index 9fea2c3..e87ebb9 100644
--- a/superset-frontend/src/visualizations/FilterBox/FilterBox.jsx
+++ b/superset-frontend/src/visualizations/FilterBox/FilterBox.jsx
@@ -402,6 +402,7 @@ class FilterBox extends React.PureComponent {
             : CreatableSelect
         }
         noResultsText={t('No results found')}
+        forceOverflow
       />
     );
   }


[superset] 05/05: fix: case expression should not have double quotes (#12562)

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit c38a5fc1d854fe565cbb6feaad6653f463655cac
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Fri Jan 15 15:33:21 2021 -0800

    fix: case expression should not have double quotes (#12562)
---
 .../configs/datasets/examples/FCC_2018_Survey.yaml | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/superset/examples/configs/datasets/examples/FCC_2018_Survey.yaml b/superset/examples/configs/datasets/examples/FCC_2018_Survey.yaml
index 81505cc..c7caea3 100644
--- a/superset/examples/configs/datasets/examples/FCC_2018_Survey.yaml
+++ b/superset/examples/configs/datasets/examples/FCC_2018_Survey.yaml
@@ -45,19 +45,19 @@ columns:
   type: STRING
   groupby: true
   filterable: true
-  expression: "CASE \n  WHEN school_degree = \"no high school (secondary school)\"\
-    \ THEN \"A. No high school (secondary school)\"\n  WHEN school_degree =  \"some\
-    \ high school\" THEN \"B. Some high school\"\n  WHEN school_degree = \"high school\
-    \ diploma or equivalent (GED)\" THEN \"C. High school diploma or equivalent (GED)\"\
-    \n  WHEN school_degree = \"associate's degree\" THEN \"D. Associate's degree\"\
-    \n  WHEN school_degree = \"some college credit, no degree\" THEN \"E. Some college\
-    \ credit, no degree\"\n  WHEN school_degree = \"bachelor's degree\" THEN \"F.\
-    \ Bachelor's degree\"\n  WHEN school_degree = \"trade, technical, or vocational\
-    \ training\" THEN \"G. Trade, technical, or vocational training\"\n  WHEN school_degree\
-    \ = \"master's degree (non-professional)\" THEN \"H. Master's degree (non-professional)\"\
-    \n  WHEN school_degree = \"Ph.D.\" THEN \"I. Ph.D.\"\n  WHEN school_degree = \"\
-    professional degree (MBA, MD, JD, etc.)\" THEN \"J. Professional degree (MBA,\
-    \ MD, JD, etc.)\"\nEND"
+  expression: "CASE \n  WHEN school_degree = 'no high school (secondary school)'\
+    \ THEN 'A. No high school (secondary school)'\n  WHEN school_degree =  'some\
+    \ high school' THEN 'B. Some high school'\n  WHEN school_degree = 'high school\
+    \ diploma or equivalent (GED)' THEN 'C. High school diploma or equivalent (GED)'\
+    \n  WHEN school_degree = 'associate''s degree' THEN 'D. Associate''s degree'\
+    \n  WHEN school_degree = 'some college credit, no degree' THEN 'E. Some college\
+    \ credit, no degree'\n  WHEN school_degree = 'bachelor''s degree' THEN 'F.\
+    \ Bachelor''s degree'\n  WHEN school_degree = 'trade, technical, or vocational\
+    \ training' THEN 'G. Trade, technical, or vocational training'\n  WHEN school_degree\
+    \ = 'master''s degree (non-professional)' THEN 'H. Master''s degree (non-professional)'\
+    \n  WHEN school_degree = 'Ph.D.' THEN 'I. Ph.D.'\n  WHEN school_degree = '\
+    professional degree (MBA, MD, JD, etc.)' THEN 'J. Professional degree (MBA,\
+    \ MD, JD, etc.)'\nEND"
   description: Highest Degree Earned
   python_date_format: null
 - column_name: job_location_preference


[superset] 02/05: fix: Add MAX_SQL_ROW value to LIMIT_DROPDOWN (#12555)

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit ae6e54025b8d84ab084240c7890f72879e0b9403
Author: Hugh A. Miles II <hu...@gmail.com>
AuthorDate: Fri Jan 15 18:00:33 2021 -0500

    fix: Add MAX_SQL_ROW value to LIMIT_DROPDOWN (#12555)
---
 superset-frontend/src/SqlLab/components/SqlEditor.jsx | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/SqlEditor.jsx b/superset-frontend/src/SqlLab/components/SqlEditor.jsx
index 75028ea..3b2e936 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor.jsx
@@ -539,9 +539,13 @@ class SqlEditor extends React.PureComponent {
   }
 
   renderQueryLimit() {
-    const menuDropdown = (
+    // Adding SQL_MAX_ROW value to dropdown
+    const { maxRow } = this.props;
+    LIMIT_DROPDOWN.push(maxRow);
+
+    return (
       <AntdMenu>
-        {LIMIT_DROPDOWN.map(limit => (
+        {[...new Set(LIMIT_DROPDOWN)].map(limit => (
           <AntdMenu.Item onClick={() => this.setQueryLimit(limit)}>
             {/* // eslint-disable-line no-use-before-define */}
             <a role="button" styling="link">
@@ -551,8 +555,6 @@ class SqlEditor extends React.PureComponent {
         ))}
       </AntdMenu>
     );
-
-    return menuDropdown;
   }
 
   renderEditorBottomBar() {


[superset] 03/05: fix(viz): missing groupby and broken adhoc metrics for boxplot (#12556)

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 5786513cbb39ffded6bd899f007209a233399384
Author: Jesse Yang <je...@airbnb.com>
AuthorDate: Fri Jan 15 17:03:12 2021 -0800

    fix(viz): missing groupby and broken adhoc metrics for boxplot (#12556)
---
 superset/common/query_context.py   | 3 ++-
 superset/common/query_object.py    | 6 +++++-
 superset/connectors/sqla/models.py | 3 ++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/superset/common/query_context.py b/superset/common/query_context.py
index a7900cf..0411007 100644
--- a/superset/common/query_context.py
+++ b/superset/common/query_context.py
@@ -142,7 +142,7 @@ class QueryContext:
     def df_metrics_to_num(df: pd.DataFrame, query_object: QueryObject) -> None:
         """Converting metrics to numeric when pandas.read_sql cannot"""
         for col, dtype in df.dtypes.items():
-            if dtype.type == np.object_ and col in query_object.metrics:
+            if dtype.type == np.object_ and col in query_object.metric_names:
                 df[col] = pd.to_numeric(df[col], errors="coerce")
 
     def get_data(self, df: pd.DataFrame,) -> Union[str, List[Dict[str, Any]]]:
@@ -166,6 +166,7 @@ class QueryContext:
         if self.result_type == utils.ChartDataResultType.SAMPLES:
             row_limit = query_obj.row_limit or math.inf
             query_obj = copy.copy(query_obj)
+            query_obj.is_timeseries = False
             query_obj.orderby = []
             query_obj.groupby = []
             query_obj.metrics = []
diff --git a/superset/common/query_object.py b/superset/common/query_object.py
index 43f7fee..cabbba6 100644
--- a/superset/common/query_object.py
+++ b/superset/common/query_object.py
@@ -28,7 +28,7 @@ from superset import app, is_feature_enabled
 from superset.exceptions import QueryObjectValidationError
 from superset.typing import Metric
 from superset.utils import pandas_postprocessing
-from superset.utils.core import DTTM_ALIAS, json_int_dttm_ser
+from superset.utils.core import DTTM_ALIAS, get_metric_names, json_int_dttm_ser
 from superset.utils.date_parser import get_since_until, parse_human_timedelta
 from superset.views.utils import get_time_range_endpoints
 
@@ -212,6 +212,10 @@ class QueryObject:
                         )
                     self.extras[field.new_name] = value
 
+    @property
+    def metric_names(self) -> List[str]:
+        return get_metric_names(self.metrics)
+
     def to_dict(self) -> Dict[str, Any]:
         query_object_dict = {
             "granularity": self.granularity,
diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 65c2a9f..d0887cd 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -993,6 +993,7 @@ class SqlaTable(  # pylint: disable=too-many-public-methods,too-many-instance-at
 
         time_range_endpoints = extras.get("time_range_endpoints")
         groupby_exprs_with_timestamp = OrderedDict(groupby_exprs_sans_timestamp.items())
+
         if granularity:
             dttm_col = columns_by_name[granularity]
             time_grain = extras.get("time_grain_sqla")
@@ -1032,7 +1033,7 @@ class SqlaTable(  # pylint: disable=too-many-public-methods,too-many-instance-at
 
         tbl = self.get_from_clause(template_processor)
 
-        if (is_sip_38 and metrics) or (not is_sip_38 and not columns):
+        if groupby_exprs_with_timestamp:
             qry = qry.group_by(*groupby_exprs_with_timestamp.values())
 
         where_clause_and = []