re-added the report download option

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-12-18 11:26:00 +01:00
commit f07979e57c
No known key found for this signature in database
5 changed files with 97 additions and 15 deletions

View file

@ -2065,10 +2065,35 @@ ui_elements <- list(
class = "fa-spin",
"aria-hidden" = "true"
),
type = "primary",
type = "secondary",
auto_reset = TRUE
),
shiny::helpText("If you change the parameters, press 'Analyse' again to update the tables")
shiny::helpText("If you change the parameters, press 'Analyse' again to update the tables"),
# shiny::conditionalPanel(
# condition = "output.ready=='yes'",
shiny::tags$hr(),
shiny::h4("Download results"),
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
shiny::selectInput(
inputId = "output_type",
label = "Output format",
selected = NULL,
choices = list(
"Word" = "docx",
"LibreOffice" = "odt"
# ,
# "PDF" = "pdf",
# "All the above" = "all"
)
),
shiny::br(),
# Button
shiny::downloadButton(
outputId = "report",
label = "Download",
icon = shiny::icon("download")
)
# )
# )
),
bslib::nav_panel(
@ -2100,8 +2125,10 @@ ui_elements <- list(
# Initial attempt at creating light and dark versions
light <- custom_theme()
dark <- custom_theme(bg = "#000",
fg="#fff")
dark <- custom_theme(
bg = "#000",
fg = "#fff"
)
# Fonts to consider:
# https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/
@ -2190,7 +2217,7 @@ server <- function(input, output, session) {
ds = NULL,
input = exists("webResearch_data"),
local_temp = NULL,
quarto = NULL,
ready = NULL,
test = "no",
data_original = NULL,
data = NULL,
@ -2562,6 +2589,8 @@ server <- function(input, output, session) {
# patchwork::wrap_plots(ncol=1) +
# patchwork::plot_annotation(title = 'Multivariable regression model checks')
rv$ready <- "ready"
})
}
)
@ -2588,6 +2617,15 @@ server <- function(input, output, session) {
shiny::outputOptions(output, "uploaded", suspendWhenHidden = FALSE)
output$ready <- shiny::reactive({
if (is.null(rv$ready)) {
"no"
} else {
"yes"
}
})
shiny::outputOptions(output, "ready", suspendWhenHidden = FALSE)
# Reimplement from environment at later time
# output$has_input <- shiny::reactive({
@ -2610,7 +2648,7 @@ server <- function(input, output, session) {
content = function(file, type = input$output_type) {
## Notification is not progressing
## Presumably due to missing
shiny::withProgress(message = "Generating report. Hold on for a moment..", {
shiny::withProgress(message = "Generating the report. Hold on for a moment..", {
rv$list |>
write_quarto(
output_format = type,