feat: корректная работа с главным экраном
This commit is contained in:
@@ -6,7 +6,6 @@ set_global_options = function(
|
||||
# APP.FILE_DB = fs::path("data.sqlite"),
|
||||
shiny.host = "127.0.0.1",
|
||||
shiny.port = 1337,
|
||||
enabled_schemas = c("schema", "schema_example"),
|
||||
...
|
||||
) {
|
||||
options(
|
||||
@@ -15,20 +14,23 @@ set_global_options = function(
|
||||
# APP.FILE_DB = APP.FILE_DB,
|
||||
shiny.host = shiny.host,
|
||||
shiny.port = shiny.port,
|
||||
enabled_schemas = enabled_schemas,
|
||||
...
|
||||
)
|
||||
}
|
||||
|
||||
#' @export
|
||||
enabled_schemas <- c(`Тестовая база данных` = "example_of_scheme")
|
||||
|
||||
#' @export
|
||||
check_and_init_scheme = function() {
|
||||
|
||||
cli::cli_inform(c("*" = "проверка схемы..."))
|
||||
|
||||
# scheme_file <- fs::path("configs/schemas", "schema.xlsx")
|
||||
scheme_names <- getOption("enabled_schemas")
|
||||
scheme_names <- enabled_schemas
|
||||
scheme_file <- paste0("configs/schemas/", scheme_names, ".xlsx")
|
||||
scheme_file <- stats::setNames(scheme_file, scheme_names)
|
||||
|
||||
if (!all(file.exists(scheme_file))) cli::cli_abort(c("Отсутствуют файлы схем для следующих наименований:", paste("-", names(scheme_file)[!file.exists(scheme_file)])))
|
||||
|
||||
db_files <- paste0("db/", scheme_names, ".sqlite")
|
||||
|
||||
@@ -71,6 +73,8 @@ init_scheme = function(scheme_file) {
|
||||
modules/scheme_generator[scheme_R6]
|
||||
)
|
||||
|
||||
if (!dir.exists("db")) dir.create("db")
|
||||
|
||||
cli::cli_h1("Инициализация схемы")
|
||||
schms <- purrr::map2(
|
||||
.x = scheme_file,
|
||||
|
||||
Reference in New Issue
Block a user