Helper Library for Keboola Shiny Applications
session
Shiny session object
loggedIn
1 if the user is logged in, 0 if not
errMsg
Error encountered when logging in
loginErrrorOutput
HTML element with login error
bucketId
ID of the current bucket
token
Current KBC token
client
Instance of Storage API client
db
Instance of Backend Driver (Redshift or Snowflake)
kfig
Instance of Application Config
kdata
Instance of Application Data
loading
Flow control flag set to 1/true while initializing
concludeStartup(options)
Resume the startup tasks after data loading
options
initial startup options
void
dbConnect()
Establish a connection via provisioning client credentials.
TRUE
getAppConfig()
Get the appConfigId from the query string. Apps created via the kbc ui will have config starting kbc_ Apps created via LG will start with lg_
String storage Bucket ID.
getBucketBackendType()
Return the backend type of the bucket.
bucket backend type
getBuckets()
Return a list of accessible buckets.
Character vector of bucketIDs
getLogin()
Verify login information and initialize application.
List with items: token, runId, bucket, loggedIn, errMsg, client, ready
getToken()
Get the token from the session headers or input element.
String KBC token
initLibs()
connect to DB and initialise the keboolaAppData and keboolaAppConfig libraries
void
initialize(session = getDefaultReactiveDomain())
Constructor.
session
Shiny session object.
loadTable(prettyName, name)
Load table from Storage.
(Exposed wrapper for KeboolaAppData
method).
prettyName
Table name to be used in labels throughout the app.
name
Name of table in SAPI.
data.frame with table data
loadTables(tables, options)
load tables specified in the parameter list tables from storage
tables
list of tables to load
options
startup method options
TRUE if tables succesfully loaded. FALSE if data was too big and reduction is required.
ready()
The DOM element id = kb_loggedIn is set to 1 when login is successful meaning that data loading can start
TRUE or FALSE
sourceData()
This is a hack used to catch the case when the data-too-large detour has been completed and to resume the startup operations in that case
list of data.frames containing sourceData
startup(options = list(appTitle = "", tables = list(), cleanData = FALSE,
dataToSave = NULL, configCallback = NULL, description = FALSE, customElements
= NULL))
This is the main KBC app entry point for all initialisation housekeeping such as authentication and data retrieval
options
List with items:
appTitle - the title of the application
tables - list of tables to load from sapi list(localname = sapiname)
dataToSave - the reactive in server.R that holds the input filtered data, or any data that would want to be saved to sapi
configCallback - the method which is to be invoked when a configuration is loaded. This method will generally update inputs according to the selectedConfig values
description - whether or not to include a description object
customElements - the method for processing custom elements of the description
list containing loginInfo
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.