Skip to content

Commit fb92a4e

Browse files
authored
usage metrics dashboard: better refresh button (#133)
* rename refresh button * add timestamp * update manifest * tighten hr spacing * update manifest checksums * bump extension version
1 parent 43f9806 commit fb92a4e

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

extensions/usage-metrics-dashboard/app.R

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,17 @@ ui <- function(request) {
198198

199199
tags$hr(),
200200

201-
# TODO: Possibly remove or hide in a "Troubleshooting" or Advanced
202-
# accordion section
203-
actionLink("clear_cache", "Clear Cache", icon = icon("refresh")),
201+
div(
202+
actionLink("clear_cache", "Refresh Data", icon = icon("refresh")),
203+
div(
204+
textOutput("last_updated"),
205+
style = "
206+
font-size:0.75rem;
207+
color:#6c757d;
208+
margin:2px 0 0 0;
209+
"
210+
)
211+
)
204212
),
205213

206214
# Main content views ----
@@ -619,16 +627,28 @@ server <- function(input, output, session) {
619627
}) |>
620628
bindCache(active_user_guid)
621629

622-
usage_data_raw <- reactive({
630+
usage_data_meta <- reactive({
623631
req(active_user_role %in% c("administrator", "publisher"))
624-
get_usage(
632+
dat <- get_usage(
625633
client,
626634
from = date_range()$from,
627635
to = date_range()$to
628636
)
637+
list(
638+
data = dat,
639+
last_updated = Sys.time()
640+
)
629641
}) |>
630642
bindCache(active_user_guid, date_range())
631643

644+
usage_data_raw <- reactive({
645+
usage_data_meta()$data
646+
})
647+
648+
usage_last_updated <- reactive({
649+
usage_data_meta()$last_updated
650+
})
651+
632652
# Multi-content table data ----
633653

634654
# Filter the raw data based on selected scope, app mode and visit merge window
@@ -720,6 +740,11 @@ server <- function(input, output, session) {
720740
}
721741
)
722742

743+
output$last_updated <- renderText({
744+
fmt <- "%Y-%m-%d %l:%M:%S %p %Z"
745+
paste0("Updated ", format(usage_last_updated(), fmt))
746+
})
747+
723748
output$content_usage_table <- renderReactable({
724749
data <- multi_content_table_data()
725750

extensions/usage-metrics-dashboard/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,7 +3056,7 @@
30563056
},
30573057
"files": {
30583058
"app.R": {
3059-
"checksum": "3e1f1e08ecddcac01fd26b112a84dc04"
3059+
"checksum": "dd69a9e45f5e4e02496de7b6cbb828d8"
30603060
},
30613061
"get_usage.R": {
30623062
"checksum": "ac5b526efed72f1c34786620ca2ddacd"
@@ -3065,7 +3065,7 @@
30653065
"checksum": "2b495c74b5987a2c318bcd80a0c2be8f"
30663066
},
30673067
"www/styles.css": {
3068-
"checksum": "96b6068bd63e5daf1f938bfb854fd849"
3068+
"checksum": "7ea30e3cc044a3221877a503b0e1ee7d"
30693069
}
30703070
},
30713071
"users": null,
@@ -3079,7 +3079,7 @@
30793079
"requiredFeatures": [
30803080
"OAuth Integrations"
30813081
],
3082-
"version": "1.0.1"
3082+
"version": "1.0.2"
30833083
},
30843084
"environment": {
30853085
"r": {

extensions/usage-metrics-dashboard/www/styles.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,8 @@ a.action-button {
5757

5858
.shiny-spinner-output-container {
5959
height: 100% !important;
60+
}
61+
62+
.sidebar hr {
63+
margin: 0.25rem 0;
6064
}

0 commit comments

Comments
 (0)