diff --git a/DESCRIPTION b/DESCRIPTION index 48cf86b..84546a7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rapadm Title: Monitor Settings and Applications at Rapporteket -Version: 0.4.0 +Version: 0.5.0 Authors@R: person(given = "Are", family = "Edvardsen", diff --git a/NEWS.md b/NEWS.md index 033f49b..e43d1ab 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# rapadm 0.5.0 + +* Added tool for listing and global removal of staging data + # rapadm 0.4.0 * Updated R version from 4.2.1 to 4.2.2 diff --git a/R/app_server.R b/R/app_server.R index 566caf7..e1a107c 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -133,16 +133,16 @@ app_server <- function(input, output, session) { far <- shiny::reactive({ shiny::req(input$fpackage, input$ftype, input$fowner, input$forganization) far <- ar - if (input$fpackage != "none") { + if (input$fpackage != "no filter") { far <- rapbase::filterAutoRep(far, "package", input$fpackage) } - if (input$ftype != "none") { + if (input$ftype != "no filter") { far <- rapbase::filterAutoRep(far, "type", input$ftype) } - if (input$fowner != "none") { + if (input$fowner != "no filter") { far <- rapbase::filterAutoRep(far, "owner", input$fowner) } - if (input$forganization != "none") { + if (input$forganization != "no filter") { far <- rapbase::filterAutoRep(far, "organization", input$forganization) } far @@ -152,28 +152,28 @@ app_server <- function(input, output, session) { shiny::selectInput( "fpackage", "- registry:", - choices = c("none", unique_autoreport(ar, "package")) + choices = c("no filter", unique_autoreport(ar, "package")) ) }) output$ftype <- shiny::renderUI({ shiny::selectInput( "ftype", "- type:", - choices = c("none", unique_autoreport(ar, "type")) + choices = c("no filter", unique_autoreport(ar, "type")) ) }) output$fowner <- shiny::renderUI({ shiny::selectInput( "fowner", "- owner:", - choices = c("none", unique_autoreport(ar, "owner")) + choices = c("no filter", unique_autoreport(ar, "owner")) ) }) output$forganization <- shiny::renderUI({ shiny::selectInput( "forganization", "- organization:", - choices = c("none", unique_autoreport(ar, "organization")) + choices = c("no filter", unique_autoreport(ar, "organization")) ) }) @@ -181,13 +181,31 @@ app_server <- function(input, output, session) { plot(calendar_autoreport(far())) }) - # filters_package <- c("none", unique_autoreport(ar, "package")) - # filters_type <- c("none", unique_autoreport(ar, "type")) - # filters_owner <- c("none", unique_autoreport(ar, "owner")) - # filters_organization <- c("none", unique_autoreport(ar, "organization")) - output$autoreport_data <- shiny::renderText({ yaml::as.yaml(far()) }) + # Staging + shiny::observeEvent(input$do_remove, { + rapbase::cleanStagingData(0, dryRun = FALSE) + }) + output$remove_staging <- shiny::renderUI({ + if (input$delete_staging) { + shiny::actionButton( + "do_remove", "Delete staging data", icon = shiny::icon("trash") + ) + } else { + NULL + } + }) + output$staging_data <- shiny::renderPrint({ + input$do_remove + res <- rapbase::cleanStagingData(0) + if (length(res) < 1) { + "There is no staging data." + } else { + res + } + }) + } diff --git a/R/app_ui.R b/R/app_ui.R index 1cde1de..8818527 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -104,8 +104,21 @@ app_ui <- function() { shiny::verbatimTextOutput("autoreport_data") ) ) - ) + ), + shiny::tabPanel( + "Staging", + shiny::sidebarLayout( + shiny::sidebarPanel( + shiny::p("Delete all staging data"), + shiny::checkboxInput("delete_staging", "I'm sure!"), + shiny::uiOutput("remove_staging") + ), + shiny::mainPanel( + shiny::verbatimTextOutput("staging_data") + ) + ) + ) ) ) }