I'd like to update a computation status flag.
Basically this flag should have 4 states {NULL when starting the app, "running" when pushing START button, "queue" when waiting the end of the previous computation, "done" when the computation is done}.
I've made a few lines of code to illustrate the behaviour but of course it does not work as expected. 
library(shiny)
ui <- shinyUI(fluidPage(
titlePanel("Test update computation status flag"),
sidebarLayout(
sidebarPanel(
fluidRow(
column(8,
"Status:",
textOutput("status1")
),
column(4,
"Box1"
)
),
hr(),
fluidRow(
column(8,
"Status:",
textOutput("status2")
),
column(4,
"Box2"
)
),
hr(),
fluidRow(align = "center",
actionButton("startButton", "START")
)
),
mainPanel()
)
))
server <- shinyServer(function(input, output, session) {
cal1 <- reactiveVal(NULL)
cal2 <- reactiveVal(NULL)
stat1 <- reactiveVal(NULL)
stat2 <- reactiveVal(NULL)
observeEvent(input$startButton, {
stat1("running")
stat2("queue")
Sys.sleep(2)
cal1(1)
})
observeEvent(!is.null(cal1()), {
stat1("done")
stat2("running")
Sys.sleep(2)
cal2(2)
})
observeEvent(!is.null(cal2()), {
stat2("done")
})
output$status1 <- renderText(stat1())
})
shinyApp(ui = ui, server = server)

Thanks for any help