Skip to content

Commit

Permalink
Merge pull request #7 from Boehringer-Ingelheim/remove_golem
Browse files Browse the repository at this point in the history
Remove golem
  • Loading branch information
zsigmas authored May 31, 2024
2 parents bb70b9c + 51e146d commit f613aba
Show file tree
Hide file tree
Showing 28 changed files with 1,706 additions and 531 deletions.
4 changes: 1 addition & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Authors@R: c(person("Boehringer-Ingelheim Pharma GmbH & Co.KG", role = c("cph",
Description: DaVinci Module Manager.
License: Apache License (>= 2)
Imports:
golem (>= 0.3.1),
shiny (>= 1.7.0),
glue (>= 1.4.2),
htmltools (>= 0.5.2),
Expand All @@ -18,7 +17,6 @@ Imports:
purrr (>= 0.3.4),
dplyr (>= 1.0.3),
dv.filter (>= 1.0.0),
dv.loader (>= 1.0.0),
lubridate (>= 1.7.9.2),
shinymeta (>= 0.2.0.1),
shinyjs (>= 2.0.0),
Expand All @@ -28,7 +26,7 @@ Imports:
cli (>= 3.3.0)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.0
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
Suggests:
testthat (>= 3.0.1),
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ export(simple_UI)
export(simple_server)
importFrom(dplyr,"%>%")
importFrom(dplyr,.data)
importFrom(golem,get_golem_options)
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# dv.manager 2.1.1-9000

- Removes `golem` dependency

# dv.manager 2.1.1

- General code housekeeping
Expand Down
29 changes: 0 additions & 29 deletions R/app_config.R
Original file line number Diff line number Diff line change
@@ -1,29 +0,0 @@
#' Access files in the current app
#'
#' @param ... Character vector specifying directory and or file to
#' point to inside the current package.
#'
#' @noRd
app_sys <- function(...) {
system.file(..., package = "dv.manager")
}


#' #' Read App Config
#' #'
#' #' @param value Value to retrieve from the config file.
#' #' @param config R_CONFIG_ACTIVE value.
#' #' @param use_parent Logical, scan the parent directory for config file.
#' #'
#' #' @noRd
#' get_golem_config <- function(value,
#' config = Sys.getenv("R_CONFIG_ACTIVE", "default"),
#' use_parent = TRUE) {
#' config::get(
#' value = value,
#' config = config,
#' # Modify this if your config file is somewhere else:
#' file = app_sys("golem-config.yml"),
#' use_parent = use_parent
#' )
#' }
45 changes: 18 additions & 27 deletions R/app_server.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#' Server side of the dv.manager
#'
#' @section golem:
#' This server side is built as a golem application. Therefore it will make use of the [golem::get_golem_options]
#' functionality. Particularly, it will receive three variables through this channel: module_list, data and filter_data.
#' All this variables are specified in the [dv.manager::run_app()] call.
#'
#' @section data:
#' *data* is the fundamental data source for the application launched by the dv.manager
#' - This data source is a named list of:
Expand Down Expand Up @@ -49,34 +44,30 @@
#'
#' @keywords internal

app_server <- function(input = NULL, output = NULL, session = NULL, id = NULL) {
if (is.null(id)) {
log_inform("As app")
return(app_server_golem(input, output, session)) # If id is null then I am calling it as a base app
} else { # Otherwise I am calling it as a module inside another app
return(
shiny::moduleServer(
id,
app_server_golem
)
)
}
}

# Used for future decoupling from golem in the future
app_server_golem <- function(input, output, session) {
app_server <- function(input = NULL, output = NULL, session = NULL) {
opts <- list(
"module_list" = golem::get_golem_options("module_list"),
"data" = golem::get_golem_options("data"),
"filter_data" = golem::get_golem_options("filter_data"),
"filter_key" = golem::get_golem_options("filter_key"),
"startup_msg" = golem::get_golem_options("startup_msg"),
"reload_period" = golem::get_golem_options("reload_period")
"module_list" = get_config("module_list"),
"data" = get_config("data"),
"filter_data" = get_config("filter_data"),
"filter_key" = get_config("filter_key"),
"startup_msg" = get_config("startup_msg"),
"reload_period" = get_config("reload_period")
)

app_server_(input, output, session, opts)
}

app_server_module <- function(id) {
opts <- list(
"module_list" = get_config("module_list"),
"data" = get_config("data"),
"filter_data" = get_config("filter_data"),
"filter_key" = get_config("filter_key"),
"startup_msg" = get_config("startup_msg"),
"reload_period" = get_config("reload_period")
)
shiny::moduleServer(id = id, module = function(input, output, session) app_server_(input, output, session, opts))
}

app_server_ <- function(input, output, session, opts) {
ns <- session[["ns"]]
Expand Down
10 changes: 5 additions & 5 deletions R/app_ui.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' The application User-Interface using an HTML template
#'
#' @param id This parameter can be either an string id if the app_ui is being used as a module or
#' a request if the app_ui is being used as an standalone application created in golem then it becomes
#' a request if the app_ui is being used as an standalone application then it becomes
#' a Internal parameter for `{shiny}`
#' DO NOT REMOVE.
#'
Expand All @@ -20,8 +20,8 @@ app_ui <- function(id) {
stop("Unknown value type in id")
}

data <- golem::get_golem_options("data")
module_list <- golem::get_golem_options("module_list")
data <- get_config("data")
module_list <- get_config("module_list")

log_inform("Initializing HTML template UI")
log_inform(glue::glue(
Expand Down Expand Up @@ -99,8 +99,8 @@ app_ui <- function(id) {
)))))

shiny::fluidPage(
golem_add_external_resources(),
theme = get_app_theme(), # "bgc-color" = "#002f62"),
insert_header_add_resources(app_title = get_config("title")),
theme = get_app_theme(),
class = "display-grid",
sidebar,
do.call(shiny::tabsetPanel, c(
Expand Down
29 changes: 0 additions & 29 deletions R/get_version.R

This file was deleted.

21 changes: 0 additions & 21 deletions R/golem_external_resources.R

This file was deleted.

63 changes: 0 additions & 63 deletions R/golem_utils_server.R

This file was deleted.

Loading

0 comments on commit f613aba

Please sign in to comment.