KeboolaShiny-class: Helper Library for Keboola Shiny Applications

Description Fields Methods

Description

Helper Library for Keboola Shiny Applications

Fields

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

Methods

concludeStartup(options)

Resume the startup tasks after data loading

Parameters

  • options initial startup options

Return Value

void

dbConnect()

Establish a connection via provisioning client credentials.

Return Value

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_

Return Value

String storage Bucket ID.

getBucketBackendType()

Return the backend type of the bucket.

Return Value

bucket backend type

getBuckets()

Return a list of accessible buckets.

Return Value

Character vector of bucketIDs

getLogin()

Verify login information and initialize application.

Return Value

List with items: token, runId, bucket, loggedIn, errMsg, client, ready

getToken()

Get the token from the session headers or input element.

Return Value

String KBC token

initLibs()

connect to DB and initialise the keboolaAppData and keboolaAppConfig libraries

Return Value

void

initialize(session = getDefaultReactiveDomain())

Constructor.

Parameters

  • session Shiny session object.

loadTable(prettyName, name)

Load table from Storage. (Exposed wrapper for KeboolaAppData method).

Parameters

  • prettyName Table name to be used in labels throughout the app.

  • name Name of table in SAPI.

Return Value

data.frame with table data

loadTables(tables, options)

load tables specified in the parameter list tables from storage

Parameters

  • tables list of tables to load

  • options startup method options

Return Value

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

Return Value

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

Return Value

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

Parameters

  • 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

Return Value

list containing loginInfo


keboola/shiny-lib documentation built on May 20, 2019, 8:34 a.m.