[MediaWiki-commits] [Gerrit] adds context param and observer routing for external linking... - change (wikidata...dashboard)
Christopher Johnson (WMDE) has submitted this change and it was merged. Change subject: adds context param and observer routing for external linking moves base file loading to global.R and dependency libraries to config.R adds external link icon to server-recent .. adds context param and observer routing for external linking moves base file loading to global.R and dependency libraries to config.R adds external link icon to server-recent Change-Id: If4b8fb87669b59b5c83399b9a095b042506560ef --- A .arclint M config.R A global.R M server.R M ui.R 5 files changed, 92 insertions(+), 25 deletions(-) Approvals: Christopher Johnson (WMDE): Verified; Looks good to me, approved diff --git a/.arclint b/.arclint new file mode 100644 index 000..9c27335 --- /dev/null +++ b/.arclint @@ -0,0 +1,57 @@ +{ + "exclude": [], + "linters": { +"chmod": { + "type": "chmod" +}, +"filename": { + "type": "filename" +}, +"generated": { + "type": "generated" +}, +"json": { + "type": "json", + "include": [ + "(^\\.arcconfig$)", + "(^\\.arclint$)", + "(\\.json$)" + ] +}, +"merge-conflict": { + "type": "merge-conflict" +}, +"nolint": { + "type": "nolint" +}, +"phutil-library": { + "type": "phutil-library", + "include": "(^\\.php$)" +}, +"phutil-xhpast": { + "type": "phutil-xhpast" +}, +"spelling": { + "type": "spelling" +}, +"text": { + "type": "text" +}, +"text-without-length": { + "type": "text", + "severity": { +"3": "disabled" + } +}, +"xhpast": { + "type": "xhpast", + "include": "(\\.php$)", + "severity": { +"16": "advice", +"34": "error" + }, + "xhpast.php-version": "5.3.0", + "xhpast.php-version.windows": "5.3.0" +} + } +} diff --git a/config.R b/config.R index 7c05030..c5a8089 100644 --- a/config.R +++ b/config.R @@ -1,4 +1,8 @@ -#Dependent libs +options(scipen = 500) + +library(shiny) +library(shinydashboard) +library(dygraphs) library(plyr) library(readr) library(xts) @@ -14,10 +18,11 @@ library(data.table) library(DT) library(XML) + data_uri <- "/srv/dashboards/shiny-server/wdm/data/" sparql_data_uri <- "/srv/dashboards/shiny-server/wdm/data/sparql/" source_data_uri <- "http://wdm-data.wmflabs.org/data/"; agg_data_uri <- "http://datasets.wikimedia.org/aggregate-datasets/wikidata/"; wdqs_uri <- "https://query.wikidata.org/bigdata/namespace/wdq/sparql?query="; custom_css <- "./assets/css/custom.css" -metrics_rdf = "/srv/dashboards/shiny-server/wdm/assets/metrics.owl" +metrics_rdf <- "/srv/dashboards/shiny-server/wdm/assets/metrics.owl" diff --git a/global.R b/global.R new file mode 100644 index 000..8bbfdda --- /dev/null +++ b/global.R @@ -0,0 +1,3 @@ +source("config.R") +source("model.R") +source("utils.R") \ No newline at end of file diff --git a/server.R b/server.R index 47c598a..92109d9 100644 --- a/server.R +++ b/server.R @@ -1,8 +1,3 @@ -## Version 0.2.0 -source("config.R") -source("model.R") -source("utils.R") - #Load Data get_data <- function(updateProgress = NULL) { if (is.function(updateProgress)) { @@ -20,17 +15,26 @@ #Start Server function(input, output, session) { - progress <- shiny::Progress$new() - progress$set(message = "Fetching data", value = 0) - on.exit(progress$close()) - updateProgress <- function(value = NULL, detail = NULL) { -if (is.null(value)) { - value <- progress$getValue() - value <- value + (progress$getMax() - value) / 5 +progress <- shiny::Progress$new() +progress$set(message = "Fetching data", value = 0) +on.exit(progress$close()) +updateProgress <- function(value = NULL, detail = NULL) { + if (is.null(value)) { +value <- progress$getValue() +value <- value + (progress$getMax() - value) / 5 + } + progress$set(value = value, detail = detail) } -progress$set(value = value, detail = detail) - } - get_data(updateProgress) +get_data(updateProgress) + +observe({ + context <- parseQueryString(session$clientData$url_search) + if (!is.null(context$t)) { +observeEvent(context$t, { + updateTabItems(session, "tabs", context$t) +}) + } +}) observeEvent(input$switchtab, { updateTabItems(session, "tabs", input$switchtab) diff --git a/ui.R b/ui.R index 71c16c1..bab6f07 100644 --- a/ui.R +++ b/ui.R @@ -1,8 +1,3 @@ -library(shiny) -library(shinydashboard) -library(dygraphs) -options(scipen = 500) - #Header elements for the visualisation header <- dashboardHeader(title = "Wikidata Metrics", disable = FALSE) @@ -72,7 +67,8 @@ tags$br(), fluidRow( uiOutput("metric_meta_recent_edits_seeAlso") -)), +), +tags$a(href="./?t=wikidata_daily_e
[MediaWiki-commits] [Gerrit] adds context param and observer routing for external linking... - change (wikidata...dashboard)
Christopher Johnson (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/247181 Change subject: adds context param and observer routing for external linking moves all dependency loading to global.R adds external link icon to server-recent .. adds context param and observer routing for external linking moves all dependency loading to global.R adds external link icon to server-recent Change-Id: If4b8fb87669b59b5c83399b9a095b042506560ef --- A bulk_sparql.Re.Rout M config.R A global.R M server.R M ui.R 5 files changed, 41 insertions(+), 25 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikidata/analytics/dashboard refs/changes/81/247181/1 diff --git a/bulk_sparql.Re.Rout b/bulk_sparql.Re.Rout new file mode 100644 index 000..dacfe5f --- /dev/null +++ b/bulk_sparql.Re.Rout @@ -0,0 +1 @@ +Fatal error: cannot open file 'bulk_sparql.Re': No such file or directory diff --git a/config.R b/config.R index 7c05030..c5a8089 100644 --- a/config.R +++ b/config.R @@ -1,4 +1,8 @@ -#Dependent libs +options(scipen = 500) + +library(shiny) +library(shinydashboard) +library(dygraphs) library(plyr) library(readr) library(xts) @@ -14,10 +18,11 @@ library(data.table) library(DT) library(XML) + data_uri <- "/srv/dashboards/shiny-server/wdm/data/" sparql_data_uri <- "/srv/dashboards/shiny-server/wdm/data/sparql/" source_data_uri <- "http://wdm-data.wmflabs.org/data/"; agg_data_uri <- "http://datasets.wikimedia.org/aggregate-datasets/wikidata/"; wdqs_uri <- "https://query.wikidata.org/bigdata/namespace/wdq/sparql?query="; custom_css <- "./assets/css/custom.css" -metrics_rdf = "/srv/dashboards/shiny-server/wdm/assets/metrics.owl" +metrics_rdf <- "/srv/dashboards/shiny-server/wdm/assets/metrics.owl" diff --git a/global.R b/global.R new file mode 100644 index 000..75fd140 --- /dev/null +++ b/global.R @@ -0,0 +1,8 @@ +options(scipen = 500) + +library(shiny) +library(shinydashboard) +library(dygraphs) +source("config.R") +source("model.R") +source("utils.R") \ No newline at end of file diff --git a/server.R b/server.R index 47c598a..92109d9 100644 --- a/server.R +++ b/server.R @@ -1,8 +1,3 @@ -## Version 0.2.0 -source("config.R") -source("model.R") -source("utils.R") - #Load Data get_data <- function(updateProgress = NULL) { if (is.function(updateProgress)) { @@ -20,17 +15,26 @@ #Start Server function(input, output, session) { - progress <- shiny::Progress$new() - progress$set(message = "Fetching data", value = 0) - on.exit(progress$close()) - updateProgress <- function(value = NULL, detail = NULL) { -if (is.null(value)) { - value <- progress$getValue() - value <- value + (progress$getMax() - value) / 5 +progress <- shiny::Progress$new() +progress$set(message = "Fetching data", value = 0) +on.exit(progress$close()) +updateProgress <- function(value = NULL, detail = NULL) { + if (is.null(value)) { +value <- progress$getValue() +value <- value + (progress$getMax() - value) / 5 + } + progress$set(value = value, detail = detail) } -progress$set(value = value, detail = detail) - } - get_data(updateProgress) +get_data(updateProgress) + +observe({ + context <- parseQueryString(session$clientData$url_search) + if (!is.null(context$t)) { +observeEvent(context$t, { + updateTabItems(session, "tabs", context$t) +}) + } +}) observeEvent(input$switchtab, { updateTabItems(session, "tabs", input$switchtab) diff --git a/ui.R b/ui.R index 71c16c1..bab6f07 100644 --- a/ui.R +++ b/ui.R @@ -1,8 +1,3 @@ -library(shiny) -library(shinydashboard) -library(dygraphs) -options(scipen = 500) - #Header elements for the visualisation header <- dashboardHeader(title = "Wikidata Metrics", disable = FALSE) @@ -72,7 +67,8 @@ tags$br(), fluidRow( uiOutput("metric_meta_recent_edits_seeAlso") -)), +), +tags$a(href="./?t=wikidata_daily_edits_delta", "Link here: ", icon("external-link"))), tabItem(tabName = "wikidata_daily_pages_delta", dygraphOutput("wikidata_daily_pages_delta_plot"), tags$br(), @@ -82,7 +78,8 @@ tags$br(), fluidRow( uiOutput("metric_meta_recent_pages_seeAlso") -)), +), +tags$a(href="./?t=wikidata_daily_pages_delta", "Link here: ", icon("external-link"))), tabItem(tabName = "wikidata_daily_users_delta", dygraphOutput("wikidata_daily_users_delta_plot"), tags$br(), @@ -91,7 +88,8 @@ tags$br(), fluidRow( uiOutput("metric_meta_recent_users_seeAlso") -)), +), +tags$a(href="./?t=wikidata_daily_users_delta", "Link here: ", icon("external-link"))), tabItem(tabName = "wikidata_daily_social"