Skip to content

Commit

Permalink
CRAN 0.5.1 released (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
cb4ds authored Jul 3, 2020
1 parent a67bbd1 commit f56551e
Show file tree
Hide file tree
Showing 37 changed files with 1,281 additions and 76 deletions.
6 changes: 3 additions & 3 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.4.10-1
Version: 0.5.1
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 @@ -26,11 +26,11 @@ Imports:
shinydashboard (>= 0.5),
shinydashboardPlus (>= 0.5),
shinyBS (>= 0.61),
logging (>= 0.7-103),
lubridate (>= 1.6),
DT (>= 0.2),
openxlsx (>= 3.0),
ggplot2 (>= 2.2)
ggplot2 (>= 2.2),
methods
RoxygenNote: 7.1.0
Suggests:
knitr,
Expand Down
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ export(downloadablePlotUI)
export(downloadableTable)
export(downloadableTableUI)
export(get_url_parameters)
export(logdebug)
export(logerror)
export(logfine)
export(logfiner)
export(logfinest)
export(loginfo)
export(logwarn)
export(remove_reset_button)
export(set_app_parameters)
export(ui_tooltip)
importFrom(methods,new)
10 changes: 8 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#Revisions and Change Log

### v0.4.10-1
### v0.5.1
* Added support for other color schemes in the dashboard
* Replaced CRAN-archived logging package functionality


### v0.4.10-1
* Fixed tests for compatibility with the next release of shiny

### v0.4.9-1

### v0.4.9-1
* Fixed url typo in readme link


Expand Down
6 changes: 3 additions & 3 deletions R/appReset.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

if (input$resetButton && !(pending)) {
# reset initially requested
logging::logwarn(paste("Application Reset requested by user. ",
logwarn(paste("Application Reset requested by user. ",
"Resetting in ", (waittime / 1000),
"seconds."),
logger = logger)
Expand All @@ -59,7 +59,7 @@
}
else if (!input$resetButton && pending) {
# reset cancelled by pushing the button again
logging::loginfo("Application Reset cancelled by user.",
loginfo("Application Reset cancelled by user.",
logger = logger)

shinyBS::createAlert(
Expand All @@ -78,7 +78,7 @@
}
else if (pending) {
# reset timed out
logging::logwarn("Application Reset", logger = logger)
logwarn("Application Reset", logger = logger)
session$reload()
}
})
Expand Down
17 changes: 8 additions & 9 deletions R/downloadFile.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ downloadFileButton <- function(id,
#' @param output provided by \code{shiny::callModule}
#' @param session provided by \code{shiny::callModule}
#' \cr \cr
#' @param logger \link[logging:logging-package]{logging} logger to use
#' @param logger logger to use
#' @param filenameroot the base text used for user-downloaded file - can be
#' either a character string or a reactive expression that returns a character
#' string
Expand All @@ -129,7 +129,6 @@ downloadFileButton <- function(id,
#' @seealso \link[periscope]{downloadFile_ValidateTypes}
#' @seealso \link[periscope]{downloadFile_AvailableTypes}
#' @seealso \link[shiny]{callModule}
#' @seealso \link[logging:logging-package]{logging}
#'
#' @examples
#' # Inside server_local.R
Expand Down Expand Up @@ -230,17 +229,17 @@ downloadFile <- function(input, output, session, logger,
}
else {
msg <- paste(type, "could not be processed")
logging::logwarn(msg)
logwarn(msg)
warning(msg)
}
}
# error - type not handled
else {
msg <- paste(type, "not implemented as a download type")
logging::logwarn(msg)
logwarn(msg)
warning(msg)
}
logging::loginfo(paste("File downloaded in browser: <",
loginfo(paste("File downloaded in browser: <",
filename(), ">"), logger = logger)
}

Expand Down Expand Up @@ -290,7 +289,7 @@ downloadFile <- function(input, output, session, logger,
else {
msg <- paste("Unsupported plot type for ggplot download - ",
"must be in: <png, jpeg, tiff, bmp>")
logging::logwarn(msg)
logwarn(msg)
warning(msg)
}
}
Expand All @@ -308,18 +307,18 @@ downloadFile <- function(input, output, session, logger,
else {
msg <- paste("Unsupported plot type for lattice download - ",
"must be in: <png, jpeg, tiff, bmp>")
logging::logwarn(msg)
logwarn(msg)
warning(msg)
}
}
# error - type not handled
# ------- should really never be hit
else {
msg <- paste(type, "not implemented as a download type")
logging::logwarn(msg)
logwarn(msg)
warning(msg)
}
logging::loginfo(paste("File downloaded in browser: <",
loginfo(paste("File downloaded in browser: <",
filename(), ">"), logger = logger)
}
}
Expand Down
10 changes: 4 additions & 6 deletions R/downloadablePlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
#' downloadfxns are set in the paired callModule (see the \strong{Shiny Usage}
#' section)
#'
#' This module is NOT compatible with the built-in (base) graphics \emph{(any
#' functions provided by the \link[graphics]{graphics} package such as plot)}
#' because they cannot be saved into an object and are directly output by the
#' system at the time of creation.
#' This module is NOT compatible with the built-in (base) graphics \emph{(such as
#' basic plot, etc.)} because they cannot be saved into an object and are directly
#' output by the system at the time of creation.
#'
#' @section Shiny Usage:
#' Call this function at the place in ui.R where the plot should be placed.
Expand Down Expand Up @@ -137,7 +136,7 @@ downloadablePlotUI <- function(id,
#' @param output provided by \code{shiny::callModule}
#' @param session provided by \code{shiny::callModule}
#' \cr \cr
#' @param logger \link[logging:logging-package]{logging} logger to use
#' @param logger logger to use
#' @param filenameroot the base text used for user-downloaded file - can be
#' either a character string or a reactive expression returning a character
#' string
Expand All @@ -163,7 +162,6 @@ downloadablePlotUI <- function(id,
#'
#' @seealso \link[periscope]{downloadablePlotUI}
#' @seealso \link[shiny]{callModule}
#' @seealso \link[logging:logging-package]{logging}
#'
#' @examples
#' # Inside server_local.R
Expand Down
3 changes: 1 addition & 2 deletions R/downloadableTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ downloadableTableUI <- function(id,
#' @param output provided by \code{shiny::callModule}
#' @param session provided by \code{shiny::callModule}
#' \cr \cr
#' @param logger \link[logging:logging-package]{logging} logger to use
#' @param logger logger to use
#' @param filenameroot the base text used for user-downloaded file - can be
#' either a character string or a reactive expression returning a character
#' string
Expand Down Expand Up @@ -127,7 +127,6 @@ downloadableTableUI <- function(id,
#'
#' @seealso \link[periscope]{downloadableTableUI}
#' @seealso \link[shiny]{callModule}
#' @seealso \link[logging:logging-package]{logging}
#'
#' @examples
#' # Inside server_local.R
Expand Down
2 changes: 1 addition & 1 deletion R/fw_helpers_external.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fw_get_version <- function() {

# Get User Action Log
fw_get_user_log <- function() {
logging::getLogger(name = "actions")
getLogger(name = "actions")
}

# Framework UI Header Creation
Expand Down
18 changes: 9 additions & 9 deletions R/fw_helpers_internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,17 @@

file.create(logfile)

logging::addHandler(logging::writeToFile,
file = logfile,
level = loglevel,
logger = logger,
formatter = formatter)
addHandler(writeToFile,
file = logfile,
level = loglevel,
logger = logger,
formatter = formatter)

if (loglevel == "DEBUG") {
logging::addHandler(logging::writeToConsole,
level = loglevel,
logger = logger,
formatter = formatter)
addHandler(writeToConsole,
level = loglevel,
logger = logger,
formatter = formatter)
}

return(logfile)
Expand Down
34 changes: 30 additions & 4 deletions R/generate_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' @param rightsidebar parameter to set the right sidebar. It can be TRUE/FALSE or a character
#' containing the name of a shiny::icon().
#' @param leftsidebar whether the left sidebar should be enabled.
#' @param style list containing application styling properties. By default the skin is blue.
#'
#' @section Name:
#' The \code{name} directory must not exist in \code{location}. If the code
Expand Down Expand Up @@ -94,6 +95,7 @@
#' }
#'
#'@seealso \link[shiny:icon]{shiny:icon()}
#'@seealso \link[shinydashboard:dashboardPage]{shinydashboard:dashboardPage()}
#'
#'@examples
#' # sample app named 'mytestapp' created in a temp dir
Expand All @@ -105,11 +107,13 @@
#'
#' # blank app named 'myblankapp' created in a temp dir
#' create_new_application(name = 'myblankapp', location = tempdir())
#' # blank app named 'myblankapp' with a green skin created in a temp dir
#' create_new_application(name = 'myblankapp', location = tempdir(), style = list(skin = "green"))
#' # blank app named 'myblankapp' without a left sidebar created in a temp dir
#' create_new_application(name = 'myblankapp', location = tempdir(), leftsidebar = FALSE)
#'
#' @export
create_new_application <- function(name, location, sampleapp = FALSE, resetbutton = TRUE, rightsidebar = FALSE, leftsidebar = TRUE) {
create_new_application <- function(name, location, sampleapp = FALSE, resetbutton = TRUE, rightsidebar = FALSE, leftsidebar = TRUE, style = list(skin = "blue")) {
usersep <- .Platform$file.sep
newloc <- paste(location, name, sep = usersep)

Expand All @@ -134,8 +138,18 @@ create_new_application <- function(name, location, sampleapp = FALSE, resetbutto
stop("Framework creation could not proceed, invalid type for rightsidebar, only logical or character allowed")
}
}
if (!is.null(style)) {
if (class(style) == "list") {
if (!identical(intersect("skin", names(style)), character(0)) && !identical(class(style$skin), "character")) {
stop("Framework creation could not proceed, invalid type for skin, only character allowed. See ?shinydashboard::dashboardPage for supported colors.")
}
} else {
stop("Framework creation could not proceed, invalid type for style, only list allowed")
}
}

.create_dirs(newloc, usersep)
.copy_fw_files(newloc, usersep, resetbutton, dashboard_plus, leftsidebar, right_sidebar_icon)
.copy_fw_files(newloc, usersep, resetbutton, dashboard_plus, leftsidebar, right_sidebar_icon, style)
.copy_program_files(newloc, usersep, sampleapp, resetbutton, leftsidebar, dashboard_plus)

message("Framework creation was successful.")
Expand Down Expand Up @@ -167,7 +181,7 @@ create_new_application <- function(name, location, sampleapp = FALSE, resetbutto
}

# Create Framework Files ----------------------------
.copy_fw_files <- function(newloc, usersep, resetbutton = TRUE, dashboard_plus = FALSE, leftsidebar = TRUE, right_sidebar_icon = NULL) {
.copy_fw_files <- function(newloc, usersep, resetbutton = TRUE, dashboard_plus = FALSE, leftsidebar = TRUE, right_sidebar_icon = NULL, style = list(skin = "blue")) {
files <- c("global.R",
"server.R")
if (dashboard_plus) {
Expand Down Expand Up @@ -215,7 +229,19 @@ create_new_application <- function(name, location, sampleapp = FALSE, resetbutto
writeLines(ui_content, con = ui_file)
close(ui_file)
}

# styling
if (!is.null(style) && identical(class(style), "list") && length(style) > 0 &&
!identical(intersect("skin", names(style)), character(0)) && !identical(style, list(skin = "blue"))) {
skin_value <- style$skin
ui_file <- file(paste(newloc, "ui.R", sep = usersep), open = "r+")
ui_content <- readLines(con = ui_file)
ui_content[length(ui_content)] <- paste0(substr(ui_content[length(ui_content)], 1, nchar(ui_content[length(ui_content)]) - 1), ",")
white_space <- paste(rep(" ", ifelse(dashboard_plus, nchar("dashboardPagePlus"), nchar("dashboardPage"))), collapse = "")
ui_content[length(ui_content) + 1] <- sprintf("%s skin = '%s')", white_space, skin_value)
writeLines(ui_content, con = ui_file)
close(ui_file)
}

#subdir copies
imgs <- c("loader.gif", "tooltip.png")
for (file in imgs) {
Expand Down
Loading

0 comments on commit f56551e

Please sign in to comment.