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
get
bottomPanel():HTMLDivElement
Returns
HTMLDivElement
Source
browsePanel
get
browsePanel():BrowsePanel
Returns
Source
dockManager
get
dockManager():DockManager
Returns
Source
lastError
get
lastError():Promise
<undefined
|string
>
Last error state
set
lastError(s
):void
Parameters
Parameter | Type |
---|---|
s | any |
Returns
Promise
<undefined
| string
>
Source
o
get
o():any
Current object (rendered in the context panel)
set
o(x
):void
Parameters
Parameter | Type |
---|---|
x | any |
Returns
any
Source
project
get
project():Project
Current project
Returns
Source
sidebar
get
sidebar():TabControl
Returns
Source
startUri
get
startUri():string
Returns
string
Source
t
get
t():DataFrame
Current table, or null.
Returns
Source
tableNames
get
tableNames():string
[]
Names of the currently open tables
Returns
string
[]
Source
tableViews
get
tableViews():Iterable
<TableView
>
Returns currently open table views
Returns
Iterable
<TableView
>
Source
tables
get
tables():DataFrame
[]
List of currently open tables
Returns
Source
topMenu
get
topMenu():Menu
Returns
Source
topPanel
get
topPanel():HTMLDivElement
Returns
HTMLDivElement
Source
tv
get
tv():TableView
Current table view, or null
Returns
Source
user
get
user():User
Current user
Returns
Source
v
get
v():ViewBase
Current view
set
v(view
):void
Parameters
Parameter | Type |
---|---|
view | ViewBase |
Returns
Source
viewer
get
viewer():Viewer
<any
>
Current viewer
set
viewer(x
):void
Parameters
Parameter | Type |
---|---|
x | Viewer <any > |
Returns
Viewer
<any
>
Source
views
get
views():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