From d9ed791a90af90b21ac278b5c773c8699741f22e Mon Sep 17 00:00:00 2001 From: Konrad1991 Date: Fri, 22 Nov 2024 09:51:39 +0100 Subject: [PATCH] update MainApp.R for serverless version --- app/MainApp.R | 2 +- bs/R/utils.R | 6 ++++++ bs/inst/tinytest/Assumptions.R | 6 ++++++ deploy_serverless_app.R | 11 ++++++++--- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/MainApp.R b/app/MainApp.R index 9e4da1d..400ce09 100644 --- a/app/MainApp.R +++ b/app/MainApp.R @@ -1,7 +1,7 @@ app <- function() { ui <- fluidPage( useShinyjs(), - includeScript(system.file("www/download.js", package = "bs")), + includeScript("www/download.js"), tags$head( tags$script(src = "https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js"), tags$script(src = "https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"), diff --git a/bs/R/utils.R b/bs/R/utils.R index fb089f0..cd8b3d1 100644 --- a/bs/R/utils.R +++ b/bs/R/utils.R @@ -529,6 +529,12 @@ elongate_col <- function(col, l) { } } +# TODO: for dataframe +# Check that enough memory is available +# Add own function for seq which also checks the size and memory usage +# Set a limit for the size of the imported data +# Set a limit for the number of results in the results list. +# Set a memory limit for the results list DataFrame <- function(...) { columns <- list(...) s <- substitute(list(...)) diff --git a/bs/inst/tinytest/Assumptions.R b/bs/inst/tinytest/Assumptions.R index 0bec908..91fd6fc 100644 --- a/bs/inst/tinytest/Assumptions.R +++ b/bs/inst/tinytest/Assumptions.R @@ -1,3 +1,9 @@ +# TODO: Tests +# Add github actions for the test +# Add test for diagnostic plot +# add tests for utils functions +# add tests for plotting internally +# add tests for lc50 internally library(shinytest2) library(tinytest) app <- bs::app() diff --git a/deploy_serverless_app.R b/deploy_serverless_app.R index 2495f77..03dc613 100644 --- a/deploy_serverless_app.R +++ b/deploy_serverless_app.R @@ -1,3 +1,9 @@ +# TODO: deploy app to GitHub.io +# All those copying etc. should be done within the github workflow +# Find a solution to show the static html files of the documentation +# automatically copy the www folder to the folder app +# automatically copy the system.files to the folder app +# automatically parse the upload filed as the environment variable is ignored? files <- list.files("/home/konrad/Documents/Biostats/bs/R/", pattern = ".R", full.names = TRUE) file.copy(files, "/home/konrad/Documents/Biostats/app/", overwrite = TRUE) # Replace the upload field @@ -38,7 +44,6 @@ code <- code[2:(length(code) - 1)] writeLines(code, con) close(con) -setwd("/home/konrad/Documents/Biostats") -shinylive::export(appdir = "./app/", destdir = "docs", quiet = FALSE) -setwd("/home/konrad/Documents/Biostats/docs") +setwd("/home/konrad/Documents/Biostats/app") +shinylive::export(appdir = "./app/", destdir = "./app", quiet = FALSE) httpuv::runStaticServer(".")