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 2022/07/21 12:12:43 UTC

[GitHub] [superset] kgabryje opened a new pull request, #20802: Fix/adhoc columns labels

kgabryje opened a new pull request, #20802:
URL: https://github.com/apache/superset/pull/20802

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   Fix adhoc columns not displaying properly. When user added an adhoc column the label was blank and on click an empty popover was showing up instead of prefilled with custom sql.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before:
   <img width="333" alt="image" src="https://user-images.githubusercontent.com/15073128/180207710-f4678de1-0f5f-480e-921f-3131d9aea188.png">
   
   After:
   <img width="331" alt="image" src="https://user-images.githubusercontent.com/15073128/180207623-d825d169-4805-4473-a446-63749391ddab.png">
   
   
   ### TESTING INSTRUCTIONS
   1. Add an adhoc column
   2. Verify that it displays correctly
   3. Click on the column to edit
   4. Verify that popover opens on Custom SQL tab with column's sql expression prefilled
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] kgabryje commented on a diff in pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
kgabryje commented on code in PR #20802:
URL: https://github.com/apache/superset/pull/20802#discussion_r926810822


##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.test.tsx:
##########
@@ -42,3 +44,19 @@ test('renders with value', () => {
   });
   expect(screen.getByText('Column A')).toBeInTheDocument();
 });
