Create RStudio addins #72
This commit is contained in:
Родитель
100d35e546
Коммит
2489cbe93a
|
@ -23,7 +23,11 @@ Imports:
|
|||
jsonlite,
|
||||
XML,
|
||||
base64enc,
|
||||
digest
|
||||
digest,
|
||||
shiny (>= 0.13),
|
||||
miniUI (>= 0.1.1),
|
||||
rstudioapi (>= 0.5),
|
||||
DT
|
||||
Depends:
|
||||
R(>= 3.0.0)
|
||||
Suggests:
|
||||
|
|
|
@ -24,6 +24,7 @@ export(azureDeleteVM)
|
|||
export(azureDeletestorageAccount)
|
||||
export(azureDeployStatus)
|
||||
export(azureDeployTemplate)
|
||||
export(azureGetAllVMstatus)
|
||||
export(azureGetBlob)
|
||||
export(azureHDIConf)
|
||||
export(azureHiveSQL)
|
||||
|
@ -59,6 +60,8 @@ export(dumpAzureContext)
|
|||
export(is.azureActiveContext)
|
||||
export(read.AzureSMR.config)
|
||||
export(setAzureContext)
|
||||
importFrom(DT,dataTableOutput)
|
||||
importFrom(DT,renderDataTable)
|
||||
importFrom(XML,htmlParse)
|
||||
importFrom(XML,xmlValue)
|
||||
importFrom(XML,xpathApply)
|
||||
|
@ -79,6 +82,12 @@ importFrom(httr,headers)
|
|||
importFrom(httr,http_status)
|
||||
importFrom(httr,status_code)
|
||||
importFrom(jsonlite,fromJSON)
|
||||
importFrom(miniUI,gadgetTitleBar)
|
||||
importFrom(miniUI,miniContentPanel)
|
||||
importFrom(miniUI,miniPage)
|
||||
importFrom(shiny,observeEvent)
|
||||
importFrom(shiny,paneViewer)
|
||||
importFrom(shiny,runGadget)
|
||||
importFrom(utils,URLencode)
|
||||
importFrom(utils,browseURL)
|
||||
importFrom(utils,ls.str)
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
# this is a template to view a DT object
|
||||
# @param data.frame
|
||||
# @param title Text to display in pane title
|
||||
|
||||
#' @importFrom miniUI miniPage gadgetTitleBar miniContentPanel
|
||||
#' @importFrom DT dataTableOutput renderDataTable
|
||||
#' @importFrom shiny observeEvent paneViewer runGadget
|
||||
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")
|
||||
}
|
5
R/zzz.R
5
R/zzz.R
|
@ -1,5 +1,6 @@
|
|||
AzureSMR.config.default <- "~/.azureml/settings.json"
|
||||
AzureSMR.config.default <- "~/.azuresmr/config.json"
|
||||
|
||||
.onAttach <- function(libname, pkgname){
|
||||
.onAttach <- function(libname, pkgname) {
|
||||
if (is.null(getOption("AzureSMR.config")))
|
||||
options(AzureSMR.config = AzureSMR.config.default)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
Name: Azure resources
|
||||
Description: List all Azure resources.
|
||||
Binding: addinListAllResources
|
||||
Interactive: true
|
||||
|
||||
Name: Azure VM status
|
||||
Description: List the status of all virtual machines.
|
||||
Binding: addinGetAllVMstatus
|
||||
Interactive: true
|
|
@ -24,7 +24,8 @@ azureDeleteVM(azureActiveContext, resourceGroup, vmName, subscriptionID,
|
|||
Delete a Virtual Machine.
|
||||
}
|
||||
\seealso{
|
||||
Other Virtual machine functions: \code{\link{azureListScaleSetNetwork}},
|
||||
Other Virtual machine functions: \code{\link{azureGetAllVMstatus}},
|
||||
\code{\link{azureListScaleSetNetwork}},
|
||||
\code{\link{azureListScaleSetVM}},
|
||||
\code{\link{azureListScaleSets}},
|
||||
\code{\link{azureListVM}}, \code{\link{azureStartVM}},
|
||||
|
|
|
@ -26,6 +26,7 @@ https://docs.microsoft.com/en-us/rest/api/network/loadbalancer/list-load-balance
|
|||
}
|
||||
\seealso{
|
||||
Other Virtual machine functions: \code{\link{azureDeleteVM}},
|
||||
\code{\link{azureGetAllVMstatus}},
|
||||
\code{\link{azureListScaleSetVM}},
|
||||
\code{\link{azureListScaleSets}},
|
||||
\code{\link{azureListVM}}, \code{\link{azureStartVM}},
|
||||
|
|
|
@ -25,6 +25,7 @@ List VMs within a scale set
|
|||
}
|
||||
\seealso{
|
||||
Other Virtual machine functions: \code{\link{azureDeleteVM}},
|
||||
\code{\link{azureGetAllVMstatus}},
|
||||
\code{\link{azureListScaleSetNetwork}},
|
||||
\code{\link{azureListScaleSets}},
|
||||
\code{\link{azureListVM}}, \code{\link{azureStartVM}},
|
||||
|
|
|
@ -23,6 +23,7 @@ List scale sets within a resource group.
|
|||
}
|
||||
\seealso{
|
||||
Other Virtual machine functions: \code{\link{azureDeleteVM}},
|
||||
\code{\link{azureGetAllVMstatus}},
|
||||
\code{\link{azureListScaleSetNetwork}},
|
||||
\code{\link{azureListScaleSetVM}},
|
||||
\code{\link{azureListVM}}, \code{\link{azureStartVM}},
|
||||
|
|
|
@ -23,6 +23,7 @@ List VMs in a Subscription.
|
|||
}
|
||||
\seealso{
|
||||
Other Virtual machine functions: \code{\link{azureDeleteVM}},
|
||||
\code{\link{azureGetAllVMstatus}},
|
||||
\code{\link{azureListScaleSetNetwork}},
|
||||
\code{\link{azureListScaleSetVM}},
|
||||
\code{\link{azureListScaleSets}},
|
||||
|
|
|
@ -25,6 +25,7 @@ Start a Virtual Machine.
|
|||
}
|
||||
\seealso{
|
||||
Other Virtual machine functions: \code{\link{azureDeleteVM}},
|
||||
\code{\link{azureGetAllVMstatus}},
|
||||
\code{\link{azureListScaleSetNetwork}},
|
||||
\code{\link{azureListScaleSetVM}},
|
||||
\code{\link{azureListScaleSets}},
|
||||
|
|
|
@ -25,6 +25,7 @@ Stop a Virtual Machine.
|
|||
}
|
||||
\seealso{
|
||||
Other Virtual machine functions: \code{\link{azureDeleteVM}},
|
||||
\code{\link{azureGetAllVMstatus}},
|
||||
\code{\link{azureListScaleSetNetwork}},
|
||||
\code{\link{azureListScaleSetVM}},
|
||||
\code{\link{azureListScaleSets}},
|
||||
|
|
|
@ -25,6 +25,7 @@ Get Status of a Virtual Machine.
|
|||
}
|
||||
\seealso{
|
||||
Other Virtual machine functions: \code{\link{azureDeleteVM}},
|
||||
\code{\link{azureGetAllVMstatus}},
|
||||
\code{\link{azureListScaleSetNetwork}},
|
||||
\code{\link{azureListScaleSetVM}},
|
||||
\code{\link{azureListScaleSets}},
|
||||
|
|
Загрузка…
Ссылка в новой задаче