Skip to content

Commit

Permalink
fix actions
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Apr 21, 2021
1 parent e9e74f9 commit 32ba872
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions modules/config_editor_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -770,19 +770,21 @@ config_editor_server<- function(input, output, session){
}

act_options = geoflow::list_action_options(input$action_form_id, raw = TRUE)
print("Action options")
print(act_options)
if(length(act_options)>0){
tags$div(
br(),
h5(tags$b("Action options")),hr(),
do.call("tagList", lapply(names(act_options), function(name){
act_option = act_options[[name]]
multiple <- ifelse(!is.null(act_option$multiple),act_option$multiple, FALSE)
multiple <- if(!is.null(act_option$multiple)) act_option$multiple else FALSE
add_choices <- if(!is.null(act_option$add_choices)) act_option$add_choices else FALSE
if(!is.null(act_option$choices)){
selectizeInput(
inputId = ns(sprintf("action_form_options_%s", name)),
label = act_option$def, selected = ifelse(!is.null(action$options[[name]]), action$options[[name]], act_option$default),
label = act_option$def, selected = if(!is.null(action$options[[name]])) unlist(action$options[[name]]) else unlist(act_option$default),
choices = act_option$choices, multiple = multiple,
options = list(create = TRUE)
options = list(create = add_choices)
)
}else{
clazz <- act_option$class
Expand All @@ -805,8 +807,7 @@ config_editor_server<- function(input, output, session){
inputId = ns(sprintf("action_form_options_%s", name)),
label = act_option$def, selected = ifelse(!is.null(action$options[[name]]), action$options[[name]], act_option$default),
choices = if(!is.null(act_option$default)){as.character(c(act_option$default,!act_option$default))}else {c("FALSE","TRUE")},
multiple = multiple,
options = list(create = TRUE)
multiple = multiple
),
textInput(
inputId = ns(sprintf("action_form_options_%s", name)),
Expand Down Expand Up @@ -845,10 +846,10 @@ config_editor_server<- function(input, output, session){
#action/delete
observeEvent(input$delete_action,{
showModal(
if(length(input$tbl_action_rows_selected)>=1 ){
if(length(input$tbl_actions_rows_selected)>=1 ){
modalDialog(
title = "Warning",
paste("Are you sure to delete",length(input$tbl_action_rows_selected),"action(s)?" ),
paste("Are you sure to delete",length(input$tbl_actions_rows_selected),"action(s)?" ),
footer = tagList(
modalButton("Cancel"),
actionButton(ns("action_delete_go"), "Yes")
Expand All @@ -867,11 +868,6 @@ config_editor_server<- function(input, output, session){
removeModal()
})


#OPTIONS
#=====================================================================================


#CONFIGURATION LOAD
#=====================================================================================
#on config load
Expand Down

0 comments on commit 32ba872

Please sign in to comment.