insightsengineering / teal

Exploratory Web Apps for Analyzing Clinical Trial Data
https://insightsengineering.github.io/teal/
Other
171 stars 34 forks source link

[Feature Request]: Add option to supress application PID in Teal UI #737

Open rpodcast opened 1 year ago

rpodcast commented 1 year ago

Feature description

I can certainly understand the value of displaying a small footer with the application process ID and session token within the main Teal module, especially for debugging. However, when an application is released to a production environment, I would prefer to hide that information as it could cause slight confusion to the users.

It would be a great enhancement to have a new argument added to either the teal module UI or server function to show/hide this specific footer, as seen in this snippet.

Code of Conduct

Contribution Guidelines

Security Policy

donyunardi commented 1 year ago

Hi @rpodcast I think this is a great input. It make sense to have more control on this behavior. I'll add this to our backlog.

pawelru commented 1 year ago

The background behind this feature was that RSConnect displays the log files per PID and (as an application owner in case a bug report to my app) this it is very hard to open the right file. With PID visible, app-user can contact app-owner and provide all the necessary information. Therefore it's sort of a fix of a third-party tool imperfections.

As teal is supposed to be hosting server independent this might rise some confusion if hosted on e.g. shinyapps.io. We need to find the right way to satisfy both needs. First of all we need to decide whether is to opt-in or rather opt-out from that feature. When it comes to the implementation, a few examples that comes to my mind:

donyunardi commented 1 year ago

I'd like to provide some short-term solutions to hide the PID using css.

Solution 1:

Provide tags$style in header argument, wrap it in tagList() to combine with tags$h1 to still define the app's title.

library(teal)

app <- init(
  data = teal_data(
    dataset("IRIS", iris),
    dataset("MTCARS", mtcars)
  ),
  modules = modules(example_module()),
  header = shiny::tagList(tags$style("#teal-identifier {visibility: hidden}"), tags$h1("My first teal application")),
)

shinyApp(app$ui, app$server)

Solution 2:

Pointed out in https://insightsengineering.github.io/teal/main/articles/teal-bs-themes.html#custom-teal-css, we can add the css when defining teal's theme:

library(teal)
options("teal.bs_theme" = bslib::bs_theme(version = "3")
        %>% bslib::bs_add_rules("#teal-identifier {visibility: hidden}"))

app <- init(
  data = teal_data(
    dataset("IRIS", iris),
    dataset("MTCARS", mtcars)
  ),
  modules = modules(example_module()),
  header = "My first teal application"
)

shinyApp(app$ui, app$server)

Both ways will hide the PID.