Skip to content

Commit

Permalink
Use tar_watch_ui() and tar_watch_server()
Browse files Browse the repository at this point in the history
  • Loading branch information
Adafede committed Aug 19, 2024
1 parent bdc3c3d commit c438c71
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ RUN Rscript -e "install.packages('tima', repos = c('https://taxonomicallyinforme

# Expose the necessary ports for Shiny
EXPOSE 3838
EXPOSE 3839

# Disable healthcheck (if you really want to disable it)
HEALTHCHECK NONE
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@
"SystemRequirements": null
},
"keywords": ["metaboliteannotation", "chemotaxonomy", "scoringsystem", "naturalproducts", "computationalmetabolomics", "taxonomicdistance", "specializedmetabolome"],
"fileSize": "4071.618KB",
"fileSize": "4071.697KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ services:
retries: 5
ports:
- "3838:3838"
- "3839:3839"
image: adafede/tima-r
networks:
- service-service-frontend
Expand Down
54 changes: 28 additions & 26 deletions inst/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -1688,10 +1688,14 @@ ui <- shiny::fluidPage(
id = "thankyou_msg",
shiny::h3("Thanks, your parameters were saved successfully!")
)),
## WIP
# shinyjs::hidden(shiny::div(id = "targets", shiny::mainPanel(h4(
# "Live show from `targets`"
# )))),
shinyjs::hidden(
shiny::div(
id = "targets",
shiny::mainPanel(
targets::tar_watch_ui(id = "targets-shiny", seconds = 10, targets_only = TRUE)
)
)
),
shinyjs::hidden(shiny::downloadButton(outputId = "results", "Download results")),
shinyjs::hidden(shiny::actionButton(inputId = "close", label = "Close")),
shinyjs::hidden(shiny::div(id = "job_msg", shiny::h3("Job is running!"))),
Expand Down Expand Up @@ -2223,25 +2227,16 @@ server <- function(input, output, session) {

shiny::observeEvent(eventExpr = input$launch, handlerExpr = {
shinyjs::show("job_msg")
# shinyjs::show("targets")
shinyjs::show("targets")
shinyjs::hide("thankyou_msg")
shinyjs::hide("error")
shinyjs::hide("params")
shinyjs::hide("form")
shinyjs::hide("job_end")
shinyjs::hide("results")
shinyjs::hide("close")
targets::tar_watch(
host = "127.0.0.1",
port = 3839,
# browse = FALSE,
display = "graph",
displays = c("summary", "graph"),
degree_from = 8,
outdated = FALSE,
targets_only = TRUE,
supervise = TRUE,
verbose = TRUE,
targets::tar_watch_server(
id = "targets-shiny",
exclude = c(
"yaml_paths",
"benchmark_ann_fil_ms1_neg",
Expand Down Expand Up @@ -2419,16 +2414,23 @@ server <- function(input, output, session) {
),
n = 1
)
shinyjs::show("results")
output$results <- downloadHandler(
filename = basename(results),
content = function(file) {
writeLines(readLines(results), file)
}
)
shinyjs::show("close")
shiny::observeEvent(eventExpr = input$close, handlerExpr = {
shiny::stopApp()
process <- reactiveValues(status = targets::tar_active())
observe({
shiny::invalidateLater(millis = 5000)
process$status <- targets::tar_active()
shinyjs::hide("job_msg")
shinyjs::show("job_end")
shinyjs::show("results")
output$results <- downloadHandler(
filename = basename(results),
content = function(file) {
writeLines(readLines(results), file)
}
)
shinyjs::show("close")
shiny::observeEvent(eventExpr = input$close, handlerExpr = {
shiny::stopApp()
})
})
})
}
Expand Down

0 comments on commit c438c71

Please sign in to comment.