global-context/services/state/global-context-store.service.ts
GlobalContextConfigStoreService
Component-scoped store that manages widget-level Global Context configuration.
Provided in component scope (see providers of c8y-global-context-config).
Properties |
|
Methods |
| hydrate | ||||||||
hydrate(config: GlobalContextState)
|
||||||||
|
Hydrates the store from an external config input. After the first call, preserves the user's tab selection.
Parameters :
Returns :
void
|
| patchCurrent | ||||||||
patchCurrent(changes: Partial
|
||||||||
|
Applies a partial update to the currently selected refresh mode. Enforces business rules (Live: aggregation=null; History: interval=CUSTOM) before commit.
Parameters :
Returns :
void
|
| resetAllModesToDefaults |
resetAllModesToDefaults()
|
|
Resets both Live and History modes to defaults, preserving the current selected tab and display mode.
Returns :
void
|
| resetModeToDefaults | ||||||
resetModeToDefaults(target: RefreshOption)
|
||||||
|
Resets a single mode (live/history) to defaults, preserving the current display mode and selected tab.
Parameters :
Returns :
void
|
| select | ||||||
select(project: (s: GlobalContextState) => void)
|
||||||
Type parameters :
|
||||||
|
Selects a value from the active configuration using a projector function. Returns a signal that updates whenever the active configuration changes.
Parameters :
Returns :
any
|
| setDisplayMode | ||||||||
setDisplayMode(mode: GlobalContextDisplayMode)
|
||||||||
|
Sets the display mode and syncs the mode to both modes. Does not change the selected tab.
Parameters :
Returns :
void
|
| setRefreshOption | ||||||||
setRefreshOption(option: RefreshOption)
|
||||||||
|
Explicitly selects the tab (Live/History). Does not mutate stored values for either refresh mode; it only switches which mode is active.
Parameters :
Returns :
void
|
| setSnapshot | |||||||||
setSnapshot(option: RefreshOption, snapshot: GlobalContextState | null)
|
|||||||||
|
Hydrates the snapshot for a specific refresh mode without altering the current selection. Used by widget configuration to restore per-mode state across component lifecycles.
Parameters :
Returns :
void
|
| setWidgetControls | ||||||
setWidgetControls(controls: WidgetControls)
|
||||||
|
Sets the widget controls template. Required for computing visibility via
Parameters :
Returns :
void
|
| Readonly displayMode |
Type : WritableSignal<GlobalContextDisplayMode>
|
Default value : signal(
GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG
)
|
|
Current display mode for the widget (config or view_and_config). |
| Readonly initialized |
Type : WritableSignal<boolean>
|
Default value : signal(false)
|
|
Whether the store has processed the first hydrate() call. |
| Readonly liveState |
Type : WritableSignal<GlobalContextState | null>
|
Default value : signal(null)
|
|
Live mode of the widget time context state. Null until the store is hydrated with the first input. |
| Readonly refreshOption |
Type : WritableSignal<RefreshOption>
|
Default value : signal(REFRESH_OPTION.LIVE)
|
|
Currently selected tab (refresh option). Defaults to LIVE. |