Skip to content

Commit

Permalink
add waiters show/hide to all R Code Download (#351)
Browse files Browse the repository at this point in the history
* add waiters show/hide to all R Code Download

* added explicit waiter; tried as reactive with waiter <- reactive({Waiter$new}) and then waiter()$show - did not work
  • Loading branch information
LeaSeep authored Oct 30, 2024
1 parent cb9095b commit d55da9a
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 5 deletions.
7 changes: 7 additions & 0 deletions program/shinyApp/R/enrichment_analysis/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ enrichment_analysis_geneset_server <- function(
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
# tmp <- getUserReactiveValues(input)
# par_tmp$Enrichment[names(tmp)] <<- tmp
envList <- list(
Expand Down Expand Up @@ -81,6 +87,7 @@ enrichment_analysis_geneset_server <- function(
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down
7 changes: 7 additions & 0 deletions program/shinyApp/R/heatmap/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ heatmap_server <- function(id, data, params, updates){
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
envList <- list(
res_tmp = res_tmp[[session$token]],
par_tmp = par_tmp[[session$token]]
Expand Down Expand Up @@ -310,6 +316,7 @@ heatmap_server <- function(id, data, params, updates){
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down
31 changes: 29 additions & 2 deletions program/shinyApp/R/pca/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,17 @@ pca_Server <- function(id, data, params, row_select){
par_tmp[[session$token]]$PCA[names(tmp)] <<- tmp
par_tmp[[session$token]]$PCA$colorTheme <<- colorTheme



output$getR_Code_PCA <- downloadHandler(
filename = function(){
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
envList <- list(
res_tmp = res_tmp[[session$token]],
par_tmp = par_tmp[[session$token]]
Expand All @@ -496,7 +500,9 @@ pca_Server <- function(id, data, params, row_select){
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},

contentType = "application/zip"
)

Expand Down Expand Up @@ -576,6 +582,12 @@ pca_Server <- function(id, data, params, row_select){
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()

envList <- list(
res_tmp = res_tmp[[session$token]],
Expand All @@ -594,6 +606,7 @@ pca_Server <- function(id, data, params, row_select){
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down Expand Up @@ -653,6 +666,12 @@ pca_Server <- function(id, data, params, row_select){
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
envList <- list(

res_tmp = res_tmp[[session$token]],
Expand All @@ -671,6 +690,7 @@ pca_Server <- function(id, data, params, row_select){
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down Expand Up @@ -738,6 +758,12 @@ pca_Server <- function(id, data, params, row_select){
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
envList <- list(

res_tmp = res_tmp[[session$token]],
Expand All @@ -756,6 +782,7 @@ pca_Server <- function(id, data, params, row_select){
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down
7 changes: 7 additions & 0 deletions program/shinyApp/R/sample_correlation/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ sample_correlation_server <- function(id, data, params){
output$getR_SampleCorrelation <- downloadHandler(
filename = function(){ paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
envList <- list(

res_tmp = res_tmp[[session$token]],
Expand All @@ -182,6 +188,7 @@ sample_correlation_server <- function(id, data, params){
files = dir(temp_directory),
root = temp_directory
)
waiter$hdie()
},
contentType = "application/zip"
)
Expand Down
7 changes: 7 additions & 0 deletions program/shinyApp/R/significance_analysis/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,12 @@ significance_analysis_server <- function(id, data, params){
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
tmp <- getUserReactiveValues(input)
par_tmp[[session$token]]$SigAna[names(tmp)] <<- tmp

Expand Down Expand Up @@ -578,6 +584,7 @@ significance_analysis_server <- function(id, data, params){
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down
28 changes: 28 additions & 0 deletions program/shinyApp/R/significance_analysis/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ create_new_tab_manual <- function(title, targetPanel, result, contrast, alpha, n
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
tmp <- getUserReactiveValues(input)
par_tmp[[session$token]]$SigAna[names(tmp)] <<- tmp
par_tmp[[session$token]]$SigAna$contrast <<- contrast
Expand Down Expand Up @@ -441,6 +447,7 @@ create_new_tab_manual <- function(title, targetPanel, result, contrast, alpha, n
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand All @@ -451,6 +458,12 @@ create_new_tab_manual <- function(title, targetPanel, result, contrast, alpha, n
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
tmp <- getUserReactiveValues(input)
par_tmp[[session$token]]$SigAna[names(tmp)] <<- tmp
par_tmp[[session$token]]$SigAna$contrast <<- contrast
Expand Down Expand Up @@ -494,6 +507,7 @@ create_new_tab_manual <- function(title, targetPanel, result, contrast, alpha, n
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down Expand Up @@ -930,6 +944,12 @@ create_new_tab_DESeq <- function(title, targetPanel, result, contrast, alpha, ns
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
tmp <- getUserReactiveValues(input)
par_tmp[[session$token]]$SigAna[names(tmp)] <<- tmp
par_tmp[[session$token]]$SigAna$contrast <<- contrast
Expand Down Expand Up @@ -973,6 +993,7 @@ create_new_tab_DESeq <- function(title, targetPanel, result, contrast, alpha, ns
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand All @@ -983,6 +1004,12 @@ create_new_tab_DESeq <- function(title, targetPanel, result, contrast, alpha, ns
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
tmp <- getUserReactiveValues(input)
par_tmp[[session$token]]$SigAna[names(tmp)] <<- tmp
par_tmp[[session$token]]$SigAna$contrast <<- contrast
Expand Down Expand Up @@ -1026,6 +1053,7 @@ create_new_tab_DESeq <- function(title, targetPanel, result, contrast, alpha, ns
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down
7 changes: 7 additions & 0 deletions program/shinyApp/R/single_gene_visualisation/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ single_gene_visualisation_server <- function(id, data){
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file){
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
envList <- list(

res_tmp = res_tmp[[session$token]],
Expand All @@ -281,6 +287,7 @@ single_gene_visualisation_server <- function(id, data){
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down
14 changes: 11 additions & 3 deletions program/shinyApp/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ server <- function(input,output,session){
# create an empty list in res/par_tmp[[session$token]]
res_tmp[[session$token]] <<- list()
par_tmp[[session$token]] <<- list()

# On session end, remove the list from res/par_tmp
session$onSessionEnded(function() {
res_tmp[[session$token]] <<- NULL
Expand Down Expand Up @@ -914,9 +915,9 @@ server <- function(input,output,session){
req(input$Do_preprocessing > 0)
waiter <- Waiter$new(
html = LOADING_SCREEN,
#color="#3897F147",
color = "rgba(255,255,255,0)",
hide_on_render=FALSE
color = "#3897F147",
hide_on_render = FALSE

)
waiter$show()
print("Do Preprocessing")
Expand Down Expand Up @@ -1254,6 +1255,12 @@ server <- function(input,output,session){
paste0("ShinyOmics_Rcode2Reproduce_", Sys.Date(), ".zip")
},
content = function(file) {
waiter <- Waiter$new(
html = LOADING_SCREEN,
color = "#3897F147",
hide_on_render = FALSE
)
waiter$show()
envList <- list(
res_tmp = res_tmp[[session$token]],
par_tmp = par_tmp[[session$token]]
Expand All @@ -1273,6 +1280,7 @@ server <- function(input,output,session){
files = dir(temp_directory),
root = temp_directory
)
waiter$hide()
},
contentType = "application/zip"
)
Expand Down

0 comments on commit d55da9a

Please sign in to comment.