Skip to content

Commit

Permalink
removing delayed_data and ddl
Browse files Browse the repository at this point in the history
  • Loading branch information
gogonzo committed Nov 6, 2023
1 parent 71c1501 commit 0c52e1a
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 139 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Collate:
'data-ddl-utils.R'
'data-transform_module.R'
'dummy_functions.R'
'get_rcode_utils.R'
'include_css_js.R'
Expand Down
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ S3method(ui_nested_tabs,teal_modules)
export("%>%")
export(TealReportCard)
export(as.teal_slices)
export(close_conn)
export(ddl)
export(delayed_data)
export(eval_and_mask)
export(example_module)
export(get_code_tdata)
Expand All @@ -30,7 +27,6 @@ export(landing_popup_module)
export(module)
export(modules)
export(new_tdata)
export(open_conn)
export(report_card_template)
export(reporter_previewer_module)
export(show_rcode_modal)
Expand Down
41 changes: 0 additions & 41 deletions R/data-ddl-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ eval_and_mask <- function(data,
data@code[length(data@code)] <- format_expression(.substitute_code(expr = code, env = env_masked))
}

# todo: should it be here or in datanames(data)?
if (length(datanames(data)) == 0) {
datanames(data) <- ls(data@env)
}

data
}

Expand All @@ -66,39 +61,3 @@ eval_and_mask <- function(data,
)
)
}

#' Convenience wrapper for ddl
#'
#' @inheritParams delayed_data
#' @param code (`character` or `language`)
#' @param env_mask (`named list`)
#' @export
ddl <- function(code, env_mask, ui, server) {
# todo: do we want to export this?
delayed_data(ui = ui, server = server, code = code, env_mask = env_mask)
}

ui_login_and_password <- function(id) {
ns <- NS(id)
actionButton(inputId = ns("submit"), label = "Submit")
}

srv_login_and_password <- function(id, code, env_mask) {
moduleServer(id, function(input, output, session) {
eventReactive(input$submit, {
eval_and_mask(teal_data(), code = code, env = reactiveValuesToList(input), env_mask = env_mask)
})
})
}


# todo: to remove before merge -------------
#' @export
open_conn <- function(username, password) {
if (password != "pass") stop("Invalid credentials. 'pass' is the password") else TRUE
}
#' @export
close_conn <- function(conn) {
message("closed")
return(NULL)
}
47 changes: 0 additions & 47 deletions R/data-transform_module.R

This file was deleted.

3 changes: 2 additions & 1 deletion R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ init <- function(data = teal_data(),
id = character(0)) {
logger::log_trace("init initializing teal app with: data ({ class(data)[1] }).")
if (
!inherits(data, c("TealData", "teal_data")) && !test_shiny_module_list(data)
!inherits(data, c("TealData", "teal_data")) &&
!(is.list(data) && identical(names(data), c("ui", "server")))
) {
data <- teal.data::to_relational_data(data = data)
}
Expand Down
7 changes: 5 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,16 @@ check_filter_datanames <- function(filters, datanames) {


test_shiny_module_list <- function(data) {
is.list(data) && identical(names(data), c("ui", "server"))
is.list(data) &&
identical(names(data), c("ui", "server")) &&
identical(names(formals(data$ui)), "id") &&
identical(names(formals(data$server)), "id")
}


check_shiny_module_list <- function(data) {
if (!test_shiny_module_list(data)) {
"`data` should be a list with 'ui' and 'server' elements."
"`data` should be a list with 'ui' and 'server' functions having 'id' argument only."
} else {
TRUE
}
Expand Down
20 changes: 0 additions & 20 deletions man/ddl.Rd

This file was deleted.

23 changes: 0 additions & 23 deletions man/delayed_data.Rd

This file was deleted.

0 comments on commit 0c52e1a

Please sign in to comment.