Skip to content

Commit

Permalink
Merge back 1.0.0 Release (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
cb4ds authored Oct 28, 2021
1 parent aebd527 commit 507df43
Show file tree
Hide file tree
Showing 80 changed files with 3,933 additions and 1,128 deletions.
12 changes: 8 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: periscope
Type: Package
Title: Enterprise Streamlined 'Shiny' Application Framework
Version: 0.6.3
Version: 1.0.0
Authors@R: c(
person("Constance", "Brett", email="connie@aggregate-genius.com", role = c("aut", "cre")),
person("Isaac", "Neuhaus", role = "aut", comment = "canvasXpress JavaScript Library Maintainer"),
Expand All @@ -20,21 +20,25 @@ Language: en-US
Depends:
R (>= 3.5)
Imports:
shiny (>= 1.1),
shiny (>= 1.5),
shinydashboard (>= 0.5),
shinyBS (>= 0.61),
lubridate (>= 1.6),
DT (>= 0.2),
writexl (>= 1.3),
ggplot2 (>= 2.2),
methods,
utils
utils,
fresh,
yaml,
grDevices
RoxygenNote: 7.1.1
Suggests:
knitr,
rmarkdown,
shinydashboardPlus,
testthat (>= 3.0),
canvasXpress,
openxlsx (>= 3.0)
openxlsx (>= 3.0),
colourpicker
VignetteBuilder: knitr
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#Revisions and Change Log

### v1.0.0 **major version release**
* Updated to the latest shiny modules paradigm from the old one
* Support for downloadableTable DT options
* Styling changed to use the fresh package
* Updated example applications, documentation, vignettes, etc.
* Ensured apps created with the older version of this package will work when the package is upgraded

---

### v0.6.3
* Bugfix for the framework to not require shinydashboardPlus unless a right sidebar is in use
* Bugfixes for the sample applications
Expand Down
55 changes: 46 additions & 9 deletions R/appReset.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,57 @@
}

# Module Server Function
.appReset <- function(input, output, session, logger) {
.appReset <- function(..., logger) {
call <- match.call()
params <- list(...)
param_index <- 1
params_length <- length(params)
old_style_call <- call[[1]] == "module" || "periscope" %in% as.character(call[[1]])

if (old_style_call) {
input <- params[[param_index]]
param_index <- param_index + 1
output <- params[[param_index]]
param_index <- param_index + 1
session <- params[[param_index]]
param_index <- param_index + 1
} else {
id <- params[[param_index]]
param_index <- param_index + 1
}

if (missing(logger) && params_length >= param_index) {
logger <- params[[param_index]]
}

if (old_style_call) {
app_reset(input, output, session, logger)
}
else {
shiny::moduleServer(
id,
function(input, output, session) {
app_reset(input, output, session, logger)
})
}
}


app_reset <- function(input, output, session, logger) {
shiny::observe({
pending <- shiny::isolate(input$resetPending)
waittime <- shiny::isolate(.g_opts$reset_wait)

if (is.null(pending)) {
return() # there is no reset button on the UI for the app
}

if (input$resetButton && !(pending)) {
# reset initially requested
logwarn(paste("Application Reset requested by user. ",
"Resetting in ", (waittime / 1000),
"seconds."),
logger = logger)
"Resetting in ", (waittime / 1000),
"seconds."),
logger = logger)
shinyBS::createAlert(
session, "sidebarAdvancedAlert",
style = "danger",
Expand All @@ -60,8 +96,8 @@
else if (!input$resetButton && pending) {
# reset cancelled by pushing the button again
loginfo("Application Reset cancelled by user.",
logger = logger)

logger = logger)
shinyBS::createAlert(
session, "sidebarAdvancedAlert",
style = "success",
Expand All @@ -82,4 +118,5 @@
session$reload()
}
})
}

}
51 changes: 43 additions & 8 deletions R/bodyFooter.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,62 @@


# Module Server Function
.bodyFooter <- function(input, output, session, logdata) {
output$dt_userlog <- shiny::renderTable({
.bodyFooter <- function(..., logdata) {
call <- match.call()
params <- list(...)
param_index <- 1
params_length <- length(params)
old_style_call <- call[[1]] == "module" || "periscope" %in% as.character(call[[1]])

if (old_style_call) {
input <- params[[param_index]]
param_index <- param_index + 1
output <- params[[param_index]]
param_index <- param_index + 1
session <- params[[param_index]]
param_index <- param_index + 1
} else {
id <- params[[param_index]]
param_index <- param_index + 1
}

if (missing(logdata) && params_length >= param_index) {
logdata <- params[[param_index]]
}

if (old_style_call) {
body_footer(input, output, session, logdata)
}
else {
shiny::moduleServer(
id,
function(input, output, session) {
body_footer(input, output, session, logdata)
})
}
}

body_footer <- function(input, output, session, logdata) {
output$dt_userlog <- shiny::renderTable({

lines <- logdata()
if (is.null(lines) || length(lines) == 0) {
return()
}

out1 <- data.frame(orig = lines, stringsAsFactors = F)
loc1 <- regexpr("\\[", out1$orig)
loc2 <- regexpr("\\]", out1$orig)

out1$logname <- substr(out1$orig, 1, loc1 - 1)

out1$timestamp <- substr(out1$orig, loc1 + 1, loc2 - 1)
out1$timestamp <- lubridate::parse_date_time(out1$timestamp, "YmdHMS")

out1$action <- substring(out1$orig, loc2 + 1)
out1$action <- trimws(out1$action, "both")

data.frame(action = out1$action,
time = format(out1$timestamp, format = .g_opts$datetime.fmt))
})
})
}
Loading

0 comments on commit 507df43

Please sign in to comment.