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:130


browsePanel

get browsePanel(): BrowsePanel

Returns

BrowsePanel

Source

src/shell.ts:134


dockManager

get dockManager(): DockManager

Returns

DockManager

Source

src/shell.ts:345


favorites

get favorites(): Entity[]

Returns

Entity[]

Source

src/shell.ts:138


lastError

get lastError(): Promise<undefined | string>

Last error state

set lastError(s): void

Parameters

ParameterType
sany

Returns

Promise<undefined | string>

Source

src/shell.ts:91


o

get o(): any

Current object (rendered in the context panel)

set o(x): void

Parameters

ParameterType
xany

Returns

any

Source

src/shell.ts:103


project

get project(): Project

Current project

Returns

Project

Source

src/shell.ts:75


get sidebar(): TabControl

Returns

TabControl

Source

src/shell.ts:115


startUri

get startUri(): string

Returns

string

Source

src/shell.ts:354


t

get t(): DataFrame

Current table, or null.

Returns

DataFrame

Source

src/shell.ts:63


tableNames

get tableNames(): string[]

Names of the currently open tables

Returns

string[]

Source

src/shell.ts:301


tableViews

get tableViews(): Iterable <TableView>

Returns currently open table views

Returns

Iterable <TableView>

Source

src/shell.ts:317


tables

get tables(): DataFrame[]

List of currently open tables

Returns

DataFrame[]

Source

src/shell.ts:307


topMenu

get topMenu(): Menu

Returns

Menu

Source

src/shell.ts:120


topPanel

get topPanel(): HTMLDivElement

Returns

HTMLDivElement

Source

src/shell.ts:125


tv

get tv(): TableView

Current table view, or null

Returns

TableView

Source

src/shell.ts:72


user

get user(): User

Current user

Returns

User

Source

src/shell.ts:98


v

get v(): ViewBase

Current view

set v(view): void

Parameters

ParameterType
viewViewBase

Returns

ViewBase

Source

src/shell.ts:68


viewer

get viewer(): Viewer<any>

Current viewer

set viewer(x): void

Parameters

ParameterType
xViewer<any>

Returns

Viewer<any>

Source

src/shell.ts:111


views

get views(): Iterable <View>

Returns currently open views

Returns

Iterable <View>

Source

src/shell.ts:312

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:183


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:204


addTable()

addTable(table): DataFrame

Adds a table to the workspace.

Parameters

ParameterType
tableDataFrame

Returns

DataFrame

Source

src/shell.ts:80


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:233


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:242


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:196


clearDirtyFlag()

clearDirtyFlag(): void

Clears dirty flag in scratchpad and open projects.

Returns

void

Source

src/shell.ts:350


clearLastError()

clearLastError(): void

Returns

void

Source

src/shell.ts:95


closeAll()

closeAll(): void

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

Returns

void

Source

src/shell.ts:262


closeTable()

closeTable(table): void

Closes a table and removes from the workspace.

Parameters

ParameterType
tableDataFrame

Returns

void

Source

src/shell.ts:86


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:170


error()

error(s, options?): void

Shows information message (red background)

Parameters

ParameterTypeDescription
sstring | HTMLElementmessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:153


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:252


getVar()

getVar(variableName): object

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

Parameters

ParameterTypeDescription
variableNamestring

Returns

object

Source

src/shell.ts:332


info()

info(x, options?): void

Shows information message (green background)

Parameters

ParameterTypeDescription
xanymessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:145


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:218


openFileOpenDialog()

openFileOpenDialog(): void

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

Returns

void

Source

src/shell.ts:257


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:279


reportTest()

reportTest(type, params): Promise<void>

Parameters

ParameterType
typeString
paramsobject

Returns

Promise<void>

Source

src/shell.ts:47


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:176


setCurrentObject()

setCurrentObject(x, freeze, force?): void

Parameters

ParameterType
xany
freezeboolean
force?boolean

Returns

void

Source

src/shell.ts:106


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:339


table()

table(tableName): DataFrame

Returns a DataFrame with the specified [tableName].

Parameters

ParameterType
tableNamestring

Returns

DataFrame

Source

src/shell.ts:284


tableByName()

tableByName(tableName): DataFrame

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

Parameters

ParameterTypeDescription
tableNamestring

Returns

DataFrame

Source

src/shell.ts:325


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:295


testError()

testError(s): void

Parameters

ParameterType
sString

Returns

void

Source

src/shell.ts:43


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:289


warning()

warning(s, options?): void

Shows warning message (yellow background)

Parameters

ParameterTypeDescription
sstring | HTMLElementmessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:160