Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extensions/who-deploys-most-often/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source("renv/activate.R")
2 changes: 2 additions & 0 deletions extensions/who-deploys-most-often/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.posit/
app_cache/
60 changes: 60 additions & 0 deletions extensions/who-deploys-most-often/app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
library(shiny)
library(bslib)
library(dplyr)
library(purrr)
library(connectapi)

shinyOptions(
cache = cachem::cache_disk("./app_cache/cache/", max_age = 60 * 60 * 12)
)

ui <- page_fluid(
theme = bs_theme(version = 5),

card(
card_header("Who Deploys Most Often"),
layout_sidebar(
sidebar = sidebar(
title = "No Filters Yet",
open = FALSE
),
card_body("Note: `n_bundles` currently uses synthetic data."),
card(
tableOutput("user_table")
)
)
)
)

server <- function(input, output, session) {
client <- connect()

# Load data
content <- reactive({
get_content(client) |>
# Fake data, to be replaced with real data later.
mutate(n_bundles = rpois(n(), 3))
}) |> bindCache("static_key")

user_table <- reactive({
content() |>
# The `owner` column is a nested list-column.
# We extract the requisite metadata up to be first-class atomic vector columns.
mutate(
username = map_chr(owner, "username"),
user_full_name = paste(map_chr(owner, "first_name"), map_chr(owner, "last_name"))
) |>
group_by(username) |>
summarize(
user_full_name = first(user_full_name),
n_bundles = sum(n_bundles),
n_content_items = n(),
last_deploy = format(max(last_deployed_time, na.rm = TRUE), "%Y-%m-%d at %I:%M %p")
) |>
arrange(desc(n_content_items))
}) |> bindCache("static_key")

output$user_table <- renderTable({user_table()})
}

shinyApp(ui, server)
1,827 changes: 1,827 additions & 0 deletions extensions/who-deploys-most-often/renv.lock

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions extensions/who-deploys-most-often/renv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
library/
local/
cellar/
lock/
python/
sandbox/
staging/
Loading