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 2021/02/15 17:29:35 UTC

[GitHub] [superset] simcha90 opened a new pull request #13137: refactor(self-trigger): Split native filters state

simcha90 opened a new pull request #13137:
URL: https://github.com/apache/superset/pull/13137


   ### SUMMARY
   Requires: https://github.com/apache-superset/superset-ui/pull/959
   This PR split `nativeFilters -> filtersState` to next subdomains:
   a. `native`: save data for native filters itself
   b. `cross`: save filter for cross filters functionality
   c. `own` every chart can save here custom data (like table plugin BE pagination: https://github.com/apache-superset/superset-ui/pull/959)
   
   Here we also re-trigger chart rendering if `own` `extraFormData` changed for some specific chart
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   https://user-images.githubusercontent.com/56388545/107977545-f71b4f00-6fc3-11eb-82ac-d7aaa0b5d7cf.mov
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [ ] 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] [superset] villebro commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584572488



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.tsx
##########
@@ -183,14 +177,10 @@ const FilterBar: React.FC<FiltersBarProps> = ({
   directPathToChild,
 }) => {
   const [filterData, setFilterData] = useState<{
-    [id: string]: {
-      extraFormData: ExtraFormData;
-      currentState: CurrentFilterState;
-    };
+    [filterId: string]: Omit<FilterState, 'id'>;

Review comment:
       ..this would also be cleaner with `id` being optional.

##########
File path: superset-frontend/src/dashboard/actions/nativeFilters.ts
##########
@@ -142,51 +138,49 @@ export const setFilterSetsConfiguration = (
   }
 };
 
-export const SET_EXTRA_FORM_DATA = 'SET_EXTRA_FORM_DATA';
-export interface SetExtraFormData {
-  type: typeof SET_EXTRA_FORM_DATA;
+export const UPDATE_EXTRA_FORM_DATA = 'UPDATE_EXTRA_FORM_DATA';
+export interface UpdateExtraFormData {
+  type: typeof UPDATE_EXTRA_FORM_DATA;
   filterId: string;
-  extraFormData: ExtraFormData;
-  currentState: CurrentFilterState;
+  nativeFilters?: Omit<FilterState, 'id'>;
+  crossFilters?: Omit<FilterState, 'id'>;
+  ownFilters?: Omit<FilterState, 'id'>;

Review comment:
       Would it make more sense to make `id` optional on `FilterState`?




----------------------------------------------------------------
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] [superset] simcha90 commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
simcha90 commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584679799



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.tsx
##########
@@ -183,14 +177,10 @@ const FilterBar: React.FC<FiltersBarProps> = ({
   directPathToChild,
 }) => {
   const [filterData, setFilterData] = useState<{
-    [id: string]: {
-      extraFormData: ExtraFormData;
-      currentState: CurrentFilterState;
-    };
+    [filterId: string]: Omit<FilterState, 'id'>;

Review comment:
       I think same thing :)




----------------------------------------------------------------
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] [superset] simcha90 commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
simcha90 commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584807497



##########
File path: superset-frontend/src/dashboard/reducers/nativeFilters.ts
##########
@@ -75,23 +91,41 @@ export function getInitialState({
   return state as NativeFiltersState;
 }
 
+const getUnitState = (
+  unitName: string,

Review comment:
       done




----------------------------------------------------------------
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] [superset] simcha90 commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
simcha90 commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584688381



##########
File path: superset-frontend/src/dashboard/actions/nativeFilters.ts
##########
@@ -142,51 +138,49 @@ export const setFilterSetsConfiguration = (
   }
 };
 
-export const SET_EXTRA_FORM_DATA = 'SET_EXTRA_FORM_DATA';
-export interface SetExtraFormData {
-  type: typeof SET_EXTRA_FORM_DATA;
+export const UPDATE_EXTRA_FORM_DATA = 'UPDATE_EXTRA_FORM_DATA';
+export interface UpdateExtraFormData {
+  type: typeof UPDATE_EXTRA_FORM_DATA;
   filterId: string;
-  extraFormData: ExtraFormData;
-  currentState: CurrentFilterState;
+  nativeFilters?: Omit<FilterState, 'id'>;
+  crossFilters?: Omit<FilterState, 'id'>;
+  ownFilters?: Omit<FilterState, 'id'>;

Review comment:
       I also think so :)




----------------------------------------------------------------
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] [superset] villebro commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584692820



##########
File path: superset-frontend/src/dashboard/reducers/nativeFilters.ts
##########
@@ -75,23 +91,41 @@ export function getInitialState({
   return state as NativeFiltersState;
 }
 
+const getUnitState = (
+  unitName: string,

Review comment:
       I think this could be clearer if `unitName` were an enum type, something like `FilterStateType`, after which this function could be renamed `getFilterState` and `unitName` would be just `type`.




----------------------------------------------------------------
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] [superset] villebro commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584682407



##########
File path: superset-frontend/src/dashboard/actions/nativeFilters.ts
##########
@@ -142,51 +138,49 @@ export const setFilterSetsConfiguration = (
   }
 };
 
-export const SET_EXTRA_FORM_DATA = 'SET_EXTRA_FORM_DATA';
-export interface SetExtraFormData {
-  type: typeof SET_EXTRA_FORM_DATA;
+export const UPDATE_EXTRA_FORM_DATA = 'UPDATE_EXTRA_FORM_DATA';
+export interface UpdateExtraFormData {
+  type: typeof UPDATE_EXTRA_FORM_DATA;
   filterId: string;
-  extraFormData: ExtraFormData;
-  currentState: CurrentFilterState;
+  nativeFilters?: Omit<FilterState, 'id'>;
+  crossFilters?: Omit<FilterState, 'id'>;
+  ownFilters?: Omit<FilterState, 'id'>;

Review comment:
       Ok, makes sense. Alternatively we might extend to something like `FilterStateWithId`, but that would probably be overkill 🙂 




----------------------------------------------------------------
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] [superset] villebro commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584505864



##########
File path: docker/pythonpath_dev/superset_config.py
##########
@@ -66,7 +66,10 @@ def get_env_variable(var_name, default=None):
 REDIS_RESULTS_DB = get_env_variable("REDIS_CELERY_DB", 1)
 
 RESULTS_BACKEND = FileSystemCache("/app/superset_home/sqllab")
-
+FEATURE_FLAGS = {
+    'DASHBOARD_NATIVE_FILTERS': True,
+    'DASHBOARD_CROSS_FILTERS': True,
+}

Review comment:
       These probably shouldn't be added yet

##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.tsx
##########
@@ -242,22 +232,19 @@ const FilterBar: React.FC<FiltersBarProps> = ({
 
   const handleFilterSelectionChange = (
     filter: Pick<Filter, 'id'> & Partial<Filter>,
-    extraFormData: ExtraFormData,
-    currentState: CurrentFilterState,
+    filtersState: DataMask,
   ) => {
+    // @ts-ignore

Review comment:
       This should probably be cleaned up in a follow-up PR (it seems we need to refine a few types in `superset-ui`)




----------------------------------------------------------------
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] [superset] codecov[bot] commented on pull request #13137: refactor(self-trigger): Split native filters state

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


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13137?src=pr&el=h1) Report
   > Merging [#13137](https://codecov.io/gh/apache/superset/pull/13137?src=pr&el=desc) (1a6978a) into [master](https://codecov.io/gh/apache/superset/commit/3c62069bbb0d07ff0194fbb159c2e04fd98fafc2?el=desc) (3c62069) will **decrease** coverage by `4.03%`.
   > The diff coverage is `63.42%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13137/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13137?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13137      +/-   ##
   ==========================================
   - Coverage   77.09%   73.05%   -4.04%     
   ==========================================
     Files         898      599     -299     
     Lines       45711    21147   -24564     
     Branches     5495     5491       -4     
   ==========================================
   - Hits        35241    15449   -19792     
   + Misses      10344     5571    -4773     
   - Partials      126      127       +1     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `57.95% <78.57%> (+0.32%)` | :arrow_up: |
   | hive | `?` | |
   | javascript | `62.75% <44.57%> (+0.18%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `?` | |
   | python | `?` | |
   | sqlite | `?` | |
   
   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/superset/pull/13137?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/chart/ChartContainer.jsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0Q29udGFpbmVyLmpzeA==) | `100.00% <ø> (ø)` | |
   | [superset-frontend/src/chart/ChartRenderer.jsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0UmVuZGVyZXIuanN4) | `76.00% <0.00%> (-1.03%)` | :arrow_down: |
   | [...rset-frontend/src/components/ButtonGroup/index.tsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvQnV0dG9uR3JvdXAvaW5kZXgudHN4) | `100.00% <ø> (ø)` | |
   | [...et-frontend/src/components/ErrorBoundary/index.jsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JCb3VuZGFyeS9pbmRleC5qc3g=) | `95.45% <ø> (ø)` | |
   | [...perset-frontend/src/components/FormLabel/index.tsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRm9ybUxhYmVsL2luZGV4LnRzeA==) | `100.00% <ø> (ø)` | |
   | [...-frontend/src/components/Select/Select.stories.tsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1NlbGVjdC5zdG9yaWVzLnRzeA==) | `0.00% <0.00%> (ø)` | |
   | [superset-frontend/src/components/Select/Select.tsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1NlbGVjdC50c3g=) | `90.81% <ø> (ø)` | |
   | [superset-frontend/src/components/Select/styles.tsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L3N0eWxlcy50c3g=) | `86.30% <ø> (ø)` | |
   | [...et-frontend/src/components/Timer/Timer.stories.tsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGltZXIvVGltZXIuc3Rvcmllcy50c3g=) | `0.00% <0.00%> (ø)` | |
   | [superset-frontend/src/components/Timer/index.tsx](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGltZXIvaW5kZXgudHN4) | `95.83% <ø> (ø)` | |
   | ... and [352 more](https://codecov.io/gh/apache/superset/pull/13137/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13137?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/superset/pull/13137?src=pr&el=footer). Last update [3c62069...c2fe5a0](https://codecov.io/gh/apache/superset/pull/13137?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] [superset] villebro merged pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
villebro merged pull request #13137:
URL: https://github.com/apache/superset/pull/13137


   


----------------------------------------------------------------
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] [superset] simcha90 closed pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
simcha90 closed pull request #13137:
URL: https://github.com/apache/superset/pull/13137


   


----------------------------------------------------------------
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] [superset] villebro commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584692820



##########
File path: superset-frontend/src/dashboard/reducers/nativeFilters.ts
##########
@@ -75,23 +91,41 @@ export function getInitialState({
   return state as NativeFiltersState;
 }
 
+const getUnitState = (
+  unitName: string,

Review comment:
       I think this could be clearerif `unitName` were an enum type, something like `FilterStateType`, after which this function could be renamed `getFilterState` and `unitName` would be just `type`.




----------------------------------------------------------------
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] [superset] simcha90 commented on a change in pull request #13137: refactor(self-trigger): Split native filters state

Posted by GitBox <gi...@apache.org>.
simcha90 commented on a change in pull request #13137:
URL: https://github.com/apache/superset/pull/13137#discussion_r584679656



##########
File path: superset-frontend/src/dashboard/actions/nativeFilters.ts
##########
@@ -142,51 +138,49 @@ export const setFilterSetsConfiguration = (
   }
 };
 
-export const SET_EXTRA_FORM_DATA = 'SET_EXTRA_FORM_DATA';
-export interface SetExtraFormData {
-  type: typeof SET_EXTRA_FORM_DATA;
+export const UPDATE_EXTRA_FORM_DATA = 'UPDATE_EXTRA_FORM_DATA';
+export interface UpdateExtraFormData {
+  type: typeof UPDATE_EXTRA_FORM_DATA;
   filterId: string;
-  extraFormData: ExtraFormData;
-  currentState: CurrentFilterState;
+  nativeFilters?: Omit<FilterState, 'id'>;
+  crossFilters?: Omit<FilterState, 'id'>;
+  ownFilters?: Omit<FilterState, 'id'>;

Review comment:
       this type we using for redux structure, so we must have `id` there, but for action we don't need it, so I preferred to use `Omit` instead create new type, we already have a lot of similar types




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