daattali / shinyalert

🗯️ Easily create pretty popup messages (modals) in Shiny
https://daattali.com/shiny/shinyalert-demo/
Other
242 stars 26 forks source link

Added dismissalert to remove arbitrary number of messages #30

Closed dipterix closed 4 years ago

dipterix commented 4 years ago

This PR is related to issue #29

A simple demo showing how it works:

library(shiny)

ui <- fluidPage(
  shinyalert::useShinyalert(),
  actionButton('a','Ok')
)

server <- function(input, output, session) {
  observeEvent(input$a, {
    shinyalert::shinyalert(
      'Warning',
      'Click OK to run code',
      callbackR = function(...){
        # procedure 1 runs for 3~4 seconds
        Sys.sleep(3 + runif(1))
        # Now dismiss modal
        shinyalert::dismissalert()
      }
    )
    shinyalert::shinyalert(
      'Scheduled!',
      'R is running, please wait for the result...', 
      showConfirmButton = FALSE
    )
  })
}

shinyApp(ui, server)
dipterix commented 4 years ago

Changes:

  1. Renamed dismissalert to closeAlert
  2. Added immediate option to shinyalert
  3. closeAlert can choose number of alerts to be closed, or a specific alert with cbid given
  4. Fixed some pre-existing doc issues.

I added myself to DESCRIPTION as ctb (contributor, providing piece of code) as convention, you can remove it if it causes some legal issues.

daattali commented 4 years ago

I made a commit that uses uuid instead of hashing the params, so that's not an issue anymore. Thanks for bringing this to my attention

daattali commented 4 years ago

@dipterix let me know if you plan on continuing this or if I should take over!

dipterix commented 4 years ago

I got fever. Please go ahead make changes if you feel necessary.

daattali commented 4 years ago

I'm working on some other packages this week, if you don't finish the PR by the end of the month I'll try to finish it :)

daattali commented 4 years ago

@dipterix Are you able to finish this PR?

daattali commented 4 years ago

I actually went through all your code and I'm mostly done integrating it. I might ask you for a PR soon :)

dipterix commented 4 years ago

Hi @daattali , sorry for the late reply. The conflicts have been resolved.

daattali commented 4 years ago

Merged in #37