NULL value no longer makes progress bar go to 100%. Closes #1472

This also removes the documentation which said that using NULL would cause the
progress bar to be hidden.
This commit is contained in:
Winston Chang
2017-01-18 14:31:25 -05:00
parent ef5e4cdc0a
commit 4feee00d34
4 changed files with 13 additions and 26 deletions

View File

@@ -55,7 +55,6 @@
#' de-emphasized appearance relative to \code{message}.
#' @param value A numeric value at which to set
#' the progress bar, relative to \code{min} and \code{max}.
#' \code{NULL} hides the progress bar, if it is currently visible.
#' @param style Progress display style. If \code{"notification"} (the default),
#' the progress indicator will show using Shiny's notification API. If
#' \code{"old"}, use the same HTML and CSS used in Shiny 0.13.2 and below
@@ -98,7 +97,6 @@
#' @export
Progress <- R6Class(
'Progress',
portable = TRUE,
public = list(
initialize = function(session = getDefaultReactiveDomain(),
@@ -113,7 +111,7 @@ Progress <- R6Class(
private$min <- min
private$max <- max
private$style <- match.arg(style, choices = c("notification", "old"))
private$value <- NULL
private$value <- 0
private$closed <- FALSE
session$sendProgress('open', list(id = private$id, style = private$style))
@@ -132,7 +130,8 @@ Progress <- R6Class(
value <- min(1, max(0, (value - private$min) / (private$max - private$min)))
}
private$value <- value
if (!is.null(value))
private$value <- value
data <- dropNulls(list(
id = private$id,
@@ -142,7 +141,7 @@ Progress <- R6Class(
style = private$style
))
private$session$sendProgress('update', data)
private$session$sendProgress('update', data)
},
inc = function(amount = 0.1, message = NULL, detail = NULL) {
@@ -239,8 +238,7 @@ Progress <- R6Class(
#' \code{"old"}, use the same HTML and CSS used in Shiny 0.13.2 and below
#' (this is for backward-compatibility).
#' @param value Single-element numeric vector; the value at which to set the
#' progress bar, relative to \code{min} and \code{max}. \code{NULL} hides the
#' progress bar, if it is currently visible.
#' progress bar, relative to \code{min} and \code{max}.
#'
#' @examples
#' ## Only run examples in interactive R sessions

View File

@@ -24,8 +24,7 @@ detail message (if any). The detail message will be shown with a
de-emphasized appearance relative to \code{message}.}
\item{value}{A numeric value at which to set
the progress bar, relative to \code{min} and \code{max}.
\code{NULL} hides the progress bar, if it is currently visible.}
the progress bar, relative to \code{min} and \code{max}.}
\item{style}{Progress display style. If \code{"notification"} (the default),
the progress indicator will show using Shiny's notification API. If

View File

@@ -28,8 +28,7 @@ Must be less tham \code{max}. Default is 0.}
greater than \code{min}. Default is 1.}
\item{value}{Single-element numeric vector; the value at which to set the
progress bar, relative to \code{min} and \code{max}. \code{NULL} hides the
progress bar, if it is currently visible.}
progress bar, relative to \code{min} and \code{max}.}
\item{message}{A single-element character vector; the message to be displayed
to the user, or \code{NULL} to hide the current message (if any).}

View File

@@ -827,14 +827,9 @@ var ShinyApp = function() {
if (typeof(message.detail) !== 'undefined') {
$progress.find('.progress-detail').text(message.detail);
}
if (typeof(message.value) !== 'undefined') {
if (message.value !== null) {
$progress.find('.progress').show();
$progress.find('.progress-bar').width((message.value*100) + '%');
} else {
$progress.find('.progress').hide();
}
if (typeof(message.value) !== 'undefined' && message.value !== null) {
$progress.find('.progress').show();
$progress.find('.progress-bar').width((message.value*100) + '%');
}
} else if (message.style === "old") {
@@ -847,13 +842,9 @@ var ShinyApp = function() {
if (typeof(message.detail) !== 'undefined') {
$progress.find('.progress-detail').text(message.detail);
}
if (typeof(message.value) !== 'undefined') {
if (message.value !== null) {
$progress.find('.progress').show();
$progress.find('.bar').width((message.value*100) + '%');
} else {
$progress.find('.progress').hide();
}
if (typeof(message.value) !== 'undefined' && message.value !== null) {
$progress.find('.progress').show();
$progress.find('.bar').width((message.value*100) + '%');
}
$progress.fadeIn();