Skip to content

Commit

Permalink
refactored the split dataframe by column and evoke formula editor. Th…
Browse files Browse the repository at this point in the history
…e UI and the server code is now handled in MainApp.R and not in each individual tab
  • Loading branch information
Konrad1991 committed Dec 12, 2024
1 parent dc209c0 commit aedca65
Show file tree
Hide file tree
Showing 6 changed files with 316 additions and 674 deletions.
86 changes: 0 additions & 86 deletions bs/R/DoseResponse.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ DoseResponseSidebarUI <- function(id) {
div(
style = "position: relative;",
br(),
div(
class = "boxed-output",
uiOutput(NS(id, "open_split_by_group")),
uiOutput(NS(id, "data_splitted")),
verbatimTextOutput(NS(id, "applied_filter"))
),
br(),
uiOutput(NS(id, "substanceNamesUI")),
checkboxInput(
NS(id, "xTransform"),
Expand Down Expand Up @@ -90,85 +83,6 @@ DoseResponseServer <- function(id, data, listResults) {
)
})

# Render split by group
output[["open_split_by_group"]] <- renderUI({
actionButton(NS(id, "open_split_by_group"),
"Open the split by group functionality",
title = "Open the split by group helper window",
disabled = is.null(data$df) || !is.data.frame(data$df) || !is.null(data$backup_df)
)
})

observeEvent(input[["open_split_by_group"]], {
showModal(modalDialog(
title = "SplitByGroup",
SplitByGroupUI("SG"),
easyClose = TRUE,
size = "l",
footer = NULL
))
})

# check if data is splitted
output$data_splitted <- renderUI({
actionButton(NS(id, "remove_filter"),
"Remove the filter from the dataset",
title = "remove the filter of the dataset",
disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df)
)
})

observe({
output$applied_filter <- renderText(NULL)
req(!is.null(data$filter_col))
req(!is.null(data$filter_group))
output$applied_filter <- renderText({
paste(
"The dataset is splitted by the variable(s): [",
paste(data$filter_col, collapse = ", "),
"] group(s) are set to: [",
paste(data$filter_group, collapse = ", "),
"]"
)
})
})

# Remove filter
observeEvent(input[["remove_filter"]], {
data$df <- data$backup_df
data$backup_df <- NULL
data$filter_col <- NULL
data$filter_group <- NULL
})

output$open_formula_editor_corr <- renderUI({
actionButton(NS(id, "open_formula_editor"),
"Open formula editor",
title = "Open the formula editor to create or modify a formula",
disabled = is.null(data$df) || !is.data.frame(data$df)
)
})

observeEvent(input[["open_formula_editor"]], {
showModal(modalDialog(
title = "FormulaEditor",
FormulaEditorUI("FO"),
easyClose = TRUE,
size = "l",
footer = tagList(
modalButton("Close")
)
))
})

# display current formula
observe({
req(!is.null(data$formula))
output$formula <- renderText({
deparse(data$formula)
})
})

reset_dr <- function() {
r_vals$plots <- NULL
r_vals$names <- NULL
Expand Down
Loading

0 comments on commit aedca65

Please sign in to comment.