+
+test('renders adhoc column', () => {
+  render(
+    <DndColumnSelect
+      {...defaultProps}
+      value={{
+        sqlExpression: 'Count *',
+        label: 'adhoc metric',

Review Comment:
   Oops 😅 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20802:
URL: https://github.com/apache/superset/pull/20802#discussion_r926758796


##########
superset-frontend/packages/superset-ui-core/src/query/types/Column.ts:
##########
@@ -61,7 +62,7 @@ export function isAdhocColumn(column?: any): column is AdhocColumn {
     typeof column !== 'string' &&
     column?.sqlExpression !== undefined &&
     column?.label !== undefined &&
-    column?.expressionType === 'SQL'
+    (!isDefined(column?.expressionType) || column?.expressionType === 'SQL')

Review Comment:
   Maybe the same logic? 
   
   ```suggestion
   ....
     return (
       typeof column !== 'string' &&
       column?.label !== undefined &&
       (column?.expressionType === null || column?.expressionType === 'SQL')
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20802:
URL: https://github.com/apache/superset/pull/20802#discussion_r926766536


##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.test.tsx:
##########
@@ -42,3 +44,19 @@ test('renders with value', () => {
   });
   expect(screen.getByText('Column A')).toBeInTheDocument();
 });
+
+test('renders adhoc column', () => {
+  render(
+    <DndColumnSelect
+      {...defaultProps}
+      value={{
+        sqlExpression: 'Count *',
+        label: 'adhoc metric',

Review Comment:
   A little fussy.....
   ```javascript
           sqlExpression: 'foo || bar',
           label: 'adhoc column',
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] kgabryje merged pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
kgabryje merged PR #20802:
URL: https://github.com/apache/superset/pull/20802


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20802:
URL: https://github.com/apache/superset/pull/20802#discussion_r926767477


##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.test.tsx:
##########
@@ -42,3 +44,19 @@ test('renders with value', () => {
   });
   expect(screen.getByText('Column A')).toBeInTheDocument();
 });
+
+test('renders adhoc column', () => {
+  render(
+    <DndColumnSelect
+      {...defaultProps}
+      value={{
+        sqlExpression: 'Count *',
+        label: 'adhoc metric',
+        expressionType: 'SQL',
+      }}
+    />,
+    { useDnd: true },
+  );
+  expect(screen.getByText('adhoc metric')).toBeVisible();

Review Comment:
   ```suggestion
     expect(screen.getByText('adhoc column')).toBeVisible();
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20802:
URL: https://github.com/apache/superset/pull/20802#discussion_r926869122


##########
superset-frontend/packages/superset-ui-core/src/query/types/Column.ts:
##########
@@ -61,7 +62,7 @@ export function isAdhocColumn(column?: any): column is AdhocColumn {
     typeof column !== 'string' &&
     column?.sqlExpression !== undefined &&
     column?.label !== undefined &&
-    column?.expressionType === 'SQL'
+    (!isDefined(column?.expressionType) || column?.expressionType === 'SQL')

Review Comment:
   Oh, I got `sqlExpression` and `expressionType` mixed up. thanks for the fix.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20802:
URL: https://github.com/apache/superset/pull/20802#discussion_r926758796


##########
superset-frontend/packages/superset-ui-core/src/query/types/Column.ts:
##########
@@ -61,7 +62,7 @@ export function isAdhocColumn(column?: any): column is AdhocColumn {
     typeof column !== 'string' &&
     column?.sqlExpression !== undefined &&
     column?.label !== undefined &&
-    column?.expressionType === 'SQL'
+    (!isDefined(column?.expressionType) || column?.expressionType === 'SQL')

Review Comment:
   Maybe the same logic? 
   
   ```javascript
   ....
     return (
       typeof column !== 'string' &&
       column?.label !== undefined &&
       (column?.expressionType === null || column?.expressionType === 'SQL')
   )
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] sadpandajoe commented on pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
sadpandajoe commented on PR #20802:
URL: https://github.com/apache/superset/pull/20802#issuecomment-1192848727

   🏷️ preset:2022.29


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] codecov[bot] commented on pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #20802:
URL: https://github.com/apache/superset/pull/20802#issuecomment-1191455551

   # [Codecov](https://codecov.io/gh/apache/superset/pull/20802?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#20802](https://codecov.io/gh/apache/superset/pull/20802?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (dd0f921) into [master](https://codecov.io/gh/apache/superset/commit/3311128c5e6c5de2ea5d6a2dfeb01ea3179e9af8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3311128) will **increase** coverage by `0.00%`.
   > The diff coverage is `66.66%`.
   
   ```diff
   @@           Coverage Diff           @@
   ##           master   #20802   +/-   ##
   =======================================
     Coverage   66.29%   66.30%           
   =======================================
     Files        1758     1758           
     Lines       66799    66800    +1     
     Branches     7055     7056    +1     
   =======================================
   + Hits        44286    44292    +6     
   + Misses      20713    20710    -3     
   + Partials     1800     1798    -2     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `51.98% <66.66%> (+0.01%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/20802?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ackages/superset-ui-core/src/query/types/Column.ts](https://codecov.io/gh/apache/superset/pull/20802/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvQ29sdW1uLnRz) | `100.00% <ø> (ø)` | |
   | [...ols/DndColumnSelectControl/ColumnSelectPopover.tsx](https://codecov.io/gh/apache/superset/pull/20802/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL0NvbHVtblNlbGVjdFBvcG92ZXIudHN4) | `3.75% <0.00%> (ø)` | |
   | [...et-ui-chart-controls/src/components/labelUtils.tsx](https://codecov.io/gh/apache/superset/pull/20802/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY2hhcnQtY29udHJvbHMvc3JjL2NvbXBvbmVudHMvbGFiZWxVdGlscy50c3g=) | `100.00% <100.00%> (ø)` | |
   | [.../controls/DndColumnSelectControl/OptionWrapper.tsx](https://codecov.io/gh/apache/superset/pull/20802/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL09wdGlvbldyYXBwZXIudHN4) | `65.85% <0.00%> (+2.43%)` | :arrow_up: |
   | [...ols/DndColumnSelectControl/utils/optionSelector.ts](https://codecov.io/gh/apache/superset/pull/20802/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL3V0aWxzL29wdGlvblNlbGVjdG9yLnRz) | `37.93% <0.00%> (+13.79%)` | :arrow_up: |
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20802:
URL: https://github.com/apache/superset/pull/20802#discussion_r926758796


##########
superset-frontend/packages/superset-ui-core/src/query/types/Column.ts:
##########
@@ -61,7 +62,7 @@ export function isAdhocColumn(column?: any): column is AdhocColumn {
     typeof column !== 'string' &&
     column?.sqlExpression !== undefined &&
     column?.label !== undefined &&
-    column?.expressionType === 'SQL'
+    (!isDefined(column?.expressionType) || column?.expressionType === 'SQL')

Review Comment:
   Maybe the same logic? 
   
   ```javascript
   ....
     return (
       typeof column !== 'string' &&
       column?.label !== undefined &&
       (column?.expressionType === null || column?.expressionType === 'SQL')
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [superset] kgabryje commented on a diff in pull request #20802: fix(explore): Adhoc columns don't display correctly

Posted by GitBox <gi...@apache.org>.
kgabryje commented on code in PR #20802:
URL: https://github.com/apache/superset/pull/20802#discussion_r926812646


##########
superset-frontend/packages/superset-ui-core/src/query/types/Column.ts:
##########
@@ -61,7 +62,7 @@ export function isAdhocColumn(column?: any): column is AdhocColumn {
     typeof column !== 'string' &&
     column?.sqlExpression !== undefined &&
     column?.label !== undefined &&
-    column?.expressionType === 'SQL'
+    (!isDefined(column?.expressionType) || column?.expressionType === 'SQL')

Review Comment:
   I think we need to cover `undefined` here.  I'll change that to `column?.expressionType === undefined`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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