-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
1187 decorate output@main #1357
base: main
Are you sure you want to change the base?
Conversation
…er creation - some documentation - some todo's
@@ -315,7 +313,12 @@ modules <- function(..., label = "root") { | |||
|
|||
#' @rdname teal_modules | |||
#' @export | |||
format.teal_module <- function(x, indent = 0, ...) { | |||
format.teal_module <- function(x, ...) { |
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.
removed indent
from the module()
documentation. It is completely unnecessary to display indent
in the public docs.
R/module_nested_tabs.R
Outdated
@@ -262,7 +256,7 @@ srv_teal_module.teal_module <- function(id, | |||
) | |||
|
|||
is_transformer_failed <- reactiveValues() | |||
transformed_teal_data <- srv_transform_data( | |||
transformed_teal_data <- srv_teal_transform_module( |
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 think this name is more accurate and more straighforward.
teal_transform_module
is consumed by ui_teal_transform_module
and srv_teal_transform_module
R/modules.R
Outdated
@@ -48,14 +48,12 @@ setOldClass("teal_modules") | |||
#' @param server_args (named `list`) with additional arguments passed on to the server function. | |||
#' @param ui_args (named `list`) with additional arguments passed on to the UI function. | |||
#' @param x (`teal_module` or `teal_modules`) Object to format/print. | |||
#' @param indent (`integer(1)`) Indention level; each nested element is indented one level more. | |||
#' @param transformers (`list` of `teal_data_module`) that will be applied to transform the data. | |||
#' @param transformers (`list` of `teal_transform_module`) that will be applied to transform module's data input. |
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.
We need to rather link transformers
with decorators
and don't refer teal_transform_module
to teal_data_module
.
R/teal_transform_module.R
Outdated
#' Some [`teal_modules`] enables app developer to inject custom shiny module to modify displayed output. | ||
#' To handle these `decorators` inside of your module use [ui_teal_transform_module()] and [srv_teal_transform_module]. | ||
#' (todo: write more about how to handle decorators: they need to go through ui_args/srv_args and then be consumed by | ||
#' ui/srv_teal_transform_module()... . Alternatively, decorators could be a [module()]'s argument) |
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.
A reference to the vignette would be nice here :)
#' @description | ||
#' `r lifecycle::badge("experimental")` | ||
#' | ||
#' `teal_transform_module` creates a shiny-module to transform data in a `teal` application. |
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.
That's not entirely true, now it also supports output decoration!
#' # Decorating `teal` module's output | ||
#' | ||
#' `teal_transform_module`'s purpose is to modify any object created in [`teal.data::teal_data`]. It means that an | ||
#' app-developer can use `teal_transform_module` to modify data but also outputted tables, listings and graphs. |
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.
#' app-developer can use `teal_transform_module` to modify data but also outputted tables, listings and graphs. | |
#' app-developer can use `teal_transform_module` to modify not only data but also tables, listings and graphs. |
R/teal_transform_module.R
Outdated
#' `teal_transform_module`'s purpose is to modify any object created in [`teal.data::teal_data`]. It means that an | ||
#' app-developer can use `teal_transform_module` to modify data but also outputted tables, listings and graphs. | ||
#' Some [`teal_modules`] enables app developer to inject custom shiny module to modify displayed output. | ||
#' To handle these `decorators` inside of your module use [ui_teal_transform_module()] and [srv_teal_transform_module]. |
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.
#' To handle these `decorators` inside of your module use [ui_teal_transform_module()] and [srv_teal_transform_module]. | |
#' To handle these `decorators` inside of your module, use [ui_teal_transform_module()] and [srv_teal_transform_module]. |
#' ``` | ||
#' | ||
#' Above can be simplified to presented below, where `level` will be automatically substituted with | ||
#' respective input matched by its name. |
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.
#' respective input matched by its name. | |
#' the respective input matched by its name. |
R/teal_transform_module.R
Outdated
#' # `server` as a language | ||
#' | ||
#' Server function in `teal_transform_module` must return `reactive` containing [teal.data::teal_data] object. | ||
#' Consider sinmple transformer which doesn't require any advanced reactivity, example `server` might have a |
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.
#' Consider sinmple transformer which doesn't require any advanced reactivity, example `server` might have a | |
#' Consider a simple transformer, which doesn't require any advanced reactivity, example `server` might have a |
#' `shiny` module server function; that takes `id` and `data` argument, | ||
#' where the `id` is the module id and `data` is the reactive `teal_data` input. | ||
#' The server function must return reactive expression containing `teal_data` object. | ||
#' To simplify use [make_teal_transform_server()]. |
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.
#' To simplify use [make_teal_transform_server()]. | |
#' To simplify, use [make_teal_transform_server()]. |
#' | ||
#' A factory function to simplify creation of a [`teal_transform_module`]'s server. Specified `expr` | ||
#' is wrapped in a shiny module function and output can be passed to the `server` argument in | ||
#' [teal_transform_module()] call. Such server function can be linked with ui and values from the |
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.
#' [teal_transform_module()] call. Such server function can be linked with ui and values from the | |
#' [teal_transform_module()] call. Such a server function can be linked with ui and values from the |
#' app-developer can use `teal_transform_module` to modify data but also outputted tables, listings and graphs. | ||
#' Some [`teal_modules`] enables app developer to inject custom shiny module to modify displayed output. | ||
#' To handle these `decorators` inside of your module use [ui_teal_transform_module()] and [srv_teal_transform_module]. | ||
#' (todo: write more about how to handle decorators: they need to go through ui_args/srv_args and then be consumed by |
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.
You can write or you can just link to the vignette which contains an example of the proper handling. It's actually better to link than to write. Just add one sentence about - as a module developer, you can see to learn how to properly handle the decorators inside your module.
#' | ||
#' `teal_transform_module` creates a shiny-module to transform data in a `teal` application. | ||
#' | ||
#' # Transforming `teal` module's input |
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.
Might be good to mention the advantages of using the transform modules for these tasks. They come with error handling out of the box, etc. It's their biggest selling point and it's what stands them apart from just embedding app dev-supplied shiny modules into a module.
WIP
@kpagacz