Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

photon:::photon_rstudioaddin() problem #43

Open
wants to merge 1 commit into
base: dev-branch
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 50 additions & 51 deletions R/photon_rstudioaddin.R
Original file line number Diff line number Diff line change
@@ -1,72 +1,63 @@
#' @title Launch an RStudio addin to build ShinyApp using Electron Framework
#' @import shiny
#' @import miniUI
#' @import shinyFiles
#'
#' @export
#'


photon_rstudioaddin <- function(RscriptRepository = NULL) {

requireNamespace("shiny")
requireNamespace("miniUI")
requireNamespace("shinyFiles")


ui <- miniUI::miniPage(
# Shiny fileinput resethandler

miniUI::gadgetTitleBar("Use photon to build your shiny app"),
miniUI::gadgetTitleBar("Use Photon to Build Standalone Shiny Apps",
left = NULL, right = NULL),

miniUI::miniTabstripPanel(
#miniUI::miniTabPanel(
#title = 'Build standalone Shiny App for first time',
#icon = shiny::icon("cloud-upload"),
miniUI::miniContentPanel(
shiny::h4("Choose your Shiny App directory"),
shinyFiles::shinyDirButton('dirSelect',
label = 'Select directory',
shiny::h4("Shiny App Directory:"),
fillRow(flex = c(1, 3),
shinyFiles::shinyDirButton('dirSelect', label = 'Select directory',
title = 'Choose your Shiny App directory'),
shiny::verbatimTextOutput('currentdirselected')
),
shiny::br(),
shiny::br(),
shiny::fillRow(
flex = c(3, 3),
shiny::column(
3,
shiny::div(class = "control-label",
shiny::strong("Selected Rscript")),
shiny::verbatimTextOutput('currentdirselected'),
shiny::dateInput(
'date',
label = "Creation date:",
startview = "month",
weekstart = 1,
min = Sys.Date()
),
shiny::textInput('rscript_args',
label = "Additional arguments to Rscript",
value = ""),
shiny::textInput('rscript_repository',
label = "Rscript repository path: launch & log location",
value =NULL),
shiny::actionButton('create', "Create job", icon = shiny::icon("play-circle"))
),
shiny::column(
3,
shiny::textInput('jobdescription',
label = "Job description",
value = "Photons light up!"),
shiny::textInput('cran_packages',
label = "CRAN package (ex. mgcv,matrixStats)",
value = "NULL"),
shiny::textInput('github_packages',
label = "GitHub packages (ex. thomasp85/patchwork)",
value = "NULL"),

shiny::textInput('bioc_packages',
label = "Bioconductor packages (ex. SummarizedExperiemnt,VariantAnnotation)",
value = "NULL")

)
)
shiny::h4("CRAN Packages:"),
shiny::textInput('cran_packages',
label = ("ex: mgcv,matrixStats"),
value = "NULL"),
shiny::br(),

shinyBS::bsCollapse(id = "adv", open = NULL,
shinyBS::bsCollapsePanel(
shiny::tags$b("> Click for Advanced Options"), NULL,
shiny::textInput('github_packages',
label = "GitHub packages (ex. thomasp85/patchwork):",
value = "NULL", width = "100%"),

shiny::textInput('bioc_packages',
label = "Bioconductor packages (ex. SummarizedExperiment,VariantAnnotation):",
value = "NULL", width = "100%")

# shiny::textInput('rscript_args',
# label = "Additional arguments to Rscript",
# value = ""),
# shiny::textInput('rscript_repository',
# label = "R script repository path: launch & log location",
# value =NULL, width = "100%")))

)))),
miniUI::miniButtonBlock(
actionButton("create", "Build", icon("play-circle"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
)
)

)

# Server code for the gadget.
Expand All @@ -89,9 +80,16 @@ photon_rstudioaddin <- function(RscriptRepository = NULL) {
})
output$currentdirselected <-
shiny::renderText({
as.character(shinyFiles::parseDirPath(volumes, input$dirSelect))
req(input$dirSelect)

print(paste("Selected directory:",
as.character(shinyFiles::parseDirPath(volumes, input$dirSelect))))
})

observeEvent(input$coll, ({
shinyBS::updateCollapse(session, "adv", open = "Advanced Options")
}))


###########################
# CREATE / OVERWRITE
Expand Down Expand Up @@ -130,3 +128,4 @@ photon_rstudioaddin <- function(RscriptRepository = NULL) {
#viewer <- shiny::paneViewer()
shiny::runGadget(ui, server, viewer = viewer)
}