Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dashboard list): do not show favorite star for anonymous users #18210 #19409

Conversation

dudasaron
Copy link
Contributor

@dudasaron dudasaron commented Mar 29, 2022

SUMMARY

A previous commit removed the FaveStar component and the id column with it from the dashboards list view for anonymous users. This broke the CERTIFIED filter because it also depends on the id column.
This PR re-adds the id column, but removes the favorite star and hides the column if the user is not logged in. Also removing the stars from the DashboardCard component if not applicable.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

Anonymous user, list/card view:
image

Logged in user, dashboard (for reference, not supposed to change):
image

Logged in user, list view (for reference, not supposed to change):
image

Logged in user, card view (for reference, not supposed to change):
image

After

Anonymous user, list view:
image

Anonymous user, card view:
image

Logged in user, dashboard (not supposed to change visually, but screenshot is included because some components are modified):
image

Logged in user, list view (not supposed to change visually, but screenshot is included because some components are modified):
image

Logged in user, card view (not supposed to change visually, but screenshot is included because some components are modified):
image

TESTING INSTRUCTIONS

Automated tests added for both logged in/anonymous cases for table and card view.

For manual testing add

PUBLIC_ROLE_LIKE = "Gamma"

to docker/pythonpath_dev/superset_config.py and run docker compose up.

Log in as admin and add the all datasource access on all_datasource_access and all database access on all_database_access permissions to the public role.

After logging out, navigate to http://localhost:3000/superset/dashboards/list and the dashboard list should open without an error and the CERTIFIED filter should work and the favorite star should not be present on the list view nor the table view. When logging in, the favorite star should be there.

ADDITIONAL INFORMATION

@dudasaron dudasaron marked this pull request as ready for review March 29, 2022 14:00
@dudasaron dudasaron force-pushed the fix/18210-list-view-invalid-filter-config-for-anonymous-user branch from eb597e6 to 34820b4 Compare March 30, 2022 09:28
@codecov
Copy link

codecov bot commented Mar 31, 2022

Codecov Report

Merging #19409 (305a262) into master (d304849) will increase coverage by 0.10%.
The diff coverage is 71.71%.

❗ Current head 305a262 differs from pull request most recent head ced4cea. Consider uploading reports for the commit ced4cea to get more accurate results

@@            Coverage Diff             @@
##           master   #19409      +/-   ##
==========================================
+ Coverage   66.48%   66.59%   +0.10%     
==========================================
  Files        1670     1677       +7     
  Lines       63965    64237     +272     
  Branches     6512     6538      +26     
==========================================
+ Hits        42528    42778     +250     
- Misses      19748    19764      +16     
- Partials     1689     1695       +6     
Flag Coverage Δ
javascript 51.34% <53.13%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ntrols/src/components/CertifiedIconWithTooltip.tsx 80.00% <ø> (ø)
...d/packages/superset-ui-chart-controls/src/index.ts 100.00% <ø> (ø)
...omponents/ColumnConfigControl/ColumnConfigItem.tsx 0.00% <ø> (ø)
...ugins/legacy-plugin-chart-calendar/src/Calendar.js 0.00% <ø> (ø)
...legacy-plugin-chart-calendar/src/ReactCalendar.jsx 0.00% <0.00%> (ø)
...cy-plugin-chart-calendar/src/vendor/cal-heatmap.js 0.00% <ø> (ø)
...plugins/legacy-plugin-chart-heatmap/src/Heatmap.js 0.00% <ø> (ø)
...s/legacy-plugin-chart-heatmap/src/ReactHeatmap.jsx 0.00% <0.00%> (ø)
...plugins/legacy-plugin-chart-rose/src/ReactRose.jsx 0.00% <0.00%> (ø)
...ntend/plugins/legacy-plugin-chart-rose/src/Rose.js 0.00% <0.00%> (ø)
... and 184 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d304849...ced4cea. Read the comment docs.

