Skip to content

Commit d82b2c7

Browse files
committed
Gate downloads on analysis completion
1 parent 5a76cca commit d82b2c7

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎inst/shiny-app/app.R‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,16 @@ ui <- fluidPage(
6262

6363
# Download Results Section
6464
h3("3. Download Results"),
65-
downloadButton("downloadResults", "Download Results (.RDS)"),
66-
br(), br(),
67-
downloadButton("downloadReport", "Download Report (.txt)")
65+
conditionalPanel(
66+
condition = "output.analysisComplete",
67+
downloadButton("downloadResults", "Download Results (.RDS)"),
68+
br(), br(),
69+
downloadButton("downloadReport", "Download Report (.txt)")
70+
),
71+
conditionalPanel(
72+
condition = "!output.analysisComplete",
73+
helpText("Run the analysis to enable downloads.")
74+
)
6875
),
6976

7077
mainPanel(
@@ -366,6 +373,7 @@ server <- function(input, output, session) {
366373
paste0("kaefa_results_", Sys.Date(), ".RDS")
367374
},
368375
content = function(file) {
376+
req(values$analysisComplete)
369377
req(values$results)
370378
saveRDS(values$results, file)
371379
}
@@ -377,6 +385,7 @@ server <- function(input, output, session) {
377385
paste0("kaefa_report_", Sys.Date(), ".txt")
378386
},
379387
content = function(file) {
388+
req(values$analysisComplete)
380389
req(values$results)
381390

382391
sink(file)

0 commit comments

Comments
 (0)