Chelsyx has submitted this change and it was merged. Change subject: Add bookmarking states ......................................................................
Add bookmarking states In Shiny 0.14, RStudio added a way to bookmark the state of the dashboard. Previously, we've used the shinyURL R package, but this way we use something that is now built into Shiny. Bug: T145478 Change-Id: I0852673581c87a89d95da9f14715fc093daac6a6 --- A global.R M server.R M ui.R R www/custom.js 4 files changed, 263 insertions(+), 345 deletions(-) Approvals: Chelsyx: Verified; Looks good to me, approved diff --git a/global.R b/global.R new file mode 100644 index 0000000..6300d25 --- /dev/null +++ b/global.R @@ -0,0 +1 @@ +enableBookmarking(store = "url") diff --git a/server.R b/server.R index 17a3679..5ac100c 100644 --- a/server.R +++ b/server.R @@ -6,11 +6,11 @@ existing_date <- Sys.Date() - 1 -shinyServer(function(input, output, session) { +function(input, output, session) { if (Sys.Date() != existing_date) { # Create a Progress object - progress <- shiny::Progress$new(session, min = 0, max = 1) + progress <- shiny::Progress$new() progress$set(message = "Downloading desktop data", value = 0) read_desktop() progress$set(message = "Downloading apps data", value = 0.1) @@ -30,11 +30,6 @@ progress$set(message = "Finished downloading datasets", value = 1) existing_date <<- Sys.Date() progress$close() - } - - # Wrap time_frame_range to provide global settings - time_frame_range <- function(input_local_timeframe, input_local_daterange) { - return(polloi::time_frame_range(input_local_timeframe, input_local_daterange, input$timeframe_global, input$daterange_global)) } ## Desktop value boxes @@ -69,7 +64,6 @@ output$desktop_event_plot <- renderDygraph({ desktop_dygraph_set %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_desktop_event)) %>% - polloi::subset_by_date_range(time_frame_range(input$desktop_event_timeframe, input$desktop_event_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Events", title = "Desktop search events, by day") %>% dyRangeSelector %>% dyEvent(as.Date("2016-07-12"), "A (schema switch)", labelLoc = "bottom") @@ -78,7 +72,6 @@ output$desktop_load_plot <- renderDygraph({ desktop_load_data %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_desktop_load)) %>% - polloi::subset_by_date_range(time_frame_range(input$desktop_load_timeframe, input$desktop_load_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Load time (ms)", title = "Desktop load times, by day", use_si = FALSE) %>% dyRangeSelector %>% dyEvent(as.Date("2016-07-12"), "A (schema switch)", labelLoc = "bottom") @@ -87,7 +80,6 @@ output$paulscore_approx_plot_fulltext <- renderDygraph({ paulscore_fulltext %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_paulscore_approx)) %>% - polloi::subset_by_date_range(time_frame_range(input$paulscore_approx_timeframe, input$paulscore_approx_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "PaulScore", title = "PaulScore for fulltext searches, by day", use_si = FALSE, group = "paulscore_approx") %>% dyRangeSelector %>% dyLegend(labelsDiv = "paulscore_approx_legend", show = "always") @@ -96,7 +88,6 @@ output$paulscore_approx_plot_autocomplete <- renderDygraph({ paulscore_autocomplete %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_paulscore_approx)) %>% - polloi::subset_by_date_range(time_frame_range(input$paulscore_approx_timeframe, input$paulscore_approx_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "PaulScore", title = "PaulScore for autocomplete searches, by day", use_si = FALSE, group = "paulscore_approx") %>% dyRangeSelector %>% dyLegend(labelsDiv = "paulscore_approx_legend", show = "always") @@ -134,7 +125,6 @@ output$mobile_event_plot <- renderDygraph({ mobile_dygraph_set %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_mobile_event)) %>% - polloi::subset_by_date_range(time_frame_range(input$mobile_event_timeframe, input$mobile_event_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Events", title = "Mobile search events, by day") %>% dyRangeSelector }) @@ -142,7 +132,6 @@ output$mobile_load_plot <- renderDygraph({ mobile_load_data %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_mobile_load)) %>% - polloi::subset_by_date_range(time_frame_range(input$mobile_load_timeframe, input$mobile_load_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Load time (ms)", title = "Mobile search events, by day", use_si = FALSE) %>% dyRangeSelector }) @@ -179,7 +168,6 @@ output$android_event_plot <- renderDygraph({ android_dygraph_set %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_app_event)) %>% - polloi::subset_by_date_range(time_frame_range(input$app_event_timeframe, input$app_event_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Events", title = "Android mobile app search events, by day") %>% dyRangeSelector }) @@ -187,7 +175,6 @@ output$android_load_plot <- renderDygraph({ android_load_data %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_app_load)) %>% - polloi::subset_by_date_range(time_frame_range(input$app_load_timeframe, input$app_load_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Load time (ms)", title = "Android result load times, by day", use_si = FALSE) %>% dyRangeSelector }) @@ -195,7 +182,6 @@ output$ios_event_plot <- renderDygraph({ ios_dygraph_set %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_app_event)) %>% - polloi::subset_by_date_range(time_frame_range(input$app_event_timeframe, input$app_event_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Events", title = "iOS mobile app search events, by day") %>% dyRangeSelector }) @@ -203,7 +189,6 @@ output$ios_load_plot <- renderDygraph({ ios_load_data %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_app_load)) %>% - polloi::subset_by_date_range(time_frame_range(input$app_load_timeframe, input$app_load_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Load time (ms)", title = "iOS result load times, by day", use_si = FALSE) %>% dyRangeSelector }) @@ -211,7 +196,6 @@ output$click_position_plot <- renderDygraph({ position_prop %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_app_click_position)) %>% - polloi::subset_by_date_range(time_frame_range(input$app_click_position_timeframe, input$app_click_position_daterange)) %>% polloi::make_dygraph(xlab = "", ylab = "Proportion of Clicks (%)", title = "Proportion of Clicks on Nth Result") %>% dyAxis("x", ticker = "Dygraph.dateTicker", axisLabelFormatter = polloi::custom_axis_formatter, axisLabelWidth = 100, pixelsPerLabel = 80) %>% @@ -222,7 +206,6 @@ output$invoke_source_plot <- renderDygraph({ source_prop %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_app_invoke_source)) %>% - polloi::subset_by_date_range(time_frame_range(input$app_invoke_source_timeframe, input$app_invoke_source_daterange)) %>% polloi::make_dygraph(xlab = "", ylab = "Proportion of Search Sessions (%)", title = "Proportion of Search Sessions, by Invoke Source") %>% dyAxis("x", ticker = "Dygraph.dateTicker", axisLabelFormatter = polloi::custom_axis_formatter, axisLabelWidth = 100, pixelsPerLabel = 80) %>% @@ -234,7 +217,7 @@ output$cirrus_aggregate <- renderDygraph({ split_dataset$cirrus[, c(1, 3)] %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_fulltext_search)) %>% - polloi::subset_by_date_range(time_frame_range(input$fulltext_search_timeframe, input$fulltext_search_timeframe_daterange)) %>% + polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Full-text via API usage by day", legend_name = "Searches") %>% dyRangeSelector }) @@ -242,7 +225,6 @@ output$open_aggregate <- renderDygraph({ split_dataset$open[, c(1, 3)] %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_open_search)) %>% - polloi::subset_by_date_range(time_frame_range(input$open_search_timeframe, input$open_search_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "OpenSearch API usage by day", legend_name = "Searches") %>% dyRangeSelector }) @@ -250,7 +232,6 @@ output$geo_aggregate <- renderDygraph({ split_dataset$geo[, c(1, 3)] %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_geo_search)) %>% - polloi::subset_by_date_range(time_frame_range(input$geo_search_timeframe, input$geo_search_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Geo Search API usage by day", legend_name = "Searches") %>% dyRangeSelector }) @@ -258,7 +239,6 @@ output$language_aggregate <- renderDygraph({ split_dataset$language[, c(1, 3)] %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_language_search)) %>% - polloi::subset_by_date_range(time_frame_range(input$language_search_timeframe, input$language_search_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Language Search API usage by day", legend_name = "Searches") %>% dyRangeSelector }) @@ -266,7 +246,6 @@ output$prefix_aggregate <- renderDygraph({ split_dataset$prefix[, c(1, 3)] %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_prefix_search)) %>% - polloi::subset_by_date_range(time_frame_range(input$prefix_search_timeframe, input$prefix_search_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Prefix Search API usage by day", legend_name = "Searches") %>% dyRangeSelector }) @@ -275,7 +254,6 @@ output$failure_rate_plot <- renderDygraph({ polloi::data_select(input$failure_rate_automata, failure_data_with_automata, failure_data_no_automata) %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_failure_rate)) %>% - polloi::subset_by_date_range(time_frame_range(input$failure_rate_timeframe, input$failure_rate_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Zero Results Rate (%)", title = "Zero Results Rate, by day", legend_name = "ZRR") %>% dyRangeSelector(fillColor = "") %>% @@ -286,7 +264,6 @@ output$failure_rate_change_plot <- renderDygraph({ polloi::data_select(input$failure_rate_automata, failure_roc_with_automata, failure_roc_no_automata) %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_failure_rate)) %>% - polloi::subset_by_date_range(time_frame_range(input$failure_rate_timeframe, input$failure_rate_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Change (%)", title = "Zero Results rate change, by day", legend_name = "Change") %>% dyRangeSelector(fillColor = "", strokeColor = "") %>% dyEvent(as.Date("2016-03-16"), "Completion Suggester Deployed", labelLoc = "bottom") @@ -296,7 +273,7 @@ xts_data <- input$failure_breakdown_automata %>% polloi::data_select(failure_breakdown_with_automata, failure_breakdown_no_automata) %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_failure_breakdown)) %>% - polloi::subset_by_date_range(time_frame_range(input$failure_breakdown_timeframe, input$failure_breakdown_timeframe_daterange)) %>% + { xts(.[, -1], order.by = .$date) } xts_data %>% dygraph(xlab = "Date", ylab = "Zero Results Rate (%)", main = "Zero result rate by search type") %>% @@ -325,7 +302,6 @@ output$suggestion_dygraph_plot <- renderDygraph({ polloi::data_select(input$failure_suggestions_automata, suggestion_with_automata, suggestion_no_automata) %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_failure_suggestions)) %>% - polloi::subset_by_date_range(time_frame_range(input$failure_suggestions_timeframe, input$failure_suggestions_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "Date", ylab = "Zero Results Rate (%)", title = "Zero Result Rates with Search Suggestions") %>% dyRangeSelector(fillColor = "") %>% dyEvent(as.Date("2016-02-01"), "A (format switch)", labelLoc = "bottom") %>% @@ -382,7 +358,6 @@ polloi::data_select(input$failure_langproj_automata, langproj_with_automata, langproj_no_automata) %>% aggregate_wikis(input$language_selector, input$project_selector) %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_failure_langproj)) %>% - polloi::subset_by_date_range(time_frame_range(input$failure_langproj_timeframe, input$failure_langproj_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "", ylab = "Zero Results Rate (%)", title = "Zero result rate by language and project") %>% dyLegend(show = "always", width = 400, labelsDiv = "failure_langproj_legend") %>% dyAxis("x", axisLabelFormatter = polloi::custom_axis_formatter) %>% @@ -393,7 +368,6 @@ output$lethal_dose_plot <- renderDygraph({ user_page_visit_dataset %>% polloi::smoother(smooth_level = polloi::smooth_switch(input$smoothing_global, input$smoothing_lethal_dose_plot)) %>% - polloi::subset_by_date_range(time_frame_range(input$lethal_dose_timeframe, input$lethal_dose_timeframe_daterange)) %>% polloi::make_dygraph(xlab = "", ylab = "Time (s)", title = "Time at which we have lost N% of the users") %>% dyAxis("x", ticker = "Dygraph.dateTicker", axisLabelFormatter = polloi::custom_axis_formatter, axisLabelWidth = 100, pixelsPerLabel = 80) %>% @@ -786,4 +760,4 @@ return(dropdownMenu(type = "notifications", .list = notifications)) }) -}) +} diff --git a/ui.R b/ui.R index 4f91cee..cce737a 100644 --- a/ui.R +++ b/ui.R @@ -2,321 +2,259 @@ library(shinydashboard) library(dygraphs) -#Header elements for the visualisation -header <- dashboardHeader(title = "Search Metrics", dropdownMenuOutput("message_menu"), disable = FALSE) +function(request) { + dashboardPage( -#Sidebar elements for the search visualisations. -sidebar <- dashboardSidebar( - tags$head( - tags$link(rel = "stylesheet", type = "text/css", href = "stylesheet.css"), - tags$script(src = "rainbow.js") - ), - sidebarMenu( - menuItem(text = "KPIs", - div(selectInput("kpi_summary_date_range_selector", - label = "KPI data range", multiple = FALSE, selected = "monthly", - choices = list("Yesterday" = "daily", "Last 7 days" = "weekly", - "Last 30 days" = "monthly", "Last 90 days" = "quarterly")), - style = "margin-bottom:-10px;"), - menuSubItem(text = "Summary", tabName = "kpis_summary"), - menuSubItem(text = "Monthly Metrics", tabName = "monthly_metrics"), - menuSubItem(text = "Load times", tabName = "kpi_load_time"), - menuSubItem(text = "Zero results", tabName = "kpi_zero_results"), - menuSubItem(text = "API usage", tabName = "kpi_api_usage"), - menuSubItem(text = "Augmented Clickthrough", tabName = "kpi_augmented_clickthroughs"), - icon = icon("star", lib = "glyphicon")), - menuItem(text = "Desktop", - menuSubItem(text = "Events", tabName = "desktop_events"), - menuSubItem(text = "Load times", tabName = "desktop_load"), - menuSubItem(text = "PaulScore", tabName = "paulscore_approx")), - menuItem(text = "Mobile Web", - menuSubItem(text = "Events", tabName = "mobile_events"), - menuSubItem(text = "Load times", tabName = "mobile_load")), - menuItem(text = "Mobile Apps", - menuSubItem(text = "Events", tabName = "app_events"), - menuSubItem(text = "Load times", tabName = "app_load"), - menuSubItem(text = "Click Position", tabName = "app_click_position"), - menuSubItem(text = "Invoke Source", tabName = "app_invoke_source") - ), - menuItem(text = "API", - menuSubItem(text = "Full-text via API", tabName = "fulltext_search"), - menuSubItem(text = "Open Search", tabName = "open_search"), - menuSubItem(text = "Geo Search", tabName = "geo_search"), - menuSubItem(text = "Prefix Search", tabName = "prefix_search"), - menuSubItem(text = "Language Search", tabName = "language_search")), - menuItem(text = "Zero Results", - menuSubItem(text = "Summary", tabName = "failure_rate"), - menuSubItem(text = "Search Type Breakdown", tabName = "failure_breakdown"), - menuSubItem(text = "Search Suggestions", tabName = "failure_suggestions"), - menuSubItem(text = "Language/Project Breakdown", tabName = "failure_langproj")), - menuItem(text = "Page Visit Times", tabName = "survival"), - menuItem(text = "Global Settings", - selectInput(inputId = "smoothing_global", label = "Smoothing", selectize = TRUE, selected = "day", - choices = c("No Smoothing" = "day", "Weekly Median" = "week", - "Monthly Median" = "month", "Splines" = "gam")), - selectInput(inputId = "timeframe_global", label = "Time Frame", selectize = TRUE, selected = "", - choices = c("All available data" = "all", "Last 7 days" = "week", "Last 30 days" = "month", - "Last 90 days" = "quarter", "Custom" = "custom")), - conditionalPanel("input.timeframe_global == 'custom'", - dateRangeInput("daterange_global", label = "Custom Date Range", - start = Sys.Date()-11, end = Sys.Date()-1, min = "2015-04-14")), - icon = icon("cog", lib = "glyphicon")) - ), - div(icon("info-sign", lib = "glyphicon"), HTML("<strong>Tip</strong>: you can drag on the graphs with your mouse to zoom in on a particular date range."), style = "padding: 10px; color: white;") -) + dashboardHeader(title = "Search Metrics", dropdownMenuOutput("message_menu"), disable = FALSE), -#Body elements for the search visualisations. -body <- dashboardBody( - tabItems( - tabItem(tabName = "kpis_summary", - htmlOutput("kpi_summary_date_range"), - fluidRow(valueBoxOutput("kpi_summary_box_load_time", width = 3), - valueBoxOutput("kpi_summary_box_zero_results", width = 3), - valueBoxOutput("kpi_summary_box_api_usage", width = 3), - valueBoxOutput("kpi_summary_box_augmented_clickthroughs", width = 3)), - includeMarkdown("./tab_documentation/kpis_summary.md")), - tabItem(tabName = "monthly_metrics", - fluidRow( - column(fluidRow( - column(selectInput("monthy_metrics_month", "Month", - choices = month.name, - selected = month.name[lubridate::month(Sys.Date() - 1 - months(1))], - selectize = FALSE), - width = 6), - column(selectInput("monthy_metrics_year", "Year", - choices = lubridate::year(seq(lubridate::floor_date(as.Date("2016-01-01"), "year"), Sys.Date() - 1 - months(1), "year")), - selected = lubridate::year(Sys.Date() - 1 - months(1)), - selectize = FALSE), - width = 6) - ), - checkboxInput("monthly_metrics_prev_month", - "Show previous month", TRUE), - checkboxInput("monthly_metrics_prev_year", - "Show previous year", TRUE), - width = 4), - column(tableOutput("monthly_metrics_tbl"), width = 8) - ), - includeMarkdown("./tab_documentation/monthly_metrics.md")), - tabItem(tabName = "kpi_load_time", - fluidRow( - column(polloi::smooth_select("smoothing_kpi_load_time"), width = 4), - column(div(id = "kpi_load_time_series_legend"), width = 8) - ), - dygraphOutput("kpi_load_time_series"), - includeMarkdown("./tab_documentation/kpi_load_time.md")), - tabItem(tabName = "kpi_zero_results", - polloi::smooth_select("smoothing_kpi_zero_results"), - dygraphOutput("kpi_zero_results_series"), - includeMarkdown("./tab_documentation/kpi_zero_results.md")), - tabItem(tabName = "kpi_api_usage", - fluidRow(column(radioButtons("kpi_api_usage_series_data", - label = "Type of data to display", - choices = list("Calls" = "raw", - "Day-to-day % change" = "change"), - inline = TRUE), - width = 4), - column(checkboxInput("kpi_api_usage_series_log_scale", - label = "Log10 Scale", - value = FALSE), - width = 2), - column(checkboxInput("kpi_api_usage_series_include_open", - label = "Include OpenSearch in total", - value = TRUE), - width = 3), - column(polloi::smooth_select("smoothing_kpi_api_usage"), width = 3)), - dygraphOutput("kpi_api_usage_series"), - includeMarkdown("./tab_documentation/kpi_api_usage.md")), - tabItem(tabName = "kpi_augmented_clickthroughs", - fluidRow( - column(polloi::smooth_select("smoothing_augmented_clickthroughs"), width = 4), - column(div(id = "kpi_augmented_clickthroughs_series_legend"), width = 8)), - dygraphOutput("kpi_augmented_clickthroughs_series"), - includeMarkdown("./tab_documentation/kpi_augmented_clickthroughs.md")), - tabItem(tabName = "desktop_events", - fluidRow( - valueBoxOutput("desktop_event_searches"), - valueBoxOutput("desktop_event_resultsets"), - valueBoxOutput("desktop_event_clickthroughs")), - fluidRow( - column(polloi::smooth_select("smoothing_desktop_event"), width = 4), - column(polloi::timeframe_select("desktop_event_timeframe"), width = 4), - column(polloi::timeframe_daterange("desktop_event_timeframe"), width = 4)), - dygraphOutput("desktop_event_plot"), - includeMarkdown("./tab_documentation/desktop_events.md")), - tabItem(tabName = "desktop_load", - fluidRow( - column(polloi::smooth_select("smoothing_desktop_load"), width = 4), - column(polloi::timeframe_select("desktop_load_timeframe"), width = 4), - column(polloi::timeframe_daterange("desktop_load_timeframe"), width = 4)), - dygraphOutput("desktop_load_plot"), - includeMarkdown("./tab_documentation/desktop_load.md")), - tabItem(tabName = "paulscore_approx", - fluidRow( - column(polloi::smooth_select("smoothing_paulscore_approx"), width = 4), - column(polloi::timeframe_select("paulscore_approx_timeframe"), width = 4), - column(polloi::timeframe_daterange("paulscore_approx_timeframe"), width = 4)), - dygraphOutput("paulscore_approx_plot_fulltext"), - div(id = "paulscore_approx_legend", style = "text-align: center;"), - dygraphOutput("paulscore_approx_plot_autocomplete"), - includeMarkdown("./tab_documentation/paulscore_approx.md")), - tabItem(tabName = "mobile_events", - fluidRow( - valueBoxOutput("mobile_event_searches"), - valueBoxOutput("mobile_event_resultsets"), - valueBoxOutput("mobile_event_clickthroughs")), - fluidRow( - column(polloi::smooth_select("smoothing_mobile_event"), width = 4), - column(polloi::timeframe_select("mobile_event_timeframe"), width = 4), - column(polloi::timeframe_daterange("mobile_event_timeframe"), width = 4)), - dygraphOutput("mobile_event_plot"), - includeMarkdown("./tab_documentation/mobile_events.md") + dashboardSidebar( + tags$head( + tags$link(rel = "stylesheet", type = "text/css", href = "stylesheet.css"), + tags$script(src = "custom.js") + ), + sidebarMenu(id = "tabs", + menuItem(text = "KPIs", + div(selectInput("kpi_summary_date_range_selector", + label = "KPI data range", multiple = FALSE, selected = "monthly", + choices = list("Yesterday" = "daily", "Last 7 days" = "weekly", + "Last 30 days" = "monthly", "Last 90 days" = "quarterly")), + style = "margin-bottom:-10px;"), + menuSubItem(text = "Summary", tabName = "kpis_summary"), + menuSubItem(text = "Monthly Metrics", tabName = "monthly_metrics"), + menuSubItem(text = "Load times", tabName = "kpi_load_time"), + menuSubItem(text = "Zero results", tabName = "kpi_zero_results"), + menuSubItem(text = "API usage", tabName = "kpi_api_usage"), + menuSubItem(text = "Augmented Clickthrough", tabName = "kpi_augmented_clickthroughs"), + icon = icon("star", lib = "glyphicon")), + menuItem(text = "Desktop", + menuSubItem(text = "Events", tabName = "desktop_events"), + menuSubItem(text = "Load times", tabName = "desktop_load"), + menuSubItem(text = "PaulScore", tabName = "paulscore_approx")), + menuItem(text = "Mobile Web", + menuSubItem(text = "Events", tabName = "mobile_events"), + menuSubItem(text = "Load times", tabName = "mobile_load")), + menuItem(text = "Mobile Apps", + menuSubItem(text = "Events", tabName = "app_events"), + menuSubItem(text = "Load times", tabName = "app_load"), + menuSubItem(text = "Click Position", tabName = "app_click_position"), + menuSubItem(text = "Invoke Source", tabName = "app_invoke_source") + ), + menuItem(text = "API", + menuSubItem(text = "Full-text via API", tabName = "fulltext_search"), + menuSubItem(text = "Open Search", tabName = "open_search"), + menuSubItem(text = "Geo Search", tabName = "geo_search"), + menuSubItem(text = "Prefix Search", tabName = "prefix_search"), + menuSubItem(text = "Language Search", tabName = "language_search")), + menuItem(text = "Zero Results", + menuSubItem(text = "Summary", tabName = "failure_rate"), + menuSubItem(text = "Search Type Breakdown", tabName = "failure_breakdown"), + menuSubItem(text = "Search Suggestions", tabName = "failure_suggestions"), + menuSubItem(text = "Language/Project Breakdown", tabName = "failure_langproj")), + menuItem(text = "Page Visit Times", tabName = "survival"), + menuItem(text = "Global Settings", + selectInput(inputId = "smoothing_global", label = "Smoothing", selectize = TRUE, selected = "day", + choices = c("No Smoothing" = "day", "Weekly Median" = "week", + "Monthly Median" = "month", "Splines" = "gam")), + icon = icon("cog", lib = "glyphicon")) + ), + div(icon("info-sign", lib = "glyphicon"), HTML("<strong>Tip</strong>: you can drag on the graphs with your mouse to zoom in on a particular date range."), style = "padding: 10px; color: white;"), + div(bookmarkButton(), style = "text-align: center;") ), - tabItem(tabName = "mobile_load", - fluidRow( - column(polloi::smooth_select("smoothing_mobile_load"), width = 4), - column(polloi::timeframe_select("mobile_load_timeframe"), width = 4), - column(polloi::timeframe_daterange("mobile_load_timeframe"), width = 4)), - dygraphOutput("mobile_load_plot"), - includeMarkdown("./tab_documentation/mobile_load.md") - ), - tabItem(tabName = "app_events", - fluidRow( - valueBoxOutput("app_event_searches"), - valueBoxOutput("app_event_resultsets"), - valueBoxOutput("app_event_clickthroughs")), - fluidRow( - column(polloi::smooth_select("smoothing_app_event"), width = 4), - column(polloi::timeframe_select("app_event_timeframe"), width = 4), - column(polloi::timeframe_daterange("app_event_timeframe"), width = 4)), - dygraphOutput("android_event_plot"), - dygraphOutput("ios_event_plot"), - includeMarkdown("./tab_documentation/app_events.md") - ), - tabItem(tabName = "app_load", - fluidRow( - column(polloi::smooth_select("smoothing_app_load"), width = 4), - column(polloi::timeframe_select("app_load_timeframe"), width = 4), - column(polloi::timeframe_daterange("app_load_timeframe"), width = 4)), - dygraphOutput("android_load_plot"), - dygraphOutput("ios_load_plot"), - includeMarkdown("./tab_documentation/app_load.md") - ), - tabItem(tabName = "app_click_position", - fluidRow( - column(polloi::smooth_select("smoothing_app_click_position"), width = 4), - column(polloi::timeframe_select("app_click_position_timeframe"), width = 4), - column(polloi::timeframe_daterange("app_click_position_timeframe"), width = 4)), - div(id = "app_click_position_legend", class = "large"), - dygraphOutput("click_position_plot"), - includeMarkdown("./tab_documentation/click_position.md") - ), - tabItem(tabName = "app_invoke_source", - fluidRow( - column(polloi::smooth_select("smoothing_app_invoke_source"), width = 4), - column(polloi::timeframe_select("app_invoke_source_timeframe"), width = 4), - column(polloi::timeframe_daterange("app_invoke_source_timeframe"), width = 4)), - div(id = "app_invoke_source_legend"), - dygraphOutput("invoke_source_plot"), - includeMarkdown("./tab_documentation/invoke_source.md") - ), - tabItem(tabName = "fulltext_search", - fluidRow( - column(polloi::smooth_select("smoothing_fulltext_search"), width = 4), - column(polloi::timeframe_select("fulltext_search_timeframe"), width = 4), - column(polloi::timeframe_daterange("fulltext_search_timeframe"), width = 4)), - dygraphOutput("cirrus_aggregate"), - includeMarkdown("./tab_documentation/fulltext_basic.md") - ), - tabItem(tabName = "open_search", - fluidRow( - column(polloi::smooth_select("smoothing_open_search"), width = 4), - column(polloi::timeframe_select("open_search_timeframe"), width = 4), - column(polloi::timeframe_daterange("open_search_timeframe"), width = 4)), - dygraphOutput("open_aggregate"), - includeMarkdown("./tab_documentation/open_basic.md") - ), - tabItem(tabName = "geo_search", - fluidRow( - column(polloi::smooth_select("smoothing_geo_search"), width = 4), - column(polloi::timeframe_select("geo_search_timeframe"), width = 4), - column(polloi::timeframe_daterange("geo_search_timeframe"), width = 4)), - dygraphOutput("geo_aggregate"), - includeMarkdown("./tab_documentation/geo_basic.md") - ), - tabItem(tabName = "prefix_search", - fluidRow( - column(polloi::smooth_select("smoothing_prefix_search"), width = 4), - column(polloi::timeframe_select("prefix_search_timeframe"), width = 4), - column(polloi::timeframe_daterange("prefix_search_timeframe"), width = 4)), - dygraphOutput("prefix_aggregate"), - includeMarkdown("./tab_documentation/prefix_basic.md") - ), - tabItem(tabName = "language_search", - fluidRow( - column(polloi::smooth_select("smoothing_language_search"), width = 4), - column(polloi::timeframe_select("language_search_timeframe"), width = 4), - column(polloi::timeframe_daterange("language_search_timeframe"), width = 4)), - dygraphOutput("language_aggregate"), - includeMarkdown("./tab_documentation/language_basic.md") - ), - tabItem(tabName = "failure_rate", - fluidRow( - column(polloi::smooth_select("smoothing_failure_rate"), width = 4), - column(polloi::timeframe_select("failure_rate_timeframe"), width = 4), - column(polloi::timeframe_daterange("failure_rate_timeframe"), width = 4)), - polloi::automata_select(input_id = "failure_rate_automata"), - dygraphOutput("failure_rate_plot"), - dygraphOutput("failure_rate_change_plot"), - includeMarkdown("./tab_documentation/failure_rate.md") - ), - tabItem(tabName = "failure_breakdown", - fluidRow( - column(polloi::smooth_select("smoothing_failure_breakdown"), width = 4), - column(polloi::timeframe_select("failure_breakdown_timeframe"), width = 4), - column(polloi::timeframe_daterange("failure_breakdown_timeframe"), width = 4)), - polloi::automata_select(input_id = "failure_breakdown_automata"), - dygraphOutput("failure_breakdown_plot"), - div(id = "failure_breakdown_plot_legend"), - includeMarkdown("./tab_documentation/failure_breakdown.md") - ), - tabItem(tabName = "failure_suggestions", - fluidRow( - column(polloi::smooth_select("smoothing_failure_suggestions"), width = 4), - column(polloi::timeframe_select("failure_suggestions_timeframe"), width = 4), - column(polloi::timeframe_daterange("failure_suggestions_timeframe"), width = 4)), - polloi::automata_select(input_id = "failure_suggestions_automata"), - dygraphOutput("suggestion_dygraph_plot"), - includeMarkdown("./tab_documentation/failure_suggests.md") - ), - tabItem(tabName = "failure_langproj", - fluidRow( - column(polloi::smooth_select("smoothing_failure_langproj"), width = 4), - column(polloi::timeframe_select("failure_langproj_timeframe"), width = 4), - column(polloi::timeframe_daterange("failure_langproj_timeframe"), width = 4)), - polloi::automata_select(input_id = "failure_langproj_automata"), - fluidRow(column(selectInput("project_order", "Sort projects by", - list("Alphabetical order" = "alphabet", "Volume of requests" = "volume"), - selected = "volume"), - uiOutput("project_selector_container"), width = 2), - column(selectInput("language_order", "Sort languages by", - list("Alphabetical order" = "alphabet", "Volume of requests" = "volume"), - selected = "volume"), - uiOutput("language_selector_container"), width = 2), - column(dygraphOutput("failure_langproj_plot"), - div(id = "failure_langproj_legend", style = "margin-top:30px;"), width = 8)), - includeMarkdown("./tab_documentation/failure_langproj.md") - ), - tabItem(tabName = "survival", - fluidRow( - column(polloi::smooth_select("smoothing_lethal_dose_plot"), width = 4), - column(polloi::timeframe_select("lethal_dose_timeframe"), width = 4), - column(polloi::timeframe_daterange("lethal_dose_timeframe"), width = 4)), - div(id = "lethal_dose_plot_legend"), - dygraphOutput("lethal_dose_plot"), - includeMarkdown("./tab_documentation/survival.md") - ) - ) -) -dashboardPage(header, sidebar, body, skin = "black", - title = "Search Metrics Dashboard | Discovery | Engineering | Wikimedia Foundation") + dashboardBody( + tabItems( + tabItem(tabName = "kpis_summary", + htmlOutput("kpi_summary_date_range"), + fluidRow(valueBoxOutput("kpi_summary_box_load_time", width = 3), + valueBoxOutput("kpi_summary_box_zero_results", width = 3), + valueBoxOutput("kpi_summary_box_api_usage", width = 3), + valueBoxOutput("kpi_summary_box_augmented_clickthroughs", width = 3)), + includeMarkdown("./tab_documentation/kpis_summary.md")), + tabItem(tabName = "monthly_metrics", + fluidRow( + column(fluidRow( + column(selectInput("monthy_metrics_month", "Month", + choices = month.name, + selected = month.name[lubridate::month(Sys.Date() - 1 - months(1))], + selectize = FALSE), + width = 6), + column(selectInput("monthy_metrics_year", "Year", + choices = lubridate::year(seq(lubridate::floor_date(as.Date("2016-01-01"), "year"), Sys.Date() - 1 - months(1), "year")), + selected = lubridate::year(Sys.Date() - 1 - months(1)), + selectize = FALSE), + width = 6) + ), + checkboxInput("monthly_metrics_prev_month", + "Show previous month", TRUE), + checkboxInput("monthly_metrics_prev_year", + "Show previous year", TRUE), + width = 4), + column(tableOutput("monthly_metrics_tbl"), width = 8) + ), + includeMarkdown("./tab_documentation/monthly_metrics.md")), + tabItem(tabName = "kpi_load_time", + fluidRow( + column(polloi::smooth_select("smoothing_kpi_load_time"), width = 4), + column(div(id = "kpi_load_time_series_legend"), width = 8) + ), + dygraphOutput("kpi_load_time_series"), + includeMarkdown("./tab_documentation/kpi_load_time.md")), + tabItem(tabName = "kpi_zero_results", + polloi::smooth_select("smoothing_kpi_zero_results"), + dygraphOutput("kpi_zero_results_series"), + includeMarkdown("./tab_documentation/kpi_zero_results.md")), + tabItem(tabName = "kpi_api_usage", + fluidRow(column(radioButtons("kpi_api_usage_series_data", + label = "Type of data to display", + choices = list("Calls" = "raw", + "Day-to-day % change" = "change"), + inline = TRUE), + width = 4), + column(checkboxInput("kpi_api_usage_series_log_scale", + label = "Log10 Scale", + value = FALSE), + width = 2), + column(checkboxInput("kpi_api_usage_series_include_open", + label = "Include OpenSearch in total", + value = TRUE), + width = 3), + column(polloi::smooth_select("smoothing_kpi_api_usage"), width = 3)), + dygraphOutput("kpi_api_usage_series"), + includeMarkdown("./tab_documentation/kpi_api_usage.md")), + tabItem(tabName = "kpi_augmented_clickthroughs", + fluidRow( + column(polloi::smooth_select("smoothing_augmented_clickthroughs"), width = 4), + column(div(id = "kpi_augmented_clickthroughs_series_legend"), width = 8)), + dygraphOutput("kpi_augmented_clickthroughs_series"), + includeMarkdown("./tab_documentation/kpi_augmented_clickthroughs.md")), + tabItem(tabName = "desktop_events", + fluidRow( + valueBoxOutput("desktop_event_searches"), + valueBoxOutput("desktop_event_resultsets"), + valueBoxOutput("desktop_event_clickthroughs")), + polloi::smooth_select("smoothing_desktop_event"), + dygraphOutput("desktop_event_plot"), + includeMarkdown("./tab_documentation/desktop_events.md")), + tabItem(tabName = "desktop_load", + polloi::smooth_select("smoothing_desktop_load"), + dygraphOutput("desktop_load_plot"), + includeMarkdown("./tab_documentation/desktop_load.md")), + tabItem(tabName = "paulscore_approx", + polloi::smooth_select("smoothing_paulscore_approx"), + dygraphOutput("paulscore_approx_plot_fulltext"), + div(id = "paulscore_approx_legend", style = "text-align: center;"), + dygraphOutput("paulscore_approx_plot_autocomplete"), + includeMarkdown("./tab_documentation/paulscore_approx.md")), + tabItem(tabName = "mobile_events", + fluidRow( + valueBoxOutput("mobile_event_searches"), + valueBoxOutput("mobile_event_resultsets"), + valueBoxOutput("mobile_event_clickthroughs")), + polloi::smooth_select("smoothing_mobile_event"), + dygraphOutput("mobile_event_plot"), + includeMarkdown("./tab_documentation/mobile_events.md") + ), + tabItem(tabName = "mobile_load", + polloi::smooth_select("smoothing_mobile_load"), + dygraphOutput("mobile_load_plot"), + includeMarkdown("./tab_documentation/mobile_load.md") + ), + tabItem(tabName = "app_events", + fluidRow( + valueBoxOutput("app_event_searches"), + valueBoxOutput("app_event_resultsets"), + valueBoxOutput("app_event_clickthroughs")), + polloi::smooth_select("smoothing_app_event"), + dygraphOutput("android_event_plot"), + dygraphOutput("ios_event_plot"), + includeMarkdown("./tab_documentation/app_events.md") + ), + tabItem(tabName = "app_load", + polloi::smooth_select("smoothing_app_load"), + dygraphOutput("android_load_plot"), + dygraphOutput("ios_load_plot"), + includeMarkdown("./tab_documentation/app_load.md") + ), + tabItem(tabName = "app_click_position", + polloi::smooth_select("smoothing_app_click_position"), + div(id = "app_click_position_legend", class = "large"), + dygraphOutput("click_position_plot"), + includeMarkdown("./tab_documentation/click_position.md") + ), + tabItem(tabName = "app_invoke_source", + polloi::smooth_select("smoothing_app_invoke_source"), + div(id = "app_invoke_source_legend"), + dygraphOutput("invoke_source_plot"), + includeMarkdown("./tab_documentation/invoke_source.md") + ), + tabItem(tabName = "fulltext_search", + polloi::smooth_select("smoothing_fulltext_search"), + dygraphOutput("cirrus_aggregate"), + includeMarkdown("./tab_documentation/fulltext_basic.md") + ), + tabItem(tabName = "open_search", + polloi::smooth_select("smoothing_open_search"), + dygraphOutput("open_aggregate"), + includeMarkdown("./tab_documentation/open_basic.md") + ), + tabItem(tabName = "geo_search", + polloi::smooth_select("smoothing_geo_search"), + dygraphOutput("geo_aggregate"), + includeMarkdown("./tab_documentation/geo_basic.md") + ), + tabItem(tabName = "prefix_search", + polloi::smooth_select("smoothing_prefix_search"), + dygraphOutput("prefix_aggregate"), + includeMarkdown("./tab_documentation/prefix_basic.md") + ), + tabItem(tabName = "language_search", + polloi::smooth_select("smoothing_language_search"), + dygraphOutput("language_aggregate"), + includeMarkdown("./tab_documentation/language_basic.md") + ), + tabItem(tabName = "failure_rate", + polloi::smooth_select("smoothing_failure_rate"), + polloi::automata_select(input_id = "failure_rate_automata"), + dygraphOutput("failure_rate_plot"), + dygraphOutput("failure_rate_change_plot"), + includeMarkdown("./tab_documentation/failure_rate.md") + ), + tabItem(tabName = "failure_breakdown", + polloi::smooth_select("smoothing_failure_breakdown"), + polloi::automata_select(input_id = "failure_breakdown_automata"), + dygraphOutput("failure_breakdown_plot"), + div(id = "failure_breakdown_plot_legend"), + includeMarkdown("./tab_documentation/failure_breakdown.md") + ), + tabItem(tabName = "failure_suggestions", + polloi::smooth_select("smoothing_failure_suggestions"), + polloi::automata_select(input_id = "failure_suggestions_automata"), + dygraphOutput("suggestion_dygraph_plot"), + includeMarkdown("./tab_documentation/failure_suggests.md") + ), + tabItem(tabName = "failure_langproj", + polloi::smooth_select("smoothing_failure_langproj"), + polloi::automata_select(input_id = "failure_langproj_automata"), + fluidRow(column(selectInput("project_order", "Sort projects by", + list("Alphabetical order" = "alphabet", "Volume of requests" = "volume"), + selected = "volume"), + uiOutput("project_selector_container"), width = 2), + column(selectInput("language_order", "Sort languages by", + list("Alphabetical order" = "alphabet", "Volume of requests" = "volume"), + selected = "volume"), + uiOutput("language_selector_container"), width = 2), + column(dygraphOutput("failure_langproj_plot"), + div(id = "failure_langproj_legend", style = "margin-top:30px;"), width = 8)), + includeMarkdown("./tab_documentation/failure_langproj.md") + ), + tabItem(tabName = "survival", + polloi::smooth_select("smoothing_lethal_dose_plot"), + div(id = "lethal_dose_plot_legend"), + dygraphOutput("lethal_dose_plot"), + includeMarkdown("./tab_documentation/survival.md") + ) + ) + ), + + skin = "black", title = "Search Metrics Dashboard | Discovery | Engineering | Wikimedia Foundation") +} diff --git a/www/rainbow.js b/www/custom.js similarity index 81% rename from www/rainbow.js rename to www/custom.js index 7f65bc0..5ae3036 100644 --- a/www/rainbow.js +++ b/www/custom.js @@ -22,4 +22,9 @@ // Reveals the KPI dropdown menu at launch: $('ul.sidebar-menu li.treeview').first().addClass('active'); + // Update the URL in the browser when a tab is clicked on: + $('a[href^="#shiny-tab"]').click(function(){ + window.location.hash = encodeURI($(this).attr('data-value')); + }); + }); -- To view, visit https://gerrit.wikimedia.org/r/311155 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0852673581c87a89d95da9f14715fc093daac6a6 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/discovery/rainbow Gerrit-Branch: master Gerrit-Owner: Bearloga <mpo...@wikimedia.org> Gerrit-Reviewer: Chelsyx <c...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits