R/fct_datasets_argon_table.R

Defines functions datasets_argon_table

Documented in datasets_argon_table

#' datasets_argon_table
#'
#' @param ns namespace
#'
#' @description Creates an argon table to show datasets available in the app
#'
#' @return shiny.tag
#' @export
datasets_argon_table = function(ns){

  data_cache = readr::read_tsv("cache/datasets.txt", col_types = "cccc", lazy = F)

  argonDash::argonTable(

    headTitles = c(
      "TYPE",
      "NAME",
      "SIZE",
      "LOCATION",
      "",
      ""
    ),

    lapply(1:nrow(data_cache), function(i) {

      argonDash::argonTableItems(

        # Dataset type
        argonDash::argonTableItem(

          argonR::argonBadge(data_cache[i, "Type"])


        ),
        # Dataset Name
        argonDash::argonTableItem(

          data_cache[i, "Name"]

        ),
        # Dataset Size
        argonDash::argonTableItem(

          data_cache[i, "Size"]

        ),
        # Dataset Path
        argonDash::argonTableItem(

          data_cache[i, "Location"]

        ),
        argonDash::argonTableItem(
          actionButton(ns(paste0("view", i)), "View", style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
        ),
        argonDash::argonTableItem(
          actionButton(ns(paste0("delete", i)), "Delete", style="color: #fff; background-color: #F32013; border-color: #CA0B00")
        )
      )

    })

  )

}
adamwaring/dataviewer documentation built on Dec. 18, 2021, 10:25 p.m.