Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion R/run_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@
#' run_app(settings = "/path/to/settings.yaml", settings_version = "NCA draft")
#' }
#' @export

max_upload_size_mb <- 30

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: as you see this is cutting the roxygen docx (all that is before @export) which may produce a fail in geenerating the documentation. Instead, move this line right before:

options(shiny.maxRequestSize = max_upload_size_mb * 1024^2)

run_app <- function(datapath = NULL, settings = NULL,
settings_version = 1L, ...) {
# Increase max upload size to 30 MB
options(shiny.maxRequestSize = 30 * 1024^2)
options(shiny.maxRequestSize = max_upload_size_mb * 1024^2)
if (!is.null(datapath)) {
stopifnot(
"Data file does not exist" = file.exists(datapath),
Expand Down
5 changes: 4 additions & 1 deletion inst/shiny/modules/tab_data/data_upload.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ data_upload_ui <- function(id) {
div(
class = "upload-container",
id = ns("upload_container"),
p("Upload your PK dataset and Settings file (optional)."),
p("Upload your PK dataset and Settings file (optional).",
tags$br(),
tags$small(style = "color: #6c757d; display: block; margin-top: 4px;",
sprintf("Maximum upload size: %s MB", max_upload_size_mb))),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice idea! Having a single source of truth is always good. However, for an installed pacakge the max_upload_size_mb variable won't be available in this submodule.

I would recommend that we instead search for the value in the settings getOption("shiny.maxRequestSize", but in case for any reason run_app.R and the setting was not set (i.e, someone decided to run the App manually without using our function, shiny::runApp(...)) then we tell teh code to assume we are using the default that shiny has (5 MB). In code this will translate to this:

Suggested change
sprintf("Maximum upload size: %s MB", max_upload_size_mb))),
sprintf("Maximum upload size: %s MB",
getOption("shiny.maxRequestSize", 5 * 1024^2) / 1024^2))),

fileInput(
ns("data_upload"),
width = "50%",
Expand Down