Shell
Grok visual shell, use it to get access to top-level views, tables, methods, etc.
Example
grok.shell.addTableView(grok.data.demo.biosensor(1000));
Constructors
new Shell()
new Shell():
Shell
Returns
Properties
| Property | Type | Default value |
|---|---|---|
build | AppBuildInfo | ... |
settings | Settings & SettingsInterface | ... |
windows | Windows | ... |
Accessors
bottomPanel
getbottomPanel():HTMLDivElement
Returns
HTMLDivElement
Source
browsePanel
getbrowsePanel():BrowsePanel
Returns
Source
dockManager
getdockManager():DockManager
Returns
Source
favorites
getfavorites():Entity[]
Returns
Entity[]
Source
lastError
getlastError():Promise<undefined|string>
Last error state
setlastError(s):void
Parameters
| Parameter | Type |
|---|---|
s | any |
Returns
Promise<undefined | string>
Source
o
geto():any
Current object (rendered in the context panel)
seto(x):void
Parameters
| Parameter | Type |
|---|---|
x | any |
Returns
any
Source
project
getproject():Project
Current project
Returns
Source
sidebar
getsidebar():TabControl
Returns
Source
startUri
getstartUri():string
Returns
string
Source
t
gett():DataFrame
Current table, or null.
Returns
Source
tableNames
gettableNames():string[]
Names of the currently open tables
Returns
string[]
Source
tableViews
gettableViews():Iterable<TableView>
Returns currently open table views
Returns
Iterable <TableView>
Source
tables
gettables():DataFrame[]
List of currently open tables
Returns
Source
topMenu
gettopMenu():Menu
Returns
Source
topPanel
gettopPanel():HTMLDivElement
Returns
HTMLDivElement
Source
tv
gettv():TableView
Current table view, or null
Returns
Source
user
getuser():User
Current user
Returns
Source
v
getv():ViewBase
Current view
setv(view):void
Parameters
| Parameter | Type |
|---|---|
view | ViewBase |
Returns
Source
viewer
getviewer():Viewer<any>
Current viewer
setviewer(x):void
Parameters
| Parameter | Type |
|---|---|
x | Viewer<any> |
Returns
Viewer<any>
Source
views
getviews():Iterable<View>
Returns currently open views
Returns
Iterable <View>
Source
Methods
add()
add(
item):Shell
Adds an item to the workspace. It could be a DataFrame, a View, or an HtmlElement. Throws an error, if the item has a different type.
Parameters
| Parameter | Type |
|---|---|
item | HTMLElement | DataFrame | ViewBase |
Returns
Source
addPreview()
addPreview(
v,dockType,width,context):ViewBase
Adds a preview for current Browse Panel node.
Parameters
| Parameter | Type | Default value |
|---|---|---|
v | ViewBase | undefined |
dockType | "fill" | "left" | "right" | "up" | "down" | DOCK_TYPE.FILL |
width | null | number | null |
context | null | FuncCall | null |
Returns
Source
addTable()
addTable(
table):DataFrame
Adds a table to the workspace.
Parameters
| Parameter | Type |
|---|---|
table | DataFrame |
Returns
Source
addTablePreview()
addTablePreview(
table,dockType,width):TableView
Adds a preview for the specified table.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
table | DataFrame | undefined | |
dockType | null | "fill" | "left" | "right" | "up" | "down" | DOCK_TYPE.FILL | |
width | null | number | null |
Returns
Source
addTableView()
addTableView(
table,dockType,width):TableView
Adds a view for the specified table.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
table | DataFrame | undefined | |
dockType | null | "fill" | "left" | "right" | "up" | "down" | DOCK_TYPE.FILL | |
width | null | number | null |
Returns
Source
addView()
addView(
v,dockType,width,context):ViewBase
Adds a view.
Parameters
| Parameter | Type | Default value |
|---|---|---|
v | ViewBase | undefined |
dockType | "fill" | "left" | "right" | "up" | "down" | DOCK_TYPE.FILL |
width | null | number | null |
context | null | FuncCall | null |
Returns
Source
clearDirtyFlag()
clearDirtyFlag():
void
Clears dirty flag in scratchpad and open projects.
Returns
void
Source
clearLastError()
clearLastError():
void
Returns
void
Source
closeAll()
closeAll():
void
Closes everything (views, tables, projects) and returns the platform to the initial state.
Returns
void
Source
closeTable()
closeTable(
table):void
Closes a table and removes from the workspace.
Parameters
| Parameter | Type |
|---|---|
table | DataFrame |
Returns
void
Source
dockElement()
dockElement(
element,title,dockStyle,ratio):void
Docks element in a separate window. Sample: https://public.datagrok.ai/js/samples/ui/docking/docking
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
element | HTMLElement | undefined | |
title | null | string | null | |
dockStyle | "fill" | "left" | "right" | "up" | "down" | DOCK_TYPE.FILL | |
ratio | number | 0.5 | area to take (relative to parent) |
Returns
void
Source
error()
error(
s,options?):void
Shows information message (red background)
Parameters
| Parameter | Type | Description |
|---|---|---|
s | string | HTMLElement | message |
options? | BalloonOptions |
Returns
void
Source
getTableView()
getTableView(
tableName):TableView
Returns TableView for the specified table if it exists, opens a new view if necessary. Search is case-insensitive.
Parameters
| Parameter | Type | Description |
|---|---|---|
tableName | string |
Returns
Source
getVar()
getVar(
variableName):object
Returns the value of the specified variable. Search is case-insensitive.
Parameters
| Parameter | Type | Description |
|---|---|---|
variableName | string |
Returns
object
Source
info()
info(
x,options?):void
Shows information message (green background)
Parameters
| Parameter | Type | Description |
|---|---|---|
x | any | message |
options? | BalloonOptions |
Returns
void
Source
newView()
newView(
name,children?,options?):View
Adds a new view with the specified name.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | 'view' | view name |
children? | object[] | undefined | content to be added by calling ui.appendAll |
options? | null | string | object | undefined |
Returns
Source
openFileOpenDialog()
openFileOpenDialog():
void
Opens a dialog for opening a file with tabular data (CSV, XSLS, etc)
Returns
void
Source
registerViewer()
registerViewer(
viewerTypeName,description,createViewer):void
Registers a viewer. Sample: https://public.datagrok.ai/js/samples/scripts/functions/custom-viewers
Parameters
| Parameter | Type | Description |
|---|---|---|
viewerTypeName | string | |
description | string | |
createViewer | (...params) => JsViewer | a function that returns JsViewer |
Returns
void
Source
reportTest()
reportTest(
type,params):Promise<void>
Parameters
| Parameter | Type |
|---|---|
type | String |
params | object |
Returns
Promise<void>
Source
route()
route(
url):View
Opens the view that handles the specified url. Sample: https://public.datagrok.ai/js/samples/ui/docking/docking
Parameters
| Parameter | Type |
|---|---|
url | string |
Returns
Source
setCurrentObject()
setCurrentObject(
x,freeze,force?):void
Parameters
| Parameter | Type |
|---|---|
x | any |
freeze | boolean |
force? | boolean |
Returns
void
Source
setVar()
setVar(
variableName,variableValue):object
Sets the value of the specified variable, and returns this value.
Parameters
| Parameter | Type | Description |
|---|---|---|
variableName | string | |
variableValue | object |
Returns
object
Source
table()
table(
tableName):DataFrame
Returns a DataFrame with the specified [tableName].
Parameters
| Parameter | Type |
|---|---|
tableName | string |
Returns
Source
tableByName()
tableByName(
tableName):DataFrame
Returns a table by its name. Search is case-insensitive.
Parameters
| Parameter | Type | Description |
|---|---|---|
tableName | string |
Returns
Source
tableView()
tableView(
tableName):TableView
Returns a first TableView for the specified [tableName], or null if there are no such views.
Parameters
| Parameter | Type |
|---|---|
tableName | string |
Returns
Source
testError()
testError(
s):void
Parameters
| Parameter | Type |
|---|---|
s | String |
Returns
void
Source
view()
view(
name):null|View
Returns a view with the specified [name], or null if there is no such view.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
null | View
Source
warning()
warning(
s,options?):void
Shows warning message (yellow background)
Parameters
| Parameter | Type | Description |
|---|---|---|
s | string | HTMLElement | message |
options? | BalloonOptions |
Returns
void