@@ -44,6 +44,20 @@ full_url <- function(session) {
44
44
)
45
45
}
46
46
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
+
47
61
ui <- function (request ) {
48
62
page_sidebar(
49
63
useShinyjs(),
@@ -507,6 +521,11 @@ server <- function(input, output, session) {
507
521
pagination = TRUE ,
508
522
defaultPageSize = 25 ,
509
523
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
+ ),
510
529
highlight = TRUE ,
511
530
defaultSorted = " total_views" ,
512
531
style = list (cursor = " pointer" ),
@@ -517,7 +536,6 @@ server <- function(input, output, session) {
517
536
title = colDef(
518
537
name = " Content" ,
519
538
defaultSortOrder = " asc" ,
520
- filterable = TRUE ,
521
539
style = function (value ) {
522
540
switch (value ,
523
541
" [Untitled]" = list (fontStyle = " italic" ),
@@ -554,7 +572,7 @@ server <- function(input, output, session) {
554
572
}
555
573
),
556
574
557
- owner_username = colDef(name = " Owner" , defaultSortOrder = " asc" , minWidth = 75 , filterable = TRUE ),
575
+ owner_username = colDef(name = " Owner" , defaultSortOrder = " asc" , minWidth = 75 ),
558
576
559
577
total_views = colDef(
560
578
name = " Visits" ,
@@ -771,6 +789,11 @@ server <- function(input, output, session) {
771
789
selected_content_info()$ title
772
790
})
773
791
792
+ output $ content_guid <- renderText({
793
+ req(selected_content_info())
794
+ selected_content_info()$ guid
795
+ })
796
+
774
797
output $ dashboard_link <- renderUI({
775
798
req(selected_content_info())
776
799
url <- selected_content_info()$ dashboard_url
@@ -903,12 +926,17 @@ server <- function(input, output, session) {
903
926
" Usage"
904
927
} else {
905
928
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 ;" ,
907
930
actionButton(" clear_content_selection" , " Back" , icon(" arrow-left" ), class = " btn btn-sm" , style = " white-space: nowrap;" ),
908
931
span(
909
932
" Usage / " ,
910
933
textOutput(" content_title" , inline = TRUE )
911
934
),
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
+ ),
912
940
uiOutput(" dashboard_link" )
913
941
)
914
942
}
0 commit comments