From 4d03b9a0300cfba7a7e4e257ea04fb96eac741c1 Mon Sep 17 00:00:00 2001 From: "Aaron Clark (Arcus)" Date: Fri, 31 May 2024 12:39:13 -0400 Subject: [PATCH 01/11] Increment version number to 3.0.0.9022 --- DESCRIPTION | 2 +- NEWS.md | 1 + R/app_server.R | 5 ++- R/mod_downloadHandler.R | 2 +- R/mod_packageDependencies.R | 6 ++-- R/mod_reportPreview.R | 10 +++--- R/utils.R | 49 +++++++++++++--------------- R/utils_get_db.R | 10 ++++-- dev/run_dev.R | 2 +- inst/report_downloads/reportHtml.Rmd | 11 ++++--- 10 files changed, 53 insertions(+), 45 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 578f287bd..aaea50a21 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: riskassessment Title: A web app designed to interface with the `riskmetric` package -Version: 3.0.0.9021 +Version: 3.0.0.9022 Authors@R: c( person("Aaron", "Clark", role = c("aut", "cre"), email = "clark.aaronchris@gmail.com"), person("Robert", "Krajcik", role = "aut", email = "robert.krajcik@biogen.com"), diff --git a/NEWS.md b/NEWS.md index 9d81b0d74..b60157d3e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -24,6 +24,7 @@ * Added `{riskmetric}` assessment documentation URLs to About tab, on Risk Assessment Criteria page. * Updated the Dependency Cards to be slightly more informative * Updated 'About' page to highlight individual contributors on the project, leveraging `bslib` cards. +* Add `Decision` column to Package Dependencies tab so that users (#774) # riskassessment 3.0.0 diff --git a/R/app_server.R b/R/app_server.R index e56e2c064..98bc3e974 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -248,7 +248,10 @@ app_server <- function(input, output, session) { }) session$userData$loaded2_db <- eventReactive({uploaded_pkgs(); changes()}, { - dbSelect("SELECT name, version, score FROM package") + dbSelect("SELECT name, version, score, decision_id, decision + FROM package as pi + LEFT JOIN decision_categories as dc + ON pi.decision_id = dc.id") }) create_src_dir <- eventReactive(input$tabs, input$tabs == "Source Explorer") diff --git a/R/mod_downloadHandler.R b/R/mod_downloadHandler.R index 2151853a5..07f88b5b8 100644 --- a/R/mod_downloadHandler.R +++ b/R/mod_downloadHandler.R @@ -287,7 +287,7 @@ mod_downloadHandler_server <- function(id, pkgs, user, metric_weights){ } else { purrr::map_df(dep_metrics$name, ~get_versnScore(.x, session$userData$loaded2_db(), session$userData$repo_pkgs())) %>% right_join(dep_metrics, by = "name") %>% - select(package, type, version, score) %>% + select(package, type, version, score, decision) %>% arrange(package, type) %>% distinct() } diff --git a/R/mod_packageDependencies.R b/R/mod_packageDependencies.R index 5611a3b27..27b9d185f 100644 --- a/R/mod_packageDependencies.R +++ b/R/mod_packageDependencies.R @@ -141,7 +141,7 @@ packageDependenciesServer <- function(id, selected_pkg, user, credentials, paren purrr::map_df(pkginfo$name, ~get_versnScore(.x, session$userData$loaded2_db(), session$userData$repo_pkgs())) %>% right_join(pkginfo, by = "name") %>% - select(package, type, name, version, score) %>% + select(package, type, name, version, score, decision) %>% # need id? arrange(name, type) %>% distinct() @@ -248,8 +248,8 @@ packageDependenciesServer <- function(id, selected_pkg, user, credentials, paren br(), DT::renderDataTable({ datatable_custom( - table_revdeps_local(), - colnames = c("Package", "Version", "Score", "Review Package"), + table_revdeps_local() |> select(-decision_id), + colnames = c("Package", "Version", "Score", "Decision", "Review Package"), hide_names = NULL ) }), diff --git a/R/mod_reportPreview.R b/R/mod_reportPreview.R index dc0423c34..409709158 100644 --- a/R/mod_reportPreview.R +++ b/R/mod_reportPreview.R @@ -192,12 +192,10 @@ reportPreviewServer <- function(id, selected_pkg, maint_metrics, com_metrics, DT::renderDataTable({ req(selected_pkg$name()) - dep_table() + datatable_custom(dep_table(), pLength = list(-1), PlChange = FALSE, + colnames = c("Package", "Type", "Version", "Score", "Decision")) - }, options = list(dom = "t", searching = FALSE, pageLength = -1, lengthChange = FALSE, - info = FALSE, - columnDefs = list(list(className = 'dt-center', targets = 2)) - ) + } ) )) ), @@ -471,7 +469,7 @@ reportPreviewServer <- function(id, selected_pkg, maint_metrics, com_metrics, purrr::map_df(dep_metrics()$name, ~get_versnScore(.x, session$userData$loaded2_db(), session$userData$repo_pkgs())) %>% right_join(dep_metrics(), by = "name") %>% - select(package, type, version, score) %>% + select(package, type, version, score, decision) %>% arrange(package, type) %>% distinct() }) diff --git a/R/utils.R b/R/utils.R index d17be6194..c5f7e5fa5 100644 --- a/R/utils.R +++ b/R/utils.R @@ -562,10 +562,14 @@ shinyInput <- function(FUN, len, id, ...) { #' datatable_custom <- function( data, - colnames = c("Package", "Type", "Name", "Version", "Score", "Review Package"), + colnames = c("Package", "Type", "Name", "Version", "Score", "Decision", "Review Package"), hide_names = "name", + pLength = list(c(15, -1), c("15", "All")), plChange = TRUE, ... ){ + decision_lst <- if (!is.null(golem::get_golem_options("decision_categories"))) golem::get_golem_options("decision_categories") else c("Low Risk", "Medium Risk", "High Risk") + color_lst <- get_colors(golem::get_golem_options("assessment_db_name")) + colnames <- colnames %||% character(0) hide_names <- hide_names %||% character(0) data <- data %||% as.data.frame(matrix(nrow = 0, ncol = pmax(length(colnames), 1) )) @@ -588,39 +592,32 @@ datatable_custom <- function( list( score = formattable::formatter( "span", - style = x ~ formattable::style( - display = "block", - "border-radius" = "4px", - "padding-right" = "4px", - "color" = "#000000", - "order" = x, - "background-color" = formattable::csscolor( - setColorPalette(100)[round(as.numeric(x)*100)] - ) - ) - ), + style = x ~ formattable::style(display = "block", + "border-radius" = "4px", + "padding-right" = "4px", + "color" = "black", + "order" = x, + "background-color" = formattable::csscolor( + setColorPalette(100)[round(as.numeric(x)*100)]))), decision = formattable::formatter( "span", - style = x ~ formattable::style( - display = "block", - "border-radius" = "4px", - "padding-right" = "4px", - "font-weight" = "bold", - "color" = ifelse(x %in% decision_lst, "white", "inherit"), - "background-color" = - ifelse(x %in% decision_lst, - color_lst[x], - "transparent" - ) - ) - ) + style = x ~ formattable::style(display = "block", + "border-radius" = "4px", + "padding-right" = "4px", + "color" = ifelse(x %in% decision_lst, get_text_color(get_colors(golem::get_golem_options("assessment_db_name"))[x]), "inherit"), + "background-color" = + ifelse(x %in% decision_lst, + glue::glue("var(--{risk_lbl(x, type = 'attribute')}-color)"), + "transparent"))) ) ), selection = "none", colnames = colnames, rownames = FALSE, options = list( - lengthMenu = list(c(15, -1), c("15", "All")), + # pageLength = pLength[1], + lengthMenu = pLength, + lengthChange = plChange, columnDefs = list(list(visible = FALSE, targets = target)), searchable = FALSE ), diff --git a/R/utils_get_db.R b/R/utils_get_db.R index a8bd0e57e..2e3708791 100644 --- a/R/utils_get_db.R +++ b/R/utils_get_db.R @@ -382,16 +382,22 @@ get_versnScore <- function(pkg_name, verify_data, cran_pkgs) { return(list(name = character(), version = character(), score = character())) if (pkg_name %in% verify_data$name) { #loaded2_db()$name - tmp_df <- verify_data %>% filter(name == pkg_name) %>% select(score, version) + tmp_df <- verify_data %>% filter(name == pkg_name) %>% select(score, version, decision_id, decision) pkg_score <- tmp_df %>% pull(score) %>% as.character pkg_versn <- tmp_df %>% pull(version) %>% as.character + pkg_decision_id <- tmp_df %>% pull(decision_id) %>% as.character + pkg_decision <- tmp_df %>% pull(decision) %>% as.character } else { pkg_score <- "" pkg_versn <- if_else(pkg_name %in% c(rownames(installed.packages(priority="base"))), "", subset(cran_pkgs, Package == pkg_name, c("Version")) %>% as.character()) + pkg_decision_id <- "" + pkg_decision <- "" } - return(list(name = pkg_name, version = pkg_versn, score = pkg_score)) + return(list(name = pkg_name, version = pkg_versn, score = pkg_score, + decision_id = pkg_decision_id, decision = pkg_decision + )) } diff --git a/dev/run_dev.R b/dev/run_dev.R index 3a02c3636..92f199d23 100644 --- a/dev/run_dev.R +++ b/dev/run_dev.R @@ -1,6 +1,6 @@ # Set options here options(golem.app.prod = FALSE) # TRUE = production mode, FALSE = development mode -options(shiny.fullstacktrace = FALSE) +options(shiny.fullstacktrace = TRUE) options(dplyr.summarise.inform = FALSE) # suppress summarise() has grouped output by..." # options(shiny.autoload.r=FALSE) diff --git a/inst/report_downloads/reportHtml.Rmd b/inst/report_downloads/reportHtml.Rmd index 230952ba4..2797b999c 100644 --- a/inst/report_downloads/reportHtml.Rmd +++ b/inst/report_downloads/reportHtml.Rmd @@ -372,10 +372,13 @@ tagList( tagList( createGrid(metrics = params$dep_cards), br(), - DT::datatable(params$dep_table, - options = list(dom = "t", searching = FALSE, pageLength = -1, - lengthChange = FALSE, info = FALSE, - columnDefs = list(list(className = 'dt-center', targets = 2)))) + # datatable_custom( + DT::datatable( + params$dep_table #, pLength = list(-1), plChange = FALSE + ,options = list(dom = "t", searching = FALSE, pageLength = -1, + lengthChange = FALSE, info = FALSE, + columnDefs = list(list(className = 'dt-center', targets = 2))) + )#) ), if('Dependency Comments' %in% params$report_includes) tagList( From 830cd7f05bd3ccc0acd91d20e6e10987b1588f95 Mon Sep 17 00:00:00 2001 From: "Aaron Clark (Arcus)" Date: Fri, 31 May 2024 14:57:53 -0400 Subject: [PATCH 02/11] move decision_list and color_list outside of datatable_custom() --- R/utils.R | 8 +++++--- tests/testthat/test-utils.R | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/R/utils.R b/R/utils.R index c5f7e5fa5..149449b4d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -565,10 +565,10 @@ datatable_custom <- function( colnames = c("Package", "Type", "Name", "Version", "Score", "Decision", "Review Package"), hide_names = "name", pLength = list(c(15, -1), c("15", "All")), plChange = TRUE, + decision_lst = if (!is.null(golem::get_golem_options("decision_categories"))) golem::get_golem_options("decision_categories") else c("Low Risk", "Medium Risk", "High Risk"), + color_lst = get_colors(golem::get_golem_options("assessment_db_name")), ... ){ - decision_lst <- if (!is.null(golem::get_golem_options("decision_categories"))) golem::get_golem_options("decision_categories") else c("Low Risk", "Medium Risk", "High Risk") - color_lst <- get_colors(golem::get_golem_options("assessment_db_name")) colnames <- colnames %||% character(0) hide_names <- hide_names %||% character(0) @@ -604,7 +604,9 @@ datatable_custom <- function( style = x ~ formattable::style(display = "block", "border-radius" = "4px", "padding-right" = "4px", - "color" = ifelse(x %in% decision_lst, get_text_color(get_colors(golem::get_golem_options("assessment_db_name"))[x]), "inherit"), + "color" = ifelse(x %in% decision_lst, #'black', + get_text_color(color_lst[x]), + "inherit"), "background-color" = ifelse(x %in% decision_lst, glue::glue("var(--{risk_lbl(x, type = 'attribute')}-color)"), diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 7bf53e94a..0ca1dbd5d 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -191,22 +191,32 @@ test_that( ) test_that("datatable_custom works", { - output <- datatable_custom(mtcars, colnames = paste0("custom_", names(mtcars))) + output <- datatable_custom(mtcars, colnames = paste0("custom_", names(mtcars)), + decision_lst = c("Low Risk", "Medium Risk", "High Risk"), + color_lst = get_colors(app_sys("testdata", "skeleton.sqlite"))) #c("#9CFF94FF", "#FFD070FF", "#FF765BFF") expect_true(inherits(output, "datatables")) # it errors if not a data frame is provided: - expect_error(datatable_custom(matrix())) + expect_error(datatable_custom(matrix(), + decision_lst = c("Low Risk", "Medium Risk", "High Risk"), + color_lst = get_colors(app_sys("testdata", "skeleton.sqlite")))) # it defaults to data frame names with a warning if colnames is not of equal # length as names(data) expect_warning( - datatable_custom(mtcars[, 1:2], colnames = c("a", "b", "c")), + datatable_custom(mtcars[, 1:2], colnames = c("a", "b", "c"), + decision_lst = c("Low Risk", "Medium Risk", "High Risk"), + color_lst = get_colors(app_sys("testdata", "skeleton.sqlite"))), "Defaulting to original data frame names" ) #it returns an empty datatable if the data frame provided is NULL - output_no_df <- datatable_custom(NULL, colnames = paste0("custom_", names(mtcars))) + output_no_df <- datatable_custom(NULL, colnames = paste0("custom_", names(mtcars)), + decision_lst = c("Low Risk", "Medium Risk", "High Risk"), + color_lst = get_colors(app_sys("testdata", "skeleton.sqlite"))) expect_true(inherits(output_no_df, "datatables")) expect_equal(nrow(output_no_df$x$data), 0) # and if the colnames parameter is also NULL: - output_no_df_no_colnames <- datatable_custom(NULL, colnames = NULL) + output_no_df_no_colnames <- datatable_custom(NULL, colnames = NULL, + decision_lst = c("Low Risk", "Medium Risk", "High Risk"), + color_lst = get_colors(app_sys("testdata", "skeleton.sqlite"))) expect_true(inherits(output_no_df_no_colnames, "datatables")) expect_equal(nrow(output_no_df_no_colnames$x$data), 0) From 26d7b4b1c0b1d7e6fa61e91f50bb8c0f95ab5237 Mon Sep 17 00:00:00 2001 From: "Aaron Clark (Arcus)" Date: Mon, 3 Jun 2024 10:58:16 -0400 Subject: [PATCH 03/11] update downloadHandler test app.R with new load2_db object. --- tests/testthat.R | 1 + tests/testthat/test-apps/downloadHandler-app/app.R | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/testthat.R b/tests/testthat.R index 4258786dd..47bd36624 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -19,3 +19,4 @@ while (!chromote::has_default_chromote_object() && Sys.time() - tmpt < 1) { } test_check("riskassessment") +test_file("tests/testthat/test-downloadHandler.R") diff --git a/tests/testthat/test-apps/downloadHandler-app/app.R b/tests/testthat/test-apps/downloadHandler-app/app.R index 1253ce3d2..23c55bf9d 100644 --- a/tests/testthat/test-apps/downloadHandler-app/app.R +++ b/tests/testthat/test-apps/downloadHandler-app/app.R @@ -40,7 +40,13 @@ server <- function(input, output, session) { session$userData$suggests <- reactiveVal(FALSE) session$userData$loaded2_db <- reactive({ - riskassessment:::dbSelect("select name, version, score from package") + riskassessment:::dbSelect(" + SELECT name, version, score, decision_id, decision + FROM package as pi + LEFT JOIN decision_categories as dc + ON pi.decision_id = dc.id + ") # "select name, version, score from package" + }) riskassessment:::mod_downloadHandler_server("downloadHandler_1", pkg, user, metric_weights) From aeb378a1eee190cfc150da6639cb4a914a3d8159 Mon Sep 17 00:00:00 2001 From: "Aaron Clark (Arcus)" Date: Mon, 3 Jun 2024 10:58:50 -0400 Subject: [PATCH 04/11] fix news --- NEWS.md | 6 ++---- tests/testthat.R | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index e7f7426f7..bf828f38b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -24,12 +24,10 @@ * Added `{riskmetric}` assessment documentation URLs to About tab, on Risk Assessment Criteria page. * Updated the Dependency Cards to be slightly more informative * Updated 'About' page to highlight individual contributors on the project, leveraging `bslib` cards. -<<<<<<< ac-774 -* Add `Decision` column to Package Dependencies tab so that users (#774) -======= * Allow users to specify decisions in the CSV upload file (#663) * Fix bug causing application to crash when trying to delete zero packages (#781) ->>>>>>> dev +* Add `Decision` column to Package Dependencies tab so that users (#774) + # riskassessment 3.0.0 diff --git a/tests/testthat.R b/tests/testthat.R index 47bd36624..f80ecbcb1 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -19,4 +19,4 @@ while (!chromote::has_default_chromote_object() && Sys.time() - tmpt < 1) { } test_check("riskassessment") -test_file("tests/testthat/test-downloadHandler.R") +# test_file("tests/testthat/test-downloadHandler.R") From 0d5c96d855e2ee8cff21f79ed9c5527ad8e05c2f Mon Sep 17 00:00:00 2001 From: Github Actions Date: Mon, 3 Jun 2024 15:15:42 +0000 Subject: [PATCH 05/11] Re-build manifest file --- manifest.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest.json b/manifest.json index 92c451f59..62cf0d630 100644 --- a/manifest.json +++ b/manifest.json @@ -940,7 +940,7 @@ "RoxygenNote": "7.3.0", "Author": "Sebastien Rochette [aut, cre] (),\n Vincent Guyader [aut] (),\n Arthur Bréant [aut] (),\n Murielle Delmotte [aut] (),\n ThinkR [cph]", "Maintainer": "Sebastien Rochette ", - "Built": "R 4.3.3; ; 2024-05-31 13:28:09 UTC; unix", + "Built": "R 4.3.3; ; 2024-05-31 13:18:53 UTC; unix", "RemoteType": "github", "RemoteUsername": "thinkr-open", "RemoteRepo": "checkhelper", @@ -1303,7 +1303,7 @@ "Imports": "callr,\ncranlike (>= 1.0.2),\ncurl,\ndesc (>= 1.1.0),\ndigest,\nparsedate,\nrappdirs,\nrematch2,\ntools,\nutils,\nwithr", "Suggests": "covr,\npingr,\ntestthat,\nzip", "Encoding": "UTF-8", - "Built": "R 4.3.3; ; 2024-05-31 13:28:18 UTC; unix", + "Built": "R 4.3.3; ; 2024-05-31 13:19:02 UTC; unix", "RemoteType": "github", "RemoteHost": "api.github.com", "RemoteUsername": "r-lib", @@ -4425,7 +4425,7 @@ "RoxygenNote": "7.2.3", "Author": "Gábor Csárdi [cre, aut, cph],\n Hadley Wickham [aut],\n RConsortium [cph],\n RStudio [cph, fnd]", "Maintainer": "Gábor Csárdi ", - "Built": "R 4.3.3; ; 2024-05-31 13:28:51 UTC; unix", + "Built": "R 4.3.3; ; 2024-05-31 13:19:35 UTC; unix", "RemoteType": "github", "RemoteUsername": "r-lib", "RemoteRepo": "revdepcheck", @@ -4543,7 +4543,7 @@ "Config/testthat/edition": "3", "Author": "R Validation Hub [aut],\n Doug Kelkhoff [aut],\n Marly Gotti [aut],\n Eli Miller [cre, aut],\n Kevin K [aut],\n Yilong Zhang [aut],\n Eric Milliman [aut],\n Juliane Manitz [aut],\n Mark Padgham [ctb],\n PSI special interest group Application and Implementation of\n Methodologies in Statistics [cph]", "Maintainer": "Eli Miller ", - "Built": "R 4.3.3; ; 2024-05-31 13:28:56 UTC; unix", + "Built": "R 4.3.3; ; 2024-05-31 13:19:40 UTC; unix", "RemoteType": "github", "RemoteUsername": "pharmaR", "RemoteRepo": "riskmetric", @@ -6403,7 +6403,7 @@ "checksum": "788fc881cc4446504a88888fa55e2cfa" }, "inst/report_downloads/reportHtml.Rmd": { - "checksum": "d4b530e1159f6bba99ba098e843e46ee" + "checksum": "dc9c51d3badaf67a4f13fe5a5bbb57f4" }, "inst/report_downloads/reportPdf.Rmd": { "checksum": "86b922fc17ccc912a82a6cb881281b0a" @@ -6463,13 +6463,13 @@ "checksum": "97d1232340e04c53088bc8f814133dcd" }, "NEWS.md": { - "checksum": "620d2738d3b34a24f584dd342c32d25e" + "checksum": "f9bc97131b3753ea173bff4248b97e1f" }, "R/app_config.R": { "checksum": "c2b61f270b86b6833f0ee39c44a1a440" }, "R/app_server.R": { - "checksum": "47f0234369555f91c1d7d44d962d8daa" + "checksum": "e2a53d90bd4289198e29bec4ff19eba7" }, "R/app_ui.R": { "checksum": "50d68f46171151cd36457a7154e5a7a3" @@ -6508,7 +6508,7 @@ "checksum": "e22e1f4c044bc9f11c46a5fcdba33063" }, "R/mod_downloadHandler.R": { - "checksum": "2e3e958ef24dbb49984d83daa998544d" + "checksum": "430a55358e979be5a4137660e3c8af32" }, "R/mod_introJS_utils_text.R": { "checksum": "d98620a891752cf54b0d0282ddaa4af6" @@ -6532,7 +6532,7 @@ "checksum": "a894eb9114e258feb99b76cdca557cd2" }, "R/mod_packageDependencies.R": { - "checksum": "06dcc773b509d093da214942b9f6513e" + "checksum": "dc0cfc84ccfc8c31b9984398e0bd19c5" }, "R/mod_pkg_explorer_utils.R": { "checksum": "b7792e08cc4a67296c9df0f452c0a72a" @@ -6541,7 +6541,7 @@ "checksum": "dbbfdfde47d106e0deaf20822c69bf94" }, "R/mod_reportPreview.R": { - "checksum": "40bb09d54e2fc715dfaf23ae6bb805f0" + "checksum": "56d62f285d64f5846cf266c79bac5b6a" }, "R/mod_reweightView.R": { "checksum": "d3988b7b6168f0560dc9525f1c6138ed" @@ -6571,7 +6571,7 @@ "checksum": "74cf2ee5e7283483a88f08d60e3728b0" }, "R/utils_get_db.R": { - "checksum": "680af236ded2012453e02affafa4c9d4" + "checksum": "270a240f5882ec130989f252fe18011f" }, "R/utils_insert_db.R": { "checksum": "ee28bd9e4f053e7ee936d7d8ef5fe887" @@ -6580,7 +6580,7 @@ "checksum": "b689ee96f0761480ac65ca22cbbb4980" }, "R/utils.R": { - "checksum": "a5fc3e385ec1b2bb3368a7b4c2085c6e" + "checksum": "af4419cca7e1a9e57bfea4da5f8fffdf" }, "README.md": { "checksum": "d7e84fce2c891619912b6cc552eecc94" From 597d9a2be4330a465f9fc50ec7aa0be016dcda9d Mon Sep 17 00:00:00 2001 From: "Aaron Clark (Arcus)" Date: Mon, 3 Jun 2024 12:11:56 -0400 Subject: [PATCH 06/11] update datatable_custom() to remove NAs from Decision col --- R/mod_packageDependencies.R | 2 +- R/utils.R | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/R/mod_packageDependencies.R b/R/mod_packageDependencies.R index 27b9d185f..c6cfd7903 100644 --- a/R/mod_packageDependencies.R +++ b/R/mod_packageDependencies.R @@ -141,7 +141,7 @@ packageDependenciesServer <- function(id, selected_pkg, user, credentials, paren purrr::map_df(pkginfo$name, ~get_versnScore(.x, session$userData$loaded2_db(), session$userData$repo_pkgs())) %>% right_join(pkginfo, by = "name") %>% - select(package, type, name, version, score, decision) %>% # need id? + select(package, type, name, version, score, decision) %>% arrange(name, type) %>% distinct() diff --git a/R/utils.R b/R/utils.R index 149449b4d..ca7ab8ada 100644 --- a/R/utils.R +++ b/R/utils.R @@ -588,7 +588,8 @@ datatable_custom <- function( formattable::as.datatable( formattable::formattable( - data, + data %>% + mutate(decision = if_else(is.na(decision) | toupper(decision) == "NA", "", decision)), list( score = formattable::formatter( "span", @@ -599,9 +600,10 @@ datatable_custom <- function( "order" = x, "background-color" = formattable::csscolor( setColorPalette(100)[round(as.numeric(x)*100)]))), - decision = formattable::formatter( - "span", - style = x ~ formattable::style(display = "block", + decision = + formattable::formatter( + "span", + style = x ~ formattable::style(display = "block", "border-radius" = "4px", "padding-right" = "4px", "color" = ifelse(x %in% decision_lst, #'black', @@ -611,6 +613,7 @@ datatable_custom <- function( ifelse(x %in% decision_lst, glue::glue("var(--{risk_lbl(x, type = 'attribute')}-color)"), "transparent"))) + ) ), selection = "none", From e781ee382ddf2e80584eb4ae2c6ead550641b9b7 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Mon, 3 Jun 2024 16:20:22 +0000 Subject: [PATCH 07/11] Re-build manifest file --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 62cf0d630..922e1eebc 100644 --- a/manifest.json +++ b/manifest.json @@ -6532,7 +6532,7 @@ "checksum": "a894eb9114e258feb99b76cdca557cd2" }, "R/mod_packageDependencies.R": { - "checksum": "dc0cfc84ccfc8c31b9984398e0bd19c5" + "checksum": "7f2be1861ff5a38054aa7f9e091e7beb" }, "R/mod_pkg_explorer_utils.R": { "checksum": "b7792e08cc4a67296c9df0f452c0a72a" @@ -6580,7 +6580,7 @@ "checksum": "b689ee96f0761480ac65ca22cbbb4980" }, "R/utils.R": { - "checksum": "af4419cca7e1a9e57bfea4da5f8fffdf" + "checksum": "f82f71505446fa2494502ce38b690bb9" }, "README.md": { "checksum": "d7e84fce2c891619912b6cc552eecc94" From 108d5aba0f1133e44cf7e0c6e73a31994dbdf238 Mon Sep 17 00:00:00 2001 From: "Aaron Clark (Arcus)" Date: Tue, 4 Jun 2024 15:46:41 -0400 Subject: [PATCH 08/11] update code so that DT page length selector only shows up on Package Dependencies Tab. AND remove 'NA's from decision column on pdf reports. --- R/mod_downloadHandler.R | 3 ++- R/mod_packageDependencies.R | 2 +- R/utils.R | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/R/mod_downloadHandler.R b/R/mod_downloadHandler.R index 07f88b5b8..faf37931f 100644 --- a/R/mod_downloadHandler.R +++ b/R/mod_downloadHandler.R @@ -283,11 +283,12 @@ mod_downloadHandler_server <- function(id, pkgs, user, metric_weights){ dep_table <- if (nrow(dep_metrics) == 0) { - dplyr::tibble(package = character(), type = character(), version = character(), score = character()) + dplyr::tibble(package = character(), type = character(), version = character(), score = character(), decision = character()) } else { purrr::map_df(dep_metrics$name, ~get_versnScore(.x, session$userData$loaded2_db(), session$userData$repo_pkgs())) %>% right_join(dep_metrics, by = "name") %>% select(package, type, version, score, decision) %>% + mutate(decision = if_else(is.na(decision) | toupper(decision) == "NA", "", decision)) %>% arrange(package, type) %>% distinct() } diff --git a/R/mod_packageDependencies.R b/R/mod_packageDependencies.R index c6cfd7903..9bb4b9129 100644 --- a/R/mod_packageDependencies.R +++ b/R/mod_packageDependencies.R @@ -234,7 +234,7 @@ packageDependenciesServer <- function(id, selected_pkg, user, credentials, paren column( width = 8, DT::renderDataTable(server = FALSE, { - datatable_custom(data_table()) + datatable_custom(data_table(), custom_dom = "lftpi") }) ) ), diff --git a/R/utils.R b/R/utils.R index ca7ab8ada..8824757c9 100644 --- a/R/utils.R +++ b/R/utils.R @@ -565,6 +565,7 @@ datatable_custom <- function( colnames = c("Package", "Type", "Name", "Version", "Score", "Decision", "Review Package"), hide_names = "name", pLength = list(c(15, -1), c("15", "All")), plChange = TRUE, + custom_dom = "t", decision_lst = if (!is.null(golem::get_golem_options("decision_categories"))) golem::get_golem_options("decision_categories") else c("Low Risk", "Medium Risk", "High Risk"), color_lst = get_colors(golem::get_golem_options("assessment_db_name")), ... @@ -582,14 +583,15 @@ datatable_custom <- function( Defaulting to original data frame names.") colnames <- names(data) } + if("decision" %in% colnames(data)) data <- data %>% mutate(decision = if_else(is.na(decision) | toupper(decision) == "NA", "", decision)) + # Hiding name from DT table. # The - 1 is because js uses 0 index instead of 1 like R target <- which(names(data) %in% hide_names) - 1 formattable::as.datatable( formattable::formattable( - data %>% - mutate(decision = if_else(is.na(decision) | toupper(decision) == "NA", "", decision)), + data, list( score = formattable::formatter( "span", @@ -620,7 +622,7 @@ datatable_custom <- function( colnames = colnames, rownames = FALSE, options = list( - # pageLength = pLength[1], + dom = custom_dom, lengthMenu = pLength, lengthChange = plChange, columnDefs = list(list(visible = FALSE, targets = target)), @@ -628,7 +630,7 @@ datatable_custom <- function( ), style = "default" ) %>% - DT::formatStyle(names(data), textAlign = "center") + DT::formatStyle(names(data), textAlign = "center") } #' Add buttons to data frame From 353c41b45019503540d4e6d780283138749d55c6 Mon Sep 17 00:00:00 2001 From: "Aaron Clark (Arcus)" Date: Tue, 4 Jun 2024 15:47:34 -0400 Subject: [PATCH 09/11] Increment version number to 3.0.0.9023 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index aaea50a21..fd83d1722 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: riskassessment Title: A web app designed to interface with the `riskmetric` package -Version: 3.0.0.9022 +Version: 3.0.0.9023 Authors@R: c( person("Aaron", "Clark", role = c("aut", "cre"), email = "clark.aaronchris@gmail.com"), person("Robert", "Krajcik", role = "aut", email = "robert.krajcik@biogen.com"), From e190a8da1a0973af049365ec51a3227b0a4e9f47 Mon Sep 17 00:00:00 2001 From: "Aaron Clark (Arcus)" Date: Tue, 4 Jun 2024 15:51:00 -0400 Subject: [PATCH 10/11] turn off full stack trace --- dev/run_dev.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/run_dev.R b/dev/run_dev.R index 92f199d23..3a02c3636 100644 --- a/dev/run_dev.R +++ b/dev/run_dev.R @@ -1,6 +1,6 @@ # Set options here options(golem.app.prod = FALSE) # TRUE = production mode, FALSE = development mode -options(shiny.fullstacktrace = TRUE) +options(shiny.fullstacktrace = FALSE) options(dplyr.summarise.inform = FALSE) # suppress summarise() has grouped output by..." # options(shiny.autoload.r=FALSE) From 9b62c85ec55f87f1eb97dc92a50304a45e787d7e Mon Sep 17 00:00:00 2001 From: Github Actions Date: Tue, 4 Jun 2024 20:49:23 +0000 Subject: [PATCH 11/11] Re-build manifest file --- manifest.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index cc3500f0b..cba394444 100644 --- a/manifest.json +++ b/manifest.json @@ -6220,7 +6220,7 @@ "checksum": "99c5575cb81828e20a7fe1d205551316" }, "DESCRIPTION": { - "checksum": "980fd095da6772e5345174c2270abc95" + "checksum": "c4ce70d1592eea23d969d53b917c4a5b" }, "inst/app/www/css/community_metrics.css": { "checksum": "f08eb25c2ee48ac22ed63b0d18994a04" @@ -6508,7 +6508,7 @@ "checksum": "e22e1f4c044bc9f11c46a5fcdba33063" }, "R/mod_downloadHandler.R": { - "checksum": "430a55358e979be5a4137660e3c8af32" + "checksum": "923e810fb1c8c7afe2d111cd42703579" }, "R/mod_introJS_utils_text.R": { "checksum": "d98620a891752cf54b0d0282ddaa4af6" @@ -6532,7 +6532,7 @@ "checksum": "a894eb9114e258feb99b76cdca557cd2" }, "R/mod_packageDependencies.R": { - "checksum": "7f2be1861ff5a38054aa7f9e091e7beb" + "checksum": "05b1fbde1ace35aa787552552744b057" }, "R/mod_pkg_explorer_utils.R": { "checksum": "b7792e08cc4a67296c9df0f452c0a72a" @@ -6580,7 +6580,7 @@ "checksum": "b689ee96f0761480ac65ca22cbbb4980" }, "R/utils.R": { - "checksum": "f82f71505446fa2494502ce38b690bb9" + "checksum": "dd8cda3fb9deb392b6f82798f26bd668" }, "README.md": { "checksum": "d7e84fce2c891619912b6cc552eecc94"