Skip to content

Commit 24b64d3

Browse files
committed
respond to feedback
1 parent 55f48cc commit 24b64d3

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

extensions/who-is-visiting-this-content/app.R

+31-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ full_url <- function(session) {
4444
)
4545
}
4646

47+
content_usage_table_search_method = JS("
48+
function(rows, columnIds, searchValue) {
49+
const searchLower = searchValue.toLowerCase();
50+
const searchColumns = ['title', 'dashboard_url', 'content_guid', 'owner_username'];
51+
52+
return rows.filter(function(row) {
53+
return searchColumns.some(function(columnId) {
54+
const value = String(row.values[columnId] || '').toLowerCase();
55+
return value.includes(searchLower);
56+
});
57+
});
58+
}
59+
")
60+
4761
ui <- function(request) {
4862
page_sidebar(
4963
useShinyjs(),
@@ -507,6 +521,11 @@ server <- function(input, output, session) {
507521
pagination = TRUE,
508522
defaultPageSize = 25,
509523
sortable = TRUE,
524+
searchable = TRUE,
525+
searchMethod = content_usage_table_search_method,
526+
language = reactableLang(
527+
searchPlaceholder = "Search by title, URL, GUID, or owner",
528+
),
510529
highlight = TRUE,
511530
defaultSorted = "total_views",
512531
style = list(cursor = "pointer"),
@@ -517,7 +536,6 @@ server <- function(input, output, session) {
517536
title = colDef(
518537
name = "Content",
519538
defaultSortOrder = "asc",
520-
filterable = TRUE,
521539
style = function(value) {
522540
switch(value,
523541
"[Untitled]" = list(fontStyle = "italic"),
@@ -554,7 +572,7 @@ server <- function(input, output, session) {
554572
}
555573
),
556574

557-
owner_username = colDef(name = "Owner", defaultSortOrder = "asc", minWidth = 75, filterable = TRUE),
575+
owner_username = colDef(name = "Owner", defaultSortOrder = "asc", minWidth = 75),
558576

559577
total_views = colDef(
560578
name = "Visits",
@@ -771,6 +789,11 @@ server <- function(input, output, session) {
771789
selected_content_info()$title
772790
})
773791

792+
output$content_guid <- renderText({
793+
req(selected_content_info())
794+
selected_content_info()$guid
795+
})
796+
774797
output$dashboard_link <- renderUI({
775798
req(selected_content_info())
776799
url <- selected_content_info()$dashboard_url
@@ -903,12 +926,17 @@ server <- function(input, output, session) {
903926
"Usage"
904927
} else {
905928
div(
906-
style = "display: flex; justify-content: space-between; gap: 1rem; align-items: center;",
929+
style = "display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;",
907930
actionButton("clear_content_selection", "Back", icon("arrow-left"), class = "btn btn-sm", style = "white-space: nowrap;"),
908931
span(
909932
"Usage / ",
910933
textOutput("content_title", inline = TRUE)
911934
),
935+
code(
936+
class = "text-muted",
937+
style = "font-family: \"Fira Mono\", Consolas, Monaco, monospace; font-size: 0.875rem;",
938+
textOutput("content_guid", inline = TRUE)
939+
),
912940
uiOutput("dashboard_link")
913941
)
914942
}

extensions/who-is-visiting-this-content/www/styles.css

+1-9
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@
1515
text-decoration-thickness: max(1px, 0.0625rem);
1616
}
1717

18-
/* Styles for the column headers */
19-
.header {
20-
border-bottom: 2px solid #555;
21-
font-size: 0.8125rem;
22-
font-weight: 400;
23-
text-transform: uppercase;
24-
}
25-
2618
/* Bar chart styles */
2719

2820
.bar-cell {
@@ -48,5 +40,5 @@
4840
}
4941

5042
#visit_merge_window_text {
51-
margin-top: -10px !important;
43+
margin-top: -10px;
5244
}

0 commit comments

Comments
 (0)