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

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

Open
3 tasks done
rpodcast opened this issue Sep 26, 2022 · 3 comments
Open
3 tasks done
Labels
core enhancement New feature or request

Comments

@rpodcast
Copy link

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

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.
@rpodcast rpodcast added the enhancement New feature or request label Sep 26, 2022
@donyunardi
Copy link
Contributor

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
Copy link
Contributor

pawelru commented Oct 26, 2022

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:

  • do this silently and automatically by trying to detect if on RSConnect (possibly some environmental variable) and turn it on only there
  • a separate teal R option - could be boolean flag
  • we have footer argument to init() and we can move PID thing there as a default argument. This would also make footer = NULL to be an explicit signal about lack of PID.
  • a separate debug mode which would give PID, turn logger on debug mode and possibly in the future: sessionInfo etc. Here we need to be very careful on what level is being specified - in particular: app level or session level (this is critical for the implementation as envvar is set on app level and e.g. R option is on session level). From my typical user experience, session level seems to be more appropriate. In case of error I don't have to have ask app-owner to redeploy the app in debug mode. It's a definitely a bigger task that needs to be well refined but I am kind of like it.

@donyunardi
Copy link
Contributor

donyunardi commented Nov 30, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants