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


browsePanel

get browsePanel(): BrowsePanel

Returns

BrowsePanel

Source

src/shell.ts:143


dockManager

get dockManager(): DockManager

Returns

DockManager

Source

src/shell.ts:354


favorites

get favorites(): Entity[]

Returns

Entity[]

Source

src/shell.ts:147


lastError

get lastError(): Promise<undefined | string>

Last error state

set lastError(s): void

Parameters

ParameterType
sany

Returns

Promise<undefined | string>

Source

src/shell.ts:100


o

get o(): any

Current object (rendered in the context panel)

set o(x): void

Parameters

ParameterType
xany

Returns

any

Source

src/shell.ts:112


preview

get preview(): null | View

The view currently displayed in preview mode.

This allows inspecting an object (like a dataset) temporarily without fully opening it or adding it to the workspace.

set preview(view): void

Parameters

ParameterType
viewnull | View

Returns

null | View

Source

src/shell.ts:77


project

get project(): Project

Current project

Returns

Project

Source

src/shell.ts:84


get sidebar(): TabControl

Returns

TabControl

Source

src/shell.ts:124


startUri

get startUri(): string

Returns

string

Source

src/shell.ts:363


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


tableViews

get tableViews(): Iterable <TableView>

Returns currently open table views

Returns

Iterable <TableView>

Source

src/shell.ts:326


tables

get tables(): DataFrame[]

List of currently open tables

Returns

DataFrame[]

Source

src/shell.ts:316


topMenu

get topMenu(): Menu

Returns

Menu

Source

src/shell.ts:129


topPanel

get topPanel(): HTMLDivElement

Returns

HTMLDivElement

Source

src/shell.ts:134


tv

get tv(): TableView

Current table view, or null

Returns

TableView

Source

src/shell.ts:81


user

get user(): User

Current user

Returns

User

Source

src/shell.ts:107


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


views

get views(): Iterable <View>

Returns currently open views

Returns

Iterable <View>

Source

src/shell.ts:321

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


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


addTable()

addTable(table): DataFrame

Adds a table to the workspace.

Parameters

ParameterType
tableDataFrame

Returns

DataFrame

Source

src/shell.ts:89


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


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


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


clearDirtyFlag()

clearDirtyFlag(): void

Clears dirty flag in scratchpad and open projects.

Returns

void

Source

src/shell.ts:359


clearLastError()

clearLastError(): void

Returns

void

Source

src/shell.ts:104


closeAll()

closeAll(): void

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

Returns

void

Source

src/shell.ts:271


closeTable()

closeTable(table): void

Closes a table and removes from the workspace.

Parameters

ParameterType
tableDataFrame

Returns

void

Source

src/shell.ts:95


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


error()

error(s, options?): void

Shows information message (red background)

Parameters

ParameterTypeDescription
sstring | HTMLElementmessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:162


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


getVar()

getVar(variableName): object

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

Parameters

ParameterTypeDescription
variableNamestring

Returns

object

Source

src/shell.ts:341


info()

info(x, options?): void

Shows information message (green background)

Parameters

ParameterTypeDescription
xanymessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:154


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


openFileOpenDialog()

openFileOpenDialog(): void

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

Returns

void

Source

src/shell.ts:266


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


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


setCurrentObject()

setCurrentObject(x, freeze, force?): void

Parameters

ParameterType
xany
freezeboolean
force?boolean

Returns

void

Source

src/shell.ts:115


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


table()

table(tableName): DataFrame

Returns a DataFrame with the specified [tableName].

Parameters

ParameterType
tableNamestring

Returns

DataFrame

Source

src/shell.ts:293


tableByName()

tableByName(tableName): DataFrame

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

Parameters

ParameterTypeDescription
tableNamestring

Returns

DataFrame

Source

src/shell.ts:334


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


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


warning()

warning(s, options?): void

Shows warning message (yellow background)

Parameters

ParameterTypeDescription
sstring | HTMLElementmessage
options?BalloonOptions

Returns

void

Source

src/shell.ts:169