Commit 3fc71238 authored by Tao Sun's avatar Tao Sun
Browse files

Enable url auto-update

parent 20d98107
Pipeline #55919 passed with stage
in 1 minute and 28 seconds
......@@ -30,8 +30,9 @@ mapServer <- function(id, parent_session) {
moduleServer(
id,
function(input, output, session) {
observe({
query <- parseQueryString(session$clientData$url_search)
query <- getQueryString()
for (i in seq_along(query)) {
nameval <- names(query[i])
......@@ -43,6 +44,13 @@ mapServer <- function(id, parent_session) {
}
})
observeEvent(parent_session$input$tabs, {
tab <- parent_session$input$tabs
if (tab == paste0(tolower(id), '_map')) {
updateQueryString(paste0("?tab=", tab))
}
})
output$map <- renderPlotly(
switch(id,
World = plot_world_map(),
......
......@@ -49,6 +49,7 @@ get_prediction_range <- function(data_source) {
predictionUI <- function(id) {
ns <- NS(id)
tagList(
textOutput(ns('text')),
includeMarkdown("credits.Rmd"),
hr(),
......@@ -165,7 +166,7 @@ predictionServer <- function(id, parent_session) {
function(input, output, session) {
observe({
query <- parseQueryString(session$clientData$url_search)
query <- getQueryString()
for (i in seq_along(query)) {
nameval <- names(query[i])
......@@ -176,6 +177,14 @@ predictionServer <- function(id, parent_session) {
)
}
})
observeEvent(c(parent_session$input$tabs, input$country_selected), {
tab <- parent_session$input$tabs
if (tab == paste0(tolower(id), '_pred')) {
country_selected <- input$country_selected
updateQueryString(paste0("?tab=", tab, "&country=", country_selected))
}
})
ref_day <- as.Date(get_last_updated(id))
......
......@@ -74,7 +74,7 @@ testServer <- function(id, parent_session) {
function(input, output, session) {
observe({
query <- parseQueryString(session$clientData$url_search)
query <- getQueryString()
for (i in seq_along(query)) {
nameval <- names(query[i])
......@@ -86,6 +86,14 @@ testServer <- function(id, parent_session) {
}
})
observeEvent(c(parent_session$input$tabs, input$country_selected), {
tab <- parent_session$input$tabs
if (tab == paste0(tolower(id), '_test')) {
country_selected <- input$country_selected
updateQueryString(paste0("?tab=", tab, "&country=", country_selected))
}
})
d <- get_tests(id)
t_tests <- reactive({
......
......@@ -5,6 +5,8 @@ account: renkulab
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 2066881
bundleId: 3482567
bundleId: 3483054
url: https://renkulab.shinyapps.io/COVID-19-Epidemic-Forecasting/
when: 1596723917.53
when: 1596730375.52004
asMultiple: FALSE
asStatic: FALSE
......@@ -19,5 +19,11 @@ server <- function(input, output, session) {
# Test ----
testServer('World', session)
testServer('US', session)
observeEvent(input$tabs, {
tab <- input$tabs
if (tab == 'about') {
updateQueryString(paste0("?tab=", tab))
}
})
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment