From d01ad9e812fe575da1043a625256567cdbe789d2 Mon Sep 17 00:00:00 2001 From: Tom Jemmett Date: Thu, 6 Aug 2026 14:50:23 +0100 Subject: [PATCH 1/3] redirect the user to the progress app if a scenario has previously been submitted --- R/app_server.R | 41 ++++++++++++++++++++++++++++++----------- inst/config.yml | 3 +++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/R/app_server.R b/R/app_server.R index 610786a..e1f7deb 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -411,9 +411,26 @@ app_server <- function(input, output, session) { }) output$start_button <- shiny::renderUI({ - if (scenario_validation()) { + if (!scenario_validation()) { + return(NULL) + } + + p <- shiny::req(params_with_inputs()) + + if ( + input$scenario_type == "Edit existing" && + !is.null(p[["__inputs_app__"]][["model_run_id"]]) + ) { + # go to the model run progress app + url <- glue::glue( + get_config("model_run_progress_url"), + "?model_run_id={p[['dataset']]}/{p[['__inputs_app__']][['model_run_id']]}" + ) + + button_text <- "View Progress" + } else { f <- tempfile_name() - p <- shiny::req(params_with_inputs()) + # go to the inputs app jsonlite::write_json(p, f, pretty = TRUE, auto_unbox = TRUE) # used by the variable in get_config("app_url") @@ -425,16 +442,18 @@ app_server <- function(input, output, session) { utils::URLencode(basename(f)) ) - bslib::layout_columns( - col_widths = c(9, 3), - shiny::tags$span(), - shiny::tags$a( - "Start", - class = "btn btn-success text-white", - href = url - ) - ) + button_text <- "Start" } + + bslib::layout_columns( + col_widths = c(9, 3), + shiny::tags$span(), + shiny::tags$a( + button_text, + class = "btn btn-success text-white", + href = url + ) + ) }) |> shiny::bindEvent(filename(), params_with_inputs()) diff --git a/inst/config.yml b/inst/config.yml index a59e20f..76685aa 100644 --- a/inst/config.yml +++ b/inst/config.yml @@ -1,11 +1,14 @@ default: app_url: "http://localhost:8080/" params_data_path: "." + model_run_progress_url: "http://localhost:8081/" development: app_url: "/nhp/dev/inputs/" params_data_path: "/data/nhp/dev/inputs" + model_run_progress_url: "/nhp/model_run_progress/" production: app_url: "/nhp/{version}/inputs/" params_data_path: "/data/nhp/prod/inputs" + model_run_progress_url: "/nhp/model_run_progress/" From 0297536cb72c7c1ead184e2ecd55fb7c09936e31 Mon Sep 17 00:00:00 2001 From: Tom Jemmett Date: Fri, 7 Aug 2026 15:16:29 +0100 Subject: [PATCH 2/3] if we are creating a new scenario, we must remove the __inputs_app__ metadata --- R/app_server.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/app_server.R b/R/app_server.R index e1f7deb..0cada78 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -430,6 +430,10 @@ app_server <- function(input, output, session) { button_text <- "View Progress" } else { f <- tempfile_name() + if (input$scenario_type == "Create new from existing") { + # remove existing inputs app metadata + p[["__inputs_app__"]] <- NULL + } # go to the inputs app jsonlite::write_json(p, f, pretty = TRUE, auto_unbox = TRUE) From fd78b15d407ee2ef14fdf021d00263e6585462da Mon Sep 17 00:00:00 2001 From: Tom Jemmett Date: Mon, 10 Aug 2026 16:06:48 +0100 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- R/app_server.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/app_server.R b/R/app_server.R index 0cada78..796d957 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -419,6 +419,7 @@ app_server <- function(input, output, session) { if ( input$scenario_type == "Edit existing" && + !is.null(p[["__inputs_app__"]]) && !is.null(p[["__inputs_app__"]][["model_run_id"]]) ) { # go to the model run progress app