-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui.R
81 lines (80 loc) · 3.62 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
library(shiny)
library(shinyjs)
function(request) {
fluidPage(
useShinyjs(), # Include shinyjs
titlePanel("Sentiment Analysis of Talk Pages"),
sidebarLayout(
sidebarPanel(
textInput("page_name", "Page Name",
placeholder = "Talk:Cross-wiki Search Result Improvements"),
helpText("Page must use Flow, parser does not support classic talk pages."),
radioButtons("source", "Source", selected = "api",
choices = c("API" = "api", "Project & Language" = "proj")),
conditionalPanel("input.source == 'api'",
textInput("api", "URL to api.php",
placeholder = "www.mediawiki.org/w/api.php")),
conditionalPanel("input.source == 'proj'",
selectInput("project", "Project",
choices = c("MediaWiki" = "mediawiki")),
conditionalPanel("input.project == 'MediaWiki'",
selectInput("language", "Language Code",
choices = c("None" = "-")))),
selectInput("demo", "Demo Talk Pages", choices = c(
"Talk:Cross-wiki Search Result Improvements",
"Talk:Wikipedia.org Portal A/B testing",
"Talk:TextCat",
"Talk:Flow",
"Talk:VisualEditor",
"Talk:Wikimedia Product",
"Talk:Beta Features"
)),
br(),
fluidRow(
column(actionButton("random_btn", "Random", icon = icon("random")), align = "center", width = 6),
column(bookmarkButton(label = "Bookmark"), align = "center", width = 6)
),
br(),
div(actionButton("analyze_btn", "Analyze Talk Page", icon = icon("refresh")),
style = "text-align: center;"),
br(),
div(textOutput("message"), style = "text-align: center;")
),
mainPanel(
tabsetPanel(
tabPanel("Overall Sentiment",
plotOutput("breakdown_overall"), icon = icon("bar-chart")),
tabPanel("Sentiment by Topic",
br(),
fluidRow(
column(uiOutput("topics_container"), width = 8),
column(checkboxInput("topics_include", "Include \"none/other\"", TRUE), width = 4)
),
br(),
plotOutput("breakdown_topic"),
icon = icon("indent")),
tabPanel("Sentiment by Participant",
br(),
fluidRow(
column(uiOutput("participants_container"), width = 8),
column(checkboxInput("participants_include", "Include \"none/other\"", TRUE), width = 4)
),
br(),
plotOutput("breakdown_participant"),
icon = icon("user")),
tabPanel("API Endpoint Usage",
br(),
p("You can access the raw output using the API endpoint:"),
htmlOutput("api_call"),
p("It will output JSON-formatted sentiment breakdown. See",
a("GitHub/bearloga/wmf-wmhack17/api", href = "https://github.com/bearloga/wmf-wmhack17/tree/master/api"),
"for more details."),
actionButton("use_api", "Make API call and show JSON output"),
div(verbatimTextOutput("api_output"), style = "margin-top: 10px; height: 300px; overflow:scroll;"),
icon = icon("gears"))
)
)
),
theme = shinythemes::shinytheme("cosmo")
)
}