-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sidebar and function args. (#285)
Add optional arguments to allow users to customize the UI and/or server of the resulting Shiny app. This will allow users to add logging functionality, for example. tests/testthat/apps/logging/app.R contains an app that creates a logfile, as a proof of concept.
- Loading branch information
1 parent
0ef27a0
commit af109b8
Showing
12 changed files
with
146 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Launch the ShinyApp (Do not remove this comment) | ||
# To deploy, run: rsconnect::deployApp() | ||
# Or use the blue button on top of this file | ||
|
||
if ( | ||
isTRUE(as.logical(Sys.getenv("TESTTHAT_IS_CHECKING", "false"))) || | ||
isTRUE(as.logical(Sys.getenv("R_COVR", "false"))) | ||
) { | ||
library("gsm.app") | ||
} else { | ||
pkgload::load_all(here::here()) | ||
} | ||
|
||
group_subset <- c( | ||
"0X001", | ||
"0X021", | ||
"0X103", | ||
"0X159", | ||
"0X161" | ||
) | ||
|
||
sample_dfResults_subset <- gsm.app::sample_dfResults %>% | ||
dplyr::filter(GroupID %in% group_subset) | ||
sample_dfAnalyticsInput_subset <- gsm.app::sample_dfAnalyticsInput %>% | ||
dplyr::filter(GroupID %in% group_subset) | ||
sample_dfGroups_subset <- gsm.app::sample_dfGroups %>% | ||
dplyr::filter( | ||
GroupLevel != "Site" | (GroupLevel == "Site" & GroupID %in% group_subset) | ||
) | ||
|
||
library(shiny.telemetry) | ||
|
||
log_path <- here::here("tests", "testthat", "apps", "logging", "logfile.txt") | ||
|
||
telemetry <- shiny.telemetry::Telemetry$new( | ||
data_storage = shiny.telemetry::DataStorageLogFile$new(log_path) | ||
) | ||
|
||
gsm.app::run_gsm_app( | ||
dfResults = sample_dfResults_subset, | ||
dfGroups = sample_dfGroups_subset, | ||
dfMetrics = gsm.app::sample_dfMetrics, | ||
dfBounds = gsm.app::sample_dfBounds, | ||
dfAnalyticsInput = sample_dfAnalyticsInput_subset, | ||
fnFetchParticipantData = gsm.app::sample_FetchParticipantData, | ||
tagListSidebar = shiny.telemetry::use_telemetry(), | ||
fnServer = function(input, output, session) { | ||
telemetry$start_session() | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters