From bad48f61027d4b45cdf14fd27ec4eeffa3ae9084 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Fri, 15 Sep 2023 10:48:07 +0200 Subject: [PATCH 1/6] drop Report previewer from mapping matrix --- R/module_filter_manager.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/module_filter_manager.R b/R/module_filter_manager.R index d3292f5a3f..ea155eecce 100644 --- a/R/module_filter_manager.R +++ b/R/module_filter_manager.R @@ -147,6 +147,7 @@ filter_manager_srv <- function(id, filtered_data_list, filter) { ifelse(state_ids_global %in% state_ids_allowed, states_active, NA) }) + # mapping_smooth <- mapping_smooth[grep("Report previewer", names(mapping_smooth), invert = TRUE)] as.data.frame(mapping_smooth, row.names = state_ids_global, check.names = FALSE) }) @@ -164,9 +165,10 @@ filter_manager_srv <- function(id, filtered_data_list, filter) { rownames(mm) <- "" } - mm + # Report Previewer will not be displayed. + mm[!grepl("Report previewer", names(mm))] }, - align = paste(c("l", rep("c", length(filtered_data_list))), collapse = ""), + align = paste(c("l", rep("c", sum(!grepl("Report previewer", names(filtered_data_list))))), collapse = ""), rownames = TRUE ) From 29226106be2b7853fe02f4116a85f5113a6dd7e4 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Fri, 15 Sep 2023 11:11:03 +0200 Subject: [PATCH 2/6] linter --- R/module_filter_manager.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/module_filter_manager.R b/R/module_filter_manager.R index ea155eecce..05f2736066 100644 --- a/R/module_filter_manager.R +++ b/R/module_filter_manager.R @@ -147,7 +147,6 @@ filter_manager_srv <- function(id, filtered_data_list, filter) { ifelse(state_ids_global %in% state_ids_allowed, states_active, NA) }) - # mapping_smooth <- mapping_smooth[grep("Report previewer", names(mapping_smooth), invert = TRUE)] as.data.frame(mapping_smooth, row.names = state_ids_global, check.names = FALSE) }) From 8f66b89a698abc2ae861de44d76bbc400e03a201 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 18 Sep 2023 08:46:48 +0200 Subject: [PATCH 3/6] amend --- NEWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 3e259a17d3..a6c25ed79d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,8 @@ ### Miscellaneous -* Enhance a `module` validation checks so that it won't throw messages about `data` argument unnecessarily. +* Enhanced a `module` validation checks so that it won't throw messages about `data` argument unnecessarily. +* Removed `Report previewer` module from mapping matrix display in filter manager. # teal 0.14.0 From 18e51472828a12e692240733ba4242c3a35e177a Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Tue, 19 Sep 2023 16:24:19 +0200 Subject: [PATCH 4/6] reserve module label 'Report previewer' --- R/modules.R | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/R/modules.R b/R/modules.R index d5d7ce016b..2cc426b7fe 100644 --- a/R/modules.R +++ b/R/modules.R @@ -212,7 +212,18 @@ module <- function(label = "module", } if (label == "global_filters") { - stop("Label 'global_filters' is reserved in teal. Please change to something else.") + stop( + sprintf("module(label = \"%s\", ...\n ", label), + "Label 'global_filters' is reserved in teal. Please change to something else.", + call. = FALSE + ) + } + if (label == "Report previewer") { + stop( + sprintf("module(label = \"%s\", ...\n ", label), + "Label 'Report previewer' is reserved in teal.", + call. = FALSE + ) } server_formals <- names(formals(server)) if (!( From 19bf60c461d7a9992eb27b169bade1abdb6d0319 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Tue, 19 Sep 2023 16:26:21 +0200 Subject: [PATCH 5/6] improve logical index in mapping matrix --- R/module_filter_manager.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/module_filter_manager.R b/R/module_filter_manager.R index 05f2736066..8339efbf1c 100644 --- a/R/module_filter_manager.R +++ b/R/module_filter_manager.R @@ -165,9 +165,9 @@ filter_manager_srv <- function(id, filtered_data_list, filter) { } # Report Previewer will not be displayed. - mm[!grepl("Report previewer", names(mm))] + mm[names(mm) != "Report previewer"] }, - align = paste(c("l", rep("c", sum(!grepl("Report previewer", names(filtered_data_list))))), collapse = ""), + align = paste(c("l", rep("c", sum(names(filtered_data_list) != "Report previewer"))), collapse = ""), rownames = TRUE ) From 053405cb1d567ca6bd2fb239a6de6005c53b9a21 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Tue, 19 Sep 2023 16:31:10 +0200 Subject: [PATCH 6/6] circumvent reserved label in reporter_previewer_module --- R/reporter_previewer_module.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/reporter_previewer_module.R b/R/reporter_previewer_module.R index fd2411f76a..12dac5791c 100644 --- a/R/reporter_previewer_module.R +++ b/R/reporter_previewer_module.R @@ -28,10 +28,11 @@ reporter_previewer_module <- function(label = "Report previewer", server_args = } module <- module( - label = label, + label = "temporary label", server = srv, ui = ui, server_args = server_args, ui_args = list(), datanames = NULL ) class(module) <- c("teal_module_previewer", class(module)) + module$label <- label module }