@@ -44,7 +44,7 @@ interface DashboardCardProps {
saveFavoriteStatus: (id: number, isStarred: boolean) => void;
favoriteStatus: boolean;
dashboardFilter?: string;
userId?: number;
userId?: string | number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! I don't think that this should ever be a string? Could you give me more context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it strange too, but it comes from already existing code: DashboardList.tsx:73 and I didn't want to dig deep into this for this PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be number. You can take note of it for a follow up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be number. You can take note of it for a follow up.

original: { id },
},
}: any) =>
userId ? (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this over userId &&

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, I'll change it

@dudasaron dudasaron force-pushed the fix/18210-list-view-invalid-filter-config-for-anonymous-user branch from 5254a95 to 2fc450c Compare April 1, 2022 17:29
@dudasaron dudasaron force-pushed the fix/18210-list-view-invalid-filter-config-for-anonymous-user branch from 2fc450c to ced4cea Compare April 1, 2022 17:29
Copy link
Member

@pkdotson pkdotson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -44,7 +44,7 @@ interface DashboardCardProps {
saveFavoriteStatus: (id: number, isStarred: boolean) => void;
favoriteStatus: boolean;
dashboardFilter?: string;
userId?: number;
userId?: string | number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be number. You can take note of it for a follow up.

@@ -44,7 +44,7 @@ interface DashboardCardProps {
saveFavoriteStatus: (id: number, isStarred: boolean) => void;
favoriteStatus: boolean;
dashboardFilter?: string;
userId?: number;
userId?: string | number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be number. You can take note of it for a follow up.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work @dudasaron ! Thanks not only for fixing this, but also cleaning up the code + adding tests ❤️

@villebro villebro merged commit b8891ac into apache:master Apr 4, 2022
@villebro villebro added the lts-v1 label Apr 4, 2022
villebro pushed a commit that referenced this pull request Apr 4, 2022
…8210 (#19409)

* fix: Only show favorite star on dashboard list if user is logged in #18210

* Fix linter errors

(cherry picked from commit b8891ac)
@crazamahdi
Copy link

crazamahdi commented Apr 6, 2022

Hey I am facing same error....please let me know how to fix that issue....i read the whole conversation but did not understand what changes to be done in config.py file.....I wrote PUBLIC_ROLE_LIKE = "Gamma" in config.py file then relaunched it through superset init but still i face the same unexpected error..ListViewError: Invalid filter config, id is not present in columns...pls Help me out @dudasaron or @villebro or anyone who knows how to fix this issue.

@dudasaron dudasaron deleted the fix/18210-list-view-invalid-filter-config-for-anonymous-user branch April 11, 2022 10:23
@dudasaron
Copy link
Contributor Author

Hi @crazamahdi, I think you were referring to the reproduction steps of the bug. What version are you using? This fix is only merged into master, but it's not yet part of any released version. If you don't have the time to wait until it makes into the official release, you can create a fork of the latest release of superset (1.4.2 as of now) and cherry pick the merge commit on top of that.

@crazamahdi
Copy link

Hi @crazamahdi, I think you were referring to the reproduction steps of the bug. What version are you using? This fix is only merged into master, but it's not yet part of any released version. If you don't have the time to wait until it makes into the official release, you can create a fork of the latest release of superset (1.4.2 as of now) and cherry pick the merge commit on top of that.

Hey thanks for your reply …I am using version 1.4.1…but I have superset version 1.4.1 on my local machine which works fine (running on http)…now when I installed the same version on my work machine(Aws instance Ubuntu 20) it throws me this unexpected error ListViewError….(while running on HTTPS)…I don’t understand how same version of superset is working on my local machine and not on my work machine….is it something related to HTTP and HTTPS? If so what changes should I do in config file to run it on https. For me I am not even able to login through admin…after entering credentials this unexpected error screen shows up

I tried installing, deleting and reinstalling various versions of superset on my work machine but everytime it throws some unexpected error….please help me out with this issue I tried resolving it for more than 4 days but no success yet@dudasaron

@chenshaojie
Copy link

Hi @crazamahdi, I think you were referring to the reproduction steps of the bug. What version are you using? This fix is only merged into master, but it's not yet part of any released version. If you don't have the time to wait until it makes into the official release, you can create a fork of the latest release of superset (1.4.2 as of now) and cherry pick the merge commit on top of that.

Hey thanks for your reply …I am using version 1.4.1…but I have superset version 1.4.1 on my local machine which works fine (running on http)…now when I installed the same version on my work machine(Aws instance Ubuntu 20) it throws me this unexpected error ListViewError….(while running on HTTPS)…I don’t understand how same version of superset is working on my local machine and not on my work machine….is it something related to HTTP and HTTPS? If so what changes should I do in config file to run it on https. For me I am not even able to login through admin…after entering credentials this unexpected error screen shows up

I tried installing, deleting and reinstalling various versions of superset on my work machine but everytime it throws some unexpected error….please help me out with this issue I tried resolving it for more than 4 days but no success yet@dudasaron

Hello, I took the liberty of disturbing, I am using the same version of the program, but I use centos, and now I am encountering the same problem as you, do you have a solution now? I found myself that even if I logged in, I would always stay on the first page of the previous page described by the author, similar to the refresh operation, but I myself used wechat to browse the web page, although there would be an operation described by the author, I could still log in and show two or three pictures of the previous page. Thank you very much.
Sorry, my English is not good, so use the translator for conversations, thank you very much for answering my questions

@crazamahdi
Copy link

Hey @chenshaojie I am still stuck at the same issue…hoping they release the fixed version soon. Got to know that issue is from their end and the fix is not yet officially released but committed to master branch. U can wait for release or u can try from GitHub directly. (If GitHub one works pls let me know too)
Thanks

@crazamahdi
Copy link

Hey @chenshaojie I finally managed to solved that error. Solve the login error by commenting the following lines in config.py file

Comment settings as below:

#SESSION_COOKIE_SAMESITE = "None"
#SESSION_COOKIE_SECURE = True

someone helped me with the solution on stack overflow.
and it worked well for me.

@chenshaojie
Copy link

chenshaojie commented Apr 24, 2022 via email

philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
…ache#18210 (apache#19409)

* fix: Only show favorite star on dashboard list if user is logged in apache#18210

* Fix linter errors
witcher-ke pushed a commit to Powerarena-Limited/superset that referenced this pull request Dec 27, 2022
…ache#18210 (apache#19409)

* fix: Only show favorite star on dashboard list if user is logged in apache#18210

* Fix linter errors
@mistercrunch mistercrunch added 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels lts-v1 size/L 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected error: ListViewError: Invalid filter config, id is not present in columns
7 participants