Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with {shinymanager}? #2

Closed
sammerk opened this issue Aug 2, 2019 · 1 comment
Closed

Conflict with {shinymanager}? #2

sammerk opened this issue Aug 2, 2019 · 1 comment

Comments

@sammerk
Copy link

sammerk commented Aug 2, 2019

{shinylogs} and {shinymanager} are awesome packages! However, I ran into an issue when combining the packages.
In the following app everything is fine, as long as line 45 is commented. But when track_usage()is active, the output freezes.

 library(shinymanager)
 library(shinylogs)
 library(shiny)
 
 credentials <- data.frame(
     user = c("fanny", "victor", "benoit"),
     password = c("azerty", "12345", "azerty"),
     comment = c("alsace", "auvergne", "bretagne"),
     stringsAsFactors = FALSE
 )
 
 # Define UI for application that draws a histogram
 ui <- fluidPage(
 
     # Application title
     titlePanel("Old Faithful Geyser Data"),
 
     # Sidebar with a slider input for number of bins 
     sidebarLayout(
         sidebarPanel(
             sliderInput("bins",
                         "Number of bins:",
                         min = 1,
                         max = 50,
                         value = 30)
         ),
 
         # Show a plot of the generated distribution
         mainPanel(
            plotOutput("distPlot")
         )
     )
 )
 
 # Wraping the UI with secure_app
 ui <- secure_app(ui)
 
 # Define server logic required to draw a histogram
 server <- function(input, output) {
 
     
     
     
     # Call of {shinylogs}
     # track_usage(storage_mode = store_json(path = "logs/"))
     
     # call the server part
     # check_credentials returns a function to authenticate users
     secure_server(check_credentials = check_credentials(credentials))
     
     
     output$distPlot <- renderPlot({
         # generate bins based on input$bins from ui.R
         x    <- faithful[, 2]
         bins <- seq(min(x), max(x), length.out = input$bins + 1)
 
         # draw the histogram with the specified number of bins
         hist(x, breaks = bins, col = 'darkgray', border = 'white')
     })
 }
 
 # Run the application 
 shinyApp(ui = ui, server = server)
@sammerk sammerk changed the title Conflict with {shinymanager} Conflict with {shinymanager}? Aug 2, 2019
@pvictor
Copy link
Member

pvictor commented Aug 5, 2019

Hi @sammerk ,

Thanks for reporting this issue. I've pushed a fix, if you re-install from Github, this should work.
Otherwise you have to have to exclude a special input from {shinymanager} from the logd like this :

track_usage(
  storage_mode = store_json(path = "logs/"), 
  exclude_input_id = ".shinymanager_timeout"
)

Victor

@pvictor pvictor closed this as completed Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants