-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
turn off on panel #91
Conversation
Does this close #84 - I guess you also need the trigger in FilteredDataAPI |
We also need to correctly (whatever that means) handle the case where the filter panel is disabled but the module developer calls the filter panel api to set states |
No, this is a button in the global scope not local. |
I'm aware there is a big filter panel UI change coming so not sure whether these should be done here or not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are missing, besides looks good to me
@@ -891,6 +945,12 @@ FilteredData <- R6::R6Class( # nolint | |||
# private attributes ---- | |||
filtered_datasets = list(), | |||
|
|||
# turn on / off filter panel | |||
filter_turn = TRUE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I dislike the "turn" term here. You can turn left/right or on/off. It's a verb whereas you are looking for a noun. I propose state / status / active instead. Please change other places as well including method docs.
-
What's the point of this field? I ask from the class simplicity point of view.
I can see that it's used in the api class - there is a check whether it's active and if yes then you can do set/get/etc. Is that needed? The functionality would be anyway disabled from the GUI perspective (vide: disabling inputs). What I am suggesting here is that the big disable/enable button would just propagate this action to all relevant inputs + save/restore action and that's it. An object would not store its state as this opens a door for unnecessary complexity I believe. I am happy to discuss it further if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default shinyWidgets::switchInput
use the logical(1) for value so this should not be surprising I stay with this type.
filter_turn
variable is needed only for filter_panel_api, so we could provide a proper warning if sb want to update the state when filter panel is turn off.
I like the Turn Off/On naming, although I see you agree with Nik in this area so please update to the one you are preferring.
R/FilteredData.R
Outdated
handlerExpr = { | ||
if (isTRUE(input[["filter_turn_onoff"]])) { | ||
self$filter_panel_enable() | ||
} else { | ||
self$filter_panel_disable() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to put all of shinyjs::disable/enable
calls here and use save/restore methods. This would keep shiny
functionalities nicely decoupled - methods relates only to data fields and shiny
parts lives inside the modules.
Moreover, I do not see (and I couldn't imagine) other place where we would call self$filter_panel_enable/disable()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"other place where we would call" - DRY rule is not the only reason to separate the code. Nice that you are raising it, please check how overcrowded is the server of filter panel now. WE should work to make it more clear and readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DRY rule is not the only reason to separate the code
Yes you are definitely right here but my first point remains.
Long time ago we have a lengthy discussions with @gogonzo and Konrad about decoupling shiny-related parts from the class definitions. Unfortunately there is no good design pattern and we decided to still keep it inside the class definition but only inside one module method or two ui/server methods. This indeed means that those the method(s) definitions would be lengthy but it also assures nice decoupling of class' methods from the shiny part which should serve just as an add-on which calls those methods. Separate shiny-methods would break that and make the code less separated.
R/FilteredData.R
Outdated
div( | ||
id = ns("switch-button"), | ||
class = "inline-block", | ||
shinyWidgets::switchInput( | ||
ns("filter_turn_onoff"), | ||
label = "TURN", | ||
value = TRUE, | ||
inline = FALSE, | ||
handleWidth = "80px" | ||
) | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please spend more time on UX here. IMO right now it is too maximal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the current UI as is obvious and the functionality important, please give me your idea then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, @kumamiao, can I also get your opinion on the wording 'On/Off' or 'Enabled/Disabled' for the button toggle? Which one do you think user will prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you - this is much better now! The screenshot you provided made me think about yet another idea - how about placing the switch next to the show/hide button (hamburger one). Those are conceptually functionalities affecting the same object - filter. WDYT? |
@pawelru very interesting proposition. I apply your proposition and I remove the text and leave it only as a title which will be printed on hover. I very like this scenario. with regular text: |
closes #84
Global toggle for Filter Panel, where the hidden state is recovered when turn on.
The PR is taken into account the filter_panel_api which is linked with it.