Skip to content

Commit

Permalink
pgx_public_dir does not need to be reactive as it should not change l…
Browse files Browse the repository at this point in the history
…ike pgx_dir does for different users
  • Loading branch information
ivokwee committed Mar 11, 2023
1 parent 1723f0f commit 5f6aa2b
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions components/board.loading/R/loading_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ LoadingBoard <- function(id,
pgxTable_edited_row = NULL,

pgxTablePublic_data = NULL,
pgx_public_dir = NULL,
selected_row_public = NULL,
reload_pgxdir_public = 0
)

## static, not changing
pgx_public_dir = stringr::str_replace_all(pgx_dir, c('data'='data_public'))

observeEvent(pgxtable$rows_selected(), {
rl$selected_row <- pgxtable$rows_selected()
})
Expand All @@ -48,7 +50,6 @@ LoadingBoard <- function(id,
observeEvent(
input$importbutton, {
selected_row <- rl$selected_row_public
pgx_public_dir <- rl$pgx_public_dir
pgx_name <- rl$pgxTablePublic_data[selected_row, 'dataset']

pgx_file <- file.path(pgx_public_dir, paste0(pgx_name, '.pgx'))
Expand Down Expand Up @@ -174,12 +175,6 @@ LoadingBoard <- function(id,
pdir
})

observeEvent(c(getPGXDIR(), rl$reload_pgxdir_public), {
##pgx_dir <- getPGXDIR()
pgx_public_dir <- stringr::str_replace_all(pgx_dir, c('data'='data_public'))
rl$pgx_public_dir <- pgx_public_dir
}, ignoreNULL = TRUE)

getPGXINFO <- shiny::reactive({
req(auth)
if (!auth$logged()) {
Expand Down Expand Up @@ -208,7 +203,7 @@ LoadingBoard <- function(id,
return(NULL)
}
info <- NULL
pdir <- rl$pgx_public_dir
pdir <- pgx_public_dir
info <- pgx.scanInfoFile(pdir, file = "datasets-info.csv", verbose = TRUE)
if (is.null(info)) {
aa <- rep(NA, 9)
Expand Down Expand Up @@ -274,8 +269,7 @@ LoadingBoard <- function(id,
return(NULL)
}

pgxdir <- rl$pgx_public_dir
pgxfiles <- dir(pgxdir, pattern = ".pgx$")
pgxfiles <- dir(pgx_public_dir, pattern = ".pgx$")
sel <- sub("[.]pgx$", "", df$dataset) %in% sub("[.]pgx$", "", pgxfiles)
df <- df[sel, , drop = FALSE]

Expand Down

0 comments on commit 5f6aa2b

Please sign in to comment.