Layouts
5.24.0The Layouts API allows you to save the arrangement and context of any set of apps running in Glue42 Enterprise as a named Layout and later restore it. You can also choose a default Global Layout which Glue42 Enterprise will load upon startup.
The Layouts library supports different types of Layouts - e.g., Global, App Default, Workspace.
The Layouts API is accessible through the glue.layouts
object.
APIobject
Description
Layouts API.
Methods
clearDefaultGlobalmethod
Signature
() => Promise<void>
Description
Removes the default Global Layout.
exportmethod
Signature
(layoutType?: LayoutType) => Promise<Layout[]>
Description
Retrieves all available Layouts.
Parameters
Name | Type | Required | Description |
---|---|---|---|
layoutType | LayoutType | Type of the Layouts to retrieve. |
forceRefreshmethod
Signature
() => Promise<void>
Description
Forces a refresh of the connection to the Glue42 Server or any other REST Layout stores, updating the list of available Layouts.
getmethod
Signature
(name: string, type: LayoutType) => Promise<Layout>
Description
Retrieves a Layout.
Parameters
Name | Type | Required | Description |
---|---|---|---|
name | string | Name of the Layout to retrieve. |
|
type | LayoutType | Type of the Layout to retrieve. |
getAllmethod
Signature
(type: LayoutType) => Promise<LayoutSummary[]>
Description
Retrieves a lightweight, summarized version of all Layouts of the provided type.
Parameters
Name | Type | Required | Description |
---|---|---|---|
type | LayoutType | Type of the Layouts whose summaries to retrieve. |
getCurrentLayoutmethod
getDefaultGlobalmethod
hibernatemethod
Signature
(name: string, options?: HibernationOptions) => Promise<HibernateResult>
Description
Hibernates a Layout.
Available since version Glue42 3.9
Parameters
Name | Type | Required | Description |
---|---|---|---|
name | string | Name of the Layout to hibernate. |
|
options | HibernationOptions | Options for hibernating a Layout. |
importmethod
Signature
(layouts: Layout[], mode?: "replace" | "merge") => Promise<ImportLayoutResult>
Description
Imports one or more Layouts.
Parameters
Name | Type | Required | Description |
---|---|---|---|
layouts | Layout[] | Array of Layouts to import. |
|
mode | "replace" | "merge" | Mode for importing the Layouts. |
listmethod
onAddedmethod
onChangedmethod
onLayoutModifiedmethod
Signature
(callback: (info: LayoutModifiedEvent) => SaveRequestResponse) => UnsubscribeFunction
Description
Notifies when a Layout is modified.
Available since version Glue42 3.21
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (info: LayoutModifiedEvent) => SaveRequestResponse | Callback function for handling the event. |
onRemovedmethod
onRenamedmethod
onRestoredmethod
onSaveRequestedmethod
Signature
(callback: (info?: SaveRequestContext) => SaveRequestResponse) => UnsubscribeFunction
Description
Notifies when a Layout save is requested.
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (info?: SaveRequestContext) => SaveRequestResponse | Callback function for handling the event. |
removemethod
Signature
(type: string, name: string) => Promise<void>
Description
Removes a Layout
Parameters
Name | Type | Required | Description |
---|---|---|---|
type | string | Type of the Layout to remove. |
|
name | string | Name of the Layout to remove. |
renamemethod
Signature
(layout: Layout, newName: string) => Promise<LayoutResult>
Description
Renames a Layout.
Parameters
Name | Type | Required | Description |
---|---|---|---|
layout | Layout | Existing Layout to rename. |
|
newName | string | New name for the Layout. |
restoremethod
Signature
(options: RestoreOptions) => Promise<void>
Description
Restores a Layout.
Parameters
Name | Type | Required | Description |
---|---|---|---|
options | RestoreOptions | Options for restoring a Layout. |
resumemethod
Signature
(name: string, context?: any, options?: ResumeOptions) => Promise<ResumeResult>
Description
Resumes a Layout.
Available since version Glue42 3.9
Parameters
Name | Type | Required | Description |
---|---|---|---|
name | string | Name of the Layout to resume. |
|
context | any | Context for the Layout. |
|
options | ResumeOptions | Options for resuming a Layout. |
savemethod
Signature
(layout: NewLayoutOptions) => Promise<Layout>
Description
Saves a new Layout.
Parameters
Name | Type | Required | Description |
---|---|---|---|
layout | NewLayoutOptions | Options for saving a Layout. |
setDefaultGlobalmethod
Signature
(name: string) => Promise<void>
Description
Sets a new default Global Layout.
Parameters
Name | Type | Required | Description |
---|---|---|---|
name | string | Name of the Layout to set as the new default Global Layout. |
updateAppContextInCurrentmethod
Signature
(context: object) => Promise<void>
Description
Updates the context saved for your app in the currently loaded Layout.
Parameters
Name | Type | Required | Description |
---|---|---|---|
context | object | New context for the app. |
updateDefaultContextmethod
Signature
(context: object) => Promise<LayoutResult>
Description
Updates the context that will be saved as a default context for the current window.
Available since version Glue42 3.10
Parameters
Name | Type | Required | Description |
---|---|---|---|
context | object | New context that will be saved as a default window context. |
Configurationobject
Description
Configuration for the Layouts library.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
autoSaveWindowContext | boolean | LayoutType[] | false | If |
|
mode | Mode | Layouts library mode. |
HibernateResultobject
Description
Describes the result returned from hibernating a Layout.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
layout | Layout | Hibernated layout. |
||
status | string | Status of the Layout operation. If successful, will be set to |
HibernationOptionsobject
Description
Options for hibernating Layouts.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
context | object | Context object that will be passed to the restored apps. It will be merged with the saved context object. |
||
metadata | any | Metadata to be saved with the Layout. |
ImportLayoutResultobject
Description
Describes the result returned from importing Layouts.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
failed | { name: string; type: LayoutType; }[] | Array of objects describing all Layouts that failed to import. Each object contains the name and the type of the Layout. |
||
status | string | Status of the Layout operation. If successful, will be set to |
Layoutobject
Description
Describes a Layout.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
components | LayoutComponent[] | Array of component objects describing the apps that are saved in the Layout. |
||
context | any | Layout context. |
||
metadata | any | Layout metadata. |
||
name | string | Name of the Layout, unique per Layout type. |
||
type | LayoutType | Type of the Layout. |
||
version | number | Version of the Layout. |
LayoutComponentobject
Description
Describes a Layout component - an app participating in the Layout and its state.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
application | string | Name of the app to which belongs window instance, or the name of the Workspaces App to which belongs the Workspace instance. |
||
state | any | Provides information about the instance ID, bounds, context, state and more of the Layout component. |
||
type | string | Type of the Layout component. If |
LayoutModifiedEventobject
Description
Object describing a modified Layout and the reason for its modification.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
layout | { name: string; type: string; } | Object holding the name and the type of the modified Layout. |
||
reason | { application?: string; action?: string; instance?: string; } | Object holding information about the name of the app or the ID of the instance that is responsible for the Layout changes, and the action that has caused them (e.g., started or stopped instance, changed state of a Workspaces App, and more). |
LayoutResultobject
Description
Describes the base result returned by methods for manipulating Layouts - e.g., renaming, hibernating, updating default context.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
status | string | Status of the Layout operation. If successful, will be set to |
LayoutSummaryobject
Description
Summarized description of a Layout.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
context | any | Layout context. |
||
metadata | any | Layout metadata. |
||
name | string | Name of the Layout, unique per Layout type. |
||
type | LayoutType | Type of the Layout. |
NewLayoutOptionsobject
Description
Options for saving a new Layout.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
context | any | Context to be saved with the Layout. |
||
ignoreInstances | string[] | Only if the Layout type is |
||
instances | string[] | Only if the Layout type is |
||
metadata | any | Metadata to be saved with the Layout. |
||
name | string | Name for the Layout. |
||
type | LayoutType | "Global" | Type of the Layout. |
RestoreOptionsobject
Description
Options for restoring a Layout.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
closeMe | boolean | true | If |
|
closeRunningInstances | boolean | true | Only if the Layout type is |
|
context | unknown | Context object that will be passed to the restored apps. It will be merged with the saved context object. |
||
name | string | Name of the Layout to restore. |
||
timeout | number | Timeout in milliseconds for restoring the Layout. If the time limit is hit, all apps opened up to this point will be closed and an error will be thrown. |
||
type | string | "Global" | Type of the Layout to restore. |
ResumeOptionsobject
Description
Options for resuming a Layout.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
cleanUp | boolean | Whether to stop any already running apps before resuming the Layout. |
ResumeResultobject
Description
Describes the result returned from resuming a Layout.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
instances | { instanceId: string; appName: string; }[] | Array of objects describing all resumed app instances participating in the Layout. Each object contains the instance ID and the app name of the resumed app instance. |
||
status | string | Status of the Layout operation. If successful, will be set to |
SaveRequestContextobject
Description
Context passed as an argument to the callback for handling Layout save request events.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
context | unknown | Context to be saved. |
||
layoutName | string | Name of the Layout that is to be saved. |
||
layoutType | LayoutType | Type of the Layout to be saved. |
SaveRequestResponseobject
Description
Result returned in response to a request for saving a Layout.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
windowContext | object | Context object specific to the app. |
ImportModeenumeration
Description
Mode for importing Layouts.
"replace"
- all existing Layouts will be removed and replaced with the imported ones (default);"merge"
- the imported Layouts will be merged with the existing ones;
- "replace"
- "merge"
LayoutTypeenumeration
Description
The supported Layout types are "Global"
, "ApplicationDefault"
and "Workspace"
.
The "Activity"
and "Swimlane"
types are deprecated.
In a Global Layout, all running apps and their state is saved. By default, hidden windows are ignored.
The App Default Layout describes the default Layout for an app instance - the last saved window bounds,
state and context. The Workspace Layout describes the arrangement of the Workspace elements, its bounds and context of individual windows.
- "Global"
- "ApplicationDefault"
- "Workspace"
- "Activity"
- "Swimlane"
Modeenumeration
Description
Layouts library initialization mode:
"full"
- all Layout functionalities are available;"fullWaitSnapshot"
- same as the"full"
mode, except that the Layouts library will notify that it is ready a little later - when a snapshot of the available Layouts has been received;"slim"
- Layout events aren't tracked and Layouts can't be manipulated;
- "full"
- "fullWaitSnapshot"
- "slim"