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

Disable fork button for view_only user #2472

Merged
merged 3 commits into from
May 2, 2018

Conversation

tonyjiangh
Copy link
Contributor

@tonyjiangh tonyjiangh commented Apr 19, 2018

Fix #2459

Disabled view

image

With cursor disabled as well

Before/After

Permission Before (Show Data Only) After (Show Data Only) Before(Edit Source) After(Edit Source)
Creator/Admin Active Disabled Active Active
Full Access Active Disabled Active Active
View Only Active(returns 403 response) Disabled Active(returns 403 response) Disabled

Tested over Firefox 59.0.2

@@ -29,10 +29,12 @@

&:not([class*="bg-"]) {
& > li > a {
color: #4C4C4C;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@tonyjiangh I think, this is a better place for this CSS. @kocsmy - WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In addition - there is a variable for disabled dropdown items

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we have a disabled class for li already. We'll need to adjust the color a bit more gray to indicate it's disabled.

@arikfr
Copy link
Member

arikfr commented Apr 19, 2018

Thanks! Why disable it (for creator/admin) in data only mode?

@kravets-levko
Copy link
Collaborator

kravets-levko commented Apr 19, 2018

@arikfr As I see, @tonyjiangh didn't implement any new logic - he uses the same condition (query.id === undefined || !canForkQuery()), so Fork item will not be disabled in data only mode (as it works now). It's just a UI improvement - add style to indicate that item is disabled.

@tonyjiangh
Copy link
Contributor Author

tonyjiangh commented Apr 20, 2018

@kravets-levko
Thanks for the review. I'll try to fix the position for css.

@arikfr @kravets-levko
No, I didn't implement any new logic. But fork in data only mode will be disabled with the current version of this fix.
Here's why:
We're using client/app/pages/queries/view.js for data only view,
and client/app/pages/queries/source-view.js for query source view.
Currently $scope.canForkQuery() is only implemented for the later.

It thought this was intentional. But based on the conversation above, I guess it's not. I'll fix that too.

@tonyjiangh
Copy link
Contributor Author

Before/After

Permission Before (Show Data Only) After (Show Data Only) Before(Edit Source) After(Edit Source)
Creator/Admin Active Active Active Active
Full Access Active Active Active Active
View Only Active(returns 403 response) Disabled Active(returns 403 response) Disabled

Copy link
Collaborator

@kravets-levko kravets-levko left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@arikfr arikfr merged commit ee8f6c1 into getredash:master May 2, 2018
@arikfr
Copy link
Member

arikfr commented May 2, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants