File

global-context/services/domain/widget-control.service.ts

Description

Service responsible for managing widget-level control settings and their interaction with dashboard-level controls. Handles the resolution of settings based on display mode, link states, and refresh options.

Key responsibilities:

  • Widget settings resolution for different display modes
  • Link state management between inline and dashboard controls
  • Dashboard control calculations based on link states
  • Settings toggle operations for individual and bulk link changes

Index

Methods

Methods

getConfigSettingsFromWidgetControls
getConfigSettingsFromWidgetControls(controls: WidgetControls, displayMode: GlobalContextDisplayMode, refreshOption: RefreshOption | string)

Extracts configuration settings from widget controls for the specified display mode and refresh option. Applies fallback logic for invalid refresh options, defaulting to LIVE mode.

Parameters :
Name Type Optional Description
controls WidgetControls No
  • Widget control configuration
displayMode GlobalContextDisplayMode No
  • Display mode (dashboard, config, view_and_config)
refreshOption RefreshOption | string No
  • Refresh mode, may be invalid and will fallback to LIVE
Returns : Partial<GlobalContextSettings>

Configuration settings for the specified mode and refresh option

getDefaultLinksFromControls
getDefaultLinksFromControls(controls: WidgetControls, displayMode: GlobalContextDisplayMode, refreshOption: RefreshOption | string)

Extracts default link states from widget controls for the specified display mode and refresh option. Applies fallback logic for invalid refresh options, defaulting to LIVE mode.

Parameters :
Name Type Optional Description
controls WidgetControls No
  • Widget control configuration
displayMode GlobalContextDisplayMode No
  • Display mode (dashboard, config, view_and_config)
refreshOption RefreshOption | string No
  • Refresh mode, may be invalid and will fallback to LIVE
Returns : LinkStatesMap

Default link states for the specified mode and refresh option

getInlineSettingsFromWidgetControls
getInlineSettingsFromWidgetControls(controls: WidgetControls, displayMode: GlobalContextDisplayMode, refreshOption: RefreshOption | string)

Extracts inline settings from widget controls for the specified display mode and refresh option. Applies fallback logic for invalid refresh options, defaulting to LIVE mode.

Parameters :
Name Type Optional Description
controls WidgetControls No
  • Widget control configuration
displayMode GlobalContextDisplayMode No
  • Display mode (dashboard, config, view_and_config)
refreshOption RefreshOption | string No
  • Refresh mode, may be invalid and will fallback to LIVE
Returns : Partial<GlobalContextSettings>

Inline settings for the specified mode and refresh option

resolveConfigControlSettings
resolveConfigControlSettings(controls: WidgetControls, mode: GlobalContextDisplayMode, refreshOption: RefreshOption)

Resolves widget settings for configuration controls based on the specified mode and refresh option. Configuration controls are simpler and don't require dashboard control calculations.

Parameters :
Name Type Optional Description
controls WidgetControls No
  • Widget control configuration containing config settings
mode GlobalContextDisplayMode No
  • Display mode determining which config settings to use
refreshOption RefreshOption No
  • Refresh mode (live/history) for settings selection

Resolved configuration settings with empty links and dashboard controls

resolveInlineControlSettings
resolveInlineControlSettings(controls: WidgetControls, mode: GlobalContextDisplayMode, refreshOption: RefreshOption)

Resolves widget settings for inline controls based on the specified mode and refresh option. For dashboard mode, calculates the split between inline and dashboard controls.

Parameters :
Name Type Optional Description
controls WidgetControls No
  • Widget control configuration containing settings and links
mode GlobalContextDisplayMode No
  • Display mode determining which settings to use
refreshOption RefreshOption No
  • Refresh mode (live/history) for settings selection

Resolved settings with inline controls, links, and dashboard controls

toggleAllControlLinks
toggleAllControlLinks(state: boolean, currentSettings: Partial, currentLinks: LinkStatesMap)

Sets all link states to the specified value and recalculates the resulting settings. This is used for bulk operations like "link all" or "unlink all" controls.

Parameters :
Name Type Optional Description
state boolean No
  • The state to set for all links (true = linked, false = unlinked)
currentSettings Partial<GlobalContextSettings> No
  • Current inline control settings
currentLinks LinkStatesMap No
  • Current link states

Updated settings with all links set to the specified state

toggleControlLink
toggleControlLink(linkKey: string, currentSettings: Partial, currentLinks: LinkStatesMap)

Toggles a single link state and recalculates the resulting settings and dashboard controls. When a link is toggled, it affects how controls are distributed between inline and dashboard.

Parameters :
Name Type Optional Description
linkKey string No
  • The key of the link to toggle
currentSettings Partial<GlobalContextSettings> No
  • Current inline control settings
currentLinks LinkStatesMap No
  • Current link states

Updated settings with toggled link and recalculated dashboard controls

results matching ""

    No results matching ""