-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.R
90 lines (82 loc) · 2.45 KB
/
app.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
82
83
84
85
86
87
88
89
90
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
library(shiny)
library(shinythemes)
library(shinyjs)
source("helpers.R")
# Define UI for application that logs into a server.
ui <- navbarPage(
header = tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "https://fonts.googleapis.com/css?family=Cabin|Oxygen+Mono|Roboto+Mono|Share+Tech+Mono|Source+Code+Pro"),
tags$style("* {font-family: 'Cabin', sans-serif !important;}", type = "text/css"),
tags$style(".fa, .far, .fas {font-family: 'Font Awesome 5 Free' !important;}", type = "text/css")
),
id = "main-nav",
title = "shinySCP",
theme = shinytheme("yeti"),
collapsible = TRUE,
# footer = tags$div(tags$p('<center>Made by Shaurita. D. Hutchins</center>')),
# Login Page
tabPanel(
title = "Login",
# Sidebar with a slider input for number of bins
fluidRow(
column(4),
column(4,
align = "center",
tags$div(
class = "well",
tags$h2("Login to a server"),
tags$br(),
textInput("username", label = h4("Username"), value = ""),
textInput("server", label = h4("Server"), value = ""),
textInput("password", label = h4("Password"), value = ""),
actionButton("submit", "Login"),
actionButton("reset", "Clear"),
tags$br(),
tags$br(),
textOutput("session")
)
),
column(4)
)
),
# About Page
tabPanel(
id = "About",
title = "About",
fluidRow(
column(3),
column(6,
align = "left",
tags$div(class = "container-fluid", includeMarkdown("assets/markdown/about.md"))
),
column(3)
)
)
)
# Define server logic required to login to a server
server <- function(input, output, session) {
x <- reactiveValues(username = NULL, server = NULL, password = NULL)
observeEvent(input$submit, {
x$username <- input$username
x$server <- input$server
x$password <- input$password
})
observeEvent(input$reset, {
updateTextInput(session, "username", value = "")
updateTextInput(session, "server", value = "")
updateTextInput(session, "password", value = "")
})
output$session <- renderPrint({
if (!is.null(x$username) | !is.null(x$server) | !is.null(x$password)) {
(
connect(x$username, x$server, x$password)
)
}
})
}
# Run the application
shinyApp(ui = ui, server = server)