From da06501da7094117e1aa3f87837b2ab444aacbc2 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Fri, 10 May 2024 11:12:25 +0200 Subject: [PATCH 1/4] chore: Remove redundant dependencies. --- dependencies.R | 1 - renv.lock | 124 ++----------------------------------------------- 2 files changed, 4 insertions(+), 121 deletions(-) diff --git a/dependencies.R b/dependencies.R index 2ff2609..289f81d 100644 --- a/dependencies.R +++ b/dependencies.R @@ -6,4 +6,3 @@ library(reactable) library(rhino) library(rsconnect) library(shinycssloaders) -library(usethis) diff --git a/renv.lock b/renv.lock index d1c946e..2c0c389 100644 --- a/renv.lock +++ b/renv.lock @@ -187,16 +187,6 @@ ], "Hash": "89e6d8219950eac806ae0c489052048a" }, - "clipr": { - "Package": "clipr", - "Version": "0.8.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "utils" - ], - "Hash": "3f038e5ac7f41d4ac41ce658c85e3042" - }, "codetools": { "Package": "codetools", "Version": "0.2-19", @@ -236,20 +226,6 @@ ], "Hash": "e8a1e41acf02548751f45c718d55aa6a" }, - "credentials": { - "Package": "credentials", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "askpass", - "curl", - "jsonlite", - "openssl", - "sys" - ], - "Hash": "c7844b32098dcbd1c59cbd8dddb4ecc6" - }, "curl": { "Package": "curl", "Version": "5.2.0", @@ -412,47 +388,6 @@ ], "Hash": "15e9634c0fcd294799e9b2e929ed1b86" }, - "gert": { - "Package": "gert", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "askpass", - "credentials", - "openssl", - "rstudioapi", - "sys", - "zip" - ], - "Hash": "f70d3fe2d9e7654213a946963d1591eb" - }, - "gh": { - "Package": "gh", - "Version": "1.4.0", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "cli", - "gitcreds", - "httr2", - "ini", - "jsonlite", - "rlang" - ], - "Hash": "03533b1c875028233598f848fda44c4c" - }, - "gitcreds": { - "Package": "gitcreds", - "Version": "0.1.2", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R" - ], - "Hash": "ab08ac61f3e1be454ae21911eb8bc2fe" - }, "glue": { "Package": "glue", "Version": "1.6.2", @@ -543,13 +478,6 @@ ], "Hash": "e2b30f1fc039a0bab047dd52bb20ef71" }, - "ini": { - "Package": "ini", - "Version": "0.3.1", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "6154ec2223172bce8162d4153cda21f7" - }, "jquerylib": { "Package": "jquerylib", "Version": "0.1.4", @@ -923,9 +851,9 @@ }, "rhino": { "Package": "rhino", - "Version": "1.6.0", + "Version": "1.7.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "box", @@ -944,9 +872,10 @@ "testthat", "utils", "withr", + "xml2", "yaml" ], - "Hash": "ff605bc0e89a93b4ccf76f565bc1cdfc" + "Hash": "59ee79b26dd590b08dd1a3111d093832" }, "rlang": { "Package": "rlang", @@ -1225,37 +1154,6 @@ ], "Hash": "5ac22900ae0f386e54f1c307eca7d843" }, - "usethis": { - "Package": "usethis", - "Version": "2.2.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "clipr", - "crayon", - "curl", - "desc", - "fs", - "gert", - "gh", - "glue", - "jsonlite", - "lifecycle", - "purrr", - "rappdirs", - "rlang", - "rprojroot", - "rstudioapi", - "stats", - "utils", - "whisker", - "withr", - "yaml" - ], - "Hash": "60e51f0b94d0324dc19e44110098fa9f" - }, "utf8": { "Package": "utf8", "Version": "1.2.4", @@ -1298,13 +1196,6 @@ ], "Hash": "c7d3fd6d29ab077cbac8f0e2751449e6" }, - "whisker": { - "Package": "whisker", - "Version": "0.4.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "c6abfa47a46d281a7d5159d0a8891e88" - }, "withr": { "Package": "withr", "Version": "2.5.2", @@ -1368,13 +1259,6 @@ "Source": "Repository", "Repository": "CRAN", "Hash": "0d0056cc5383fbc240ccd0cb584bf436" - }, - "zip": { - "Package": "zip", - "Version": "2.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "fcc4bd8e6da2d2011eb64a5e5cc685ab" } } } From f8f2e679833e516b07be43c812c87d34d968e594 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Fri, 10 May 2024 11:12:36 +0200 Subject: [PATCH 2/4] chore: Update gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7b732e7..039024e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .RData .Ruserdata .DS_Store +.Renviron From 89ade8301679ebbd300b33235d77817c950c8a94 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Fri, 10 May 2024 11:13:06 +0200 Subject: [PATCH 3/4] style: Fix box::use statements style. --- app/logic/api_utils.R | 12 ++++++------ app/logic/app_table_utils.R | 7 +++---- app/logic/job_list_utils.R | 6 +----- app/logic/logs_utils.R | 8 ++++---- app/main.R | 34 +++++++++++++++++---------------- app/view/mod_app_table.R | 28 +++++++++++++-------------- app/view/mod_header.R | 12 +++++------- app/view/mod_job_list.R | 29 ++++++++++++++-------------- app/view/mod_logs.R | 38 +++++++++++++++++++------------------ tests/testthat/test-main.R | 7 ------- 10 files changed, 84 insertions(+), 97 deletions(-) diff --git a/app/logic/api_utils.R b/app/logic/api_utils.R index 37a8f9a..2a3cec5 100644 --- a/app/logic/api_utils.R +++ b/app/logic/api_utils.R @@ -1,16 +1,16 @@ box::use( + dplyr[filter], + glue[glue], httr2[ - request, req_auth_bearer_token, req_dry_run, req_perform, - resp_body_string, - req_user_agent + req_user_agent, + request, + resp_body_string ], - magrittr[`%>%`], jsonlite[fromJSON], - dplyr[filter], - glue[glue] + magrittr[`%>%`], ) #' Simple function to get the access token from environment diff --git a/app/logic/app_table_utils.R b/app/logic/app_table_utils.R index f1cd081..125dd99 100644 --- a/app/logic/app_table_utils.R +++ b/app/logic/app_table_utils.R @@ -1,16 +1,15 @@ box::use( shiny[ + a, div, - span, icon, - a, + span, strong ], - glue[glue] ) box::use( - app/logic/general_utils[format_timestamp] + app/logic/general_utils[format_timestamp], ) #' Function to process each row for the app table diff --git a/app/logic/job_list_utils.R b/app/logic/job_list_utils.R index 2292604..02bceb0 100644 --- a/app/logic/job_list_utils.R +++ b/app/logic/job_list_utils.R @@ -1,16 +1,12 @@ box::use( shiny[ div, - span, - icon, - a, strong ], - glue[glue] ) box::use( - app/logic/general_utils[format_timestamp] + app/logic/general_utils[format_timestamp], ) diff --git a/app/logic/logs_utils.R b/app/logic/logs_utils.R index 7166a90..ebbec6e 100644 --- a/app/logic/logs_utils.R +++ b/app/logic/logs_utils.R @@ -1,13 +1,13 @@ box::use( glue[glue], shiny[ - icon, - div - ] + div, + icon + ], ) box::use( - app/logic/general_utils[check_text_error, format_timestamp] + app/logic/general_utils[check_text_error, format_timestamp], ) #' Function to process each row for the log table diff --git a/app/main.R b/app/main.R index ba01871..d221881 100644 --- a/app/main.R +++ b/app/main.R @@ -1,32 +1,34 @@ +# nolint start: box_func_import_count_linter box::use( + dplyr[select], + magrittr[`%>%`], shiny[ - NS, - moduleServer, div, + fluidPage, + img, + isTruthy, + moduleServer, + NS, + observeEvent, + p, reactive, reactiveValues, - observeEvent, - isTruthy, - tags, - tagList, - renderUI, - uiOutput, - img, removeUI, - p, - fluidPage + renderUI, + tagList, + tags, + uiOutput ], - magrittr[`%>%`], - dplyr[select], - shinycssloaders[withSpinner] + shinycssloaders[withSpinner], ) +# nolint end box::use( + app/logic/api_utils[get_app_list], app/view/mod_app_table, + app/view/mod_header, app/view/mod_job_list, app/view/mod_logs, - app/view/mod_header, - app/logic/api_utils[get_app_list] ) #' @export diff --git a/app/view/mod_app_table.R b/app/view/mod_app_table.R index 3f08bb8..02d4556 100644 --- a/app/view/mod_app_table.R +++ b/app/view/mod_app_table.R @@ -1,28 +1,26 @@ box::use( - shiny[ - NS, - div, - moduleServer, - reactive + dplyr[ + mutate, + select ], + magrittr[`%>%`], reactable[ + colDef, + getReactableState, reactable, - renderReactable, reactableOutput, - getReactableState, - colDef + renderReactable ], - dplyr[ - select, - mutate + shiny[ + moduleServer, + NS, + reactive ], - magrittr[`%>%`], - glue[glue], - shinycssloaders[withSpinner] + shinycssloaders[withSpinner], ) box::use( - app/logic/app_table_utils[process_app_data] + app/logic/app_table_utils[process_app_data], ) #' @export diff --git a/app/view/mod_header.R b/app/view/mod_header.R index 999f176..e94e1d0 100644 --- a/app/view/mod_header.R +++ b/app/view/mod_header.R @@ -1,14 +1,12 @@ box::use( shiny[ - NS, - moduleServer, + actionLink, div, - img, h2, - icon, - actionButton, - actionLink - ] + img, + moduleServer, + NS + ], ) #' @export diff --git a/app/view/mod_job_list.R b/app/view/mod_job_list.R index ff6700b..96aac6e 100644 --- a/app/view/mod_job_list.R +++ b/app/view/mod_job_list.R @@ -1,29 +1,28 @@ box::use( - shiny[ - moduleServer, - NS, - div, - reactive, - req + dplyr[ + mutate, + select ], + magrittr[`%>%`], reactable[ + colDef, + getReactableState, reactable, - renderReactable, reactableOutput, - getReactableState, - colDef + renderReactable ], - dplyr[ - select, - mutate + shiny[ + moduleServer, + NS, + reactive, + req ], - magrittr[`%>%`], - shinycssloaders[withSpinner] + shinycssloaders[withSpinner], ) box::use( app/logic/api_utils[get_job_list], - app/logic/job_list_utils[process_job_data] + app/logic/job_list_utils[process_job_data], ) #' @export diff --git a/app/view/mod_logs.R b/app/view/mod_logs.R index 2803368..cde7551 100644 --- a/app/view/mod_logs.R +++ b/app/view/mod_logs.R @@ -1,32 +1,34 @@ +# nolint start: box_func_import_count_linter box::use( + dplyr[mutate], + glue[glue], + magrittr[`%>%`], + reactable[ + colDef, + reactable, + reactableOutput, + renderReactable + ], + shinycssloaders[withSpinner], shiny[ - moduleServer, - NS, div, - reactive, - req, downloadButton, downloadHandler, icon, + moduleServer, + NS, + observeEvent, + reactive, renderUI, - uiOutput, - observeEvent - ], - reactable[ - reactable, - renderReactable, - reactableOutput, - colDef + req, + uiOutput ], - dplyr[mutate], - magrittr[`%>%`], - glue[glue], - shinycssloaders[withSpinner] ) +# nolint end box::use( - app/logic/api_utils[get_job_logs, download_job_logs], - app/logic/logs_utils[process_log_data] + app/logic/api_utils[download_job_logs, get_job_logs], + app/logic/logs_utils[process_log_data], ) #' @export diff --git a/tests/testthat/test-main.R b/tests/testthat/test-main.R index 36714eb..e69de29 100644 --- a/tests/testthat/test-main.R +++ b/tests/testthat/test-main.R @@ -1,7 +0,0 @@ -box::use( - shiny[testServer], - testthat[...], -) -box::use( - app/main[...], -) From f65f8ad962da3fa64d27c348b0e7e7386c5e4a3c Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Fri, 10 May 2024 11:31:30 +0200 Subject: [PATCH 4/4] docs: Fix api_utils documentation. --- app/logic/api_utils.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/logic/api_utils.R b/app/logic/api_utils.R index 2a3cec5..ea09ead 100644 --- a/app/logic/api_utils.R +++ b/app/logic/api_utils.R @@ -30,7 +30,7 @@ get_access_token <- function() { #' Simple function to make an API url #' @param host Character. Default CONNECT_SERVER set as an envvar #' @param endpoint Character. Default is "content" -#' @param versioned Logical. Whether to use versioned API. Default is FALSE +#' @param version Logical. Whether to use versioned API. Default is "v1" #' @return url for the API get_api_url <- function( host = Sys.getenv("CONNECT_SERVER"), @@ -44,7 +44,7 @@ get_api_url <- function( #' #' @param app_mode_filter Character. The filter for app_mode in the API #' response. Default is "shiny". -#' @param url Character. The URL for API endpoint +#' @param endpoint Character. Default is "content" #' @param dry_run Logical. Whether to dry run the API for debugging. #' Default is FALSE #' @export @@ -77,7 +77,7 @@ get_app_list <- function( #' Function to get a list of all jobs for a specific app #' #' @param guid Character. The guid for the app in question -#' @param url Character. The URL for API endpoint +#' @param endpoint Character. Default is "content" #' @param dry_run Logical. Whether to dry run the API for debugging. #' Default is FALSE #' @export @@ -112,7 +112,7 @@ get_job_list <- function( #' #' @param guid Character. The guid for the app in question #' @param job_key Character. The key for the job in question -#' @param url Character. The URL for API endpoint +#' @param endpoint Character. Default is "content" #' @param tail Logical. Whether to show the tail only for the logs #' @param dry_run Logical. Whether to dry run the API for debugging. #' Default is FALSE @@ -152,7 +152,7 @@ get_job_logs <- function( #' #' @param guid Character. The guid for the app in question #' @param job_key Character. The key for the job in quesrtion -#' @param url Character. The URL for API endpoint +#' @param endpoint Character. Default is "content" #' @param dry_run Logical. Whether to dry run the API for debugging. #' Default is FALSE #' @export