Skip to main content

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

Shell

Properties

PropertyTypeDefault value
buildAppBuildInfo...
settingsSettings & SettingsInterface...
windowsWindows...

Accessors

bottomPanel

get bottomPanel(): HTMLDivElement

Returns

HTMLDivElement

Source

src/shell.ts:122


browsePanel

get browsePanel(): BrowsePanel

Returns

BrowsePanel

Source

src/shell.ts:126


dockManager

get dockManager(): DockManager

Returns

DockManager

Source

src/shell.ts:333


lastError

get lastError(): Promise<undefined | string>

Last error state

set lastError(s): void

Parameters

ParameterType
sany

Returns

Promise<undefined | string>

Source

src/shell.ts:83


o

get o(): any

Current object (rendered in the context panel)

set o(x): void

Parameters

ParameterType
xany

Returns

any

Source

src/shell.ts:95


project

get project(): Project

Current project

Returns

Project

Source

src/shell.ts:67


get sidebar(): TabControl

Returns

TabControl

Source

src/shell.ts:107


startUri

get startUri(): string

Returns

string

Source

src/shell.ts:342


t

get t(): DataFrame

Current table, or null.

Returns

DataFrame

Source

src/shell.ts:55


tableNames

get tableNames(): string[]

Names of the currently open tables

Returns

string[]

Source

src/shell.ts:289


tableViews

get tableViews(): Iterable <TableView>

Returns currently open table views

Returns

Iterable <TableView>

Source

src/shell.ts:305


tables

get tables(): DataFrame[]

List of currently open tables

Returns

DataFrame[]

Source

src/shell.ts:295


topMenu

get topMenu(): Menu

Returns

Menu

Source

src/shell.ts:112


topPanel

get topPanel(): HTMLDivElement

Returns

HTMLDivElement

Source

src/shell.ts:117


tv

get tv(): TableView

Current table view, or null

Returns

TableView

Source

src/shell.ts:64


user

get user(): User

Current user

Returns

User

Source

src/shell.ts:90


v

get v(): ViewBase

Current view

set v(view): void

Parameters

ParameterType
viewViewBase

Returns

ViewBase

Source

src/shell.ts:60


viewer

get viewer(): Viewer<any>

Current viewer

set viewer(x): void

Parameters

ParameterType
xViewer<any>

Returns

Viewer<any>

Source

src/shell.ts:103


views

get views(): Iterable <View>

Returns currently open views

Returns

Iterable <View>

Source

src/shell.ts:300

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

ParameterType
itemHTMLElement | DataFrame | ViewBase

Returns

Shell

Source

src/shell.ts:171


addPreview()

addPreview(v, dockType, width, context): ViewBase

Adds a preview for current Browse Panel node.

Parameters

ParameterTypeDefault value
vViewBaseundefined
dockType"fill" | "left" | "right" | "up" | "down"DOCK_TYPE.FILL
widthnull | numbernull
contextnull | FuncCallnull

Returns

ViewBase

Source

src/shell.ts:192


addTable()

addTable(table): DataFrame

Adds a table to the workspace.

Parameters

ParameterType
tableDataFrame

Returns

DataFrame

Source

src/shell.ts:72


addTablePreview()

addTablePreview(table, dockType, width): TableView

Adds a preview for the specified table.

Parameters

ParameterTypeDefault valueDescription
tableDataFrameundefined
dockTypenull | "fill" | "left" | "right" | "up" | "down"DOCK_TYPE.FILL
widthnull | numbernull

Returns

TableView

Source

src/shell.ts:221


addTableView()

addTableView(table, dockType, width): TableView

Adds a view for the specified table.

Parameters

ParameterTypeDefault valueDescription
tableDataFrameundefined
dockTypenull | "fill" | "left" | "right" | "up" | "down"DOCK_TYPE.FILL
widthnull | numbernull

Returns

TableView

Source

src/shell.ts:230


addView()

addView(v, dockType, width, context): ViewBase

Adds a view.

Parameters

ParameterTypeDefault value
vViewBaseundefined
dockType"fill" | "left" | "right" | "up" | "down"DOCK_TYPE.FILL
widthnull | numbernull
contextnull | FuncCallnull

Returns

ViewBase

Source

src/shell.ts:184


clearDirtyFlag()

clearDirtyFlag(): void

Clears dirty flag in scratchpad and open projects.

