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 2020/07/16 01:56:47 UTC

[GitHub] [incubator-superset] nytai opened a new pull request #10335: feature: enabled SIP-34 listview filters for react CRUD

nytai opened a new pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335


   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   - api endpoint `/api/v1/database/schemas` for fetching list of schemas.
   - adds SIP-34 filters to datasets list view
   - removes `LIST_VIEWS_SIP34_FILTER_UI` feature flag
   - enabled SIP-34 filters for datasts, charts, dashboards, listview
   - moves `src/views/*` -> `src/views/CRUD/*` (eg, `src/views/datasetList/DatasetList.tsx` -> `src/views/CRUD/dataset/DatasetList.tsx` ) -- idea being that `src/views/CRUD` namespace can share code, ie, data fetching logic, state hooks, edit modals, delete modals, etc
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   <img width="843" alt="Screen Shot 2020-07-15 at 6 46 41 PM" src="https://user-images.githubusercontent.com/10255196/87617693-da850480-c6cc-11ea-9a66-a97a342c8c63.png">
   <img width="3008" alt="Screen Shot 2020-07-15 at 6 46 49 PM" src="https://user-images.githubusercontent.com/10255196/87617696-dbb63180-c6cc-11ea-910e-e7905d5fffef.png">
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   - unit tests pass
   - can filter on charts, dashboards, datasets list views
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [x] Changes UI: Behind `ENABLE_REACT_CRUD_VIEWS` flag
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [ ] 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.

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] [incubator-superset] mistercrunch edited a comment on pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
mistercrunch edited a comment on pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#issuecomment-662803307


   This looks amazing, let's get it through! 


----------------------------------------------------------------
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.

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] [incubator-superset] codecov-commenter commented on pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#issuecomment-659744559


   # [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=h1) Report
   > Merging [#10335](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/0eee6785a812cfa65276cd2bfbef08da8ff357f3&el=desc) will **decrease** coverage by `6.42%`.
   > The diff coverage is `37.86%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/10335/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #10335      +/-   ##
   ==========================================
   - Coverage   65.67%   59.24%   -6.43%     
   ==========================================
     Files         601      405     -196     
     Lines       32268    13247   -19021     
     Branches     3275     3253      -22     
   ==========================================
   - Hits        21191     7848   -13343     
   + Misses      10893     5215    -5678     
     Partials      184      184              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | #javascript | `59.24% <37.86%> (-0.36%)` | :arrow_down: |
   | #python | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/components/ListView/utils.ts](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTGlzdFZpZXcvdXRpbHMudHM=) | `75.00% <ø> (-8.15%)` | :arrow_down: |
   | [superset-frontend/src/featureFlags.ts](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2ZlYXR1cmVGbGFncy50cw==) | `84.61% <ø> (-1.10%)` | :arrow_down: |
   | [...uperset-frontend/src/views/CRUD/dataset/Button.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YXNldC9CdXR0b24udHN4) | `100.00% <ø> (ø)` | |
   | [superset-frontend/src/welcome/App.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3dlbGNvbWUvQXBwLnRzeA==) | `0.00% <0.00%> (ø)` | |
   | [superset-frontend/src/views/CRUD/utils.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvdXRpbHMudHN4) | `25.00% <25.00%> (ø)` | |
   | [...perset-frontend/src/views/CRUD/chart/ChartList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvY2hhcnQvQ2hhcnRMaXN0LnRzeA==) | `57.03% <33.33%> (ø)` | |
   | [...et-frontend/src/views/CRUD/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YXNldC9EYXRhc2V0TGlzdC50c3g=) | `62.17% <39.34%> (ø)` | |
   | [...rontend/src/views/CRUD/dashboard/DashboardList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGFzaGJvYXJkL0Rhc2hib2FyZExpc3QudHN4) | `63.77% <60.00%> (ø)` | |
   | [...rset-frontend/src/components/ListView/ListView.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTGlzdFZpZXcvTGlzdFZpZXcudHN4) | `98.14% <100.00%> (-0.16%)` | :arrow_down: |
   | [superset-frontend/src/components/Modal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTW9kYWwudHN4) | `94.44% <100.00%> (ø)` | |
   | ... and [197 more](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=footer). Last update [0eee678...b44cf7e](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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] [incubator-superset] codecov-commenter edited a comment on pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#issuecomment-659744559


   # [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=h1) Report
   > Merging [#10335](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/09dfbab7ed7cdb518109fa3fb093ce20d52fa8af&el=desc) will **decrease** coverage by `0.19%`.
   > The diff coverage is `47.61%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/10335/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #10335      +/-   ##
   ==========================================
   - Coverage   70.25%   70.05%   -0.20%     
   ==========================================
     Files         605      605              
     Lines       32425    32386      -39     
     Branches     3295     3270      -25     
   ==========================================
   - Hits        22781    22689      -92     
   - Misses       9535     9585      +50     
   - Partials      109      112       +3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | #cypress | `54.01% <ø> (-0.51%)` | :arrow_down: |
   | #javascript | `58.90% <28.73%> (-0.37%)` | :arrow_down: |
   | #python | `69.82% <89.74%> (+0.06%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...rc/components/ErrorMessage/TimeoutErrorMessage.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL1RpbWVvdXRFcnJvck1lc3NhZ2UudHN4) | `5.45% <0.00%> (ø)` | |
   | [superset-frontend/src/components/ListView/utils.ts](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTGlzdFZpZXcvdXRpbHMudHM=) | `75.00% <ø> (-8.15%)` | :arrow_down: |
   | [superset-frontend/src/featureFlags.ts](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2ZlYXR1cmVGbGFncy50cw==) | `100.00% <ø> (ø)` | |
   | [...uperset-frontend/src/views/CRUD/dataset/Button.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YXNldC9CdXR0b24udHN4) | `100.00% <ø> (ø)` | |
   | [superset-frontend/src/welcome/App.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3dlbGNvbWUvQXBwLnRzeA==) | `0.00% <0.00%> (ø)` | |
   | [superset/config.py](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `90.15% <ø> (ø)` | |
   | [...et-frontend/src/views/CRUD/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YXNldC9EYXRhc2V0TGlzdC50c3g=) | `61.20% <22.72%> (ø)` | |
   | [superset-frontend/src/views/CRUD/utils.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvdXRpbHMudHN4) | `25.00% <25.00%> (ø)` | |
   | [...perset-frontend/src/views/CRUD/chart/ChartList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvY2hhcnQvQ2hhcnRMaXN0LnRzeA==) | `57.36% <33.33%> (ø)` | |
   | [...rontend/src/views/CRUD/dashboard/DashboardList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGFzaGJvYXJkL0Rhc2hib2FyZExpc3QudHN4) | `64.06% <60.00%> (ø)` | |
   | ... and [18 more](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=footer). Last update [09dfbab...276f614](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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] [incubator-superset] codecov-commenter edited a comment on pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#issuecomment-659744559


   # [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=h1) Report
   > Merging [#10335](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/09dfbab7ed7cdb518109fa3fb093ce20d52fa8af&el=desc) will **decrease** coverage by `0.09%`.
   > The diff coverage is `47.61%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/10335/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #10335      +/-   ##
   ==========================================
   - Coverage   70.25%   70.16%   -0.10%     
   ==========================================
     Files         605      605              
     Lines       32425    32386      -39     
     Branches     3295     3270      -25     
   ==========================================
   - Hits        22781    22724      -57     
   - Misses       9535     9553      +18     
     Partials      109      109              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | #cypress | `54.51% <ø> (-0.01%)` | :arrow_down: |
   | #javascript | `58.90% <28.73%> (-0.37%)` | :arrow_down: |
   | #python | `69.82% <89.74%> (+0.06%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...rc/components/ErrorMessage/TimeoutErrorMessage.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL1RpbWVvdXRFcnJvck1lc3NhZ2UudHN4) | `5.45% <0.00%> (ø)` | |
   | [superset-frontend/src/components/ListView/utils.ts](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTGlzdFZpZXcvdXRpbHMudHM=) | `75.00% <ø> (-8.15%)` | :arrow_down: |
   | [superset-frontend/src/featureFlags.ts](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2ZlYXR1cmVGbGFncy50cw==) | `100.00% <ø> (ø)` | |
   | [...uperset-frontend/src/views/CRUD/dataset/Button.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YXNldC9CdXR0b24udHN4) | `100.00% <ø> (ø)` | |
   | [superset-frontend/src/welcome/App.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3dlbGNvbWUvQXBwLnRzeA==) | `0.00% <0.00%> (ø)` | |
   | [superset/config.py](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `90.15% <ø> (ø)` | |
   | [...et-frontend/src/views/CRUD/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YXNldC9EYXRhc2V0TGlzdC50c3g=) | `61.20% <22.72%> (ø)` | |
   | [superset-frontend/src/views/CRUD/utils.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvdXRpbHMudHN4) | `25.00% <25.00%> (ø)` | |
   | [...perset-frontend/src/views/CRUD/chart/ChartList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvY2hhcnQvQ2hhcnRMaXN0LnRzeA==) | `57.36% <33.33%> (ø)` | |
   | [...rontend/src/views/CRUD/dashboard/DashboardList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGFzaGJvYXJkL0Rhc2hib2FyZExpc3QudHN4) | `64.06% <60.00%> (ø)` | |
   | ... and [10 more](https://codecov.io/gh/apache/incubator-superset/pull/10335/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=footer). Last update [09dfbab...276f614](https://codecov.io/gh/apache/incubator-superset/pull/10335?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

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] [incubator-superset] nytai commented on a change in pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
nytai commented on a change in pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#discussion_r460310881



##########
File path: superset-frontend/src/views/CRUD/dataset/DatasetList.tsx
##########
@@ -69,128 +66,191 @@ interface DatasetListProps {
   addDangerToast: (msg: string) => void;
   addSuccessToast: (msg: string) => void;
 }
+interface Database {
+  allow_csv_upload: boolean;
+  allow_ctas: boolean;
+  allow_cvas: null | boolean;
+  allow_dml: boolean;
+  allow_multi_schema_metadata_fetch: boolean;
+  allow_run_async: boolean;
+  allows_cost_estimate: boolean;
+  allows_subquery: boolean;
+  allows_virtual_table_explore: boolean;
+  backend: string;
+  database_name: string;
+  explore_database_id: number;
+  expose_in_sqllab: boolean;
+  force_ctas_schema: null | boolean;
+  function_names: string[];
+  id: number;
+}
+
+const createFetchDatabases = (handleError: (err: Response) => void) => async (
+  filterValue = '',
+  pageIndex?: number,
+  pageSize?: number,
+) => {
+  const resourceEndpoint = `/api/v1/database/`;
+
+  try {
+    const queryParams = rison.encode({
+      columns: ['database_name', 'id'],
+      keys: ['none'],
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ database_name: label, id: value }: Database) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);

Review comment:
       yea I should probably move to using `handleError` in these views. Will look into a followup PR for doing that as it'll require some testing. 




----------------------------------------------------------------
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.

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] [incubator-superset] rusackas commented on a change in pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
rusackas commented on a change in pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#discussion_r460288698



##########
File path: superset-frontend/src/views/CRUD/dataset/DatasetList.tsx
##########
@@ -69,128 +66,191 @@ interface DatasetListProps {
   addDangerToast: (msg: string) => void;
   addSuccessToast: (msg: string) => void;
 }
+interface Database {
+  allow_csv_upload: boolean;
+  allow_ctas: boolean;
+  allow_cvas: null | boolean;
+  allow_dml: boolean;
+  allow_multi_schema_metadata_fetch: boolean;
+  allow_run_async: boolean;
+  allows_cost_estimate: boolean;
+  allows_subquery: boolean;
+  allows_virtual_table_explore: boolean;
+  backend: string;
+  database_name: string;
+  explore_database_id: number;
+  expose_in_sqllab: boolean;
+  force_ctas_schema: null | boolean;
+  function_names: string[];
+  id: number;
+}
+
+const createFetchDatabases = (handleError: (err: Response) => void) => async (
+  filterValue = '',
+  pageIndex?: number,
+  pageSize?: number,
+) => {
+  const resourceEndpoint = `/api/v1/database/`;
+
+  try {
+    const queryParams = rison.encode({
+      columns: ['database_name', 'id'],
+      keys: ['none'],
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ database_name: label, id: value }: Database) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);

Review comment:
       In cases like this, I'd be A-OK with a one-line `eslint-ignore` here so we stop getting the warnings about completely intentional console errors.

##########
File path: superset-frontend/src/views/CRUD/chart/ChartList.tsx
##########
@@ -49,16 +43,31 @@ interface State {
   bulkSelectEnabled: boolean;
   chartCount: number;
   charts: any[];
-  filterOperators: FilterOperatorMap;
-  filters: Filters;
   lastFetchDataConfig: FetchDataConfig | null;
   loading: boolean;
   permissions: string[];
   // for now we need to use the Slice type defined in PropertiesModal.
   // In future it would be better to have a unified Chart entity.
   sliceCurrentlyEditing: Slice | null;
 }
+const createFetchDatasets = (
+  handleError: (err: Response) => void,
+) => async () => {
+  const resource = '/api/v1/chart/datasources';
+  try {
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resource}`,

Review comment:
       ```suggestion
         endpoint: resource,
   ```
   Actually, you might not even need the variable, unless you like it for cleanliness. Could just be 
   ```
     endpoint: '/api/v1/chart/datasources',
   ```

##########
File path: superset-frontend/src/views/CRUD/dataset/DatasetList.tsx
##########
@@ -69,128 +66,191 @@ interface DatasetListProps {
   addDangerToast: (msg: string) => void;
   addSuccessToast: (msg: string) => void;
 }
+interface Database {
+  allow_csv_upload: boolean;
+  allow_ctas: boolean;
+  allow_cvas: null | boolean;
+  allow_dml: boolean;
+  allow_multi_schema_metadata_fetch: boolean;
+  allow_run_async: boolean;
+  allows_cost_estimate: boolean;
+  allows_subquery: boolean;
+  allows_virtual_table_explore: boolean;
+  backend: string;
+  database_name: string;
+  explore_database_id: number;
+  expose_in_sqllab: boolean;
+  force_ctas_schema: null | boolean;
+  function_names: string[];
+  id: number;
+}
+
+const createFetchDatabases = (handleError: (err: Response) => void) => async (
+  filterValue = '',
+  pageIndex?: number,
+  pageSize?: number,
+) => {
+  const resourceEndpoint = `/api/v1/database/`;
+
+  try {
+    const queryParams = rison.encode({
+      columns: ['database_name', 'id'],
+      keys: ['none'],
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,

Review comment:
       Same totally optional nit, but you could simplify with 
   ```
         endpoint: `/api/v1/database/?q=${queryParams}`,
   ```

##########
File path: superset-frontend/src/views/CRUD/dataset/DatasetList.tsx
##########
@@ -69,128 +66,191 @@ interface DatasetListProps {
   addDangerToast: (msg: string) => void;
   addSuccessToast: (msg: string) => void;
 }
+interface Database {
+  allow_csv_upload: boolean;
+  allow_ctas: boolean;
+  allow_cvas: null | boolean;
+  allow_dml: boolean;
+  allow_multi_schema_metadata_fetch: boolean;
+  allow_run_async: boolean;
+  allows_cost_estimate: boolean;
+  allows_subquery: boolean;
+  allows_virtual_table_explore: boolean;
+  backend: string;
+  database_name: string;
+  explore_database_id: number;
+  expose_in_sqllab: boolean;
+  force_ctas_schema: null | boolean;
+  function_names: string[];
+  id: number;
+}
+
+const createFetchDatabases = (handleError: (err: Response) => void) => async (
+  filterValue = '',
+  pageIndex?: number,
+  pageSize?: number,
+) => {
+  const resourceEndpoint = `/api/v1/database/`;
+
+  try {
+    const queryParams = rison.encode({
+      columns: ['database_name', 'id'],
+      keys: ['none'],
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(

Review comment:
       I still get a little excited when I see or use these operators.

##########
File path: superset-frontend/src/views/CRUD/dataset/DatasetList.tsx
##########
@@ -69,128 +66,191 @@ interface DatasetListProps {
   addDangerToast: (msg: string) => void;
   addSuccessToast: (msg: string) => void;
 }
+interface Database {
+  allow_csv_upload: boolean;
+  allow_ctas: boolean;
+  allow_cvas: null | boolean;
+  allow_dml: boolean;
+  allow_multi_schema_metadata_fetch: boolean;
+  allow_run_async: boolean;
+  allows_cost_estimate: boolean;
+  allows_subquery: boolean;
+  allows_virtual_table_explore: boolean;
+  backend: string;
+  database_name: string;
+  explore_database_id: number;
+  expose_in_sqllab: boolean;
+  force_ctas_schema: null | boolean;
+  function_names: string[];
+  id: number;
+}
+
+const createFetchDatabases = (handleError: (err: Response) => void) => async (
+  filterValue = '',
+  pageIndex?: number,
+  pageSize?: number,
+) => {
+  const resourceEndpoint = `/api/v1/database/`;
+
+  try {
+    const queryParams = rison.encode({
+      columns: ['database_name', 'id'],
+      keys: ['none'],
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ database_name: label, id: value }: Database) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);
+    handleError(e);
+  }
+  return [];
+};
 
+export const createFetchSchemas = (
+  handleError: (error: Response) => void,
+) => async (filterValue = '', pageIndex?: number, pageSize?: number) => {
+  const resourceEndpoint = `/api/v1/database/schemas/`;
+
+  try {
+    const queryParams = rison.encode({
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ text: label, value }: { text: string; value: any }) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);
+    handleError(e);
+  }
+  return [];
+};
 const DatasetList: FunctionComponent<DatasetListProps> = ({
   addDangerToast,
   addSuccessToast,
 }) => {
-  const [databases, setDatabases] = useState<{ text: string; value: number }[]>(
-    [],
-  );
   const [datasetCount, setDatasetCount] = useState(0);
   const [datasetCurrentlyDeleting, setDatasetCurrentlyDeleting] = useState<
     (Dataset & { chart_count: number; dashboard_count: number }) | null
   >(null);
   const [datasets, setDatasets] = useState<any[]>([]);
-  const [currentFilters, setCurrentFilters] = useState<Filters>([]);
-  const [filterOperators, setFilterOperators] = useState<FilterOperatorMap>();
   const [
     lastFetchDataConfig,
     setLastFetchDataConfig,
   ] = useState<FetchDataConfig | null>(null);
   const [loading, setLoading] = useState(true);
-  const [currentOwners, setCurrentOwners] = useState<
-    { text: string; value: number }[]
-  >([]);
   const [permissions, setPermissions] = useState<string[]>([]);
 
   const [datasetAddModalOpen, setDatasetAddModalOpen] = useState<boolean>(
     false,
   );
   const [bulkSelectEnabled, setBulkSelectEnabled] = useState<boolean>(false);
 
-  const updateFilters = () => {
-    const convertFilter = ({
-      name: label,
-      operator,
-    }: {
-      name: string;
-      operator: string;
-    }) => ({ label, value: operator });
-    if (filterOperators) {
-      setCurrentFilters([
-        {
-          Header: 'Database',
-          id: 'database',
-          input: 'select',
-          operators: filterOperators.database.map(convertFilter),
-          selects: databases.map(({ text: label, value }) => ({
-            label,
-            value,
-          })),
-        },
-        {
-          Header: 'Schema',
-          id: 'schema',
-          operators: filterOperators.schema.map(convertFilter),
-        },
-        {
-          Header: 'Table Name',
-          id: 'table_name',
-          operators: filterOperators.table_name.map(convertFilter),
-        },
-        {
-          Header: 'Owners',
-          id: 'owners',
-          input: 'select',
-          operators: filterOperators.owners.map(convertFilter),
-          selects: currentOwners.map(({ text: label, value }) => ({
-            label,
-            value,
-          })),
-        },
-        {
-          Header: 'SQL Lab View',
-          id: 'is_sqllab_view',
-          input: 'checkbox',
-          operators: filterOperators.is_sqllab_view.map(convertFilter),
-        },
-      ]);
-    }
-  };
+  const filterTypes: Filters = [
+    {
+      Header: t('Owner'),
+      id: 'owners',
+      input: 'select',
+      operator: 'rel_m_m',
+      unfilteredLabel: 'All',
+      fetchSelects: createFetchOwners('dataset', e =>
+        addDangerToast(
+          t(
+            'An error occurred while fetching databaser owner values: %s',

Review comment:
       ```suggestion
               'An error occurred while fetching database owner values: %s',
   ```

##########
File path: superset-frontend/src/views/CRUD/dataset/DatasetList.tsx
##########
@@ -69,128 +66,191 @@ interface DatasetListProps {
   addDangerToast: (msg: string) => void;
   addSuccessToast: (msg: string) => void;
 }
+interface Database {
+  allow_csv_upload: boolean;
+  allow_ctas: boolean;
+  allow_cvas: null | boolean;
+  allow_dml: boolean;
+  allow_multi_schema_metadata_fetch: boolean;
+  allow_run_async: boolean;
+  allows_cost_estimate: boolean;
+  allows_subquery: boolean;
+  allows_virtual_table_explore: boolean;
+  backend: string;
+  database_name: string;
+  explore_database_id: number;
+  expose_in_sqllab: boolean;
+  force_ctas_schema: null | boolean;
+  function_names: string[];
+  id: number;
+}
+
+const createFetchDatabases = (handleError: (err: Response) => void) => async (
+  filterValue = '',
+  pageIndex?: number,
+  pageSize?: number,
+) => {
+  const resourceEndpoint = `/api/v1/database/`;
+
+  try {
+    const queryParams = rison.encode({
+      columns: ['database_name', 'id'],
+      keys: ['none'],
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ database_name: label, id: value }: Database) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);
+    handleError(e);
+  }
+  return [];
+};
 
+export const createFetchSchemas = (
+  handleError: (error: Response) => void,
+) => async (filterValue = '', pageIndex?: number, pageSize?: number) => {
+  const resourceEndpoint = `/api/v1/database/schemas/`;
+
+  try {
+    const queryParams = rison.encode({
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ text: label, value }: { text: string; value: any }) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);
+    handleError(e);
+  }
+  return [];
+};
 const DatasetList: FunctionComponent<DatasetListProps> = ({
   addDangerToast,
   addSuccessToast,
 }) => {
-  const [databases, setDatabases] = useState<{ text: string; value: number }[]>(
-    [],
-  );
   const [datasetCount, setDatasetCount] = useState(0);
   const [datasetCurrentlyDeleting, setDatasetCurrentlyDeleting] = useState<
     (Dataset & { chart_count: number; dashboard_count: number }) | null
   >(null);
   const [datasets, setDatasets] = useState<any[]>([]);
-  const [currentFilters, setCurrentFilters] = useState<Filters>([]);
-  const [filterOperators, setFilterOperators] = useState<FilterOperatorMap>();
   const [
     lastFetchDataConfig,
     setLastFetchDataConfig,
   ] = useState<FetchDataConfig | null>(null);
   const [loading, setLoading] = useState(true);
-  const [currentOwners, setCurrentOwners] = useState<
-    { text: string; value: number }[]
-  >([]);
   const [permissions, setPermissions] = useState<string[]>([]);
 
   const [datasetAddModalOpen, setDatasetAddModalOpen] = useState<boolean>(
     false,
   );
   const [bulkSelectEnabled, setBulkSelectEnabled] = useState<boolean>(false);
 
-  const updateFilters = () => {
-    const convertFilter = ({
-      name: label,
-      operator,
-    }: {
-      name: string;
-      operator: string;
-    }) => ({ label, value: operator });
-    if (filterOperators) {
-      setCurrentFilters([
-        {
-          Header: 'Database',
-          id: 'database',
-          input: 'select',
-          operators: filterOperators.database.map(convertFilter),
-          selects: databases.map(({ text: label, value }) => ({
-            label,
-            value,
-          })),
-        },
-        {
-          Header: 'Schema',
-          id: 'schema',
-          operators: filterOperators.schema.map(convertFilter),
-        },
-        {
-          Header: 'Table Name',
-          id: 'table_name',
-          operators: filterOperators.table_name.map(convertFilter),
-        },
-        {
-          Header: 'Owners',
-          id: 'owners',
-          input: 'select',
-          operators: filterOperators.owners.map(convertFilter),
-          selects: currentOwners.map(({ text: label, value }) => ({
-            label,
-            value,
-          })),
-        },
-        {
-          Header: 'SQL Lab View',
-          id: 'is_sqllab_view',
-          input: 'checkbox',
-          operators: filterOperators.is_sqllab_view.map(convertFilter),
-        },
-      ]);
-    }
-  };
+  const filterTypes: Filters = [
+    {
+      Header: t('Owner'),
+      id: 'owners',
+      input: 'select',
+      operator: 'rel_m_m',
+      unfilteredLabel: 'All',
+      fetchSelects: createFetchOwners('dataset', e =>
+        addDangerToast(
+          t(
+            'An error occurred while fetching databaser owner values: %s',

Review comment:
       ```suggestion
               'An error occurred while fetching database owners: %s',
   ```

##########
File path: superset-frontend/src/views/CRUD/utils.tsx
##########
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { SupersetClient } from '@superset-ui/connection';
+import rison from 'rison';
+
+export const createFetchOwners = (
+  resource: string,
+  handleError: (error: Response) => void,
+) => async (filterValue = '', pageIndex?: number, pageSize?: number) => {
+  const resourceEndpoint = `/api/v1/${resource}/related/owners`;

Review comment:
       Just curious if this is worth abstracting for any foreseeable future use, e.g. `createFetchRelatedModel(resource, relation)`
   ...
    ```const resourceEndpoint = `/api/v1/${resource}/related/${relation}/`;```
   

##########
File path: superset-frontend/src/views/CRUD/dataset/DatasetList.tsx
##########
@@ -69,128 +66,191 @@ interface DatasetListProps {
   addDangerToast: (msg: string) => void;
   addSuccessToast: (msg: string) => void;
 }
+interface Database {
+  allow_csv_upload: boolean;
+  allow_ctas: boolean;
+  allow_cvas: null | boolean;
+  allow_dml: boolean;
+  allow_multi_schema_metadata_fetch: boolean;
+  allow_run_async: boolean;
+  allows_cost_estimate: boolean;
+  allows_subquery: boolean;
+  allows_virtual_table_explore: boolean;
+  backend: string;
+  database_name: string;
+  explore_database_id: number;
+  expose_in_sqllab: boolean;
+  force_ctas_schema: null | boolean;
+  function_names: string[];
+  id: number;
+}
+
+const createFetchDatabases = (handleError: (err: Response) => void) => async (
+  filterValue = '',
+  pageIndex?: number,
+  pageSize?: number,
+) => {
+  const resourceEndpoint = `/api/v1/database/`;
+
+  try {
+    const queryParams = rison.encode({
+      columns: ['database_name', 'id'],
+      keys: ['none'],
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ database_name: label, id: value }: Database) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);

Review comment:
       ...and/or having the handleError method do that for you.

##########
File path: superset-frontend/src/views/CRUD/dataset/DatasetList.tsx
##########
@@ -69,128 +66,191 @@ interface DatasetListProps {
   addDangerToast: (msg: string) => void;
   addSuccessToast: (msg: string) => void;
 }
+interface Database {
+  allow_csv_upload: boolean;
+  allow_ctas: boolean;
+  allow_cvas: null | boolean;
+  allow_dml: boolean;
+  allow_multi_schema_metadata_fetch: boolean;
+  allow_run_async: boolean;
+  allows_cost_estimate: boolean;
+  allows_subquery: boolean;
+  allows_virtual_table_explore: boolean;
+  backend: string;
+  database_name: string;
+  explore_database_id: number;
+  expose_in_sqllab: boolean;
+  force_ctas_schema: null | boolean;
+  function_names: string[];
+  id: number;
+}
+
+const createFetchDatabases = (handleError: (err: Response) => void) => async (
+  filterValue = '',
+  pageIndex?: number,
+  pageSize?: number,
+) => {
+  const resourceEndpoint = `/api/v1/database/`;
+
+  try {
+    const queryParams = rison.encode({
+      columns: ['database_name', 'id'],
+      keys: ['none'],
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ database_name: label, id: value }: Database) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);
+    handleError(e);
+  }
+  return [];
+};
 
+export const createFetchSchemas = (
+  handleError: (error: Response) => void,
+) => async (filterValue = '', pageIndex?: number, pageSize?: number) => {
+  const resourceEndpoint = `/api/v1/database/schemas/`;
+
+  try {
+    const queryParams = rison.encode({
+      ...(pageIndex ? { page: pageIndex } : {}),
+      ...(pageSize ? { page_ize: pageSize } : {}),
+      ...(filterValue ? { filter: filterValue } : {}),
+    });
+    const { json = {} } = await SupersetClient.get({
+      endpoint: `${resourceEndpoint}?q=${queryParams}`,
+    });
+
+    return json?.result?.map(
+      ({ text: label, value }: { text: string; value: any }) => ({
+        label,
+        value,
+      }),
+    );
+  } catch (e) {
+    console.error(e);
+    handleError(e);

Review comment:
       Again, the handleError method could spit out the console error rather than just swallowing the error.




----------------------------------------------------------------
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.

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] [incubator-superset] bkyryliuk commented on pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
bkyryliuk commented on pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#issuecomment-659821981


   can't wait to see it live!


----------------------------------------------------------------
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.

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] [incubator-superset] rusackas commented on pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
rusackas commented on pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#issuecomment-679292461


   Impacts #8976


----------------------------------------------------------------
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.

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] [incubator-superset] dpgaspar commented on a change in pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#discussion_r456599279



##########
File path: superset/databases/api.py
##########
@@ -265,3 +275,87 @@ def select_star(
             return self.response(404, message="Table not found on the database")
         self.incr_stats("success", self.select_star.__name__)
         return self.response(200, result=result)
+
+    @expose("/schemas/", methods=["GET"])
+    @protect()
+    @safe
+    @statsd_metrics
+    @rison(get_schemas_schema)
+    def schemas(self, **kwargs: Any) -> FlaskResponse:
+        """Get all schemas
+        ---
+        get:
+          parameters:
+          - in: query
+            name: q
+            content:
+              application/json:
+                schema:
+                  type: object
+                  properties:
+                    page_size:
+                      type: integer
+                    page:
+                      type: integer
+                    filter:
+                      type: string
+          responses:
+            200:
+              description: Related column data
+              content:
+                application/json:
+                  schema:
+                    type: object
+                    properties:
+                      count:
+                        type: integer
+                      result:
+                        type: object
+                        properties:
+                          value:
+                            type: string
+                          text:
+                            type: string

Review comment:
       Here also, declare a marshmallow schema for the response and reference that. Register your schema on OpenAPI using `openapi_spec_component_schemas` FAB attr

##########
File path: superset/databases/api.py
##########
@@ -265,3 +275,87 @@ def select_star(
             return self.response(404, message="Table not found on the database")
         self.incr_stats("success", self.select_star.__name__)
         return self.response(200, result=result)
+
+    @expose("/schemas/", methods=["GET"])
+    @protect()
+    @safe
+    @statsd_metrics
+    @rison(get_schemas_schema)
+    def schemas(self, **kwargs: Any) -> FlaskResponse:
+        """Get all schemas
+        ---
+        get:
+          parameters:
+          - in: query
+            name: q
+            content:
+              application/json:
+                schema:
+                  type: object
+                  properties:
+                    page_size:
+                      type: integer
+                    page:
+                      type: integer
+                    filter:
+                      type: string

Review comment:
       It's nicer to use a reference here to the schema, so we don't have to repeat ourselfs. Take a look at: https://github.com/apache/incubator-superset/blob/master/superset/charts/api.py#L502
   




----------------------------------------------------------------
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.

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] [incubator-superset] nytai closed pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
nytai closed pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335


   


----------------------------------------------------------------
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.

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] [incubator-superset] nytai commented on a change in pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
nytai commented on a change in pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#discussion_r460311290



##########
File path: superset-frontend/src/views/CRUD/utils.tsx
##########
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { SupersetClient } from '@superset-ui/connection';
+import rison from 'rison';
+
+export const createFetchOwners = (
+  resource: string,
+  handleError: (error: Response) => void,
+) => async (filterValue = '', pageIndex?: number, pageSize?: number) => {
+  const resourceEndpoint = `/api/v1/${resource}/related/owners`;

Review comment:
       yup, will look into doing that. Hoping to have some common functions/hooks shared between the various listviews related to error handling, data fetching, permission checking, etc.  




----------------------------------------------------------------
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.

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] [incubator-superset] mistercrunch commented on pull request #10335: feat(listviews): SIP-34 filters for charts, dashboards, datasets

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on pull request #10335:
URL: https://github.com/apache/incubator-superset/pull/10335#issuecomment-662803307


   This looks amazing, let's get it through! Looks like you're one cypress test away :)


----------------------------------------------------------------
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.

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