Skip to content

Commit

Permalink
split app.R into ui.R and server.R as recommended by shiny
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejiang committed Sep 23, 2015
1 parent 18a7e48 commit 2840e82
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 41 deletions.
43 changes: 2 additions & 41 deletions R/app.R → R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,46 +40,7 @@ maketreelist <- function(df, root=df[1,1]) {

}
datadirectory = "../inst/extdata"
ui <- navbarPage("OpenCyto",
tabsetPanel(tabPanel("Data",{
navlistPanel(
tabPanel("Import",
tags$br(),
div(div(shinyDirButton("dir_btn",label = "choose...", title = "Please select a folder", buttonType = "primary")
,style="display:inline-block;")
, div(textInput("path_import",label = "workspaces path"), style="display:inline-block;")
,div(actionButton(inputId = "refresh_import",label = "Scan")
,style="display:inline-block;")
,style="display:inline-block;"),
div(h6(DT::dataTableOutput(outputId = "file_table",))),
actionButton("parse_chosen",label="Import Files"),
hidden(div(div(actionButton("parseGroup",label = "Parse Workspace"),style="display:inline-block;"),div(uiOutput("workspaceGroups"),style="display:inline-block"),div(textOutput("nsamples"),style="display:inline-block"),style='width:90%',id="parseUI")),
div(verbatimTextOutput("message1"),style='width:90%')
),

tabPanel("Load",
div(div(h5("Existing Data"),style="display:inline-block"),
div(div(textInput("path",label = "path",value = "../inst/extdata"),style="display:inline-block"),actionButton(inputId = "refresh",label = "Scan"),style="display:inline-block"),style="display:inline-block"),
div(h6(DT::dataTableOutput(outputId = "existing_data")), style = 'width:90%;'),
actionButton(inputId = "load",label = "Load Data"),
div(verbatimTextOutput("message"),style='width:90%')

),useShinyjs()
# ,extendShinyjs(script = "www/actions.js")
,id="datanavlist"
)

}),

tabPanel("Compensate & Transform","Compensate & Transform"),
tabPanel("Gating Template","Build a Gating Template"),
tabPanel("Tree","View Gating Tree",
div(div(diagonalNetworkOutput("tree",width="400px",height="300px"),
style="display:inline-block;float:left;"),div(imageOutput("gateplot",width = "300px",height="300px"),style="margin-left:400px;"),style="width:100%;height:100%;")
),id = "tabset"
)
)
server <- function(input, output,session){
function(input, output,session){
MAX_MB_UPLOAD = 1024 # one Gb limit.
options(shiny.maxRequestSize=MAX_MB_UPLOAD*1024^2)

Expand Down Expand Up @@ -218,6 +179,6 @@ server <- function(input, output,session){
output$gateplot = renderImage(plt(),deleteFile = FALSE)
})
}
shinyApp(ui = ui, server = server)



41 changes: 41 additions & 0 deletions R/ui.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
library(shiny)
library(DT)
navbarPage("OpenCyto",
tabsetPanel(tabPanel("Data",{
navlistPanel(
tabPanel("Import",
tags$br(),
div(div(shinyDirButton("dir_btn",label = "choose...", title = "Please select a folder", buttonType = "primary")
,style="display:inline-block;")
, div(textInput("path_import",label = "workspaces path"), style="display:inline-block;")
,div(actionButton(inputId = "refresh_import",label = "Scan")
,style="display:inline-block;")
,style="display:inline-block;"),
div(h6(DT::dataTableOutput(outputId = "file_table",))),
actionButton("parse_chosen",label="Import Files"),
hidden(div(div(actionButton("parseGroup",label = "Parse Workspace"),style="display:inline-block;"),div(uiOutput("workspaceGroups"),style="display:inline-block"),div(textOutput("nsamples"),style="display:inline-block"),style='width:90%',id="parseUI")),
div(verbatimTextOutput("message1"),style='width:90%')
),

tabPanel("Load",
div(div(h5("Existing Data"),style="display:inline-block"),
div(div(textInput("path",label = "path",value = "../inst/extdata"),style="display:inline-block"),actionButton(inputId = "refresh",label = "Scan"),style="display:inline-block"),style="display:inline-block"),
div(h6(DT::dataTableOutput(outputId = "existing_data")), style = 'width:90%;'),
actionButton(inputId = "load",label = "Load Data"),
div(verbatimTextOutput("message"),style='width:90%')

),useShinyjs()
# ,extendShinyjs(script = "www/actions.js")
,id="datanavlist"
)

}),

tabPanel("Compensate & Transform","Compensate & Transform"),
tabPanel("Gating Template","Build a Gating Template"),
tabPanel("Tree","View Gating Tree",
div(div(diagonalNetworkOutput("tree",width="400px",height="300px"),
style="display:inline-block;float:left;"),div(imageOutput("gateplot",width = "300px",height="300px"),style="margin-left:400px;"),style="width:100%;height:100%;")
),id = "tabset"
)
)

0 comments on commit 2840e82

Please sign in to comment.