Skip to content

Disable / Enable attrs based on custom config #956

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

Merged
merged 4 commits into from
Sep 16, 2019
Merged

Disable / Enable attrs based on custom config #956

merged 4 commits into from
Sep 16, 2019

Conversation

VeraZab
Copy link
Contributor

@VeraZab VeraZab commented Sep 3, 2019

I don't think I want to quite include the full whitelisting functionality in this pr. It can be a foundation for it, but more thought would have to be put into it, and it's not really the core of the functionality that we need atm.

Just to show an example of a case, say you enable very few attributes (just 'colorway' for example). Then you get situations like this:
Screen Shot 2019-09-05 at 4 53 56 PM

Where you have a panel that can add annotations, but nothing can be edited. It seems odd, feels like that menu item should not even be there. Thoughts @nicolaskruchten ?

@VeraZab
Copy link
Contributor Author

VeraZab commented Sep 5, 2019

this is the commit i'd like to double check my logic on: 6f8473f

I think what I've done is the right thing to do, but maybe we could discuss this tomorrow

@nicolaskruchten
Copy link
Contributor

So when excluding color specifically we want to be able to say "yes to column mapping but no to specific color choosing" e.g.

image

@nicolaskruchten
Copy link
Contributor

Similarly we want to be able to say "constant vs variable" but just hide the color-picker widget:

image

@nicolaskruchten
Copy link
Contributor

maybe we need to do widget-type-matching. like color-picker and font-family.

@nicolaskruchten
Copy link
Contributor

what happened to the image dropzone thing?

@VeraZab
Copy link
Contributor Author

VeraZab commented Sep 10, 2019

I don't know if it's just atm that it's slow, but we just went from 60 snapshots to 252, so these tests will be taking significantly longer now..

return false;
}

export function computeCustomConfigVisibility(props, fullValue, customConfig, wrappedComponent) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to notHiddenByCustomConfig ?

Copy link
Contributor

Choose a reason for hiding this comment

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

or notHiddenByCustomVisibilityRules ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but the outcome of this function can be true or false for visibility

Copy link
Contributor

Choose a reason for hiding this comment

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

the "positive" version of this is permittedByCustomVisibilityRules

@VeraZab
Copy link
Contributor Author

VeraZab commented Sep 16, 2019

I think I addressed all the comments, please let me know if I can merge and release @nicolaskruchten.


it('HIDES Field based on customConfig', () =>
expect(wrapper.find('input').length).toEqual(0));
it('SHOWS PlotlySection if it has an attr that is accepted by customConfig', () =>
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this section be hidden because it's empty?

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 could make it so, if i remove a part of the current logic that we have: https://github.com/plotly/react-chart-editor/blob/master/src/components/containers/PlotlySection.js#L51
(the || , just make it return if there's no child)

It didn't seem necessary for the current config we're trying to get right, and it's previously existing logic, that is not entirely false. (I mean it appears because we did put an attr, that is accepted by customConfig on a PlotlySection)

Copy link
Contributor

Choose a reason for hiding this comment

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

to make this test easier to understand, can we make it such that there is another widget in the section with the same attr as the section?

@nicolaskruchten
Copy link
Contributor

💃

@VeraZab VeraZab merged commit 87e4c5d into master Sep 16, 2019
@VeraZab VeraZab deleted the disable branch September 16, 2019 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants