From a1f36dbe008498ef874b9fe6224c0804516bab0e Mon Sep 17 00:00:00 2001 From: Jamie Gilbert Date: Wed, 13 Sep 2023 13:46:37 -0700 Subject: [PATCH] messages for displaying no data --- R/components-data-viewer.R | 11 ++--------- R/evidence-synth-main.R | 11 +++++------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/R/components-data-viewer.R b/R/components-data-viewer.R index 3c954126..649d96d3 100644 --- a/R/components-data-viewer.R +++ b/R/components-data-viewer.R @@ -331,12 +331,8 @@ function filterMinValue(rows, columnId, filterValue) { else{ data = newdf()[, input$dataCols, drop = FALSE] } - if(is.null(data)){ - return(NULL) - } - if(nrow(data) == 0){ - return(NULL) - } + # Display message when dat is empty + shiny::validate(shiny::need(hasData(data), "No data for selection")) # set row height based on nchar of table if(max(apply(data, 1, function(x) max(nchar(x))), na.rm = T) < 100){ height <- 40*3 @@ -407,9 +403,6 @@ function filterMinValue(rows, columnId, filterValue) { }) - - - # HELPERS addTableActions <- function( colDefsInput, diff --git a/R/evidence-synth-main.R b/R/evidence-synth-main.R index 588cb320..95eece9c 100644 --- a/R/evidence-synth-main.R +++ b/R/evidence-synth-main.R @@ -280,11 +280,11 @@ evidenceSynthesisServer <- function( ) }) - output$esSccsPlot <- shiny::renderPlot( - createPlotForSccsAnalysis( - sccsData() - ) - ) + output$esSccsPlot <- shiny::renderPlot({ + sccsRes <- sccsData() + shiny::validate(shiny::need(hasData(sccsRes), "No valid data for selected target")) + createPlotForSccsAnalysis(sccsRes) + }) resultTableServer( @@ -697,7 +697,6 @@ getSccsEstimation <- function( targetId, outcomeId ){ - if(is.null(targetId)){ return(NULL) }