Commit 5d124132 authored by jlopez's avatar jlopez
Browse files

Add predefined tools

parent 4b9eea59
......@@ -47,7 +47,39 @@ tabPanel("Param panel 2", height = "300px", style = "overflow: hidden; overflow-
),
tabPanel("Param panel 3", height = "300px", style = "overflow: hidden; overflow-y:scroll"),
tabPanel("Param panel 3", height = "300px", style = "overflow: hidden; overflow-y:scroll", br(),
selectInput("selectpanel3", label = "Select the tool to use : ", choices = list("biotoolB" = "biotoolB", "biotoolA" = "biotoolA")),
box(title = "Tool biotoolB :", width = 12, status = "success", collapsible = TRUE, solidHeader = TRUE,
textInput("inputs_param1", label = "Input Param1 :", value = "", width = "auto"),
sliderInput("inputs_param2", label = "Slider param2 :", min = 0, max = 100, step = 1, width = "auto", value = 50),
sliderInput("inputs_param3", label = "Slider param3 :", min = 10, max = 20, step = 0.1, width = "auto", value = c(11.8,19.6)),
checkboxInput("inputs_param8", label = "Checkbox 1", value = TRUE),
checkboxInput("inputs_param9", label = "Checkbox 2", value = FALSE),
actionButton("inputs_testButton", "Test", class="btn btn-success")
),
box(title = "Tool biotoolA :", width = 12, status = "success", collapsible = TRUE, solidHeader = TRUE,
textInput("param1", label = "Input Param1 :", value = "", width = "auto"),
sliderInput("param2", label = "Slider param2 :", min = 0, max = 100, step = 1, width = "auto", value = 50),
sliderInput("param3", label = "Slider param3 :", min = 10, max = 20, step = 0.1, width = "auto", value = c(11.8,19.6)),
checkboxInput("param8", label = "Checkbox 1", value = TRUE),
checkboxInput("param9", label = "Checkbox 2", value = FALSE),
actionButton("testButton", "Test", class="btn btn-success")
)
),
tabPanel("Param panel 4", height = "300px", style = "overflow: hidden; overflow-y:scroll"),
......
......@@ -8,6 +8,16 @@ observeEvent(input$testButton2, {
})
#' Event when use inputs_testButton button
observeEvent(input$inputs_testButton, {
})
#' Event when use testButton button
observeEvent(input$testButton, {
})
#' Event when use runP button
observeEvent(input$runP, {
......@@ -85,6 +95,68 @@ observeEvent(input$runP, {
# Panel : panel3
# Tool : biotoolB
if(input$selectpanel3 == "biotoolB") {
if(!is.na(as.numeric(input$inputs_param1))) {
res <- paste(res, "inputs_param1:", input$inputs_param1, "\n", sep = " ")
} else {
res <- paste(res, "inputs_param1:", paste0('"', input$inputs_param1, '"'), "\n", sep = " ")
}
res <- paste(res, "inputs_param2:", input$inputs_param2, "\n", sep = " ")
res <- paste(res, "inputs_param3_min:", input$inputs_param3[1], "\n", sep = " ")
res <- paste(res, "inputs_param3_max:", input$inputs_param3[2], "\n", sep = " ")
res <- paste(res, "inputs_param3_step:", "0.1", "\n", sep = " ")
if(input$inputs_param8) {
res <- paste(res, "inputs_param8:", "true", "\n", sep = " ")
} else {
res <- paste(res, "inputs_param8:", "false", "\n", sep = " ")
}
if(input$inputs_param9) {
res <- paste(res, "inputs_param9:", "true", "\n", sep = " ")
} else {
res <- paste(res, "inputs_param9:", "false", "\n", sep = " ")
}
}
# Tool : biotoolA
if(input$selectpanel3 == "biotoolA") {
if(!is.na(as.numeric(input$param1))) {
res <- paste(res, "param1:", input$param1, "\n", sep = " ")
} else {
res <- paste(res, "param1:", paste0('"', input$param1, '"'), "\n", sep = " ")
}
res <- paste(res, "param2:", input$param2, "\n", sep = " ")
res <- paste(res, "param3_min:", input$param3[1], "\n", sep = " ")
res <- paste(res, "param3_max:", input$param3[2], "\n", sep = " ")
res <- paste(res, "param3_step:", "0.1", "\n", sep = " ")
if(input$param8) {
res <- paste(res, "param8:", "true", "\n", sep = " ")
} else {
res <- paste(res, "param8:", "false", "\n", sep = " ")
}
if(input$param9) {
res <- paste(res, "param9:", "true", "\n", sep = " ")
} else {
res <- paste(res, "param9:", "false", "\n", sep = " ")
}
}
# Panel : panel4
# Panel : panel5
......
......@@ -17,6 +17,7 @@ App:
boxes: [
{
name: "A",
defined: false,
title: "Tool A :",
status: "success", # status : primary, success, danger, warning, info
content: [# type possible : text, slider, select, radio, checkbox, file, button, help
......@@ -32,6 +33,7 @@ App:
},
{
name: "B",
defined: false,
title: "Tool B :",
status: "success",
content: [
......@@ -49,6 +51,7 @@ App:
boxes: [
{
name: "C",
defined: false,
title: "Tool C :",
status: "success",
content: [
......@@ -63,6 +66,16 @@ App:
panel: "Param panel 3",
name: "panel3",
boxes: [
{
name: "biotoolB",
defined: true,
concat_name_param: true # namepage_nameparam
},
{
name: "biotoolA",
defined: true,
concat_name_param: true
}
]
},
{
......@@ -107,6 +120,7 @@ App:
{
name: "D",
title: "Tool D :",
defined: false,
status: "success",
content: [
{name: "first_name", type: "text", value: "", label: "First name :"},
......
......@@ -3,8 +3,28 @@ library(yaml)
path_yml <- "/home/jimmy/jimmy/projets/sag/app/pipelineR.yml"
path_tools <- "/home/jimmy/jimmy/projets/sag/predefined_tools/"
APP <<- yaml.load_file(path_yml)$App
files_tools <- paste0(path_tools, list.files(path_tools))
all <- list()
index <- 1
for(f in files_tools) {
yml <- yaml.load_file(f)
if(length(yml) == 0) {
all <- list(yaml.load_file(f))
} else {
all[[index]] <- yaml.load_file(f)
}
index <- index + 1
}
YML_TOOLS <<- all
YML_TOOLS
#============================================================
generate_added_styles <- function () {
......@@ -227,14 +247,27 @@ generate_pages_server <- function() {
res <- res + ')),\n'
for(b in 1:length(panel_boxes)) { # draw boxes
box <- panel_boxes[[b]]
if(box$defined == TRUE) {
for(t in YML_TOOLS) {
if(t$name == box$name) {
box <- t
if(panel_boxes[[b]]$concat_name_param == TRUE) {
for(z in 1:length(box$content)) {
box$content[[z]]$name <- APP$pages[[x]]$name + "_" + box$content[[z]]$name
}
}
break
}
}
}
res <- res + '\tbox(title = "' + box$title + '", width = 12, status = "' + box$status + '", collapsible = TRUE, solidHeader = TRUE'
panel_content = box$content
......@@ -340,6 +373,24 @@ generate_pages_server <- function() {
box <- panel_boxes[[b]]
if(box$defined == TRUE) {
for(t in YML_TOOLS) {
if(t$name == box$name) {
box <- t
if(panel_boxes[[b]]$concat_name_param == TRUE) {
for(z in 1:length(box$content)) {
box$content[[z]]$name <- APP$pages[[x]]$name + "_" + box$content[[z]]$name
}
}
break
}
}
}
panel_content = box$content
......@@ -408,6 +459,24 @@ generate_pages_server <- function() {
box <- panel_boxes[[b]]
if(box$defined == TRUE) {
for(t in YML_TOOLS) {
if(t$name == box$name) {
box <- t
if(panel_boxes[[b]]$concat_name_param == TRUE) {
for(z in 1:length(box$content)) {
box$content[[z]]$name <- APP$pages[[x]]$name + "_" + box$content[[z]]$name
}
}
break
}
}
}
res <- res + '\n\t# Tool : ' + box$name+ '\n'
res <- res + '\n\tif(input$select' + panel$name + ' == "' + box$name + '") {\n'
......
{
name: "biotoolA",
title: "Tool biotoolA :",
status: "success",
content: [
{name: "param1", type: "text", value: "", label: "Input Param1 :"},
{name: "param2", type: "slider", min: 0, max: 100, step: 1, value: [50], label: "Slider param2 :"},
{name: "param3", type: "slider", min: 10, max: 20, step: 0.1, value: [11.8, 19.6], label: "Slider param3 :"},
{name: "param8", type: "checkbox", value: TRUE, label: "Checkbox 1"},
{name: "param9", type: "checkbox", value: FALSE, label: "Checkbox 2"},
{name: "testButton", type: "button", icon: "", class: "btn btn-success", label: "Test"},
]
}
{
name: "biotoolB",
title: "Tool biotoolB :",
status: "success",
content: [
{name: "param1", type: "text", value: "", label: "Input Param1 :"},
{name: "param2", type: "slider", min: 0, max: 100, step: 1, value: [50], label: "Slider param2 :"},
{name: "param3", type: "slider", min: 10, max: 20, step: 0.1, value: [11.8, 19.6], label: "Slider param3 :"},
{name: "param8", type: "checkbox", value: TRUE, label: "Checkbox 1"},
{name: "param9", type: "checkbox", value: FALSE, label: "Checkbox 2"},
{name: "testButton", type: "button", icon: "", class: "btn btn-success", label: "Test"},
]
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment