rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
133 stars 81 forks source link

Ability to publish a Shiny app with a custom description #947

Open capncodewash opened 1 year ago

capncodewash commented 1 year ago

I may be missing something, but it appears that the rsconnect package's deployApp() function doesn't seem to support setting a custom description for a Shiny app. The parameters available are currently:

deployApp(
  appDir = getwd(),
  appFiles = NULL,
  appFileManifest = NULL,
  appPrimaryDoc = NULL,
  appSourceDoc = NULL,
  appName = NULL,
  appTitle = NULL,
  envVars = NULL,
  appId = NULL,
  contentCategory = NULL,
  account = NULL,
  server = NULL,
  upload = TRUE,
  recordDir = NULL,
  launch.browser = getOption("rsconnect.launch.browser", is_interactive()),
  on.failure = NULL,
  logLevel = c("normal", "quiet", "verbose"),
  lint = TRUE,
  metadata = list(),
  forceUpdate = NULL,
  python = NULL,
  forceGeneratePythonEnvironment = FALSE,
  quarto = NA,
  appVisibility = NULL,
  image = NULL
)

But to change the description, it seems I need to either interact with the API directly (PATCH /v1/content/{guid}), or use the connectapi package's content_update() function.

This seems a bit of an oversight in this package, since most users don't have an API key. However, the same users are able to update the app description from the Posit Connect GUI.

I tried using appTitle but it doesn't seem to map the description field. The metadata field isn't as useful, since it's only stored in the local .dcf file, and not on the server side. It also would be great if we could set arbitrary key/value pairs on the server side!

My use case is publishing Shiny apps to Posit Connect, and documenting aspects of the deployment (config configuration name, Git commit ID, date, time, user, etc.) alongside the deployed app. The description field is the only place that seems suitable.

Thanks.

hadley commented 1 year ago

Are you sure it's not the appTitle?

capncodewash commented 1 year ago

Hi Hadley (thanks for all the R packages by the way!)

appTitle doesn't appear to affect the description field on either first publication or on app update. For reference, I'm using:

Publish command (note, I'm updating an existing app here):

rsconnect::deployApp(appDir = ".",
                     account = "<redacted-my-email>",
                     server = "rstudio-connect.<redacted-my-domain>",
                     appName = "demoshinyapp-production",
                     appId = 303,
                     appTitle = "This is a custom description.",
                     launch.browser = function(url) {
                         message("Deployment completed: ", url)
                     },
                     lint = FALSE,
                     metadata = list(asMultiple = FALSE, asStatic = FALSE),
                     logLevel = "verbose",
                     forceUpdate = TRUE)

Result:

rsconnect-republish-update-appTitle

I can't currently upgrade for normal usage to rsconnect v1.0.1 for my main projects due to renv issues ( #926 ), but I tested it with v1.0.1 on a throwaway 'Old Faithful Geyser' demo app that doesn't have an renv lock file, and the appTitle string seemed to make its way to the 'friendly' app name in Connect, but the description field is empty. This is publishing for the first time:

rsconnect::deployApp(appDir = ".",
                     account = "<redacted-my-email>",
                     server = "rstudio-connect.<redacted-my-domain>",
                     appName = "shinypublishtest",
                     appTitle = "This is a custom description.",
                     launch.browser = function(url) {
                         message("Deployment completed: ", url)
                     },
                     lint = FALSE,
                     metadata = list(asMultiple = FALSE, asStatic = FALSE),
                     logLevel = "verbose")

Result:

rsconnect-1 0 1-blank-app-publish

So it seems like if you supply appTitle on first publication, it's used as a the friendly name, but on update (with forceUpdate) it doesn't replace the appName in Connect.

In neither case did the description field get updated - it just shows 'Click here to edit description' in Connect, so it's presumably blank in the database.

Apologies if this has been fixed in Connect - I'm not able to upgrade quite yet.