Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature branch PR #1253

Merged
merged 231 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 200 commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
e0405b9
WIP
gogonzo Jun 26, 2024
5ba1325
remove bslib::card
gogonzo Jun 26, 2024
74d4cd9
minor changes
gogonzo Jun 26, 2024
8c18a37
call modules and filter-panel
gogonzo Jun 26, 2024
81ba5aa
comments
gogonzo Jun 26, 2024
e434c6d
linking teal_data -> filter panel -> teal_module
gogonzo Jun 26, 2024
719a28e
passing filters to module-specific
gogonzo Jun 26, 2024
e84caed
missing stuff from srv_teal
gogonzo Jun 26, 2024
7621ae1
Merge remote-tracking branch 'origin/main' into 669_insertUI@main
gogonzo Jun 26, 2024
916e1f7
todos
gogonzo Jun 26, 2024
0c42abe
feat: add teal_data_module inside a popup during init
vedhav Jun 27, 2024
91e8c9a
Merge branch 'data_module_popup@669_insertUI@main' into 669_insertUI@…
gogonzo Jun 27, 2024
7758a4f
comment
gogonzo Jun 27, 2024
bd53634
another todo
gogonzo Jun 27, 2024
fc6e27a
fix: allow the popup modal to be closed when opened again
vedhav Jun 27, 2024
080e863
feat: add the filter_hamburger
vedhav Jun 27, 2024
a599d8d
fix: append reporter module when reporter is used in any of the modules
vedhav Jun 27, 2024
5f98a9a
chore: remove the todo, reporter modules is appended in init
vedhav Jun 27, 2024
8e78255
chore: remove local log
vedhav Jun 27, 2024
8a2222e
slices_global and available_filters (WIP)
gogonzo Jun 27, 2024
cb33d64
fix available_slices
gogonzo Jun 27, 2024
31786bc
fix duplicated ids in slices_global
gogonzo Jun 27, 2024
a231038
filter manager WIP
gogonzo Jun 27, 2024
02390f6
filter manager
gogonzo Jun 27, 2024
d90597e
another comment
gogonzo Jun 27, 2024
476c124
comments
gogonzo Jun 27, 2024
c25d94a
more comments
gogonzo Jun 27, 2024
8e31df0
fix: pass only required datasets to module
vedhav Jun 28, 2024
c69c009
active_datanames WIP
gogonzo Jun 28, 2024
1f59b92
resolving some comments
gogonzo Jun 28, 2024
7f709f7
feat: adds hashes to reproducible code
averissimo Jun 28, 2024
5aa39a4
filter-manager done!
gogonzo Jun 28, 2024
21fb11e
fix: make the reactive data as reactiveVal
vedhav Jun 28, 2024
6eb139e
chore: replace `!isTRUE` to `isFALSE`
vedhav Jul 1, 2024
8116adf
chore: move the data related code into srv_data
vedhav Jul 1, 2024
964a110
Revert "chore: replace `!isTRUE` to `isFALSE`"
vedhav Jul 1, 2024
a0d7f18
comments
gogonzo Jul 1, 2024
87aa0ea
feat: pass the required datasets in the ui itself
vedhav Jul 1, 2024
61a3f1e
todo comment
gogonzo Jul 1, 2024
7e9affb
fix todo: keep verified status from original teal_data
averissimo Jul 2, 2024
5f06f58
fix todo: hide/blur background when teal_data_module popup
averissimo Jul 2, 2024
ee85cb7
Adds unfiltered data in teal_data passed to modules (#1256)
averissimo Jul 2, 2024
8ac40d8
build man pages
m7pr Jul 2, 2024
a9f3c4e
update NAMESPACE
m7pr Jul 2, 2024
8bbff54
missing man PAGE
m7pr Jul 2, 2024
6277e21
snapshot manager
gogonzo Jul 2, 2024
6169045
snapshot from file
gogonzo Jul 2, 2024
89b947d
remove todos
gogonzo Jul 2, 2024
c383202
teal as a module
gogonzo Jul 3, 2024
09ffd96
module_filter_manager_panel
gogonzo Jul 3, 2024
0105c1b
Merge branch 'main' into 669_insertUI@main
gogonzo Jul 3, 2024
1bc10b2
snapshot_manager_panel
gogonzo Jul 3, 2024
6c03384
Add bookmark@669 insert UI@main (#1258)
vedhav Jul 4, 2024
98ed8a5
simplify if
gogonzo Jul 4, 2024
690bac1
moving stuff back to the old files
gogonzo Jul 4, 2024
3a975b5
filter_manager + tests
gogonzo Jul 4, 2024
975609a
add test and improve filter-manager docs
gogonzo Jul 5, 2024
d99ef9c
call_module (inline) to .call_teal_module (standalone)
gogonzo Jul 5, 2024
fb2e759
module_nested_tabs + tests
gogonzo Jul 5, 2024
e92ce25
fix: use proper ns for filter restore values for bookmark
vedhav Jul 5, 2024
7b5e22e
chore: prefix `session$ns` so it works when teal is called as a module
vedhav Jul 5, 2024
4309311
fix test-module_nested_tabs
gogonzo Jul 8, 2024
984a631
module_teal docs and test
gogonzo Jul 8, 2024
4d0d7db
tests module_data
gogonzo Jul 8, 2024
b092f1e
resize fix @chlebowa
gogonzo Jul 10, 2024
db2b2f0
+ todo
gogonzo Jul 10, 2024
05ab26e
✔ checks
gogonzo Jul 10, 2024
818b6b7
1226 make new `*_data_summary` (#1257)
m7pr Jul 10, 2024
d6425c4
feat: just use the active panel from teal.slice
vedhav Jul 15, 2024
b99eec0
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 15, 2024
f9b9362
chore: get allow_add from attr instead of passing it
vedhav Jul 15, 2024
285892c
fix: use the proper ns
vedhav Jul 15, 2024
0f508af
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 15, 2024
a8a386f
bring toggle_title and toggle_icon functions from teal.slice
m7pr Jul 16, 2024
6b15464
Update R/1.0_module_data_summary.R
m7pr Jul 16, 2024
32d8280
fix: use the proper ns for filter panel
vedhav Jul 16, 2024
aa5f939
substitute dplyr::bind_rows with rbind
m7pr Jul 18, 2024
f1b022f
extend data_summary methods with columns containing NAs so that rbind…
m7pr Jul 18, 2024
9440341
fix data preparations for data-summary to repsect rbind limitations
m7pr Jul 18, 2024
3c42dba
Update R/1.0_module_data_summary.R
m7pr Jul 19, 2024
58555a3
substitute @env with teal.code::get_env() for teal_data
m7pr Jul 19, 2024
fa3dc9c
filter Subjects out from data-overview if there is none to display
m7pr Jul 19, 2024
c166a35
Fix R CMD Notes for `Undefined global functions or variables:` (#1267)
m7pr Jul 19, 2024
a5dd9f0
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 19, 2024
e09ad9c
`{shinytest2}` and `shiny::testServer` tests for `data_summary` panel…
m7pr Jul 22, 2024
b6647eb
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 22, 2024
c101987
Implement `teal_transform_module` (#1260)
averissimo Jul 22, 2024
e511cc0
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 22, 2024
048e6f4
todo: static app fails with teal_data and datanames that are created …
averissimo Jul 22, 2024
497b85f
feat: allow for new datanames in summary_data
averissimo Jul 22, 2024
10c362c
fix set shinyOptions (throws when mockSession is used)
gogonzo Jul 23, 2024
7f99484
filter related code to filter_panel
gogonzo Jul 23, 2024
4307cd5
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 23, 2024
c2d9cb7
tests
gogonzo Jul 23, 2024
83b80a9
Merge remote-tracking branch 'origin/669_insertUI@main' into 669_inse…
gogonzo Jul 23, 2024
5b36b25
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 23, 2024
191d378
bring back validate_teal_data in nested tabs
gogonzo Jul 23, 2024
562063d
more tests
gogonzo Jul 23, 2024
07c562b
fix: modules with eager data delay the dataname check to later stage
averissimo Jul 23, 2024
b43d569
hard error if not-teal_data gets through
gogonzo Jul 23, 2024
102f5b8
- more boilerplate tests
gogonzo Jul 23, 2024
a428c1c
test: adds test for srv_teal summary table
averissimo Jul 23, 2024
5e9aada
fix restore initial snapshot @donyunardi
gogonzo Jul 24, 2024
655cf11
test: adds 1 new test for srv_teal summary table
averissimo Jul 24, 2024
c224e7b
changes for tests
gogonzo Jul 24, 2024
c593990
4 tests for `teal_modules` (#1274)
m7pr Jul 24, 2024
f34e0df
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 24, 2024
7628770
remove browser()
m7pr Jul 24, 2024
ab07ff2
Merge branch '669_insertUI@main' of https://github.com/insightsengine…
m7pr Jul 24, 2024
7762d80
add teal.data:: prefixes to test-module_teal
m7pr Jul 24, 2024
7c6ec0b
substitute |> with %>%
m7pr Jul 24, 2024
2595cd0
remove dplyr::filter from tests
m7pr Jul 24, 2024
ed8f441
fix 2 tests for data_summary
m7pr Jul 24, 2024
50d675a
fix: reactivity issue reported by @gogonzo
averissimo Jul 24, 2024
7354eec
revert: fallback to shiny.silent.error instead of NULL
averissimo Jul 24, 2024
eb12c5e
chore: cleanup
averissimo Jul 24, 2024
d36e52d
feature: hash is calculated once at data_rv
averissimo Jul 24, 2024
c2b9335
chore: missing fallback change
averissimo Jul 24, 2024
d673b62
chore: reorganize test in describe/it
averissimo Jul 24, 2024
a2798b0
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 24, 2024
a192638
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 24, 2024
77c00d3
fix: create new teal_data instead of incorrectly manipulating existing
averissimo Jul 24, 2024
d02766a
chore: cleanup linter problems
averissimo Jul 24, 2024
7faea1f
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 24, 2024
f122cc7
fix .add_signature_to_data
gogonzo Jul 24, 2024
247aaf7
check_filter_datanames soon after data loaded/validated
gogonzo Jul 24, 2024
d1dbb4a
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 24, 2024
0656f31
chore: minimum changes so that documentation builds
averissimo Jul 24, 2024
ae90595
log_trace -> log_debug
gogonzo Jul 24, 2024
6ab53b0
trigger bookmarking to work
gogonzo Jul 24, 2024
3400b74
fix (WIP) reload data/snapshot manager
gogonzo Jul 24, 2024
fda7d9a
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 24, 2024
dd7e6c4
fix snapshot
gogonzo Jul 25, 2024
fdde38c
fix some tests - WIP filter panel broken
gogonzo Jul 25, 2024
8e7479c
feat: assign datanames at end of transform
averissimo Jul 25, 2024
d2a77e1
tests: small syntax improvement
averissimo Jul 25, 2024
c08009d
fix: typo
averissimo Jul 25, 2024
0074ce8
WIP - need to fix all the tests related to slices_global()
gogonzo Jul 25, 2024
75ebd38
- fix when initialized with empty teal_slice()
gogonzo Jul 25, 2024
1358113
update tests
gogonzo Jul 26, 2024
0ca1f07
skip init test
gogonzo Jul 26, 2024
b2d057e
some check fixes
gogonzo Jul 26, 2024
6f7ca32
more tests
gogonzo Jul 26, 2024
a9e9cef
reorganize tests
gogonzo Jul 26, 2024
82a5c7a
mapping table
gogonzo Jul 26, 2024
25cb34b
fix a test
gogonzo Jul 26, 2024
38cc74e
<<- needed as `testthat::describe`, `testthat::it` use different envi…
gogonzo Jul 29, 2024
93c0d84
add @name to module_filter_manager
m7pr Jul 29, 2024
08329b2
fix NOTE:
gogonzo Jul 29, 2024
8387c14
remove session from ui side
gogonzo Jul 29, 2024
194cfaf
lintr
gogonzo Jul 29, 2024
9b7f193
fix module_teal
gogonzo Jul 29, 2024
18874d6
include module_teal in pkgdown
gogonzo Jul 29, 2024
e0d1f68
rename snapshot_manager_srv to srv_snapshot_manager
m7pr Jul 29, 2024
508c634
remove the test for deleted function - modules_dataset
m7pr Jul 29, 2024
e970b57
deleted test-snapshot-manager.R
m7pr Jul 29, 2024
45188ac
update teal_data_module test message for case with 2 arguments
m7pr Jul 29, 2024
db310ee
fix documentation of module_filter_panel
gogonzo Jul 29, 2024
259f3c7
fix spelling::spell_check_package()
m7pr Jul 29, 2024
3832b12
merge
m7pr Jul 29, 2024
39bb9ca
man for module_filter_panel
m7pr Jul 29, 2024
58bd876
fix setdiff_teal_slices
gogonzo Jul 29, 2024
4e18c6d
try @encoding tag
gogonzo Jul 30, 2024
77a5b01
Remove emojis from documentation in favour of images (#1278)
m7pr Jul 30, 2024
66b3e72
update data_summary shinytest2 tests
m7pr Jul 30, 2024
c237048
Merge branch '669_insertUI@main' of https://github.com/insightsengine…
m7pr Jul 30, 2024
cd2bc8d
datanames reduction out from teal_transforms
gogonzo Jul 30, 2024
6a1b8af
import setdiff_teal_slices from teal.slice?
m7pr Jul 30, 2024
ab4b144
move setdiff_teal_slices to the test?
m7pr Jul 30, 2024
3efe983
Data module as tab@669 insert UI@main (#1273)
gogonzo Jul 30, 2024
9fdc64e
update gitignore
m7pr Jul 30, 2024
a1365ce
fix reporter shinytest2 tests
m7pr Jul 30, 2024
6e69666
fix shinytest2 tests for utils
m7pr Jul 30, 2024
414f92b
fix tests for show_r_code
m7pr Jul 30, 2024
6223c79
fix some tests for teal_data_module
m7pr Jul 30, 2024
d79894c
Fix datanames - three basic conditions
gogonzo Jul 31, 2024
fcf590b
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Jul 31, 2024
6eea881
Adjust `TealAppDriver` methods for `filter_panel` `shinytest2` tests …
m7pr Jul 31, 2024
b0d7c66
there is no more style for teal_secondary_col
m7pr Jul 31, 2024
3a8cdbf
chore: use the proper label
vedhav Aug 1, 2024
70c1dbc
use `topological_sort` on `datanames()` (#1280)
m7pr Aug 1, 2024
626a206
fix last test in data-summary
m7pr Aug 1, 2024
f251aa6
Have different constructor for "Data" module and "Transform" module (…
vedhav Aug 2, 2024
a9ef747
fix test
gogonzo Aug 2, 2024
da091b6
fix pkgdown
gogonzo Aug 2, 2024
ab8ac73
Add landing popup argument in `init` and soft deprecate calling it as…
vedhav Aug 2, 2024
57966d8
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 2, 2024
9a77b51
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Aug 2, 2024
5a388bc
Fixes lingering/ghost slices in the filter panel after DDL reload (#1…
averissimo Aug 2, 2024
49639b5
style: make the collapse icon to point on hover
vedhav Aug 5, 2024
15d0334
Merge remote-tracking branch 'origin/main' into 669_insertUI@main
gogonzo Aug 5, 2024
7c86b04
Merge remote-tracking branch 'origin/main' into 669_insertUI@main
gogonzo Aug 5, 2024
1cf892a
fix lintr and little docs improvement
gogonzo Aug 5, 2024
6635112
fix: slices restore on bookmark issue
averissimo Aug 5, 2024
4ea5b5d
trigger reactivity when show
gogonzo Aug 6, 2024
5f7d0a8
chore: move the JS functions from `teal.slice` over here
vedhav Aug 6, 2024
f09cf12
Merge branch 'main' into 669_insertUI@main
vedhav Aug 6, 2024
6b8ea72
fix: use the proper selector to click the add toggle
vedhav Aug 6, 2024
b67b141
fix: use the selector in the proper place :facepalm:
vedhav Aug 6, 2024
693cc75
chore: enforces fontawesome style solid/regular
averissimo Aug 6, 2024
82db0fd
1287 Do not show filter panel for modules without datanames (#1292)
m7pr Aug 7, 2024
358b671
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 7, 2024
2a3780f
Adds tests to check the new features of teal_data_module (#1293)
vedhav Aug 7, 2024
5c58bad
fix: factor the topological sort order in the datanames
vedhav Aug 7, 2024
e4b9085
Removes string colors style from error messages in `ui/srv_validate_r…
averissimo Aug 7, 2024
baf3406
restart cicd
gogonzo Aug 8, 2024
111bcb7
fix: silent error showing in console
averissimo Aug 8, 2024
049273d
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 8, 2024
6bcd212
Exclude the "_raw" datasets only if the original dataset exists (#1305)
vedhav Aug 9, 2024
466dc86
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 9, 2024
5a00fb9
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Aug 9, 2024
49fb94c
chore: fix spellcheck
vedhav Aug 9, 2024
56effb1
fix: correct the broken test logic
vedhav Aug 9, 2024
71af526
fix: trigger .fallback when upstream data changes
averissimo Aug 9, 2024
c12b083
tests: add test for expected behavior on fallback and recovery
averissimo Aug 9, 2024
cbb3070
tests: update tests with modified transform code
averissimo Aug 9, 2024
202dbbd
All datanames to transform@669 insert UI@main (#1302)
gogonzo Aug 12, 2024
ba83d53
Extend teal transform vignette (#1301)
vedhav Aug 12, 2024
20ff375
chore: make teal_data_utilities docs internal
vedhav Aug 12, 2024
174577a
chore: fix spellcheck
vedhav Aug 12, 2024
971dd59
update NEWS with issues reference
gogonzo Aug 12, 2024
a6b21f8
Improves datanames error message (#1297)
averissimo Aug 12, 2024
1a91b3e
chore: fix linter error from PR merge
averissimo Aug 12, 2024
2b65b98
restart cicd
gogonzo Aug 12, 2024
f4743ac
fix: fixes datanames warning and updates tests
averissimo Aug 12, 2024
61ea769
chore: fix linter error
averissimo Aug 12, 2024
afdb670
- deprecate module_teal_with_spash instead of removing
gogonzo Aug 12, 2024
cac8ef7
remove fake S3 methods
gogonzo Aug 12, 2024
370b166
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Aug 12, 2024
a81e794
rerun roxygen2
gogonzo Aug 12, 2024
84c6ce4
fix: non-breaking error during tests
averissimo Aug 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ vignettes/*.md
inst/doc
tests/testthat/_snaps/**/*.new.md
tests/testthat/_snaps/**/*.new.svg
teal_app.lock
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ Collate:
'init.R'
'landing_popup_module.R'
'module_bookmark_manager.R'
'module_data_summary.R'
'module_filter_data.R'
'module_filter_manager.R'
'module_init_data.R'
'module_nested_tabs.R'
'module_snapshot_manager.R'
'module_tabs_with_filters.R'
'module_teal.R'
'module_teal_with_splash.R'
'module_wunder_bar.R'
'module_teal_data.R'
'module_transform_data.R'
'reporter_previewer_module.R'
'show_rcode_modal.R'
'tdata.R'
Expand Down
21 changes: 13 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ S3method(get_metadata,tdata)
S3method(join_keys,tdata)
S3method(print,teal_module)
S3method(print,teal_modules)
S3method(srv_nested_tabs,default)
S3method(srv_nested_tabs,teal_module)
S3method(srv_nested_tabs,teal_modules)
S3method(ui_nested_tabs,default)
S3method(ui_nested_tabs,teal_module)
S3method(ui_nested_tabs,teal_modules)
S3method(srv_teal_module,default)
S3method(srv_teal_module,teal_module)
S3method(srv_teal_module,teal_modules)
S3method(ui_teal_module,default)
S3method(ui_teal_module,shiny.tag)
S3method(ui_teal_module,teal_module)
S3method(ui_teal_module,teal_modules)
S3method(within,teal_data_module)
export("%>%")
export(TealReportCard)
Expand All @@ -31,11 +32,12 @@ export(new_tdata)
export(report_card_template)
export(reporter_previewer_module)
export(show_rcode_modal)
export(srv_teal_with_splash)
export(srv_teal)
export(tdata2env)
export(teal_data_module)
export(teal_slices)
export(ui_teal_with_splash)
export(teal_transform_module)
export(ui_teal)
export(validate_has_data)
export(validate_has_elements)
export(validate_has_variable)
Expand All @@ -48,6 +50,9 @@ import(shiny)
import(teal.data)
import(teal.slice)
importFrom(magrittr,"%>%")
importFrom(methods,new)
importFrom(methods,setMethod)
importFrom(shiny,reactiveVal)
importFrom(shiny,reactiveValues)
importFrom(stats,setNames)
importMethodsFrom(teal.code,eval_code)
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# teal 0.15.2.9050

### Breaking changes
* The `landing_popup_module()` needs to be passed as the `landing_popup` argument of `init` instead of being passed as a module of the `modules` argument of `init`

### Enhancement
* Provided progress bar for modules loading and data filtering during teal app startup.

Expand Down
122 changes: 89 additions & 33 deletions R/TealAppDriver.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
#' @description
#' Initialize a `TealAppDriver` object for testing a `teal` application.
#'
#' @param data,modules,filter,title,header,footer arguments passed to `init`
#' @param data,modules,filter,title,header,footer,landing_popup arguments passed to `init`
#' @param timeout (`numeric`) Default number of milliseconds for any timeout or
#' timeout_ parameter in the `TealAppDriver` class.
#' Defaults to 20s.
Expand All @@ -45,6 +45,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
title = build_app_title(),
header = tags$p(),
footer = tags$p(),
landing_popup = NULL,
timeout = rlang::missing_arg(),
load_timeout = rlang::missing_arg(),
...) {
Expand All @@ -57,7 +58,8 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
filter = filter,
title = title,
header = header,
footer = footer
footer = footer,
landing_popup = landing_popup,
)

# Default timeout is hardcoded to 4s in shinytest2:::resolve_timeout
Expand Down Expand Up @@ -166,13 +168,11 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
navigate_teal_tab = function(tabs) {
checkmate::check_character(tabs, min.len = 1)
for (tab in tabs) {
root <- "root"
self$set_input(
sprintf("teal-main_ui-%s-active_tab", root),
"teal-teal_modules-active_tab",
get_unique_labels(tab),
wait_ = FALSE
)
root <- sprintf("%s-%s", private$modules$label, get_unique_labels(tab))
}
self$wait_for_idle()
private$set_active_ns()
Expand Down Expand Up @@ -229,6 +229,26 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
private$ns$filter_panel
},
#' @description
#' Get the active shiny name space for interacting with the data-summary panel.
#'
#' @return (`string`) The active shiny name space of the data-summary component.
active_data_summary_ns = function() {
if (identical(private$ns$data_summary, character(0))) {
private$set_active_ns()
}
private$ns$data_summary
},
#' @description
#' Get the active shiny name space bound with a custom `element` name.
#'
#' @param element `character(1)` custom element name.
#'
#' @return (`string`) The active shiny name space of the component bound with the input `element`.
active_data_summary_element = function(element) {
checkmate::assert_string(element)
sprintf("#%s-%s", self$active_data_summary_ns(), element)
},
#' @description
#' Get the input from the module in the `teal` app.
#' This function will only access inputs from the name space of the current active teal module.
#'
Expand Down Expand Up @@ -262,9 +282,10 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
get_active_module_table_output = function(table_id, which = 1) {
checkmate::check_number(which, lower = 1)
checkmate::check_string(table_id)
table <- self$active_module_element(table_id) %>%
self$get_html_rvest() %>%
rvest::html_table(fill = TRUE)
table <- rvest::html_table(
self$get_html_rvest(self$active_module_element(table_id)),
fill = TRUE
)
if (length(table) == 0) {
data.frame()
} else {
Expand Down Expand Up @@ -310,19 +331,37 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
#' Get the active datasets that can be accessed via the filter panel of the current active teal module.
get_active_filter_vars = function() {
displayed_datasets_index <- self$is_visible(
sprintf("#%s-active-filter_active_vars_contents > span", self$active_filters_ns())
sprintf("#%s-filters-filter_active_vars_contents > span", self$active_filters_ns())
)

available_datasets <- self$get_text(
sprintf(
"#%s-active-filter_active_vars_contents .filter_panel_dataname",
"#%s-filters-filter_active_vars_contents .filter_panel_dataname",
self$active_filters_ns()
)
)

available_datasets[displayed_datasets_index]
},
#' @description
#' Get the active data summary table
#' @return `data.frame`
get_active_data_summary_table = function() {
summary_table <- rvest::html_table(
self$get_html_rvest(self$active_data_summary_element("table")),
fill = TRUE
)[[1]]

col_names <- unlist(summary_table[1, ], use.names = FALSE)
summary_table <- summary_table[-1, ]
colnames(summary_table) <- col_names
if (nrow(summary_table) > 0) {
summary_table
} else {
NULL
}
},
#' @description
#' Test if `DOM` elements are visible on the page with a JavaScript call.
#' @param selector (`character(1)`) `CSS` selector to check visibility.
#' A `CSS` id will return only one element if the UI is well formed.
Expand Down Expand Up @@ -371,14 +410,17 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
active_filters <- lapply(
datasets,
function(x) {
var_names <- self$get_text(
sprintf(
"#%s-active-%s-filters .filter-card-varname",
self$active_filters_ns(),
x
var_names <- gsub(
pattern = "\\s",
replacement = "",
self$get_text(
sprintf(
"#%s-filters-%s .filter-card-varname",
self$active_filters_ns(),
x
)
)
) %>%
gsub(pattern = "\\s", replacement = "")
)
structure(
lapply(var_names, private$get_active_filter_selection, dataset_name = x),
names = var_names
Expand All @@ -402,10 +444,19 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
add_filter_var = function(dataset_name, var_name, ...) {
checkmate::check_string(dataset_name)
checkmate::check_string(var_name)
private$set_active_ns()
self$click(
selector = sprintf(
"#%s-filters-%s-add_filter_icon",
private$ns$filter_panel,
dataset_name
)
)
self$set_input(
sprintf(
"%s-add-%s-filter-var_to_add",
self$active_filters_ns(),
"%s-filters-%s-%s-filter-var_to_add",
private$ns$filter_panel,
dataset_name,
dataset_name
),
var_name,
Expand Down Expand Up @@ -468,7 +519,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
checkmate::check_string(input)

input_id_prefix <- sprintf(
"%s-active-%s-filter-%s_%s-inputs",
"%s-filters-%s-filter-%s_%s-inputs",
self$active_filters_ns(),
dataset_name,
dataset_name,
Expand All @@ -492,7 +543,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.

# Generate correct namespace
slices_input_id <- sprintf(
"%s-active-%s-filter-%s_%s-inputs-%s",
"%s-filters-%s-filter-%s_%s-inputs-%s",
self$active_filters_ns(),
dataset_name,
dataset_name,
Expand Down Expand Up @@ -542,9 +593,10 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
#'
#' @return The `character` vector.
get_attr = function(selector, attribute) {
self$get_html_rvest("html") %>%
rvest::html_nodes(selector) %>%
rvest::html_attr(attribute)
rvest::html_attr(
rvest::html_nodes(self$get_html_rvest("html"), selector),
attribute
)
},
#' @description
#' Wrapper around `get_html` that passes the output directly to `rvest::read_html`.
Expand Down Expand Up @@ -602,14 +654,13 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
all_inputs <- self$get_values()$input
active_tab_inputs <- all_inputs[grepl("-active_tab$", names(all_inputs))]

tab_ns <- lapply(names(active_tab_inputs), function(name) {
tab_ns <- unlist(lapply(names(active_tab_inputs), function(name) {
gsub(
pattern = "-active_tab$",
replacement = sprintf("-%s", active_tab_inputs[[name]]),
name
)
}) %>%
unlist()
}))
active_ns <- tab_ns[1]
if (length(tab_ns) > 1) {
for (i in 2:length(tab_ns)) {
Expand All @@ -621,11 +672,16 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
}
private$ns$module <- sprintf("%s-%s", active_ns, "module")

component <- "filter_panel"
if (!is.null(self$get_html(sprintf("#teal-main_ui-%s", component)))) {
private$ns[[component]] <- sprintf("teal-main_ui-%s", component)
} else {
private$ns[[component]] <- sprintf("%s-module_%s", active_ns, component)
components <- c("filter_panel", "data_summary")
for (component in components) {
if (
!is.null(self$get_html(sprintf("#%s-%s-panel", active_ns, component))) ||
!is.null(self$get_html(sprintf("#%s-%s-table", active_ns, component)))
) {
private$ns[[component]] <- sprintf("%s-%s", active_ns, component)
} else {
private$ns[[component]] <- sprintf("%s-module_%s", active_ns, component)
}
}
},
# @description
Expand All @@ -639,7 +695,7 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
checkmate::check_string(dataset_name)
checkmate::check_string(var_name)
input_id_prefix <- sprintf(
"%s-active-%s-filter-%s_%s-inputs",
"%s-filters-%s-filter-%s_%s-inputs",
self$active_filters_ns(),
dataset_name,
dataset_name,
Expand Down
28 changes: 20 additions & 8 deletions R/dummy_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,33 @@
#' shinyApp(app$ui, app$server)
#' }
#' @export
example_module <- function(label = "example teal module", datanames = "all") {
example_module <- function(label = "example teal module", datanames = "all", transformers = list()) {
checkmate::assert_string(label)
ans <- module(
label,
server = function(id, data) {
checkmate::assert_class(data(), "teal_data")
checkmate::assert_class(isolate(data()), "teal_data")
gogonzo marked this conversation as resolved.
Show resolved Hide resolved
moduleServer(id, function(input, output, session) {
updateSelectInput(
inputId = "dataname",
choices = isolate(teal.data::datanames(data())),
selected = restoreInput(session$ns("dataname"), NULL)
)
datanames_rv <- reactive({
teal.data::datanames(req(data()))
})

observeEvent(datanames_rv(), {
selected <- isolate(input$dataname)
if (identical(selected, "")) selected <- restoreInput(session$ns("dataname"), NULL)
updateSelectInput(
session = session,
inputId = "dataname",
choices = datanames_rv(),
selected = selected
)
})

output$text <- renderPrint({
req(input$dataname)
data()[[input$dataname]]
})

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(data())),
Expand All @@ -46,7 +57,8 @@ example_module <- function(label = "example teal module", datanames = "all") {
)
)
},
datanames = datanames
datanames = datanames,
transformers = transformers
)
attr(ans, "teal_bookmarkable") <- TRUE
ans
Expand Down
Loading
Loading