AzureSMR/R/addins.R

43 строки
1.2 KiB
R
Исходник Обычный вид История

2017-09-05 11:28:28 +03:00
#' This is a template to view a DT object
#'
#' @param x data.frame
2017-09-05 11:28:28 +03:00
#' @param title Text to display in pane title
2017-06-06 23:58:16 +03:00
#' @importFrom miniUI miniPage gadgetTitleBar miniContentPanel
#' @importFrom DT dataTableOutput renderDataTable
#' @importFrom shiny observeEvent paneViewer runGadget stopApp
2017-06-06 23:58:16 +03:00
dataTableViewer <- function(x, title = "") {
ui <- miniPage(
gadgetTitleBar(title),
miniContentPanel(
DT::dataTableOutput("dt", height = "100%")
)
)
server <- function(input, output, session) {
output$dt <- DT::renderDataTable(x)
observeEvent(input$done, stopApp())
}
viewer <- paneViewer()
runGadget(ui, server, viewer = viewer)
}
addinListAllResources <- function() {
settingsfile <- getOption("AzureSMR.config")
assert_that(file.exists(settingsfile))
az <- createAzureContext(configFile = settingsfile)
z <- azureListAllResources(az)
z$id <- NULL
dataTableViewer(z, title = "All resources")
}
addinGetAllVMstatus <- function() {
settingsfile <- getOption("AzureSMR.config")
assert_that(file.exists(settingsfile))
az <- createAzureContext(configFile = settingsfile)
z <- azureGetAllVMstatus(az)
z$id <- NULL
dataTableViewer(z, title = "All virtual machines")
}