Returns

void

Source

src/shell.ts:338


clearLastError()

clearLastError(): void

Returns

void

Source

src/shell.ts:87


closeAll()

closeAll(): void

Closes everything (views, tables, projects) and returns the platform to the initial state.

Returns

void

Source

src/shell.ts:250


closeTable()

closeTable(table): void

Closes a table and removes from the workspace.

Parameters

ParameterType
tableDataFrame

Returns

void

Source

src/shell.ts:78


dockElement()

dockElement(element, title, dockStyle, ratio): void

Docks element in a separate window. Sample: https://public.datagrok.ai/js/samples/ui/docking/docking

Parameters

ParameterTypeDefault valueDescription
elementHTMLElementundefined
titlenull | stringnull
dockStyle"fill" | "left" | "right" | "up" | "down"DOCK_TYPE.FILL
rationumber0.5area to take (relative to parent)

Returns

void

Source

src/shell.ts:158


error()

error(s, options?): void

Shows information message (red background)

Parameters

ParameterTypeDescription
sstring | HTMLElementmessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:141


getTableView()

getTableView(tableName): TableView

Returns TableView for the specified table if it exists, opens a new view if necessary. Search is case-insensitive.

Parameters

ParameterTypeDescription
tableNamestring

Returns

TableView

Source

src/shell.ts:240


getVar()

getVar(variableName): object

Returns the value of the specified variable. Search is case-insensitive.

Parameters

ParameterTypeDescription
variableNamestring

Returns

object

Source

src/shell.ts:320


info()

info(x, options?): void

Shows information message (green background)

Parameters

ParameterTypeDescription
xanymessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:133


newView()

newView(name, children?, options?): View

Adds a new view with the specified name.

Parameters

ParameterTypeDefault valueDescription
namestring'view'view name
children?object[]undefinedcontent to be added by calling ui.appendAll
options?null | string | objectundefined

Returns

View

Source

src/shell.ts:206


openFileOpenDialog()

openFileOpenDialog(): void

Opens a dialog for opening a file with tabular data (CSV, XSLS, etc)

Returns

void

Source

src/shell.ts:245


registerViewer()

registerViewer(viewerTypeName, description, createViewer): void

Registers a viewer. Sample: https://public.datagrok.ai/js/samples/scripts/functions/custom-viewers

Parameters

ParameterTypeDescription
viewerTypeNamestring
descriptionstring
createViewer(...params) => JsViewera function that returns JsViewer

Returns

void

Source

src/shell.ts:267


reportTest()

reportTest(type, params): Promise<void>

Parameters

ParameterType
typeString
paramsobject

Returns

Promise<void>

Source

src/shell.ts:46


route()

route(url): View

Opens the view that handles the specified url. Sample: https://public.datagrok.ai/js/samples/ui/docking/docking

Parameters

ParameterType
urlstring

Returns

View

Source

src/shell.ts:164


setCurrentObject()

setCurrentObject(x, freeze, force?): void

Parameters

ParameterType
xany
freezeboolean
force?boolean

Returns

void

Source

src/shell.ts:98


setVar()

setVar(variableName, variableValue): object

Sets the value of the specified variable, and returns this value.

Parameters

ParameterTypeDescription
variableNamestring
variableValueobject

Returns

object

Source

src/shell.ts:327


table()

table(tableName): DataFrame

Returns a DataFrame with the specified [tableName].

Parameters

ParameterType
tableNamestring

Returns

DataFrame

Source

src/shell.ts:272


tableByName()

tableByName(tableName): DataFrame

Returns a table by its name. Search is case-insensitive.

Parameters

ParameterTypeDescription
tableNamestring

Returns

DataFrame

Source

src/shell.ts:313


tableView()

tableView(tableName): TableView

Returns a first TableView for the specified [tableName], or null if there are no such views.

Parameters

ParameterType
tableNamestring

Returns

TableView

Source

src/shell.ts:283


testError()

testError(s): void

Parameters

ParameterType
sString

Returns

void

Source

src/shell.ts:42


view()

view(name): null | View

Returns a view with the specified [name], or null if there is no such view.

Parameters

ParameterType
namestring

Returns

null | View

Source

src/shell.ts:277


warning()

warning(s, options?): void

Shows warning message (yellow background)

Parameters

ParameterTypeDescription
sstring | HTMLElementmessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:148