new Workspaces()
- Since:
-
10.5.0
Methods
-
<static> WorkspacesManager#_resetToDefault()
-
Reset to default state (empty workspaces)
- Since:
-
10.5.0
Returns:
- Type
- void
-
<static> WorkspacesManager#collectCurrentState(contextElement)
-
Collect current state from all charts
Parameters:
Name Type Description contextElementHTMLElement cq-context or multiChartContainer element
- Since:
-
10.5.0
Returns:
Current state with grid and charts
- Type
- object
-
<static> WorkspacesManager#createWorkspace(name, contextElement)
-
Create a new workspace with current chart state
Parameters:
Name Type Description namestring Workspace name
contextElementHTMLElement cq-context or multiChartContainer element
- Since:
-
10.5.0
Returns:
New workspace ID or null on failure
- Type
- string | null
-
<static> WorkspacesManager#deleteWorkspace(workspaceId, contextElement)
-
Delete a workspace
Parameters:
Name Type Description workspaceIdstring Workspace ID
contextElementHTMLElement cq-context or multiChartContainer element
- Since:
-
10.5.0
Returns:
- Type
- void
-
<static> WorkspacesManager#findUserWorkspaceByName(name)
-
Find a user-created (non-admin) workspace by name.
Parameters:
Name Type Description namestring Workspace name
- Since:
-
10.5.0
Returns:
Workspace ID if found, null otherwise
- Type
- string | null
-
<static> WorkspacesManager#generateId()
-
Generate unique workspace ID
- Since:
-
10.5.0
Returns:
Workspace ID prefixed with "ws_"
- Type
- string
-
<static> WorkspacesManager#getActiveWorkspaceId(contextElement)
-
Get the active workspace ID for a given context element
Parameters:
Name Type Description contextElementHTMLElement cq-context or multiChartContainer element
- Since:
-
10.5.0
Returns:
Active workspace ID or "none"
- Type
- string
-
<static> WorkspacesManager#getWorkspaceById(id [, props])
-
Get workspace or specific properties by ID
Parameters:
Name Type Argument Description idstring Workspace ID
propsstring <optional>
<repeatable>
Property names to extract. If omitted, returns full workspace. If single prop, returns value directly. If multiple, returns object with those props.
- Since:
-
10.5.0
Returns:
Full workspace object, single property value, or object with requested properties
- Type
- *
Example
manager.getWorkspaceById(id) // → full workspace object manager.getWorkspaceById(id, 'name') // → "My Workspace" (string) manager.getWorkspaceById(id, 'name', 'isAdmin') // → {name: "...", isAdmin: false} -
<static> WorkspacesManager#getWorkspaces()
-
Get all workspaces as array
- Since:
-
10.5.0
Returns:
Array of workspace objects
- Type
- Array
-
<static> WorkspacesManager#getWorkspacesSummary()
-
Get lightweight workspace summaries for menu rendering (no layout/drawings cloned)
- Since:
-
10.5.0
Returns:
Array of summary objects with id, name, isAdmin, isFavorite, modifiedAt
- Type
- Array
-
<static> WorkspacesManager#initialize( [config])
-
Initialize the WorkspacesManager - load workspaces from storage or create default
Parameters:
Name Type Argument Description configobject <optional>
Chart configuration object
Properties
Name Type Argument Description menuWorkspaceConfigobject <optional>
Workspace menu configuration
Properties
Name Type Argument Description nameValueStoreobject <optional>
Storage class constructor
cbfunction <optional>
Callback executed after storage loads
loadWorkspaceIdstring <optional>
Workspace ID to load for this chart on init; overrides stored active workspace
contextElementHTMLElement <optional>
Specific cq-context element to use
- Since:
-
10.5.0
Returns:
- Type
- void
Example
// In defaultConfiguration.js or your chart config: config.menuWorkspaceConfig = { loadWorkspaceId: "ws_abc123" // load this workspace when the chart initializes }; CIQ.Workspaces.getInstance().initialize(config); -
<static> WorkspacesManager#isWorkspaceReadOnly(id)
-
Check if workspace is read-only (admin workspace)
Parameters:
Name Type Description idstring Workspace ID
- Since:
-
10.5.0
Returns:
True if workspace is admin/read-only
- Type
- boolean
-
<static> WorkspacesManager#loadSampleAdminWorkspace()
-
Create (if missing) a sample read-only admin workspace for demos/examples. Lazily loads examples/data/workspacesSampleData.js if a sample isn't already available.
- Since:
-
10.5.0
Returns:
- Type
- void
-
<static> WorkspacesManager#loadWorkspace(workspaceId, contextElement)
-
Load a workspace and restore its state
Parameters:
Name Type Description workspaceIdstring Workspace ID or "none"
contextElementHTMLElement cq-context or multiChartContainer element
- Since:
-
10.5.0
Returns:
- Type
- void
-
<static> WorkspacesManager#overwriteWorkspaceById(id, contextElement)
-
Overwrite an existing workspace with current chart state
Parameters:
Name Type Description idstring Workspace ID to overwrite
contextElementHTMLElement cq-context or multiChartContainer element
- Since:
-
10.5.0
Returns:
Workspace ID on success, null if not found/admin/error
- Type
- string | null
-
<static> WorkspacesManager#save()
-
Save workspaces to storage
- Since:
-
10.5.0
Returns:
- Type
- void
-
<static> WorkspacesManager#saveActiveWorkspace(activeWorkspaceId, contextElement)
-
Save current state to active workspace
Parameters:
Name Type Description activeWorkspaceIdstring ID of the workspace to overwrite
contextElementHTMLElement cq-context or multiChartContainer element
- Since:
-
10.5.0
Returns:
- Type
- void
-
<static> WorkspacesManager#showToast(message [, type] [, contextElement])
-
Show toast notification
Parameters:
Name Type Argument Default Description messagestring Message to display
typestring <optional>
ToastType.SUCCESS Toast type (success, error, confirmation)
contextElementHTMLElement <optional>
null cq-context or multiChartContainer element; omit to suppress toast
- Since:
-
10.5.0
Returns:
- Type
- void
-
<static> WorkspacesManager#updateWorkspaceMetadata(workspaceId, updates)
-
Update workspace metadata (name only)
Parameters:
Name Type Description workspaceIdstring Workspace ID
updatesobject Updates to apply
- Since:
-
10.5.0
Returns:
- Type
- void
