Skip to content

Commit

Permalink
change code to remove uninformative info
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaliniPandurangan committed Aug 28, 2023
1 parent 6f698cf commit da0216d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
21 changes: 6 additions & 15 deletions components/ui/ui-PlotModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ PlotModuleUI <- function(id,
shiny::tags$head(shiny::tags$style(modaldialog.style)),
shiny::tags$head(shiny::tags$style(modalbody.style)),
shiny::tags$head(shiny::tags$style(modalcontent.style)),
shiny::tags$head(shiny::tags$style(modalfooter.none))
shiny::tags$head(shiny::tags$style(modalfooter.none)),
shiny::tags$script(src = "dropdown-helper.js")
)
),
bslib::card_body(
Expand Down Expand Up @@ -401,21 +402,11 @@ PlotModuleServer <- function(id,
ns <- session$ns

filename <- ns("title")
filename <- vapply(strsplit(filename, "-"), function(x)
paste(x[seq.int(2)], collapse = "-"), #remove uninformative information.
character(1L))
stopwords = c('-title', '-pltmod-title', '-plot-title', '-pltsrv-title', '-plotmodule-title')
x <- unlist(strsplit(filename, "-"))
x <- x[!x %in% stopwords]
filename <- paste(x, collapse = "-")

filename_split <- strsplit(filename, "-")[[1]]

new_filename <- paste0(filename_split[-c(length(filename_split)-1, length(filename_split))], collapse = "-")

# Check if new filename is empty
if (new_filename == "") {
filename <- filename
} else {
filename <- new_filename
}

# replace empty spaces of title with underscore
filename <- gsub(" ", "_", filename)
# all caps down
Expand Down
5 changes: 5 additions & 0 deletions components/ui/ui-TableModule2.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ TableModuleServer <- function(id,
function(input, output, session) {
ns <- session$ns
filename <- ns("title")
# stopwords = ['-title', '-pltmod-title', '-plot-title', '-pltsrv-title', '-plotmodule-title']
# x <- unlist(strsplit(filename, "-"))
# x <- x[!x %in% stopwords]
# filename <- paste(x, collapse = "-")
# print(filename)
filename <- vapply(strsplit(filename, "-"), function(x) #remove uninformative information.
paste(x[seq.int(2)], collapse = "-"), character(1L))
filename <- paste0(filename, ".csv")
Expand Down

0 comments on commit da0216d

Please sign in to comment.