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

Simple - Load Reporter - Inbuild #251

Merged
merged 37 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7d07ade
transfer the old code
Polkas Feb 19, 2024
a335e28
simple archiver inbuild
Polkas Feb 19, 2024
b4fbe8a
add btn-group
Polkas Feb 21, 2024
5e2a240
better style
Polkas Feb 21, 2024
7024ff7
improve previewer ui
Polkas Feb 21, 2024
bfd70a7
simple validation
Polkas Feb 22, 2024
8e91b02
improve validation
Polkas Feb 22, 2024
7c7ecd2
temp fix for Teal Slices Block
Polkas Feb 23, 2024
9137470
custom simple reporter modules
Polkas Mar 1, 2024
5910f9f
improve checkmate
Polkas Mar 1, 2024
ccdcafe
Merge branch 'main' into 81_archiver_simple@main
Polkas Mar 1, 2024
899c6ea
add docs
Polkas Mar 1, 2024
cabb1b4
update ReportCard tolist fromlist
Polkas Mar 2, 2024
8b65b20
remove not needed private slot
Polkas Mar 3, 2024
3b73977
report id and rm Archiver
Polkas Mar 8, 2024
6912bdf
fix testServer
Polkas Mar 8, 2024
38657c2
improvements
Polkas Mar 8, 2024
ca35fc0
change tempfile name
Polkas Mar 9, 2024
7be9579
id to filename
Polkas Mar 9, 2024
119d889
small update
Polkas Mar 9, 2024
3692740
merge main
Polkas Mar 19, 2024
d824b60
fix conflict
Polkas Apr 12, 2024
53b9e92
add styler from main
Polkas Apr 12, 2024
f167d70
rm shiny bookmarkings metadata
Polkas Apr 12, 2024
478d5f1
rm Archiver tests and not needed file
Polkas Apr 12, 2024
cf14454
Dawid reco
Polkas Apr 14, 2024
a13f429
setBookmarkExclude
Polkas Apr 15, 2024
2a24cc2
shiny::setBookmarkExclude
Polkas Apr 15, 2024
4434450
previewer_buttons and NEWS
Polkas Apr 18, 2024
6889b24
fix bookmark
Polkas Apr 18, 2024
68736f0
Apply suggestions from code review
Polkas Apr 22, 2024
7a5c965
Apply suggestions from code review
Polkas Apr 22, 2024
d049cff
dispatch_block
Polkas Apr 23, 2024
86d6001
simplify
Polkas Apr 23, 2024
d385240
restart cicd
gogonzo Apr 23, 2024
0103301
pkgdown update
Polkas Apr 23, 2024
2365fe4
spelling and lintr
Polkas Apr 23, 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
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export(add_card_button_ui)
export(as_yaml_auto)
export(download_report_button_srv)
export(download_report_button_ui)
export(report_load_srv)
export(report_load_ui)
export(reporter_previewer_srv)
export(reporter_previewer_ui)
export(reset_report_button_srv)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Enhancements

* Report cards are now included in bookmarks. When using the `shiny` bookmarking mechanism, present report cards will be available in the restored application.
* Report can be loaded back now. The zip file with the report can be loaded back which will restore Previewer state.

# teal.reporter 0.3.1

Expand Down
181 changes: 0 additions & 181 deletions R/Archiver.R

This file was deleted.

37 changes: 35 additions & 2 deletions R/DownloadModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ download_report_button_srv <- function(id,

output$download_data <- shiny::downloadHandler(
filename = function() {
paste("report_", format(Sys.time(), "%y%m%d%H%M%S"), ".zip", sep = "")
paste0(
"report_",
if (reporter$get_id() == "") NULL else paste0(reporter$get_id(), "_"),
format(Sys.time(), "%y%m%d%H%M%S"),
".zip"
)
},
content = function(file) {
shiny::showNotification("Rendering and Downloading the document.")
Expand Down Expand Up @@ -189,13 +194,15 @@ report_render_and_compress <- function(reporter, input_list, global_knitr, file
tryCatch(
renderer$render(reporter$get_blocks(), yaml_header, global_knitr),
warning = function(cond) {
print(cond)
Polkas marked this conversation as resolved.
Show resolved Hide resolved
shiny::showNotification(
ui = "Render document warning!",
action = "Please contact app developer",
type = "warning"
)
},
error = function(cond) {
print(cond)
shiny::showNotification(
ui = "Render document error!",
action = "Please contact app developer",
Expand All @@ -204,17 +211,41 @@ report_render_and_compress <- function(reporter, input_list, global_knitr, file
}
)

output_dir <- renderer$get_output_dir()

tryCatch(
archiver_dir <- reporter$to_jsondir(output_dir),
warning = function(cond) {
print(cond)
shiny::showNotification(
ui = "Archive document warning!",
action = "Please contact app developer",
type = "warning"
)
},
error = function(cond) {
print(cond)
shiny::showNotification(
ui = "Archive document error!",
action = "Please contact app developer",
type = "error"
)
}
)

temp_zip_file <- tempfile(fileext = ".zip")
tryCatch(
expr = zip::zipr(temp_zip_file, renderer$get_output_dir()),
expr = zip::zipr(temp_zip_file, output_dir),
warning = function(cond) {
print(cond)
shiny::showNotification(
ui = "Zipping folder warning!",
action = "Please contact app developer",
type = "warning"
)
},
error = function(cond) {
print(cond)
shiny::showNotification(
ui = "Zipping folder error!",
action = "Please contact app developer",
Expand All @@ -226,13 +257,15 @@ report_render_and_compress <- function(reporter, input_list, global_knitr, file
tryCatch(
expr = file.copy(temp_zip_file, file),
warning = function(cond) {
print(cond)
Polkas marked this conversation as resolved.
Show resolved Hide resolved
shiny::showNotification(
ui = "Copying file warning!",
action = "Please contact app developer",
type = "warning"
)
},
error = function(cond) {
print(cond)
Polkas marked this conversation as resolved.
Show resolved Hide resolved
shiny::showNotification(
ui = "Copying file error!",
action = "Please contact app developer",
Expand Down
Loading