@c8y/ngx-components 1023.17.16 → 1023.17.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/datapoint-explorer/view/index.d.ts +2 -1
- package/datapoint-explorer/view/index.d.ts.map +1 -1
- package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs +7 -2
- package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-global-context.mjs +8 -8
- package/fesm2022/c8y-ngx-components-global-context.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-time-context.mjs +9 -2
- package/fesm2022/c8y-ngx-components-time-context.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +15 -7
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/global-context/index.d.ts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/locales/de.po +20 -20
- package/locales/zh_TW.po +0 -1
- package/package.json +1 -1
- package/time-context/index.d.ts +3 -2
- package/time-context/index.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-global-context.mjs","sources":["../../global-context/models/global-context.model.ts","../../global-context/models/auto-refresh.model.ts","../../global-context/models/interval-picker.model.ts","../../global-context/models/global-context-defaults.ts","../../global-context/models/control-flow.model.ts","../../global-context/models/aggregation.model.ts","../../global-context/models/constants.ts","../../global-context/utils/date-time-context.util.ts","../../global-context/utils/global-context-defaults.util.ts","../../global-context/services/state/global-context.service.ts","../../global-context/services/state/global-context-form.service.ts","../../global-context/services/state/global-context-event.service.ts","../../global-context/services/domain/widget-control.service.ts","../../global-context/services/domain/date-time-context-picker.service.ts","../../global-context/services/domain/widget-config-migration.service.ts","../../global-context/services/domain/global-context-validation.service.ts","../../global-context/services/domain/aggregation-validation.service.ts","../../global-context/services/domain/aggregation-picker.service.ts","../../global-context/services/infrastructure/global-context-utils.service.ts","../../global-context/features/aggregation/aggregation-picker/aggregation-picker.component.ts","../../global-context/features/aggregation/aggregation-picker/aggregation-picker.component.html","../../global-context/features/configuration/history-mode-configuration-controls/history-mode-configuration-controls.component.ts","../../global-context/features/configuration/history-mode-configuration-controls/history-mode-configuration-controls.component.html","../../global-context/features/time-context/interval-picker/interval-picker.component.ts","../../global-context/features/time-context/interval-picker/interval-picker.component.html","../../global-context/features/time-context/time-range-picker/date-time-context-picker.component.ts","../../global-context/features/time-context/time-range-picker/date-time-context-picker.component.html","../../global-context/features/configuration/live-mode-configuration-controls/live-mode-configuration-controls.component.ts","../../global-context/features/configuration/live-mode-configuration-controls/live-mode-configuration-controls.component.html","../../global-context/features/configuration/configuration-controls/configuration-controls.component.ts","../../global-context/features/configuration/configuration-collapse/configuration-collapse.component.ts","../../global-context/features/configuration/configuration-collapse/configuration-collapse.component.html","../../global-context/services/infrastructure/global-context-query.service.ts","../../global-context/features/aggregation/aggregation-display/aggregation-display.component.ts","../../global-context/features/aggregation/aggregation-display/aggregation-display.component.html","../../global-context/features/refresh/auto-refresh/auto-refresh-control.component.ts","../../global-context/features/refresh/auto-refresh/auto-refresh-control.component.html","../../global-context/features/time-context/time-range-display/time-range-display.component.ts","../../global-context/features/time-context/time-range-display/time-range-display.component.html","../../global-context/shared/context-controls/context-controls.component.ts","../../global-context/shared/context-controls/context-controls.component.html","../../global-context/core/global-context.component.ts","../../global-context/core/global-context.component.html","../../global-context/services/infrastructure/global-context-navigation.service.ts","../../global-context/core/widget-inline/inline-link-controls.component.ts","../../global-context/core/widget-inline/inline-link-helpers.ts","../../global-context/core/widget-inline/orchestrator/config-composer.util.ts","../../global-context/core/widget-inline/inline-refresh-helpers.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-aggregation.helper.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-context.helper.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-refresh.helper.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-state.helper.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-toggle.helper.ts","../../global-context/core/widget-inline/orchestrator/validation.util.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-orchestrator.ts","../../global-context/core/widget-inline/orchestrator/history-mode-orchestrator.ts","../../global-context/core/widget-inline/orchestrator/live-mode-orchestrator.ts","../../global-context/core/widget-inline/orchestrator/global-context-inline-orchestrator.service.ts","../../global-context/core/global-context-inline.component.ts","../../global-context/core/global-context-inline.component.html","../../global-context/services/state/global-context-store.service.ts","../../global-context/core/global-context-config.component.ts","../../global-context/core/global-context-config.component.html","../../global-context/features/configuration/config-context-selector/config-context-selector.component.ts","../../global-context/core/global-context-widget-config.component.ts","../../global-context/core/index.ts","../../global-context/features/time-context/index.ts","../../global-context/features/refresh/realtime-control/realtime-control.component.ts","../../global-context/features/refresh/realtime-control/realtime-control.component.html","../../global-context/features/refresh/index.ts","../../global-context/features/configuration/index.ts","../../global-context/shared/preview-controls/preview-controls.component.ts","../../global-context/shared/preview-controls/preview-controls.component.html","../../global-context/shared/index.ts","../../global-context/integration/widget-controls/default-widget-template.ts","../../global-context/integration/widget-controls/widget-controls-factory.ts","../../global-context/integration/widget-controls/guards.ts","../../global-context/integration/widget-controls/update-helpers.ts","../../global-context/integration/widget-controls/widget-controls-presets.helpers.ts","../../global-context/integration/widget-controls/widget-controls-presets.ts","../../global-context/integration/widget-wrapper/global-context-widget-wrapper.component.ts","../../global-context/integration/presets/control-presets.ts","../../global-context/integration/config-mode-controls/config-mode-controls.component.ts","../../global-context/integration/context-controls/context-controls.component.ts","../../global-context/integration/link-buttons/link-buttons.component.ts","../../global-context/integration/global-context-connector/global-context-connector.component.ts","../../global-context/integration/local-controls/local-controls.component.ts","../../global-context/integration/index.ts","../../global-context/global-context.module.ts","../../global-context/c8y-ngx-components-global-context.ts"],"sourcesContent":["import { aggregationType } from '@c8y/client';\nimport { RefreshOption } from './auto-refresh.model';\nimport { LinkStatesMap } from './control-flow.model';\nimport { DateTimeContext } from './date-time-context-picker.model';\nimport { Interval, TimeInterval } from './interval-picker.model';\n\nexport const GLOBAL_CONTEXT_EVENTS = {\n STATE_CHANGE: 'GLOBAL_CONTEXT_STATE_CHANGE',\n REFRESH: 'REFRESH',\n REFRESH_OPTION_CHANGE: 'GLOBAL_CONTEXT_REFRESH_OPTION_CHANGE',\n UPDATE_GLOBAL_CONTEXT_LIVE: 'UPDATE_GLOBAL_CONTEXT_LIVE',\n UPDATE_GLOBAL_CONTEXT_HISTORY: 'UPDATE_GLOBAL_CONTEXT_HISTORY',\n INIT_GLOBAL_CONTEXT: 'INIT_GLOBAL_CONTEXT'\n} as const;\n\nexport enum GLOBAL_CONTEXT_DISPLAY_MODE {\n DASHBOARD = 'dashboard',\n CONFIG = 'config',\n VIEW_AND_CONFIG = 'view_and_config'\n}\n\nexport type GlobalContextKeys = (keyof GlobalContextState)[];\n\n/**\n * State object passed to widget state handlers\n */\nexport interface WidgetState {\n config?: GlobalContextState;\n inlineControlSettings?: Partial<GlobalContextSettings>;\n dashboardControlSettings?: Partial<GlobalContextSettings>;\n currentLinks?: LinkStatesMap;\n displayMode?: string;\n [key: string]: unknown;\n}\n\n/**\n * Result returned from widget state handlers\n */\nexport interface WidgetStateHandlerResult {\n inlineControlSettings: Partial<GlobalContextSettings>;\n dashboardControlSettings?: Partial<GlobalContextSettings>;\n links?: Partial<LinkStatesMap>;\n options?: { noAutoRefreshCounter?: boolean };\n}\n\nexport interface WidgetControls {\n supports: GlobalContextKeys;\n supportedModes?: RefreshOption[];\n options?: { noAutoRefreshCounter?: boolean };\n configSettings: {\n [mode in GLOBAL_CONTEXT_DISPLAY_MODE]?: {\n [option in RefreshOption]?: Partial<GlobalContextSettings>;\n };\n };\n settings: {\n [mode in GLOBAL_CONTEXT_DISPLAY_MODE]?: {\n [option in RefreshOption]?: Partial<GlobalContextSettings>;\n };\n };\n defaultLinks?: {\n [mode in GLOBAL_CONTEXT_DISPLAY_MODE]?: {\n [option in RefreshOption]?: LinkStatesMap;\n };\n };\n stateHandlers?: {\n [stateName: string]: (widgetState?: WidgetState) => WidgetStateHandlerResult;\n };\n}\n\n/** Settings to control which features are visible in the global context UI */\nexport interface GlobalContextSettings {\n showTimeContext: boolean;\n showAggregation: boolean;\n showAutoRefresh: boolean;\n showRefresh: boolean;\n showRefreshInterval: boolean;\n}\n\n/** Base interface for all global context events */\nexport interface GlobalContextEventBase<Type extends string, Payload> {\n type: Type;\n payload: Payload;\n timestamp?: number;\n}\n\n/**\n * Registry of all available global context events and their payloads\n *\n * Extend with new events by declaring module augmentation:\n * interface GlobalContextEventRegistry {\n * NEW_EVENT: boolean; // Add your event payload type\n * }\n */\nexport interface GlobalContextEventRegistry {\n [GLOBAL_CONTEXT_EVENTS.REFRESH]: {\n dateFrom?: string | Date;\n dateTo?: string | Date;\n interval?: TimeInterval;\n };\n [GLOBAL_CONTEXT_EVENTS.STATE_CHANGE]: Partial<GlobalContextState>;\n [GLOBAL_CONTEXT_EVENTS.REFRESH_OPTION_CHANGE]: RefreshOption;\n [GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_LIVE]: Partial<GlobalContextState>;\n [GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_HISTORY]: Partial<GlobalContextState>;\n [GLOBAL_CONTEXT_EVENTS.INIT_GLOBAL_CONTEXT]: void;\n}\n\n/** Union of all possible event type strings */\nexport type GlobalContextEventType = keyof GlobalContextEventRegistry;\n/** Union type of all possible global context events */\nexport type GlobalContextEventUnion = {\n [K in GlobalContextEventType]: GlobalContextEventBase<K, GlobalContextEventRegistry[K]>;\n}[GlobalContextEventType];\n\nexport enum DateContextQueryParamNames {\n DATE_CONTEXT_FROM = 'dateContextFrom',\n DATE_CONTEXT_TO = 'dateContextTo',\n DATE_CONTEXT_INTERVAL = 'dateContextInterval',\n DATE_CONTEXT_AGGREGATION = 'dateContextAggregation',\n DATE_CONTEXT_AUTO_REFRESH = 'globalContextAutoRefresh',\n DATE_CONTEXT_REFRESH_MODE = 'globalContextRefreshMode'\n}\n\ntype DateContextFromToQueryParams = {\n [DateContextQueryParamNames.DATE_CONTEXT_FROM]: string;\n [DateContextQueryParamNames.DATE_CONTEXT_TO]: string;\n [DateContextQueryParamNames.DATE_CONTEXT_INTERVAL]?: never;\n};\n\ntype DateContextIntervalQueryParams = {\n [DateContextQueryParamNames.DATE_CONTEXT_FROM]?: never;\n [DateContextQueryParamNames.DATE_CONTEXT_TO]?: never;\n [DateContextQueryParamNames.DATE_CONTEXT_INTERVAL]: Interval['id'];\n};\n\n/**\n * Input query params is an object representing all possible query params related to widget time context.\n * It can be provided by user typing them in browser URL address bar, so all of them should be considered.\n */\nexport type InputDateContextQueryParams = {\n [DateContextQueryParamNames.DATE_CONTEXT_FROM]?: string;\n [DateContextQueryParamNames.DATE_CONTEXT_TO]?: string;\n [DateContextQueryParamNames.DATE_CONTEXT_INTERVAL]?: Interval['id'];\n [DateContextQueryParamNames.DATE_CONTEXT_AGGREGATION]?: aggregationType;\n [DateContextQueryParamNames.DATE_CONTEXT_AUTO_REFRESH]?: boolean;\n [DateContextQueryParamNames.DATE_CONTEXT_REFRESH_MODE]?: string;\n};\n\n/**\n * Output query params is an object representing params that are applied to current URL in browser address bar.\n * These params are set programmatically.\n * Time context interval and time range described by date \"from\" and date \"to\" exclude each other.\n */\nexport type OutputDateContextQueryParams = (\n | DateContextFromToQueryParams\n | DateContextIntervalQueryParams\n) & {\n [DateContextQueryParamNames.DATE_CONTEXT_AGGREGATION]: aggregationType;\n};\n\nexport type GlobalContextDisplayMode = `${GLOBAL_CONTEXT_DISPLAY_MODE}`;\n\nexport const GLOBAL_CONTEXT_SOURCE = {\n WIDGET: 'widget',\n DASHBOARD: 'dashboard'\n} as const;\n\nexport type GlobalContextSource =\n (typeof GLOBAL_CONTEXT_SOURCE)[keyof typeof GLOBAL_CONTEXT_SOURCE];\n\n// TODO: This type should extend ContextWidgetConfig from @c8y/ngx-components/context-dashboard\n// but importing it creates a circular dependency (global-context <-> context-dashboard)\nexport interface GlobalContextState {\n dateTimeContext?: DateTimeContext;\n aggregation?: aggregationType | null;\n isAutoRefreshEnabled?: boolean;\n refreshInterval?: number;\n refreshOption?: RefreshOption;\n displayMode?: `${GLOBAL_CONTEXT_DISPLAY_MODE}`;\n source?: GlobalContextSource;\n eventSourceId?: string;\n /**\n * Flag indicating global context values have been applied.\n * For dashboard mode, widgets should wait for this flag before processing config.\n */\n isGlobalContextReady?: boolean;\n}\n\n/**\n * Interface for date context parameters passed to setDateContextQueryParams method.\n * Provides strong typing for all possible parameters.\n */\nexport interface DateContextParams {\n /** Time interval ID ('DAYS', 'HOURS', etc.) or 'custom' for date ranges */\n interval?: Interval['id'];\n /** Array containing [dateFrom, dateTo] strings or Date objects for custom date ranges */\n date?: (string | Date)[] | null;\n /** Data aggregation type ('HOURLY', 'DAILY', etc.) */\n aggregation?: aggregationType;\n /** Whether auto-refresh should be enabled */\n isAutoRefreshEnabled?: boolean;\n /** Refresh mode ('live' or 'history') */\n refreshOption?: RefreshOption;\n}\n\n/**\n * Result type for query parameter validation status.\n * Provides detailed validation information for debugging and UI state management.\n */\nexport interface ParameterValidationStatus {\n /** True if interval parameter is valid and selectable */\n interval: boolean;\n /** True if aggregation parameter is valid */\n aggregation: boolean;\n /** True if both dateFrom and dateTo form a valid date range */\n dateRange: boolean;\n /** Parsed boolean value, or undefined if invalid/missing */\n autoRefresh: boolean | undefined;\n}\n\nexport const WIDGET_DISPLAY_MODE = {\n INLINE: 'inline',\n CONFIG: 'config',\n PREVIEW: 'preview'\n} as const;\n\nexport type WidgetDisplayMode = (typeof WIDGET_DISPLAY_MODE)[keyof typeof WIDGET_DISPLAY_MODE];\n\nexport interface GlobalContextEvent {\n context: Partial<GlobalContextState>;\n diff: Partial<GlobalContextState>;\n}\n","export const REFRESH_OPTION = {\n LIVE: 'live',\n HISTORY: 'history'\n} as const;\n\nexport type RefreshOption = (typeof REFRESH_OPTION)[keyof typeof REFRESH_OPTION];\n","import { gettext } from '@c8y/ngx-components/gettext';\n\nconst todayDate = new Date();\n\nexport const TIME_SPAN_MS = {\n MINUTE: 1000 * 60,\n HOUR: 1000 * 60 * 60,\n DAY: 1000 * 60 * 60 * 24,\n WEEK: 1000 * 60 * 60 * 24 * 7,\n MONTH: todayDate.valueOf() - new Date(todayDate.setMonth(todayDate.getMonth() - 1)).valueOf()\n} as const;\n\nexport const TIME_INTERVAL = {\n NONE: 'none',\n MINUTES: 'minutes',\n HOURS: 'hours',\n DAYS: 'days',\n WEEKS: 'weeks',\n MONTHS: 'months',\n CUSTOM: 'custom'\n} as const;\n\nexport type TimeInterval = (typeof TIME_INTERVAL)[keyof typeof TIME_INTERVAL];\n\nexport type Interval = {\n id: 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'custom' | string;\n title: string;\n timespanInMs?: number;\n};\n\nexport type AlarmFilterInterval =\n | Interval\n | {\n id: 'none';\n title: string;\n timespanInMs?: number;\n };\n\nexport const INTERVALS: Interval[] = [\n {\n id: 'minutes',\n title: gettext('Last minute'),\n timespanInMs: TIME_SPAN_MS.MINUTE\n },\n {\n id: 'hours',\n title: gettext('Last hour'),\n timespanInMs: TIME_SPAN_MS.HOUR\n },\n {\n id: 'days',\n title: gettext('Last day'),\n timespanInMs: TIME_SPAN_MS.DAY\n },\n {\n id: 'weeks',\n title: gettext('Last week'),\n timespanInMs: TIME_SPAN_MS.WEEK\n },\n {\n id: 'months',\n title: gettext('Last month'),\n timespanInMs: TIME_SPAN_MS.MONTH\n },\n { id: 'custom', title: gettext('Custom') }\n];\n\nexport const INTERVAL_TITLES: Record<AlarmFilterInterval['id'], string> = {\n none: gettext('No date filter'),\n minutes: gettext('Last minute'),\n hours: gettext('Last hour'),\n days: gettext('Last day'),\n weeks: gettext('Last week'),\n months: gettext('Last month'),\n custom: gettext('Custom')\n};\n","import { REFRESH_OPTION } from './auto-refresh.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE } from './global-context.model';\nimport { TIME_INTERVAL } from './interval-picker.model';\n\n/**\n * Default values for global context configuration\n * Single source of truth for all default values across the global context feature\n */\nexport const GLOBAL_CONTEXT_DEFAULTS = {\n /** Default refresh option - live mode */\n REFRESH_OPTION: REFRESH_OPTION.LIVE,\n\n /** Default auto-refresh state */\n IS_AUTO_REFRESH_ENABLED: true,\n\n /** Default refresh interval in milliseconds (5 seconds) */\n REFRESH_INTERVAL: 5000,\n\n /** Default aggregation type */\n AGGREGATION: null,\n\n /** Default display mode */\n DISPLAY_MODE: GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD,\n\n /** Default date range duration in milliseconds (1 hour) */\n DATE_RANGE_DURATION_MS: 60 * 60 * 1000,\n\n /** Default time interval for custom ranges */\n TIME_INTERVAL: TIME_INTERVAL.HOURS\n} as const;\n","import { gettext } from '@c8y/ngx-components/gettext';\nimport { GlobalContextSettings, GlobalContextState } from './global-context.model';\n\n/**\n * Define the mapping between GlobalContextState keys and their equivalent in GlobalContextSettings\n */\nexport const LINK_BTNS_CONFIG: {\n [K in Extract<\n keyof GlobalContextState,\n 'dateTimeContext' | 'aggregation' | 'isAutoRefreshEnabled'\n >]: {\n /** Form control name, same as global state key */\n formControlName: K;\n /** Setting key in GlobalContextSettings */\n settingKey: keyof GlobalContextSettings;\n /** User-friendly label for UI */\n label: string;\n /** Css Class for link button visualization */\n cssClass: string;\n icon: string;\n };\n} = {\n dateTimeContext: {\n formControlName: 'dateTimeContext',\n settingKey: 'showTimeContext',\n label: gettext('date/time'),\n cssClass: 'time-context',\n icon: 'calendar'\n },\n isAutoRefreshEnabled: {\n formControlName: 'isAutoRefreshEnabled',\n settingKey: 'showAutoRefresh',\n label: gettext('auto refresh'),\n cssClass: 'auto-refresh',\n icon: 'refresh'\n },\n aggregation: {\n formControlName: 'aggregation',\n settingKey: 'showAggregation',\n label: gettext('aggregation'),\n cssClass: 'aggregation',\n icon: 'input'\n }\n} as const;\n\n/**\n * Type for link toggle event\n */\nexport interface LinkToggleEvent {\n key: Extract<\n keyof GlobalContextState,\n 'dateTimeContext' | 'aggregation' | 'isAutoRefreshEnabled'\n >;\n isLinked: boolean;\n}\n\n/**\n * Type for link states map\n */\nexport type LinkStatesMap = Partial<\n Record<\n Extract<keyof GlobalContextState, 'dateTimeContext' | 'aggregation' | 'isAutoRefreshEnabled'>,\n boolean\n >\n>;\n\n/**\n * Type for control configs map\n */\nexport type ControlConfigsMap = Partial<\n Record<\n Extract<keyof GlobalContextState, 'dateTimeContext' | 'aggregation' | 'isAutoRefreshEnabled'>,\n {\n cssClass?: string;\n linkTooltip?: string;\n unlinkTooltip?: string;\n icon?: string;\n disabled?: boolean;\n disabledTooltip?: string;\n autoUnlinked?: boolean;\n }\n >\n>;\n","import { aggregationType } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TIME_SPAN_MS } from './interval-picker.model';\n\nexport type Aggregation = {\n id: aggregationType | null;\n title: string;\n};\n\nexport const AGGREGATIONS: Aggregation[] = [\n { id: null, title: gettext('None') },\n { id: aggregationType.MINUTELY, title: gettext('Minutely') },\n { id: aggregationType.HOURLY, title: gettext('Hourly') },\n { id: aggregationType.DAILY, title: gettext('Daily') }\n];\n\nexport const AGGREGATION_LIMITS = {\n MINUTELY_LIMIT: TIME_SPAN_MS.MINUTE * 10,\n HOURLY_LIMIT: TIME_SPAN_MS.DAY * 1,\n DAILY_LIMIT: TIME_SPAN_MS.DAY * 4\n};\n\nexport const AGGREGATION_ICON_TYPE = {\n UNDEFINED: 'line-chart',\n MINUTELY: 'hourglass',\n HOURLY: 'clock-o',\n DAILY: 'calendar-o'\n} as const;\n\nexport type AggregationIconType =\n (typeof AGGREGATION_ICON_TYPE)[keyof typeof AGGREGATION_ICON_TYPE];\n\nexport const AGGREGATION_ICONS: Record<aggregationType | 'undefined', AggregationIconType> = {\n undefined: AGGREGATION_ICON_TYPE.UNDEFINED,\n MINUTELY: AGGREGATION_ICON_TYPE.MINUTELY,\n HOURLY: AGGREGATION_ICON_TYPE.HOURLY,\n DAILY: AGGREGATION_ICON_TYPE.DAILY\n};\n\nexport const AGGREGATION_TEXTS: Record<\n aggregationType | 'undefined' | 'null' | 'disabled',\n string\n> = {\n disabled: gettext('No aggregation with realtime enabled'),\n undefined: gettext('No aggregation'),\n null: gettext('No aggregation'),\n MINUTELY: gettext('Minutely aggregation'),\n HOURLY: gettext('Hourly aggregation'),\n DAILY: gettext('Daily aggregation')\n};\n\nexport const AGGREGATION_VALUES = {\n none: 'NONE',\n minutely: aggregationType.MINUTELY,\n hourly: aggregationType.HOURLY,\n daily: aggregationType.DAILY\n} as const;\n\nexport const AGGREGATION_VALUES_ARR = [\n AGGREGATION_VALUES.none,\n AGGREGATION_VALUES.minutely,\n AGGREGATION_VALUES.hourly,\n AGGREGATION_VALUES.daily\n] as const;\n\nexport const AGGREGATION_LABELS = {\n NONE: AGGREGATIONS[0].title,\n [aggregationType.MINUTELY]: AGGREGATIONS[1].title,\n [aggregationType.HOURLY]: AGGREGATIONS[2].title,\n [aggregationType.DAILY]: AGGREGATIONS[3].title\n} as const;\n\n/**\n * Represents the available aggregation options.\n * Aggregation 'none' is not handled by our backend.\n */\nexport type AggregationOption = typeof AGGREGATION_VALUES.none | `${aggregationType}`;\n/**\n * Represents the status of aggregation options.\n * Used to determine which aggregation options should be disabled.\n */\nexport type AggregationOptionStatus = {\n [key in AggregationOption]?: boolean;\n};\n\nexport interface AggregationState {\n aggregationType: aggregationType;\n isDisabled: boolean;\n}\n","/**\n * Time duration constants (ms)\n */\nexport const TIME_DURATION = {\n /** One hour in milliseconds */\n ONE_HOUR_MS: 60 * 60 * 1000,\n /** One minute in milliseconds */\n ONE_MINUTE_MS: 60 * 1000,\n /** One second in milliseconds */\n ONE_SECOND_MS: 1000\n} as const;\n\n/**\n * Timing constants for debouncing and throttling\n */\nexport const TIMING = {\n /** Debounce time for form value changes (ms) */\n FORM_DEBOUNCE: 100,\n /** Throttle time for context changes (ms) */\n CONTEXT_THROTTLE: 200,\n /** Tooltip delay time (ms) */\n TOOLTIP_DELAY: 500,\n /** Default debounce time (ms) */\n DEFAULT_DEBOUNCE: 100\n} as const;\n\n/**\n * UI priority constants\n */\nexport const UI_PRIORITIES = {\n /** High priority for configuration controls */\n CONFIGURATION_PRIORITY: 1000\n} as const;\n","import { DateTimeContext } from '../models/date-time-context-picker.model';\nimport { INTERVALS, TIME_INTERVAL, TimeInterval } from '../models/interval-picker.model';\n\n/**\n * Central utility for all DateTimeContext operations.\n * Single source of truth for date validation, conversion, and context normalization.\n */\nexport class DateTimeContextUtil {\n /**\n * Converts a value to a Date object, handling various input types.\n * Allows JavaScript's natural type coercion for compatibility with existing tests.\n */\n static toDate(value: unknown): Date | null {\n // Handle undefined explicitly - new Date(undefined) is Invalid Date\n if (value === undefined) {\n return null;\n }\n\n // Already a Date object\n if (value instanceof Date) {\n return isNaN(value.getTime()) ? null : value;\n }\n\n // Let JavaScript's natural type coercion handle all other cases\n // This allows null, false, true, numbers, strings to be handled like new Date() would\n const date = new Date(value as never);\n return isNaN(date.getTime()) ? null : date;\n }\n\n /**\n * Converts a date value to ISO string format.\n */\n static toIso(value: Date | string | null | undefined): string | null {\n const date = this.toDate(value);\n return date ? date.toISOString() : null;\n }\n\n /**\n * Normalizes an ISO string to remove milliseconds (sets to .000Z).\n * This ensures date comparisons ignore millisecond precision.\n *\n * @param isoString - ISO date string (e.g., \"2025-10-27T15:10:04.405Z\")\n * @returns ISO string with milliseconds zeroed (e.g., \"2025-10-27T15:10:04.000Z\")\n */\n static normalizeIsoToSeconds(isoString: string | null | undefined): string | null {\n if (!isoString || typeof isoString !== 'string') {\n return null;\n }\n\n // Parse the ISO string to a Date\n const date = this.toDate(isoString);\n if (!date) {\n return null;\n }\n\n // Set milliseconds to 0\n date.setMilliseconds(0);\n return date.toISOString();\n }\n\n /**\n * Validates if a single date value is valid.\n * Only accepts Date objects and valid date strings (not numbers, null, etc.)\n * This is the strict validation used for form inputs and user-facing APIs.\n */\n static isValidDate(value: unknown): boolean {\n // Only accept Date instances or strings\n if (value instanceof Date) {\n return !isNaN(value.getTime());\n }\n if (typeof value === 'string') {\n const date = new Date(value);\n return !isNaN(date.getTime());\n }\n return false;\n }\n\n /**\n * Validates if a value can be converted to a valid date.\n * Uses JavaScript's natural type coercion, accepting null, numbers, booleans, etc.\n * This is used internally for range validation.\n */\n static isCoercibleToDate(value: unknown): boolean {\n return this.toDate(value) !== null;\n }\n\n /**\n * Validates if a date range is valid (from < to).\n */\n static isValidRange(from: unknown, to: unknown): boolean {\n const fromDate = this.toDate(from);\n const toDate = this.toDate(to);\n\n // Both dates must be valid and fromDate must be before toDate\n return fromDate !== null && toDate !== null && fromDate < toDate;\n }\n\n /**\n * Validates if a date range is valid, allowing equal dates (from <= to).\n */\n static isValidRangeOrEqual(from: unknown, to: unknown): boolean {\n const fromDate = this.toDate(from);\n const toDate = this.toDate(to);\n\n // Both dates must be valid and fromDate must be before or equal to toDate\n return fromDate !== null && toDate !== null && fromDate <= toDate;\n }\n\n /**\n * Calculates date range from an interval.\n * Pure implementation based on INTERVALS configuration.\n */\n static dateRangeFromInterval(\n interval: TimeInterval,\n now: Date = new Date()\n ): [Date, Date] | null {\n // Special case: 'none' returns epoch to current time\n if (interval === 'none') {\n return [new Date(0), now];\n }\n\n // Special case: 'custom' has no default range\n if (interval === TIME_INTERVAL.CUSTOM) {\n return null;\n }\n\n // Find the interval configuration\n const intervalConfig = INTERVALS.find(({ id }) => id === interval);\n if (!intervalConfig || !intervalConfig.timespanInMs) {\n return null;\n }\n\n // Calculate date range: current time minus interval timespan\n const dateTo = new Date(now);\n const dateFrom = new Date(dateTo.valueOf() - intervalConfig.timespanInMs);\n return [dateFrom, dateTo];\n }\n\n /**\n * Ensures all dates in a DateTimeContext are ISO strings with milliseconds normalized to .000Z.\n */\n static ensureIsoContext(ctx: Partial<DateTimeContext>): DateTimeContext {\n const result: DateTimeContext = {\n interval: ctx.interval || TIME_INTERVAL.CUSTOM,\n dateFrom: null,\n dateTo: null\n };\n\n if (ctx.dateFrom) {\n const iso = this.toIso(ctx.dateFrom);\n result.dateFrom = this.normalizeIsoToSeconds(iso);\n }\n if (ctx.dateTo) {\n const iso = this.toIso(ctx.dateTo);\n result.dateTo = this.normalizeIsoToSeconds(iso);\n }\n\n return result;\n }\n\n /**\n * Normalizes a DateTimeContext for live mode.\n * - For non-custom intervals: recomputes range based on current time\n * - For custom interval: updates dateTo to current time\n */\n static normalizeForLive(ctx: Partial<DateTimeContext>, now: Date = new Date()): DateTimeContext {\n const interval = ctx.interval || TIME_INTERVAL.CUSTOM;\n\n if (interval !== TIME_INTERVAL.CUSTOM) {\n // Recompute range from interval\n const range = this.dateRangeFromInterval(interval, now);\n if (range) {\n return this.ensureIsoContext({\n interval,\n dateFrom: range[0],\n dateTo: range[1]\n });\n }\n }\n\n // For custom interval, keep dateFrom but update dateTo to now\n return this.ensureIsoContext({\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: ctx.dateFrom,\n dateTo: now\n });\n }\n\n /**\n * Normalizes a DateTimeContext for history mode.\n * Forces interval to CUSTOM and preserves explicit date range.\n */\n static normalizeForHistory(ctx: Partial<DateTimeContext>): DateTimeContext {\n return this.ensureIsoContext({\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: ctx.dateFrom,\n dateTo: ctx.dateTo\n });\n }\n\n /**\n * Type guard to check if a value is a valid DateTimeContext object.\n */\n static isValidDateTimeContext(context: unknown): context is DateTimeContext {\n if (!context || typeof context !== 'object') return false;\n\n const ctx = context as Record<string, unknown>;\n\n const hasDates = 'dateFrom' in ctx && 'dateTo' in ctx && 'interval' in ctx;\n if (!hasDates) return false;\n\n return (\n typeof ctx.interval === 'string' &&\n ctx.interval.length > 0 &&\n this.isValidDate(ctx.dateFrom) &&\n this.isValidDate(ctx.dateTo)\n );\n }\n\n /**\n * Checks if a partial DateTimeContext has all required fields.\n * Business logic: Allow single field updates or complete updates (all 3 fields),\n * but reject incomplete updates with 2 fields.\n */\n static isCompleteDateTimeContext(\n diff: Partial<{ dateTimeContext: Partial<DateTimeContext> }>\n ): boolean {\n // If no dateTimeContext in diff, it's considered complete\n if (!('dateTimeContext' in diff) || !diff.dateTimeContext) {\n return true;\n }\n\n const keys = Object.keys(diff.dateTimeContext);\n // Allow single field updates (e.g., just interval) or complete updates (all 3 fields)\n // Reject incomplete updates with 2 fields\n return keys.length === 1 || keys.length === 3;\n }\n\n /**\n * Formats a context for emission, ensuring ISO dates and filtering by supported fields.\n */\n static formatForEmission(\n context: Partial<{ dateTimeContext: Partial<DateTimeContext> }>,\n supports: string[]\n ): Partial<{ dateTimeContext: DateTimeContext }> {\n if (!supports.includes('dateTimeContext') || !context.dateTimeContext) {\n return {};\n }\n\n const dateTimeContext = context.dateTimeContext;\n\n // For live mode with custom interval, default dateTo to now if missing\n if (dateTimeContext.interval === TIME_INTERVAL.CUSTOM && !dateTimeContext.dateTo) {\n return {\n dateTimeContext: this.ensureIsoContext({\n ...dateTimeContext,\n dateTo: new Date()\n })\n };\n }\n\n return {\n dateTimeContext: this.ensureIsoContext(dateTimeContext)\n };\n }\n}\n","import { GLOBAL_CONTEXT_DEFAULTS } from '../models/global-context-defaults';\nimport type { DateTimeContext } from '../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../models/global-context.model';\nimport { DateTimeContextUtil } from './date-time-context.util';\n\n/**\n * Creates a complete default global context state\n *\n * @returns A complete GlobalContextState with all required properties set to sensible defaults\n */\nexport function createDefaultGlobalContextState(): GlobalContextState {\n const now = new Date();\n const dateFrom = new Date(now.getTime() - GLOBAL_CONTEXT_DEFAULTS.DATE_RANGE_DURATION_MS);\n\n return {\n dateTimeContext: {\n dateFrom: dateFrom.toISOString(),\n dateTo: now.toISOString(),\n interval: GLOBAL_CONTEXT_DEFAULTS.TIME_INTERVAL\n },\n refreshOption: GLOBAL_CONTEXT_DEFAULTS.REFRESH_OPTION,\n isAutoRefreshEnabled: GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n aggregation: GLOBAL_CONTEXT_DEFAULTS.AGGREGATION,\n displayMode: GLOBAL_CONTEXT_DEFAULTS.DISPLAY_MODE\n };\n}\n\n/**\n * Fills missing or invalid properties in a partial global context state with defaults\n *\n * @param state - Partial global context state that may have missing or invalid values\n * @returns Complete GlobalContextState with all required properties\n */\nexport function fillMissingDefaults(state: Partial<GlobalContextState>): GlobalContextState {\n const defaults = createDefaultGlobalContextState();\n\n // Use central utility to ensure ISO formatting for dateTimeContext\n const dateTimeContext = state.dateTimeContext\n ? DateTimeContextUtil.ensureIsoContext({\n ...defaults.dateTimeContext,\n ...state.dateTimeContext,\n // Use defaults for invalid dates\n dateFrom: DateTimeContextUtil.isValidDate(state.dateTimeContext?.dateFrom)\n ? state.dateTimeContext.dateFrom\n : defaults.dateTimeContext.dateFrom,\n dateTo: DateTimeContextUtil.isValidDate(state.dateTimeContext?.dateTo)\n ? state.dateTimeContext.dateTo\n : defaults.dateTimeContext.dateTo,\n interval: state.dateTimeContext?.interval || defaults.dateTimeContext.interval\n })\n : defaults.dateTimeContext;\n\n return {\n ...defaults,\n ...state,\n dateTimeContext,\n // Always override refreshInterval to use the fixed 5s default\n // This ensures old dashboards with custom intervals are migrated to the new fixed interval\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL\n };\n}\n\n/**\n * Validates if a value is a valid date (either Date object or ISO string)\n * Delegates to central utility for consistency.\n *\n * @param value - Value to validate (string, Date, or undefined)\n * @returns true if the value represents a valid date\n */\nexport function isValidDateValue(value: string | Date | undefined): value is string | Date {\n return DateTimeContextUtil.isValidDate(value);\n}\n\n/**\n * Checks if a date time context object has all required valid properties\n * Delegates to central utility for consistency.\n *\n * @param context - DateTimeContext to validate\n * @returns true if the context is complete and valid\n */\nexport function isValidDateTimeContext(context: unknown): context is DateTimeContext {\n return DateTimeContextUtil.isValidDateTimeContext(context);\n}\n\n/**\n * Checks if a dateTimeContext diff object is complete (has all 3 required fields).\n * Delegates to central utility for consistency.\n *\n * @param diff - Partial state that may contain dateTimeContext\n * @returns true if dateTimeContext is absent, has only 1 field, or has all 3 fields; false if it has 2 fields (incomplete)\n */\nexport function isCompleteDateTimeContext(diff: Partial<GlobalContextState>): boolean {\n return DateTimeContextUtil.isCompleteDateTimeContext(diff);\n}\n\n/**\n * Formats dateTimeContext for emission, handling date conversions and defaults.\n * Delegates to central utility for consistency.\n *\n * @param context - Global context state to format\n * @param supports - Array of supported fields from widget template\n * @returns Formatted context with properly formatted dateTimeContext\n */\nexport function formatDateTimeContextForEmission(\n context: Partial<GlobalContextState>,\n supports: string[]\n): Partial<GlobalContextState> {\n const result = DateTimeContextUtil.formatForEmission(context, supports);\n\n // Merge back with original context to preserve other fields\n return {\n ...context,\n ...result\n };\n}\n","import { computed, Injectable, signal } from '@angular/core';\nimport { ViewContext } from '@c8y/ngx-components';\nimport { BehaviorSubject, distinctUntilChanged, map, Observable, shareReplay } from 'rxjs';\nimport { GlobalContextSettings, GlobalContextState } from '../../models/global-context.model';\nimport { createDefaultGlobalContextState } from '../../utils/global-context-defaults.util';\n\n/**\n * Interface representing a registered widget's global context settings with its unique identifier.\n */\ninterface RegisteredGlobalContextSettings extends Partial<GlobalContextSettings> {\n /** Unique identifier for the widget that registered these settings */\n readonly id: string;\n}\n\n/**\n * Default settings applied when no widgets have registered any settings.\n */\nconst DEFAULT_GLOBAL_CONTEXT_SETTINGS: GlobalContextSettings = {\n showTimeContext: false,\n showAggregation: false,\n showAutoRefresh: false,\n showRefresh: false,\n showRefreshInterval: false\n} as const;\n\n/**\n * GlobalContextService manages widget settings registration and loading states.\n *\n * This service is responsible for:\n * - Registering and managing widget-specific global context settings\n * - Consolidating settings from multiple widgets using OR logic\n * - Tracking loading states across multiple widgets\n * - Providing default configurations for the global context\n *\n * @example\n * ```typescript\n * // Register widget settings\n * globalContextService.register('widget-1', { showTimeContext: true });\n *\n * // Get consolidated settings from all widgets\n * globalContextService.getConsolidatedSettings().subscribe(settings => {\n * console.log(settings); // { showTimeContext: true, ... }\n * });\n *\n * // Track loading state\n * globalContextService.registerLoading('widget-1');\n * console.log(globalContextService.isLoading()); // true\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextService {\n /**\n * Computed signal that indicates if any widgets are currently in a loading state.\n * Returns true if at least one widget has registered a loading state.\n */\n readonly isLoading = computed(() => this.loadingIds().size > 0);\n\n /** Target context for the global context service */\n protected readonly targetContext: ViewContext.Device | ViewContext.Group = ViewContext.Group;\n\n /** Observable stream of all registered widget settings */\n private readonly settings$ = new BehaviorSubject<readonly RegisteredGlobalContextSettings[]>([]);\n\n /** Signal storing unique identifiers of widgets currently in loading state */\n private readonly loadingIds = signal<Set<string>>(new Set());\n\n /**\n * Registers global context settings for a specific widget.\n * If settings for the same widget ID already exist, they will be updated.\n *\n * @param id - Unique identifier for the widget\n * @param settings - Partial global context settings to register\n *\n * @throws {Error} When id is empty or null\n *\n * @example\n * ```typescript\n * globalContextService.register('my-widget', {\n * showTimeContext: true,\n * showAutoRefresh: false\n * });\n * ```\n */\n register(id: string, settings: Partial<GlobalContextSettings>): void {\n this.validateWidgetId(id);\n\n const registeredSettings: RegisteredGlobalContextSettings = {\n ...settings,\n id\n };\n\n const currentSettings = this.settings$.value;\n const existingIndex = this.findSettingsIndex(id, currentSettings);\n\n if (existingIndex >= 0) {\n this.updateExistingSettings(existingIndex, registeredSettings, currentSettings);\n } else {\n this.addNewSettings(registeredSettings, currentSettings);\n }\n }\n\n /**\n * Retrieves all currently registered widget settings.\n *\n * @returns Array of all registered settings with their widget IDs\n */\n getSettings(): readonly RegisteredGlobalContextSettings[] {\n return this.settings$.value;\n }\n\n /**\n * Removes all registered widget settings.\n * This will cause the consolidated settings to return to default values.\n */\n resetSettings(): void {\n this.settings$.next([]);\n }\n\n /**\n * Unregisters settings for a specific widget.\n *\n * @param id - Unique identifier of the widget to unregister\n *\n * @example\n * ```typescript\n * globalContextService.unregister('my-widget');\n * ```\n */\n unregister(id: string): void {\n if (!id) return; // Silently ignore invalid IDs\n\n const currentSettings = this.settings$.value;\n const filteredSettings = currentSettings.filter(s => s.id !== id);\n\n if (filteredSettings.length !== currentSettings.length) {\n this.settings$.next(filteredSettings);\n }\n }\n\n /**\n * Returns an observable of consolidated global context settings.\n *\n * Settings are consolidated using OR logic - if any widget requires a setting to be shown,\n * it will be included in the consolidated result. The observable emits distinct values only\n * and is shared among all subscribers for optimal performance.\n *\n * @returns Observable that emits consolidated settings whenever they change\n *\n * @example\n * ```typescript\n * globalContextService.getConsolidatedSettings().subscribe(settings => {\n * if (settings.showTimeContext) {\n * // Show time context controls\n * }\n * });\n * ```\n */\n getConsolidatedSettings(): Observable<GlobalContextSettings> {\n return this.settings$.pipe(\n map(settingsArray => this.consolidateSettings(settingsArray)),\n distinctUntilChanged(this.areSettingsEqual),\n shareReplay(1)\n );\n }\n\n /**\n * Returns the default global context settings.\n * These settings are used when no widgets have registered any settings.\n *\n * @returns Default settings object with all options disabled\n */\n getDefaultSettings(): GlobalContextSettings {\n return { ...DEFAULT_GLOBAL_CONTEXT_SETTINGS };\n }\n\n /**\n * Registers a loading state for a specific widget.\n * This will cause the `isLoading` computed signal to return true.\n *\n * @param id - Unique identifier of the widget in loading state\n *\n * @example\n * ```typescript\n * globalContextService.registerLoading('my-widget');\n * console.log(globalContextService.isLoading()); // true\n * ```\n */\n registerLoading(id: string): void {\n if (!id) return; // Silently ignore invalid IDs\n\n this.loadingIds.update(ids => {\n const newIds = new Set(ids);\n newIds.add(id);\n return newIds;\n });\n }\n\n /**\n * Unregisters a loading state for a specific widget.\n * When no widgets are in loading state, `isLoading` will return false.\n *\n * @param id - Unique identifier of the widget to remove from loading state\n *\n * @example\n * ```typescript\n * globalContextService.unregisterLoading('my-widget');\n * ```\n */\n unregisterLoading(id: string): void {\n if (!id) return; // Silently ignore invalid IDs\n\n this.loadingIds.update(ids => {\n const newIds = new Set(ids);\n newIds.delete(id);\n return newIds;\n });\n }\n\n /**\n * Returns the default global context state.\n * This state is used as the initial configuration for new global context instances.\n *\n * @returns Default global context state with live refresh enabled and 1-minute time range\n *\n * @example\n * ```typescript\n * const defaultState = globalContextService.getDefaultState();\n * console.log(defaultState.refreshOption); // 'live'\n * ```\n */\n getDefaultState(): GlobalContextState {\n return createDefaultGlobalContextState();\n }\n\n /**\n * Validates that a widget ID is not empty or null.\n *\n * @param id - Widget ID to validate\n * @throws {Error} When ID is invalid\n */\n private validateWidgetId(id: string): void {\n if (!id || id.trim().length === 0) {\n throw new Error('Widget ID cannot be empty or null');\n }\n }\n\n /**\n * Finds the index of settings for a given widget ID.\n *\n * @param id - Widget ID to search for\n * @param settings - Array of settings to search in\n * @returns Index of the settings or -1 if not found\n */\n private findSettingsIndex(\n id: string,\n settings: readonly RegisteredGlobalContextSettings[]\n ): number {\n return settings.findIndex(s => s.id === id);\n }\n\n /**\n * Updates existing settings for a widget.\n *\n * @param index - Index of the settings to update\n * @param newSettings - New settings to apply\n * @param currentSettings - Current settings array\n */\n private updateExistingSettings(\n index: number,\n newSettings: RegisteredGlobalContextSettings,\n currentSettings: readonly RegisteredGlobalContextSettings[]\n ): void {\n const updatedSettings = [...currentSettings];\n updatedSettings[index] = newSettings;\n this.settings$.next(updatedSettings);\n }\n\n /**\n * Adds new settings to the settings array.\n *\n * @param newSettings - Settings to add\n * @param currentSettings - Current settings array\n */\n private addNewSettings(\n newSettings: RegisteredGlobalContextSettings,\n currentSettings: readonly RegisteredGlobalContextSettings[]\n ): void {\n this.settings$.next([...currentSettings, newSettings]);\n }\n\n /**\n * Consolidates multiple widget settings using OR logic.\n *\n * @param settingsArray - Array of widget settings to consolidate\n * @returns Consolidated settings object\n */\n private consolidateSettings(\n settingsArray: readonly RegisteredGlobalContextSettings[]\n ): GlobalContextSettings {\n return settingsArray.reduce(\n (consolidated, current) => ({\n showTimeContext: consolidated.showTimeContext || !!current.showTimeContext,\n showAggregation: consolidated.showAggregation || !!current.showAggregation,\n showAutoRefresh: consolidated.showAutoRefresh || !!current.showAutoRefresh,\n showRefresh: consolidated.showRefresh || !!current.showRefresh,\n showRefreshInterval: consolidated.showRefreshInterval || !!current.showRefreshInterval\n }),\n { ...DEFAULT_GLOBAL_CONTEXT_SETTINGS }\n );\n }\n\n /**\n * Compares two settings objects for deep equality.\n *\n * @param prev - Previous settings\n * @param curr - Current settings\n * @returns True if settings are equal, false otherwise\n */\n private areSettingsEqual(prev: GlobalContextSettings, curr: GlobalContextSettings): boolean {\n return (\n prev.showTimeContext === curr.showTimeContext &&\n prev.showAggregation === curr.showAggregation &&\n prev.showAutoRefresh === curr.showAutoRefresh &&\n prev.showRefresh === curr.showRefresh &&\n prev.showRefreshInterval === curr.showRefreshInterval\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { FormBuilder, type FormGroup } from '@angular/forms';\nimport { omit, pick } from 'lodash-es';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport type { GlobalContextState } from '../../models/global-context.model';\nimport { createDefaultGlobalContextState } from '../../utils/global-context-defaults.util';\n\n/**\n * Service responsible for building and managing form groups for global context configuration.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextFormService {\n private readonly fb = inject(FormBuilder);\n\n /**\n * Creates a FormGroup for global context configuration.\n * @param config Optional existing configuration to initialize form values\n * @param defaults Optional override values for specific controls\n * @returns A fully configured FormGroup\n */\n buildForm(\n config: Partial<GlobalContextState> = {},\n defaults?: Partial<GlobalContextState>,\n skipProp?: Array<keyof GlobalContextState>\n ) {\n // Get base default values\n const defaultValues = this.getDefaultValues();\n\n // Extract valid config values\n const validConfigKeys = Object.keys(defaultValues) as Array<keyof GlobalContextState>;\n const configValues = pick(config, validConfigKeys) as Partial<GlobalContextState>;\n\n // Merge configurations with appropriate precedence\n const mergedValues = structuredClone(this.mergeValues(defaultValues, configValues, defaults));\n const filtered = omit(mergedValues, skipProp) as Partial<GlobalContextState>;\n\n return skipProp ? this.fb.group(filtered) : this.fb.group(mergedValues);\n }\n\n /**\n * Extracts form values into a configuration object\n * @param form The form to extract values from\n * @returns GlobalContextConfig object\n */\n getConfigFromForm(form: FormGroup): GlobalContextState {\n if (!form) return null;\n\n // Get raw form values\n const formValue = form.getRawValue();\n\n return {\n dateTimeContext: formValue.dateTimeContext,\n aggregation: formValue.aggregation,\n isAutoRefreshEnabled: formValue.isAutoRefreshEnabled,\n // Always use fixed 5s interval, ignore any form value\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n refreshOption: formValue.refreshOption\n };\n }\n\n /**\n * Gets the default values for the global context form\n */\n getDefaultValues(): GlobalContextState {\n return createDefaultGlobalContextState();\n }\n\n /**\n * Merges default values with config and explicit overrides\n */\n private mergeValues(\n defaultValues: GlobalContextState,\n configValues: Partial<GlobalContextState>,\n overrideValues?: Partial<GlobalContextState>\n ): GlobalContextState {\n // First merge config values over defaults\n const mergedBasicValues: GlobalContextState = {\n ...defaultValues,\n ...configValues\n };\n\n // Special handling for dateTimeContext\n if (configValues.dateTimeContext) {\n mergedBasicValues.dateTimeContext = {\n ...defaultValues.dateTimeContext,\n ...configValues.dateTimeContext\n };\n }\n\n // Apply explicit overrides if present\n if (overrideValues) {\n const result: GlobalContextState = {\n ...mergedBasicValues,\n ...overrideValues\n };\n\n if (overrideValues.dateTimeContext) {\n result.dateTimeContext = {\n ...mergedBasicValues.dateTimeContext,\n ...overrideValues.dateTimeContext\n };\n }\n\n return result;\n }\n\n return mergedBasicValues;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, filter, fromEvent, map, Observable } from 'rxjs';\nimport {\n GLOBAL_CONTEXT_EVENTS,\n GlobalContextEventRegistry,\n GlobalContextEventType,\n GlobalContextEventUnion\n} from '../../models/global-context.model';\n\n/**\n * Configuration constants for the event service.\n */\nconst EVENT_CONFIG = {\n /** Name of the custom event dispatched on the window object */\n EVENT_NAME: 'global-context',\n /** Maximum number of cached event subjects to prevent memory leaks */\n MAX_CACHED_SUBJECTS: 50\n} as const;\n\n/**\n * GlobalContextEventService manages global context events using the browser's native event system.\n *\n * This service provides a type-safe wrapper around window custom events for global context communication.\n * It maintains event subjects for efficient observable-based event handling while ensuring proper\n * cleanup and memory management.\n *\n * Key features:\n * - Type-safe event emission and subscription\n * - Latest value caching for each event type\n * - Memory-efficient subject management\n * - Integration with browser's native event system\n *\n * @example\n * ```typescript\n * // Emit an event\n * eventService.emit('GLOBAL_CONTEXT_STATE_CHANGE', {\n * refreshOption: 'live',\n * isAutoRefreshEnabled: true\n * });\n *\n * // Subscribe to events\n * eventService.on('GLOBAL_CONTEXT_STATE_CHANGE').subscribe(state => {\n * console.log('State changed:', state);\n * });\n *\n * // Get the latest value\n * const latestState = eventService.getLatestValue('GLOBAL_CONTEXT_STATE_CHANGE');\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextEventService {\n /** Map storing BehaviorSubjects for each event type to cache latest values */\n private readonly eventSubjects = new Map<\n GlobalContextEventType,\n BehaviorSubject<GlobalContextEventRegistry[GlobalContextEventType] | null>\n >();\n\n /** Observable stream of all global context events from the window */\n private readonly events$ = fromEvent<CustomEvent<GlobalContextEventUnion>>(\n window,\n EVENT_CONFIG.EVENT_NAME\n ).pipe(map(event => event.detail));\n\n /**\n * Emits a global context event with type-safe payload.\n *\n * The event is both stored locally for latest value retrieval and dispatched\n * as a browser custom event for cross-component communication.\n *\n * @param type - The specific event type to emit (must be a valid GlobalContextEventType)\n * @param payload - Type-safe payload matching the event type requirements\n *\n * @throws {Error} When event type is invalid or payload validation fails\n *\n * @example\n * ```typescript\n * // Emit a state change event\n * eventService.emit('GLOBAL_CONTEXT_STATE_CHANGE', {\n * refreshOption: 'live',\n * isAutoRefreshEnabled: true\n * });\n *\n * // Emit a refresh event\n * eventService.emit('GLOBAL_CONTEXT_REFRESH', {\n * dateFrom: '2024-01-01',\n * dateTo: '2024-01-02'\n * });\n * ```\n */\n emit<T extends GlobalContextEventType>(type: T, payload?: GlobalContextEventRegistry[T]): void {\n const payloadCopy = structuredClone(payload);\n\n try {\n this.validateEventType(type);\n\n // Update the local subject with the new value\n const subject = this.getOrCreateEventSubject(type);\n subject.next(payloadCopy ?? null);\n\n // Dispatch the browser event for cross-component communication\n this.dispatchBrowserEvent(type, payloadCopy);\n } catch (error) {\n console.error(`Failed to emit global context event '${type}':`, error);\n throw error;\n }\n }\n\n /**\n * Creates an observable that emits whenever a specific event type occurs.\n *\n * The observable filters the global event stream to only emit events of the specified type.\n * This provides efficient, reactive event handling without manual event listener management.\n *\n * @param eventType - The specific event type to observe\n * @returns Observable that emits payloads of the specified event type\n *\n * @throws {Error} When event type is invalid\n *\n * @example\n * ```typescript\n * // Subscribe to state changes\n * eventService.on('GLOBAL_CONTEXT_STATE_CHANGE')\n * .pipe(takeUntilDestroyed())\n * .subscribe(state => {\n * console.log('New state:', state);\n * });\n *\n * // Subscribe to refresh events with filtering\n * eventService.on('GLOBAL_CONTEXT_REFRESH')\n * .pipe(\n * filter(data => data?.interval === 'MINUTES'),\n * takeUntilDestroyed()\n * )\n * .subscribe(refreshData => {\n * console.log('Minute-based refresh:', refreshData);\n * });\n * ```\n */\n on<T extends GlobalContextEventType>(eventType: T): Observable<GlobalContextEventRegistry[T]> {\n try {\n this.validateEventType(eventType);\n\n return this.events$.pipe(\n filter((event): event is GlobalContextEventUnion => event.type === eventType),\n map(event => event.payload as GlobalContextEventRegistry[T])\n );\n } catch (error) {\n console.error(`Failed to create observable for event '${eventType}':`, error);\n throw error;\n }\n }\n\n /**\n * Retrieves the most recently emitted value for a specific event type.\n *\n * This method provides synchronous access to the latest event data without\n * requiring a subscription. Returns null if no event of the specified type\n * has been emitted yet.\n *\n * @param eventType - The event type to retrieve the latest value for\n * @returns The latest emitted value or null if none exists\n *\n * @throws {Error} When event type is invalid\n *\n * @example\n * ```typescript\n * // Get the current state\n * const currentState = eventService.getLatestValue('GLOBAL_CONTEXT_STATE_CHANGE');\n * if (currentState) {\n * console.log('Current refresh option:', currentState.refreshOption);\n * }\n *\n * // Check for latest refresh data\n * const refreshData = eventService.getLatestValue('GLOBAL_CONTEXT_REFRESH');\n * if (refreshData?.dateFrom) {\n * console.log('Last refresh from:', refreshData.dateFrom);\n * }\n * ```\n */\n getLatestValue<T extends GlobalContextEventType>(\n eventType: T\n ): GlobalContextEventRegistry[T] | null {\n try {\n this.validateEventType(eventType);\n\n const value = this.getOrCreateEventSubject(eventType).getValue();\n return structuredClone(value);\n } catch (error) {\n console.error(`Failed to get latest value for event '${eventType}':`, error);\n throw error;\n }\n }\n\n /**\n * Synchronizes dateTimeContext from REFRESH event to STATE_CHANGE event.\n *\n * This method ensures that when a REFRESH event contains dateTimeContext data,\n * it updates the STATE_CHANGE event subject's value directly without emitting a new event.\n * This keeps the internal state synchronized without triggering listeners.\n *\n * @param refreshDateTimeContext - The dateTimeContext from the REFRESH event to sync\n *\n * @example\n * ```typescript\n * // When a refresh occurs with new dateTimeContext\n * const refreshData = { dateFrom: '2024-01-01', dateTo: '2024-01-02', interval: 'HOURLY' };\n * eventService.emit(GLOBAL_CONTEXT_EVENTS.REFRESH, refreshData);\n *\n * // Sync it to STATE_CHANGE internal state\n * eventService.syncRefreshToStateChange(refreshData);\n * ```\n */\n syncRefreshToStateChange(\n refreshDateTimeContext?: GlobalContextEventRegistry[typeof GLOBAL_CONTEXT_EVENTS.REFRESH]\n ): void {\n if (!refreshDateTimeContext) {\n return;\n }\n\n // Only update if we have all required properties for DateTimeContext\n if (\n refreshDateTimeContext.dateFrom &&\n refreshDateTimeContext.dateTo &&\n refreshDateTimeContext.interval\n ) {\n // Get the STATE_CHANGE subject\n const stateChangeSubject = this.getOrCreateEventSubject(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE);\n const currentState = stateChangeSubject.getValue() || {};\n\n // Merge refresh dateTimeContext into current state\n const updatedState = {\n ...currentState,\n dateTimeContext: {\n dateFrom: refreshDateTimeContext.dateFrom,\n dateTo: refreshDateTimeContext.dateTo,\n interval: refreshDateTimeContext.interval\n }\n };\n\n // Update the subject's value directly without emitting an event\n stateChangeSubject.next(updatedState);\n }\n }\n\n /**\n * Validates that an event type is not empty or invalid.\n *\n * @param eventType - The event type to validate\n * @throws {Error} When event type is invalid\n */\n private validateEventType(eventType: string): void {\n if (!eventType || typeof eventType !== 'string' || eventType.trim().length === 0) {\n throw new Error('Event type must be a non-empty string');\n }\n }\n\n /**\n * Dispatches a browser custom event for cross-component communication.\n *\n * @param type - Event type\n * @param payload - Event payload\n */\n private dispatchBrowserEvent<T extends GlobalContextEventType>(\n type: T,\n payload?: GlobalContextEventRegistry[T]\n ): void {\n const customEvent = new CustomEvent(EVENT_CONFIG.EVENT_NAME, {\n detail: {\n type,\n payload,\n timestamp: Date.now()\n }\n });\n\n window.dispatchEvent(customEvent);\n }\n\n /**\n * Gets or creates a BehaviorSubject for a specific event type.\n * Implements memory management by limiting the number of cached subjects.\n *\n * @param type - The event type\n * @returns BehaviorSubject for the event type\n */\n private getOrCreateEventSubject<T extends GlobalContextEventType>(\n type: T\n ): BehaviorSubject<GlobalContextEventRegistry[T] | null> {\n if (!this.eventSubjects.has(type)) {\n // Implement basic memory management\n this.ensureSubjectCacheLimit();\n\n const newSubject = new BehaviorSubject<GlobalContextEventRegistry[T] | null>(null);\n this.eventSubjects.set(type, newSubject as BehaviorSubject<any>);\n }\n\n return this.eventSubjects.get(type) as BehaviorSubject<GlobalContextEventRegistry[T] | null>;\n }\n\n /**\n * Ensures the event subject cache doesn't exceed the maximum limit.\n * Removes the oldest subjects when limit is reached.\n */\n private ensureSubjectCacheLimit(): void {\n if (this.eventSubjects.size >= EVENT_CONFIG.MAX_CACHED_SUBJECTS) {\n const firstKey = this.eventSubjects.keys().next().value;\n if (firstKey) {\n const subject = this.eventSubjects.get(firstKey);\n if (subject && !subject.closed) {\n subject.complete();\n }\n this.eventSubjects.delete(firstKey);\n }\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport { LinkStatesMap } from '../../models/control-flow.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GlobalContextDisplayMode,\n GlobalContextSettings,\n WidgetControls\n} from '../../models/global-context.model';\n\n/**\n * Standard result interface for all widget settings operations.\n * Used consistently across resolution, toggle, and configuration methods.\n */\nexport interface WidgetSettingsResult {\n /** Settings for inline (widget-level) controls (new naming) */\n settings: Partial<GlobalContextSettings>;\n /** Link states determining dashboard vs inline control visibility */\n links: LinkStatesMap;\n /** Settings for dashboard-level controls (new naming) */\n dashboardControls: Partial<GlobalContextSettings>;\n}\n\n/**\n * Service responsible for managing widget-level control settings and their interaction\n * with dashboard-level controls. Handles the resolution of settings based on display mode,\n * link states, and refresh options.\n *\n * Key responsibilities:\n * - Widget settings resolution for different display modes\n * - Link state management between inline and dashboard controls\n * - Dashboard control calculations based on link states\n * - Settings toggle operations for individual and bulk link changes\n */\n@Injectable({ providedIn: 'root' })\nexport class WidgetControlService {\n // ========================================\n // PUBLIC API METHODS\n // ========================================\n\n /**\n * Resolves widget settings for inline controls based on the specified mode and refresh option.\n * For dashboard mode, calculates the split between inline and dashboard controls.\n *\n * @param controls - Widget control configuration containing settings and links\n * @param mode - Display mode determining which settings to use\n * @param refreshOption - Refresh mode (live/history) for settings selection\n * @returns Resolved settings with inline controls, links, and dashboard controls\n */\n resolveInlineControlSettings(\n controls: WidgetControls,\n mode: GlobalContextDisplayMode,\n refreshOption: RefreshOption\n ): WidgetSettingsResult {\n const baseSettings = this.getInlineSettingsFromWidgetControls(controls, mode, refreshOption);\n const baseLinks = this.getDefaultLinksFromControls(controls, mode, refreshOption);\n\n if (mode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n // Calculate dashboard controls with the merged settings and links\n const { newSettings: newInlineSettings, dashboardSettings } = this.calculateDashboardSettings(\n baseSettings,\n baseLinks\n );\n return {\n settings: newInlineSettings,\n links: baseLinks,\n dashboardControls: dashboardSettings\n };\n }\n\n return {\n settings: baseSettings,\n links: baseLinks,\n dashboardControls: {}\n };\n }\n\n /**\n * Resolves widget settings for configuration controls based on the specified mode and refresh option.\n * Configuration controls are simpler and don't require dashboard control calculations.\n *\n * @param controls - Widget control configuration containing config settings\n * @param mode - Display mode determining which config settings to use\n * @param refreshOption - Refresh mode (live/history) for settings selection\n * @returns Resolved configuration settings with empty links and dashboard controls\n */\n resolveConfigControlSettings(\n controls: WidgetControls,\n mode: GlobalContextDisplayMode,\n refreshOption: RefreshOption\n ): WidgetSettingsResult {\n const baseSettings = this.getConfigSettingsFromWidgetControls(controls, mode, refreshOption);\n return {\n settings: baseSettings,\n links: {},\n dashboardControls: {}\n };\n }\n\n /**\n * Extracts inline settings from widget controls for the specified display mode and refresh option.\n * Applies fallback logic for invalid refresh options, defaulting to LIVE mode.\n *\n * @param controls - Widget control configuration\n * @param displayMode - Display mode (dashboard, config, view_and_config)\n * @param refreshOption - Refresh mode, may be invalid and will fallback to LIVE\n * @returns Inline settings for the specified mode and refresh option\n */\n getInlineSettingsFromWidgetControls(\n controls: WidgetControls,\n displayMode: GlobalContextDisplayMode,\n refreshOption: RefreshOption | string\n ): Partial<GlobalContextSettings> {\n const validatedRefresh = this.validateRefreshOption(refreshOption);\n const templateSettings = controls?.settings?.[displayMode]?.[validatedRefresh] || {};\n return { ...templateSettings };\n }\n\n /**\n * Extracts configuration settings from widget controls for the specified display mode and refresh option.\n * Applies fallback logic for invalid refresh options, defaulting to LIVE mode.\n *\n * @param controls - Widget control configuration\n * @param displayMode - Display mode (dashboard, config, view_and_config)\n * @param refreshOption - Refresh mode, may be invalid and will fallback to LIVE\n * @returns Configuration settings for the specified mode and refresh option\n */\n getConfigSettingsFromWidgetControls(\n controls: WidgetControls,\n displayMode: GlobalContextDisplayMode,\n refreshOption: RefreshOption | string\n ): Partial<GlobalContextSettings> {\n const validatedRefresh = this.validateRefreshOption(refreshOption);\n const configSettings = controls?.configSettings?.[displayMode]?.[validatedRefresh] || {};\n return { ...configSettings };\n }\n\n /**\n * Extracts default link states from widget controls for the specified display mode and refresh option.\n * Applies fallback logic for invalid refresh options, defaulting to LIVE mode.\n *\n * @param controls - Widget control configuration\n * @param displayMode - Display mode (dashboard, config, view_and_config)\n * @param refreshOption - Refresh mode, may be invalid and will fallback to LIVE\n * @returns Default link states for the specified mode and refresh option\n */\n getDefaultLinksFromControls(\n controls: WidgetControls,\n displayMode: GlobalContextDisplayMode,\n refreshOption: RefreshOption | string\n ): LinkStatesMap {\n const validatedRefresh = this.validateRefreshOption(refreshOption);\n const defaultLinks = controls?.defaultLinks?.[displayMode]?.[validatedRefresh] || {};\n return { ...defaultLinks };\n }\n\n /**\n * Toggles a single link state and recalculates the resulting settings and dashboard controls.\n * When a link is toggled, it affects how controls are distributed between inline and dashboard.\n *\n * @param linkKey - The key of the link to toggle\n * @param currentSettings - Current inline control settings\n * @param currentLinks - Current link states\n * @returns Updated settings with toggled link and recalculated dashboard controls\n */\n toggleControlLink(\n linkKey: string,\n currentSettings: Partial<GlobalContextSettings>,\n currentLinks: LinkStatesMap\n ): WidgetSettingsResult {\n const updatedLinks = { ...currentLinks };\n updatedLinks[linkKey] = !updatedLinks[linkKey];\n\n const { newSettings, dashboardSettings } = this.calculateDashboardSettings(\n currentSettings,\n updatedLinks\n );\n\n return {\n settings: newSettings,\n links: updatedLinks,\n dashboardControls: dashboardSettings\n };\n }\n\n /**\n * Sets all link states to the specified value and recalculates the resulting settings.\n * This is used for bulk operations like \"link all\" or \"unlink all\" controls.\n *\n * @param state - The state to set for all links (true = linked, false = unlinked)\n * @param currentSettings - Current inline control settings\n * @param currentLinks - Current link states\n * @returns Updated settings with all links set to the specified state\n */\n toggleAllControlLinks(\n state: boolean,\n currentSettings: Partial<GlobalContextSettings>,\n currentLinks: LinkStatesMap\n ): WidgetSettingsResult {\n const updatedLinks = { ...currentLinks };\n Object.keys(updatedLinks).forEach(key => {\n updatedLinks[key] = state;\n });\n\n const { newSettings, dashboardSettings } = this.calculateDashboardSettings(\n currentSettings,\n updatedLinks\n );\n\n return {\n settings: newSettings,\n links: updatedLinks,\n dashboardControls: dashboardSettings\n };\n }\n\n /**\n * Validates and normalizes a refresh option, providing fallback to LIVE for invalid values.\n * Handles type coercion and validates against the REFRESH_OPTION enum.\n *\n * @param refreshOption - Refresh option to validate (may be string or RefreshOption)\n * @returns Valid RefreshOption, defaulting to LIVE for invalid inputs\n */\n private validateRefreshOption(refreshOption: RefreshOption | string): RefreshOption {\n return Object.values(REFRESH_OPTION).includes(refreshOption as RefreshOption)\n ? (refreshOption as RefreshOption)\n : REFRESH_OPTION.LIVE;\n }\n\n /**\n * Calculates how settings should be split between dashboard and inline controls based on link states.\n * When a control is linked (true), it appears on the dashboard. When unlinked (false), it appears inline.\n * This method implements the core business logic for the dashboard/inline control relationship.\n *\n * @param settings - Base settings to split between dashboard and inline\n * @param links - Link states determining where each control should appear\n * @returns Object containing settings for both inline and dashboard controls\n */\n private calculateDashboardSettings(\n settings: Partial<GlobalContextSettings>,\n links: LinkStatesMap\n ): {\n newSettings: Partial<GlobalContextSettings>;\n dashboardSettings: Partial<GlobalContextSettings>;\n } {\n const inlineSettings = { ...(settings || {}) };\n const dashboardSettings: Partial<GlobalContextSettings> = {};\n\n // If links is empty, set all dashboard settings to false\n if (Object.keys(links ?? {}).length === 0) {\n if (settings && 'showTimeContext' in settings) dashboardSettings.showTimeContext = false;\n if (settings && 'showAutoRefresh' in settings) dashboardSettings.showAutoRefresh = false;\n if (settings && 'showRefresh' in settings) dashboardSettings.showRefresh = false;\n if (settings && 'showRefreshInterval' in settings)\n dashboardSettings.showRefreshInterval = false;\n if (settings && 'showAggregation' in settings) dashboardSettings.showAggregation = false;\n } else {\n // Otherwise, set based on links values\n if (settings && 'showTimeContext' in settings && 'dateTimeContext' in links) {\n dashboardSettings.showTimeContext = links.dateTimeContext;\n inlineSettings.showTimeContext = !links.dateTimeContext;\n }\n if (settings && 'showAutoRefresh' in settings && 'isAutoRefreshEnabled' in links) {\n dashboardSettings.showAutoRefresh = links.isAutoRefreshEnabled;\n inlineSettings.showAutoRefresh = !links.isAutoRefreshEnabled;\n }\n if (settings && 'showRefresh' in settings) {\n dashboardSettings.showRefresh = !settings.showRefresh;\n inlineSettings.showRefresh = settings.showRefresh;\n }\n if (settings && 'showRefreshInterval' in settings && 'isAutoRefreshEnabled' in links) {\n dashboardSettings.showRefreshInterval =\n settings.showRefreshInterval && links.isAutoRefreshEnabled;\n inlineSettings.showRefreshInterval = inlineSettings.showAutoRefresh;\n }\n if (settings && 'showAggregation' in settings && 'aggregation' in links) {\n dashboardSettings.showAggregation = links.aggregation;\n inlineSettings.showAggregation = !links.aggregation;\n }\n }\n\n return { newSettings: inlineSettings, dashboardSettings };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { type Interval, INTERVALS, type TimeInterval } from '../../models/interval-picker.model';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\n\n@Injectable({ providedIn: 'root' })\nexport class DateTimeContextPickerService {\n /**\n * Calculates date time context according to provided interval.\n *\n * @param intervalId - Interval id indicating time range\n * @returns Tuple of [dateFrom, dateTo] where dateTo is current time, or null if interval is invalid\n *\n * @example\n * ```typescript\n * // Returns [epoch, current date] for 'none' interval\n * service.getDateTimeContextByInterval('none');\n *\n * // Returns [1 hour ago, now] for 'hours' interval\n * service.getDateTimeContextByInterval('hours');\n *\n * // Returns null for invalid intervals\n * service.getDateTimeContextByInterval('invalid'); // null\n * ```\n */\n getDateTimeContextByInterval(intervalId: TimeInterval): [Date, Date] | null {\n // Delegate to the central utility\n return DateTimeContextUtil.dateRangeFromInterval(intervalId);\n }\n\n /**\n * Validates provided param for being selectable Interval id.\n * @param intervalId Interval id to be validated.\n * @returns True if provided id is valid, selectable Interval id and false if it's not.\n */\n isSelectableInterval(intervalId: Interval['id']): boolean {\n // Handle type safety - return false for non-string inputs\n if (typeof intervalId !== 'string') {\n return false;\n }\n\n // 'custom' interval is not selectable\n if (intervalId === 'custom') {\n return false;\n }\n\n // 'none' interval is selectable (special case)\n if (intervalId === 'none') {\n return true;\n }\n\n // Check if interval exists in INTERVALS array\n return INTERVALS.some(({ id }) => id === intervalId);\n }\n\n /**\n * Validates provided date \"from\" and date \"to\":\n * - if both dates are proper date strings/values\n * - if provided date from is earlier than date to.\n * @param stringifiedDateFrom Date \"from\" that should be validated.\n * @param stringifiedDateTo Date \"to\" that should be validated.\n * @returns Result of validation of dates range.\n */\n isValidDateRange(stringifiedDateFrom: string, stringifiedDateTo: string): boolean {\n // Delegate to the central utility\n return DateTimeContextUtil.isValidRange(stringifiedDateFrom, stringifiedDateTo);\n }\n\n /**\n * Validates provided aggregation type.\n * @param aggregation Aggregation type to be validated.\n * @returns Result of validation of aggregation.\n */\n isValidAggregation(aggregation: aggregationType | null): boolean {\n // null is a valid aggregation (no aggregation)\n if (aggregation === null) {\n return true;\n }\n\n // Check if aggregation is one of the valid enum values\n return Object.values(aggregationType).includes(aggregation);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport { DateTimeContext } from '../../models/date-time-context-picker.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GlobalContextState } from '../../models/global-context.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport { TIME_INTERVAL, TIME_SPAN_MS, TimeInterval } from '../../models/interval-picker.model';\nimport { DateTimeContextPickerService } from './date-time-context-picker.service';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\n\n/**\n * Legacy widget configuration interface representing the various formats used in older widgets.\n *\n * This interface captures all possible legacy configuration properties that need to be migrated\n * to the new GlobalContextState format. Legacy widgets could store these properties at different\n * nesting levels (root, config, or mapConfig) with varying naming conventions.\n *\n * Note: The field 'canDecoupleGlobalTimeContext' was intentionally excluded from migration logic.\n * This field was used in legacy configurations but is no longer relevant for the new Global Context system.\n */\nexport interface LegacyWidgetConfig {\n /**\n * Widget capability declarations from widget definitions.\n * These indicate which global context features the widget supports,\n * but don't represent the actual configuration values.\n */\n displaySettings?: {\n /** Whether widget supports global time context feature */\n globalTimeContext?: boolean;\n /** Whether widget supports auto-refresh feature */\n globalAutoRefreshContext?: boolean;\n /** Whether widget supports realtime updates */\n globalRealtimeContext?: boolean;\n /** Whether widget supports data aggregation */\n globalAggregationContext?: boolean;\n };\n\n /**\n * Actual widget instance configuration determining which features are active.\n * These take precedence over displaySettings when determining migration behavior.\n */\n /** Whether this widget instance uses global time context */\n widgetInstanceGlobalTimeContext?: boolean;\n /** Whether this widget instance uses global auto-refresh */\n widgetInstanceGlobalAutoRefreshContext?: boolean;\n /** @deprecated Deprecated field not used in migration */\n canDecoupleGlobalTimeContext?: boolean;\n /** Whether to display date selection controls in the widget */\n displayDateSelection?: boolean;\n\n /** Legacy time configuration properties (multiple formats supported) */\n /** Date range as array [from, to] - used by some widgets */\n dateFilter?: string[] | [string, string];\n /** Date range as array [from, to] - alternative legacy format */\n date?: string[] | [string, string];\n /** Start date as ISO string */\n dateFrom?: string;\n /** End date as ISO string */\n dateTo?: string;\n /** Time interval identifier (e.g., 'hours', 'days', 'none') */\n interval?: string;\n\n /** Legacy refresh configuration properties */\n /** Legacy refresh mode ('interval', 'global-interval', 'none') */\n refreshOption?: string;\n /** Whether auto-refresh is enabled */\n isAutoRefreshEnabled?: boolean;\n /** Refresh interval in milliseconds */\n refreshInterval?: number;\n /** Whether widget is in realtime mode */\n isRealtime?: boolean;\n /** Alternative realtime flag used by some widgets */\n realtime?: boolean;\n\n /**\n * Nested configuration objects where widgets might store their settings.\n * The migration service checks these nested levels to ensure all configuration is captured.\n */\n /** Map widget specific configuration */\n mapConfig?: Record<string, unknown>;\n /** Generic nested configuration */\n config?: Record<string, unknown>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class WidgetConfigMigrationService {\n constructor(private dateTimeContextPickerService: DateTimeContextPickerService) {}\n\n /**\n * Transforms legacy widget configurations into the standardized GlobalContextState format.\n *\n * This migration handles the transition from various legacy configuration formats to the new\n * unified global context system. It detects which properties need updating and\n * preserves configurations that are already in the correct format.\n *\n * **What is migrated:**\n * - `displayMode`: Derived from widgetInstanceGlobalTimeContext/AutoRefreshContext flags\n * - `dateTimeContext`: Normalized from dateFilter, date, dateFrom/dateTo, or interval fields\n * - `refreshOption`: Converted from legacy 'interval'/'global-interval'/'none' values to LIVE/HISTORY\n * - `isAutoRefreshEnabled` + `refreshInterval`: Determined from realtime flags and legacy settings\n * - `aggregation`: Normalized from legacy 'NONE' string to null\n *\n *\n * **Use case:**\n * Call this on every widget configuration before rendering to ensure compatibility with\n * the global context system, regardless of when the widget was created or last saved.\n *\n * @param config - Widget configuration object that may contain legacy or new format properties.\n * Can be any object type, but should contain widget configuration fields.\n * @returns Configuration with all required GlobalContextState properties, either migrated from\n * legacy format or preserved if already valid. Returns input unchanged if null/undefined.\n *\n * @example\n * ```ts\n * // Legacy config with old format\n * const legacyConfig = {\n * widgetInstanceGlobalTimeContext: true,\n * dateFrom: '2024-01-01',\n * dateTo: '2024-01-02',\n * refreshOption: 'interval'\n * };\n *\n * // After migration\n * const migrated = migrationService.migrateWidgetConfig(legacyConfig);\n * // {\n * // displayMode: 'dashboard',\n * // dateTimeContext: { dateFrom: '2024-01-01T00:00:00.000Z', dateTo: '2024-01-02T00:00:00.000Z', interval: 'custom' },\n * // refreshOption: 'live',\n * // isAutoRefreshEnabled: true,\n * // refreshInterval: 60000,\n * // aggregation: null\n * // }\n * ```\n */\n migrateWidgetConfig<T extends object = object>(config: T): Partial<GlobalContextState> {\n // Guard: Handle invalid config\n if (!config) {\n return config as Partial<GlobalContextState>;\n }\n\n // Cast to unknown first, then to our working type\n const configObj = config as unknown as Record<string, unknown>;\n\n // Check if already has valid new format (minimal check)\n const hasValidDisplayMode =\n typeof configObj.displayMode === 'string' && this.isValidDisplayMode(configObj.displayMode);\n const hasValidRefreshOption =\n typeof configObj.refreshOption === 'string' &&\n this.isValidRefreshOption(configObj.refreshOption);\n\n // If has basic valid format and no legacy fields needing migration, return as is\n if (hasValidDisplayMode && hasValidRefreshOption && !this.hasLegacyFields(configObj)) {\n return config as Partial<GlobalContextState>;\n }\n\n // Extract settings from all levels (including nested) for migration decisions\n const settingsForMigration = this.extractGlobalContextSettings(configObj);\n\n // Create a flat config without nested objects (to avoid duplication in output)\n const flatConfig = this.createFlatConfig(configObj);\n\n // Apply migrations based on the merged settings\n this.applyGlobalContextProperties(flatConfig, settingsForMigration);\n\n return flatConfig;\n }\n\n /**\n * Creates a flattened configuration by excluding nested configuration objects.\n *\n * Legacy widgets often stored settings in nested objects like `mapConfig` or `config`.\n * This method creates a copy of the configuration without these nested objects to prevent\n * duplication in the migrated output - the nested values are extracted and merged separately\n * by extractGlobalContextSettings().\n *\n * @param config - The raw widget configuration potentially containing nested objects\n * @returns Flattened configuration without mapConfig and config properties\n *\n */\n private createFlatConfig(config: Record<string, unknown>): Partial<GlobalContextState> {\n const { mapConfig: _mapConfig, config: _nestedConfig, ...flatConfig } = config;\n return structuredClone(flatConfig) as Partial<GlobalContextState>;\n }\n\n /**\n * Applies or migrates all global context properties to ensure complete configuration.\n *\n * This method implements a selective migration strategy:\n * - Checks which properties are missing or invalid in the current config\n * - Migrates only the properties that need updating\n * - Forces full migration when config has NO global context properties at all\n *\n * The method ensures that all widgets end up with valid displayMode, dateTimeContext,\n * refreshOption/isAutoRefreshEnabled/refreshInterval, and aggregation settings.\n *\n * @param config - The configuration object to modify (mutated in place)\n * @param mergedSettings - Combined settings from all config levels used for migration decisions\n *\n */\n private applyGlobalContextProperties(\n config: Partial<GlobalContextState>,\n mergedSettings: Record<string, unknown>\n ): void {\n // Check if this config has no global context properties at all\n const hasNoGlobalContext = this.hasNoGlobalContextProperties(config);\n\n // Check what needs migration\n const needsDisplayMode = !this.isValidDisplayMode(config.displayMode);\n const needsDateTimeContext = !config.dateTimeContext;\n const needsRefreshSettings = this.needsRefreshSettingsMigration(config, mergedSettings);\n const needsAggregation =\n (mergedSettings.aggregation as string) === 'NONE' || config.aggregation === undefined;\n\n // Apply migrations based on needs or if no global context exists\n if (needsDisplayMode || hasNoGlobalContext) {\n config.displayMode = this.resolveDisplayMode(mergedSettings);\n }\n\n if (needsDateTimeContext || hasNoGlobalContext) {\n config.dateTimeContext = this.resolveDateTimeContext(mergedSettings);\n }\n\n if (needsRefreshSettings || hasNoGlobalContext) {\n this.applyRefreshSettings(config, mergedSettings);\n }\n\n if (needsAggregation || hasNoGlobalContext) {\n config.aggregation = this.normalizeAggregation(config.aggregation);\n }\n }\n\n /**\n * Determines if a configuration completely lacks global context properties.\n *\n * Used to detect widgets that have never been configured for global context integration.\n * When true, the migration applies full default configuration rather than selective updates.\n *\n * @param config - The configuration to check\n * @returns true if all global context properties are missing or undefined\n *\n */\n private hasNoGlobalContextProperties(config: Partial<GlobalContextState>): boolean {\n return (\n !config.displayMode &&\n !config.dateTimeContext &&\n config.refreshOption === undefined &&\n config.isAutoRefreshEnabled === undefined &&\n config.refreshInterval === undefined &&\n config.aggregation === undefined\n );\n }\n\n /**\n * Applies refresh settings as a cohesive unit to ensure consistency.\n *\n * The three refresh properties (refreshOption, isAutoRefreshEnabled, refreshInterval) are\n * interdependent and must be migrated together to avoid inconsistent states:\n * - refreshOption determines the mode (LIVE vs HISTORY)\n * - isAutoRefreshEnabled controls whether auto-refresh is active\n * - refreshInterval sets the refresh frequency in milliseconds\n *\n * Special handling:\n * - Realtime widgets get LIVE mode with 5-second interval\n * - Legacy refreshOption values are normalized to LIVE or HISTORY\n * - Nested config refreshInterval values are prioritized\n *\n * @param config - The configuration object to update (mutated in place)\n * @param mergedSettings - Combined settings from all levels for migration decisions\n *\n */\n private applyRefreshSettings(\n config: Partial<GlobalContextState>,\n mergedSettings: Record<string, unknown>\n ): void {\n const isRealtime = this.isRealtimeWidget(mergedSettings);\n const legacyRefreshOption = mergedSettings.refreshOption;\n\n // Refresh Option\n if (!this.isValidRefreshOption(config.refreshOption)) {\n config.refreshOption = this.resolveRefreshOption(\n isRealtime,\n typeof legacyRefreshOption === 'string' ? legacyRefreshOption : undefined\n );\n }\n\n // Auto Refresh Enabled\n if (config.isAutoRefreshEnabled === undefined) {\n config.isAutoRefreshEnabled = this.resolveAutoRefreshEnabled(\n isRealtime,\n typeof legacyRefreshOption === 'string' ? legacyRefreshOption : undefined\n );\n }\n\n // Refresh Interval - always use default 5s interval (ignore stored values)\n // This ensures old dashboards with custom intervals are migrated to the fixed 5s interval\n config.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n }\n\n /**\n * Determines the appropriate display mode based on legacy widget configuration.\n *\n * Display mode controls how the widget integrates with global context:\n * - DASHBOARD: Fully controlled by dashboard-level global context\n * - CONFIG: Widget manages its own settings independently\n * - VIEW_AND_CONFIG: Widget shows inline controls and can configure itself\n *\n * Decision logic priority:\n * 1. displayDateSelection=true → VIEW_AND_CONFIG (explicit request for date controls)\n * 2. Both time and refresh are global → DASHBOARD (full integration)\n * 3. One global, one local → VIEW_AND_CONFIG (partial integration)\n * 4. One setting defined → DASHBOARD (assume global by default)\n * 5. Both undefined → CONFIG (widget manages itself)\n *\n * @param settings - Merged settings from all config levels\n * @returns The appropriate display mode for the widget\n *\n */\n private resolveDisplayMode(settings: Record<string, unknown>): GLOBAL_CONTEXT_DISPLAY_MODE {\n // Special case: Display date selection\n if (settings.displayDateSelection === true) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG;\n }\n\n const timeGlobal = settings.widgetInstanceGlobalTimeContext;\n const refreshGlobal = settings.widgetInstanceGlobalAutoRefreshContext;\n\n // Explicit configurations\n if (timeGlobal === true && refreshGlobal === true) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n\n if (timeGlobal === true && refreshGlobal === false) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG;\n }\n\n if (timeGlobal === false && refreshGlobal === true) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG;\n }\n\n // Single setting defined\n if (timeGlobal === true && refreshGlobal === undefined) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n\n if (timeGlobal === undefined && refreshGlobal === true) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n\n // Both undefined - widget manages itself\n if (timeGlobal === undefined && refreshGlobal === undefined) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n }\n\n // Default to CONFIG (widget manages itself)\n return GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n }\n\n /**\n * Builds date/time context from various legacy configuration formats.\n *\n * Legacy widgets stored time configuration in many different ways. This method\n * normalizes all formats into the new DateTimeContext structure with consistent\n * ISO date strings and proper interval classification.\n *\n * Resolution priority:\n * 1. interval='none' → Always epoch (1970) to now with CUSTOM interval\n * 2. Predefined intervals (hours, days, etc.) → Calculate fresh dates based on interval\n * 3. Legacy date fields → Use provided dates with calculated/custom interval\n * 4. Widget needs time context → Apply default (last hour)\n * 5. Fallback → Last hour with HOURS interval\n *\n * Special cases:\n * - interval='none' always means \"all data\" regardless of other date fields\n * - Predefined intervals recalculate dates to be relative to current time\n * - Custom date ranges preserve the exact dates provided\n *\n * @param settings - Merged settings from all config levels\n * @returns Complete DateTimeContext with ISO dates and interval\n *\n */\n private resolveDateTimeContext(settings: Record<string, unknown>): DateTimeContext {\n // Special case: interval \"none\" always means \"all data from 1970 to now\"\n if (\n settings.interval &&\n typeof settings.interval === 'string' &&\n settings.interval.toLowerCase() === 'none'\n ) {\n return {\n dateFrom: '1970-01-01T00:00:00.000Z', // Always use epoch start\n dateTo: DateTimeContextUtil.toIso(new Date()), // Always use current time\n interval: TIME_INTERVAL.CUSTOM\n };\n }\n\n // Check if we have a predefined interval (not custom or none)\n // For predefined intervals, we should calculate fresh dates based on current time\n if (\n settings.interval &&\n typeof settings.interval === 'string' &&\n this.isPredefinedInterval(settings.interval)\n ) {\n const interval = this.resolveInterval(settings.interval as string);\n const dateRange = this.dateTimeContextPickerService.getDateTimeContextByInterval(interval);\n\n return DateTimeContextUtil.ensureIsoContext({\n dateFrom: dateRange![0],\n dateTo: dateRange![1],\n interval\n });\n }\n\n // Try legacy date fields (for custom intervals or when no interval specified)\n const legacyDates = this.extractLegacyDates(settings);\n if (legacyDates) {\n return {\n dateFrom: legacyDates.dateFrom,\n dateTo: legacyDates.dateTo,\n interval: this.calculateInterval(\n legacyDates.dateFrom,\n legacyDates.dateTo,\n typeof settings.interval === 'string' ? settings.interval : undefined\n )\n };\n }\n\n // Create default context if widget needs it\n if (this.needsDefaultDateTimeContext(settings)) {\n const interval = this.resolveInterval(settings.interval as string);\n const dateRange = this.dateTimeContextPickerService.getDateTimeContextByInterval(interval);\n\n return DateTimeContextUtil.ensureIsoContext({\n dateFrom: dateRange![0],\n dateTo: dateRange![1],\n interval\n });\n }\n\n // Absolute fallback: last hour\n return this.getDefaultDateTimeContext();\n }\n\n /**\n * Resolves the refresh option (LIVE or HISTORY) from legacy configuration.\n *\n * Maps legacy refresh option values to the new binary system:\n * - 'interval' or 'global-interval' → LIVE (auto-refresh enabled)\n * - 'none' → HISTORY (no auto-refresh)\n * - Realtime widgets with any option → LIVE\n * - Default → LIVE\n *\n * @param isRealtime - Whether the widget is in realtime mode\n * @param legacyOption - Legacy refreshOption value if present\n * @returns LIVE or HISTORY refresh option\n *\n */\n private resolveRefreshOption(isRealtime: boolean, legacyOption?: string): RefreshOption {\n // Only use LIVE for realtime if there's an actual legacy option indicating it\n if (isRealtime && legacyOption) {\n return REFRESH_OPTION.LIVE;\n }\n\n // Handle legacy refresh option\n const normalizedOption = legacyOption?.toLowerCase();\n switch (normalizedOption) {\n case 'global-interval':\n case 'interval':\n return REFRESH_OPTION.LIVE;\n case 'none':\n return REFRESH_OPTION.HISTORY;\n default:\n // Default to LIVE for all widgets (including interval='none')\n return REFRESH_OPTION.LIVE;\n }\n }\n\n /**\n * Resolves whether auto-refresh should be enabled based on widget configuration.\n *\n * Determines the initial state of the auto-refresh toggle:\n * - Realtime widgets → always enabled\n * - refreshOption='none' → disabled\n * - All other cases → enabled (including interval='none')\n *\n * @param isRealtime - Whether the widget is in realtime mode\n * @param legacyOption - Legacy refreshOption value if present\n * @returns true if auto-refresh should be enabled\n *\n */\n private resolveAutoRefreshEnabled(isRealtime: boolean, legacyOption?: string): boolean {\n if (isRealtime) {\n return true;\n }\n\n // Only disable auto-refresh if refreshOption is explicitly 'none'\n if (legacyOption && legacyOption.toLowerCase() === 'none') {\n return false;\n }\n\n return true; // Default to enabled (including interval='none')\n }\n\n /**\n * Detects if a widget is configured for realtime operation.\n *\n * Realtime widgets continuously update with live data and require special handling\n * with shorter refresh intervals (5 seconds) and LIVE mode.\n *\n * Detection criteria:\n * - Explicit realtime/isRealtime flags\n * - globalRealtimeContext capability + active refresh option\n *\n * @param settings - Widget settings to check\n * @returns true if widget should operate in realtime mode\n *\n */\n private isRealtimeWidget(settings: Record<string, unknown>): boolean {\n // Consider explicit realtime settings\n if (settings.realtime === true || settings.isRealtime === true) {\n return true;\n }\n\n // Also consider display settings if there's a refresh option indicating active refresh\n const displaySettings = settings.displaySettings as Record<string, unknown> | undefined;\n if (\n displaySettings?.globalRealtimeContext === true &&\n typeof settings.refreshOption === 'string' &&\n ['interval', 'global-interval'].includes(settings.refreshOption)\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Extracts date range from various legacy property formats.\n *\n * Legacy widgets stored dates in multiple ways. This method checks all possible\n * locations and returns the first valid date range found.\n *\n * Priority order:\n * 1. dateFrom + dateTo (most explicit)\n * 2. dateFilter array\n * 3. date array\n *\n * @param settings - Widget settings containing potential date properties\n * @returns Date range object or null if no valid dates found\n *\n */\n private extractLegacyDates(\n settings: Record<string, unknown>\n ): { dateFrom: string; dateTo: string } | null {\n // Priority 1: dateFrom/dateTo\n if (typeof settings.dateFrom === 'string' && typeof settings.dateTo === 'string') {\n return { dateFrom: settings.dateFrom, dateTo: settings.dateTo };\n }\n\n // Priority 2: dateFilter array\n if (Array.isArray(settings.dateFilter) && settings.dateFilter.length >= 2) {\n return { dateFrom: settings.dateFilter[0], dateTo: settings.dateFilter[1] };\n }\n\n // Priority 3: date array\n if (Array.isArray(settings.date) && settings.date.length >= 2) {\n return { dateFrom: settings.date[0], dateTo: settings.date[1] };\n }\n\n return null;\n }\n\n /**\n * Calculates the appropriate time interval based on date range duration.\n *\n * Uses the provided interval if valid, otherwise calculates from the date range span:\n * - ≤1 minute → MINUTES\n * - ≤1 hour → HOURS\n * - ≤1 day → DAYS\n * - ≤1 week → WEEKS\n * - ≤1 month → MONTHS\n * - >1 month → CUSTOM\n *\n * Special case: interval='none' → CUSTOM\n *\n * @param dateFrom - Start date as ISO string\n * @param dateTo - End date as ISO string\n * @param providedInterval - Optional interval from legacy config\n * @returns Appropriate TimeInterval enum value\n *\n */\n private calculateInterval(\n dateFrom: string,\n dateTo: string,\n providedInterval?: string\n ): TimeInterval {\n // Use provided interval if valid\n if (providedInterval) {\n // Handle case-insensitive 'none' variations\n if (providedInterval.toLowerCase() === 'none') {\n return TIME_INTERVAL.CUSTOM;\n }\n\n if (Object.values(TIME_INTERVAL).includes(providedInterval as TimeInterval)) {\n return providedInterval as TimeInterval;\n }\n }\n\n // Calculate from date range\n try {\n const from = new Date(dateFrom);\n const to = new Date(dateTo);\n const diffMs = to.getTime() - from.getTime();\n\n if (diffMs <= TIME_SPAN_MS.MINUTE) return TIME_INTERVAL.MINUTES;\n if (diffMs <= TIME_SPAN_MS.HOUR) return TIME_INTERVAL.HOURS;\n if (diffMs <= TIME_SPAN_MS.DAY) return TIME_INTERVAL.DAYS;\n if (diffMs <= TIME_SPAN_MS.WEEK) return TIME_INTERVAL.WEEKS;\n if (diffMs <= TIME_SPAN_MS.MONTH) return TIME_INTERVAL.MONTHS;\n\n return TIME_INTERVAL.CUSTOM;\n } catch {\n return TIME_INTERVAL.CUSTOM;\n }\n }\n\n /**\n * Resolves and validates a time interval string.\n *\n * @param interval - Interval string to validate\n * @returns Valid TimeInterval or HOURS as default\n *\n */\n private resolveInterval(interval?: string): TimeInterval {\n if (interval && this.dateTimeContextPickerService.isSelectableInterval(interval)) {\n return interval as TimeInterval;\n }\n return TIME_INTERVAL.HOURS;\n }\n\n /**\n * Normalizes legacy aggregation values to the new format.\n *\n * Converts legacy 'NONE' string to null (meaning no aggregation).\n *\n * @param value - Legacy aggregation value\n * @returns Normalized aggregationType or null\n *\n */\n private normalizeAggregation(value?: string | aggregationType | null): aggregationType | null {\n if (value === 'NONE' || value === undefined) {\n return null;\n }\n return value as aggregationType;\n }\n\n /**\n * Checks if an interval is predefined (relative to current time) rather than custom.\n *\n * Predefined intervals (hours, days, etc.) are recalculated relative to current time\n * during migration, while custom intervals preserve their exact date ranges.\n *\n * @param interval - Interval string to check\n * @returns true if interval is predefined (not CUSTOM or 'none')\n *\n */\n private isPredefinedInterval(interval: string): boolean {\n const predefinedIntervals: string[] = [\n TIME_INTERVAL.MINUTES,\n TIME_INTERVAL.HOURS,\n TIME_INTERVAL.DAYS,\n TIME_INTERVAL.WEEKS,\n TIME_INTERVAL.MONTHS\n ];\n return predefinedIntervals.includes(interval);\n }\n\n /**\n * Determines if a widget requires a default date/time context to be generated.\n *\n * Returns true when the widget has time-related settings but no explicit date values,\n * indicating it expects time context but didn't provide specific dates.\n *\n * @param settings - Widget settings to evaluate\n * @returns true if default date/time context should be applied\n *\n */\n private needsDefaultDateTimeContext(settings: Record<string, unknown>): boolean {\n const displaySettings = settings.displaySettings as Record<string, unknown> | undefined;\n const hasTimeSettings = !!(\n settings.displayDateSelection ||\n settings.widgetInstanceGlobalTimeContext !== undefined ||\n displaySettings?.globalTimeContext ||\n settings.interval\n );\n\n const hasExplicitDates = !!(\n (settings.dateFrom && settings.dateTo) ||\n settings.dateFilter ||\n settings.date\n );\n\n return hasTimeSettings && !hasExplicitDates;\n }\n\n /**\n * Creates a default date/time context for widgets without explicit time configuration.\n *\n * Returns the last hour as a safe default that works for most widgets.\n *\n * @returns DateTimeContext configured for the last hour\n *\n */\n private getDefaultDateTimeContext(): DateTimeContext {\n const interval = TIME_INTERVAL.HOURS;\n const dateRange = this.dateTimeContextPickerService.getDateTimeContextByInterval(interval);\n\n return DateTimeContextUtil.ensureIsoContext({\n dateFrom: dateRange![0],\n dateTo: dateRange![1],\n interval\n });\n }\n\n /**\n * Detects if a configuration contains legacy fields requiring migration.\n *\n * Recursively checks for legacy date fields, refresh options, aggregation values,\n * and nested configurations that need updating.\n *\n * @param config - Configuration object to check\n * @returns true if any legacy fields are found\n *\n */\n private hasLegacyFields(config: Record<string, unknown>): boolean {\n // Check for legacy date fields\n if (\n config.dateFilter ||\n config.date ||\n (config.dateFrom && config.dateTo && !config.dateTimeContext)\n ) {\n return true;\n }\n\n // Check for legacy refresh options (case-insensitive)\n if (\n typeof config.refreshOption === 'string' &&\n ['global-interval', 'interval', 'none'].includes(config.refreshOption.toLowerCase())\n ) {\n return true;\n }\n\n // Check for legacy aggregation\n if (config.aggregation === 'NONE') {\n return true;\n }\n\n // Check nested configs\n if (\n config.mapConfig &&\n typeof config.mapConfig === 'object' &&\n this.hasLegacyFields(config.mapConfig as Record<string, unknown>)\n ) {\n return true;\n }\n\n if (\n config.config &&\n typeof config.config === 'object' &&\n this.hasLegacyFields(config.config as Record<string, unknown>)\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Check if widget needs refresh settings migration.\n */\n private needsRefreshSettingsMigration(\n config: Partial<GlobalContextState>,\n settings: Record<string, unknown>\n ): boolean {\n // Already has valid refresh option\n if (this.isValidRefreshOption(config.refreshOption)) {\n // But check if realtime needs special handling\n const isRealtime = this.isRealtimeWidget(settings);\n if (\n isRealtime &&\n (config.refreshInterval === undefined || config.isAutoRefreshEnabled === undefined)\n ) {\n return true;\n }\n return false;\n }\n\n // Has legacy refresh option or undefined\n return true;\n }\n\n /**\n * Validates if a value is a recognized display mode.\n *\n * @param value - Value to validate\n * @returns true if value is a valid GLOBAL_CONTEXT_DISPLAY_MODE\n *\n */\n private isValidDisplayMode(value?: string): boolean {\n return (\n value === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD ||\n value === GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG ||\n value === GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n );\n }\n\n /**\n * Validates if a value is a recognized refresh option.\n *\n * @param value - Value to validate\n * @returns true if value is LIVE or HISTORY\n *\n */\n private isValidRefreshOption(value?: string): boolean {\n return value === REFRESH_OPTION.LIVE || value === REFRESH_OPTION.HISTORY;\n }\n\n /**\n * Extracts and merges global context settings from all configuration levels.\n *\n * Legacy widgets stored settings at different nesting levels (root, config, mapConfig).\n * This method extracts relevant settings from all levels and merges them with proper\n * precedence to ensure nothing is missed during migration.\n *\n * Precedence order (highest to lowest):\n * 1. mapConfig (most specific)\n * 2. config (nested level)\n * 3. root level (main config)\n *\n * @param config - Full widget configuration with potential nesting\n * @returns Merged settings object containing all relevant properties\n *\n */\n private extractGlobalContextSettings(config: Record<string, unknown>): Record<string, unknown> {\n const mainLevel = this.extractRelevantSettings(config);\n const configLevel =\n config.config && typeof config.config === 'object'\n ? this.extractRelevantSettings(config.config as Record<string, unknown>)\n : {};\n const mapConfigLevel =\n config.mapConfig && typeof config.mapConfig === 'object'\n ? this.extractRelevantSettings(config.mapConfig as Record<string, unknown>)\n : {};\n\n // Merge with precedence\n return {\n ...mainLevel,\n ...configLevel,\n ...mapConfigLevel\n };\n }\n\n /**\n * Filters a configuration object to include only global context relevant properties.\n *\n * Reduces noise by extracting only the properties needed for migration decisions,\n * ignoring widget-specific configuration that doesn't affect global context.\n *\n * @param obj - Configuration object to filter\n * @returns Object containing only relevant properties\n *\n */\n private extractRelevantSettings(obj: Record<string, unknown>): Record<string, unknown> {\n const relevantKeys = [\n 'displaySettings',\n 'widgetInstanceGlobalTimeContext',\n 'widgetInstanceGlobalAutoRefreshContext',\n 'dateFilter',\n 'date',\n 'dateFrom',\n 'dateTo',\n 'refreshOption',\n 'refreshInterval',\n 'displayDateSelection',\n 'isAutoRefreshEnabled',\n 'isRealtime',\n 'realtime',\n 'interval',\n 'aggregation'\n ];\n\n return Object.fromEntries(\n relevantKeys.filter(key => obj[key] !== undefined).map(key => [key, obj[key]])\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { Interval } from '../../models/interval-picker.model';\nimport { DateTimeContextPickerService } from './date-time-context-picker.service';\n\n/**\n * Service responsible for validating global context parameters.\n *\n * This service centralizes all validation logic for global context parameters,\n * including intervals, aggregations, date ranges, and boolean values.\n * It provides a single source of truth for validation rules across the application.\n *\n * @example\n * ```typescript\n * constructor(private validationService: GlobalContextValidationService) {}\n *\n * const isValid = this.validationService.isValidInterval('HOURS');\n * const dateRangeValid = this.validationService.isValidDateRange('2024-01-01', '2024-01-02');\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class GlobalContextValidationService {\n private dateTimeContextPickerService = inject(DateTimeContextPickerService);\n\n /**\n * Validates if the provided interval is selectable and supported.\n *\n * @param interval - The interval to validate\n * @returns True if the interval is valid and selectable, false otherwise\n *\n * @example\n * ```typescript\n * const isValid = validationService.isValidInterval('HOURS'); // true\n * const isInvalid = validationService.isValidInterval('INVALID'); // false\n * ```\n */\n isValidInterval(interval: string | unknown): boolean {\n return (\n typeof interval === 'string' &&\n this.dateTimeContextPickerService.isSelectableInterval(interval as Interval['id'])\n );\n }\n\n /**\n * Validates if the provided aggregation type is supported.\n *\n * @param aggregation - The aggregation type to validate\n * @returns True if the aggregation is valid, false otherwise\n *\n * @example\n * ```typescript\n * const isValid = validationService.isValidAggregation(aggregationType.HOURLY); // true\n * const isInvalid = validationService.isValidAggregation('INVALID' as any); // false\n * ```\n */\n isValidAggregation(aggregation: string | unknown): boolean {\n return (\n typeof aggregation === 'string' &&\n this.dateTimeContextPickerService.isValidAggregation(aggregation as aggregationType)\n );\n }\n\n /**\n * Validates if the provided date range is valid.\n *\n * @param dateFrom - The start date of the range\n * @param dateTo - The end date of the range\n * @returns True if the date range is valid, false otherwise\n *\n * @example\n * ```typescript\n * const isValid = validationService.isValidDateRange('2024-01-01', '2024-01-02'); // true\n * const isInvalid = validationService.isValidDateRange('invalid', '2024-01-02'); // false\n * ```\n */\n isValidDateRange(dateFrom: string, dateTo: string): boolean {\n return this.dateTimeContextPickerService.isValidDateRange(dateFrom, dateTo);\n }\n\n /**\n * Parses a string value to boolean or undefined.\n *\n * Only accepts the exact strings 'true' and 'false'. All other values,\n * including different cases, whitespace, or non-string types return undefined.\n *\n * @param value - The value to parse\n * @returns true for 'true', false for 'false', undefined for all other values\n *\n * @example\n * ```typescript\n * const result1 = validationService.parseBoolean('true'); // true\n * const result2 = validationService.parseBoolean('false'); // false\n * const result3 = validationService.parseBoolean('True'); // undefined\n * const result4 = validationService.parseBoolean(null); // undefined\n * ```\n */\n parseBoolean(value: string | unknown): boolean | undefined {\n if (typeof value !== 'string') return undefined;\n\n const map: Record<string, boolean> = {\n true: true,\n false: false\n };\n\n return map[value] ?? undefined;\n }\n\n /**\n * Validates multiple parameters at once and returns detailed results.\n *\n * @param params - Object containing parameters to validate\n * @returns Validation results for each parameter\n *\n * @example\n * ```typescript\n * const results = validationService.validateParameters({\n * interval: 'HOURS',\n * aggregation: aggregationType.HOURLY,\n * autoRefresh: 'true'\n * });\n * ```\n */\n validateParameters(params: {\n interval?: string | unknown;\n aggregation?: string | unknown;\n dateFrom?: string | null;\n dateTo?: string | null;\n autoRefresh?: string | unknown;\n }): {\n interval: boolean;\n aggregation: boolean;\n dateRange: boolean;\n autoRefresh: boolean | undefined;\n } {\n return {\n interval: params.interval ? this.isValidInterval(params.interval) : false,\n aggregation: params.aggregation ? this.isValidAggregation(params.aggregation) : false,\n dateRange:\n params.dateFrom && params.dateTo\n ? this.isValidDateRange(params.dateFrom, params.dateTo)\n : false,\n autoRefresh: params.autoRefresh ? this.parseBoolean(params.autoRefresh) : undefined\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { AggregationState } from '../../models/aggregation.model';\nimport { TIME_SPAN_MS } from '../../models/interval-picker.model';\n\n/**\n * AggregationValidationService handles the validation of time ranges against\n * aggregation type requirements in the global context system.\n *\n * This service determines which aggregation types (MINUTELY, HOURLY, DAILY) are valid\n * for a given time range based on predefined business rules. It provides the core\n * validation logic that determines UI state and aggregation availability.\n *\n * Key responsibilities:\n * - Validate time ranges against minimum aggregation requirements\n * - Calculate time range durations in milliseconds\n * - Transform validation results into UI-friendly disabled state maps\n * - Provide consistent validation logic across the application\n *\n * Validation Rules:\n * - MINUTELY: Disabled for time ranges <= 1 minute\n * - HOURLY: Disabled for time ranges <= 1 hour\n * - DAILY: Disabled for time ranges <= 1 day\n *\n * @example\n * ```typescript\n * const validationService = inject(AggregationValidationService);\n *\n * // Validate a 2-hour time range\n * const dateRange: [Date, Date] = [\n * new Date('2024-01-01T10:00:00Z'),\n * new Date('2024-01-01T12:00:00Z')\n * ];\n *\n * const disabledAggregations = validationService.getDisabledAggregations(dateRange);\n * console.log(disabledAggregations);\n * // { DAILY: true, HOURLY: false, MINUTELY: false }\n *\n * // Check if specific aggregation is valid\n * const isHourlyValid = validationService.isAggregationValid(dateRange, aggregationType.HOURLY);\n * console.log(isHourlyValid); // true (2 hours > 1 hour requirement)\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class AggregationValidationService {\n /**\n * Determines which aggregation types should be disabled for a given time range.\n *\n * This method validates the time range against all aggregation type requirements\n * and returns a map indicating which aggregations should be disabled in the UI.\n *\n * @param dateRange - Tuple of [dateFrom, dateTo] defining the time range\n * @returns Map of aggregation types to their disabled boolean state\n *\n * @example\n * ```typescript\n * const shortRange: [Date, Date] = [\n * new Date('2024-01-01T12:00:00Z'),\n * new Date('2024-01-01T12:30:00Z') // 30 minutes\n * ];\n *\n * const disabled = validationService.getDisabledAggregations(shortRange);\n * // { DAILY: true, HOURLY: true, MINUTELY: false }\n * ```\n */\n getDisabledAggregations([dateFrom, dateTo]: [Date, Date]): Partial<\n Record<aggregationType, boolean>\n > {\n const timeRangeValidations = this.validateTimeRanges([dateFrom, dateTo]);\n return this.transformValidationsToDisabledMap(timeRangeValidations);\n }\n\n /**\n * Checks if a specific aggregation type is valid for the given time range.\n *\n * This method provides a convenient way to check if a single aggregation type\n * meets the minimum time range requirements without needing to validate all types.\n *\n * @param dateRange - Tuple of [dateFrom, dateTo] defining the time range\n * @param aggregation - The aggregation type to validate\n * @returns True if the aggregation is valid for the time range, false if disabled\n *\n * @example\n * ```typescript\n * const oneHourRange: [Date, Date] = [\n * new Date('2024-01-01T12:00:00Z'),\n * new Date('2024-01-01T13:00:00Z')\n * ];\n *\n * const isMinutelyValid = validationService.isAggregationValid(oneHourRange, aggregationType.MINUTELY);\n * // true (1 hour > 1 minute requirement)\n *\n * const isDailyValid = validationService.isAggregationValid(oneHourRange, aggregationType.DAILY);\n * // false (1 hour <= 1 day requirement)\n * ```\n */\n isAggregationValid([dateFrom, dateTo]: [Date, Date], aggregation: aggregationType): boolean {\n const timeRangeInMs = this.getTimeRangeInMs(dateFrom, dateTo);\n\n switch (aggregation) {\n case aggregationType.DAILY:\n return timeRangeInMs > TIME_SPAN_MS.DAY;\n case aggregationType.HOURLY:\n return timeRangeInMs > TIME_SPAN_MS.HOUR;\n case aggregationType.MINUTELY:\n return timeRangeInMs > TIME_SPAN_MS.MINUTE;\n default:\n return false;\n }\n }\n\n /**\n * Calculates the time range duration in milliseconds.\n *\n * This method provides a standardized way to calculate time range durations\n * that can be used for validation and threshold comparisons.\n *\n * @param dateFrom - Start date of the range\n * @param dateTo - End date of the range\n * @returns Duration in milliseconds between the two dates\n *\n * @example\n * ```typescript\n * const duration = validationService.getTimeRangeInMs(\n * new Date('2024-01-01T10:00:00Z'),\n * new Date('2024-01-01T12:00:00Z')\n * );\n * console.log(duration); // 7200000 (2 hours in milliseconds)\n * ```\n */\n getTimeRangeInMs(dateFrom: Date, dateTo: Date): number {\n // Normalize dates to remove milliseconds for consistent comparisons\n // This prevents issues where date pickers might strip milliseconds inconsistently\n const normalizedFrom = new Date(dateFrom);\n normalizedFrom.setMilliseconds(0);\n\n const normalizedTo = new Date(dateTo);\n normalizedTo.setMilliseconds(0);\n\n return normalizedTo.valueOf() - normalizedFrom.valueOf();\n }\n\n /**\n * Validates time ranges against all aggregation type requirements.\n *\n * Determines which aggregation types should be disabled based on the time range duration.\n * Each aggregation type has a minimum time range requirement to be meaningful.\n *\n * Validation Logic:\n * - DAILY: Disabled if time range <= 1 day\n * - HOURLY: Disabled if time range <= 1 hour\n * - MINUTELY: Disabled if time range <= 1 minute\n *\n * @param dateRange - Tuple of [dateFrom, dateTo] to validate\n * @returns Array of aggregation states with their disabled status\n */\n private validateTimeRanges([dateFrom, dateTo]: [Date, Date]): AggregationState[] {\n const timeRangeInMs = this.getTimeRangeInMs(dateFrom, dateTo);\n\n return [\n {\n aggregationType: aggregationType.DAILY,\n isDisabled: timeRangeInMs <= TIME_SPAN_MS.DAY\n },\n {\n aggregationType: aggregationType.HOURLY,\n isDisabled: timeRangeInMs <= TIME_SPAN_MS.HOUR\n },\n {\n aggregationType: aggregationType.MINUTELY,\n isDisabled: timeRangeInMs <= TIME_SPAN_MS.MINUTE\n }\n ];\n }\n\n /**\n * Converts aggregation state array to a disabled aggregations map.\n *\n * Transforms the validation results into a map structure that indicates\n * which aggregation types should be disabled in the UI.\n *\n * @param timeRangeValidations - Array of aggregation states from validation\n * @returns Map of aggregation types to their disabled boolean state\n */\n private transformValidationsToDisabledMap(\n timeRangeValidations: AggregationState[]\n ): Partial<Record<aggregationType, boolean>> {\n return timeRangeValidations.reduce(\n (acc, { aggregationType, isDisabled }) => ({\n ...acc,\n [aggregationType]: isDisabled\n }),\n {}\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { AGGREGATION_LIMITS } from '../../models/aggregation.model';\nimport { AggregationValidationService } from './aggregation-validation.service';\n\n/**\n * Interface defining the result of aggregation calculation.\n * Contains both the selected aggregation and information about which aggregations are disabled.\n */\nexport interface AggregationCalculationResult {\n /** The selected aggregation type or null if no aggregation is selected */\n readonly selectedAggregation: aggregationType | null;\n /** Map of aggregation types to their disabled state */\n readonly disabledAggregations: Partial<Record<aggregationType, boolean>>;\n}\n\n/**\n * AggregationPickerService handles the logic for selecting appropriate data aggregations\n * based on time ranges and user preferences in the global context system.\n *\n * This service focuses on aggregation selection and automatic fallback logic when requested\n * aggregations are not appropriate for the data range. It delegates validation concerns\n * to the AggregationValidationService for better separation of concerns.\n *\n * Key responsibilities:\n * - Calculate optimal aggregation selection for given time ranges and preferences\n * - Handle automatic aggregation selection based on time range thresholds\n * - Provide fallback logic when requested aggregations are invalid\n * - Combine validation results with selection logic for complete aggregation calculation\n *\n * Auto-selection Logic:\n * - Uses AGGREGATION_LIMITS thresholds (10min, 1day, 4days) for fallback selection\n * - Delegates validation to AggregationValidationService\n * - Returns comprehensive results including both selection and validation state\n *\n * @example\n * ```typescript\n * const service = inject(AggregationPickerService);\n *\n * // Calculate aggregation for a 2-day time range\n * const dateRange: [Date, Date] = [\n * new Date('2024-01-01T00:00:00Z'),\n * new Date('2024-01-03T00:00:00Z')\n * ];\n *\n * const result = service.calculateAggregation(dateRange, aggregationType.HOURLY);\n * console.log(result.selectedAggregation); // 'HOURLY' (valid for 2-day range)\n * console.log(result.disabledAggregations); // { DAILY: true, HOURLY: false, MINUTELY: false }\n *\n * // Auto-selection when requested aggregation is disabled\n * const shortRange: [Date, Date] = [\n * new Date('2024-01-01T12:00:00Z'),\n * new Date('2024-01-01T12:30:00Z') // 30 minutes\n * ];\n *\n * const autoResult = service.calculateAggregation(shortRange, aggregationType.DAILY);\n * // DAILY is disabled for 30min range, so falls back to MINUTELY\n * console.log(autoResult.selectedAggregation); // 'MINUTELY'\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class AggregationPickerService {\n /** Service for validating time ranges against aggregation requirements */\n private readonly validationService = inject(AggregationValidationService);\n\n /**\n * Calculates the appropriate aggregation for a given time range and user preference.\n *\n * This method validates the time range against aggregation requirements and determines\n * which aggregations should be disabled. If the requested aggregation is not valid\n * for the time range, it automatically selects the most appropriate alternative.\n *\n * Validation Rules:\n * - MINUTELY: Requires time range > 1 minute\n * - HOURLY: Requires time range > 1 hour\n * - DAILY: Requires time range > 1 day\n *\n * Auto-selection Thresholds (when fallback is needed):\n * - >= 4 days: Selects DAILY aggregation\n * - >= 1 day: Selects HOURLY aggregation\n * - >= 10 minutes: Selects MINUTELY aggregation\n * - < 10 minutes: Returns null (no aggregation)\n *\n * @param dateRange - Tuple of [dateFrom, dateTo] defining the time range\n * @param requestedAggregation - User's preferred aggregation type or null for no preference\n * @returns Object containing the selected aggregation and disabled aggregation states\n *\n * @example\n * ```typescript\n * // Valid aggregation request\n * const result = service.calculateAggregation(\n * [new Date('2024-01-01'), new Date('2024-01-03')], // 2 days\n * aggregationType.HOURLY\n * );\n * // result.selectedAggregation === 'HOURLY' (valid for 2-day range)\n *\n * // Invalid aggregation request with fallback\n * const fallbackResult = service.calculateAggregation(\n * [new Date('2024-01-01T12:00'), new Date('2024-01-01T12:30')], // 30 minutes\n * aggregationType.DAILY // Not valid for 30min range\n * );\n * // fallbackResult.selectedAggregation === 'MINUTELY' (auto-selected)\n *\n * // Explicit null request\n * const nullResult = service.calculateAggregation(\n * [new Date('2024-01-01'), new Date('2024-01-03')],\n * null\n * );\n * // nullResult.selectedAggregation === null (as requested)\n * ```\n */\n calculateAggregation(\n [dateFrom, dateTo]: [Date, Date],\n requestedAggregation: aggregationType | null\n ): AggregationCalculationResult {\n const disabledAggregations = this.validationService.getDisabledAggregations([dateFrom, dateTo]);\n const timeRangeInMs = this.validationService.getTimeRangeInMs(dateFrom, dateTo);\n\n const isRequestedAggregationValid =\n requestedAggregation === null || !disabledAggregations[requestedAggregation];\n\n const selectedAggregation = isRequestedAggregationValid\n ? requestedAggregation\n : this.determineAggregation(timeRangeInMs);\n\n return {\n selectedAggregation,\n disabledAggregations\n };\n }\n\n /**\n * Determines the most appropriate aggregation type based on time range duration.\n *\n * Uses predefined thresholds to automatically select the best aggregation type\n * when the requested aggregation is not valid for the time range. This method\n * implements the fallback logic that ensures users always get meaningful aggregations.\n *\n * Selection Logic (based on AGGREGATION_LIMITS):\n * - >= 4 days (DAILY_LIMIT): Select DAILY aggregation\n * - >= 1 day (HOURLY_LIMIT): Select HOURLY aggregation\n * - >= 10 minutes (MINUTELY_LIMIT): Select MINUTELY aggregation\n * - < 10 minutes: Return null (no aggregation appropriate)\n *\n * @param timeRangeInMs - Duration of the time range in milliseconds\n * @returns The most appropriate aggregation type or null if no aggregation is suitable\n *\n * @example\n * ```typescript\n * // Large time range - selects DAILY\n * const dailyResult = service.determineAggregation(5 * 24 * 60 * 60 * 1000); // 5 days\n * // Returns aggregationType.DAILY\n *\n * // Medium time range - selects HOURLY\n * const hourlyResult = service.determineAggregation(2 * 24 * 60 * 60 * 1000); // 2 days\n * // Returns aggregationType.HOURLY\n *\n * // Small time range - selects MINUTELY\n * const minutelyResult = service.determineAggregation(30 * 60 * 1000); // 30 minutes\n * // Returns aggregationType.MINUTELY\n *\n * // Very small time range - no aggregation\n * const nullResult = service.determineAggregation(5 * 60 * 1000); // 5 minutes\n * // Returns null\n * ```\n */\n private determineAggregation(timeRangeInMs: number): aggregationType | null {\n if (timeRangeInMs >= AGGREGATION_LIMITS.DAILY_LIMIT) {\n return aggregationType.DAILY;\n } else if (timeRangeInMs >= AGGREGATION_LIMITS.HOURLY_LIMIT) {\n return aggregationType.HOURLY;\n } else if (timeRangeInMs >= AGGREGATION_LIMITS.MINUTELY_LIMIT) {\n return aggregationType.MINUTELY;\n }\n return null;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { isEqual, isObject, transform } from 'lodash-es';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextUtilsService {\n /**\n * Compares two objects and returns an object containing only the fields that changed.\n * For nested objects, recursively identifies changes at each level.\n * Converts Date objects to ISO strings for comparison and in the result.\n *\n * @param oldObj - The original object to compare\n * @param newObj - The new object to compare against\n * @returns An object containing only the changed fields and their new values\n * @throws Error if inputs are not valid objects\n */\n getChangedFields<T extends object>(oldObj: T, newObj: T): Partial<T> {\n // Validate inputs\n if (!isObject(oldObj) || !isObject(newObj)) {\n throw new Error('Both arguments must be objects');\n }\n\n // Set to track visited objects (to avoid infinite recursion on circular refs)\n const visited = new WeakSet<object>();\n\n const diff = this.findChanges(oldObj, newObj, visited);\n return (diff === undefined ? {} : diff) as Partial<T>;\n }\n\n /**\n * Checks if a value is a Date object\n * @param val - The value to check\n * @returns True if the value is a Date object\n */\n private isDate(val: unknown): val is Date {\n return val instanceof Date && !isNaN(val.getTime());\n }\n\n /**\n * Recursive helper function to find changes between two values\n * @param oldVal - Original value\n * @param newVal - New value to compare against\n * @param visited - Set to track visited objects to avoid circular references\n * @returns The changed value or undefined if no changes\n */\n private findChanges(oldVal: unknown, newVal: unknown, visited: WeakSet<object>): unknown {\n // Handle Date objects - convert to ISO string for comparison\n let oldDateString: string | undefined;\n if (this.isDate(oldVal)) {\n oldDateString = DateTimeContextUtil.normalizeIsoToSeconds(oldVal.toISOString());\n }\n if (this.isDate(newVal)) {\n const isoString = DateTimeContextUtil.normalizeIsoToSeconds(newVal.toISOString());\n // If old value wasn't a date, or if the ISO strings differ, return new ISO string\n if (!oldDateString || oldDateString !== isoString) {\n return isoString;\n }\n return undefined; // Dates are equal, no change\n }\n // Update oldVal if it was converted to string\n if (oldDateString) {\n oldVal = oldDateString;\n }\n\n // Handle ISO string comparisons - normalize to seconds precision\n if (typeof oldVal === 'string' && typeof newVal === 'string') {\n const normalizedOld = DateTimeContextUtil.normalizeIsoToSeconds(oldVal);\n const normalizedNew = DateTimeContextUtil.normalizeIsoToSeconds(newVal);\n\n // If both are valid ISO dates, compare normalized versions\n if (normalizedOld && normalizedNew) {\n if (normalizedOld === normalizedNew) {\n return undefined; // Dates are equal (ignoring milliseconds)\n }\n return normalizedNew; // Return normalized version\n }\n }\n\n // If we've seen this object reference before, break out (circular reference)\n if (isObject(oldVal) && isObject(newVal)) {\n if (visited.has(oldVal as object) || visited.has(newVal as object)) {\n return undefined; // avoid infinite loop, no changes deeper\n }\n visited.add(oldVal as object);\n visited.add(newVal as object);\n }\n\n // If values are deeply equal, no change; return nothing\n if (isEqual(oldVal, newVal)) {\n return undefined;\n }\n\n // If both values are objects, recurse into their properties\n if (isObject(oldVal) && isObject(newVal)) {\n const result = transform(\n newVal,\n (result: Record<string, unknown>, value: unknown, key: string) => {\n const change = this.findChanges(oldVal[key], value, visited);\n if (change !== undefined) {\n // Only include the key if there is a difference\n result[key] = change;\n }\n },\n Array.isArray(newVal) ? [] : {}\n ); // preserve array vs object in result\n\n // If result is empty (no changes found in nested objects), return undefined\n return Object.keys(result).length === 0 ? undefined : result;\n }\n\n // For primitive values (or if types differ), return the new value\n return newVal;\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n input,\n signal\n} from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { aggregationType } from '@c8y/client';\nimport { I18nModule, IconDirective } from '@c8y/ngx-components';\nimport { BsDropdownModule } from 'ngx-bootstrap/dropdown';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport {\n AGGREGATION_ICONS,\n AGGREGATION_TEXTS,\n AGGREGATIONS\n} from '../../../models/aggregation.model';\n\n@Component({\n selector: 'c8y-aggregation-picker',\n templateUrl: './aggregation-picker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AggregationPickerComponent),\n multi: true\n }\n ],\n standalone: true,\n imports: [TooltipModule, BsDropdownModule, I18nModule, IconDirective, FormsModule]\n})\nexport class AggregationPickerComponent implements ControlValueAccessor {\n /**\n * Configuration for disabling specific types of aggregation.\n * By default no aggregation type is disabled.\n *\n * Uses input transform to normalize null/undefined to empty object,\n * preventing template errors when accessing properties.\n */\n readonly disabledAggregations = input(\n {},\n {\n transform: (\n value: Partial<Record<aggregationType, boolean>> | null | undefined\n ): Partial<Record<aggregationType, boolean>> => value ?? {}\n }\n );\n\n /**\n * Whether to reset the aggregation value to default when disabled.\n * Default is false.\n */\n readonly resetToDefault = input(false);\n\n /**\n * Whether to show the aggregation picker options as a radio-group or as a dropdown.\n * Default is dropdown.\n */\n readonly layout = input<'radio' | 'dropdown'>('dropdown');\n\n private readonly _disabled = signal(false);\n readonly disabled = computed(() => this._disabled());\n\n readonly AGGREGATIONS = AGGREGATIONS;\n readonly AGGREGATION_ICONS = AGGREGATION_ICONS;\n readonly AGGREGATION_TEXTS = AGGREGATION_TEXTS;\n\n private readonly _value = signal<aggregationType | null>(null);\n readonly value = computed(() => this._value());\n private readonly _touched = signal(false);\n readonly touched = computed(() => this._touched());\n\n // Computed helpers for cleaner templates\n readonly currentText = computed(() => {\n const value = this._value();\n return value ? this.AGGREGATION_TEXTS[value] : this.AGGREGATION_TEXTS.undefined;\n });\n\n readonly currentIcon = computed(() => {\n const value = this._value();\n return value ? this.AGGREGATION_ICONS[value] : this.AGGREGATION_ICONS.undefined;\n });\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = _ => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onTouched = () => {};\n\n writeValue(value: aggregationType | null): void {\n if (this._value() === value) {\n return;\n }\n\n this._value.set(value);\n }\n\n registerOnChange(fn: (value: aggregationType | null) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(onTouched: () => void): void {\n this.onTouched = onTouched;\n }\n\n markAsTouched() {\n if (!this._touched()) {\n this.onTouched();\n this._touched.set(true);\n }\n }\n\n setDisabledState(disabled: boolean) {\n this._disabled.set(disabled);\n\n if (disabled && this.resetToDefault()) {\n this.resetValue();\n }\n }\n\n selectAggregation(aggregation: aggregationType | null): void {\n // Early return if value hasn't changed (no-op)\n if (aggregation === this._value()) {\n return;\n }\n\n this.markAsTouched();\n this._value.set(aggregation);\n this.onChange(aggregation);\n }\n\n private resetValue() {\n if (this._value() !== null) {\n this._value.set(null);\n this.onChange(null);\n }\n }\n}\n","@if (layout() === 'dropdown') {\n <div\n class=\"dropdown\"\n style=\"border: 0; margin-left: -1px\"\n container=\"body\"\n #dropdown=\"bs-dropdown\"\n dropdown\n [attr.data-cy]=\"'global-context--aggregation-picker'\"\n [insideClick]=\"true\"\n [isDisabled]=\"disabled()\"\n >\n <button\n class=\"dropdown-toggle form-control p-t-0 p-b-0 l-h-1 d-flex a-i-center\"\n [attr.aria-label]=\"currentText() | translate\"\n tooltip=\"{{ (disabled() ? AGGREGATION_TEXTS.disabled : currentText()) | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-expanded]=\"dropdown.isOpen\"\n type=\"button\"\n [attr.data-cy]=\"'global-context--aggregation-picker-' + value()\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n dropdownToggle\n >\n <i\n class=\"icon-14\"\n [c8yIcon]=\"currentIcon()\"\n ></i>\n <span class=\"caret m-r-8 m-l-4\"></span>\n </button>\n\n <ul\n class=\"dropdown-menu dropdown-menu-right--xs\"\n role=\"listbox\"\n *dropdownMenu\n >\n @for (aggregation of AGGREGATIONS; track aggregation.id || $index) {\n @let isDisabled = aggregation.id ? disabledAggregations()[aggregation.id] : false;\n <li\n [class.active]=\"aggregation.id === value()\"\n [class.disabled]=\"isDisabled\"\n >\n <button\n class=\"\"\n [attr.aria-selected]=\"aggregation.id === value()\"\n role=\"option\"\n (click)=\"selectAggregation(aggregation.id); dropdown.isOpen = false\"\n [disabled]=\"isDisabled\"\n [attr.data-cy]=\"'global-context--aggregation-picker-input-' + aggregation.id\"\n >\n <i\n class=\"icon-14\"\n [c8yIcon]=\"\n aggregation.id ? AGGREGATION_ICONS[aggregation.id] : AGGREGATION_ICONS.undefined\n \"\n ></i>\n <span>{{ aggregation.title | translate }}</span>\n </button>\n </li>\n }\n </ul>\n </div>\n}\n\n@if (layout() === 'radio') {\n <div\n class=\"radio-group d-flex-md a-i-center gap-16\"\n [attr.aria-label]=\"'Aggregation options' | translate\"\n role=\"radiogroup\"\n >\n @for (aggregation of AGGREGATIONS; track aggregation.id || $index) {\n @let isDisabled = aggregation.id ? disabledAggregations()[aggregation.id] : false;\n <label\n class=\"c8y-radio\"\n [attr.data-cy]=\"'global-context--aggregation-picker-input-' + aggregation.id\"\n >\n <input\n name=\"aggregation\"\n role=\"radio\"\n type=\"radio\"\n [value]=\"aggregation.id\"\n [checked]=\"aggregation.id === value()\"\n [disabled]=\"isDisabled\"\n (change)=\"selectAggregation(aggregation.id)\"\n />\n <span></span>\n <i\n class=\"icon-16 m-l-4\"\n [c8yIcon]=\"\n aggregation.id ? AGGREGATION_ICONS[aggregation.id] : AGGREGATION_ICONS.undefined\n \"\n ></i>\n <span>{{ aggregation.title | translate }}</span>\n </label>\n }\n </div>\n}\n","import { NgClass } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n inject,\n Input,\n output,\n signal\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n AbstractControl,\n FormBuilder,\n FormsModule,\n ReactiveFormsModule,\n ValidationErrors,\n ValidatorFn\n} from '@angular/forms';\nimport { aggregationType } from '@c8y/client';\nimport {\n C8yTranslatePipe,\n DateTimePickerModule,\n FormGroupComponent,\n I18nModule,\n IconDirective,\n MessageDirective,\n MessagesComponent\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { isEqual } from 'lodash-es';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { debounceTime } from 'rxjs';\nimport { AGGREGATION_TEXTS } from '../../../models/aggregation.model';\nimport { TIME_DURATION } from '../../../models/constants';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type {\n GlobalContextSettings,\n GlobalContextState\n} from '../../../models/global-context.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport { AggregationPickerService } from '../../../services/domain/aggregation-picker.service';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport { AggregationPickerComponent } from '../../aggregation/aggregation-picker';\n\n/**\n * Component for configuring history mode settings\n * Stateless component that emits changes immediately\n */\n@Component({\n selector: 'c8y-history-mode-configuration-controls',\n templateUrl: './history-mode-configuration-controls.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n C8yTranslatePipe,\n I18nModule,\n TooltipModule,\n ReactiveFormsModule,\n IconDirective,\n FormsModule,\n PopoverModule,\n FormGroupComponent,\n AggregationPickerComponent,\n MessagesComponent,\n MessageDirective,\n DateTimePickerModule,\n NgClass\n ]\n})\nexport class HistoryModeConfigurationControlsComponent {\n readonly AGGREGATION_TEXTS = AGGREGATION_TEXTS;\n readonly DATE_FORMAT = 'medium';\n\n readonly errorMessages = {\n dateAfterRangeMax: gettext('This date is after the latest allowed date.'),\n dateBeforeRangeMin: gettext('This date is before the earliest allowed date.'),\n invalidDateTime: gettext('This date is invalid.'),\n invalidDateRange: gettext('Start date must be before end date.')\n } as const;\n\n // Popover messages for translation extraction\n readonly TIME_RANGE_PICKER_POPOVER = gettext(\n 'Specify the exact start and end date/time of the time period to analyse. This provides a static view of historical data within the selected timeframe.'\n );\n readonly AGGREGATION_POPOVER = gettext(\n \"Groups data points into larger time intervals to simplify visualization and improve performance. 'None' shows raw data, while other options combine data points into minute, hour, or day groupings.\"\n );\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly formBuilder = inject(FormBuilder);\n private readonly aggregationPickerService = inject(AggregationPickerService);\n\n private readonly settingsSignal = signal<Partial<GlobalContextSettings>>({\n showAutoRefresh: true,\n showTimeContext: true,\n showAggregation: true\n });\n private readonly contextState = signal<GlobalContextState | null>(null);\n\n @Input()\n set settings(value: Partial<GlobalContextSettings> | null) {\n this.settingsSignal.set({\n showAutoRefresh: true,\n showTimeContext: true,\n showAggregation: true,\n ...(value ?? {})\n });\n }\n get settings(): Partial<GlobalContextSettings> {\n return this.settingsSignal();\n }\n\n @Input()\n set context(value: GlobalContextState | null) {\n const cloned = value ? structuredClone(value) : null;\n\n // Only update if context actually changed to avoid unnecessary form patches\n const prev = this.contextState();\n const isDifferent = !isEqual(prev, cloned);\n\n if (isDifferent) {\n this.contextState.set(cloned);\n this.patchFormFromContext(cloned);\n }\n }\n\n readonly contextChange = output<Partial<GlobalContextState>>();\n readonly validationStatus = output<boolean>();\n\n currentForm: ReturnType<typeof this.createForm>;\n readonly disabledAggregations = signal<Partial<Record<aggregationType, boolean>>>({});\n readonly dateFromErrors = signal<Record<string, any> | null>(null);\n readonly dateToErrors = signal<Record<string, any> | null>(null);\n\n constructor() {\n this.currentForm = this.createForm();\n\n this.currentForm.valueChanges\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(100))\n .subscribe(formValue => {\n this.handleFormValueChange(formValue as Partial<GlobalContextState>);\n });\n\n this.currentForm.statusChanges\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(100))\n .subscribe(() => {\n this.updateErrorSignals();\n this.validationStatus.emit(this.currentForm.valid);\n });\n\n this.updateErrorSignals();\n this.validationStatus.emit(this.currentForm.valid);\n }\n\n private updateErrorSignals(): void {\n const dateTimeContext = this.currentForm?.get('dateTimeContext');\n const dateFromControl = dateTimeContext?.get('dateFrom');\n const dateToControl = dateTimeContext?.get('dateTo');\n\n const dateFromControlErrors = dateFromControl?.errors || {};\n const groupErrors = dateTimeContext?.errors || {};\n\n if (Object.keys(dateFromControlErrors).length > 0) {\n this.dateFromErrors.set(dateFromControlErrors);\n } else if (Object.keys(groupErrors).length > 0) {\n this.dateFromErrors.set(groupErrors);\n } else {\n this.dateFromErrors.set(null);\n }\n\n const dateToControlErrors = dateToControl?.errors || {};\n this.dateToErrors.set(Object.keys(dateToControlErrors).length > 0 ? dateToControlErrors : null);\n }\n\n private handleFormValueChange(formValue: Partial<GlobalContextState>): void {\n const { dateTimeContext, aggregation } = formValue;\n\n if (!dateTimeContext) {\n return;\n }\n\n // Normalize seconds and milliseconds BEFORE validation to prevent precision issues\n const normalizedFrom = new Date(dateTimeContext.dateFrom);\n normalizedFrom.setSeconds(0, 0);\n const normalizedTo = new Date(dateTimeContext.dateTo);\n normalizedTo.setSeconds(0, 0);\n\n dateTimeContext.dateFrom = normalizedFrom.toISOString();\n dateTimeContext.dateTo = normalizedTo.toISOString();\n\n // Calculate disabled aggregations regardless of validation\n // This allows us to disable aggregations even for edge cases like dateFrom === dateTo\n dateTimeContext.interval = TIME_INTERVAL.CUSTOM;\n\n const { selectedAggregation, disabledAggregations } =\n this.aggregationPickerService.calculateAggregation(\n [new Date(dateTimeContext.dateFrom), new Date(dateTimeContext.dateTo)],\n aggregation ?? null\n );\n this.disabledAggregations.set(disabledAggregations);\n\n // Skip emission if validation fails (e.g., dateFrom > dateTo), but still update UI\n if (!this.isValidDateTimeContext(dateTimeContext)) {\n return;\n }\n\n if (selectedAggregation !== undefined) {\n this.currentForm.patchValue({ aggregation: selectedAggregation }, { emitEvent: false });\n }\n\n const emission = structuredClone(this.currentForm.value) as GlobalContextState;\n this.contextChange.emit(emission);\n }\n\n private isValidDateTimeContext(dateTimeContext: DateTimeContext | null): boolean {\n if (!dateTimeContext) {\n return false;\n }\n\n const normalizedFrom = new Date(dateTimeContext.dateFrom);\n normalizedFrom.setSeconds(0, 0);\n const normalizedTo = new Date(dateTimeContext.dateTo);\n normalizedTo.setSeconds(0, 0);\n\n return DateTimeContextUtil.isValidRange(normalizedFrom, normalizedTo);\n }\n\n private patchFormFromContext(context?: GlobalContextState | null): void {\n if (!this.currentForm) {\n return;\n }\n\n const ctx = context ?? this.contextState();\n\n if (!ctx) {\n const defaults = this.getDefaultDateRange();\n this.currentForm.patchValue(\n {\n dateTimeContext: {\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: defaults.dateFrom,\n dateTo: defaults.dateTo\n },\n aggregation: null\n },\n { emitEvent: false }\n );\n this.disabledAggregations.set({});\n this.validationStatus.emit(this.currentForm.valid);\n return;\n }\n\n let clonedContext: DateTimeContext | null = null;\n if (ctx.dateTimeContext) {\n clonedContext = structuredClone(ctx.dateTimeContext);\n } else {\n const defaults = this.getDefaultDateRange();\n clonedContext = {\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: defaults.dateFrom,\n dateTo: defaults.dateTo\n };\n }\n\n clonedContext.interval = TIME_INTERVAL.CUSTOM;\n\n const normalizedFrom = new Date(clonedContext.dateFrom);\n normalizedFrom.setSeconds(0, 0);\n const normalizedTo = new Date(clonedContext.dateTo);\n normalizedTo.setSeconds(0, 0);\n\n clonedContext.dateFrom = normalizedFrom.toISOString();\n clonedContext.dateTo = normalizedTo.toISOString();\n\n this.currentForm.patchValue(\n {\n dateTimeContext: clonedContext,\n aggregation: ctx.aggregation ?? null\n },\n { emitEvent: false }\n );\n\n // Update disabled aggregations but DON'T override the value\n const { disabledAggregations } = this.aggregationPickerService.calculateAggregation(\n [new Date(clonedContext.dateFrom), new Date(clonedContext.dateTo)],\n ctx.aggregation ?? null\n );\n this.disabledAggregations.set(disabledAggregations);\n this.validationStatus.emit(this.currentForm.valid);\n }\n\n private createForm() {\n const defaultDates = this.getDefaultDateRange();\n\n const dateTimeContext = this.formBuilder.group<DateTimeContext>(\n {\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: defaultDates.dateFrom,\n dateTo: defaultDates.dateTo\n },\n {\n validators: [this.createDateRangeValidator()]\n }\n );\n\n return this.formBuilder.group({\n dateTimeContext,\n aggregation: this.formBuilder.control<aggregationType | null>(null)\n });\n }\n\n private getDefaultDateRange(): { dateFrom: string; dateTo: string } {\n const now = new Date();\n now.setSeconds(0, 0);\n const oneHourAgo = new Date(now.getTime() - TIME_DURATION.ONE_HOUR_MS);\n oneHourAgo.setSeconds(0, 0);\n\n return {\n dateFrom: oneHourAgo.toISOString(),\n dateTo: now.toISOString()\n };\n }\n\n private createDateRangeValidator(): ValidatorFn {\n return (group: AbstractControl): ValidationErrors | null => {\n const dateFrom = group.get('dateFrom')?.value;\n const dateTo = group.get('dateTo')?.value;\n\n if (!dateFrom || !dateTo) {\n return null;\n }\n\n const normalizedFrom = new Date(dateFrom);\n normalizedFrom.setSeconds(0, 0);\n const normalizedTo = new Date(dateTo);\n normalizedTo.setSeconds(0, 0);\n\n if (!DateTimeContextUtil.isValidRange(normalizedFrom, normalizedTo)) {\n return { invalidDateRange: true };\n }\n\n return null;\n };\n }\n}\n","@if (currentForm) {\n @let SHOW_TIME_CONTEXT = settings.showTimeContext;\n @let SHOW_AGGREGATION = settings.showAggregation;\n\n <form [formGroup]=\"currentForm\">\n <div class=\"content-flex-100\">\n <div\n class=\"col-4\"\n [ngClass]=\"{ 'm-b-8': !SHOW_AGGREGATION }\"\n >\n @if (SHOW_TIME_CONTEXT) {\n @let dateTimeContext = currentForm.get('dateTimeContext');\n @let tempDateFromValue = dateTimeContext.get('dateFrom')?.value;\n @let tempDateToValue = dateTimeContext.get('dateTo')?.value;\n @let fromErrors = dateFromErrors();\n @let toErrors = dateToErrors();\n\n <fieldset class=\"c8y-fieldset\">\n <legend>\n <div class=\"standalone btn-icon-dot__item time-context m-r-4\">\n <i\n class=\"\"\n [c8yIcon]=\"'calendar'\"\n ></i>\n </div>\n {{ 'Date & time range' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"TIME_RANGE_PICKER_POPOVER | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-form-group class=\"content-flex-58 d-flex a-i-center m-b-0 p-t-16\">\n <c8y-form-group\n [class.has-error]=\"fromErrors\"\n class=\"form-group-sm d-flex a-i-center col-6 flex-wrap\"\n >\n <label\n class=\"m-b-sm-0 m-r-8 text-nowrap\"\n style=\"min-width: 30px\"\n [title]=\"'From`date`' | translate\"\n for=\"dateFrom\"\n translate\n >\n From`date`\n </label>\n <c8y-date-time-picker\n [class.has-error]=\"fromErrors\"\n id=\"dateFrom\"\n [maxDate]=\"tempDateToValue\"\n [placeholder]=\"'From`date`' | translate\"\n [formControl]=\"dateTimeContext.get('dateFrom')\"\n ></c8y-date-time-picker>\n <c8y-messages [show]=\"fromErrors\">\n <c8y-message\n name=\"dateAfterRangeMax\"\n [text]=\"errorMessages.dateAfterRangeMax | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateTime\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateRange\"\n [text]=\"errorMessages.invalidDateRange | translate\"\n ></c8y-message>\n </c8y-messages>\n </c8y-form-group>\n\n <c8y-form-group\n [class.has-error]=\"toErrors\"\n class=\"form-group-sm d-flex flex-wrap col-6 a-i-center\"\n >\n <label\n class=\"m-b-sm-0 text-nowrap m-r-8\"\n style=\"min-width: 30px\"\n [title]=\"'To`date`' | translate\"\n for=\"dateTo\"\n translate\n >\n To`date`\n </label>\n <c8y-date-time-picker\n [class.has-error]=\"toErrors\"\n id=\"dateTo\"\n [minDate]=\"tempDateFromValue\"\n [placeholder]=\"'To`date`' | translate\"\n [formControl]=\"dateTimeContext.get('dateTo')\"\n ></c8y-date-time-picker>\n <c8y-messages [show]=\"toErrors\">\n <c8y-message\n name=\"dateBeforeRangeMin\"\n [text]=\"errorMessages.dateBeforeRangeMin | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateTime\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n </c8y-messages>\n </c8y-form-group>\n </c8y-form-group>\n </fieldset>\n }\n </div>\n <div class=\"col-\">\n @if (SHOW_AGGREGATION) {\n @let selectedAggregation = currentForm.get('aggregation')?.value;\n\n <fieldset class=\"c8y-fieldset\">\n <legend>\n <div class=\"standalone btn-icon-dot__item aggregation m-r-4\">\n <i [c8yIcon]=\"'input'\"></i>\n </div>\n {{ 'Aggregation' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"AGGREGATION_POPOVER | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-form-group class=\"p-t-16 p-b-16 m-b-4\">\n <c8y-aggregation-picker\n formControlName=\"aggregation\"\n [resetToDefault]=\"true\"\n [disabledAggregations]=\"disabledAggregations()\"\n [layout]=\"'radio'\"\n ></c8y-aggregation-picker>\n </c8y-form-group>\n </fieldset>\n }\n </div>\n </div>\n </form>\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, forwardRef, Input } from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule\n} from '@angular/forms';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { BsDropdownModule } from 'ngx-bootstrap/dropdown';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport type { Interval } from '../../../models/interval-picker.model';\nimport { INTERVALS } from '../../../models/interval-picker.model';\n\n@Component({\n selector: 'c8y-interval-picker',\n templateUrl: './interval-picker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => IntervalPickerComponent),\n multi: true\n }\n ],\n standalone: true,\n imports: [\n CommonModule,\n FormsModule,\n A11yModule,\n ReactiveFormsModule,\n BsDropdownModule,\n IconDirective,\n PopoverModule,\n C8yTranslatePipe\n ]\n})\nexport class IntervalPickerComponent implements ControlValueAccessor {\n @Input() INTERVALS: Interval[] = [...INTERVALS];\n @Input() shouldDisableInterval = { isDisabled: false, msg: null };\n\n value: Interval['id'];\n touched = false;\n disabled = false;\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = _ => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onTouched = () => {};\n\n writeValue(value: Interval['id']) {\n this.value = value;\n }\n\n registerOnChange(fn: (value: Interval['id']) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(onTouched: () => void): void {\n this.onTouched = onTouched;\n }\n\n markAsTouched() {\n if (!this.touched) {\n this.onTouched();\n this.touched = true;\n }\n }\n\n onIntervalSelect(intervalId: Interval['id']) {\n this.markAsTouched();\n this.value = intervalId;\n this.onChange(intervalId);\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled = disabled;\n }\n}\n","@for (interval of INTERVALS; track interval.id) {\n @let isSelected = interval.id === value;\n @let checkVisibility = isSelected ? 'visible' : 'hidden';\n @let isIntervalDisabled = shouldDisableInterval?.isDisabled;\n @let isIntervalDisabledMsg = shouldDisableInterval?.msg;\n @let isCustom = interval.id === 'custom';\n\n <li [class.active]=\"isSelected\">\n <div\n [ngStyle]=\"{\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center'\n }\"\n >\n <button\n class=\"mr-2\"\n type=\"button\"\n [attr.data-cy]=\"'global-context--interval-' + interval.id\"\n (click)=\"onIntervalSelect(interval.id)\"\n [disabled]=\"isCustom && isIntervalDisabled\"\n >\n <span [class.text-primary]=\"isSelected\">\n <span\n [c8yIcon]=\"'check'\"\n [style.visibility]=\"checkVisibility\"\n ></span>\n {{ interval.title | translate }}\n </span>\n </button>\n </div>\n </li>\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n Input,\n OnInit,\n ViewChild,\n computed,\n forwardRef,\n inject,\n signal\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n ControlValueAccessor,\n FormBuilder,\n FormControl,\n FormGroup,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule\n} from '@angular/forms';\nimport {\n DatePipe,\n DateTimePickerModule,\n FormGroupComponent,\n I18nModule,\n IconDirective,\n MessageDirective,\n MessagesComponent\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { BsDropdownDirective, BsDropdownModule } from 'ngx-bootstrap/dropdown';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { distinctUntilChanged } from 'rxjs';\nimport {\n DateTimeContext,\n DateTimeContextPickerConfig\n} from '../../../models/date-time-context-picker.model';\nimport {\n INTERVAL_TITLES,\n TIME_INTERVAL,\n TimeInterval\n} from '../../../models/interval-picker.model';\nimport { DateTimeContextPickerService } from '../../../services/domain/date-time-context-picker.service';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport { IntervalPickerComponent } from '../interval-picker';\n\n@Component({\n selector: 'c8y-date-time-context-picker',\n templateUrl: './date-time-context-picker.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n ReactiveFormsModule,\n TooltipModule,\n BsDropdownModule,\n I18nModule,\n IconDirective,\n DatePipe,\n MessagesComponent,\n MessageDirective,\n FormGroupComponent,\n IntervalPickerComponent,\n DateTimePickerModule\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => DateTimeContextPickerComponent),\n multi: true\n }\n ]\n})\nexport class DateTimeContextPickerComponent implements OnInit, ControlValueAccessor {\n @Input() disabled = false;\n @Input() shouldDisableInterval: Record<string, boolean> = {};\n @Input() config: DateTimeContextPickerConfig = {\n showDateFrom: true,\n showDateTo: true\n };\n\n @ViewChild(BsDropdownDirective) dropdown?: BsDropdownDirective;\n\n private readonly service = inject(DateTimeContextPickerService);\n private readonly formBuilder = inject(FormBuilder);\n private readonly destroyRef = inject(DestroyRef);\n private readonly datePipe = inject(DatePipe);\n private readonly cdr = inject(ChangeDetectorRef);\n\n readonly INTERVALS = INTERVAL_TITLES;\n readonly DATE_FORMAT = 'medium';\n readonly TIME_INTERVAL = TIME_INTERVAL;\n\n readonly errorMessages = {\n dateAfterRangeMax: gettext('This date is after the latest allowed date.'),\n dateBeforeRangeMin: gettext('This date is before the earliest allowed date.'),\n invalidDateTime: gettext('This date is invalid.'),\n invalidDateRange: gettext('Start date must be before end date.')\n } as const;\n\n form!: FormGroup;\n tempDateFromControl!: FormControl;\n tempDateToControl!: FormControl;\n\n private readonly customSnapshot = signal<DateTimeContext | null>(null);\n private readonly isRestoring = signal(false);\n private readonly canEmit = signal(true);\n private readonly currentInterval = signal<TimeInterval | null>(null);\n private onChangeCallback?: (value: Partial<DateTimeContext>) => void;\n private onTouchedCallback?: () => void;\n\n readonly isCustomMode = computed(() => this.currentInterval() === TIME_INTERVAL.CUSTOM);\n readonly isEditing = computed(() => this.dropdown?.isOpen && this.isCustomMode());\n\n ngOnInit(): void {\n this.form = this.formBuilder.group<DateTimeContext>({\n interval: null,\n dateFrom: null,\n dateTo: null\n });\n this.tempDateFromControl = new FormControl(null);\n this.tempDateToControl = new FormControl(null);\n\n this.setupIntervalChangeHandler();\n }\n\n writeValue(value: DateTimeContext): void {\n // Prevent updates when dropdown is open and custom mode is active\n if (this.dropdown?.isOpen && this.isCustomMode()) return;\n\n if (value && this.form) {\n const normalized = this.normalizeContext(value);\n this.form.patchValue(normalized, { emitEvent: false });\n this.currentInterval.set(normalized.interval);\n\n if (normalized.interval === TIME_INTERVAL.CUSTOM) {\n this.canEmit.set(false);\n this.customSnapshot.set({ ...this.form.value });\n this.syncTempControls();\n } else {\n this.canEmit.set(true);\n this.customSnapshot.set(null);\n }\n this.cdr.markForCheck();\n }\n }\n\n registerOnChange(fn: (value: DateTimeContext) => void): void {\n this.onChangeCallback = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouchedCallback = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n isDisabled ? this.form.disable({ emitEvent: false }) : this.form.enable({ emitEvent: false });\n }\n\n onShownDropdown(): void {\n if (this.isCustomMode()) {\n this.syncTempControls();\n this.customSnapshot.set({ ...this.form.value });\n }\n }\n\n onHiddenDropdown(): void {\n const snapshot = this.customSnapshot();\n if (snapshot && this.isCustomMode()) {\n this.isRestoring.set(true);\n this.form.patchValue(snapshot, { emitEvent: true });\n this.currentInterval.set(snapshot.interval);\n this.isRestoring.set(false);\n this.customSnapshot.set(null);\n }\n\n this.canEmit.set(!this.isCustomMode());\n this.onTouchedCallback?.();\n }\n\n getDateRangeLabel(): string {\n const dateFrom = this.isEditing()\n ? this.tempDateFromControl?.value\n : this.form.get('dateFrom')?.value;\n const dateTo = this.isEditing()\n ? this.tempDateToControl?.value\n : this.form.get('dateTo')?.value;\n\n if (!dateFrom || !dateTo) return '';\n return `${this.datePipe.transform(dateFrom, this.DATE_FORMAT)} — ${this.datePipe.transform(dateTo, this.DATE_FORMAT)}`;\n }\n\n isApplyDisabled(): boolean {\n if (!this.isCustomMode()) return this.form.invalid;\n\n const tempFrom = this.tempDateFromControl?.value;\n const tempTo = this.tempDateToControl?.value;\n\n if (this.config?.showDateFrom && !tempFrom) return true;\n if (this.config?.showDateTo && !tempTo) return true;\n\n if (tempFrom && tempTo) {\n const fromTime = this.normalizeTimestamp(tempFrom);\n const toTime = this.normalizeTimestamp(tempTo);\n if (fromTime >= toTime) return true;\n }\n\n const formFrom = this.form.get('dateFrom')?.value;\n const formTo = this.form.get('dateTo')?.value;\n const hasChanged =\n (this.config?.showDateFrom && tempFrom !== formFrom) ||\n (this.config?.showDateTo && tempTo !== formTo);\n\n return !hasChanged;\n }\n\n getDateFromErrors() {\n if (!this.tempDateFromControl?.touched) return null;\n const errors = this.tempDateFromControl?.errors || {};\n\n if (\n !this.config?.showDateTo &&\n this.tempDateFromControl?.value &&\n this.tempDateToControl?.value\n ) {\n const fromTime = this.normalizeTimestamp(this.tempDateFromControl.value);\n const toTime = this.normalizeTimestamp(this.tempDateToControl.value);\n if (fromTime >= toTime) {\n const {\n dateAfterRangeMax: _dateAfterRangeMax,\n dateBeforeRangeMin: _dateBeforeRangeMin,\n ...rest\n } = errors;\n return { ...rest, invalidDateRange: true };\n }\n }\n\n return Object.keys(errors).length > 0 ? errors : null;\n }\n\n getDateToErrors() {\n if (!this.config?.showDateTo) return null;\n if (!this.tempDateToControl?.touched && !this.tempDateFromControl?.touched) return null;\n\n const errors = this.tempDateToControl?.errors || {};\n const fromVal = this.tempDateFromControl?.value;\n const toVal = this.tempDateToControl?.value;\n\n if (fromVal && toVal) {\n const fromTime = this.normalizeTimestamp(fromVal);\n const toTime = this.normalizeTimestamp(toVal);\n if (fromTime >= toTime) {\n const {\n dateAfterRangeMax: _dateAfterRangeMax,\n dateBeforeRangeMin: _dateBeforeRangeMin,\n ...rest\n } = errors;\n return { ...rest, invalidDateRange: true };\n }\n }\n\n return Object.keys(errors).length > 0 ? errors : null;\n }\n\n protected applyDateTimeContext(intervalVal: TimeInterval = TIME_INTERVAL.CUSTOM): void {\n if (intervalVal === null) return;\n\n if (intervalVal === TIME_INTERVAL.CUSTOM) {\n this.applyCustomDates();\n } else if (intervalVal === 'none') {\n this.updateDates([new Date(0), new Date()], intervalVal);\n } else {\n const dates = this.service.getDateTimeContextByInterval(intervalVal);\n this.updateDates(dates, intervalVal);\n }\n\n this.closeDropdown();\n this.onTouchedCallback?.();\n }\n\n protected reset(): void {\n const dates = this.service.getDateTimeContextByInterval(TIME_INTERVAL.DAYS);\n this.updateDates(dates, TIME_INTERVAL.DAYS);\n this.closeDropdown();\n }\n\n private setupIntervalChangeHandler(): void {\n this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(value => {\n if (this.canEmit() && !this.isRestoring() && this.onChangeCallback) {\n this.onChangeCallback({ ...value });\n }\n });\n\n this.form\n .get('interval')\n ?.valueChanges.pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))\n .subscribe(interval => {\n this.currentInterval.set(interval);\n if (this.isRestoring()) return;\n\n if (interval === TIME_INTERVAL.CUSTOM) {\n this.canEmit.set(false);\n this.customSnapshot.set({ ...this.form.value });\n this.syncTempControls();\n } else {\n this.canEmit.set(true);\n this.customSnapshot.set(null);\n this.applyDateTimeContext(interval);\n }\n });\n }\n\n private applyCustomDates(): void {\n const normalizeDate = (dateStr: string): string => {\n const date = new Date(dateStr);\n date.setSeconds(0, 0);\n return date.toISOString();\n };\n\n const dateFrom = this.tempDateFromControl.value\n ? normalizeDate(this.tempDateFromControl.value)\n : null;\n const dateTo = this.tempDateToControl.value\n ? normalizeDate(this.tempDateToControl.value)\n : null;\n\n const ensured = DateTimeContextUtil.ensureIsoContext({\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom,\n dateTo\n });\n\n const next: DateTimeContext = {\n interval: ensured.interval ?? TIME_INTERVAL.CUSTOM,\n dateFrom: ensured.dateFrom,\n dateTo: ensured.dateTo\n };\n\n this.canEmit.set(true);\n this.customSnapshot.set(null);\n\n this.form.patchValue(next, { emitEvent: false });\n if (this.onChangeCallback) {\n this.onChangeCallback({ ...next });\n }\n }\n\n private updateDates(dates: [Date, Date], interval: TimeInterval): void {\n const [dateFrom, dateTo] = dates.map(date => DateTimeContextUtil.toIso(date));\n this.form.patchValue({ dateFrom, dateTo, interval });\n }\n\n private syncTempControls(): void {\n const dateFrom = this.form.get('dateFrom')?.value;\n const dateTo = this.form.get('dateTo')?.value;\n this.tempDateFromControl.setValue(dateFrom, { emitEvent: false });\n this.tempDateToControl.setValue(dateTo, { emitEvent: false });\n }\n\n private normalizeContext(value: DateTimeContext): DateTimeContext {\n const normalized = { ...value };\n if (normalized?.dateFrom instanceof Date) {\n normalized.dateFrom = normalized.dateFrom.toISOString();\n }\n if (normalized?.dateTo instanceof Date) {\n normalized.dateTo = normalized.dateTo.toISOString();\n }\n return normalized;\n }\n\n private normalizeTimestamp(dateStr: string): number {\n const date = new Date(dateStr);\n date.setSeconds(0, 0);\n return date.getTime();\n }\n\n private closeDropdown(): void {\n if (this.dropdown?.isOpen) {\n this.dropdown.hide();\n }\n }\n}\n","@if (form) {\n @let intervalValue = form.get('interval')?.value;\n @let isIntervalNone = intervalValue === 'none';\n @let dateFromControl = form.get('dateFrom');\n @let dateToControl = form.get('dateTo');\n @let dateRangeLabel = getDateRangeLabel();\n\n <form [formGroup]=\"form\">\n <div\n class=\"dropdown max-width-100\"\n container=\"body\"\n #dropdown=\"bs-dropdown\"\n dropdown\n [insideClick]=\"true\"\n [isDisabled]=\"disabled\"\n (onShown)=\"onShownDropdown()\"\n (onHidden)=\"onHiddenDropdown()\"\n >\n <!-- Dropdown toggle button with better accessibility -->\n <button\n class=\"dropdown-toggle form-control l-h-tight d-flex a-i-center\"\n [attr.aria-label]=\"dateRangeLabel\"\n [tooltip]=\"dateRangeLabel\"\n placement=\"top\"\n container=\"body\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n dropdownToggle\n data-cy=\"c8y-date-time-context-picker--picker-toggle\"\n >\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"'schedule1'\"\n aria-hidden=\"true\"\n ></i>\n <div class=\"d-col text-left flex-grow min-width-0\">\n @if (isIntervalNone) {\n <span class=\"text-10 text-muted l-h-1\">\n {{ 'No date filter' | translate }}\n </span>\n } @else {\n <span\n class=\"text-10 text-muted l-h-1\"\n data-cy=\"c8y-date-time-context-picker--picker-label\"\n >\n {{ INTERVALS[intervalValue] | translate }}\n </span>\n <span\n class=\"text-12 l-h-1 text-medium text-truncate\"\n data-cy=\"c8y-date-time-context-picker--picker-time-range\"\n >\n {{ form.get('dateFrom')?.value | c8yDate: DATE_FORMAT }} —\n {{ form.get('dateTo')?.value | c8yDate: DATE_FORMAT }}\n </span>\n }\n </div>\n <span\n class=\"caret m-r-16 m-l-4\"\n aria-hidden=\"true\"\n ></span>\n </button>\n\n <!-- Dropdown menu -->\n <ul\n class=\"dropdown-menu dropdown-menu--date-range\"\n role=\"menu\"\n *dropdownMenu\n >\n @if (dropdown.isOpen) {\n <!-- Interval picker section -->\n <c8y-interval-picker\n class=\"d-contents\"\n formControlName=\"interval\"\n [shouldDisableInterval]=\"shouldDisableInterval\"\n ></c8y-interval-picker>\n\n <!-- Custom date range section -->\n @if (isCustomMode() && (config?.showDateFrom || config?.showDateTo)) {\n <div class=\"p-l-16 p-r-16\">\n @if (config?.showDateFrom) {\n <c8y-form-group [class.has-error]=\"getDateFromErrors()\">\n <label\n [title]=\"'From`date`' | translate\"\n for=\"dateFrom\"\n translate\n >\n From`date`\n </label>\n <c8y-date-time-picker\n [class.has-error]=\"getDateFromErrors()\"\n id=\"dateFrom\"\n [maxDate]=\"tempDateToControl?.value\"\n [placeholder]=\"'From`date`' | translate\"\n [formControl]=\"tempDateFromControl\"\n ></c8y-date-time-picker>\n <c8y-messages [show]=\"getDateFromErrors()\">\n <c8y-message\n name=\"dateAfterRangeMax\"\n [text]=\"errorMessages.dateAfterRangeMax | translate\"\n ></c8y-message>\n <c8y-message\n name=\"dateBeforeRangeMin\"\n [text]=\"errorMessages.dateBeforeRangeMin | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateTime\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"bsDate\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateRange\"\n [text]=\"errorMessages.invalidDateRange | translate\"\n ></c8y-message>\n </c8y-messages>\n </c8y-form-group>\n }\n\n @if (config?.showDateTo) {\n <c8y-form-group [class.has-error]=\"getDateToErrors()\">\n <label\n [title]=\"'To`date`' | translate\"\n for=\"dateTo\"\n translate\n >\n To`date`\n </label>\n <c8y-date-time-picker\n [class.has-error]=\"getDateToErrors()\"\n id=\"dateTo\"\n [minDate]=\"tempDateFromControl?.value\"\n [placeholder]=\"'To`date`' | translate\"\n [formControl]=\"tempDateToControl\"\n ></c8y-date-time-picker>\n <c8y-messages [show]=\"getDateToErrors()\">\n <c8y-message\n name=\"dateAfterRangeMax\"\n [text]=\"errorMessages.dateAfterRangeMax | translate\"\n ></c8y-message>\n <c8y-message\n name=\"dateBeforeRangeMin\"\n [text]=\"errorMessages.dateBeforeRangeMin | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateTime\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"bsDate\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateRange\"\n [text]=\"errorMessages.invalidDateRange | translate\"\n ></c8y-message>\n </c8y-messages>\n </c8y-form-group>\n }\n </div>\n\n <!-- Action buttons -->\n <div class=\"p-16 d-flex gap-8 separator-top\">\n <button\n class=\"btn btn-default btn-sm flex-grow\"\n title=\"{{ 'Reset' | translate }}\"\n type=\"button\"\n (click)=\"reset()\"\n translate\n >\n Reset\n </button>\n\n <button\n class=\"btn btn-primary btn-sm flex-grow\"\n title=\"{{ 'Apply' | translate }}\"\n type=\"button\"\n (click)=\"applyDateTimeContext()\"\n [disabled]=\"isApplyDisabled()\"\n translate\n >\n Apply\n </button>\n </div>\n }\n }\n </ul>\n </div>\n </form>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Input,\n inject,\n output,\n signal\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, FormGroupComponent, IconDirective } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { debounceTime } from 'rxjs';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../../models';\nimport type {\n GlobalContextSettings,\n GlobalContextState\n} from '../../../models/global-context.model';\nimport { fillMissingDefaults } from '../../../utils/global-context-defaults.util';\nimport { DateTimeContextPickerComponent } from '../../time-context/time-range-picker/date-time-context-picker.component';\n\n/**\n * Component for configuring live mode settings\n * Stateless component that emits changes immediately\n */\n@Component({\n selector: 'c8y-live-mode-configuration-controls',\n templateUrl: './live-mode-configuration-controls.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n C8yTranslatePipe,\n TooltipModule,\n ReactiveFormsModule,\n DateTimeContextPickerComponent,\n IconDirective,\n FormsModule,\n PopoverModule,\n FormGroupComponent\n ]\n})\nexport class LiveModeConfigurationControlsComponent {\n // Popover messages for translation extraction\n readonly REFRESH_POPOVER_MESSAGE = gettext(\n 'The update method is determined by the widget type. Some widgets support real-time updates via WebSocket connection, while others use periodic refreshes.'\n );\n readonly TIME_RANGE_PICKER_POPOVER = gettext(\n 'Sets a rolling time window relative to the current time. As time progresses, the window automatically shifts to maintain the selected duration, always showing the most recent data.'\n );\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly formBuilder = inject(FormBuilder);\n\n private readonly settingsSignal = signal<Partial<GlobalContextSettings>>({\n showAutoRefresh: true,\n showTimeContext: true\n });\n private readonly defaultLiveContext = fillMissingDefaults({ refreshOption: REFRESH_OPTION.LIVE });\n private readonly currentContext = signal<GlobalContextState>(\n structuredClone(this.defaultLiveContext)\n );\n\n @Input()\n set settings(value: Partial<GlobalContextSettings> | null) {\n this.settingsSignal.set({\n showAutoRefresh: true,\n showTimeContext: true,\n ...(value ?? {})\n });\n }\n get settings(): Partial<GlobalContextSettings> {\n return this.settingsSignal();\n }\n\n @Input()\n set context(value: GlobalContextState | null) {\n if (!value) {\n return;\n }\n\n const normalized = fillMissingDefaults({\n ...value,\n refreshOption: REFRESH_OPTION.LIVE\n });\n const cloned = structuredClone(normalized);\n\n this.currentContext.set(cloned);\n this.patchFormFromContext(cloned);\n }\n\n readonly contextChange = output<Partial<GlobalContextState>>();\n\n form: ReturnType<typeof this.createForm>;\n\n constructor() {\n this.form = this.createForm();\n\n this.form.valueChanges\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(100))\n .subscribe(value => {\n this.contextChange.emit({\n dateTimeContext: value.dateTimeContext ?? null,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n isAutoRefreshEnabled: value.isAutoRefreshEnabled ?? null,\n aggregation: null\n });\n });\n\n this.patchFormFromContext(this.currentContext());\n }\n\n private createForm() {\n return this.formBuilder.group({\n dateTimeContext: this.formBuilder.control<DateTimeContext | null>(null),\n refreshInterval: this.formBuilder.control<number>(GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL),\n isAutoRefreshEnabled: this.formBuilder.control<boolean | null>(true)\n });\n }\n\n private patchFormFromContext(context?: GlobalContextState): void {\n if (!this.form) {\n return;\n }\n\n const ctx = context ?? this.currentContext();\n const { dateTimeContext, isAutoRefreshEnabled } = ctx;\n this.form.patchValue(\n {\n dateTimeContext: dateTimeContext ? structuredClone(dateTimeContext) : null,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n isAutoRefreshEnabled: isAutoRefreshEnabled ?? null\n },\n { emitEvent: false }\n );\n }\n}\n","@if (form) {\n @let SHOW_TIME_CONTEXT = settings.showTimeContext;\n @let SHOW_AUTO_REFRESH = settings.showAutoRefresh;\n\n <form [formGroup]=\"form\">\n <div class=\"content-flex-82\">\n <div class=\"col-5\">\n @if (SHOW_TIME_CONTEXT) {\n <fieldset class=\"c8y-fieldset\">\n <legend>\n <div class=\"standalone btn-icon-dot__item time-context m-r-4\">\n <i [c8yIcon]=\"'calendar'\"></i>\n </div>\n {{ 'Date & time' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"TIME_RANGE_PICKER_POPOVER | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-form-group class=\"m-b-4 p-t-16 p-b-16\">\n <c8y-date-time-context-picker\n formControlName=\"dateTimeContext\"\n [config]=\"{ showDateTo: false, showDateFrom: true }\"\n ></c8y-date-time-context-picker>\n </c8y-form-group>\n </fieldset>\n }\n </div>\n <div class=\"col-3\">\n @if (SHOW_AUTO_REFRESH) {\n <fieldset class=\"c8y-fieldset\">\n <legend class=\"d-flex\">\n <div class=\"standalone btn-icon-dot__item auto-refresh m-r-4\">\n <i [c8yIcon]=\"'refresh'\"></i>\n </div>\n {{ 'Auto refresh' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"REFRESH_POPOVER_MESSAGE | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-form-group class=\"m-b-8 form-group-sm p-t-16 p-b-16\">\n <div class=\"d-flex gap-8 a-i-center\">\n <label class=\"c8y-switch c8y-switch--inline\">\n <input\n type=\"checkbox\"\n #arInput\n formControlName=\"isAutoRefreshEnabled\"\n />\n <span></span>\n <span>\n {{ 'Auto refresh enabled' | translate }}\n </span>\n </label>\n </div>\n </c8y-form-group>\n </fieldset>\n }\n </div>\n </div>\n </form>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n TemplateRef,\n computed,\n effect,\n input,\n output,\n viewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport {\n C8yTranslatePipe,\n FormsModule,\n IconDirective,\n TabWithTemplate,\n TabsOutletComponent\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type {\n GlobalContextSettings,\n GlobalContextState\n} from '../../../models/global-context.model';\nimport { HistoryModeConfigurationControlsComponent } from '../history-mode-configuration-controls/history-mode-configuration-controls.component';\nimport { LiveModeConfigurationControlsComponent } from '../live-mode-configuration-controls/live-mode-configuration-controls.component';\n\ntype InlineTab = TabWithTemplate & { isActive?: boolean };\n\n@Component({\n selector: 'c8y-configuration-controls',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"p-relative fit-h\">\n <div [attr.class]=\"containerClass()\">\n <c8y-tabs-outlet\n [orientation]=\"controlsDisplayMode()\"\n [outletName]=\"resolvedOutletName()\"\n [attr.outletname]=\"resolvedOutletName()\"\n [openFirstTab]=\"false\"\n [tabs]=\"inlineTabs()\"\n ></c8y-tabs-outlet>\n\n @if (selectedMode() === REFRESH_OPTION.LIVE) {\n <div class=\"p-l-24 p-r-24 fit-w min-width-0\">\n <c8y-live-mode-configuration-controls\n [settings]=\"settings()\"\n [context]=\"liveContext()\"\n (contextChange)=\"handleLiveChanges($event)\"\n ></c8y-live-mode-configuration-controls>\n </div>\n }\n\n @if (selectedMode() === REFRESH_OPTION.HISTORY) {\n <div class=\"p-l-24 p-r-24 fit-w min-width-0\">\n <c8y-history-mode-configuration-controls\n [settings]=\"settings()\"\n [context]=\"historyContext()\"\n (contextChange)=\"handleHistoryChanges($event)\"\n (validationStatus)=\"handleValidationStatus($event)\"\n ></c8y-history-mode-configuration-controls>\n </div>\n }\n </div>\n\n <ng-template #LiveTab>\n <i [c8yIcon]=\"'process'\"></i>\n <div>\n <p class=\"text-bold\">{{ MODE_LABELS.LIVE | translate }}</p>\n <p class=\"tab-description text-12 l-h-tight\">\n {{ MODE_DESCRIPTIONS.LIVE | translate }}\n </p>\n </div>\n </ng-template>\n <ng-template #HistoryTab>\n <i [c8yIcon]=\"'schedule1'\"></i>\n <div>\n <p class=\"text-bold\">{{ MODE_LABELS.HISTORY | translate }}</p>\n <p class=\"tab-description text-12 l-h-tight\">\n {{ MODE_DESCRIPTIONS.HISTORY | translate }}\n </p>\n </div>\n </ng-template>\n </div>\n `,\n standalone: true,\n imports: [\n TooltipModule,\n CollapseModule,\n TabsOutletComponent,\n ReactiveFormsModule,\n FormsModule,\n PopoverModule,\n HistoryModeConfigurationControlsComponent,\n LiveModeConfigurationControlsComponent,\n C8yTranslatePipe,\n IconDirective\n ]\n})\nexport class ConfigurationControlsComponent {\n readonly MODE_LABELS = {\n LIVE: gettext('Live'),\n HISTORY: gettext('History')\n } as const;\n\n readonly MODE_DESCRIPTIONS = {\n LIVE: gettext('Dynamic time window that moves with current time to show recent data.'),\n HISTORY: gettext('Fixed time period for analyzing historical data.')\n } as const;\n readonly REFRESH_OPTION = REFRESH_OPTION;\n\n readonly controlsDisplayMode = input<'horizontal' | 'vertical'>('vertical');\n readonly settings = input<Partial<GlobalContextSettings>>({\n showAutoRefresh: true,\n showTimeContext: true,\n showAggregation: true\n });\n readonly activeMode = input<RefreshOption>(REFRESH_OPTION.LIVE);\n readonly liveContext = input<GlobalContextState | null>(null);\n readonly historyContext = input<GlobalContextState | null>(null);\n readonly supportedModes = input<RefreshOption[]>([REFRESH_OPTION.LIVE, REFRESH_OPTION.HISTORY]);\n\n readonly tabsOutletName = input<string | null>(null);\n private readonly liveTabSelect = new EventEmitter<void>();\n private readonly historyTabSelect = new EventEmitter<void>();\n readonly refreshOptionChange = output<RefreshOption>();\n readonly contextChange = output<Partial<GlobalContextState>>();\n readonly validationStatus = output<boolean>();\n\n readonly selectedMode = computed(() => this.activeMode());\n readonly containerClass = computed(() =>\n this.controlsDisplayMode() === 'horizontal' ? 'horizontal d-col' : 'd-flex'\n );\n readonly resolvedOutletName = computed(\n () => this.tabsOutletName() ?? 'verticalTabOutletForConfigurationModes'\n );\n\n readonly liveTabTemplate = viewChild<TemplateRef<any>>('LiveTab');\n readonly historyTabTemplate = viewChild<TemplateRef<any>>('HistoryTab');\n\n readonly inlineTabs = computed(() => {\n const liveTemp = this.liveTabTemplate();\n const historyTemp = this.historyTabTemplate();\n\n if (!liveTemp || !historyTemp) {\n return [];\n }\n\n const modes = this.supportedModes();\n const allTabs: InlineTab[] = [\n {\n title: this.MODE_LABELS.LIVE,\n template: liveTemp,\n showAlways: true,\n tabsOutlet: this.resolvedOutletName(),\n onSelect: this.liveTabSelect,\n isActive: this.selectedMode() === REFRESH_OPTION.LIVE\n },\n {\n title: this.MODE_LABELS.HISTORY,\n template: historyTemp,\n showAlways: true,\n tabsOutlet: this.resolvedOutletName(),\n onSelect: this.historyTabSelect,\n isActive: this.selectedMode() === REFRESH_OPTION.HISTORY\n }\n ];\n\n return allTabs.filter((tab, index) => {\n const mode = index === 0 ? REFRESH_OPTION.LIVE : REFRESH_OPTION.HISTORY;\n return modes.includes(mode);\n });\n });\n\n constructor() {\n this.liveTabSelect\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.handleTabSelect(REFRESH_OPTION.LIVE));\n this.historyTabSelect\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.handleTabSelect(REFRESH_OPTION.HISTORY));\n\n // Validate active mode and fallback to first available if not supported\n effect(() => {\n const currentMode = this.activeMode();\n const modes = this.supportedModes();\n\n if (!modes.includes(currentMode) && modes.length > 0) {\n this.refreshOptionChange.emit(modes[0]);\n }\n });\n\n // Emit validation status when mode changes\n effect(() => {\n const mode = this.selectedMode();\n if (mode === REFRESH_OPTION.LIVE) {\n this.validationStatus.emit(true);\n }\n });\n }\n\n handleTabSelect(mode: RefreshOption): void {\n if (this.selectedMode() === mode) {\n return;\n }\n\n this.refreshOptionChange.emit(mode);\n }\n\n handleLiveChanges(changes: Partial<GlobalContextState>): void {\n this.contextChange.emit({ ...changes, refreshOption: REFRESH_OPTION.LIVE });\n }\n\n handleHistoryChanges(changes: Partial<GlobalContextState>): void {\n this.contextChange.emit({ ...changes, refreshOption: REFRESH_OPTION.HISTORY });\n }\n\n handleValidationStatus(isValid: boolean): void {\n this.validationStatus.emit(isValid);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n Input,\n output,\n signal\n} from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, FormsModule } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { isEqual } from 'lodash-es';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport { TIME_DURATION } from '../../../models/constants';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport { fillMissingDefaults } from '../../../utils/global-context-defaults.util';\nimport { ConfigurationControlsComponent } from '../configuration-controls/configuration-controls.component';\n\n@Component({\n selector: 'c8y-configuration-collapse',\n templateUrl: './configuration-collapse.component.html',\n host: { class: 'd-contents' },\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n TooltipModule,\n CollapseModule,\n ReactiveFormsModule,\n FormsModule,\n PopoverModule,\n ConfigurationControlsComponent,\n C8yTranslatePipe\n ]\n})\nexport class ConfigurationCollapseComponent {\n readonly REFRESH_OPTION = REFRESH_OPTION;\n\n readonly isCollapsed = signal(true);\n readonly shouldSave = signal(false);\n readonly hasPendingChanges = signal(false);\n readonly activeMode = signal<RefreshOption>(REFRESH_OPTION.LIVE);\n readonly supportedModes = input<RefreshOption[]>([REFRESH_OPTION.LIVE, REFRESH_OPTION.HISTORY]);\n readonly isFormValid = signal(true);\n\n readonly helpText = gettext(\n 'When checked, saves these settings as the default configuration for this dashboard. If unchecked, changes will only apply for the current session and will reset when you reload the page.'\n );\n\n private readonly latestContext = signal<GlobalContextState | null>(null);\n private readonly snapshots = signal<Record<RefreshOption, GlobalContextState | null>>({\n [REFRESH_OPTION.LIVE]: null,\n [REFRESH_OPTION.HISTORY]: null\n });\n\n readonly liveViewContext = computed(() => {\n return this.snapshots()[REFRESH_OPTION.LIVE] ?? undefined;\n });\n readonly historyViewContext = computed(() => {\n return this.snapshots()[REFRESH_OPTION.HISTORY] ?? undefined;\n });\n\n @Input() set context(value: GlobalContextState) {\n if (!value) {\n return;\n }\n\n this.latestContext.set(structuredClone(value));\n\n // CRITICAL: Don't update form snapshots while dropdown is open\n // User is actively editing - external updates would overwrite their changes\n if (this.isCollapsed()) {\n this.activeMode.set(value.refreshOption ?? REFRESH_OPTION.LIVE);\n\n this.snapshots.set({\n [REFRESH_OPTION.LIVE]:\n value.refreshOption === REFRESH_OPTION.LIVE ? structuredClone(value) : null,\n [REFRESH_OPTION.HISTORY]:\n value.refreshOption === REFRESH_OPTION.HISTORY ? structuredClone(value) : null\n });\n\n this.hasPendingChanges.set(false);\n } else {\n // Dropdown is open - only recalculate if current state differs from latest\n this.recalculatePendingChanges();\n }\n }\n\n readonly contextChange = output<Partial<GlobalContextState>>();\n readonly refreshOptionChange = output<RefreshOption>();\n readonly savePreferenceChange = output<boolean>();\n\n toggle(): void {\n this.isCollapsed.update(value => !value);\n }\n\n close(): void {\n if (this.isCollapsed()) {\n return;\n }\n\n this.isCollapsed.set(true);\n this.resetToLatest();\n }\n\n onCollapsed(): void {\n this.isCollapsed.set(true);\n this.shouldSave.set(false);\n this.resetToLatest();\n }\n\n onExpanded(): void {\n this.isCollapsed.set(false);\n\n const mode = this.activeMode();\n const snapshot = this.snapshots()[mode];\n\n if (!snapshot) {\n const defaultContext = this.createDefaultContext(mode);\n this.snapshots.update(previous => ({\n ...previous,\n [mode]: structuredClone(defaultContext)\n }));\n }\n\n this.recalculatePendingChanges();\n }\n\n onModeChange(changes: Partial<GlobalContextState>): void {\n const mode = changes.refreshOption ?? this.activeMode();\n if (!mode) {\n return;\n }\n\n const current = this.snapshots()[mode]\n ? structuredClone(this.snapshots()[mode]!)\n : this.createDefaultContext(mode);\n\n const { refreshOption: _ignored, ...rest } = changes;\n const merged: GlobalContextState = { ...current, ...rest, refreshOption: mode };\n\n if (mode === REFRESH_OPTION.LIVE) {\n const normalized = fillMissingDefaults({ ...merged, refreshOption: REFRESH_OPTION.LIVE });\n merged.dateTimeContext = normalized.dateTimeContext;\n merged.isAutoRefreshEnabled = normalized.isAutoRefreshEnabled;\n merged.refreshInterval = normalized.refreshInterval;\n }\n\n this.snapshots.update(previous => ({\n ...previous,\n [mode]: structuredClone(merged)\n }));\n\n if (mode === this.activeMode()) {\n this.recalculatePendingChanges();\n }\n }\n\n onModeSelected(mode: RefreshOption): void {\n if (this.activeMode() === mode) {\n return;\n }\n\n this.activeMode.set(mode);\n\n const snapshot = this.snapshots()[mode];\n if (!snapshot) {\n const defaultContext = this.createDefaultContext(mode);\n this.snapshots.update(previous => ({\n ...previous,\n [mode]: structuredClone(defaultContext)\n }));\n }\n\n this.recalculatePendingChanges();\n }\n\n apply(): void {\n const shouldPersist = this.shouldSave();\n this.savePreferenceChange.emit(shouldPersist);\n\n if (!this.hasPendingChanges()) {\n return;\n }\n\n const mode = this.activeMode();\n const activeSnapshot = this.snapshots()[mode];\n if (!activeSnapshot) {\n return;\n }\n\n const payload = structuredClone(activeSnapshot);\n\n this.contextChange.emit(payload);\n this.refreshOptionChange.emit(mode);\n\n this.latestContext.set(structuredClone(payload));\n\n this.hasPendingChanges.set(false);\n this.shouldSave.set(false);\n this.isCollapsed.set(true);\n }\n\n shouldSaveInDashboard(change: boolean): void {\n this.shouldSave.set(change);\n }\n\n onValidationStatusChange(isValid: boolean): void {\n this.isFormValid.set(isValid);\n }\n\n private resetToLatest(): void {\n const latest = this.latestContext();\n const latestMode = latest?.refreshOption ?? REFRESH_OPTION.LIVE;\n\n this.snapshots.set({\n [REFRESH_OPTION.LIVE]:\n latest && latestMode === REFRESH_OPTION.LIVE ? structuredClone(latest) : null,\n [REFRESH_OPTION.HISTORY]:\n latest && latestMode === REFRESH_OPTION.HISTORY ? structuredClone(latest) : null\n });\n\n this.activeMode.set(latestMode);\n this.hasPendingChanges.set(false);\n this.shouldSave.set(false);\n this.isFormValid.set(true);\n }\n\n private createDefaultContext(mode: RefreshOption): GlobalContextState {\n if (mode === REFRESH_OPTION.LIVE) {\n return fillMissingDefaults({ refreshOption: REFRESH_OPTION.LIVE });\n }\n\n const now = new Date();\n const dateTo = now.toISOString();\n const dateFrom = new Date(now.getTime() - TIME_DURATION.ONE_HOUR_MS).toISOString();\n\n return {\n refreshOption: REFRESH_OPTION.HISTORY,\n dateTimeContext: {\n dateFrom,\n dateTo,\n interval: TIME_INTERVAL.CUSTOM\n },\n aggregation: null\n };\n }\n\n private recalculatePendingChanges(): void {\n const latest = this.latestContext();\n if (!latest) {\n this.hasPendingChanges.set(false);\n return;\n }\n\n const latestMode = latest.refreshOption ?? REFRESH_OPTION.LIVE;\n if (this.activeMode() !== latestMode) {\n this.hasPendingChanges.set(true);\n return;\n }\n\n const snapshot = this.snapshots()[this.activeMode()];\n if (!snapshot) {\n this.hasPendingChanges.set(false);\n return;\n }\n\n this.hasPendingChanges.set(!isEqual(snapshot, latest));\n }\n}\n","<div\n class=\"c8y-global-context\"\n [collapse]=\"isCollapsed()\"\n (collapsed)=\"onCollapsed()\"\n (expanded)=\"onExpanded()\"\n [isAnimated]=\"true\"\n>\n <div class=\"p-t-16 p-b-16 p-l-24 p-r-24 separator-bottom\">\n <span\n class=\"h4\"\n translate\n >\n Time mode\n </span>\n </div>\n <div>\n @if (!isCollapsed()) {\n <c8y-configuration-controls\n [activeMode]=\"activeMode()\"\n [liveContext]=\"liveViewContext()\"\n [historyContext]=\"historyViewContext()\"\n [supportedModes]=\"supportedModes()\"\n (refreshOptionChange)=\"onModeSelected($event)\"\n (contextChange)=\"onModeChange($event)\"\n (validationStatus)=\"onValidationStatusChange($event)\"\n ></c8y-configuration-controls>\n }\n </div>\n <div class=\"c8y-top-drawer--footer\">\n <div class=\"d-flex a-i-center gap-8\">\n <button\n class=\"btn btn-default\"\n [title]=\"'Close help' | translate\"\n aria-controls=\"collapseHelp\"\n [attr.aria-expanded]=\"!isCollapsed()\"\n type=\"button\"\n (click)=\"toggle()\"\n translate\n >\n Close\n </button>\n <button\n class=\"btn btn-primary\"\n [title]=\"'Apply global context' | translate\"\n aria-controls=\"collapseHelp\"\n [attr.aria-expanded]=\"!isCollapsed()\"\n type=\"button\"\n (click)=\"apply()\"\n [disabled]=\"!hasPendingChanges() || !isFormValid()\"\n translate\n data-cy=\"global-date-context--Apply-button\"\n >\n Apply\n </button>\n\n <label class=\"c8y-checkbox d-flex align-items-center m-b-0\">\n <input\n class=\"m-r-4\"\n type=\"checkbox\"\n [ngModel]=\"shouldSave()\"\n (ngModelChange)=\"shouldSaveInDashboard($event)\"\n />\n <span class=\"a-s-center m-r-8\"></span>\n <span\n class=\"text-truncate\"\n translate\n >\n Save in dashboard configuration\n </span>\n <button\n class=\"btn-help btn-help--sm m-l-4\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"helpText | translate\"\n placement=\"right\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </label>\n </div>\n </div>\n</div>\n","import { inject, Injectable } from '@angular/core';\nimport { ActivatedRoute, NavigationExtras, Router } from '@angular/router';\nimport { aggregationType } from '@c8y/client';\nimport { map, Observable } from 'rxjs';\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport {\n DateContextParams,\n DateContextQueryParamNames,\n GlobalContextState,\n InputDateContextQueryParams,\n ParameterValidationStatus\n} from '../../models/global-context.model';\nimport { Interval, TIME_INTERVAL, TimeInterval } from '../../models/interval-picker.model';\nimport { DateTimeContextPickerService } from '../domain/date-time-context-picker.service';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\nimport { GlobalContextValidationService } from '../domain/global-context-validation.service';\n\n/**\n * Service responsible for managing date context query parameters in the URL.\n *\n * This service provides a centralized way to handle reading, writing, and validation\n * of date context query parameters. It supports both interval-based and date-range-based\n * time contexts, with interval taking precedence when both are present.\n *\n * Key features:\n * - Reactive query parameter changes via observables\n * - Validation of query parameter values\n * - Conversion between query parameters and typed objects\n * - URL navigation with proper parameter handling\n * - Support for both interval and custom date ranges\n *\n * @example\n * ```typescript\n * // Subscribe to query parameter changes\n * queryService.queryParamsChange$().subscribe(params => {\n * console.log('Date context params:', params);\n * });\n *\n * // Set new query parameters\n * queryService.setDateContextQueryParams({\n * interval: TIME_INTERVAL.DAYS,\n * aggregation: aggregationType.HOURLY,\n * isAutoRefreshEnabled: true,\n * refreshOption: 'live'\n * });\n *\n * // Get context from current URL\n * const context = queryService.dateTimeContextFromQueryParams();\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class GlobalContextQueryService {\n private activatedRoute = inject(ActivatedRoute);\n private dateTimeContextPickerService = inject(DateTimeContextPickerService);\n private router = inject(Router);\n private validationService = inject(GlobalContextValidationService);\n\n /**\n * Stores the state when browser navigation occurs via back/forward buttons.\n * Used to preserve the global context state during browser history navigation\n * to ensure consistency between URL and component state.\n */\n navigationPopState = null;\n\n /**\n * Returns an observable that emits processed date context query parameters.\n *\n * This observable emits every time the route's query parameters change, providing\n * validated and typed parameter values. Invalid parameter values are automatically\n * filtered out and replaced with null or undefined as appropriate.\n *\n * The emitted object includes:\n * - `dateContextInterval`: Validated interval ID or null\n * - `dateContextAggregation`: Validated aggregation type or null\n * - `globalContextAutoRefresh`: Parsed boolean value or undefined\n * - All other original query parameters (preserved as-is)\n *\n * @returns Observable that emits InputDateContextQueryParams whenever route query params change\n *\n * @example\n * ```typescript\n * // Subscribe to parameter changes\n * queryService.queryParamsChange$().pipe(\n * takeUntilDestroyed()\n * ).subscribe(params => {\n * if (params.dateContextInterval) {\n * console.log('Valid interval:', params.dateContextInterval);\n * }\n * if (params.globalContextAutoRefresh === true) {\n * console.log('Auto-refresh is enabled');\n * }\n * });\n * ```\n */\n queryParamsChange$(): Observable<InputDateContextQueryParams> {\n // Get root route for consistent query param access\n let currentRoute = this.activatedRoute;\n while (currentRoute.parent) {\n currentRoute = currentRoute.parent;\n }\n\n return currentRoute.queryParams.pipe(\n map((params: Record<DateContextQueryParamNames, string>) => this.processQueryParams(params))\n );\n }\n\n /**\n * Creates a global context state object from the current route's query parameters.\n *\n * This method reads the current query parameters and attempts to build a valid\n * GlobalContextState object. It handles validation of parameters and applies\n * business logic for parameter precedence and conflicts.\n *\n * **Parameter Precedence Rules:**\n * 1. **Interval takes precedence**: If a valid interval is provided, any date range\n * parameters (dateFrom/dateTo) are ignored and recalculated based on the interval\n * 2. **Date range fallback**: If no valid interval is found, the method attempts\n * to use explicit date range parameters\n * 3. **Partial context**: If only non-temporal parameters are valid (aggregation,\n * refresh settings), a partial context without dateTimeContext is returned\n *\n * **Validation Logic:**\n * - Intervals are validated through DateTimeContextPickerService.isSelectableInterval()\n * - Date ranges are validated through DateTimeContextPickerService.isValidDateRange()\n * - Boolean parameters are strictly parsed (only 'true'/'false' strings accepted)\n * - Invalid refresh modes default to 'live'\n *\n * @returns Partial GlobalContextState object with valid parameters, or null if no valid context can be built\n *\n * @example\n * ```typescript\n * // With interval parameter: ?dateContextInterval=DAYS&dateContextAggregation=HOURLY\n * const context = queryService.dateTimeContextFromQueryParams();\n * // Returns: {\n * // aggregation: 'HOURLY',\n * // dateTimeContext: {\n * // dateFrom: '2024-01-01T00:00:00.000Z',\n * // dateTo: '2024-01-02T00:00:00.000Z',\n * // interval: 'DAYS'\n * // }\n * // }\n *\n * // With date range: ?dateContextFrom=2024-01-01&dateContextTo=2024-01-02\n * const context2 = queryService.dateTimeContextFromQueryParams();\n * // Returns: {\n * // dateTimeContext: {\n * // dateFrom: '2024-01-01',\n * // dateTo: '2024-01-02',\n * // interval: 'custom'\n * // }\n * // }\n *\n * // Invalid parameters\n * const context3 = queryService.dateTimeContextFromQueryParams();\n * // Returns: null\n * ```\n */\n dateTimeContextFromQueryParams(): Partial<GlobalContextState> | null {\n // Try multiple methods to get query params due to Angular routing inconsistencies\n let params = {};\n\n // Method 1: Navigate up to root route to get query params\n // Query params can be \"lost\" in child routes, so we traverse to the root\n // where they are most reliably available during navigation\n let currentRoute = this.activatedRoute;\n while (currentRoute.parent) {\n currentRoute = currentRoute.parent;\n }\n params = currentRoute.snapshot.queryParams;\n\n // Method 2: Fallback to manual URL parsing if root route params are empty\n if (!params || Object.keys(params).length === 0) {\n const currentUrl = this.router.url;\n if (currentUrl) {\n const questionMarkIndex = currentUrl.indexOf('?');\n if (questionMarkIndex > -1) {\n const queryString = currentUrl.substring(questionMarkIndex + 1);\n const urlParams = new URLSearchParams(queryString);\n params = {};\n urlParams.forEach((value, key) => {\n params[key] = value;\n });\n }\n }\n }\n\n // Extract and validate query parameters\n const dateContextInterval = params[DateContextQueryParamNames.DATE_CONTEXT_INTERVAL];\n const isValidInterval =\n this.dateTimeContextPickerService.isSelectableInterval(dateContextInterval);\n\n // Build the base context object without undefined values\n const baseContext: Partial<GlobalContextState> = {};\n\n const aggregation = params[DateContextQueryParamNames.DATE_CONTEXT_AGGREGATION];\n if (aggregation) {\n baseContext.aggregation = aggregation;\n }\n\n const refreshOption = params[DateContextQueryParamNames.DATE_CONTEXT_REFRESH_MODE];\n if (refreshOption) {\n baseContext.refreshOption =\n refreshOption === REFRESH_OPTION.HISTORY || refreshOption === REFRESH_OPTION.LIVE\n ? refreshOption\n : GLOBAL_CONTEXT_DEFAULTS.REFRESH_OPTION;\n }\n\n const isAutoRefreshEnabled = this.validationService.parseBoolean(\n params[DateContextQueryParamNames.DATE_CONTEXT_AUTO_REFRESH]\n );\n if (isAutoRefreshEnabled !== undefined) {\n baseContext.isAutoRefreshEnabled = isAutoRefreshEnabled;\n }\n\n // Try to get context from interval first\n if (isValidInterval && dateContextInterval) {\n const intervalId = dateContextInterval as Interval['id'];\n const range = DateTimeContextUtil.dateRangeFromInterval(\n intervalId as unknown as TimeInterval\n );\n if (range) {\n const [dateFrom, dateTo] = range;\n return {\n ...baseContext,\n dateTimeContext: DateTimeContextUtil.ensureIsoContext({\n interval: intervalId as unknown as TimeInterval,\n dateFrom,\n dateTo\n })\n };\n }\n }\n\n // If interval not provided, try getting date range from query params\n const dateRange = this.getDateContextFromQueryParams();\n if (dateRange) {\n return {\n ...baseContext,\n dateTimeContext: DateTimeContextUtil.ensureIsoContext({\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: dateRange[0],\n dateTo: dateRange[1]\n })\n };\n }\n\n // If we have some context values but no valid time range,\n // check if we should return the partial context or null\n if (Object.keys(baseContext).length > 0) {\n return baseContext;\n }\n\n // No valid context found at all\n return null;\n }\n\n /**\n * Updates the URL query parameters with new date context values.\n *\n * This method translates a context state object into URL query parameters and\n * navigates to update the current route. It handles the mutual exclusivity\n * between interval-based and date-range-based parameters.\n *\n * **Parameter Logic:**\n * - **Interval mode**: When a valid interval is provided (not 'custom'),\n * date-specific parameters (dateFrom/dateTo) are cleared\n * - **Date range mode**: When interval is 'custom' or undefined,\n * interval parameter is cleared and date range parameters are set\n * - **Navigation behavior**: Uses 'merge' strategy to preserve other query parameters\n * - **Browser history**: Handles popstate navigation differently than programmatic navigation\n *\n * **Performance Optimization:**\n * The method includes normalization logic to prevent unnecessary navigation\n * when the new parameters would result in the same normalized URL state.\n *\n * @param contextState Object containing the new context state values\n * @param contextState.interval - Time interval ('DAYS', 'HOURS', etc.) or 'custom'\n * @param contextState.date - Array of [dateFrom, dateTo] strings for custom ranges\n * @param contextState.aggregation - Data aggregation type ('HOURLY', 'DAILY', etc.)\n * @param contextState.isAutoRefreshEnabled - Whether auto-refresh should be enabled\n * @param contextState.refreshOption - Refresh mode ('live' or 'history')\n *\n * @example\n * ```typescript\n * // Set interval-based context\n * queryService.setDateContextQueryParams({\n * interval: TIME_INTERVAL.DAYS,\n * aggregation: aggregationType.HOURLY,\n * isAutoRefreshEnabled: true,\n * refreshOption: 'live'\n * });\n * // Results in: https://example.com/apps/cockpit/#/?dateContextInterval=DAYS&dateContextAggregation=HOURLY&globalContextAutoRefresh=true&globalContextRefreshMode=live\n *\n * // Set custom date range context\n * queryService.setDateContextQueryParams({\n * interval: TIME_INTERVAL.CUSTOM,\n * date: ['2024-01-01T00:00:00.000Z', '2024-01-02T00:00:00.000Z'],\n * aggregation: aggregationType.DAILY,\n * isAutoRefreshEnabled: false,\n * refreshOption: 'history'\n * });\n * // Results in: https://example.com/apps/cockpit/#/?dateContextFrom=2024-01-01T00:00:00.000Z&dateContextTo=2024-01-02T00:00:00.000Z&dateContextAggregation=DAILY&globalContextAutoRefresh=false&globalContextRefreshMode=history\n * ```\n */\n setDateContextQueryParams(contextState: DateContextParams): void {\n const { interval, date, aggregation, isAutoRefreshEnabled, refreshOption } = contextState;\n const queryParams = this.buildQueryParams({\n interval,\n date,\n aggregation,\n isAutoRefreshEnabled,\n refreshOption\n });\n\n const navigation = this.router.getCurrentNavigation();\n\n this.navigateWithQueryParams(queryParams, {\n queryParamsHandling: 'merge',\n state: {\n clearParams: navigation?.trigger === 'popstate' ? false : true\n }\n });\n }\n\n /**\n * Removes all date context query parameters from the current URL.\n *\n * This method performs a selective cleanup by detecting which date context\n * parameters are currently present in the URL and removing only those.\n * It preserves all non-date-context parameters unchanged.\n *\n * **Behavior:**\n * - **Selective removal**: Only removes parameters that are actually present\n * - **Preserve other params**: Non-date-context parameters remain unchanged\n * - **No-op optimization**: If no date context parameters exist, no navigation occurs\n * - **Merge strategy**: Uses 'merge' queryParamsHandling to maintain other URL state\n *\n * **Parameters removed (if present):**\n * - `dateContextFrom`\n * - `dateContextTo`\n * - `dateContextInterval`\n * - `dateContextAggregation`\n * - `globalContextAutoRefresh`\n * - `globalContextRefreshMode`\n *\n * @example\n * ```typescript\n * // Current URL: https://example.com/apps/cockpit/#/dashboard?dateContextInterval=DAYS&dateContextAggregation=HOURLY&otherParam=value\n * queryService.checkAndRemoveDateContextParams();\n * // Result URL: https://example.com/apps/cockpit/#/dashboard?otherParam=value\n *\n * // Current URL: https://example.com/apps/cockpit/#/dashboard?someOtherParam=value (no date context params)\n * queryService.checkAndRemoveDateContextParams();\n * // Result: No navigation occurs (no-op)\n * ```\n */\n checkAndRemoveDateContextParams(): void {\n const currentParams = this.activatedRoute.snapshot.queryParams;\n const dateContextParamNames = Object.values(DateContextQueryParamNames);\n\n // Check if any date context params exist in the current URL\n const dateContextParamsPresent = dateContextParamNames.some(\n paramName => currentParams[paramName] !== undefined\n );\n\n if (dateContextParamsPresent) {\n // Create an object with null values for all date context params that are present\n const paramsToRemove = dateContextParamNames.reduce(\n (acc, paramName) => {\n if (currentParams[paramName] !== undefined) {\n acc[paramName] = null;\n }\n return acc;\n },\n {} as Record<string, null>\n );\n\n // Only navigate if there are params to remove\n if (Object.keys(paramsToRemove).length > 0) {\n this.navigateWithQueryParams(paramsToRemove, { queryParamsHandling: 'merge' });\n }\n }\n }\n\n /**\n * Gets the current parameter validation status for debugging and UI state management.\n *\n * This method analyzes the current query parameters and returns detailed validation\n * information for each parameter type. Useful for debugging parameter issues and\n * providing user feedback about parameter validity.\n *\n * @returns ParameterValidationStatus object containing validation results for each parameter type\n *\n * @example\n * ```typescript\n * const status = queryService.getParameterValidationStatus();\n *\n * if (!status.interval && !status.dateRange) {\n * console.warn('No valid time context found in URL parameters');\n * }\n *\n * if (status.autoRefresh === undefined) {\n * console.info('Auto-refresh parameter not specified or invalid');\n * }\n *\n * // Use for conditional UI rendering\n * const hasValidTimeContext = status.interval || status.dateRange;\n * ```\n */\n getParameterValidationStatus(): ParameterValidationStatus {\n // Get params from root route\n let currentRoute = this.activatedRoute;\n while (currentRoute.parent) {\n currentRoute = currentRoute.parent;\n }\n const params = currentRoute.snapshot.queryParams;\n\n return this.validationService.validateParameters({\n interval: params[DateContextQueryParamNames.DATE_CONTEXT_INTERVAL],\n aggregation: params[DateContextQueryParamNames.DATE_CONTEXT_AGGREGATION],\n dateFrom: params[DateContextQueryParamNames.DATE_CONTEXT_FROM],\n dateTo: params[DateContextQueryParamNames.DATE_CONTEXT_TO],\n autoRefresh: params[DateContextQueryParamNames.DATE_CONTEXT_AUTO_REFRESH]\n });\n }\n\n /**\n * Validates if the current query parameters represent a valid global context.\n *\n * This is a convenience method that combines parameter validation with context building\n * to determine if the URL contains sufficient valid parameters to create a global context.\n *\n * @returns True if current parameters can build a valid global context, false otherwise\n *\n * @example\n * ```typescript\n * if (queryService.hasValidContext()) {\n * const context = queryService.dateTimeContextFromQueryParams();\n * // Context is guaranteed to be non-null\n * } else {\n * // Show default state or parameter input form\n * }\n * ```\n */\n hasValidContext(): boolean {\n const context = this.dateTimeContextFromQueryParams();\n return (\n context !== null && (context.dateTimeContext !== undefined || Object.keys(context).length > 0)\n );\n }\n\n /**\n * Builds query parameters based on the provided context state.\n * Chooses between interval-based or date-range-based parameters.\n *\n * @param contextState The global context state containing interval, date, aggregation, etc.\n * @returns Record of query parameters to be set in the URL\n */\n private buildQueryParams(\n contextState: DateContextParams\n ): Record<DateContextQueryParamNames, null | string | boolean> {\n const { interval, date, aggregation, isAutoRefreshEnabled, refreshOption } = contextState;\n if (interval && interval !== TIME_INTERVAL.CUSTOM) {\n return this.buildIntervalBasedQueryParams(\n interval,\n aggregation,\n isAutoRefreshEnabled,\n refreshOption\n );\n } else {\n return this.buildDateRangeBasedQueryParams(\n date,\n aggregation,\n isAutoRefreshEnabled,\n refreshOption\n );\n }\n }\n\n /**\n * Builds query parameters for interval-based time context.\n * Clears date-specific parameters and sets interval-related ones.\n *\n * @param interval The time interval\n * @param aggregation The aggregation type\n * @param isAutoRefreshEnabled Auto-refresh enabled flag\n * @param refreshOption The refresh option ('live' or 'history')\n * @returns Query parameters object for interval-based context\n */\n private buildIntervalBasedQueryParams(\n interval: string,\n aggregation: string | null,\n isAutoRefreshEnabled: boolean,\n refreshOption: string\n ): Record<DateContextQueryParamNames, null | string | boolean> {\n return {\n dateContextInterval: interval,\n dateContextAggregation: aggregation,\n dateContextTo: null,\n dateContextFrom: null,\n globalContextAutoRefresh: isAutoRefreshEnabled,\n globalContextRefreshMode: refreshOption\n };\n }\n\n /**\n * Builds query parameters for date-range-based time context.\n * Clears interval parameter and sets date-specific ones.\n *\n * @param date Array containing [dateFrom, dateTo] strings or Date objects, or null\n * @param aggregation The aggregation type\n * @param isAutoRefreshEnabled Auto-refresh enabled flag\n * @param refreshOption The refresh option ('live' or 'history')\n * @returns Query parameters object for date-range-based context\n */\n private buildDateRangeBasedQueryParams(\n date: (string | Date)[] | null,\n aggregation: string | null,\n isAutoRefreshEnabled: boolean,\n refreshOption: string\n ): Record<DateContextQueryParamNames, null | string | boolean> {\n return {\n dateContextFrom: date && date[0] ? DateTimeContextUtil.toIso(date[0]) : null,\n dateContextTo: date && date[1] ? DateTimeContextUtil.toIso(date[1]) : null,\n dateContextAggregation: aggregation,\n dateContextInterval: null,\n globalContextAutoRefresh: isAutoRefreshEnabled,\n globalContextRefreshMode: refreshOption\n };\n }\n\n /**\n * Helper method to navigate with query parameters\n * Centralizes navigation logic for consistent handling across methods\n *\n * @param queryParams The query parameters to set\n * @param options Additional navigation options\n */\n private navigateWithQueryParams(\n queryParams: Record<string, any>,\n options: Partial<NavigationExtras> = {}\n ): void {\n // Get root route for navigation\n let rootRoute = this.activatedRoute;\n while (rootRoute.parent) {\n rootRoute = rootRoute.parent;\n }\n\n const currentParams = rootRoute.snapshot.queryParams;\n\n // Helper to normalize boolean-like values\n const normalize = (obj: Record<string, any>) =>\n Object.fromEntries(\n Object.entries(obj)\n .filter(([_, v]) => v !== undefined && v !== null && v !== '')\n .map(([k, v]) => [k, v === 'true' ? true : v === 'false' ? false : v])\n );\n\n const current = normalize(currentParams);\n const next = normalize(queryParams);\n\n const hasChanged = JSON.stringify(current) !== JSON.stringify(next);\n\n if (hasChanged) {\n const navigationExtras: NavigationExtras = {\n relativeTo: rootRoute,\n queryParams,\n ...options\n };\n\n this.router.navigate([], navigationExtras);\n }\n }\n\n /**\n * Parses and validates date context from query params described by date \"from\" and date \"to\".\n *\n * @returns Date context as tuple of date \"from\" and date \"to\", or null if date context is invalid.\n */\n private getDateContextFromQueryParams(): [string, string] | null {\n // Get params from root route\n let currentRoute = this.activatedRoute;\n while (currentRoute.parent) {\n currentRoute = currentRoute.parent;\n }\n const params = currentRoute.snapshot.queryParams;\n const dateContextFrom = params[DateContextQueryParamNames.DATE_CONTEXT_FROM];\n const dateContextTo = params[DateContextQueryParamNames.DATE_CONTEXT_TO];\n\n if (this.validationService.isValidDateRange(dateContextFrom, dateContextTo)) {\n return [dateContextFrom, dateContextTo];\n }\n return null;\n }\n\n /**\n * Maps query params object to proper type with validation.\n *\n * Transforms raw string query parameters into properly typed values,\n * filtering out invalid values and converting boolean strings.\n *\n * @param params Query parameters object with string values only.\n * @returns Query params object of proper type with validated values.\n */\n private processQueryParams(\n params: Record<DateContextQueryParamNames, string>\n ): InputDateContextQueryParams {\n // Use validation service to get validated values in one call\n const validated = this.validationService.validateParameters({\n interval: params.dateContextInterval,\n aggregation: params.dateContextAggregation,\n autoRefresh: params.globalContextAutoRefresh\n });\n\n return {\n ...params,\n dateContextInterval: validated.interval\n ? (params.dateContextInterval as Interval['id'])\n : null,\n dateContextAggregation: validated.aggregation\n ? (params.dateContextAggregation as aggregationType)\n : null,\n globalContextAutoRefresh: validated.autoRefresh\n };\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { AGGREGATION_ICONS, AGGREGATION_TEXTS } from '../../../models/aggregation.model';\n\n@Component({\n selector: 'c8y-aggregation-display',\n templateUrl: './aggregation-display.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [C8yTranslatePipe, IconDirective]\n})\nexport class AggregationDisplayComponent {\n readonly aggregation = input<aggregationType | null>(null);\n readonly AGGREGATION_ICONS = AGGREGATION_ICONS;\n readonly AGGREGATION_TEXTS = AGGREGATION_TEXTS;\n}\n","<div class=\"d-flex a-i-center l-h-tight form-control\">\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"aggregation() ? AGGREGATION_ICONS[aggregation()] : AGGREGATION_ICONS.undefined\"\n ></i>\n <div class=\"d-col text-left fit-w\">\n <span class=\"text-10 l-h-1 text-muted\">\n {{ 'Aggregation' | translate }}\n </span>\n <span\n class=\"text-12 l-h-1 text-medium text-truncate\"\n data-cy=\"global-date-context--Aggregation-display-value\"\n >\n {{ AGGREGATION_TEXTS[aggregation()] | translate }}\n </span>\n </div>\n</div>\n","import { AsyncPipe } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n EventEmitter,\n forwardRef,\n HostListener,\n inject,\n Input,\n OnDestroy,\n Output,\n ViewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n C8yTranslatePipe,\n CountdownIntervalComponent,\n CountdownIntervalModule,\n IconDirective\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { BehaviorSubject } from 'rxjs';\nimport { filter, tap, withLatestFrom } from 'rxjs/operators';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../../models';\n\n/**\n * Source of auto-refresh state change.\n */\nenum AutoRefreshChangeSource {\n /** External change from user interaction or form value changes */\n External = 'external',\n /** Internal change from tab visibility detection */\n Visibility = 'visibility'\n}\n\n/**\n * Auto-refresh toggle control with countdown timer.\n *\n * Displays a toggle button that enables/disables automatic refresh with a visual countdown\n * showing time until next refresh. Integrates with Angular forms via ControlValueAccessor.\n */\n@Component({\n selector: 'c8y-auto-refresh-control',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AutoRefreshControlComponent),\n multi: true\n }\n ],\n standalone: true,\n imports: [CountdownIntervalModule, C8yTranslatePipe, TooltipModule, IconDirective, AsyncPipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './auto-refresh-control.component.html'\n})\nexport class AutoRefreshControlComponent implements AfterViewInit, OnDestroy, ControlValueAccessor {\n countdownIntervalConfig = {\n enforcePulseIcon: false\n };\n\n @Input() isAutoRefreshConnected = false;\n\n @Input()\n set autoRefreshSeconds(_value: number) {\n // Value hardcoded to 5000ms for now, as per requirements\n // It will be adjusted later when dynamic intervals are supported (based on the request execution time)\n this.autoRefreshSeconds$ = new BehaviorSubject<number>(\n GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL\n );\n\n // Always show pulse icon, never show countdown timer\n this.countdownIntervalConfig = {\n enforcePulseIcon: true\n };\n }\n\n @Input() disableCounter = false;\n\n readonly DISABLE_AUTO_REFRESH = gettext('Auto refresh enabled');\n readonly ENABLE_AUTO_REFRESH = gettext('Auto refresh paused');\n readonly DEFAULT_INTERVAL_VALUE = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n\n private countdownComponentReady$ = new BehaviorSubject<CountdownIntervalComponent | null>(null);\n private readonly loading$ = new BehaviorSubject<boolean>(false);\n private readonly destroyRef = inject(DestroyRef);\n private readonly cdr = inject(ChangeDetectorRef);\n\n // Grace period handling for widgets without proper loading state\n private gracePeriodTimeout: ReturnType<typeof setTimeout> | null = null;\n\n // Track if auto-refresh was disabled by tab visibility (not user action)\n private disabledByTabVisibility = false;\n\n @Input() isEnabled: boolean;\n\n private _isLoading: boolean;\n\n @Input()\n set isLoading(value: boolean) {\n const wasLoading = this._isLoading;\n this._isLoading = value;\n\n // If loading started, cancel any pending grace period\n if (value && this.gracePeriodTimeout) {\n this.clearGracePeriod();\n }\n\n this.loading$.next(value);\n\n // Handle loading -> not loading transition\n if (wasLoading && !value && this.countdownIntervalComponent) {\n this.countdownIntervalComponent.reset();\n }\n }\n get isLoading(): boolean {\n return this._isLoading;\n }\n\n @ViewChild(CountdownIntervalComponent)\n countdownIntervalComponent: CountdownIntervalComponent;\n\n @Output() loadingChange = new EventEmitter<boolean>();\n\n @Output() refresh = new EventEmitter<void>();\n\n autoRefreshSeconds$: BehaviorSubject<number>;\n\n onChange: (value: boolean) => void;\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onTouched = () => {};\n\n ngAfterViewInit() {\n this.countdownComponentReady$.next(this.countdownIntervalComponent);\n this.setUpOnCountdownEndedListener();\n this.setupLoadingHandler();\n this.syncCountdownState();\n }\n\n ngOnDestroy() {\n this.clearGracePeriod();\n }\n\n @HostListener('document:visibilitychange')\n onVisibilityChange(): void {\n if (document.hidden && this.isEnabled) {\n this.disabledByTabVisibility = true;\n this.setAutoRefreshEnabled(false, AutoRefreshChangeSource.Visibility);\n } else {\n if (this.disabledByTabVisibility) {\n this.setAutoRefreshEnabled(true, AutoRefreshChangeSource.Visibility);\n }\n }\n }\n\n toggleIntervalRefresh() {\n this.setAutoRefreshEnabled(!this.isEnabled, AutoRefreshChangeSource.External);\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n writeValue(showIntervalRefresh: boolean): void {\n this.isEnabled = showIntervalRefresh;\n\n // External state change always clears the flag\n // This ensures visibility doesn't re-enable after external disable\n this.disabledByTabVisibility = false;\n\n this.syncCountdownState();\n this.cdr.markForCheck();\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n resetCountdown() {\n this.clearGracePeriod();\n this.countdownIntervalComponent?.reset();\n }\n\n /**\n * Internal method to change auto-refresh state with proper flag management.\n * @param enabled - New enabled state\n * @param source - Source of the change (External or Visibility)\n */\n private setAutoRefreshEnabled(enabled: boolean, source: AutoRefreshChangeSource): void {\n this.isEnabled = enabled;\n\n if (enabled || source === AutoRefreshChangeSource.External) {\n this.disabledByTabVisibility = false;\n }\n\n if (source === AutoRefreshChangeSource.External) {\n this.onChange(this.isEnabled);\n }\n\n this.syncCountdownState();\n this.cdr.markForCheck();\n }\n\n private setupLoadingHandler() {\n this.loading$\n .pipe(\n withLatestFrom(this.countdownComponentReady$),\n filter(([_, component]) => component !== null),\n tap(([isLoading, component]) => {\n if (isLoading) {\n // Stop without showing \"0\" - keep the last countdown value visible\n component?.stop(false);\n }\n // Reset is now handled in the isLoading setter\n }),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe();\n }\n\n private setUpOnCountdownEndedListener() {\n this.countdownIntervalComponent?.countdownEnded\n .pipe(\n filter(() => this.isEnabled),\n tap(() => this.handleCountdownEnded()),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe();\n }\n\n private handleCountdownEnded(): void {\n this.refresh.emit();\n\n // For widgets not connected to auto-refresh, implement grace period\n if (!this.isAutoRefreshConnected) {\n // Give widget 500ms to set loading state\n this.gracePeriodTimeout = setTimeout(() => {\n // If still no loading state, reset the countdown\n if (!this.isLoading) {\n this.resetCountdown();\n }\n this.gracePeriodTimeout = null;\n }, 500);\n }\n }\n\n private syncCountdownState(): void {\n if (!this.countdownIntervalComponent) return;\n\n if (this.isEnabled && !this.isLoading) {\n this.countdownIntervalComponent.start();\n } else if (!this.isEnabled) {\n this.countdownIntervalComponent.stop();\n }\n }\n\n private clearGracePeriod(): void {\n if (this.gracePeriodTimeout) {\n clearTimeout(this.gracePeriodTimeout);\n this.gracePeriodTimeout = null;\n }\n }\n}\n","@let autoRefreshTooltip = (isEnabled ? DISABLE_AUTO_REFRESH : ENABLE_AUTO_REFRESH) | translate;\n@let countdownInterval = (autoRefreshSeconds$ | async) ?? DEFAULT_INTERVAL_VALUE;\n\n<button\n [class.btn]=\"disableCounter\"\n [class.btn-link]=\"disableCounter\"\n [class.c8y-realtime]=\"disableCounter\"\n [class.toggle-countdown]=\"!disableCounter\"\n [attr.aria-label]=\"autoRefreshTooltip\"\n [tooltip]=\"tooltipTpl\"\n placement=\"bottom\"\n container=\"body\"\n [delay]=\"500\"\n (click)=\"toggleIntervalRefresh(); $event.stopPropagation()\"\n [adaptivePosition]=\"false\"\n [disabled]=\"isLoading\"\n mode\n data-cy=\"global-date-context--Auto-refresh-toggle\"\n>\n <div class=\"d-flex a-i-center\">\n @if (!disableCounter) {\n <c8y-countdown-interval\n #countdown\n [hidden]=\"!isEnabled\"\n [countdownInterval]=\"countdownInterval\"\n [config]=\"countdownIntervalConfig\"\n ></c8y-countdown-interval>\n }\n\n @if (!isEnabled) {\n <i\n class=\"icon-20 text-primary\"\n [c8yIcon]=\"'pause-circle'\"\n data-cy=\"global-date-context--Auto-refresh-toggle-pause\"\n ></i>\n } @else if (disableCounter) {\n <span class=\"c8y-pulse m-0 active\"></span>\n }\n </div>\n</button>\n\n<ng-template #tooltipTpl>\n {{ autoRefreshTooltip }}\n</ng-template>\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\nimport { C8yTranslatePipe, DatePipe, IconDirective } from '@c8y/ngx-components';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport { INTERVAL_TITLES } from '../../../models/interval-picker.model';\n\n@Component({\n selector: 'c8y-time-range-display',\n templateUrl: './time-range-display.component.html',\n standalone: true,\n imports: [IconDirective, C8yTranslatePipe, DatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class TimeRangeDisplayComponent {\n REFRESH_OPTION = REFRESH_OPTION;\n @Input() dateTimeContext: DateTimeContext;\n @Input() mode: 'from' | 'to' | 'default' = 'default';\n\n dateTo = new Date();\n\n readonly INTERVALS = INTERVAL_TITLES;\n readonly DATE_FORMAT = 'medium';\n}\n","@if (dateTimeContext) {\n <div class=\"d-flex a-i-center l-h-tight form-control\">\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"'schedule1'\"\n ></i>\n <div class=\"d-col text-left fit-w\">\n <span\n class=\"text-10 l-h-1 text-muted\"\n data-cy=\"global-date-context--Selected-interval\"\n >\n {{ INTERVALS[dateTimeContext.interval] | translate }}\n </span>\n\n @if (mode === 'from') {\n <span class=\"text-12 text-medium text-truncate\">\n {{ 'From`date`' | translate }} {{ dateTimeContext.dateFrom | c8yDate: DATE_FORMAT }}\n </span>\n }\n\n @if (mode === 'to') {\n <span class=\"text-12 l-h-1 text-medium text-truncate\">\n {{ 'To`date`' | translate }} {{ dateTimeContext.dateTo | c8yDate: DATE_FORMAT }}\n </span>\n }\n\n @if (mode === 'default') {\n <span\n class=\"text-12 l-h-1 text-medium text-truncate\"\n data-cy=\"global-date-context--Selected-time-range\"\n >\n {{ dateTimeContext.dateFrom | c8yDate: DATE_FORMAT }} —\n {{ dateTimeContext.dateTo | c8yDate: DATE_FORMAT }}\n </span>\n }\n </div>\n </div>\n}\n","import { AsyncPipe, TitleCasePipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n EventEmitter,\n inject,\n Input,\n OnInit,\n Output\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, FormsModule } from '@c8y/ngx-components';\nimport { pick } from 'lodash-es';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport {\n BehaviorSubject,\n debounceTime,\n distinctUntilChanged,\n map,\n Observable,\n startWith\n} from 'rxjs';\nimport { AggregationDisplayComponent } from '../../features/aggregation/aggregation-display/aggregation-display.component';\nimport { AutoRefreshControlComponent } from '../../features/refresh/auto-refresh/auto-refresh-control.component';\nimport { TimeRangeDisplayComponent } from '../../features/time-context/time-range-display/time-range-display.component';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport { GlobalContextSettings, GlobalContextState } from '../../models/global-context.model';\nimport { GlobalContextFormService } from '../../services/state/global-context-form.service';\n\n/**\n * Context controls component for managing global context state and refresh options.\n *\n * Provides controls for time range, aggregation, and auto-refresh functionality\n * with reactive form handling and optimized change detection.\n *\n * @usageNotes\n *\n * ### Basic Usage\n * ```html\n * <c8y-context-controls\n * [settings]=\"globalSettings\"\n * [context]=\"currentContext\"\n * [isLoading]=\"loading\"\n * (contextChange)=\"handleContextChange($event)\"\n * (refresh)=\"handleRefresh()\"\n * (contextClick)=\"handleClick($event)\">\n * </c8y-context-controls>\n * ```\n *\n */\n@Component({\n selector: 'c8y-context-controls',\n standalone: true,\n templateUrl: './context-controls.component.html',\n imports: [\n C8yTranslatePipe,\n TooltipModule,\n CollapseModule,\n ReactiveFormsModule,\n FormsModule,\n PopoverModule,\n AutoRefreshControlComponent,\n TitleCasePipe,\n TimeRangeDisplayComponent,\n AggregationDisplayComponent,\n AsyncPipe\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContextControlsComponent implements OnInit {\n // Static properties\n readonly REFRESH_OPTION = REFRESH_OPTION;\n\n // Inputs\n @Input() showDisplayModeLabel = false;\n @Input() isLoading = false;\n\n @Input()\n set settings(value: GlobalContextSettings) {\n this._settings.next(value);\n }\n get settings(): GlobalContextSettings {\n return this._settings.value;\n }\n\n @Input()\n set context(value: GlobalContextState) {\n this._context.next(value);\n }\n get context(): GlobalContextState {\n return this._context.value;\n }\n\n // Outputs\n @Output() contextChange = new EventEmitter<Partial<GlobalContextState>>();\n @Output() refresh = new EventEmitter<void>();\n @Output() contextClick = new EventEmitter<Event>();\n\n // Public properties\n form: ReturnType<(typeof this.globalContextFormService)['buildForm']>;\n isAnySettingEnabled = true;\n refreshOption: RefreshOption;\n isAutoRefreshConnected = false;\n\n // Private properties\n private readonly globalContextFormService = inject(GlobalContextFormService);\n private readonly destroyRef = inject(DestroyRef);\n private readonly cd = inject(ChangeDetectorRef);\n private readonly _settings = new BehaviorSubject<GlobalContextSettings>(null);\n private readonly _context = new BehaviorSubject<GlobalContextState>(null);\n private readonly _isAnySettingsEnabled$ = new BehaviorSubject<boolean>(true);\n\n // Reactive state with optimized observables\n readonly isAnySettingsEnabled$: Observable<boolean> = this._isAnySettingsEnabled$.pipe(\n debounceTime(500),\n startWith(true),\n distinctUntilChanged()\n );\n\n // Lifecycle hooks\n ngOnInit(): void {\n this.initializeForm();\n this.setupContextSubscription();\n this.setupSettingsSubscription();\n this.setupFormValueChanges();\n }\n\n // Private methods\n private initializeForm(): void {\n this.form = this.globalContextFormService.buildForm(this.context, {});\n this.refreshOption = this.context?.refreshOption || REFRESH_OPTION.LIVE;\n }\n\n private setupContextSubscription(): void {\n this._context.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(context => {\n if (this.form && context) {\n this.form.patchValue(context, { emitEvent: false });\n }\n if (context && 'refreshOption' in context) {\n this.refreshOption = context.refreshOption;\n }\n });\n }\n\n private setupSettingsSubscription(): void {\n this._settings\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map(settings => this.extractRelevantSettings(settings)),\n distinctUntilChanged()\n )\n .subscribe(settingsToCheck => {\n const hasEnabledSettings = Object.values(settingsToCheck).some(setting => setting);\n this._isAnySettingsEnabled$.next(hasEnabledSettings);\n this.isAutoRefreshConnected = settingsToCheck.showAutoRefresh;\n this.cd.markForCheck();\n });\n }\n\n private setupFormValueChanges(): void {\n this.form.valueChanges\n .pipe(startWith(this.form.value), takeUntilDestroyed(this.destroyRef), distinctUntilChanged())\n .subscribe(value => {\n this.contextChange.emit(value);\n });\n }\n\n private extractRelevantSettings(settings: GlobalContextSettings): {\n showTimeContext: boolean;\n showAggregation: boolean;\n showAutoRefresh: boolean;\n } {\n const requiredKeys: (keyof GlobalContextSettings)[] = [\n 'showTimeContext',\n 'showAggregation',\n 'showAutoRefresh'\n ];\n\n return pick(settings, requiredKeys);\n }\n}\n","@if (form) {\n @let SHOW_TIME_CONTEXT = settings.showTimeContext;\n @let SHOW_AGGREGATION = settings.showAggregation;\n @let SHOW_AUTO_REFRESH = settings.showAutoRefresh;\n @let refreshIntervalValue = form?.get('refreshInterval')?.value;\n @let isLiveMode = refreshOption === REFRESH_OPTION.LIVE;\n\n @if (isLiveMode) {\n <form\n class=\"input-group\"\n [formGroup]=\"form\"\n >\n <c8y-auto-refresh-control\n #autoRefreshControl\n [isLoading]=\"isLoading\"\n [isAutoRefreshConnected]=\"isAutoRefreshConnected\"\n formControlName=\"isAutoRefreshEnabled\"\n [autoRefreshSeconds]=\"refreshIntervalValue\"\n (refresh)=\"refresh.emit()\"\n ></c8y-auto-refresh-control>\n <button\n class=\"btn-clean d-flex p-l-xs-16 p-r-xs-16 m-t-xs-8 m-b-xs-8\"\n style=\"margin-left: -1px\"\n (click)=\"contextClick.emit($event); $event.stopPropagation()\"\n >\n <div class=\"d-col a-i-start form-control\">\n <p class=\"text-muted fit-w text-10 l-h-1\">\n {{ 'Time mode' | translate }}\n </p>\n <p\n class=\"text-bold text-12 fit-w l-h-1\"\n data-cy=\"global-time-context-controls--Display-mode\"\n >\n {{ refreshOption | translate | titlecase }}\n </p>\n </div>\n\n @let interval = form.get('dateTimeContext')?.value?.interval;\n @let isCustomInterval = interval === 'custom';\n\n <c8y-time-range-display\n style=\"margin-left: -1px\"\n [dateTimeContext]=\"form.get('dateTimeContext')?.value\"\n ></c8y-time-range-display>\n\n @if (!(isAnySettingsEnabled$ | async)) {\n <div\n class=\"d-col a-i-center form-control\"\n style=\"margin-left: -1px\"\n >\n <i\n class=\"dlt-c8y-icon-disconnected icon-20 text-danger\"\n [tooltip]=\"'No synced widgets' | translate\"\n placement=\"right\"\n container=\"body\"\n [delay]=\"500\"\n data-cy=\"global-time-context-controls--Widgets-disconnected\"\n ></i>\n </div>\n }\n </button>\n </form>\n } @else {\n <form [formGroup]=\"form\">\n <button\n class=\"btn-clean d-flex p-l-xs-16 p-r-xs-16 m-t-xs-8 m-b-xs-8\"\n (click)=\"contextClick.emit($event); $event.stopPropagation()\"\n >\n <div class=\"d-col a-i-center form-control\">\n <i class=\"dlt-c8y-icon-schedule1 icon-20 text-primary\"></i>\n </div>\n\n <div\n class=\"d-col a-i-start form-control\"\n style=\"margin-left: -1px\"\n >\n <p class=\"text-muted fit-w text-10 l-h-1\">\n {{ 'Time mode' | translate }}\n </p>\n <p\n class=\"text-bold text-12 fit-w l-h-1\"\n data-cy=\"global-time-context-controls--Display-mode\"\n >\n {{ refreshOption | translate | titlecase }}\n </p>\n </div>\n\n <c8y-time-range-display\n style=\"margin-left: -1px\"\n [dateTimeContext]=\"form.get('dateTimeContext')?.value\"\n ></c8y-time-range-display>\n <c8y-aggregation-display\n style=\"margin-left: -1px\"\n [aggregation]=\"form.get('aggregation')?.value\"\n ></c8y-aggregation-display>\n\n @if (!(isAnySettingsEnabled$ | async)) {\n <div\n class=\"d-col a-i-center form-control\"\n style=\"margin-left: -1px\"\n >\n <i\n class=\"dlt-c8y-icon-disconnected icon-20 text-danger\"\n [tooltip]=\"'No synced widgets' | translate\"\n placement=\"right\"\n container=\"body\"\n [delay]=\"500\"\n data-cy=\"global-time-context-controls--Widgets-disconnected\"\n ></i>\n </div>\n }\n </button>\n </form>\n }\n}\n","import { Location } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n inject,\n signal,\n ViewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport {\n ActivatedRoute,\n ActivationEnd,\n Navigation,\n NavigationEnd,\n NavigationStart,\n Router\n} from '@angular/router';\nimport { AlertService } from '@c8y/ngx-components';\nimport { ContextDashboardStateService } from '@c8y/ngx-components/context-dashboard-state';\nimport { isEqual, pick, some } from 'lodash-es';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport {\n combineLatest,\n debounceTime,\n distinctUntilChanged,\n filter,\n firstValueFrom,\n fromEvent,\n map,\n shareReplay,\n startWith,\n tap\n} from 'rxjs';\n\nimport { ConfigurationCollapseComponent } from '../features/configuration/configuration-collapse/configuration-collapse.component';\nimport type { RefreshOption } from '../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../models/auto-refresh.model';\nimport {\n DashboardChildConfig,\n DashboardChildSlot,\n DashboardManagedObject\n} from '../models/dashboard-context.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../models/global-context-defaults';\nimport type { DateTimeContext } from '../models/date-time-context-picker.model';\nimport type { GlobalContextSettings, GlobalContextState } from '../models/global-context.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GLOBAL_CONTEXT_EVENTS,\n GLOBAL_CONTEXT_SOURCE\n} from '../models/global-context.model';\nimport { INTERVALS, TIME_INTERVAL } from '../models/interval-picker.model';\nimport { AggregationPickerService } from '../services/domain/aggregation-picker.service';\nimport { GlobalContextQueryService } from '../services/infrastructure/global-context-query.service';\nimport { GlobalContextEventService } from '../services/state/global-context-event.service';\nimport { GlobalContextFormService } from '../services/state/global-context-form.service';\nimport { GlobalContextService } from '../services/state/global-context.service';\nimport { ContextControlsComponent } from '../shared/context-controls/context-controls.component';\nimport { DateTimeContextUtil } from '../utils/date-time-context.util';\n\n/**\n * GlobalContextComponent\n *\n * This component manages the global context across the application.\n * It synchronizes state between:\n * - Form UI state (user interactions)\n * - URL parameters (for permalink support)\n * - Dashboard state (for dashboard-specific settings)\n *\n * Key lifecycle phases:\n * 1. Initial load: URL params > Dashboard defaults > Form defaults\n * 2. User interactions: Form > URL params + Dashboard state\n * 3. Dashboard switching: Consider dashboard defaults if no settings\n */\n@Component({\n standalone: true,\n imports: [\n ReactiveFormsModule,\n TooltipModule,\n ContextControlsComponent,\n ConfigurationCollapseComponent\n ],\n selector: 'c8y-global-context',\n templateUrl: './global-context.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class GlobalContextComponent implements AfterViewInit {\n // Service Dependencies\n private readonly destroyRef = inject(DestroyRef);\n private readonly router = inject(Router);\n private readonly location = inject(Location);\n private readonly activatedRoute = inject(ActivatedRoute);\n private readonly alertService = inject(AlertService);\n private readonly cd = inject(ChangeDetectorRef);\n\n // Context Services\n readonly globalContextService = inject(GlobalContextService);\n readonly globalContextEventService = inject(GlobalContextEventService);\n private readonly globalContextFormService = inject(GlobalContextFormService);\n private readonly globalContextQueryService = inject(GlobalContextQueryService);\n private readonly aggregationPickerService = inject(AggregationPickerService);\n private readonly contextDashboardStateService = inject(ContextDashboardStateService, {\n optional: true\n }) as ContextDashboardStateService<GlobalContextState>;\n\n // Component State\n private blockUrlSync = true; // Start with blocking enabled to prevent early syncs\n private readonly navigationState$ = this.createNavigationStateStream();\n private initialUrlParams: Partial<GlobalContextState> | null = null;\n readonly intervals = INTERVALS;\n form!: ReturnType<typeof this.globalContextFormService.buildForm>;\n settings: GlobalContextSettings = this.globalContextService.getDefaultSettings();\n shouldSaveDashboardState = false;\n globalContextState = signal<GlobalContextState | null>(null);\n isVisible = signal<boolean>(false);\n\n @ViewChild(ConfigurationCollapseComponent, { static: false })\n configurationCollapseComponent!: ConfigurationCollapseComponent;\n\n constructor() {\n // Capture URL params immediately in constructor before anything can clear them\n const urlParams = this.globalContextQueryService.dateTimeContextFromQueryParams();\n if (urlParams && Object.keys(urlParams).length > 0) {\n this.initialUrlParams = urlParams;\n }\n // Keep blockUrlSync as true for all cases initially - will be unblocked after init\n }\n\n ngAfterViewInit() {\n this.initializeComponent();\n this.setupGlobalContextEvents();\n this.setupNavigationHandling();\n this.setupWidgetConfigListener();\n }\n\n onRefresh(): void {\n const currentState = this.getGlobalContextState();\n if (!currentState) return;\n\n if (this.isCustomInterval()) {\n this.handleCustomIntervalRefresh(currentState);\n } else {\n this.handleStandardIntervalRefresh();\n }\n }\n\n updateQueryParamsWithoutNavigation(\n queryParams: Record<string, string | number | boolean | null>\n ): void {\n const urlTree = this.router.createUrlTree([], {\n relativeTo: this.activatedRoute,\n queryParams: {\n ...this.activatedRoute.snapshot.queryParams,\n ...queryParams\n }\n });\n\n const url = this.router.serializeUrl(urlTree);\n this.location.replaceState(url);\n }\n\n onChanges(changes: GlobalContextState): void {\n // User has made a manual change - unblock URL sync\n if (this.blockUrlSync) {\n this.blockUrlSync = false;\n }\n\n const processedChanges = this.processStateChanges(changes);\n const stateToSave = this.extractSaveableState(processedChanges);\n const stateToEmit = structuredClone(processedChanges);\n\n this.patchGlobalContextState(stateToSave);\n this.broadcastStateChanges(stateToEmit);\n this.scheduleQueryParamSync();\n this.saveDashboardStateIfNeeded(stateToSave);\n }\n\n onRefreshOptionChanges(refreshOption: RefreshOption) {\n this.globalContextEventService.emit('GLOBAL_CONTEXT_REFRESH_OPTION_CHANGE', refreshOption);\n }\n\n getGlobalContextState(): GlobalContextState | null {\n return this.globalContextState();\n }\n\n updateGlobalContextState(globalContextState: GlobalContextState): void {\n const adjustedState = this.adjustGlobalState(globalContextState);\n\n // Remove non-persistent fields\n delete adjustedState.source;\n delete adjustedState.eventSourceId;\n\n this.patchGlobalContextState(adjustedState);\n }\n\n patchGlobalContextState(partialState: Partial<GlobalContextState>): boolean {\n const adjustedState = this.adjustGlobalState(partialState);\n const currentState = this.globalContextState();\n\n if (this.isStateUnchanged(currentState, adjustedState)) {\n return false;\n }\n\n this.globalContextState.set({ ...(currentState ?? {}), ...adjustedState });\n\n return true;\n }\n\n adjustGlobalState(globalContextState: GlobalContextState): Partial<GlobalContextState> {\n const gcCopy = structuredClone(globalContextState);\n\n const { dateTimeContext, aggregation } = gcCopy;\n\n // Adjust aggregation based on date range\n if ('aggregation' in gcCopy) {\n const { selectedAggregation } = this.aggregationPickerService.calculateAggregation(\n [new Date(dateTimeContext.dateFrom), new Date(dateTimeContext.dateTo)],\n aggregation\n );\n\n gcCopy.aggregation = selectedAggregation;\n }\n return gcCopy;\n }\n\n private setupWidgetConfigListener(): void {\n // Listen for dashboard save events to re-evaluate visibility\n this.contextDashboardStateService?.dashboardSaved\n .pipe(\n filter(Boolean),\n takeUntilDestroyed(this.destroyRef),\n tap(dashboard => {\n // Update visibility based on dashboard children\n const shouldShow = this.shouldShowGlobalContextForDashboard(dashboard);\n this.isVisible.set(shouldShow);\n })\n )\n ?.subscribe();\n }\n private createNavigationStateStream() {\n return this.router.events.pipe(\n takeUntilDestroyed(this.destroyRef),\n filter(\n e =>\n e instanceof NavigationStart || e instanceof NavigationEnd || e instanceof ActivationEnd\n ),\n map(e => e instanceof NavigationStart),\n startWith(false),\n tap(isNavigationStart => {\n if (isNavigationStart) {\n this.configurationCollapseComponent?.close();\n }\n }),\n shareReplay(1)\n );\n }\n\n private setupNavigationHandling(): void {\n this.router.events\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n filter(event => event instanceof NavigationEnd),\n filter(() => !this.isNavigationInProgress()),\n tap(() => this.handleNavigationEnd())\n )\n ?.subscribe();\n }\n\n private isNavigationInProgress(): boolean {\n // Prevent unnecessary data refetching during navigation.\n // Exception: allow events when navigation is user-triggered.\n // Without this, leaving dashboard triggers `GLOBAL_CONTEXT_EVENTS.STATE_CHANGE`,\n // causing unwanted widget data refetch.\n return (\n !!this.router.getCurrentNavigation() &&\n this.router.getCurrentNavigation().trigger !== 'popstate'\n );\n }\n\n private setupGlobalContextEvents(): void {\n this.setupContextHistoryEvents();\n this.setupContextLiveEvents();\n }\n\n private setupContextHistoryEvents(): void {\n fromEvent<CustomEvent>(window, GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_HISTORY)\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(250))\n ?.subscribe(event => {\n const detail = event.detail;\n if (detail?.type === GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_HISTORY) {\n detail.payload.refreshOption = REFRESH_OPTION.HISTORY;\n this.onChanges(detail.payload);\n }\n });\n }\n\n private setupContextLiveEvents(): void {\n fromEvent<CustomEvent>(window, GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_LIVE)\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(250))\n ?.subscribe(event => {\n const detail = event.detail;\n if (detail?.type === GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_LIVE) {\n detail.payload.refreshOption = REFRESH_OPTION.LIVE;\n this.onChanges(detail.payload);\n }\n });\n }\n\n private handleNavigationEnd(): void {\n this.applyUrlStateIfPresent();\n }\n\n private applyUrlStateIfPresent(): void {\n const queryParamsContext = this.globalContextQueryService.dateTimeContextFromQueryParams();\n\n if (queryParamsContext) {\n const isStateChanged = this.patchGlobalContextState(queryParamsContext);\n\n if (isStateChanged) {\n this.emitStateChange();\n }\n }\n }\n\n private handleCustomIntervalRefresh(state: GlobalContextState): void {\n const { dateTimeContext, refreshOption } = state;\n\n if (refreshOption === REFRESH_OPTION.LIVE) {\n this.refreshCustomLiveInterval(dateTimeContext);\n } else if (refreshOption === REFRESH_OPTION.HISTORY) {\n this.refreshCustomHistoryInterval(dateTimeContext);\n }\n }\n\n private refreshCustomLiveInterval(dateTimeContext: DateTimeContext): void {\n const updatedContext = DateTimeContextUtil.normalizeForLive(dateTimeContext);\n\n this.patchGlobalContextState({ dateTimeContext: updatedContext });\n\n const { dateTimeContext: currentContext } = this.getGlobalContextState();\n const fromIso =\n DateTimeContextUtil.toIso(currentContext.dateFrom) || DateTimeContextUtil.toIso(new Date());\n const toIso =\n DateTimeContextUtil.toIso(currentContext.dateTo) || DateTimeContextUtil.toIso(new Date());\n this.updateQueryParamsWithoutNavigation({\n dateContextFrom: fromIso,\n dateContextTo: toIso\n });\n\n this.globalContextEventService.emit(GLOBAL_CONTEXT_EVENTS.REFRESH, { ...currentContext });\n }\n\n private refreshCustomHistoryInterval(dateTimeContext: DateTimeContext): void {\n const normalizedContext = DateTimeContextUtil.normalizeForHistory(dateTimeContext);\n\n this.globalContextEventService.emit(GLOBAL_CONTEXT_EVENTS.REFRESH, normalizedContext);\n }\n\n private handleStandardIntervalRefresh(): void {\n this.updateDateTimeContext();\n const { dateTimeContext } = this.getGlobalContextState();\n this.globalContextEventService.emit(GLOBAL_CONTEXT_EVENTS.REFRESH, { ...dateTimeContext });\n this.globalContextEventService.syncRefreshToStateChange({ ...dateTimeContext });\n }\n\n private processStateChanges(changes: GlobalContextState): GlobalContextState {\n const processedChanges = { ...changes };\n\n if (this.shouldSetCustomDateTo(processedChanges.dateTimeContext)) {\n processedChanges.dateTimeContext.dateTo = DateTimeContextUtil.toIso(new Date());\n }\n\n return processedChanges;\n }\n\n private shouldSetCustomDateTo(dateTimeContext: DateTimeContext): boolean {\n return (\n dateTimeContext &&\n dateTimeContext.interval === TIME_INTERVAL.CUSTOM &&\n !dateTimeContext.dateTo\n );\n }\n\n private extractSaveableState(changes: GlobalContextState): Partial<GlobalContextState> {\n return pick(changes, [\n 'dateTimeContext',\n 'aggregation',\n 'isAutoRefreshEnabled',\n 'refreshInterval',\n 'refreshOption',\n 'displayMode'\n ]);\n }\n\n private broadcastStateChanges(stateToEmit: GlobalContextState): void {\n this.emitStateChange(stateToEmit);\n this.contextDashboardStateService?.updateGlobalState(structuredClone(stateToEmit));\n }\n\n private scheduleQueryParamSync(): void {\n queueMicrotask(() => this.syncFormStateToQueryParams());\n }\n\n private saveDashboardStateIfNeeded(stateToSave: Partial<GlobalContextState>): void {\n if (!this.shouldSaveDashboardState) return;\n\n try {\n this.contextDashboardStateService?.saveDashboardState(\n this.contextDashboardStateService.selected$.value,\n structuredClone(stateToSave)\n );\n } catch (error) {\n this.alertService.addServerFailure(error);\n }\n }\n\n private isStateUnchanged(\n currentState: GlobalContextState | null,\n newState: Partial<GlobalContextState>\n ): boolean {\n if (!currentState) return false;\n\n const keys = Object.keys(newState) as (keyof GlobalContextState)[];\n const currentStateSubset = pick(currentState, keys);\n return isEqual(currentStateSubset, newState);\n }\n\n private emitStateChange(state?: GlobalContextState): void {\n const stateToEmit = state ?? this.getGlobalContextState();\n\n if (!stateToEmit) {\n return;\n }\n\n this.globalContextEventService.emit(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE, {\n source: GLOBAL_CONTEXT_SOURCE.DASHBOARD,\n eventSourceId: null,\n ...structuredClone(stateToEmit)\n });\n }\n\n private async initializeComponent(): Promise<void> {\n await this.initGlobalContextState();\n this.setupStateSubscriptions();\n\n // Unblock URL sync after initialization if no initial URL params\n if (!this.initialUrlParams) {\n this.blockUrlSync = false;\n }\n }\n\n private setupStateSubscriptions(): void {\n this.setupDashboardSubscription();\n this.emitStateChange();\n this.setupSettingsSubscription();\n }\n\n private async initGlobalContextState() {\n const initialState = await this.buildInitialState();\n\n this.updateGlobalContextState(initialState);\n }\n\n private async buildInitialState(): Promise<GlobalContextState> {\n // Get the selected dashboard (works for both dashboard and device routes)\n const selectedDashboard = await firstValueFrom(\n this.contextDashboardStateService?.selected$.pipe(filter(Boolean))\n );\n\n // Check if we're on a dashboard or device route\n const currentUrl = this.router.url;\n const isDashboardRoute = currentUrl?.includes('/dashboard/');\n const isDeviceRoute = currentUrl?.includes('/device/') && currentUrl?.includes('/device-info');\n\n // Determine visibility based on route type\n if (isDashboardRoute) {\n // Dashboard route - check children for displayMode\n const shouldShow = this.shouldShowGlobalContextForDashboard(selectedDashboard);\n this.isVisible.set(shouldShow);\n\n // Even if not visible, continue to build and return proper state\n // This ensures widgets can still get initial state via event service\n // Temporary solution, should be removed and isDeviceRoute check should be added to isDashboardRoute || isDeviceRoute\n // As for now dashboard children do not have proper configuration in the devicemanagement device-info dashboard\n } else if (isDeviceRoute) {\n const shouldShow = this.shouldShowGlobalContextForDashboard(selectedDashboard);\n this.isVisible.set(shouldShow ?? false);\n // Home dashboard\n } else if (selectedDashboard && this.shouldShowGlobalContextForDashboard(selectedDashboard)) {\n this.isVisible.set(true);\n }\n\n // Build state exactly like dashboard routes\n const globalContextDefaultState = this.globalContextService.getDefaultState();\n const dashboardGlobalContextState = selectedDashboard?.c8y_Dashboard?.dashboardState ?? {};\n const urlParams = this.initialUrlParams ?? {};\n const userInputQueryParams = { ...(this.globalContextQueryService.navigationPopState ?? {}) };\n\n this.globalContextQueryService.navigationPopState = null;\n\n let currentState: GlobalContextState = {\n ...globalContextDefaultState,\n ...dashboardGlobalContextState,\n ...urlParams,\n ...userInputQueryParams\n };\n\n // In live mode we always need to keep a valid date range (based on the interval)\n if (currentState.refreshOption === REFRESH_OPTION.LIVE) {\n const normalized =\n currentState?.dateTimeContext.interval === TIME_INTERVAL.CUSTOM\n ? DateTimeContextUtil.normalizeForLive(currentState.dateTimeContext)\n : (() => {\n const range = DateTimeContextUtil.dateRangeFromInterval(\n currentState.dateTimeContext?.interval\n );\n if (!range) return currentState.dateTimeContext;\n return DateTimeContextUtil.ensureIsoContext({\n interval: currentState.dateTimeContext.interval,\n dateFrom: range[0],\n dateTo: range[1]\n });\n })();\n\n currentState = {\n ...currentState,\n dateTimeContext: normalized\n };\n }\n\n // Always enforce the fixed 5s refresh interval\n // This ensures old dashboards with custom intervals stored in dashboardState are migrated\n currentState.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n\n return currentState;\n }\n\n private setupDashboardSubscription(): void {\n this.contextDashboardStateService?.selected$\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n tap(() => this.globalContextService.resetSettings()),\n filter(Boolean),\n tap(() => this.handleDashboardNavigation())\n )\n ?.subscribe();\n }\n\n private handleDashboardNavigation(): void {\n const navigation = this.router.getCurrentNavigation();\n const queryParamsContext = this.globalContextQueryService.dateTimeContextFromQueryParams();\n\n if (this.isPopstateNavigation(navigation)) {\n this.handlePopstateNavigation(queryParamsContext);\n }\n }\n\n private isPopstateNavigation(navigation: Navigation | null): boolean {\n return navigation?.trigger === 'popstate';\n }\n\n private handlePopstateNavigation(queryParamsContext: Partial<GlobalContextState>): void {\n if (queryParamsContext) {\n this.patchGlobalContextState(queryParamsContext);\n\n this.globalContextQueryService.navigationPopState = { ...this.globalContextState() };\n\n this.syncFormStateToQueryParams();\n }\n }\n\n private setupSettingsSubscription(): void {\n combineLatest([this.globalContextService.getConsolidatedSettings(), this.navigationState$])\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n tap(([settings]) => this.updateSettings(settings)),\n filter(([, navigationInProgress]) => !navigationInProgress),\n distinctUntilChanged((prev, curr) => isEqual(prev[0], curr[0]))\n )\n ?.subscribe(([settings]) => this.handleSettingsChange(settings));\n }\n\n private updateSettings(settings: GlobalContextSettings): void {\n this.settings = { ...settings };\n this.cd.markForCheck();\n }\n\n private handleSettingsChange(settings: GlobalContextSettings): void {\n const hasEnabledSettings = some(settings, Boolean);\n\n if (hasEnabledSettings) {\n this.syncFormStateToQueryParams();\n }\n }\n\n private syncFormStateToQueryParams(): void {\n // Block sync until initialization is complete AND user has interacted (if URL params exist)\n if (this.blockUrlSync) {\n return;\n }\n\n const currentState = this.getGlobalContextState();\n\n if (!currentState) return;\n\n const queryParams = this.buildQueryParamsFromState(currentState);\n\n this.globalContextQueryService.setDateContextQueryParams(queryParams);\n }\n\n private buildQueryParamsFromState(state: GlobalContextState) {\n const isAnyTrue = Object.values(this.settings).some(value => value === true);\n\n const queryParams = {\n interval: this.getIntervalForQuery(state),\n date: this.getDateRangeForQuery(state),\n aggregation: this.getAggregationForQuery(state),\n isAutoRefreshEnabled: this.getAutoRefreshForQuery(state),\n refreshOption: isAnyTrue ? state.refreshOption || REFRESH_OPTION.LIVE : null\n };\n\n return queryParams;\n }\n\n private getIntervalForQuery(state: GlobalContextState) {\n return this.settings.showTimeContext ? state.dateTimeContext?.interval || null : null;\n }\n\n private getDateRangeForQuery(state: GlobalContextState) {\n if (!this.settings.showTimeContext || !state.dateTimeContext) {\n return null;\n }\n return [state.dateTimeContext.dateFrom, state.dateTimeContext.dateTo];\n }\n\n private getAggregationForQuery(state: GlobalContextState) {\n // Live mode never has aggregation (business rule)\n if (state?.refreshOption === REFRESH_OPTION.LIVE) {\n return null;\n }\n // Include aggregation in URL if it has a value for History mode\n // This ensures aggregation is persisted in dashboard URLs\n return state?.aggregation || null;\n }\n\n private getAutoRefreshForQuery(state: GlobalContextState) {\n return this.settings.showAutoRefresh ? !!state.isAutoRefreshEnabled : null;\n }\n\n private isCustomInterval(): boolean {\n const state = this.getGlobalContextState();\n return state?.dateTimeContext?.interval === TIME_INTERVAL.CUSTOM;\n }\n\n private updateDateTimeContext(): void {\n const state = this.getGlobalContextState();\n const currentInterval = state?.dateTimeContext?.interval;\n\n if (!currentInterval) return;\n\n const range = DateTimeContextUtil.dateRangeFromInterval(currentInterval);\n if (!range) return;\n const [dateFrom, dateTo] = range;\n const ctx = DateTimeContextUtil.ensureIsoContext({\n interval: currentInterval,\n dateFrom,\n dateTo\n });\n this.patchGlobalContextState({ dateTimeContext: ctx });\n }\n\n /**\n * Checks if global context should be shown based on dashboard children configuration\n * NOTE: Using DashboardManagedObject instead of ContextDashboardManagedObject\n * to avoid circular dependency issues with the type imports.\n * @param dashboard - The dashboard object containing children\n * @returns true if any child has displayMode set to 'dashboard', false otherwise\n */\n private shouldShowGlobalContextForDashboard(\n dashboard: DashboardManagedObject | null | undefined\n ): boolean {\n // If no dashboard or no c8y_Dashboard property, show by default\n if (!dashboard?.c8y_Dashboard) {\n return true;\n }\n\n const children = dashboard.c8y_Dashboard.children;\n\n // If no children, don't show global context\n if (!children || typeof children !== 'object' || Object.keys(children).length === 0) {\n return false;\n }\n\n // Check if any child needs global context\n return Object.values(children).some((child: DashboardChildSlot | null | undefined) => {\n const config: DashboardChildConfig | null | undefined = child?.config;\n\n if (!config) {\n return false;\n }\n\n const {\n widgetInstanceGlobalAutoRefreshContext,\n widgetInstanceGlobalTimeContext,\n displayMode\n } = config;\n\n // Show global context if widget uses it in any way\n // - 'dashboard' mode: fully connected to global context\n if (displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n return true;\n }\n\n // For backwards compatibility: check legacy fields if displayMode is not set\n if (!displayMode) {\n const hasTimeContext = widgetInstanceGlobalTimeContext === true;\n const hasRefreshContext = widgetInstanceGlobalAutoRefreshContext === true;\n const timeExplicitlyFalse = widgetInstanceGlobalTimeContext === false;\n const refreshExplicitlyFalse = widgetInstanceGlobalAutoRefreshContext === false;\n\n // Hide when contexts are incompatible: one is true and the other is explicitly false\n const hasIncompatibleConfiguration =\n (hasTimeContext && refreshExplicitlyFalse) || (hasRefreshContext && timeExplicitlyFalse);\n\n if (hasIncompatibleConfiguration) {\n return false;\n }\n\n // Show if at least one context is explicitly true\n return hasTimeContext || hasRefreshContext;\n }\n\n return false;\n });\n }\n}\n","@if (globalContextState() !== null && isVisible()) {\n <c8y-context-controls\n [settings]=\"settings\"\n [context]=\"globalContextState()\"\n [isLoading]=\"globalContextService.isLoading()\"\n (refresh)=\"onRefresh()\"\n (contextChange)=\"onChanges($event)\"\n (contextClick)=\"gcs.toggle()\"\n ></c8y-context-controls>\n\n <c8y-configuration-collapse\n #gcs\n [context]=\"globalContextState()\"\n (contextChange)=\"onChanges($event)\"\n (refreshOptionChange)=\"onRefreshOptionChanges($event)\"\n (savePreferenceChange)=\"shouldSaveDashboardState = $event\"\n ></c8y-configuration-collapse>\n}\n","import { inject, Injectable, signal } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { ActionBarFactory, ActionBarItem, ContextRouteService } from '@c8y/ngx-components';\nimport { GlobalContextComponent } from '../../core/global-context.component';\nimport { GlobalContextQueryService } from './global-context-query.service';\n\n/**\n * Constants defining the supported route paths for global context integration.\n */\nexport const ROUTE_PATHS = {\n /** Home route path identifier */\n HOME: 'home',\n /** Dashboard route path identifier */\n DASHBOARD: 'dashboard',\n /** General route path identifier */\n GENERAL: 'general',\n /** Device info route path identifier */\n DEVICE: 'device-info'\n} as const;\n\n/**\n * Type definition for supported route path values.\n */\nexport type RoutePath = (typeof ROUTE_PATHS)[keyof typeof ROUTE_PATHS];\n\n/**\n * Interface defining the structure of a global context instance.\n * Contains both the ActionBar configuration and metadata about the current route context.\n */\nexport interface GlobalContextInstance {\n /** ActionBar item configuration for rendering the global context component */\n readonly actionBarItem: ActionBarItem;\n /** Source route path that created this instance */\n readonly source: RoutePath | null;\n /** Unique identifier for the source (e.g., dashboard ID) */\n readonly sourceId: string | null;\n}\n\n/**\n * Default global context instance configuration.\n */\nconst DEFAULT_INSTANCE: GlobalContextInstance = {\n actionBarItem: {\n component: GlobalContextComponent,\n placement: 'left'\n },\n source: null,\n sourceId: null\n} as const;\n\n/**\n * GlobalContextNavigationService manages the integration of global context functionality\n * with Angular's routing system and the Cumulocity ActionBar.\n *\n * This service implements the ActionBarFactory interface to provide context-aware\n * global context components in different route contexts (home, dashboard, general).\n * It handles route transitions, manages query parameter cleanup, and maintains\n * instance state across navigation.\n *\n * Key responsibilities:\n * - Determine when and where to show global context components\n * - Manage global context instances across different routes\n * - Handle query parameter cleanup during navigation\n * - Provide ActionBar integration for the global context component\n *\n * @example\n * ```typescript\n * // Service is automatically used by ActionBar system\n * // Get current instance\n * const instance = navigationService.getInstance();\n * console.log(instance.source); // 'home' | 'dashboard' | null\n *\n * // Manual instance management (rarely needed)\n * navigationService.setInstance({\n * actionBarItem: { component: GlobalContextComponent, placement: 'left' },\n * source: 'dashboard',\n * sourceId: 'my-dashboard-id'\n * });\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextNavigationService implements ActionBarFactory {\n /** Service for managing global context query parameters */\n private readonly globalContextQueryService = inject(GlobalContextQueryService);\n\n /** Service for accessing route context data */\n private readonly contextRoute = inject(ContextRouteService);\n\n /** Angular router for navigation state access */\n private readonly router = inject(Router);\n\n /** Signal storing the current global context instance configuration */\n private readonly instance = signal<GlobalContextInstance>({\n ...DEFAULT_INSTANCE,\n source: ROUTE_PATHS.HOME\n });\n\n /**\n * Determines the appropriate ActionBarItem based on the current route context.\n *\n * This is the main entry point called by the ActionBar system to determine\n * if and how the global context component should be displayed for a given route.\n *\n * Route handling logic:\n * - Home routes: Always show global context\n * - Dashboard routes: Show if valid dashboard ID exists\n * - Device routes: Show if valid device ID exists\n * - General routes: Hide global context\n * - Other routes: Show only if context data is available\n *\n * @param activeRoute - The currently active Angular route\n * @returns ActionBarItem configuration or null if global context should not be shown\n *\n * @example\n * ```typescript\n * // Called automatically by ActionBar system\n * const actionBarItem = navigationService.get(activatedRoute);\n * if (actionBarItem) {\n * // Global context will be shown in ActionBar\n * }\n * ```\n */\n get(activeRoute: ActivatedRoute): ActionBarItem | null {\n const contextData = this.contextRoute.getContextData(activeRoute);\n const currentPath = this.extractCurrentPath(activeRoute);\n\n // Handle home route - always show global context\n if (this.isHomePath(currentPath)) {\n return this.handleHome();\n }\n\n // Handle general route - never show global context\n if (this.isGeneralPath(currentPath)) {\n this.resetInstance();\n return null;\n }\n\n // Handle dashboard route - show if valid dashboard context\n if (this.isDashboardRoute(activeRoute)) {\n return this.handleDashboard(activeRoute);\n }\n\n if (this.isDevicePath(currentPath)) {\n return this.handleDevice(activeRoute);\n }\n\n // For other routes, check if we have context data\n if (!contextData) {\n return null;\n }\n\n // Check if we need to clean up from previous contexts\n const current = this.getInstance();\n\n // Clean up if we were on a dashboard and now we're not\n if (current.source === ROUTE_PATHS.DASHBOARD) {\n this.handleQueryParamCleanup(true);\n this.resetInstance();\n return null;\n }\n\n // Check if we're on a device sub-route (has device ID but not device-info)\n const deviceId = this.extractDeviceId(activeRoute);\n if (deviceId) {\n // We're on a device route, but not device-info\n // Check if we need to clean up from a previous device-info view\n if (current.source === ROUTE_PATHS.DEVICE) {\n this.handleQueryParamCleanup(true);\n this.resetInstance();\n }\n return null;\n }\n\n // Default: don't show global context for unknown routes\n return null;\n }\n\n /**\n * Retrieves the current global context instance configuration.\n *\n * The instance contains both the ActionBar configuration and metadata\n * about the current route context that created this instance.\n *\n * @returns Current GlobalContextInstance with ActionBar config and route metadata\n *\n * @example\n * ```typescript\n * const instance = navigationService.getInstance();\n * console.log(instance.source); // 'home', 'dashboard', or null\n * console.log(instance.sourceId); // dashboard ID if applicable\n *\n * // Use ActionBar configuration\n * const actionBarItem = instance.actionBarItem;\n * ```\n */\n getInstance(): GlobalContextInstance {\n return this.instance();\n }\n\n /**\n * Sets a new global context instance configuration.\n *\n * This method allows manual control over the global context instance,\n * though it's typically managed automatically by the route handlers.\n * Passing null will reset the instance to default configuration.\n *\n * @param instance - New instance configuration or null to reset to defaults\n *\n * @example\n * ```typescript\n * // Set custom instance\n * navigationService.setInstance({\n * actionBarItem: {\n * component: GlobalContextComponent,\n * placement: 'right'\n * },\n * source: 'dashboard',\n * sourceId: 'custom-dashboard'\n * });\n *\n * // Reset to defaults\n * navigationService.setInstance(null);\n * ```\n */\n setInstance(instance: GlobalContextInstance | null): void {\n if (instance === null) {\n this.resetInstance();\n } else {\n this.instance.set(instance);\n }\n }\n\n /**\n * Handles navigation to home routes.\n *\n * Home routes always display the global context component.\n * Updates the instance if the source has changed.\n *\n * @returns ActionBarItem configuration for home context\n */\n private handleHome(): ActionBarItem {\n const current = this.getInstance();\n\n // Only update instance if source has changed\n if (current.source !== ROUTE_PATHS.HOME) {\n const homeInstance: GlobalContextInstance = {\n actionBarItem: {\n component: GlobalContextComponent,\n placement: 'left'\n },\n source: ROUTE_PATHS.HOME,\n sourceId: null\n };\n\n this.instance.set(homeInstance);\n }\n\n return this.getInstance().actionBarItem;\n }\n\n /**\n * Handles navigation to dashboard routes.\n *\n * Dashboard routes display global context only if a valid dashboard ID exists.\n * Manages query parameter cleanup during dashboard transitions.\n *\n * @param activeRoute - The active route containing dashboard parameters\n * @returns ActionBarItem configuration for dashboard context or null if invalid\n */\n private handleDashboard(activeRoute: ActivatedRoute): ActionBarItem | null {\n const dashboardId = this.extractDashboardId(activeRoute);\n\n if (!dashboardId) {\n return null;\n }\n\n const current = this.getInstance();\n\n // Return existing instance if same dashboard\n if (current.source === ROUTE_PATHS.DASHBOARD && current.sourceId === dashboardId) {\n return current.actionBarItem;\n }\n\n // We're changing contexts if coming from a different dashboard\n const isChangingContext =\n current.source === ROUTE_PATHS.DASHBOARD && current.sourceId !== dashboardId;\n this.handleQueryParamCleanup(isChangingContext);\n\n // Create new dashboard instance\n const dashboardInstance: GlobalContextInstance = {\n actionBarItem: {\n component: GlobalContextComponent,\n placement: 'left'\n },\n source: ROUTE_PATHS.DASHBOARD,\n sourceId: dashboardId\n };\n\n this.instance.set(dashboardInstance);\n return this.getInstance().actionBarItem;\n }\n\n private handleDevice(activeRoute: ActivatedRoute): ActionBarItem | null {\n const deviceId = this.extractDeviceId(activeRoute);\n\n if (!deviceId) {\n return null;\n }\n\n const current = this.getInstance();\n\n // Return existing instance if same device\n if (current.source === ROUTE_PATHS.DEVICE && current.sourceId === deviceId) {\n return current.actionBarItem;\n }\n\n // We're changing contexts if coming from a different device\n const isChangingContext =\n current.source === ROUTE_PATHS.DEVICE && current.sourceId !== deviceId;\n this.handleQueryParamCleanup(isChangingContext);\n\n // Create new device instance\n const deviceInstance: GlobalContextInstance = {\n actionBarItem: {\n component: GlobalContextComponent,\n placement: 'left'\n },\n source: ROUTE_PATHS.DEVICE,\n sourceId: deviceId\n };\n\n this.instance.set(deviceInstance);\n return this.getInstance().actionBarItem;\n }\n\n /**\n * Extracts the current path from an activated route.\n *\n * @param activeRoute - The route to extract path from\n * @returns The first URL segment path or undefined\n */\n private extractCurrentPath(activeRoute: ActivatedRoute): string | undefined {\n return activeRoute?.snapshot?.url?.[0]?.path;\n }\n\n /**\n * Extracts dashboard ID from route parameters.\n *\n * @param activeRoute - The route containing dashboard parameters\n * @returns Dashboard ID or undefined if not present\n */\n private extractDashboardId(activeRoute: ActivatedRoute): string | undefined {\n const dashboardId = activeRoute?.snapshot?.params?.['dashboardId'];\n return dashboardId && typeof dashboardId === 'string' ? dashboardId : undefined;\n }\n\n /**\n * Extracts device ID from route parameters.\n *\n * @param activeRoute - The route containing device parameters\n * @returns Device ID or undefined if not present\n */\n private extractDeviceId(activeRoute: ActivatedRoute): string | undefined {\n let currentRoute: ActivatedRoute | null = activeRoute;\n while (currentRoute) {\n const deviceId = currentRoute.snapshot.params['id'];\n if (deviceId && typeof deviceId === 'string') {\n return deviceId;\n }\n currentRoute = currentRoute.parent;\n }\n return undefined;\n }\n\n /**\n * Checks if the current path is a home route.\n *\n * @param path - Path to check\n * @returns True if path is home route\n */\n private isHomePath(path: string | undefined): boolean {\n return path === ROUTE_PATHS.HOME;\n }\n\n /**\n * Checks if the current path is a dashboard route.\n * Handles both direct dashboard routes and nested dashboard routes (e.g., group dashboards)\n *\n * @param activeRoute - The active route to check\n * @returns True if this is a dashboard route\n */\n private isDashboardRoute(activeRoute: ActivatedRoute): boolean {\n try {\n // Check if any segment in the URL path is 'dashboard'\n const urlSegments = activeRoute?.snapshot?.url || [];\n const hasDashboardSegment = urlSegments.some(\n segment => segment.path === ROUTE_PATHS.DASHBOARD\n );\n\n // Also check if we have a dashboardId parameter (for nested routes)\n const hasDashboardId = !!activeRoute?.snapshot?.params?.['dashboardId'];\n\n return hasDashboardSegment || hasDashboardId;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Checks if the current path is a dashboard route.\n *\n * @param path - Path to check\n * @returns True if path is dashboard route\n */\n private isDashboardPath(path: string | undefined): boolean {\n return path === ROUTE_PATHS.DASHBOARD;\n }\n\n private isDevicePath(path: string | undefined): boolean {\n return path === ROUTE_PATHS.DEVICE;\n }\n\n /**\n * Checks if the current path is a general route.\n *\n * @param path - Path to check\n * @returns True if path is general route\n */\n private isGeneralPath(path: string | undefined): boolean {\n return path === ROUTE_PATHS.GENERAL;\n }\n\n /**\n * Handles query parameter cleanup during navigation.\n *\n * Cleans up global context query parameters when:\n * 1. Explicitly requested via navigation state\n * 2. Actually changing contexts (different dashboard/device)\n */\n private handleQueryParamCleanup(isChangingContext = false): void {\n const navigation = this.router.getCurrentNavigation();\n\n // Clear params when explicitly requested OR when changing contexts\n const shouldClearParams =\n navigation?.extras?.state?.clearParams === true || (navigation !== null && isChangingContext);\n\n if (shouldClearParams) {\n this.globalContextQueryService.checkAndRemoveDateContextParams();\n }\n }\n\n /**\n * Resets the instance to default configuration.\n */\n private resetInstance(): void {\n this.instance.set({ ...DEFAULT_INSTANCE });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n EventEmitter,\n inject,\n Input,\n OnInit,\n Output,\n signal\n} from '@angular/core';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { TranslateService } from '@ngx-translate/core';\n\nimport type { LinkControlConfig, LinkControlInfo } from './inline-context.models';\n\n/**\n * Component to display and manage link controls for global context items\n */\n@Component({\n selector: 'c8y-global-context-link-controls',\n standalone: true,\n imports: [IconDirective, TooltipModule, C8yTranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n styles: [\n `\n .btn-icon-dot[disabled] {\n cursor: not-allowed;\n opacity: 0.75;\n }\n\n .btn-icon-dot.link-auto-unlinked,\n .btn-icon-dot.link-auto-unlinked:focus {\n box-shadow: 0 0 0 2px var(--c8y-palette-status-danger);\n border-color: var(--c8y-palette-status-danger);\n }\n `\n ],\n template: `\n @if (showLinks()) {\n <button\n class=\"btn-icon-dot-set\"\n [class.active]=\"someControlsLinked()\"\n [attr.aria-label]=\"'Global context sync controls' | translate\"\n [tooltip]=\"masterTooltipTemplate\"\n delay=\"500\"\n container=\"body\"\n (click)=\"toggleAll()\"\n data-cy=\"global-context-link--all\"\n >\n <span class=\"btn-icon-dot__item default\" [class.active]=\"allControlsLinked()\">\n <i [c8yIcon]=\"someControlsLinked() ? 'link' : 'unlink'\"></i>\n </span>\n <!-- Individual Link icons -->\n @for (control of visibleControls(); track control.key) {\n <span\n [class]=\"control.cssClass + ' btn-icon-dot__item'\"\n [class.active]=\"control.isLinked\"\n [class.link-disabled]=\"control.disabled\"\n [class.link-auto-unlinked]=\"control.autoUnlinked\"\n [attr.data-cy]=\"'global-context-link--' + control.key\"\n >\n <i [c8yIcon]=\"control.icon\"></i>\n </span>\n }\n </button>\n <ng-template #masterTooltipTemplate>{{ masterTooltipText() | translate }}</ng-template>\n }\n `\n})\nexport class GlobalContextLinkControlsComponent implements OnInit {\n // Single output event - all controls toggle together (v2 pattern)\n @Output() allLinksToggled = new EventEmitter<boolean>();\n\n private translateService: TranslateService = inject(TranslateService);\n private _linkStates: { [key: string]: boolean } = {};\n private linkStatesSignal = signal<{ [key: string]: boolean }>({});\n private controlConfigsSignal = signal<Record<string, LinkControlConfig>>({});\n\n showLinks = computed<boolean>(() => {\n const linkStates = this.linkStatesSignal();\n return Object.keys(linkStates).length > 0;\n });\n\n visibleControls = computed<LinkControlInfo[]>(() => {\n const linkStates = this.linkStatesSignal();\n const controlConfigs = this.controlConfigsSignal();\n\n return Object.entries(linkStates)\n .filter(([key]) => controlConfigs[key])\n .map(([key, isLinked]) => ({\n key,\n isLinked,\n cssClass: (controlConfigs[key]?.cssClass || 'default').trim(),\n icon: controlConfigs[key]?.icon || '',\n disabled: !!controlConfigs[key]?.disabled,\n disabledTooltip: controlConfigs[key]?.disabledTooltip,\n autoUnlinked: !!controlConfigs[key]?.autoUnlinked\n }));\n });\n\n allControlsLinked = computed<boolean>(() => {\n const controls = this.visibleControls();\n return controls.length > 0 && controls.every(control => control.isLinked);\n });\n\n someControlsLinked = computed<boolean>(() => {\n const controls = this.visibleControls();\n return controls.length > 0 && controls.some(control => control.isLinked);\n });\n\n masterTooltipText = computed<string>(() => {\n const controls = this.visibleControls();\n const linkedControls = controls.filter(control => control.isLinked);\n const controlConfigs = this.controlConfigsSignal();\n const clickToToggleLabel = this.translateService.instant(gettext('(click to toggle)'));\n\n if (linkedControls.length === 0) {\n const usingWidgetCustomTimeSettingsLabel = this.translateService.instant(\n gettext('Using widget custom time settings')\n );\n return `${usingWidgetCustomTimeSettingsLabel}\\n${clickToToggleLabel}`;\n }\n\n const linkedNames = linkedControls.map(control => {\n const config = controlConfigs[control.key];\n return this.translateService.instant(config?.label);\n });\n\n const formatter = new Intl.ListFormat(\n this.translateService.getCurrentLang()?.replace('_', '-'),\n { type: 'conjunction' }\n );\n const linkedNamesList = formatter.format(linkedNames);\n const linkedToDashboardLabel = this.translateService.instant(gettext('Synced to dashboard:'));\n return `${linkedToDashboardLabel}\\n${linkedNamesList}\\n${clickToToggleLabel}`;\n });\n\n @Input()\n set linkStates(value: { [key: string]: boolean }) {\n this._linkStates = value || {};\n this.linkStatesSignal.set(this._linkStates);\n }\n get linkStates(): { [key: string]: boolean } {\n return this._linkStates;\n }\n\n @Input()\n set controlConfigs(value: Record<string, LinkControlConfig>) {\n this.controlConfigsSignal.set(value || {});\n }\n\n ngOnInit(): void {\n this.linkStatesSignal.set(this._linkStates);\n }\n\n toggleAll(): void {\n const newLinkState = !this.allControlsLinked();\n const updatedLinkStates = { ...this._linkStates };\n const config = this.controlConfigsSignal();\n\n // Update only controls that are part of the current configuration\n for (const key of Object.keys(config)) {\n if (key in updatedLinkStates && !config[key]?.disabled) {\n updatedLinkStates[key] = newLinkState;\n }\n }\n this._linkStates = updatedLinkStates;\n this.linkStatesSignal.set(this._linkStates);\n this.allLinksToggled.emit(newLinkState);\n }\n}\n","import { aggregationType } from '@c8y/client';\nimport {\n LINK_BTNS_CONFIG,\n type ControlConfigsMap,\n type LinkStatesMap,\n type LinkToggleEvent\n} from '../../models/control-flow.model';\nimport type {\n GlobalContextSettings,\n GlobalContextState,\n WidgetState,\n WidgetStateHandlerResult\n} from '../../models/global-context.model';\nimport type { LinkHelpersContext } from './inline-context.models';\n\nexport function handleLinkToggle(\n ctx: LinkHelpersContext,\n event: LinkToggleEvent,\n options?: { suppressEmit?: boolean; fromHandler?: boolean }\n): boolean {\n const sources = ctx.getFieldSources();\n if (!options?.fromHandler) {\n resetHandlerOverrides(ctx);\n }\n\n if (event.isLinked && event.key === 'aggregation' && sources.dateTimeContext === 'local') {\n const localDateTimeContext = ctx.getLocalState().dateTimeContext;\n const validation = ctx.orchestrator.validateAggregationLink({\n globalAggregation: ctx.getGlobalState().aggregation,\n localDateTimeContext,\n calculateValidAggregation: (_dateRange, target) => ({\n selectedAggregation: ctx.orchestrator.calculateAggregation(\n localDateTimeContext,\n target as aggregationType | null\n )\n })\n });\n\n if (!validation.canLink) {\n ctx.updateAggregationValue(validation.nextAggregation ?? null);\n return false;\n }\n }\n\n const outcome = ctx.orchestrator.toggleLink({\n key: event.key,\n isLinked: event.isLinked,\n fieldSources: sources\n });\n\n applyLocalStateToForm(ctx, outcome.snapshotKeys);\n\n if (outcome.recalcLocalAggregation) {\n ctx.recalcLocalAggregation();\n }\n\n if (outcome.recalcGlobalAggregation) {\n ctx.recalcGlobalAggregation();\n }\n\n if (!options?.suppressEmit) {\n ctx.emitBasedOnFieldSources();\n if (outcome.shouldEmitRefresh) {\n ctx.emitRefresh(null);\n }\n }\n\n if (outcome.clearLocalKeys.length) {\n outcome.clearLocalKeys.forEach(key => applyGlobalValueToForm(ctx, key));\n }\n\n syncWithEffectiveConfig(ctx, outcome.snapshotKeys);\n\n return outcome.shouldEmitRefresh;\n}\n\nexport function toggleAllLinks(\n ctx: LinkHelpersContext,\n args: {\n keys: Array<keyof LinkStatesMap>;\n isLinked: boolean;\n suppressRefresh: boolean;\n suppressEmit: boolean;\n }\n): void {\n resetHandlerOverrides(ctx);\n let supportedLinks: Array<keyof LinkStatesMap> = [...args.keys];\n\n if (!supportedLinks.length) {\n return;\n }\n\n const currentSources = ctx.getFieldSources();\n\n if (args.isLinked && supportedLinks.includes('aggregation')) {\n const dateTimeWillStayLocal =\n currentSources.dateTimeContext === 'local' && !supportedLinks.includes('dateTimeContext');\n\n if (dateTimeWillStayLocal) {\n const localDateTimeContext = ctx.getLocalState().dateTimeContext;\n const validation = ctx.orchestrator.validateAggregationLink({\n globalAggregation: ctx.getGlobalState().aggregation,\n localDateTimeContext,\n calculateValidAggregation: (_dateRange, target) => ({\n selectedAggregation: ctx.orchestrator.calculateAggregation(\n localDateTimeContext,\n target as aggregationType | null\n )\n })\n });\n\n if (!validation.canLink) {\n supportedLinks = supportedLinks.filter(link => link !== 'aggregation');\n ctx.updateAggregationValue(validation.nextAggregation ?? null);\n }\n }\n }\n\n if (!supportedLinks.length) {\n return;\n }\n\n const outcome = ctx.orchestrator.toggleAllLinks({\n keys: supportedLinks,\n isLinked: args.isLinked,\n fieldSources: currentSources\n });\n\n if (outcome.clearLocalKeys.length) {\n outcome.clearLocalKeys.forEach(key => applyGlobalValueToForm(ctx, key));\n }\n\n if (outcome.snapshotKeys.length) {\n applyLocalStateToForm(ctx, outcome.snapshotKeys);\n }\n\n if (outcome.recalcLocalAggregation) {\n ctx.recalcLocalAggregation();\n }\n\n if (outcome.recalcGlobalAggregation) {\n ctx.recalcGlobalAggregation();\n }\n\n // Only emit configuration updates if not suppressed\n if (!args.suppressEmit) {\n ctx.emitBasedOnFieldSources();\n }\n\n // Only emit refresh if not suppressed (when unlinking, data is already loaded)\n if (outcome.shouldEmitRefresh && !args.suppressRefresh) {\n ctx.emitRefresh(null);\n }\n\n syncWithEffectiveConfig(ctx, outcome.snapshotKeys);\n}\n\nexport function applyConfigOverride(\n ctx: LinkHelpersContext,\n config: Partial<GlobalContextState>\n): void {\n const fieldsToUpdate = [\n 'isAutoRefreshEnabled',\n 'refreshInterval',\n 'refreshOption',\n 'dateTimeContext',\n 'aggregation'\n ] as const;\n\n fieldsToUpdate.forEach(field => {\n if (config[field] !== undefined) {\n updateFormAndLocalState(ctx, field, config[field]);\n }\n });\n}\n\nexport function buildWidgetState(\n ctx: LinkHelpersContext,\n configOverride?: GlobalContextState | null\n): WidgetState {\n const config = configOverride ?? ctx.getEffectiveConfig();\n return {\n config,\n inlineControlSettings: ctx.inlineSettings(),\n dashboardControlSettings: ctx.dashboardControlSettings(),\n currentLinks: ctx.controlLinkStatus(),\n displayMode: config?.displayMode\n };\n}\n\nexport function applyHandlerResult(\n ctx: LinkHelpersContext,\n result: WidgetStateHandlerResult\n): boolean {\n let shouldEmitRefresh = false;\n\n if (result.inlineControlSettings) {\n ctx.setInlineOverrides(structuredClone(result.inlineControlSettings));\n }\n\n if (result.dashboardControlSettings) {\n ctx.setDashboardOverrides(structuredClone(result.dashboardControlSettings));\n }\n\n if (result.links) {\n shouldEmitRefresh = processLinkUpdates(ctx, result.links, { suppressEmit: true });\n }\n\n if (result.options) {\n processOptions(ctx, result.options);\n }\n\n return shouldEmitRefresh;\n}\n\nexport function processLinkUpdates(\n ctx: LinkHelpersContext,\n links: Partial<LinkStatesMap>,\n options?: { suppressEmit?: boolean }\n): boolean {\n let shouldEmitRefresh = false;\n\n Object.entries(links).forEach(([key, isLinked]) => {\n const linkKey = key as LinkToggleEvent['key'];\n const refreshRequested = handleLinkToggle(\n ctx,\n { key: linkKey, isLinked: !!isLinked },\n { suppressEmit: true, fromHandler: true }\n );\n\n shouldEmitRefresh = shouldEmitRefresh || refreshRequested;\n });\n\n if (!options?.suppressEmit) {\n ctx.emitBasedOnFieldSources();\n if (shouldEmitRefresh) {\n ctx.emitRefresh(null);\n }\n }\n\n return shouldEmitRefresh;\n}\n\nexport function processOptions(ctx: LinkHelpersContext, options: Record<string, unknown>): void {\n if (options.noAutoRefreshCounter !== undefined) {\n ctx.setShouldDisableCounter(!!options.noAutoRefreshCounter);\n }\n}\n\nexport function resetHandlerOverrides(ctx: LinkHelpersContext): void {\n if (Object.keys(ctx.inlineOverrides()).length) {\n ctx.setInlineOverrides({});\n }\n if (Object.keys(ctx.dashboardOverrides()).length) {\n ctx.setDashboardOverrides({});\n }\n}\n\nexport function buildControlLinkConfig(\n ctx: LinkHelpersContext,\n settings: Partial<GlobalContextSettings>,\n linkStates: LinkStatesMap | null\n): { controlConfig: ControlConfigsMap; filteredStates: LinkStatesMap } {\n const config: ControlConfigsMap = {};\n const filteredStates: LinkStatesMap = {};\n const disableReasons = ctx.orchestrator.getLinkDisableReasons();\n const aggregationReason = ctx.orchestrator.getAggregationUnlinkReason();\n const isAggregationAutoUnlinked =\n aggregationReason?.source === 'validation' && aggregationReason.canAutoRecover;\n\n const desiredKeys = new Set<keyof LinkStatesMap>();\n\n if (settings.showTimeContext) {\n desiredKeys.add('dateTimeContext');\n }\n if (settings.showAggregation) {\n desiredKeys.add('aggregation');\n }\n if (settings.showAutoRefresh) {\n desiredKeys.add('isAutoRefreshEnabled');\n }\n\n if (linkStates) {\n Object.keys(linkStates).forEach(key => {\n desiredKeys.add(key as keyof LinkStatesMap);\n });\n }\n\n const BASE_ORDER: Array<keyof LinkStatesMap> = [\n 'dateTimeContext',\n 'aggregation',\n 'isAutoRefreshEnabled'\n ];\n\n const orderedKeys = [\n ...BASE_ORDER.filter(key => desiredKeys.has(key)),\n ...Array.from(desiredKeys)\n .filter(key => !BASE_ORDER.includes(key))\n .sort()\n ];\n\n orderedKeys.forEach(key => {\n const baseConfig = LINK_BTNS_CONFIG[key];\n if (baseConfig) {\n const disableReason = disableReasons?.[key as keyof GlobalContextState];\n const baseCssClass = (baseConfig.cssClass ?? '').trim();\n const baseAutoUnlinked =\n key === 'aggregation'\n ? isAggregationAutoUnlinked\n : (baseConfig as { autoUnlinked?: boolean }).autoUnlinked;\n config[key] = {\n ...baseConfig,\n cssClass: baseCssClass || 'default',\n disabled: !!disableReason,\n disabledTooltip: disableReason ?? baseConfig.label,\n ...(baseAutoUnlinked !== undefined ? { autoUnlinked: baseAutoUnlinked } : {})\n };\n filteredStates[key] = linkStates?.[key] ?? false;\n }\n });\n\n return { controlConfig: config, filteredStates };\n}\n\nfunction updateFormAndLocalState<T extends keyof GlobalContextState>(\n ctx: LinkHelpersContext,\n field: T,\n value: GlobalContextState[T]\n): void {\n const control = ctx.form()?.get(field as string);\n if (control) {\n control.setValue(value, { emitEvent: false });\n }\n ctx.updateLocalState(state => ({ ...state, [field]: value }));\n}\n\nfunction applyGlobalValueToForm(ctx: LinkHelpersContext, key: keyof GlobalContextState): void {\n const control = ctx.form()?.get(key as string);\n if (!control) {\n return;\n }\n\n const globalState = ctx.getGlobalState();\n const configState = ctx.getInitialConfig();\n const globalStateValue = globalState[key];\n const configValue = configState ? configState[key] : undefined;\n let valueToApply = globalStateValue !== undefined ? globalStateValue : configValue;\n\n if (key === 'aggregation') {\n valueToApply = ctx.orchestrator.deriveAggregationValue(ctx.getEffectiveConfig());\n }\n\n control.setValue(valueToApply ?? null, { emitEvent: false });\n\n if (key === 'isAutoRefreshEnabled') {\n const refreshIntervalControl = ctx.form()?.get('refreshInterval');\n const refreshOptionControl = ctx.form()?.get('refreshOption');\n const refreshIntervalValue =\n ctx.getGlobalState().refreshInterval ?? ctx.getInitialConfig()?.refreshInterval ?? null;\n const refreshOptionValue =\n ctx.getGlobalState().refreshOption ?? ctx.getInitialConfig()?.refreshOption ?? null;\n\n refreshIntervalControl?.setValue(refreshIntervalValue, { emitEvent: false });\n refreshOptionControl?.setValue(refreshOptionValue, { emitEvent: false });\n }\n}\n\nfunction updateFormField(\n ctx: LinkHelpersContext,\n key: keyof GlobalContextState,\n value: GlobalContextState[keyof GlobalContextState] | null | undefined\n): void {\n const control = ctx.form()?.get(key as string);\n if (control) {\n const nextValue = value === undefined ? null : structuredClone(value);\n control.setValue(nextValue as unknown, { emitEvent: false });\n }\n}\n\nfunction syncWithEffectiveConfig(\n ctx: LinkHelpersContext,\n keys: Array<keyof GlobalContextState>\n): void {\n if (!keys.length) {\n return;\n }\n\n const latest = ctx.getEffectiveConfig();\n\n keys.forEach(key => {\n if (latest[key] === undefined) {\n return;\n }\n\n const value = structuredClone(latest[key]) as GlobalContextState[keyof GlobalContextState];\n ctx.updateLocalState(current => ({ ...current, [key]: value }));\n updateFormField(ctx, key, value);\n });\n}\n\nfunction applyLocalStateToForm(\n ctx: LinkHelpersContext,\n keys: Array<keyof GlobalContextState>\n): void {\n if (!keys.length) {\n return;\n }\n\n const localState = ctx.getLocalState();\n\n keys.forEach(key => {\n if (Object.prototype.hasOwnProperty.call(localState, key)) {\n const value = localState[key];\n updateFormField(ctx, key, value ?? null);\n }\n });\n}\n","import { GLOBAL_CONTEXT_DEFAULTS } from '../../../models/global-context-defaults';\nimport type { GlobalContextState } from '../../../models/global-context.model';\n\nexport const FIELD_SOURCE_LOCAL = 'local' as const;\nexport const FIELD_SOURCE_GLOBAL = 'global' as const;\nexport type FieldSource = typeof FIELD_SOURCE_LOCAL | typeof FIELD_SOURCE_GLOBAL;\n\nexport type FieldSourcesMap = Partial<Record<keyof GlobalContextState, FieldSource>>;\n\nexport interface EffectiveConfigContext {\n baseConfig: GlobalContextState | null | undefined;\n localState: Partial<GlobalContextState>;\n globalState: Partial<GlobalContextState>;\n fieldSources: FieldSourcesMap;\n}\n\nconst CORE_GLOBAL_CONTEXT_FIELDS: Array<keyof GlobalContextState> = [\n 'dateTimeContext',\n 'aggregation',\n 'isAutoRefreshEnabled',\n 'refreshInterval',\n 'refreshOption',\n 'source'\n];\n\nexport function composeEffectiveConfig(context: EffectiveConfigContext): GlobalContextState {\n const baseConfiguration: Partial<GlobalContextState> = structuredClone(context.baseConfig ?? {});\n const configuration: Partial<\n Record<keyof GlobalContextState, GlobalContextState[keyof GlobalContextState]>\n > = { ...baseConfiguration };\n\n CORE_GLOBAL_CONTEXT_FIELDS.forEach(key => {\n const resolvedValue = resolveConfigurationValue(\n key,\n context.fieldSources,\n context.localState,\n context.globalState,\n baseConfiguration\n );\n if (resolvedValue === undefined) {\n delete configuration[key];\n } else {\n configuration[key] = resolvedValue;\n }\n });\n\n Object.entries(context.globalState).forEach(([key, value]) => {\n const isStandardKey = CORE_GLOBAL_CONTEXT_FIELDS.includes(key as keyof GlobalContextState);\n if (!isStandardKey && value !== undefined) {\n (configuration as Record<string, unknown>)[key] = structuredClone(value);\n }\n });\n\n return configuration as GlobalContextState;\n}\n\nfunction resolveConfigurationValue<K extends keyof GlobalContextState>(\n key: K,\n sources: FieldSourcesMap,\n localStateValues: Partial<GlobalContextState>,\n globalStateValues: Partial<GlobalContextState>,\n baseConfiguration: Partial<GlobalContextState>\n): GlobalContextState[K] | undefined {\n const localValue = localStateValues[key];\n const globalValue = globalStateValues[key];\n const baseValue = baseConfiguration[key];\n\n if (sources[key] === FIELD_SOURCE_LOCAL && localValue !== undefined) {\n return safeCloneValue(localValue);\n }\n\n if (sources[key] === FIELD_SOURCE_GLOBAL && globalValue !== undefined) {\n return safeCloneValue(globalValue);\n }\n\n if (baseValue !== undefined) {\n return safeCloneValue(baseValue);\n }\n\n switch (key) {\n case 'isAutoRefreshEnabled':\n return GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED as GlobalContextState[K];\n case 'refreshOption':\n return GLOBAL_CONTEXT_DEFAULTS.REFRESH_OPTION as GlobalContextState[K];\n case 'refreshInterval':\n return GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL as GlobalContextState[K];\n case 'aggregation':\n return GLOBAL_CONTEXT_DEFAULTS.AGGREGATION as GlobalContextState[K];\n case 'displayMode':\n return GLOBAL_CONTEXT_DEFAULTS.DISPLAY_MODE as GlobalContextState[K];\n case 'dateTimeContext':\n return undefined;\n case 'source':\n return undefined;\n case 'eventSourceId':\n return undefined;\n case 'isGlobalContextReady':\n return undefined;\n default: {\n // Exhaustive check: ensures all keys are handled at compile time\n const _exhaustive: never = key;\n return undefined;\n }\n }\n}\n\nfunction safeCloneValue<T>(value: T): T {\n return typeof value === 'object' && value !== null ? structuredClone(value) : value;\n}\n","import { aggregationType } from '@c8y/client';\nimport type { DateTimeContext } from '../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../models/global-context.model';\nimport type { TimeInterval } from '../../models/interval-picker.model';\nimport { TIME_INTERVAL } from '../../models/interval-picker.model';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\nimport type { RefreshHelpersContext } from './inline-context.models';\nimport { FIELD_SOURCE_GLOBAL, FIELD_SOURCE_LOCAL } from './orchestrator/config-composer.util';\nimport type { RefreshResult } from './orchestrator/global-context-inline-orchestrator.service';\nimport type { AggregationChangeInstruction } from './orchestrator/shared-mode-orchestrator.types';\n\nexport function recalculateAggregationForLocalDateTime(ctx: RefreshHelpersContext): void {\n const localDateTimeContext = ctx.getLocalState().dateTimeContext;\n const currentAggregation = ctx.form()?.get('aggregation')?.value as aggregationType | null;\n\n if (!localDateTimeContext) {\n return;\n }\n\n const adjustment = ctx.orchestrator.adjustAggregationForDateTime({\n dateTimeContext: localDateTimeContext,\n aggregation: currentAggregation\n });\n\n if (adjustment.changed) {\n updateAggregationValue(ctx, adjustment.nextAggregation);\n }\n}\n\nexport function recalculateAggregationForGlobalDateTime(ctx: RefreshHelpersContext): void {\n const globalDateTimeContext =\n ctx.getGlobalState().dateTimeContext ?? ctx.getInitialConfig()?.dateTimeContext;\n const currentAggregation = ctx.form()?.get('aggregation')?.value as aggregationType | null;\n\n if (!globalDateTimeContext) {\n return;\n }\n\n const adjustment = ctx.orchestrator.adjustAggregationForDateTime({\n dateTimeContext: globalDateTimeContext,\n aggregation: currentAggregation\n });\n\n if (adjustment.changed) {\n updateAggregationValue(ctx, adjustment.nextAggregation);\n }\n}\n\nexport function handleGlobalRefresh(\n ctx: RefreshHelpersContext,\n globalDateTimeContext: DateTimeContext\n): void {\n const sources = ctx.getFieldSources();\n\n ctx.updateGlobalState(current => ({\n ...current,\n dateTimeContext: structuredClone(globalDateTimeContext)\n }));\n\n // If auto-refresh is unlinked (manual mode), don't auto-emit on global refresh\n // Linked fields like dateTime will still sync via syncLocalEntriesWithGlobal()\n if (sources.isAutoRefreshEnabled === FIELD_SOURCE_LOCAL) {\n return;\n }\n\n processRefreshEvent(ctx, { globalDateTimeContext });\n}\n\nexport function processRefreshEvent(\n ctx: RefreshHelpersContext,\n params: { globalDateTimeContext?: DateTimeContext | null }\n): RefreshResult {\n const outcome = ctx.orchestrator.processRefresh({\n globalDateTimeContext: params.globalDateTimeContext,\n generateFreshDateTime: interval => generateFreshDateTimeContext(interval)\n });\n\n applyRefreshOutcome(ctx, outcome);\n\n return outcome;\n}\n\nexport function applyRefreshOutcome(ctx: RefreshHelpersContext, outcome: RefreshResult): void {\n if (outcome.updatedLocalDateTime) {\n const next = structuredClone(outcome.updatedLocalDateTime);\n updateLocalDateTimeContext(ctx, next);\n updateFormDateTimeContext(ctx, next);\n } else if (outcome.refreshPayload) {\n const baseContext = ctx.getEffectiveConfig().dateTimeContext ?? {\n dateFrom: undefined,\n dateTo: undefined,\n interval: TIME_INTERVAL.CUSTOM\n };\n const next = structuredClone(baseContext);\n Object.assign(next, outcome.refreshPayload);\n updateFormDateTimeContext(ctx, next);\n }\n\n ctx.emitBasedOnFieldSources();\n\n if (outcome.shouldEmitRefresh) {\n ctx.emitRefresh(outcome.refreshPayload ?? null);\n }\n}\n\nexport function getShouldDisableIntervalConfig(\n ctx: RefreshHelpersContext\n): Record<string, boolean> {\n const sources = ctx.getFieldSources();\n return sources.dateTimeContext === FIELD_SOURCE_GLOBAL ? { custom: true } : {};\n}\n\nexport function deriveDisabledAggregations(\n ctx: RefreshHelpersContext\n): Partial<Record<aggregationType, boolean>> {\n const configuration = ctx.getEffectiveConfig();\n const dateTimeContext = configuration?.dateTimeContext;\n\n if (!dateTimeContext) {\n return {};\n }\n\n return calculateDisabledAggregationsFromContext(ctx, dateTimeContext);\n}\n\nexport function calculateDisabledAggregationsFromContext(\n ctx: RefreshHelpersContext,\n dateTimeContext: DateTimeContext\n): Partial<Record<aggregationType, boolean>> {\n if (hasValidDateRange(dateTimeContext)) {\n return calculateFromDateRange(ctx, dateTimeContext);\n }\n\n if (hasValidInterval(dateTimeContext)) {\n return calculateFromInterval(ctx, dateTimeContext.interval!);\n }\n\n return {};\n}\n\nfunction calculateFromDateRange(\n ctx: RefreshHelpersContext,\n dateTimeContext: DateTimeContext\n): Partial<Record<aggregationType, boolean>> {\n try {\n const dateRange = createDateRange(dateTimeContext);\n return ctx.aggregationValidationService.getDisabledAggregations(dateRange);\n } catch (error) {\n return {};\n }\n}\n\nfunction calculateFromInterval(\n ctx: RefreshHelpersContext,\n interval: TimeInterval | string\n): Partial<Record<aggregationType, boolean>> {\n const range = DateTimeContextUtil.dateRangeFromInterval(interval as TimeInterval);\n if (!range) {\n return {};\n }\n\n try {\n return ctx.aggregationValidationService.getDisabledAggregations(range);\n } catch (error) {\n return {};\n }\n}\n\nfunction hasValidInterval(dateTimeContext: DateTimeContext): boolean {\n return !!dateTimeContext.interval && dateTimeContext.interval !== TIME_INTERVAL.CUSTOM;\n}\n\nfunction createDateRange(dateTimeContext: DateTimeContext): [Date, Date] {\n return [new Date(dateTimeContext.dateFrom), new Date(dateTimeContext.dateTo)];\n}\n\nfunction hasValidDateRange(dateTimeContext: DateTimeContext | null): boolean {\n return !!dateTimeContext?.dateFrom && !!dateTimeContext?.dateTo;\n}\n\nexport function generateFreshDateTimeContext(interval: TimeInterval): DateTimeContext {\n const range = DateTimeContextUtil.dateRangeFromInterval(interval);\n if (!range) {\n const now = new Date();\n return DateTimeContextUtil.ensureIsoContext({ interval, dateFrom: now, dateTo: now });\n }\n return DateTimeContextUtil.ensureIsoContext({ interval, dateFrom: range[0], dateTo: range[1] });\n}\n\nexport function patchFormValues(\n ctx: RefreshHelpersContext,\n formUpdates: Partial<GlobalContextState>\n): void {\n const form = ctx.form();\n if (!form || !Object.keys(formUpdates).length) {\n return;\n }\n\n form.patchValue(formUpdates, { emitEvent: false });\n}\n\nexport function updateAggregationValue(\n ctx: RefreshHelpersContext,\n aggregation: aggregationType | null\n): void {\n ctx.form()?.get('aggregation')?.setValue(aggregation, { emitEvent: false });\n ctx.updateLocalState(current => ({\n ...current,\n aggregation\n }));\n}\n\nexport function applyLocalAggregationChange(\n ctx: RefreshHelpersContext,\n change: AggregationChangeInstruction\n): void {\n updateAggregationValue(ctx, change.nextAggregation ?? null);\n}\n\nfunction updateLocalDateTimeContext(ctx: RefreshHelpersContext, newContext: DateTimeContext): void {\n ctx.updateLocalState(current => ({ ...current, dateTimeContext: newContext }));\n}\n\nfunction updateFormDateTimeContext(ctx: RefreshHelpersContext, newContext: DateTimeContext): void {\n ctx.form()?.get('dateTimeContext')?.setValue(newContext, { emitEvent: false });\n}\n","import type { aggregationType } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type { AggregationChangeInstruction } from './shared-mode-orchestrator.types';\nimport type { AggregationValidationResult } from './validation.util';\n\nexport const AGGREGATION_SYNC_FAILED = gettext('Cannot sync aggregation with dashboard');\n\nexport interface AggregationAdjustmentFn {\n (params: {\n dateTimeContext: DateTimeContext | null | undefined;\n aggregation: aggregationType | null | undefined;\n }): { nextAggregation: aggregationType | null; changed: boolean };\n}\n\nexport interface ResolveAggregationChangeForFormParams {\n formValue: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n globalAggregation: aggregationType | null | undefined;\n currentAggregation: aggregationType | null | undefined;\n adjustAggregationForDateTime: AggregationAdjustmentFn;\n updateFieldSources: (updater: (current: FieldSourcesMap) => FieldSourcesMap) => void;\n}\n\nexport function resolveAggregationChangeForForm(\n params: ResolveAggregationChangeForFormParams\n): AggregationChangeInstruction | null {\n const { formValue, sources } = params;\n const dateTimeContext = formValue.dateTimeContext;\n\n if (!dateTimeContext) {\n return null;\n }\n\n if (\n sources.dateTimeContext === FIELD_SOURCE_LOCAL &&\n sources.aggregation === FIELD_SOURCE_GLOBAL\n ) {\n if (params.globalAggregation === undefined) {\n return null;\n }\n\n const adjustment = params.adjustAggregationForDateTime({\n dateTimeContext,\n aggregation: params.globalAggregation ?? null\n });\n\n if (!adjustment.changed) {\n return null;\n }\n\n params.updateFieldSources(current => ({\n ...current,\n aggregation: FIELD_SOURCE_LOCAL\n }));\n\n return {\n nextAggregation: adjustment.nextAggregation,\n alertMessage: AGGREGATION_SYNC_FAILED\n };\n }\n\n const adjustment = params.adjustAggregationForDateTime({\n dateTimeContext,\n aggregation: params.currentAggregation ?? null\n });\n\n if (!adjustment.changed) {\n return null;\n }\n\n return {\n nextAggregation: adjustment.nextAggregation\n };\n}\n\nexport interface ResolveAutoUnlinkParams {\n globalAggregation: aggregationType | null | undefined;\n localDateTimeContext: DateTimeContext | null | undefined;\n adjustAggregationForDateTime: AggregationAdjustmentFn;\n updateFieldSources: (updater: (current: FieldSourcesMap) => FieldSourcesMap) => void;\n}\n\nexport function resolveAutoUnlinkAggregationChange(\n params: ResolveAutoUnlinkParams\n): AggregationChangeInstruction | null {\n if (params.globalAggregation === undefined) {\n return null;\n }\n\n const context = params.localDateTimeContext;\n\n if (!context?.dateFrom || !context?.dateTo) {\n params.updateFieldSources(current => ({\n ...current,\n aggregation: FIELD_SOURCE_LOCAL\n }));\n\n return {\n nextAggregation: null,\n alertMessage: AGGREGATION_SYNC_FAILED\n };\n }\n\n const adjustment = params.adjustAggregationForDateTime({\n dateTimeContext: context,\n aggregation: params.globalAggregation ?? null\n });\n\n if (!adjustment.changed) {\n return null;\n }\n\n params.updateFieldSources(current => ({\n ...current,\n aggregation: FIELD_SOURCE_LOCAL\n }));\n\n return {\n nextAggregation: adjustment.nextAggregation,\n alertMessage: AGGREGATION_SYNC_FAILED\n };\n}\n\nexport interface ApplyAggregationForGlobalStateParams {\n incomingState: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n formUpdates: Partial<GlobalContextState>;\n adjustAggregationForDateTime: AggregationAdjustmentFn;\n localAggregationSnapshot: aggregationType | null;\n globalAggregationSnapshot: aggregationType | null;\n applyLocalAggregationChange: (change: AggregationChangeInstruction) => void;\n}\n\nexport function applyAggregationChangesForGlobalState(\n params: ApplyAggregationForGlobalStateParams\n): boolean {\n const { incomingState, sources, formUpdates } = params;\n const dateTimeContext = formUpdates.dateTimeContext ?? incomingState.dateTimeContext;\n\n if (!dateTimeContext) {\n return false;\n }\n\n const aggregationTarget =\n sources.aggregation === FIELD_SOURCE_LOCAL\n ? params.localAggregationSnapshot\n : (incomingState.aggregation ?? params.globalAggregationSnapshot);\n\n const adjustment = params.adjustAggregationForDateTime({\n dateTimeContext,\n aggregation: aggregationTarget ?? null\n });\n\n if (!adjustment.changed) {\n return false;\n }\n\n if (sources.aggregation === FIELD_SOURCE_LOCAL) {\n params.applyLocalAggregationChange({ nextAggregation: adjustment.nextAggregation });\n } else {\n formUpdates.aggregation = adjustment.nextAggregation;\n }\n\n return true;\n}\n\nexport interface AggregationValidationDeps {\n sources?: FieldSourcesMap;\n localDateTimeContext: DateTimeContext | null | undefined;\n globalAggregation: aggregationType | null | undefined;\n validateAggregationLink: (context: {\n globalAggregation: aggregationType | null | undefined;\n localDateTimeContext?: DateTimeContext | null;\n calculateValidAggregation: (\n range: [Date, Date],\n target: aggregationType | null\n ) => { selectedAggregation: aggregationType | null };\n }) => AggregationValidationResult;\n calculateAggregation: (\n dateTimeContext: DateTimeContext | null | undefined,\n target: aggregationType | null | undefined\n ) => aggregationType | null;\n}\n\nexport interface AggregationValidationOutcome {\n isValid: boolean;\n message?: string;\n}\n\nexport function evaluateAggregationValidation(\n deps: AggregationValidationDeps\n): AggregationValidationOutcome | null {\n const sources = deps.sources;\n\n if (!sources || sources.aggregation !== FIELD_SOURCE_LOCAL) {\n return null;\n }\n\n if (sources.dateTimeContext !== FIELD_SOURCE_LOCAL) {\n return { isValid: true };\n }\n\n const linkResult = deps.validateAggregationLink({\n globalAggregation: deps.globalAggregation,\n localDateTimeContext: deps.localDateTimeContext,\n calculateValidAggregation: (_range, target) => ({\n selectedAggregation: deps.calculateAggregation(\n deps.localDateTimeContext,\n (target ?? null) as aggregationType | null\n )\n })\n });\n\n if (linkResult.canLink) {\n return { isValid: true };\n }\n\n return {\n isValid: false,\n message: AGGREGATION_SYNC_FAILED\n };\n}\n","import { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type {\n AggregationChangeInstruction,\n ExecuteHandlerContext,\n HandleFormChangeContext,\n HandleGlobalStateChangeContext\n} from './shared-mode-orchestrator.types';\n\nexport interface FormChangeDependencies {\n resolveAggregationChangeForForm: (params: {\n formValue: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n }) => AggregationChangeInstruction | null;\n setAggregationValidationState: (isValid: boolean, message?: string | null) => void;\n computeEffectiveConfig: () => GlobalContextState;\n updateAggregationDisableReason: () => void;\n}\n\nfunction assignClonedValue<K extends keyof GlobalContextState>(\n target: Partial<GlobalContextState>,\n key: K,\n value: GlobalContextState[K]\n): void {\n target[key] = structuredClone(value);\n}\n\nexport function handleFormChange(\n context: HandleFormChangeContext,\n deps: FormChangeDependencies\n): void {\n const {\n formValue,\n getFieldSources,\n applyFormChangesToLocalState,\n shouldValidateAggregation,\n applyLocalAggregationChange,\n applyRefreshOptionChange,\n previousRefresh,\n updateGlobalStateFromForm,\n emitUpdate,\n emitRefresh\n } = context;\n\n applyFormChangesToLocalState(formValue);\n\n const sources = getFieldSources();\n let didChange = false;\n\n if (shouldValidateAggregation(formValue)) {\n const aggregationChange = deps.resolveAggregationChangeForForm({\n formValue,\n sources\n });\n\n if (aggregationChange) {\n applyLocalAggregationChange(aggregationChange);\n deps.setAggregationValidationState(\n !aggregationChange.alertMessage,\n aggregationChange.alertMessage\n );\n didChange = true;\n }\n }\n\n const nextRefresh = formValue.refreshOption ?? previousRefresh;\n applyRefreshOptionChange(previousRefresh, nextRefresh);\n\n const updatedSources = getFieldSources();\n updateGlobalStateFromForm(formValue, updatedSources);\n\n emitUpdate(deps.computeEffectiveConfig());\n\n if (didChange) {\n emitRefresh(null);\n }\n\n deps.updateAggregationDisableReason();\n}\n\nexport interface GlobalStateChangeDependencies {\n resolveAutoUnlinkAggregationChange: (\n aggregation: GlobalContextState['aggregation']\n ) => AggregationChangeInstruction | null;\n setAggregationValidationState: (isValid: boolean, message?: string | null) => void;\n updateFieldSources: (updater: (current: FieldSourcesMap) => FieldSourcesMap) => void;\n applyAggregationChangesForGlobalState: (params: {\n incomingState: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n formUpdates: Partial<GlobalContextState>;\n applyLocalAggregationChange: (change: AggregationChangeInstruction) => void;\n }) => boolean;\n updateLocalState: (\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ) => void;\n computeEffectiveConfig: () => GlobalContextState;\n updateAggregationDisableReason: () => void;\n}\n\nexport function handleGlobalStateChange(\n context: HandleGlobalStateChangeContext,\n deps: GlobalStateChangeDependencies\n): void {\n const {\n state,\n getFieldSources,\n previousRefresh,\n processGlobalStateChange,\n shouldValidateAggregationForUnlinkedDateTime,\n applyLocalAggregationChange,\n applyRefreshOptionChange,\n patchForm,\n emitUpdate,\n emitRefresh\n } = context;\n\n const sources = getFieldSources();\n const formUpdates = processGlobalStateChange(state, sources);\n let didAnyChange = false;\n let shouldReevaluateDisableReason = true;\n\n if (shouldValidateAggregationForUnlinkedDateTime(state, sources)) {\n const change = deps.resolveAutoUnlinkAggregationChange(state.aggregation);\n if (change) {\n delete (formUpdates as Record<string, unknown>).aggregation;\n deps.updateFieldSources(current => ({\n ...current,\n aggregation: FIELD_SOURCE_LOCAL\n }));\n deps.setAggregationValidationState(false);\n applyLocalAggregationChange(change);\n didAnyChange = true;\n shouldReevaluateDisableReason = false;\n }\n } else if (\n deps.applyAggregationChangesForGlobalState({\n incomingState: state,\n sources,\n formUpdates,\n applyLocalAggregationChange\n })\n ) {\n didAnyChange = true;\n }\n\n const nextRefresh = state.refreshOption ?? previousRefresh;\n const refreshChanged = nextRefresh !== previousRefresh;\n applyRefreshOptionChange(previousRefresh, nextRefresh);\n\n // When switching to Live mode with CUSTOM interval, always update form with normalized dateTimeContext\n if (\n refreshChanged &&\n nextRefresh === REFRESH_OPTION.LIVE &&\n state.dateTimeContext?.interval === TIME_INTERVAL.CUSTOM\n ) {\n formUpdates.dateTimeContext = state.dateTimeContext;\n }\n\n if (refreshChanged && getFieldSources().isAutoRefreshEnabled === FIELD_SOURCE_LOCAL) {\n delete formUpdates.isAutoRefreshEnabled;\n delete formUpdates.refreshInterval;\n delete formUpdates.refreshOption;\n }\n\n if (refreshChanged) {\n didAnyChange = true;\n }\n\n if (Object.keys(formUpdates).length) {\n deps.updateLocalState(current => {\n const updated = { ...current };\n (Object.keys(formUpdates) as Array<keyof GlobalContextState>).forEach(key => {\n const value = formUpdates[key];\n if (sources[key] === FIELD_SOURCE_GLOBAL && value !== undefined) {\n assignClonedValue(updated, key, value);\n }\n });\n return updated;\n });\n patchForm(formUpdates);\n didAnyChange = true;\n }\n\n emitUpdate(deps.computeEffectiveConfig());\n\n if (didAnyChange) {\n emitRefresh(null);\n }\n\n if (shouldReevaluateDisableReason) {\n deps.updateAggregationDisableReason();\n }\n}\n\nexport interface ExecuteHandlerDependencies {\n computeEffectiveConfig: () => GlobalContextState;\n}\n\nexport function executeHandler(\n context: ExecuteHandlerContext,\n deps: ExecuteHandlerDependencies\n): void {\n const {\n handler,\n configOverride,\n previousRefresh,\n applyRefreshOptionChange,\n buildWidgetState,\n applyHandlerResult,\n applyConfigOverride,\n emitBasedOnFieldSources,\n requestRefresh\n } = context;\n\n if (!handler) {\n return;\n }\n\n if (configOverride?.refreshOption !== undefined) {\n applyRefreshOptionChange(previousRefresh, configOverride.refreshOption);\n }\n\n const result = handler(buildWidgetState(configOverride));\n let shouldEmitRefresh = false;\n\n if (result) {\n shouldEmitRefresh = applyHandlerResult(result);\n }\n\n if (configOverride) {\n applyConfigOverride(configOverride);\n }\n\n emitBasedOnFieldSources(deps.computeEffectiveConfig());\n if (shouldEmitRefresh) {\n requestRefresh();\n }\n}\n","import type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport type { TimeInterval } from '../../../models/interval-picker.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type { RefreshResult } from './shared-mode-orchestrator.types';\n\nexport interface RefreshContext {\n effectiveConfig: GlobalContextState;\n fieldSources: FieldSourcesMap;\n globalDateTimeContext?: DateTimeContext | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n}\n\nexport interface RefreshDependencies {\n supportsAutoRefresh: (config: GlobalContextState) => boolean;\n}\n\nexport function calculateRefreshOutcome(\n context: RefreshContext,\n deps: RefreshDependencies\n): RefreshResult {\n const { fieldSources, effectiveConfig } = context;\n\n if (fieldSources.isAutoRefreshEnabled === FIELD_SOURCE_LOCAL) {\n return handleLocalAutoRefresh(context, deps);\n }\n\n if (fieldSources.dateTimeContext === FIELD_SOURCE_GLOBAL) {\n return {\n refreshPayload: context.globalDateTimeContext ?? null,\n shouldEmitRefresh: true\n };\n }\n\n if (!deps.supportsAutoRefresh(effectiveConfig)) {\n return {\n refreshPayload: null,\n shouldEmitRefresh: true\n };\n }\n\n const interval = resolveRefreshInterval(fieldSources, effectiveConfig.dateTimeContext?.interval);\n const freshContext = buildFreshContext(context, interval);\n\n return {\n refreshPayload: null,\n updatedLocalDateTime: freshContext,\n shouldEmitRefresh: true\n };\n}\n\nexport function handleLocalAutoRefresh(\n context: RefreshContext,\n deps: RefreshDependencies\n): RefreshResult {\n const { fieldSources, effectiveConfig } = context;\n const result: RefreshResult = { refreshPayload: null, shouldEmitRefresh: true };\n\n if (fieldSources.dateTimeContext === FIELD_SOURCE_GLOBAL) {\n const resolvedContext =\n context.globalDateTimeContext ?? effectiveConfig.dateTimeContext ?? null;\n\n if (resolvedContext) {\n result.refreshPayload = structuredClone(resolvedContext);\n return result;\n }\n\n if (!deps.supportsAutoRefresh(effectiveConfig)) {\n return result;\n }\n\n const interval = resolveRefreshInterval(\n fieldSources,\n effectiveConfig.dateTimeContext?.interval\n );\n result.refreshPayload = buildFreshContext(context, interval);\n return result;\n }\n\n if (!deps.supportsAutoRefresh(effectiveConfig)) {\n return result;\n }\n\n const interval = resolveRefreshInterval(fieldSources, effectiveConfig.dateTimeContext?.interval);\n result.updatedLocalDateTime = buildFreshContext(context, interval);\n return result;\n}\n\nexport function resolveRefreshInterval(\n fieldSources: FieldSourcesMap,\n configInterval: TimeInterval | undefined\n): TimeInterval {\n if (fieldSources.dateTimeContext === FIELD_SOURCE_LOCAL && configInterval) {\n return configInterval;\n }\n\n return configInterval ?? TIME_INTERVAL.CUSTOM;\n}\n\nexport function buildFreshContext(\n context: RefreshContext,\n interval: TimeInterval\n): DateTimeContext {\n if (interval === TIME_INTERVAL.CUSTOM) {\n const source = context.effectiveConfig.dateTimeContext;\n\n if (source?.dateFrom) {\n return DateTimeContextUtil.normalizeForLive(source);\n }\n\n const generated = context.generateFreshDateTime(TIME_INTERVAL.CUSTOM);\n if (generated) {\n return generated;\n }\n\n return {\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: null,\n dateTo: null\n } satisfies DateTimeContext;\n }\n\n return context.generateFreshDateTime(interval);\n}\n","import type { WritableSignal } from '@angular/core';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport type { LinkStatesMap } from '../../../models/control-flow.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n type GlobalContextDisplayMode,\n type GlobalContextState,\n WIDGET_DISPLAY_MODE,\n type WidgetControls,\n type WidgetDisplayMode\n} from '../../../models/global-context.model';\nimport type { WidgetControlService } from '../../../services/domain/widget-control.service';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport { createDefaultGlobalContextState } from '../../../utils/global-context-defaults.util';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../../models/global-context-defaults';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type { VisibilityContext } from './shared-mode-orchestrator.types';\n\nexport function mapToContextDisplayMode(displayMode: WidgetDisplayMode): GlobalContextDisplayMode {\n switch (displayMode) {\n case WIDGET_DISPLAY_MODE.CONFIG:\n return GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n case WIDGET_DISPLAY_MODE.INLINE:\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n default:\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n}\n\nexport function resolveWidgetDisplayMode(\n initialConfig: GlobalContextState | null,\n globalState: Partial<GlobalContextState>\n): WidgetDisplayMode {\n const raw = initialConfig?.displayMode ?? globalState.displayMode;\n if (raw === GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG) return WIDGET_DISPLAY_MODE.CONFIG;\n if (raw === GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG) return WIDGET_DISPLAY_MODE.INLINE;\n return WIDGET_DISPLAY_MODE.INLINE;\n}\n\nexport function resolveVisibilityContextInternal(\n config: GlobalContextState,\n widgetControlsSignal: WritableSignal<WidgetControls | null>,\n fieldSourcesSignal: WritableSignal<FieldSourcesMap>,\n globalStateSignal: WritableSignal<Partial<GlobalContextState>>,\n widgetControlService: WidgetControlService,\n getDefaultRefreshOption: () => RefreshOption\n): VisibilityContext | null {\n const controls = widgetControlsSignal();\n if (!controls || !config.displayMode) return null;\n const refreshOption =\n (config.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n ? globalStateSignal().refreshOption\n : config.refreshOption) ?? getDefaultRefreshOption();\n const baseVisibility = widgetControlService.resolveInlineControlSettings(\n controls,\n config.displayMode,\n refreshOption\n ) ?? {\n settings: {},\n links: {},\n dashboardControls: {}\n };\n if (config.displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) return baseVisibility;\n let settings = baseVisibility.settings || {};\n let links = { ...(baseVisibility.links || {}) } as LinkStatesMap;\n let dashboard = baseVisibility.dashboardControls || {};\n const sources = fieldSourcesSignal() || {};\n (Object.keys(links) as Array<keyof LinkStatesMap>).forEach(key => {\n const desired =\n (sources as FieldSourcesMap)[key as keyof GlobalContextState] === FIELD_SOURCE_GLOBAL;\n if (!!links[key] === desired) return;\n const toggled = widgetControlService.toggleControlLink(key as string, settings, links);\n settings = toggled.settings;\n links = toggled.links as LinkStatesMap;\n dashboard = toggled.dashboardControls;\n });\n return { settings, links, dashboardControls: dashboard };\n}\n\nexport function syncSourcesForRefreshOption(\n displayMode: WidgetDisplayMode,\n refreshOption: RefreshOption,\n controls: WidgetControls | null,\n fieldSourcesSignal: WritableSignal<FieldSourcesMap>,\n getDefaultRefreshOption: () => RefreshOption,\n setFieldSources: (sources: FieldSourcesMap) => void\n): void {\n const sources = { ...fieldSourcesSignal() };\n if (!sources) return;\n sources.refreshOption = sources.refreshOption ?? FIELD_SOURCE_LOCAL;\n if (controls?.supports?.includes('isAutoRefreshEnabled')) {\n sources.isAutoRefreshEnabled = sources.isAutoRefreshEnabled ?? FIELD_SOURCE_LOCAL;\n sources.refreshInterval = sources.refreshInterval ?? FIELD_SOURCE_LOCAL;\n }\n if (displayMode === WIDGET_DISPLAY_MODE.CONFIG) {\n sources.refreshOption = FIELD_SOURCE_LOCAL;\n sources.isAutoRefreshEnabled = FIELD_SOURCE_LOCAL;\n sources.refreshInterval = FIELD_SOURCE_LOCAL;\n }\n if (refreshOption !== getDefaultRefreshOption())\n sources.isAutoRefreshEnabled = FIELD_SOURCE_LOCAL;\n setFieldSources(sources);\n}\n\nexport function sanitizeLocalState(\n state: Partial<GlobalContextState> | null | undefined,\n configSignal: WritableSignal<GlobalContextState>,\n ensureDateTimeContext: (\n context: GlobalContextState['dateTimeContext'] | null | undefined\n ) => DateTimeContext\n): Partial<GlobalContextState> {\n const snapshot = { ...state };\n if (snapshot.dateTimeContext === null) delete snapshot.dateTimeContext;\n else if (snapshot.dateTimeContext !== undefined)\n snapshot.dateTimeContext = ensureDateTimeContext(snapshot.dateTimeContext);\n // Always enforce the fixed 5s refresh interval\n if (snapshot.refreshInterval !== undefined) {\n snapshot.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n }\n return snapshot;\n}\n\nexport function sanitizeGlobalState(\n state: Partial<GlobalContextState> | null | undefined,\n configSignal: WritableSignal<GlobalContextState>,\n normalizeRefreshOption: (option: RefreshOption | undefined) => RefreshOption,\n getDefaultRefreshOption: () => RefreshOption,\n ensureDateTimeContext: (\n context: GlobalContextState['dateTimeContext'] | null | undefined\n ) => DateTimeContext\n): Partial<GlobalContextState> {\n const snapshot = { ...state };\n if (snapshot.dateTimeContext !== undefined)\n snapshot.dateTimeContext = ensureDateTimeContext(snapshot.dateTimeContext);\n snapshot.refreshOption = normalizeRefreshOption(\n snapshot.refreshOption ?? getDefaultRefreshOption()\n );\n // Always enforce the fixed 5s refresh interval\n if (snapshot.refreshInterval !== undefined) {\n snapshot.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n }\n return snapshot;\n}\n\nexport function ensureDateTimeContext(\n context: GlobalContextState['dateTimeContext'] | null | undefined,\n configSignal: WritableSignal<GlobalContextState>\n): DateTimeContext {\n const defaults =\n configSignal().dateTimeContext ?? createDefaultGlobalContextState().dateTimeContext;\n const iso = DateTimeContextUtil.ensureIsoContext(context ?? defaults);\n return {\n interval: iso.interval ?? defaults.interval,\n dateFrom: iso.dateFrom ?? defaults.dateFrom,\n dateTo: iso.dateTo ?? defaults.dateTo\n };\n}\n\nexport function syncLocalEntriesWithGlobal(\n fieldSourcesSignal: WritableSignal<FieldSourcesMap>,\n globalStateSignal: WritableSignal<Partial<GlobalContextState>>,\n localStateSignal: WritableSignal<Partial<GlobalContextState>>\n): void {\n const sources = fieldSourcesSignal();\n const globalState = globalStateSignal();\n if (!sources || !globalState) return;\n localStateSignal.update(current => {\n const working: Partial<GlobalContextState> = { ...current };\n (Object.keys(globalState) as Array<keyof GlobalContextState>).forEach(key => {\n if (sources[key] === FIELD_SOURCE_GLOBAL) {\n const value = globalState[key];\n if (value === undefined) {\n delete working[key];\n } else {\n (working as any)[key] = structuredClone(value);\n }\n }\n });\n return working;\n });\n}\n","import type { LinkStatesMap } from '../../../models/control-flow.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type { LinkToggleOutcome } from './shared-mode-orchestrator.types';\n\nexport interface LinkToggleArgs {\n key: keyof LinkStatesMap;\n isLinked: boolean;\n fieldSources: FieldSourcesMap;\n}\n\nexport interface ToggleAllArgs {\n keys: Array<keyof LinkStatesMap>;\n isLinked: boolean;\n fieldSources: FieldSourcesMap;\n}\n\nexport function computeLinkToggle(args: LinkToggleArgs): LinkToggleOutcome {\n const { key, isLinked, fieldSources } = args;\n const updatedFieldSources: FieldSourcesMap = { ...fieldSources };\n const snapshotKeys = new Set<keyof GlobalContextState>();\n const clearLocalKeys = new Set<keyof GlobalContextState>();\n const targetSource = isLinked ? FIELD_SOURCE_GLOBAL : FIELD_SOURCE_LOCAL;\n\n updatedFieldSources[key as keyof GlobalContextState] = targetSource;\n\n if (isLinked) {\n clearLocalKeys.add(key as keyof GlobalContextState);\n } else {\n snapshotKeys.add(key as keyof GlobalContextState);\n }\n\n if (key === 'dateTimeContext') {\n updatedFieldSources.refreshOption = targetSource;\n if (isLinked) {\n clearLocalKeys.add('refreshOption');\n } else {\n snapshotKeys.add('refreshOption');\n }\n }\n\n let recalcLocalAggregation = false;\n let recalcGlobalAggregation = false;\n\n if (!isLinked && key === 'aggregation' && fieldSources.dateTimeContext === FIELD_SOURCE_LOCAL) {\n recalcLocalAggregation = true;\n }\n\n if (isLinked && key === 'dateTimeContext' && fieldSources.aggregation === FIELD_SOURCE_LOCAL) {\n recalcGlobalAggregation = true;\n }\n\n let shouldEmitRefresh = false;\n\n if (key === 'isAutoRefreshEnabled') {\n updatedFieldSources.refreshInterval = targetSource;\n updatedFieldSources.refreshOption = targetSource;\n shouldEmitRefresh = !isLinked;\n\n if (isLinked) {\n clearLocalKeys.add('refreshInterval');\n clearLocalKeys.add('refreshOption');\n } else {\n snapshotKeys.add('refreshInterval');\n snapshotKeys.add('refreshOption');\n }\n }\n\n return {\n fieldSources: updatedFieldSources,\n snapshotKeys: Array.from(snapshotKeys),\n shouldEmitRefresh,\n recalcLocalAggregation,\n recalcGlobalAggregation,\n clearLocalKeys: Array.from(clearLocalKeys)\n };\n}\n\nexport function computeToggleAll(args: ToggleAllArgs): LinkToggleOutcome {\n const { keys, isLinked, fieldSources } = args;\n const updatedFieldSources: FieldSourcesMap = { ...fieldSources };\n const snapshotKeys = new Set<keyof GlobalContextState>();\n const clearLocalKeys = new Set<keyof GlobalContextState>();\n\n let shouldEmitRefresh = false;\n let recalcLocalAggregation = false;\n let recalcGlobalAggregation = false;\n\n keys.forEach(key => {\n const targetSource = isLinked ? FIELD_SOURCE_GLOBAL : FIELD_SOURCE_LOCAL;\n updatedFieldSources[key as keyof GlobalContextState] = targetSource;\n\n if (isLinked) {\n clearLocalKeys.add(key as keyof GlobalContextState);\n } else {\n snapshotKeys.add(key as keyof GlobalContextState);\n }\n\n if (key === 'dateTimeContext') {\n updatedFieldSources.refreshOption = targetSource;\n if (isLinked) {\n clearLocalKeys.add('refreshOption');\n } else {\n snapshotKeys.add('refreshOption');\n }\n }\n\n if (!isLinked && key === 'aggregation' && fieldSources.dateTimeContext === FIELD_SOURCE_LOCAL) {\n recalcLocalAggregation = true;\n }\n\n if (isLinked && key === 'dateTimeContext' && fieldSources.aggregation === FIELD_SOURCE_LOCAL) {\n recalcGlobalAggregation = true;\n }\n\n if (key === 'isAutoRefreshEnabled') {\n updatedFieldSources.refreshInterval = targetSource;\n updatedFieldSources.refreshOption = targetSource;\n shouldEmitRefresh = !isLinked;\n\n if (isLinked) {\n clearLocalKeys.add('refreshInterval');\n clearLocalKeys.add('refreshOption');\n } else {\n snapshotKeys.add('refreshInterval');\n snapshotKeys.add('refreshOption');\n }\n }\n });\n\n return {\n fieldSources: updatedFieldSources,\n snapshotKeys: Array.from(snapshotKeys),\n shouldEmitRefresh,\n recalcLocalAggregation,\n recalcGlobalAggregation,\n clearLocalKeys: Array.from(clearLocalKeys)\n };\n}\n","import { aggregationType } from '@c8y/client';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\n\nexport interface AggregationValidationContext {\n globalAggregation: aggregationType | null | undefined;\n localDateTimeContext?: DateTimeContext | null;\n calculateValidAggregation: (\n dateRange: [Date, Date],\n target: aggregationType | null\n ) => {\n selectedAggregation: aggregationType | null;\n };\n}\n\nexport interface AggregationValidationResult {\n canLink: boolean;\n nextAggregation: aggregationType | null;\n message?: string;\n}\n\nexport function validateAggregationLink(\n context: AggregationValidationContext\n): AggregationValidationResult {\n const { globalAggregation, localDateTimeContext } = context;\n\n if (globalAggregation === undefined) {\n return { canLink: true, nextAggregation: null };\n }\n\n if (!localDateTimeContext?.dateFrom || !localDateTimeContext?.dateTo) {\n return { canLink: true, nextAggregation: globalAggregation };\n }\n\n try {\n const dateRange: [Date, Date] = [\n new Date(localDateTimeContext.dateFrom),\n new Date(localDateTimeContext.dateTo)\n ];\n\n const result = context.calculateValidAggregation(dateRange, globalAggregation);\n\n if (result.selectedAggregation !== globalAggregation) {\n return {\n canLink: false,\n nextAggregation: result.selectedAggregation,\n message: 'Cannot sync aggregation with dashboard date range'\n };\n }\n\n return { canLink: true, nextAggregation: globalAggregation };\n } catch (error) {\n return { canLink: false, nextAggregation: null };\n }\n}\n\nexport function deriveAggregationValue(config: GlobalContextState): aggregationType | null {\n return config.dateTimeContext && config.dateTimeContext.interval === 'none'\n ? null\n : (config.aggregation ?? null);\n}\n","import { Injectable, WritableSignal, signal } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { Subject } from 'rxjs';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport type { LinkStatesMap } from '../../../models/control-flow.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type {\n GlobalContextEvent,\n GlobalContextState,\n WidgetControls,\n WidgetDisplayMode\n} from '../../../models/global-context.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n WIDGET_DISPLAY_MODE\n} from '../../../models/global-context.model';\nimport type { TimeInterval } from '../../../models/interval-picker.model';\nimport { AggregationPickerService } from '../../../services/domain/aggregation-picker.service';\nimport { WidgetControlService } from '../../../services/domain/widget-control.service';\nimport { GlobalContextService } from '../../../services/state/global-context.service';\nimport { createDefaultGlobalContextState } from '../../../utils/global-context-defaults.util';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../../models/global-context-defaults';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n composeEffectiveConfig,\n type FieldSourcesMap\n} from './config-composer.util';\nimport {\n AGGREGATION_SYNC_FAILED,\n applyAggregationChangesForGlobalState as applyAggregationChangesForGlobalStateHelper,\n evaluateAggregationValidation,\n resolveAggregationChangeForForm as resolveAggregationChangeForFormHelper,\n resolveAutoUnlinkAggregationChange as resolveAutoUnlinkAggregationChangeHelper\n} from './shared-mode-aggregation.helper';\nimport {\n executeHandler as executeHandlerHelper,\n handleFormChange as handleFormChangeHelper,\n handleGlobalStateChange as handleGlobalStateChangeHelper\n} from './shared-mode-context.helper';\nimport type {\n AggregationChangeInstruction,\n AggregationUnlinkReason,\n ExecuteHandlerContext,\n HandleFormChangeContext,\n HandleGlobalStateChangeContext,\n LinkToggleOutcome,\n ModeServices,\n RefreshResult,\n VisibilityContext\n} from './shared-mode-orchestrator.types';\nimport { calculateRefreshOutcome } from './shared-mode-refresh.helper';\nimport {\n ensureDateTimeContext as ensureDateTimeContextHelper,\n mapToContextDisplayMode as mapToContextDisplayModeHelper,\n resolveVisibilityContextInternal as resolveVisibilityContextInternalHelper,\n resolveWidgetDisplayMode as resolveWidgetDisplayModeHelper,\n sanitizeGlobalState as sanitizeGlobalStateHelper,\n sanitizeLocalState as sanitizeLocalStateHelper,\n syncLocalEntriesWithGlobal as syncLocalEntriesWithGlobalHelper,\n syncSourcesForRefreshOption as syncSourcesForRefreshOptionHelper\n} from './shared-mode-state.helper';\nimport { computeLinkToggle, computeToggleAll } from './shared-mode-toggle.helper';\nimport {\n deriveAggregationValue as deriveAggregationValueUtil,\n validateAggregationLink as validateAggregationLinkUtil,\n type AggregationValidationContext,\n type AggregationValidationResult\n} from './validation.util';\n\n@Injectable()\nexport class SharedModeOrchestrator {\n private readonly widgetControlService: WidgetControlService;\n private readonly aggregationPickerService: AggregationPickerService;\n private readonly globalContextService: GlobalContextService;\n private readonly mode: RefreshOption;\n private configSignal: WritableSignal<GlobalContextState> = signal(\n createDefaultGlobalContextState()\n );\n private widgetControlsSignal: WritableSignal<WidgetControls | null> = signal(null);\n private displayModeSignal: WritableSignal<WidgetDisplayMode> = signal(WIDGET_DISPLAY_MODE.INLINE);\n private loadingSignal: WritableSignal<boolean> = signal(false);\n private fieldSourcesSignal: WritableSignal<FieldSourcesMap> = signal({});\n private localStateSignal: WritableSignal<Partial<GlobalContextState>> = signal({});\n private globalStateSignal: WritableSignal<Partial<GlobalContextState>> = signal({});\n private linkDisableReasonsSignal: WritableSignal<\n Partial<Record<keyof GlobalContextState, string>>\n > = signal({});\n private aggregationUnlinkReason: AggregationUnlinkReason | null = null;\n private latestVisibility: VisibilityContext | null = null;\n readonly globalContextChange$ = new Subject<GlobalContextEvent>();\n readonly refresh$ = new Subject<void>();\n constructor(mode: RefreshOption, services: ModeServices) {\n this.mode = mode;\n this.widgetControlService = services.widgetControlService;\n this.aggregationPickerService = services.aggregationPickerService;\n this.globalContextService = services.globalContextService;\n }\n initConfig(config: GlobalContextState | null | undefined): void {\n const cloned = structuredClone(config ?? createDefaultGlobalContextState());\n // Always enforce the fixed 5s refresh interval\n cloned.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n this.configSignal.set(cloned);\n }\n initWidgetControls(controls: WidgetControls | null | undefined): void {\n this.widgetControlsSignal.set(controls ?? null);\n }\n setDisplayMode(mode: WidgetDisplayMode | null | undefined): void {\n this.displayModeSignal.set(mode ?? WIDGET_DISPLAY_MODE.INLINE);\n }\n getDisplayMode(): WidgetDisplayMode {\n return this.displayModeSignal();\n }\n setLoading(isLoading: boolean): void {\n this.loadingSignal.set(!!isLoading);\n }\n getFieldSources(): FieldSourcesMap {\n return this.fieldSourcesSignal();\n }\n setFieldSources(value: FieldSourcesMap): void {\n this.fieldSourcesSignal.set(value ?? {});\n this.syncLocalEntriesWithGlobal();\n }\n updateFieldSources(updater: (sources: FieldSourcesMap) => FieldSourcesMap): void {\n this.fieldSourcesSignal.update(current => updater({ ...current }) ?? {});\n this.syncLocalEntriesWithGlobal();\n }\n getLocalState(): Partial<GlobalContextState> {\n return this.localStateSignal();\n }\n setLocalState(state: Partial<GlobalContextState>): void {\n const sanitized = sanitizeLocalStateHelper(state, this.configSignal, ctx =>\n this.ensureDateTimeContext(ctx)\n );\n this.localStateSignal.set(sanitized);\n }\n updateLocalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n this.localStateSignal.update(current =>\n sanitizeLocalStateHelper(updater({ ...current }) ?? {}, this.configSignal, ctx =>\n this.ensureDateTimeContext(ctx)\n )\n );\n }\n getGlobalState(): Partial<GlobalContextState> {\n return this.globalStateSignal();\n }\n setGlobalState(state: Partial<GlobalContextState>): void {\n this.globalStateSignal.set(\n sanitizeGlobalStateHelper(\n state,\n this.configSignal,\n opt => this.normalizeRefreshOption(opt),\n () => this.getDefaultRefreshOption(),\n ctx => this.ensureDateTimeContext(ctx)\n )\n );\n this.syncLocalEntriesWithGlobal();\n }\n updateGlobalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n this.globalStateSignal.update(current =>\n sanitizeGlobalStateHelper(\n updater({ ...current }) ?? {},\n this.configSignal,\n opt => this.normalizeRefreshOption(opt),\n () => this.getDefaultRefreshOption(),\n ctx => this.ensureDateTimeContext(ctx)\n )\n );\n this.syncLocalEntriesWithGlobal();\n }\n initializeStateAndSources(params: {\n initialConfig: GlobalContextState | null;\n globalState: Partial<GlobalContextState>;\n isDashboard: boolean;\n widgetControls?: WidgetControls | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n forcedRefreshOption?: RefreshOption;\n }): void {\n const {\n initialConfig,\n globalState,\n isDashboard,\n widgetControls,\n generateFreshDateTime,\n forcedRefreshOption\n } = params;\n const normalizedGlobalState = structuredClone(globalState ?? {});\n if (forcedRefreshOption) normalizedGlobalState.refreshOption = forcedRefreshOption;\n this.initConfig(initialConfig);\n this.setGlobalState(normalizedGlobalState);\n this.initWidgetControls(widgetControls);\n const widgetDisplayMode = resolveWidgetDisplayModeHelper(initialConfig, normalizedGlobalState);\n const controls = widgetControls ?? this.widgetControlsSignal();\n\n const localState: Partial<GlobalContextState> = initialConfig ? { ...initialConfig } : {};\n const fieldSources: FieldSourcesMap = {};\n const globalSnapshot: Partial<GlobalContextState> = structuredClone(\n normalizedGlobalState ?? {}\n );\n\n // Simple rule: Dashboard mode → ALL sources global, Non-dashboard → ALL sources local\n const defaultSource = isDashboard ? FIELD_SOURCE_GLOBAL : FIELD_SOURCE_LOCAL;\n\n (Object.keys(localState) as Array<keyof GlobalContextState>).forEach(key => {\n fieldSources[key] = defaultSource;\n });\n\n // Ensure all supported controls have field sources\n if (controls?.supports) {\n controls.supports.forEach(field => {\n if (!fieldSources[field]) {\n fieldSources[field] = defaultSource;\n }\n });\n }\n\n // Source is ALWAYS global (tracks event origin)\n fieldSources.source = FIELD_SOURCE_GLOBAL;\n\n this.applyInitialModeAdjustments({\n isDashboard,\n localState,\n fieldSources,\n generateFreshDateTime\n });\n this.setFieldSources(fieldSources);\n this.setLocalState(localState);\n this.setGlobalState(globalSnapshot);\n this.setDisplayMode(widgetDisplayMode);\n this.linkDisableReasonsSignal.set({});\n this.updateAggregationDisableReason();\n }\n getConfigSnapshot(): GlobalContextState {\n return this.configSignal();\n }\n computeEffectiveConfig(baseConfig: GlobalContextState | null | undefined): GlobalContextState {\n const localState = this.localStateSignal();\n const globalState = this.globalStateSignal();\n const fieldSources = this.fieldSourcesSignal();\n\n // Normalize baseConfig to enforce fixed 5s refresh interval\n const normalizedBaseConfig = baseConfig\n ? {\n ...baseConfig,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL\n }\n : baseConfig;\n\n const composed = composeEffectiveConfig({\n baseConfig: normalizedBaseConfig,\n localState,\n globalState,\n fieldSources\n });\n\n const displayMode =\n baseConfig?.displayMode ??\n this.globalStateSignal().displayMode ??\n mapToContextDisplayModeHelper(this.displayModeSignal());\n const configWithMode = { ...composed, displayMode };\n this.latestVisibility = resolveVisibilityContextInternalHelper(\n configWithMode,\n this.widgetControlsSignal,\n this.fieldSourcesSignal,\n this.globalStateSignal,\n this.widgetControlService,\n () => this.getDefaultRefreshOption()\n );\n return configWithMode;\n }\n getLatestVisibility(): VisibilityContext | null {\n return this.latestVisibility;\n }\n resolveVisibilityContext(\n config: GlobalContextState | null | undefined\n ): VisibilityContext | null {\n return config\n ? resolveVisibilityContextInternalHelper(\n config,\n this.widgetControlsSignal,\n this.fieldSourcesSignal,\n this.globalStateSignal,\n this.widgetControlService,\n () => this.getDefaultRefreshOption()\n )\n : null;\n }\n handleFormChange(context: HandleFormChangeContext): void {\n handleFormChangeHelper(context, {\n resolveAggregationChangeForForm: params => this.resolveAggregationChangeForForm(params),\n setAggregationValidationState: (isValid, message) =>\n this.setAggregationValidationState(isValid, message),\n computeEffectiveConfig: () => this.computeEffectiveConfig(this.configSignal()),\n updateAggregationDisableReason: () => this.updateAggregationDisableReason()\n });\n }\n handleGlobalStateChange(context: HandleGlobalStateChangeContext): void {\n handleGlobalStateChangeHelper(context, {\n resolveAutoUnlinkAggregationChange: aggregation =>\n this.resolveAutoUnlinkAggregationChange(aggregation),\n setAggregationValidationState: (isValid, message) =>\n this.setAggregationValidationState(isValid, message),\n updateFieldSources: updater => this.updateFieldSources(updater),\n applyAggregationChangesForGlobalState: params =>\n this.applyAggregationChangesForGlobalState(params),\n updateLocalState: updater => this.updateLocalState(updater),\n computeEffectiveConfig: () => this.computeEffectiveConfig(this.configSignal()),\n updateAggregationDisableReason: () => this.updateAggregationDisableReason()\n });\n }\n toggleLink(args: {\n key: keyof LinkStatesMap;\n isLinked: boolean;\n fieldSources?: FieldSourcesMap;\n }): LinkToggleOutcome {\n const prevGlobal = this.getGlobalState();\n const prevLocal = this.getLocalState();\n const prevEffective = this.computeEffectiveConfig(this.configSignal());\n if (args.key === 'aggregation') this.handleAggregationManualToggle(args.isLinked);\n const outcome = computeLinkToggle({\n key: args.key,\n isLinked: args.isLinked,\n fieldSources: args.fieldSources ?? this.getFieldSources()\n });\n this.setFieldSources(outcome.fieldSources);\n if (args.key === 'dateTimeContext' && !args.isLinked)\n this.promoteEffectiveDateTimeToLocal(prevEffective);\n this.syncLocalStateForLinkOutcome({\n outcome,\n previousGlobalState: prevGlobal,\n previousLocalState: prevLocal,\n previousEffectiveConfig: prevEffective\n });\n this.updateAggregationDisableReason();\n return outcome;\n }\n toggleAllLinks(args: {\n keys: Array<keyof LinkStatesMap>;\n isLinked: boolean;\n fieldSources?: FieldSourcesMap;\n }): LinkToggleOutcome {\n const prevGlobal = this.getGlobalState();\n const prevLocal = this.getLocalState();\n const prevEffective = this.computeEffectiveConfig(this.configSignal());\n if (args.keys.includes('aggregation')) this.handleAggregationManualToggle(args.isLinked);\n const outcome = computeToggleAll({\n keys: args.keys,\n isLinked: args.isLinked,\n fieldSources: args.fieldSources ?? this.getFieldSources()\n });\n this.setFieldSources(outcome.fieldSources);\n if (!args.isLinked && args.keys.includes('dateTimeContext'))\n this.promoteEffectiveDateTimeToLocal(prevEffective);\n this.syncLocalStateForLinkOutcome({\n outcome,\n previousGlobalState: prevGlobal,\n previousLocalState: prevLocal,\n previousEffectiveConfig: prevEffective\n });\n this.updateAggregationDisableReason();\n return outcome;\n }\n executeHandler(context: ExecuteHandlerContext): void {\n executeHandlerHelper(context, {\n computeEffectiveConfig: () => this.computeEffectiveConfig(this.configSignal())\n });\n }\n processRefresh(params: {\n globalDateTimeContext?: DateTimeContext | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n }): RefreshResult {\n const result = calculateRefreshOutcome(\n {\n effectiveConfig: this.computeEffectiveConfig(this.configSignal()),\n fieldSources: this.fieldSourcesSignal(),\n globalDateTimeContext: params.globalDateTimeContext,\n generateFreshDateTime: params.generateFreshDateTime\n },\n { supportsAutoRefresh: config => this.supportsAutoRefresh(config) }\n );\n if (result.updatedLocalDateTime)\n this.updateLocalState(current => ({\n ...current,\n dateTimeContext: structuredClone(result.updatedLocalDateTime)\n }));\n if (result.refreshPayload) {\n const merged = {\n ...(this.globalStateSignal().dateTimeContext ?? {}),\n ...result.refreshPayload\n } as DateTimeContext;\n this.updateGlobalState(state => ({ ...state, dateTimeContext: structuredClone(merged) }));\n }\n return result;\n }\n applyRefreshOptionChange(params: {\n previousRefresh?: RefreshOption;\n nextRefresh?: RefreshOption;\n }): { refreshOption?: RefreshOption; forceDisableAutoRefresh?: boolean } {\n const { previousRefresh, nextRefresh } = params;\n if (!nextRefresh || nextRefresh === previousRefresh) return {};\n const resolved = this.normalizeRefreshOption(nextRefresh);\n this.syncSourcesForRefreshOption(\n this.displayModeSignal(),\n resolved,\n this.widgetControlsSignal()\n );\n const sources = this.fieldSourcesSignal();\n if (sources.refreshOption === FIELD_SOURCE_LOCAL) {\n this.updateLocalState(current =>\n current.refreshOption === resolved ? current : { ...current, refreshOption: resolved }\n );\n } else {\n this.updateLocalState(current => {\n if (current.refreshOption === undefined) return current;\n const { refreshOption: _drop, ...rest } = current;\n return rest;\n });\n }\n if (sources.isAutoRefreshEnabled === FIELD_SOURCE_GLOBAL) {\n this.updateLocalState(current => {\n if (current.isAutoRefreshEnabled === undefined) return current;\n const { isAutoRefreshEnabled: _drop, ...rest } = current;\n return rest;\n });\n }\n this.applyModeSpecificRefreshOptionChange(resolved, sources);\n this.updateAggregationDisableReason();\n return {\n refreshOption: resolved,\n forceDisableAutoRefresh: this.shouldForceDisableAutoRefresh(resolved)\n };\n }\n updateGlobalStateFromForm(\n formValue: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): void {\n const nextSources = structuredClone(sources ?? {});\n this.setFieldSources(nextSources);\n const next: Partial<GlobalContextState> = structuredClone(this.getGlobalState() ?? {});\n (Object.keys(formValue) as Array<keyof GlobalContextState>).forEach(key => {\n if (nextSources[key] !== FIELD_SOURCE_GLOBAL) return;\n const value = formValue[key];\n if (value !== undefined) {\n (next as any)[key] = structuredClone(value);\n }\n });\n this.setGlobalState(next);\n }\n processGlobalStateChange(\n state: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): Partial<GlobalContextState> {\n const normalizedState = structuredClone(state ?? {});\n const nextGlobalState: Partial<GlobalContextState> = structuredClone(\n this.getGlobalState() ?? {}\n );\n const formUpdates: Partial<GlobalContextState> = {};\n (Object.keys(normalizedState) as Array<keyof GlobalContextState>).forEach(key => {\n const value = normalizedState[key];\n if (value === undefined) return;\n (nextGlobalState as any)[key] = structuredClone(value);\n if (sources[key] === FIELD_SOURCE_GLOBAL) {\n (formUpdates as any)[key] = structuredClone(value);\n }\n });\n this.setGlobalState(nextGlobalState);\n return formUpdates;\n }\n validateAggregationLink(context: AggregationValidationContext): AggregationValidationResult {\n return validateAggregationLinkUtil(context);\n }\n deriveAggregationValue(config: GlobalContextState | null | undefined): aggregationType | null {\n return config ? deriveAggregationValueUtil(config) : null;\n }\n calculateAggregation(\n dateTimeContext: DateTimeContext | null | undefined,\n currentAggregation: aggregationType | null | undefined\n ): aggregationType | null {\n if (!dateTimeContext?.dateFrom || !dateTimeContext?.dateTo) return currentAggregation ?? null;\n try {\n const range: [Date, Date] = [\n new Date(dateTimeContext.dateFrom),\n new Date(dateTimeContext.dateTo)\n ];\n const result = this.aggregationPickerService.calculateAggregation(\n range,\n currentAggregation ?? null\n );\n return result.selectedAggregation ?? null;\n } catch (_error) {\n return currentAggregation ?? null;\n }\n }\n adjustAggregationForDateTime(params: {\n dateTimeContext?: DateTimeContext | null;\n aggregation?: aggregationType | null;\n }): { nextAggregation: aggregationType | null; changed: boolean } {\n const nextAggregation = this.calculateAggregation(\n params.dateTimeContext ?? null,\n params.aggregation ?? null\n );\n return {\n nextAggregation,\n changed: params.aggregation !== undefined && nextAggregation !== params.aggregation\n };\n }\n resolveAggregationChangeForForm(params: {\n formValue: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n }): AggregationChangeInstruction | null {\n const globalAggregation =\n this.globalStateSignal().aggregation ?? this.configSignal().aggregation ?? null;\n const currentAggregation =\n this.localStateSignal().aggregation ??\n params.formValue.aggregation ??\n this.configSignal().aggregation ??\n null;\n return resolveAggregationChangeForFormHelper({\n formValue: params.formValue,\n sources: params.sources,\n globalAggregation,\n currentAggregation,\n adjustAggregationForDateTime: args => this.adjustAggregationForDateTime(args),\n updateFieldSources: updater => this.updateFieldSources(updater)\n });\n }\n shouldValidateAggregationForUnlinkedDateTime(\n state: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): boolean {\n return (\n sources.dateTimeContext === FIELD_SOURCE_LOCAL &&\n sources.aggregation === FIELD_SOURCE_LOCAL &&\n state.dateTimeContext !== undefined\n );\n }\n getLinkDisableReasons(): Partial<Record<keyof GlobalContextState, string>> {\n return this.linkDisableReasonsSignal();\n }\n getAggregationUnlinkReason(): AggregationUnlinkReason | null {\n return this.aggregationUnlinkReason;\n }\n emitConfiguration(\n componentId: string,\n configuration: GlobalContextState | null | undefined\n ): GlobalContextState {\n const resolvedConfig = configuration ?? this.computeEffectiveConfig(this.configSignal());\n\n if (resolvedConfig.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n this.globalContextService.register(\n componentId,\n this.latestVisibility?.dashboardControls ?? {}\n );\n } else {\n this.globalContextService.unregister(componentId);\n }\n return resolvedConfig;\n }\n ngOnDestroy(): void {\n this.globalContextChange$.complete();\n this.refresh$.complete();\n }\n protected applyInitialModeAdjustments(_: {\n isDashboard: boolean;\n localState: Partial<GlobalContextState>;\n fieldSources: FieldSourcesMap;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n }): void {\n // mode-specific overrides handled by subclasses\n }\n protected normalizeRefreshOption(nextRefresh: RefreshOption): RefreshOption {\n return nextRefresh;\n }\n protected applyModeSpecificRefreshOptionChange(\n _refreshOption: RefreshOption,\n _sources: FieldSourcesMap\n ): void {\n // mode-specific overrides handled by subclasses\n }\n protected shouldForceDisableAutoRefresh(_refreshOption: RefreshOption): boolean {\n return false;\n }\n protected getDefaultRefreshOption(): RefreshOption {\n return this.mode;\n }\n protected supportsAutoRefresh(config: GlobalContextState): boolean {\n return config.refreshOption === this.getDefaultRefreshOption();\n }\n private syncSourcesForRefreshOption(\n displayMode: WidgetDisplayMode,\n refreshOption: RefreshOption,\n controls: WidgetControls | null\n ): void {\n syncSourcesForRefreshOptionHelper(\n displayMode,\n refreshOption,\n controls,\n this.fieldSourcesSignal,\n () => this.getDefaultRefreshOption(),\n sources => this.setFieldSources(sources)\n );\n }\n private setLinkDisableReason(key: keyof GlobalContextState, reason: string | undefined): void {\n this.linkDisableReasonsSignal.update(current => ({ ...current, [key]: reason }));\n }\n private handleAggregationManualToggle(isLinked: boolean): void {\n if (isLinked) {\n this.setAggregationValidationState(true);\n } else {\n this.setLinkDisableReason('aggregation', undefined);\n this.setAggregationUnlinkReason({ source: 'user', canAutoRecover: false });\n }\n }\n private setAggregationUnlinkReason(reason: AggregationUnlinkReason | null): void {\n this.aggregationUnlinkReason = reason;\n }\n private updateAggregationDisableReason(): void {\n const outcome = evaluateAggregationValidation({\n sources: this.fieldSourcesSignal(),\n localDateTimeContext:\n this.localStateSignal().dateTimeContext ?? this.configSignal().dateTimeContext ?? null,\n globalAggregation:\n this.globalStateSignal().aggregation ?? this.configSignal().aggregation ?? null,\n validateAggregationLink: context => this.validateAggregationLink(context),\n calculateAggregation: (context, target) => this.calculateAggregation(context, target)\n });\n if (!outcome) {\n this.setAggregationValidationState(true);\n return;\n }\n if (!outcome.isValid) {\n this.setAggregationValidationState(false, outcome.message ?? AGGREGATION_SYNC_FAILED);\n return;\n }\n this.setAggregationValidationState(true);\n if (this.attemptAggregationAutoRecover()) return;\n }\n private setAggregationValidationState(isValid: boolean, message?: string | null): void {\n if (isValid) {\n this.setLinkDisableReason('aggregation', undefined);\n this.setAggregationUnlinkReason(null);\n return;\n }\n const resolved = message ?? AGGREGATION_SYNC_FAILED;\n this.setLinkDisableReason('aggregation', resolved);\n this.setAggregationUnlinkReason({\n source: 'validation',\n canAutoRecover: true,\n message: resolved\n });\n }\n private resolveAutoUnlinkAggregationChange(\n globalAggregation: aggregationType | null | undefined\n ): AggregationChangeInstruction | null {\n return resolveAutoUnlinkAggregationChangeHelper({\n globalAggregation,\n localDateTimeContext: this.localStateSignal().dateTimeContext,\n adjustAggregationForDateTime: args => this.adjustAggregationForDateTime(args),\n updateFieldSources: updater => this.updateFieldSources(updater)\n });\n }\n private applyAggregationChangesForGlobalState(params: {\n incomingState: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n formUpdates: Partial<GlobalContextState>;\n applyLocalAggregationChange: (change: AggregationChangeInstruction) => void;\n }): boolean {\n return applyAggregationChangesForGlobalStateHelper({\n incomingState: params.incomingState,\n sources: params.sources,\n formUpdates: params.formUpdates,\n adjustAggregationForDateTime: args => this.adjustAggregationForDateTime(args),\n localAggregationSnapshot:\n this.localStateSignal().aggregation ?? this.configSignal().aggregation ?? null,\n globalAggregationSnapshot:\n this.globalStateSignal().aggregation ?? this.configSignal().aggregation ?? null,\n applyLocalAggregationChange: params.applyLocalAggregationChange\n });\n }\n private canAutoRecoverAggregation(): boolean {\n return (\n this.aggregationUnlinkReason?.source === 'validation' &&\n this.aggregationUnlinkReason.canAutoRecover === true\n );\n }\n private attemptAggregationAutoRecover(): boolean {\n if (!this.canAutoRecoverAggregation()) return false;\n this.setAggregationUnlinkReason(null);\n this.updateFieldSources(current => ({ ...current, aggregation: FIELD_SOURCE_GLOBAL }));\n this.updateLocalState(current => {\n if (current.aggregation === undefined) return current;\n const { aggregation: _drop, ...rest } = current;\n return rest;\n });\n return true;\n }\n private syncLocalStateForLinkOutcome(params: {\n outcome: LinkToggleOutcome;\n previousGlobalState: Partial<GlobalContextState>;\n previousLocalState: Partial<GlobalContextState>;\n previousEffectiveConfig: GlobalContextState;\n }): void {\n const { outcome, previousGlobalState, previousLocalState, previousEffectiveConfig } = params;\n if (!outcome.clearLocalKeys.length && !outcome.snapshotKeys.length) return;\n const configSnapshot = structuredClone(this.configSignal());\n this.updateLocalState(current => {\n const updated = { ...current };\n outcome.clearLocalKeys.forEach(key => delete updated[key]);\n outcome.snapshotKeys.forEach(key => {\n const typedKey = key as keyof GlobalContextState;\n let candidate = previousLocalState[typedKey] as\n | GlobalContextState[typeof typedKey]\n | null\n | undefined;\n if (candidate === undefined)\n candidate =\n previousEffectiveConfig[typedKey] ??\n previousGlobalState[typedKey] ??\n configSnapshot[typedKey];\n const resolved = this.resolveSnapshotValue(typedKey, candidate);\n if (resolved === undefined) delete updated[typedKey];\n else (updated as Record<string, unknown>)[typedKey as string] = resolved as unknown;\n });\n return updated;\n });\n }\n private resolveSnapshotValue(\n key: keyof GlobalContextState,\n candidate: GlobalContextState[keyof GlobalContextState] | null | undefined\n ): GlobalContextState[keyof GlobalContextState] | undefined {\n if (candidate !== undefined && candidate !== null) {\n if (key === 'dateTimeContext')\n return this.ensureDateTimeContext(candidate as DateTimeContext);\n if (key === 'refreshOption') return this.normalizeRefreshOption(candidate as RefreshOption);\n return structuredClone(candidate as GlobalContextState[keyof GlobalContextState]);\n }\n if (key === 'dateTimeContext') return this.ensureDateTimeContext(null);\n if (key === 'refreshOption') return this.normalizeRefreshOption(this.getDefaultRefreshOption());\n return undefined;\n }\n private promoteEffectiveDateTimeToLocal(previousEffectiveConfig: GlobalContextState): void {\n const snapshot = previousEffectiveConfig?.dateTimeContext;\n if (!snapshot) return;\n this.updateLocalState(current => ({ ...current, dateTimeContext: structuredClone(snapshot) }));\n }\n private ensureDateTimeContext(\n context: GlobalContextState['dateTimeContext'] | null | undefined\n ): DateTimeContext {\n return ensureDateTimeContextHelper(context, this.configSignal);\n }\n private syncLocalEntriesWithGlobal(): void {\n syncLocalEntriesWithGlobalHelper(\n this.fieldSourcesSignal,\n this.globalStateSignal,\n this.localStateSignal\n );\n }\n}\nexport type {\n AggregationUnlinkReason,\n LinkToggleOutcome,\n ModeServices,\n RefreshResult,\n VisibilityContext\n} from './shared-mode-orchestrator.types';\n","import { Injectable } from '@angular/core';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport { FieldSourcesMap } from './config-composer.util';\nimport { SharedModeOrchestrator, type ModeServices } from './shared-mode-orchestrator';\n\n@Injectable()\nexport class HistoryModeOrchestrator extends SharedModeOrchestrator {\n constructor(services: ModeServices) {\n super(REFRESH_OPTION.HISTORY, services);\n }\n\n protected override normalizeRefreshOption(_nextRefresh: RefreshOption): RefreshOption {\n return REFRESH_OPTION.HISTORY;\n }\n\n protected override applyModeSpecificRefreshOptionChange(\n refreshOption: RefreshOption,\n _sources: FieldSourcesMap\n ): void {\n if (refreshOption !== REFRESH_OPTION.HISTORY) {\n return;\n }\n\n this.updateLocalState(current => {\n if (current.isAutoRefreshEnabled === false) {\n return current;\n }\n return { ...current, isAutoRefreshEnabled: false };\n });\n }\n\n protected override shouldForceDisableAutoRefresh(refreshOption: RefreshOption): boolean {\n return refreshOption === REFRESH_OPTION.HISTORY;\n }\n\n protected override supportsAutoRefresh(_config: GlobalContextState): boolean {\n return false;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport type { TimeInterval } from '../../../models/interval-picker.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport { FieldSourcesMap } from './config-composer.util';\nimport { SharedModeOrchestrator, type ModeServices } from './shared-mode-orchestrator';\n\n@Injectable()\nexport class LiveModeOrchestrator extends SharedModeOrchestrator {\n constructor(services: ModeServices) {\n super(REFRESH_OPTION.LIVE, services);\n }\n\n protected override applyInitialModeAdjustments(params: {\n isDashboard: boolean;\n localState: Partial<GlobalContextState>;\n fieldSources: FieldSourcesMap;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n }): void {\n const { isDashboard, localState, generateFreshDateTime } = params;\n\n // Live mode never has aggregation (business rule)\n delete localState.aggregation;\n\n const interval = localState?.dateTimeContext?.interval;\n\n if (isDashboard || localState?.refreshOption !== REFRESH_OPTION.LIVE || !interval) {\n return;\n }\n\n // For CUSTOM interval: keep dateFrom, update dateTo to now\n // For other intervals: generate fresh dateTimeContext\n if (interval === TIME_INTERVAL.CUSTOM) {\n if (localState.dateTimeContext) {\n localState.dateTimeContext = DateTimeContextUtil.normalizeForLive(\n localState.dateTimeContext\n );\n }\n } else {\n const fresh = generateFreshDateTime(interval as TimeInterval);\n localState.dateTimeContext = fresh;\n }\n }\n}\n","import { Injectable, OnDestroy, inject } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { Subject, Subscription } from 'rxjs';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { LinkStatesMap } from '../../../models/control-flow.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type {\n GlobalContextEvent,\n GlobalContextState,\n WidgetControls,\n WidgetDisplayMode\n} from '../../../models/global-context.model';\nimport type { TimeInterval } from '../../../models/interval-picker.model';\nimport { AggregationPickerService } from '../../../services/domain/aggregation-picker.service';\nimport { WidgetControlService } from '../../../services/domain/widget-control.service';\nimport { GlobalContextService } from '../../../services/state/global-context.service';\nimport { type FieldSourcesMap } from './config-composer.util';\nimport { HistoryModeOrchestrator } from './history-mode-orchestrator';\nimport { LiveModeOrchestrator } from './live-mode-orchestrator';\nimport { SharedModeOrchestrator } from './shared-mode-orchestrator';\nimport type {\n AggregationChangeInstruction,\n AggregationUnlinkReason,\n ExecuteHandlerContext,\n HandleFormChangeContext,\n HandleGlobalStateChangeContext,\n LinkToggleOutcome,\n ModeServices,\n RefreshResult,\n VisibilityContext\n} from './shared-mode-orchestrator.types';\nimport type { AggregationValidationContext, AggregationValidationResult } from './validation.util';\n\n@Injectable()\nexport class GlobalContextInlineOrchestratorService implements OnDestroy {\n private readonly widgetControlService = inject(WidgetControlService);\n private readonly aggregationPickerService = inject(AggregationPickerService);\n private readonly globalContextService = inject(GlobalContextService);\n\n private readonly live: LiveModeOrchestrator;\n private readonly history: HistoryModeOrchestrator;\n private active: SharedModeOrchestrator;\n private activeMode: RefreshOption = REFRESH_OPTION.LIVE;\n private lastLiveAutoRefresh: boolean | undefined;\n private readonly subscriptions: Subscription[] = [];\n private initSnapshot: {\n initialConfig: GlobalContextState | null;\n widgetControls?: WidgetControls | null;\n isDashboard: boolean;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n } | null = null;\n private modeSnapshots: Record<RefreshOption, Partial<GlobalContextState>> = {\n [REFRESH_OPTION.LIVE]: {},\n [REFRESH_OPTION.HISTORY]: {}\n };\n readonly globalContextChange$ = new Subject<GlobalContextEvent>();\n readonly refresh$ = new Subject<void>();\n\n constructor() {\n const services: ModeServices = {\n widgetControlService: this.widgetControlService,\n aggregationPickerService: this.aggregationPickerService,\n globalContextService: this.globalContextService\n };\n this.live = new LiveModeOrchestrator(services);\n this.history = new HistoryModeOrchestrator(services);\n this.active = this.live;\n\n this.subscriptions.push(\n this.live.globalContextChange$.subscribe(event => this.globalContextChange$.next(event)),\n this.history.globalContextChange$.subscribe(event => this.globalContextChange$.next(event)),\n this.live.refresh$.subscribe(() => this.refresh$.next()),\n this.history.refresh$.subscribe(() => this.refresh$.next())\n );\n }\n\n initConfig(config: GlobalContextState | null | undefined): void {\n this.live.initConfig(config);\n this.history.initConfig(config);\n }\n\n initWidgetControls(controls: WidgetControls | null | undefined): void {\n this.live.initWidgetControls(controls);\n this.history.initWidgetControls(controls);\n }\n\n setDisplayMode(mode: WidgetDisplayMode | null | undefined): void {\n this.live.setDisplayMode(mode);\n this.history.setDisplayMode(mode);\n }\n\n getDisplayMode(): WidgetDisplayMode {\n return this.getActive().getDisplayMode();\n }\n\n setLoading(isLoading: boolean): void {\n this.getActive().setLoading(isLoading);\n }\n\n getFieldSources(): FieldSourcesMap {\n return this.getActive().getFieldSources();\n }\n\n setFieldSources(value: FieldSourcesMap): void {\n this.getActive().setFieldSources(value);\n }\n\n updateFieldSources(updater: (sources: FieldSourcesMap) => FieldSourcesMap): void {\n this.getActive().updateFieldSources(updater);\n }\n\n getLocalState(): Partial<GlobalContextState> {\n return this.getActive().getLocalState();\n }\n\n setLocalState(state: Partial<GlobalContextState>): void {\n this.getActive().setLocalState(state);\n }\n\n updateLocalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n this.getActive().updateLocalState(updater);\n }\n\n getGlobalState(): Partial<GlobalContextState> {\n return this.getActive().getGlobalState();\n }\n\n setGlobalState(state: Partial<GlobalContextState>): void {\n const targetMode = (state?.refreshOption as RefreshOption) ?? this.activeMode;\n const normalized = this.normalizeGlobalStateForMode(\n targetMode,\n state,\n this.initSnapshot?.initialConfig ?? null\n );\n\n this.updateModeSnapshot(targetMode, normalized);\n this.propagateSnapshots();\n }\n\n updateGlobalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n const targetMode = this.activeMode;\n const current = this.modeSnapshots[targetMode] ?? {};\n const updated = updater(structuredClone(current)) ?? {};\n const normalized = this.normalizeGlobalStateForMode(\n targetMode,\n updated,\n this.initSnapshot?.initialConfig ?? null\n );\n\n this.updateModeSnapshot(targetMode, normalized);\n this.propagateSnapshots();\n }\n\n initializeStateAndSources(params: {\n initialConfig: GlobalContextState | null;\n globalState: Partial<GlobalContextState>;\n isDashboard: boolean;\n widgetControls?: WidgetControls | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n forcedRefreshOption?: RefreshOption;\n }): void {\n const baseGlobalState = structuredClone(params.globalState ?? {});\n const liveState = this.normalizeGlobalStateForMode(\n REFRESH_OPTION.LIVE,\n baseGlobalState,\n params.initialConfig\n );\n const historyState = this.normalizeGlobalStateForMode(\n REFRESH_OPTION.HISTORY,\n baseGlobalState,\n params.initialConfig\n );\n\n this.updateModeSnapshot(REFRESH_OPTION.LIVE, liveState);\n this.updateModeSnapshot(REFRESH_OPTION.HISTORY, historyState);\n\n this.initSnapshot = {\n initialConfig: params.initialConfig,\n widgetControls: params.widgetControls ?? null,\n isDashboard: params.isDashboard,\n generateFreshDateTime: params.generateFreshDateTime\n };\n\n const liveParams = {\n ...params,\n globalState: structuredClone(this.modeSnapshots[REFRESH_OPTION.LIVE]),\n forcedRefreshOption: REFRESH_OPTION.LIVE\n };\n const historyParams = {\n ...params,\n globalState: structuredClone(this.modeSnapshots[REFRESH_OPTION.HISTORY]),\n forcedRefreshOption: REFRESH_OPTION.HISTORY\n };\n\n this.live.initializeStateAndSources(liveParams);\n this.history.initializeStateAndSources(historyParams);\n\n // After initialization, sync the fresh states back to snapshots\n // (applyInitialModeAdjustments may have generated fresh dates in local state)\n // Use computeEffectiveConfig to merge local+global states\n const liveEffective = this.live.computeEffectiveConfig(params.initialConfig);\n const historyEffective = this.history.computeEffectiveConfig(params.initialConfig);\n\n this.updateModeSnapshot(REFRESH_OPTION.LIVE, liveEffective);\n this.updateModeSnapshot(REFRESH_OPTION.HISTORY, historyEffective);\n\n // For standalone mode, use widget's refreshOption, not global state\n // For dashboard mode, use global state's refreshOption\n const desiredMode = params.isDashboard\n ? (params.forcedRefreshOption ??\n baseGlobalState.refreshOption ??\n params.initialConfig?.refreshOption ??\n this.activeMode)\n : (params.forcedRefreshOption ?? params.initialConfig?.refreshOption ?? this.activeMode);\n\n this.ensureMode(desiredMode);\n }\n\n handleFormChange(context: HandleFormChangeContext): void {\n const nextRefresh = context.formValue.refreshOption ?? context.previousRefresh;\n this.ensureMode(nextRefresh ?? this.activeMode);\n this.getActive().handleFormChange(context);\n }\n\n handleGlobalStateChange(context: HandleGlobalStateChangeContext): void {\n const nextRefresh = context.state.refreshOption ?? context.previousRefresh;\n this.ensureMode(nextRefresh ?? this.activeMode);\n this.getActive().handleGlobalStateChange(context);\n this.syncActiveSnapshot();\n }\n\n toggleLink(args: {\n key: keyof LinkStatesMap;\n isLinked: boolean;\n fieldSources?: FieldSourcesMap;\n }): LinkToggleOutcome {\n return this.getActive().toggleLink(args);\n }\n\n toggleAllLinks(args: {\n keys: Array<keyof LinkStatesMap>;\n isLinked: boolean;\n fieldSources?: FieldSourcesMap;\n }): LinkToggleOutcome {\n return this.getActive().toggleAllLinks(args);\n }\n\n executeHandler(context: ExecuteHandlerContext): void {\n const nextRefresh = context.configOverride?.refreshOption ?? context.previousRefresh;\n this.ensureMode(nextRefresh ?? this.activeMode);\n this.getActive().executeHandler(context);\n }\n\n processRefresh(params: {\n globalDateTimeContext?: DateTimeContext | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n }): RefreshResult {\n // Choose orchestrator based on mode:\n // - Dashboard mode: use global state's refreshOption\n // - Standalone mode: use effective config's refreshOption (local state)\n const isDashboard = this.initSnapshot?.isDashboard ?? false;\n const effectiveRefreshOption = isDashboard\n ? (this.getGlobalState().refreshOption ?? this.activeMode)\n : (this.getActive().computeEffectiveConfig(this.initSnapshot?.initialConfig ?? null)\n .refreshOption ?? this.activeMode);\n\n this.ensureMode(effectiveRefreshOption);\n return this.getActive().processRefresh(params);\n }\n\n applyRefreshOptionChange(params: {\n previousRefresh?: RefreshOption;\n nextRefresh?: RefreshOption;\n }): { refreshOption?: RefreshOption; forceDisableAutoRefresh?: boolean } {\n const desiredMode = params.nextRefresh ?? this.activeMode;\n this.ensureMode(desiredMode);\n\n const outcome = this.getActive().applyRefreshOptionChange(params);\n\n if (outcome.refreshOption) {\n this.ensureMode(outcome.refreshOption);\n }\n\n return outcome;\n }\n\n updateGlobalStateFromForm(\n formValue: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): void {\n this.getActive().updateGlobalStateFromForm(formValue, sources);\n this.syncActiveSnapshot();\n }\n\n processGlobalStateChange(\n state: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): Partial<GlobalContextState> {\n const result = this.getActive().processGlobalStateChange(state, sources);\n this.syncActiveSnapshot();\n return result;\n }\n\n validateAggregationLink(context: AggregationValidationContext): AggregationValidationResult {\n return this.getActive().validateAggregationLink(context);\n }\n\n deriveAggregationValue(config: GlobalContextState | null | undefined): aggregationType | null {\n return this.getActive().deriveAggregationValue(config);\n }\n\n calculateAggregation(\n dateTimeContext: DateTimeContext | null | undefined,\n currentAggregation: aggregationType | null | undefined\n ): aggregationType | null {\n return this.getActive().calculateAggregation(dateTimeContext, currentAggregation);\n }\n\n adjustAggregationForDateTime(params: {\n dateTimeContext: DateTimeContext;\n aggregation: aggregationType | null;\n }): { nextAggregation: aggregationType | null; changed: boolean } {\n return this.getActive().adjustAggregationForDateTime(params);\n }\n\n resolveAggregationChangeForForm(params: {\n formValue: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n }): AggregationChangeInstruction | null {\n return this.getActive().resolveAggregationChangeForForm(params);\n }\n\n shouldValidateAggregationForUnlinkedDateTime(\n state: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): boolean {\n return this.getActive().shouldValidateAggregationForUnlinkedDateTime(state, sources);\n }\n\n getLinkDisableReasons(): Partial<Record<keyof GlobalContextState, string>> {\n return this.getActive().getLinkDisableReasons();\n }\n\n getAggregationUnlinkReason(): AggregationUnlinkReason | null {\n return this.getActive().getAggregationUnlinkReason();\n }\n\n computeEffectiveConfig(baseConfig: GlobalContextState | null | undefined): GlobalContextState {\n return this.getActive().computeEffectiveConfig(baseConfig);\n }\n\n resolveVisibilityContext(\n config: GlobalContextState | null | undefined\n ): VisibilityContext | null {\n return this.getActive().resolveVisibilityContext(config);\n }\n\n emitConfiguration(\n componentId: string,\n configuration: GlobalContextState | null | undefined\n ): GlobalContextState {\n return this.getActive().emitConfiguration(componentId, configuration);\n }\n\n getLatestVisibility(): VisibilityContext | null {\n return this.getActive().getLatestVisibility();\n }\n\n getConfigSnapshot(): GlobalContextState {\n return this.getActive().getConfigSnapshot();\n }\n\n ngOnDestroy(): void {\n this.subscriptions.forEach(subscription => subscription.unsubscribe());\n this.live.ngOnDestroy();\n this.history.ngOnDestroy();\n }\n\n private ensureMode(refreshOption?: RefreshOption | null): void {\n const desired =\n refreshOption === REFRESH_OPTION.HISTORY ? REFRESH_OPTION.HISTORY : REFRESH_OPTION.LIVE;\n const previous = this.activeMode;\n\n if (desired === previous) {\n return;\n }\n\n this.activeMode = desired;\n this.active = desired === REFRESH_OPTION.HISTORY ? this.history : this.live;\n this.resetActiveMode();\n }\n\n private getActive(): SharedModeOrchestrator {\n return this.active;\n }\n\n private resetActiveMode(): void {\n if (!this.initSnapshot) {\n return;\n }\n\n const isDashboard = this.initSnapshot.isDashboard;\n const snapshot = this.modeSnapshots[this.activeMode] ?? {};\n\n // For standalone mode, use the snapshot as initialConfig so fresh dates are preserved\n // For dashboard mode, use original initialConfig and snapshot goes to globalState\n const effectiveInitialConfig = isDashboard\n ? this.initSnapshot.initialConfig\n : (snapshot as GlobalContextState);\n\n const params = {\n initialConfig: effectiveInitialConfig,\n globalState: structuredClone(snapshot),\n isDashboard,\n widgetControls: this.initSnapshot.widgetControls,\n generateFreshDateTime: this.initSnapshot.generateFreshDateTime,\n forcedRefreshOption: this.activeMode\n };\n\n this.getActive().initializeStateAndSources(params);\n }\n\n private normalizeGlobalStateForMode(\n mode: RefreshOption,\n state: Partial<GlobalContextState> | null | undefined,\n initialConfig: GlobalContextState | null\n ): Partial<GlobalContextState> {\n const seed: Partial<GlobalContextState> = {\n ...(this.modeSnapshots?.[mode] ?? {}),\n ...(state ?? {})\n };\n const normalized = structuredClone(seed);\n\n normalized.refreshOption = mode;\n\n if (mode === REFRESH_OPTION.LIVE) {\n const restored =\n this.lastLiveAutoRefresh ??\n state?.isAutoRefreshEnabled ??\n initialConfig?.isAutoRefreshEnabled;\n\n if (restored !== undefined) {\n normalized.isAutoRefreshEnabled = restored;\n } else {\n delete normalized.isAutoRefreshEnabled;\n }\n\n // Live mode always has aggregation=null (business rule)\n delete normalized.aggregation;\n } else {\n if (state?.isAutoRefreshEnabled !== undefined) {\n this.lastLiveAutoRefresh = state.isAutoRefreshEnabled;\n }\n normalized.isAutoRefreshEnabled = false;\n }\n\n return normalized;\n }\n\n private syncActiveSnapshot(propagate = true): void {\n const current = this.getActive().getGlobalState() ?? {};\n this.updateModeSnapshot(this.activeMode, current);\n if (propagate) {\n this.propagateSnapshots();\n }\n }\n\n private updateModeSnapshot(mode: RefreshOption, snapshot: Partial<GlobalContextState>): void {\n this.modeSnapshots[mode] = structuredClone(snapshot ?? {});\n\n if (mode === REFRESH_OPTION.LIVE) {\n this.captureLiveAutoRefresh(this.modeSnapshots[mode]);\n }\n }\n\n private propagateSnapshots(): void {\n this.live.setGlobalState(structuredClone(this.modeSnapshots[REFRESH_OPTION.LIVE] ?? {}));\n this.history.setGlobalState(structuredClone(this.modeSnapshots[REFRESH_OPTION.HISTORY] ?? {}));\n }\n\n private captureLiveAutoRefresh(state: Partial<GlobalContextState> | null | undefined): void {\n if (!state) {\n return;\n }\n\n const refreshOption = state.refreshOption ?? REFRESH_OPTION.LIVE;\n\n if (refreshOption !== REFRESH_OPTION.LIVE) {\n return;\n }\n\n if (state.isAutoRefreshEnabled !== undefined) {\n this.lastLiveAutoRefresh = state.isAutoRefreshEnabled;\n }\n }\n}\n\nexport type {\n AggregationUnlinkReason,\n RefreshResult,\n VisibilityContext\n} from './shared-mode-orchestrator';\n","import { NgTemplateOutlet, NgClass } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n EffectRef,\n inject,\n input,\n OnDestroy,\n OnInit,\n output,\n signal,\n TemplateRef,\n ViewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { aggregationType } from '@c8y/client';\nimport { C8yTranslatePipe, DashboardChildComponent, IconDirective } from '@c8y/ngx-components';\nimport { isEqual } from 'lodash-es';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { distinctUntilChanged } from 'rxjs/operators';\nimport { AggregationPickerComponent } from '../features/aggregation/aggregation-picker';\nimport { AutoRefreshControlComponent } from '../features/refresh/auto-refresh';\nimport { DateTimeContextPickerComponent } from '../features/time-context/time-range-picker/date-time-context-picker.component';\nimport type { RefreshOption } from '../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../models/auto-refresh.model';\nimport type {\n ControlConfigsMap,\n LinkStatesMap,\n LinkToggleEvent\n} from '../models/control-flow.model';\nimport { LINK_BTNS_CONFIG } from '../models/control-flow.model';\nimport type { DateTimeContext } from '../models/date-time-context-picker.model';\nimport type {\n GlobalContextDisplayMode,\n GlobalContextSettings,\n GlobalContextState,\n WidgetControls,\n WidgetDisplayMode,\n WidgetState,\n WidgetStateHandlerResult\n} from '../models/global-context.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GLOBAL_CONTEXT_EVENTS,\n WIDGET_DISPLAY_MODE\n} from '../models/global-context.model';\nimport { AggregationValidationService } from '../services/domain/aggregation-validation.service';\nimport { GlobalContextEventService } from '../services/state/global-context-event.service';\nimport { GlobalContextFormService } from '../services/state/global-context-form.service';\nimport { GlobalContextService } from '../services/state/global-context.service';\nimport type {\n LinkHelpersContext,\n RefreshHelpersContext\n} from './widget-inline/inline-context.models';\nimport { GlobalContextLinkControlsComponent } from './widget-inline/inline-link-controls.component';\nimport {\n applyConfigOverride as applyConfigOverrideHelper,\n applyHandlerResult as applyHandlerResultHelper,\n buildControlLinkConfig as buildControlLinkConfigHelper,\n buildWidgetState as buildWidgetStateHelper,\n handleLinkToggle as handleLinkToggleHelper,\n toggleAllLinks as toggleAllLinksHelper\n} from './widget-inline/inline-link-helpers';\nimport {\n applyLocalAggregationChange as applyLocalAggregationChangeHelper,\n calculateDisabledAggregationsFromContext as calculateDisabledAggregationsFromContextHelper,\n deriveDisabledAggregations as deriveDisabledAggregationsHelper,\n generateFreshDateTimeContext,\n getShouldDisableIntervalConfig as getShouldDisableIntervalConfigHelper,\n handleGlobalRefresh as handleGlobalRefreshHelper,\n patchFormValues as patchFormValuesHelper,\n processRefreshEvent as processRefreshEventHelper,\n recalculateAggregationForGlobalDateTime,\n recalculateAggregationForLocalDateTime,\n updateAggregationValue as updateAggregationValueHelper\n} from './widget-inline/inline-refresh-helpers';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './widget-inline/orchestrator/config-composer.util';\nimport {\n GlobalContextInlineOrchestratorService,\n type RefreshResult,\n type VisibilityContext\n} from './widget-inline/orchestrator/global-context-inline-orchestrator.service';\nimport type { AggregationChangeInstruction } from './widget-inline/orchestrator/shared-mode-orchestrator.types';\nconst EMIT_EVENT_DISABLED = { emitEvent: false };\n@Component({\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n ReactiveFormsModule,\n GlobalContextLinkControlsComponent,\n AggregationPickerComponent,\n AutoRefreshControlComponent,\n DateTimeContextPickerComponent,\n IconDirective,\n C8yTranslatePipe,\n TooltipModule,\n NgTemplateOutlet,\n NgClass\n ],\n selector: 'c8y-global-context-inline',\n templateUrl: './global-context-inline.component.html',\n exportAs: 'globalContextInline',\n providers: [GlobalContextInlineOrchestratorService]\n})\nexport class GlobalContextInlineComponent implements OnInit, AfterViewInit, OnDestroy {\n private readonly componentId = crypto.randomUUID();\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n readonly REFRESH_OPTION = REFRESH_OPTION;\n // --- Service Injections ---\n private readonly destroyReference = inject(DestroyRef);\n private readonly globalContextService = inject(GlobalContextService);\n private readonly globalContextEventService = inject(GlobalContextEventService);\n private readonly globalContextFormService = inject(GlobalContextFormService);\n private readonly aggregationValidationService = inject(AggregationValidationService);\n private readonly orchestrator = inject(GlobalContextInlineOrchestratorService);\n private readonly injectedDashboardChild = inject(DashboardChildComponent, { optional: true });\n // --- Inputs ---\n widgetControls = input.required<WidgetControls>();\n config = input<GlobalContextState | null>(null);\n isLoading = input(false);\n dashboardChildForLegacy = input<DashboardChildComponent>();\n // --- Outputs ---\n readonly refresh = output<Partial<DateTimeContext> | null>();\n readonly globalContextChange = output<Partial<GlobalContextState>>();\n // --- Signals for State Management ---\n private inlineOverrides = signal<Partial<GlobalContextSettings>>({});\n private dashboardOverrides = signal<Partial<GlobalContextSettings>>({});\n private viewInitCompleted = signal(false);\n // --- Derived State from Signals ---\n readonly effectiveConfig = computed(() =>\n this.orchestrator.computeEffectiveConfig(this.config())\n );\n private readonly visibilityContext = computed<VisibilityContext | null>(() =>\n this.orchestrator.resolveVisibilityContext(this.effectiveConfig())\n );\n readonly inlineSettings = computed(() => {\n const base = this.visibilityContext()?.settings ?? {};\n return { ...base, ...this.inlineOverrides() };\n });\n readonly dashboardControlSettings = computed(() => {\n const base = this.visibilityContext()?.dashboardControls ?? {};\n return { ...base, ...this.dashboardOverrides() };\n });\n readonly controlLinkStatus = computed(() => this.visibilityContext()?.links ?? {});\n readonly disabledAggregations = computed(() =>\n deriveDisabledAggregationsHelper(this.getRefreshContext())\n );\n readonly linkDisplayModel = computed(() => {\n const settings = this.inlineSettings() ?? {};\n const linkStates = this.controlLinkStatus() ?? {};\n const { controlConfig, filteredStates } = buildControlLinkConfigHelper(\n this.getLinkContext(),\n settings,\n Object.keys(linkStates).length ? linkStates : null\n );\n\n return {\n controlConfig,\n linkStates: filteredStates,\n showHeaderLinks: this.effectiveConfig().displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n };\n });\n // --- Other Properties ---\n form!: FormGroup;\n shouldDisableCounter = false;\n readonly controlLinksConfig: ControlConfigsMap = LINK_BTNS_CONFIG;\n @ViewChild('headerContent', { static: true, read: TemplateRef })\n private headerTemplateRef?: TemplateRef<unknown>;\n private registeredHeaderTemplate: TemplateRef<unknown> | null = null;\n private registeredDashboardChild: DashboardChildComponent | null = null;\n private headerEffectRef: EffectRef | null = null;\n private linkContextCache: LinkHelpersContext | null = null;\n constructor() {\n // Effects are set up once, initialization will set form afterwards\n this.setupEffects();\n effect(() => {\n const cfg = this.config();\n this.orchestrator.initConfig(cfg ?? {});\n this.orchestrator.setDisplayMode(this.mapToWidgetDisplayMode(cfg?.displayMode));\n this.orchestrator.initWidgetControls(this.widgetControls());\n });\n this.headerEffectRef = effect(() => {\n if (!this.viewInitCompleted()) {\n return;\n }\n const displayMode = this.effectiveConfig().displayMode;\n const dashboardChild = this.resolveDashboardChild();\n const shouldProject =\n !!dashboardChild && displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n const template = shouldProject ? (this.headerTemplateRef ?? null) : null;\n this.updateDashboardHeaderRegistration(template, dashboardChild);\n });\n }\n getDisabledAggregations(): Partial<Record<aggregationType, boolean>> {\n const dateTimeContext = this.getFormDateTimeContext();\n if (!this.hasValidDateRange(dateTimeContext)) {\n return this.disabledAggregations();\n }\n return calculateDisabledAggregationsFromContextHelper(\n this.getRefreshContext(),\n dateTimeContext as DateTimeContext\n );\n }\n shouldShowHeaderLinks(): boolean {\n return this.linkDisplayModel().showHeaderLinks;\n }\n shouldRenderHeaderInline(): boolean {\n const dashboardChild = this.resolveDashboardChild();\n return (\n !dashboardChild ||\n this.effectiveConfig().displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n );\n }\n getAutoRefreshSeconds(): number | null {\n if (!this.form) return null;\n const value = this.form.get('refreshInterval')?.value;\n return value == null ? null : typeof value === 'string' ? Number(value) : value;\n }\n getIntervalDisableConfig(): Record<string, boolean> {\n return this.getShouldDisableIntervalConfig();\n }\n ngOnInit(): void {\n this.initialize();\n }\n ngAfterViewInit(): void {\n this.viewInitCompleted.set(true);\n const dashboardChild = this.resolveDashboardChild();\n const displayMode = this.effectiveConfig().displayMode;\n const template =\n dashboardChild && displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n ? (this.headerTemplateRef ?? null)\n : null;\n this.updateDashboardHeaderRegistration(template, dashboardChild);\n }\n ngOnDestroy(): void {\n this.headerEffectRef?.destroy();\n this.cleanupRegisteredHeaderTemplate();\n this.globalContextService.unregister(this.componentId);\n this.globalContextService.unregisterLoading(this.componentId);\n }\n // --- Public API methods (ordering: public before private) ---\n handleLinkToggle(\n event: LinkToggleEvent,\n options?: {\n suppressEmit?: boolean;\n fromHandler?: boolean;\n }\n ): boolean {\n return handleLinkToggleHelper(this.getLinkContext(), event, options);\n }\n toggleAllLinks(isLinked: boolean, suppressRefresh?: boolean, suppressEmit?: boolean): void {\n const supportedLinks = Object.keys(this.controlLinkStatus() || {}) as Array<\n keyof LinkStatesMap\n >;\n if (!supportedLinks.length) {\n return;\n }\n\n // When unlinking: suppress both refresh and emit (data is already loaded)\n // When linking: allow both refresh and emit unless explicitly suppressed\n const shouldSuppressRefresh = suppressRefresh ?? !isLinked;\n const shouldSuppressEmit = suppressEmit ?? !isLinked;\n\n toggleAllLinksHelper(this.getLinkContext(), {\n keys: supportedLinks as Array<keyof LinkStatesMap>,\n isLinked,\n suppressRefresh: shouldSuppressRefresh,\n suppressEmit: shouldSuppressEmit\n });\n }\n\n updateDateTimeContext(dateTimeContext: any): void {\n this.orchestrator.updateLocalState(state => ({\n ...state,\n dateTimeContext: structuredClone(dateTimeContext)\n }));\n\n const dateTimeControl = this.form?.get('dateTimeContext');\n if (dateTimeControl) {\n dateTimeControl.setValue(structuredClone(dateTimeContext), { emitEvent: false });\n }\n }\n\n /**\n * Pause auto-refresh: sets isAutoRefreshEnabled to false and unlinks all controls.\n * This stops the auto-refresh timer and prevents the widget from receiving\n * updates from the global context.\n *\n * NOTE: Does NOT trigger any refresh or emit - data is already loaded, no updates needed.\n */\n pauseAutoRefresh(): void {\n // Step 1: Unlink all controls without any emissions (data already loaded)\n this.toggleAllLinks(\n false, // isLinked = false\n true, // suppressRefresh = true\n true // suppressEmit = true\n );\n\n // Step 2: Set isAutoRefreshEnabled to false without emitting events\n this.setAutoRefreshEnabled(false);\n }\n\n /**\n * Resume auto-refresh: sets isAutoRefreshEnabled to true and links all controls.\n * This starts the auto-refresh timer and allows the widget to receive\n * updates from the global context.\n *\n * NOTE: Triggers emissions and refresh to sync with the current global context state.\n */\n resumeAutoRefresh(): void {\n this.toggleAllLinks(true, false, false);\n this.setAutoRefreshEnabled(true);\n }\n\n triggerHandler(handlerName: string, configOverride?: GlobalContextState | null): void {\n const handler = this.widgetControls()?.stateHandlers?.[handlerName];\n const previousRefresh = this.effectiveConfig().refreshOption;\n this.orchestrator.executeHandler({\n handler,\n configOverride,\n previousRefresh,\n applyRefreshOptionChange: (prev, next) => this.applyRefreshOptionChange(prev, next),\n buildWidgetState: override => this.buildWidgetState(override ?? null),\n applyHandlerResult: result => this.applyHandlerResult(result),\n applyConfigOverride: config => {\n if (config) {\n this.applyConfigOverride(config);\n }\n },\n emitBasedOnFieldSources: config => this.emitConfiguration(config),\n requestRefresh: () => this.refresh.emit(null)\n });\n }\n onLocalRefreshTrigger(): void {\n const outcome = this.processRefreshEvent({\n globalDateTimeContext:\n this.getGlobalState().dateTimeContext ?? this.config()?.dateTimeContext ?? null\n });\n if (!outcome.shouldEmitRefresh) {\n this.refresh.emit(null);\n }\n }\n\n private setAutoRefreshEnabled(enabled: boolean): void {\n const autoRefreshControl = this.form?.get('isAutoRefreshEnabled');\n if (autoRefreshControl && autoRefreshControl.value !== enabled) {\n autoRefreshControl.setValue(enabled, { emitEvent: false });\n }\n }\n\n private mapToWidgetDisplayMode(mode?: GlobalContextDisplayMode | null): WidgetDisplayMode {\n switch (mode) {\n case GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG:\n return WIDGET_DISPLAY_MODE.CONFIG;\n case GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG:\n return WIDGET_DISPLAY_MODE.INLINE;\n case GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD:\n return WIDGET_DISPLAY_MODE.INLINE;\n case null:\n case undefined:\n return WIDGET_DISPLAY_MODE.INLINE;\n default: {\n // Exhaustive check: ensures all modes are handled at compile time\n // TypeScript can't verify template literal types match enum members perfectly\n const _exhaustive: never = mode as never;\n return WIDGET_DISPLAY_MODE.INLINE;\n }\n }\n }\n private applyConfigOverride(config: Partial<GlobalContextState>): void {\n applyConfigOverrideHelper(this.getLinkContext(), config);\n }\n private buildWidgetState(configOverride?: GlobalContextState | null): WidgetState {\n return buildWidgetStateHelper(this.getLinkContext(), configOverride);\n }\n private applyHandlerResult(result: WidgetStateHandlerResult): boolean {\n return applyHandlerResultHelper(this.getLinkContext(), result);\n }\n\n private getFormDateTimeContext(): DateTimeContext | null {\n return this.form?.get('dateTimeContext')?.value;\n }\n\n private hasValidDateRange(dateTimeContext: DateTimeContext | null): boolean {\n return !!dateTimeContext?.dateFrom && !!dateTimeContext?.dateTo;\n }\n private applyRefreshOptionChange(\n previousRefresh: RefreshOption | undefined,\n nextRefresh: RefreshOption | undefined\n ): void {\n const outcome = this.orchestrator.applyRefreshOptionChange({\n previousRefresh,\n nextRefresh\n });\n if (!outcome.refreshOption) {\n return;\n }\n this.inlineOverrides.set({});\n this.dashboardOverrides.set({});\n this.form?.patchValue({ refreshOption: outcome.refreshOption }, EMIT_EVENT_DISABLED);\n if (outcome.forceDisableAutoRefresh) {\n this.form?.patchValue({ isAutoRefreshEnabled: false }, EMIT_EVENT_DISABLED);\n }\n }\n private getFieldSources(): FieldSourcesMap {\n return this.orchestrator.getFieldSources() || {};\n }\n private getLocalState(): Partial<GlobalContextState> {\n return this.orchestrator.getLocalState();\n }\n private updateLocalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n this.orchestrator.updateLocalState(updater);\n }\n private getGlobalState(): Partial<GlobalContextState> {\n return this.orchestrator.getGlobalState();\n }\n private initialize(): void {\n const initialConfig = this.config() || {};\n this.inlineOverrides.set({});\n this.dashboardOverrides.set({});\n this.orchestrator.initConfig(initialConfig);\n this.orchestrator.initWidgetControls(this.widgetControls());\n this.orchestrator.setDisplayMode(this.getInitialDisplayMode(initialConfig));\n this.initializeForm(initialConfig);\n this.initializeStateAndSources(initialConfig);\n this.syncFormWithEffectiveConfig();\n this.setupSubscriptions();\n this.emitBasedOnFieldSources();\n this.setupWidgetOptions();\n }\n private getInitialDisplayMode(initialConfig: GlobalContextState | null): WidgetDisplayMode {\n const mode = initialConfig?.displayMode ?? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n switch (mode) {\n case GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG:\n return WIDGET_DISPLAY_MODE.CONFIG;\n case GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG:\n return WIDGET_DISPLAY_MODE.INLINE;\n case GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD:\n return WIDGET_DISPLAY_MODE.INLINE;\n default: {\n // Exhaustive check: ensures all modes are handled at compile time\n // TypeScript can't verify template literal types match enum members perfectly\n const _exhaustive: never = mode as never;\n return WIDGET_DISPLAY_MODE.INLINE;\n }\n }\n }\n private initializeForm(initialConfig: GlobalContextState | null): void {\n this.form = this.globalContextFormService.buildForm(initialConfig);\n }\n private syncFormWithEffectiveConfig(): void {\n const effectiveValues = this.effectiveConfig();\n if (effectiveValues && this.form) {\n this.form.patchValue(effectiveValues, EMIT_EVENT_DISABLED);\n }\n }\n private setupWidgetOptions(): void {\n const template = this.widgetControls();\n this.shouldDisableCounter = !!template?.options?.noAutoRefreshCounter;\n }\n private setupEffects(): void {\n // Remove automatic form syncing - form should be controlled by local state changes\n // and user interactions only, not by derived effective config\n // Register loading state reactively\n effect(() => {\n const loading = this.isLoading();\n const inDashboard =\n this.effectiveConfig().displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n const autoLinked = this.getFieldSources()?.isAutoRefreshEnabled === FIELD_SOURCE_GLOBAL;\n if (inDashboard && autoLinked && loading) {\n this.globalContextService.registerLoading(this.componentId);\n } else {\n this.globalContextService.unregisterLoading(this.componentId);\n }\n });\n }\n private setupSubscriptions(): void {\n this.subscribeToFormChanges();\n if (this.isDashboardMode()) {\n this.subscribeToGlobalStateChanges();\n this.subscribeToGlobalRefreshEvents();\n }\n }\n private subscribeToFormChanges(): void {\n this.form.valueChanges\n .pipe(\n distinctUntilChanged((previous, current) => isEqual(previous, current)),\n takeUntilDestroyed(this.destroyReference)\n )\n .subscribe(formValue => {\n this.handleFormChange(formValue);\n });\n }\n private handleFormChange(formValue: Partial<GlobalContextState>): void {\n const sources = this.getFieldSources();\n const normalizedFormValue = { ...formValue };\n\n if (\n this.effectiveConfig().refreshOption === REFRESH_OPTION.HISTORY &&\n sources.refreshOption === FIELD_SOURCE_LOCAL &&\n formValue.refreshOption === REFRESH_OPTION.LIVE\n ) {\n normalizedFormValue.refreshOption = REFRESH_OPTION.HISTORY;\n this.form.patchValue({ refreshOption: REFRESH_OPTION.HISTORY }, EMIT_EVENT_DISABLED);\n }\n\n this.orchestrator.handleFormChange({\n formValue: normalizedFormValue,\n getFieldSources: () => this.getFieldSources(),\n applyFormChangesToLocalState: value => this.applyFormChangesToLocalState(value),\n shouldValidateAggregation: value => this.shouldValidateAggregation(value),\n applyLocalAggregationChange: change => this.applyLocalAggregationChange(change),\n applyRefreshOptionChange: (prev, next) => this.applyRefreshOptionChange(prev, next),\n previousRefresh: this.effectiveConfig().refreshOption,\n updateGlobalStateFromForm: (value, sources) =>\n this.orchestrator.updateGlobalStateFromForm(value, sources as FieldSourcesMap),\n emitUpdate: config => this.emitConfiguration(config),\n emitRefresh: payload => this.refresh.emit(payload ?? null)\n });\n }\n private shouldValidateAggregation(formValue: Partial<GlobalContextState>): boolean {\n return !!formValue.dateTimeContext && !!this.form.get('aggregation');\n }\n private applyFormChangesToLocalState(formValue: Partial<GlobalContextState>): void {\n this.updateLocalState(current => ({ ...current, ...formValue }));\n }\n private subscribeToGlobalStateChanges(): void {\n this.globalContextEventService\n .on(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE)\n .pipe(takeUntilDestroyed(this.destroyReference))\n .subscribe(state => this.handleGlobalStateChange(state));\n }\n private handleGlobalStateChange(state: Partial<GlobalContextState> | null): void {\n if (!state) {\n return;\n }\n this.orchestrator.handleGlobalStateChange({\n state,\n getFieldSources: () => this.getFieldSources(),\n previousRefresh: this.effectiveConfig().refreshOption,\n processGlobalStateChange: (incoming, sources) =>\n this.orchestrator.processGlobalStateChange(incoming, sources as FieldSourcesMap),\n shouldValidateAggregationForUnlinkedDateTime: (incoming, sources) =>\n this.orchestrator.shouldValidateAggregationForUnlinkedDateTime(\n incoming,\n sources as FieldSourcesMap\n ),\n applyLocalAggregationChange: change => this.applyLocalAggregationChange(change),\n applyRefreshOptionChange: (prev, next) => this.applyRefreshOptionChange(prev, next),\n patchForm: updates => this.patchFormValues(updates),\n emitUpdate: config => this.emitConfiguration(config),\n emitRefresh: payload => this.refresh.emit(payload ?? null)\n });\n }\n private subscribeToGlobalRefreshEvents(): void {\n this.globalContextEventService\n .on(GLOBAL_CONTEXT_EVENTS.REFRESH)\n .pipe(takeUntilDestroyed(this.destroyReference))\n .subscribe(dateTimeContext => {\n if (dateTimeContext) {\n this.handleGlobalRefresh(dateTimeContext as DateTimeContext);\n }\n });\n }\n private isDashboardMode(config: GlobalContextState | null = null): boolean {\n if (config) {\n return config.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n return this.effectiveConfig().displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n private initializeStateAndSources(initialConfig: GlobalContextState | null): void {\n const isDashboard = this.isDashboardMode(initialConfig);\n const globalState =\n this.globalContextEventService.getLatestValue(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE) || {};\n this.orchestrator.initializeStateAndSources({\n initialConfig,\n globalState,\n isDashboard,\n widgetControls: this.widgetControls(),\n generateFreshDateTime: interval => generateFreshDateTimeContext(interval)\n });\n }\n\n private handleGlobalRefresh(globalDateTimeContext: DateTimeContext): void {\n handleGlobalRefreshHelper(this.getRefreshContext(), globalDateTimeContext);\n }\n private processRefreshEvent(params: {\n globalDateTimeContext?: DateTimeContext | null;\n }): RefreshResult {\n return processRefreshEventHelper(this.getRefreshContext(), params);\n }\n\n private getShouldDisableIntervalConfig(): Record<string, boolean> {\n return getShouldDisableIntervalConfigHelper(this.getRefreshContext());\n }\n\n private resolveDashboardChild(): DashboardChildComponent | null {\n return this.dashboardChildForLegacy() ?? this.injectedDashboardChild ?? null;\n }\n private updateDashboardHeaderRegistration(\n template: TemplateRef<unknown> | null,\n dashboardChild: DashboardChildComponent | null\n ): void {\n // Handle early exits and cleanup in one conditional block\n const isDifferentDashboardChild =\n this.registeredDashboardChild && this.registeredDashboardChild !== dashboardChild;\n const isMissingRequiredData = !template || !dashboardChild;\n const isAlreadyRegistered =\n this.registeredHeaderTemplate === template &&\n this.registeredDashboardChild === dashboardChild;\n\n if (isDifferentDashboardChild || isMissingRequiredData) {\n this.removeHeaderFromDashboard();\n if (isMissingRequiredData) {\n return;\n }\n }\n\n if (isAlreadyRegistered) {\n return;\n }\n\n this.removeHeaderFromDashboard();\n const headers = dashboardChild.additionalHeaderTemplates;\n if (!headers.includes(template)) {\n headers.push(template);\n }\n this.registeredHeaderTemplate = template;\n this.registeredDashboardChild = dashboardChild;\n }\n private cleanupRegisteredHeaderTemplate(): void {\n this.removeHeaderFromDashboard();\n }\n private removeHeaderFromDashboard(): void {\n if (this.registeredDashboardChild && this.registeredHeaderTemplate) {\n const headers = this.registeredDashboardChild.additionalHeaderTemplates;\n const index = headers.indexOf(this.registeredHeaderTemplate);\n if (index >= 0) {\n headers.splice(index, 1);\n }\n }\n this.registeredHeaderTemplate = null;\n this.registeredDashboardChild = null;\n }\n private emitBasedOnFieldSources(): void {\n this.emitConfiguration(this.effectiveConfig());\n }\n private emitConfiguration(configuration: GlobalContextState): void {\n const safe = this.orchestrator.emitConfiguration(this.componentId, configuration);\n this.globalContextChange.emit(safe);\n }\n private patchFormValues(formUpdates: Partial<GlobalContextState>): void {\n patchFormValuesHelper(this.getRefreshContext(), formUpdates);\n }\n\n private applyLocalAggregationChange(change: AggregationChangeInstruction): void {\n applyLocalAggregationChangeHelper(this.getRefreshContext(), change);\n }\n private getRefreshContext(): RefreshHelpersContext {\n return {\n orchestrator: this.orchestrator,\n aggregationValidationService: this.aggregationValidationService,\n getFieldSources: () => this.getFieldSources(),\n getLocalState: () => this.getLocalState(),\n getGlobalState: () => this.getGlobalState(),\n updateLocalState: updater => this.updateLocalState(updater),\n updateGlobalState: updater => this.orchestrator.updateGlobalState(updater),\n getEffectiveConfig: () => this.effectiveConfig(),\n getInitialConfig: () => this.config(),\n emitBasedOnFieldSources: () => this.emitBasedOnFieldSources(),\n emitRefresh: payload => this.refresh.emit(payload ?? null),\n form: () => this.form\n };\n }\n private getLinkContext(): LinkHelpersContext {\n if (!this.linkContextCache) {\n this.linkContextCache = this.createLinkContext();\n }\n return this.linkContextCache;\n }\n\n private createLinkContext(): LinkHelpersContext {\n return {\n orchestrator: this.orchestrator,\n getFieldSources: () => this.getFieldSources(),\n getEffectiveConfig: () => this.effectiveConfig(),\n getInitialConfig: () => this.config(),\n getLocalState: () => this.getLocalState(),\n getGlobalState: () => this.getGlobalState(),\n updateLocalState: updater => this.updateLocalState(updater),\n emitBasedOnFieldSources: () => this.emitBasedOnFieldSources(),\n emitRefresh: payload => this.refresh.emit(payload ?? null),\n form: () => this.form,\n inlineOverrides: this.inlineOverrides.asReadonly(),\n setInlineOverrides: value => this.inlineOverrides.set(value),\n dashboardOverrides: this.dashboardOverrides.asReadonly(),\n setDashboardOverrides: value => this.dashboardOverrides.set(value),\n inlineSettings: () => this.inlineSettings() ?? {},\n dashboardControlSettings: () => this.dashboardControlSettings() ?? {},\n controlLinkStatus: () => this.controlLinkStatus() ?? {},\n updateAggregationValue: aggregation =>\n updateAggregationValueHelper(this.getRefreshContext(), aggregation),\n applyLocalAggregationChange: change =>\n applyLocalAggregationChangeHelper(this.getRefreshContext(), change),\n recalcLocalAggregation: () =>\n recalculateAggregationForLocalDateTime(this.getRefreshContext()),\n recalcGlobalAggregation: () =>\n recalculateAggregationForGlobalDateTime(this.getRefreshContext()),\n setShouldDisableCounter: value => {\n this.shouldDisableCounter = value;\n }\n };\n }\n}\n","<ng-template #headerContent>\n @let linkModel = linkDisplayModel();\n <ng-content select=\"#header\"></ng-content>\n\n @if (shouldShowHeaderLinks()) {\n <c8y-global-context-link-controls\n [linkStates]=\"linkModel.linkStates\"\n [controlConfigs]=\"linkModel.controlConfig\"\n (allLinksToggled)=\"toggleAllLinks($event)\"\n ></c8y-global-context-link-controls>\n }\n</ng-template>\n\n<ng-template #inlineContent>\n @let settings = inlineSettings();\n @let linkModel = linkDisplayModel();\n\n @if (form && settings) {\n <form\n class=\"d-flex gap-16 p-l-16 p-r-16 inner-scroll\"\n [ngClass]=\"{\n 'p-b-8':\n settings.showTimeContext ||\n settings.showRefresh ||\n settings.showAutoRefresh ||\n settings.showAggregation\n }\"\n [formGroup]=\"form\"\n >\n <div class=\"input-group w-auto input-group-sm\">\n @if (settings.showAggregation) {\n <c8y-aggregation-picker\n data-cy=\"global-inline-date-context--Aggregation-display\"\n [disabledAggregations]=\"getDisabledAggregations()\"\n formControlName=\"aggregation\"\n [resetToDefault]=\"true\"\n ></c8y-aggregation-picker>\n }\n\n @if (settings.showAutoRefresh) {\n <c8y-auto-refresh-control\n [isLoading]=\"isLoading()\"\n [disableCounter]=\"shouldDisableCounter\"\n formControlName=\"isAutoRefreshEnabled\"\n [autoRefreshSeconds]=\"getAutoRefreshSeconds()\"\n [isAutoRefreshConnected]=\"linkModel.linkStates.isAutoRefreshEnabled ?? false\"\n (refresh)=\"onLocalRefreshTrigger()\"\n ></c8y-auto-refresh-control>\n }\n\n @if (settings.showTimeContext) {\n @let isHistoryMode = form.get('refreshOption')?.value === REFRESH_OPTION.HISTORY;\n <c8y-date-time-context-picker\n style=\"margin-left: -1px\"\n formControlName=\"dateTimeContext\"\n [shouldDisableInterval]=\"getIntervalDisableConfig()\"\n [config]=\"\n isHistoryMode\n ? { showDateTo: true, showDateFrom: true }\n : { showDateTo: false, showDateFrom: true }\n \"\n ></c8y-date-time-context-picker>\n }\n\n @if (settings.showRefresh) {\n <div class=\"input-group-btn\">\n <button\n class=\"btn btn-default\"\n [attr.aria-label]=\"'Refresh' | translate\"\n [tooltip]=\"'Refresh' | translate\"\n placement=\"bottom\"\n container=\"body\"\n type=\"button\"\n data-cy=\"global-inline-date-context--reload-button\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n [disabled]=\"isLoading()\"\n (click)=\"refresh.emit(null)\"\n >\n <i\n [class.icon-spin]=\"isLoading()\"\n [c8yIcon]=\"'refresh'\"\n ></i>\n </button>\n </div>\n }\n </div>\n </form>\n }\n\n <ng-content select=\"#body\"></ng-content>\n</ng-template>\n\n@switch (effectiveConfig().displayMode) {\n @case (GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG) {\n <ng-container [ngTemplateOutlet]=\"inlineContent\"></ng-container>\n }\n @case (GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG) {\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n <ng-container [ngTemplateOutlet]=\"inlineContent\"></ng-container>\n }\n @default {\n @if (shouldRenderHeaderInline()) {\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n }\n <ng-container [ngTemplateOutlet]=\"inlineContent\"></ng-container>\n }\n}\n","import { Injectable, WritableSignal, computed, inject, signal } from '@angular/core';\nimport { REFRESH_OPTION, type RefreshOption } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n type GlobalContextSettings,\n type WidgetControls,\n type GlobalContextDisplayMode,\n type GlobalContextState\n} from '../../models/global-context.model';\nimport { TIME_INTERVAL } from '../../models/interval-picker.model';\nimport { fillMissingDefaults } from '../../utils/global-context-defaults.util';\nimport { WidgetControlService } from '../domain/widget-control.service';\nimport { GlobalContextUtilsService } from '../infrastructure/global-context-utils.service';\n\n/**\n * GlobalContextConfigStoreService\n *\n * Component-scoped store that manages widget-level Global Context configuration.\n * - Holds separate Live/History modes\n * - Tracks refreshOption (tab) and displayMode\n * - Normalizes incoming configs (Live → aggregation=null; History → interval=CUSTOM)\n * - Applies targeted patches to the current mode\n * - Avoids redundant recomputation via shallow diffing\n *\n * Provided in component scope (see providers of c8y-global-context-config).\n */\n@Injectable()\nexport class GlobalContextConfigStoreService {\n /** Utility for diffing before signal writes */\n private readonly utils = inject(GlobalContextUtilsService);\n /** Widget control template used for computing visibility settings */\n private readonly widgetControlService = inject(WidgetControlService);\n\n /** Widget controls definition (what a widget supports) provided by the host component */\n private readonly _widgetControls: WritableSignal<WidgetControls | null> = signal(null);\n\n /**\n * Live mode of the widget time context state.\n * Null until the store is hydrated with the first input.\n */\n readonly liveState: WritableSignal<GlobalContextState | null> = signal(null);\n\n /**\n * History mode of the widget time context state.\n * Null until the store is hydrated with the first input.\n */\n readonly historyState: WritableSignal<GlobalContextState | null> = signal(null);\n\n /** Currently selected tab (refresh option). Defaults to LIVE. */\n readonly refreshOption: WritableSignal<RefreshOption> = signal(REFRESH_OPTION.LIVE);\n\n /** Current display mode for the widget (config or view_and_config). */\n readonly displayMode: WritableSignal<GlobalContextDisplayMode> = signal(\n GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG\n );\n\n /** Whether the store has processed the first hydrate() call. */\n readonly initialized: WritableSignal<boolean> = signal(false);\n\n /**\n * Computed visibility settings for controls, based on the current widget controls,\n * display mode, and selected refresh option. If widgetControls are not provided yet,\n * defaults to showing all controls.\n */\n readonly settings = computed<Partial<GlobalContextSettings>>(() => {\n this.activeConfig();\n const { settings } = this.widgetControlService.resolveConfigControlSettings(\n this._widgetControls(),\n this.displayMode(),\n this.refreshOption()\n );\n return settings;\n });\n\n /**\n * Inline visibility and dashboard control settings derived for the Inline component.\n * Uses default link states from the widget controls; dynamic link toggling remains\n * handled by the Inline component.\n */\n readonly inlineSettings = computed(() => {\n const res = this.widgetControlService.resolveInlineControlSettings(\n this._widgetControls(),\n this.displayMode(),\n this.refreshOption()\n );\n return res; // { settings, links, dashboardControls }\n });\n\n /**\n * Effective configuration for the currently selected tab.\n * Consumers should read this to render the UI.\n */\n readonly activeConfig = computed(() => {\n return this.refreshOption() === REFRESH_OPTION.LIVE ? this.liveState() : this.historyState();\n });\n\n /**\n * Hydrates the store from an external config input.\n * After the first call, preserves the user's tab selection.\n * @param config - Incoming widget-level global context configuration\n */\n hydrate(config: GlobalContextState): void {\n const norm = this.normalize(config);\n\n if (!this.initialized()) {\n // Initialize both modes with the same dateTimeContext for consistency\n // This ensures when user switches modes, they see the same time range initially\n const sharedDateTimeContext = norm.dateTimeContext;\n\n const baseLive = fillMissingDefaults({\n displayMode: norm.displayMode,\n refreshOption: REFRESH_OPTION.LIVE,\n isAutoRefreshEnabled: GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n aggregation: null,\n dateTimeContext: sharedDateTimeContext\n });\n const baseHistory = this.enforceHistory(\n fillMissingDefaults({\n displayMode: norm.displayMode,\n refreshOption: REFRESH_OPTION.HISTORY,\n isAutoRefreshEnabled: false,\n dateTimeContext: sharedDateTimeContext,\n // Preserve null aggregation from the source mode instead of using default\n aggregation: norm.aggregation\n })\n );\n\n if (norm.refreshOption === REFRESH_OPTION.LIVE) {\n this.liveState.set(norm);\n this.historyState.set(baseHistory);\n } else {\n this.liveState.set(baseLive);\n this.historyState.set(this.enforceHistory(norm));\n }\n this.refreshOption.set(norm.refreshOption);\n this.displayMode.set(norm.displayMode);\n this.initialized.set(true);\n return;\n }\n\n // Subsequent updates: update matching state only, preserve tab selection\n if (norm.refreshOption === REFRESH_OPTION.LIVE) {\n this.setIfChanged(this.liveState, norm);\n } else {\n this.setIfChanged(this.historyState, this.enforceHistory(norm));\n }\n\n // Keep display mode in sync\n if (this.displayMode() !== norm.displayMode) {\n this.setDisplayMode(norm.displayMode);\n }\n }\n\n /**\n * Sets the widget controls template. Required for computing visibility via `settings`.\n */\n setWidgetControls(controls: WidgetControls): void {\n this._widgetControls.set(controls);\n }\n\n /**\n * Sets the display mode and syncs the mode to both modes.\n * Does not change the selected tab.\n * @param mode - Display mode to set (CONFIG or VIEW_AND_CONFIG)\n */\n setDisplayMode(mode: GlobalContextDisplayMode): void {\n if (this.displayMode() === mode) {\n return;\n }\n this.displayMode.set(mode);\n\n const live = this.liveState();\n const history = this.historyState();\n if (live) {\n this.setIfChanged(this.liveState, { ...live, displayMode: mode });\n }\n if (history) {\n this.setIfChanged(this.historyState, { ...history, displayMode: mode });\n }\n }\n\n /**\n * Explicitly selects the tab (Live/History). Does not mutate stored values for either\n * refresh mode; it only switches which mode is active.\n * @param option - Target refresh option (LIVE or HISTORY)\n */\n setRefreshOption(option: RefreshOption): void {\n if (this.refreshOption() === option) {\n return;\n }\n this.refreshOption.set(option);\n }\n\n /**\n * Hydrates the snapshot for a specific refresh mode without altering the current selection.\n * Used by widget configuration to restore per-mode state across component lifecycles.\n */\n setSnapshot(option: RefreshOption, snapshot: GlobalContextState | null): void {\n if (!snapshot) {\n return;\n }\n\n if (option === REFRESH_OPTION.LIVE) {\n // Don't use fillMissingDefaults here as it can overwrite the dateTimeContext\n // The snapshot is already complete from the tab switch logic\n const normalized: GlobalContextState = {\n ...snapshot,\n refreshOption: REFRESH_OPTION.LIVE,\n aggregation: null\n };\n if (normalized.displayMode && this.displayMode() !== normalized.displayMode) {\n this.displayMode.set(normalized.displayMode);\n }\n this.setIfChanged(this.liveState, normalized);\n return;\n }\n\n // For History, enforce the interval=CUSTOM rule but don't regenerate dates\n const normalizedHistory: GlobalContextState = this.enforceHistory({\n ...snapshot,\n refreshOption: REFRESH_OPTION.HISTORY\n });\n if (normalizedHistory.displayMode && this.displayMode() !== normalizedHistory.displayMode) {\n this.displayMode.set(normalizedHistory.displayMode);\n }\n this.setIfChanged(this.historyState, normalizedHistory);\n }\n\n /**\n * Applies a partial update to the currently selected refresh mode.\n * Enforces business rules (Live: aggregation=null; History: interval=CUSTOM) before commit.\n * @param changes - Partial changes to apply to the current refresh mode\n */\n patchCurrent(changes: Partial<GlobalContextState>): void {\n const isLive = this.refreshOption() === REFRESH_OPTION.LIVE;\n const target = isLive ? this.liveState : this.historyState;\n const prev = target();\n\n if (!prev) {\n return;\n }\n\n // Filter out refreshInterval from changes - it's fixed at 5s and should not be user-modifiable\n const { refreshInterval: _, ...allowedChanges } = changes;\n\n let next: GlobalContextState = { ...prev, ...allowedChanges } as GlobalContextState;\n\n if (!isLive) {\n next = this.enforceHistory(next);\n } else {\n // Live must not carry aggregation\n next.aggregation = null;\n }\n\n // Always enforce the fixed refresh interval\n next.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n\n this.setIfChanged(target, next);\n }\n\n /**\n * Resets both Live and History modes to defaults, preserving the current\n * selected tab and display mode.\n */\n resetAllModesToDefaults(): void {\n const mode = this.displayMode();\n const baseLive = fillMissingDefaults({\n displayMode: mode,\n refreshOption: REFRESH_OPTION.LIVE,\n isAutoRefreshEnabled: GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n aggregation: null\n });\n const baseHistory = this.enforceHistory(\n fillMissingDefaults({\n displayMode: mode,\n refreshOption: REFRESH_OPTION.HISTORY,\n isAutoRefreshEnabled: false\n })\n );\n this.liveState.set(baseLive);\n this.historyState.set(baseHistory);\n }\n\n /**\n * Resets a single mode (live/history) to defaults, preserving the current\n * display mode and selected tab.\n */\n resetModeToDefaults(target: RefreshOption): void {\n const mode = this.displayMode();\n if (target === REFRESH_OPTION.LIVE) {\n const baseLive = fillMissingDefaults({\n displayMode: mode,\n refreshOption: REFRESH_OPTION.LIVE,\n isAutoRefreshEnabled: GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n aggregation: null\n });\n this.liveState.set(baseLive);\n } else {\n const baseHistory = this.enforceHistory(\n fillMissingDefaults({\n displayMode: mode,\n refreshOption: REFRESH_OPTION.HISTORY,\n isAutoRefreshEnabled: false\n })\n );\n this.historyState.set(baseHistory);\n }\n }\n\n /**\n * Selects a value from the active configuration using a projector function.\n * Returns a signal that updates whenever the active configuration changes.\n */\n select<K>(project: (s: GlobalContextState) => K) {\n return computed<K | null>(() => {\n const cfg = this.activeConfig();\n return cfg ? project(cfg) : null;\n });\n }\n\n /**\n * Normalizes an incoming configuration to internal invariants.\n * @param config - Raw incoming config\n * @returns A normalized config respecting store rules\n */\n private normalize(config: GlobalContextState): GlobalContextState {\n const norm = fillMissingDefaults(config);\n if (![REFRESH_OPTION.LIVE, REFRESH_OPTION.HISTORY].includes(norm.refreshOption)) {\n norm.refreshOption = REFRESH_OPTION.LIVE;\n }\n if (\n norm.displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG &&\n norm.displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n ) {\n norm.displayMode = GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n }\n if (norm.refreshOption === REFRESH_OPTION.LIVE) {\n norm.aggregation = null;\n }\n // Always enforce the fixed 5s refresh interval\n norm.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n if (norm.refreshOption === REFRESH_OPTION.HISTORY) {\n return this.enforceHistory(norm);\n }\n return norm;\n }\n\n /**\n * Ensures state represents a valid History configuration (interval=CUSTOM).\n * @param state - State candidate to coerce to History rules\n * @returns A state object compliant with History mode rules\n */\n private enforceHistory(state: GlobalContextState): GlobalContextState {\n return {\n ...state,\n refreshOption: REFRESH_OPTION.HISTORY,\n ...(state.dateTimeContext && {\n dateTimeContext: { ...state.dateTimeContext, interval: TIME_INTERVAL.CUSTOM }\n })\n };\n }\n\n /**\n * Writes to a signal only if the next value differs from the current one.\n * Prevents unnecessary change detection and effect triggering.\n * @param target - Signal to update\n * @param next - Next value to set if changed\n */\n private setIfChanged(\n target: WritableSignal<GlobalContextState | null>,\n next: GlobalContextState\n ): void {\n const prev = target();\n if (!prev) {\n target.set(next);\n return;\n }\n const diff = this.utils.getChangedFields(prev, next);\n\n if (Object.keys(diff).length > 0) {\n target.set(next);\n }\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n output,\n untracked\n} from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { ConfigurationControlsComponent } from '../features/configuration/configuration-controls/configuration-controls.component';\nimport { REFRESH_OPTION } from '../models/auto-refresh.model';\nimport type { GlobalContextState, WidgetControls } from '../models/global-context.model';\nimport { GlobalContextConfigStoreService } from '../services/state/global-context-store.service';\n\n/**\n * GlobalContextConfigComponent\n *\n * Presentation + state coordination for the widget's Global Context controls.\n * - Hydrates a component-scoped store from the incoming `config` input.\n * - Renders Live/History configuration controls via `ConfigurationControlsComponent`.\n * - Emits a normalized `GlobalContextState` when user changes either the tab\n * (refreshOption) or any control value within the current tab.\n * - Does not emit during initial hydrate; emissions only happen on user actions.\n */\n@Component({\n standalone: true,\n imports: [\n ReactiveFormsModule,\n TooltipModule,\n PopoverModule,\n CollapseModule,\n ConfigurationControlsComponent\n ],\n selector: 'c8y-global-context-config',\n templateUrl: './global-context-config.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [GlobalContextConfigStoreService]\n})\nexport class GlobalContextConfigComponent {\n private readonly store = inject(GlobalContextConfigStoreService);\n\n configInput = input.required<GlobalContextState>({ alias: 'config' });\n isLoading = input(false);\n widgetControls = input.required<WidgetControls>();\n liveSnapshotInput = input<GlobalContextState | null>(null, { alias: 'liveSnapshot' });\n historySnapshotInput = input<GlobalContextState | null>(null, { alias: 'historySnapshot' });\n\n readonly activeConfig = computed(() => this.store.activeConfig());\n readonly liveConfig = computed(() => this.store.liveState());\n readonly historyConfig = computed(() => this.store.historyState());\n readonly refreshOption = computed(() => this.store.refreshOption());\n readonly settings = computed(() => this.store.settings());\n readonly supportedModes = computed(\n () => this.widgetControls().supportedModes ?? [REFRESH_OPTION.LIVE, REFRESH_OPTION.HISTORY]\n );\n isExpanded = false;\n\n readonly refresh = output<void>();\n readonly globalContextChange = output<GlobalContextState>();\n\n constructor() {\n // Consolidated hydration & widget controls effect\n effect(() => {\n const config = this.configInput();\n const controls = this.widgetControls();\n\n untracked(() => {\n if (config) {\n this.store.hydrate(config);\n }\n if (controls) {\n this.store.setWidgetControls(controls);\n }\n // Touch settings once both are available to trigger hydration\n if (config && controls && this.activeConfig()) {\n this.settings();\n }\n });\n });\n\n // Consolidated snapshot setting effect\n effect(() => {\n const liveSnapshot = this.liveSnapshotInput();\n const historySnapshot = this.historySnapshotInput();\n\n untracked(() => {\n if (liveSnapshot) {\n this.store.setSnapshot(REFRESH_OPTION.LIVE, liveSnapshot);\n }\n if (historySnapshot) {\n this.store.setSnapshot(REFRESH_OPTION.HISTORY, historySnapshot);\n }\n });\n });\n }\n\n onConfigurationChanges(changes: Partial<GlobalContextState>): void {\n const current = this.activeConfig();\n if (!current) {\n return;\n }\n\n if (this.isRefreshOptionChange(changes, current)) {\n const { refreshOption } = changes;\n\n // Get the target mode's existing state to preserve its interval/preset\n const targetState =\n refreshOption === REFRESH_OPTION.LIVE ? this.store.liveState() : this.store.historyState();\n\n // Build target snapshot: inherit time range (dateFrom/dateTo) but preserve target mode's interval\n const targetSnapshot: GlobalContextState = {\n ...current,\n refreshOption,\n dateTimeContext:\n current.dateTimeContext && targetState?.dateTimeContext\n ? {\n ...structuredClone(current.dateTimeContext),\n interval: targetState.dateTimeContext.interval // Preserve target's interval\n }\n : current.dateTimeContext,\n // Reset aggregation for Live mode, preserve for History\n aggregation: refreshOption === REFRESH_OPTION.LIVE ? null : current.aggregation\n };\n\n // CRITICAL: Set snapshot BEFORE changing refreshOption to prevent race condition\n this.store.setSnapshot(refreshOption, targetSnapshot);\n this.store.setRefreshOption(refreshOption);\n\n this.emitActive();\n return;\n }\n\n // Capture state before patch to detect actual changes\n const stateBefore = this.store.activeConfig();\n this.store.patchCurrent(changes);\n const stateAfter = this.store.activeConfig();\n\n // Only emit if the state actually changed\n // The store's setIfChanged method prevents unnecessary updates,\n // so we check if the reference changed to know if an update occurred\n if (stateBefore !== stateAfter) {\n this.emitActive();\n }\n }\n\n /** Emits the current normalized active state if available */\n private emitActive(): void {\n const state = this.store.activeConfig();\n if (state) {\n this.globalContextChange.emit(state);\n }\n }\n\n private isRefreshOptionChange(\n changes: Partial<GlobalContextState>,\n current: Partial<GlobalContextState>\n ): boolean {\n return (\n Object.keys(changes).length === 1 &&\n 'refreshOption' in changes &&\n changes.refreshOption !== current.refreshOption\n );\n }\n}\n","<c8y-configuration-controls\n [settings]=\"settings()\"\n [controlsDisplayMode]=\"'horizontal'\"\n [tabsOutletName]=\"'verticalTabOutletForConfigurationModes'\"\n [activeMode]=\"refreshOption()\"\n [liveContext]=\"liveConfig()\"\n [historyContext]=\"historyConfig()\"\n [supportedModes]=\"supportedModes()\"\n (contextChange)=\"onConfigurationChanges($event)\"\n (refreshOptionChange)=\"onConfigurationChanges({ refreshOption: $event })\"\n></c8y-configuration-controls>\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n forwardRef,\n inject,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n ControlValueAccessor,\n FormBuilder,\n FormsModule,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule\n} from '@angular/forms';\nimport { C8yTranslatePipe } from '@c8y/ngx-components';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { map } from 'rxjs/operators';\nimport type { ContextConfig } from '../../../models/context-config.model';\nimport type { GlobalContextDisplayMode } from '../../../models/global-context.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE } from '../../../models/global-context.model';\n\n@Component({\n selector: 'c8y-config-context-selector',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (form) {\n @let isWidgetContext = form.get('context')?.value === 'widget';\n @let helpText = 'Show controls directly in the widget view for easier access.' | translate;\n\n <form class=\"form-group m-b-8\" [formGroup]=\"form\">\n <div class=\"d-flex gap-8 a-i-center\">\n <label class=\"c8y-radio\">\n <input\n type=\"radio\"\n value=\"dashboard\"\n data-cy=\"c8y-config-context-selector--dashboard-mode\"\n formControlName=\"context\"\n />\n <span class=\"a-s-center\"></span>\n <span translate>Dashboard</span>\n </label>\n <label class=\"c8y-radio\">\n <input\n type=\"radio\"\n value=\"widget\"\n data-cy=\"c8y-config-context-selector--config-mode\"\n formControlName=\"context\"\n />\n <span class=\"a-s-center\"></span>\n <span translate>Widget</span>\n </label>\n </div>\n\n @if (isWidgetContext) {\n <div class=\"m-t-8\">\n <label class=\"c8y-checkbox\">\n <input\n type=\"checkbox\"\n data-cy=\"c8y-config-context-selector--view-and-config-mode\"\n formControlName=\"showInWidget\"\n />\n <span class=\"a-s-center\"></span>\n <span translate>Show in widget</span>\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"helpText\"\n placement=\"right\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </label>\n </div>\n }\n </form>\n }\n `,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ConfigContextSelectorComponent),\n multi: true\n }\n ],\n imports: [C8yTranslatePipe, FormsModule, ReactiveFormsModule, PopoverModule]\n})\nexport class ConfigContextSelectorComponent implements ControlValueAccessor, OnInit {\n private readonly fb = inject(FormBuilder);\n private readonly destroyRef = inject(DestroyRef);\n\n protected form!: ReturnType<typeof this.initForm>;\n\n protected get isWidgetContext(): boolean {\n return this.form?.get('context')?.value === 'widget';\n }\n\n ngOnInit(): void {\n this.form = this.initForm();\n this.setupValueChanges();\n }\n\n writeValue(value: GlobalContextDisplayMode): void {\n if (!value) return;\n\n const formValue: ContextConfig = {\n context: value === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD ? 'dashboard' : 'widget',\n showInWidget: value === GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n };\n\n this.form?.patchValue(formValue, { emitEvent: false });\n }\n\n registerOnChange(fn: (value: GlobalContextDisplayMode) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n isDisabled ? this.form?.disable() : this.form?.enable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChange: (value: GlobalContextDisplayMode) => void = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onTouched: () => void = () => {};\n\n private initForm() {\n return this.fb.group<ContextConfig>({\n context: 'widget',\n showInWidget: false\n });\n }\n\n private setupValueChanges(): void {\n this.form.valueChanges\n .pipe(\n map(({ context, showInWidget }: ContextConfig) =>\n context === 'dashboard'\n ? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n : showInWidget\n ? GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n : GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG\n ),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe(dateSelection => {\n this.onChange(dateSelection);\n this.onTouched();\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n effect,\n inject,\n input,\n OnInit,\n output,\n signal,\n untracked\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe } from '@c8y/ngx-components';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { ConfigContextSelectorComponent } from '../features/configuration/config-context-selector';\nimport type { RefreshOption } from '../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../models/auto-refresh.model';\nimport type {\n GlobalContextDisplayMode,\n GlobalContextState,\n WidgetControls\n} from '../models/global-context.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GLOBAL_CONTEXT_EVENTS } from '../models/global-context.model';\nimport { GlobalContextEventService } from '../services/state/global-context-event.service';\nimport { GlobalContextConfigComponent } from './global-context-config.component';\n\n/**\n * Widget configuration component for time context settings.\n *\n * Allows widgets to either sync with dashboard-level time settings (dashboard mode)\n * or use independent time controls (widget mode). When in widget mode, displays\n * additional configuration controls for time range, aggregation, and refresh settings.\n */\n@Component({\n selector: 'c8y-global-context-widget-config',\n standalone: true,\n imports: [\n ReactiveFormsModule,\n ConfigContextSelectorComponent,\n GlobalContextConfigComponent,\n C8yTranslatePipe,\n PopoverModule\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <form [formGroup]=\"form\">\n <fieldset class=\"c8y-fieldset\">\n <legend>\n {{ 'Time context' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"\n 'Sync with dashboard settings or set independent time controls for this widget.'\n | translate\n \"\n placement=\"right\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-config-context-selector formControlName=\"displayMode\"></c8y-config-context-selector>\n </fieldset>\n </form>\n\n @if (configInput()?.displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n <fieldset class=\"c8y-fieldset p-l-0 p-r-0 p-t-16\">\n <legend class=\"m-l-16\">{{ 'Widget time context' | translate }}</legend>\n <c8y-global-context-config\n [config]=\"_latestConfig()\"\n [widgetControls]=\"widgetControlsInput()\"\n [isLoading]=\"isLoadingInput()\"\n [liveSnapshot]=\"liveSnapshot\"\n [historySnapshot]=\"historySnapshot\"\n (refresh)=\"refresh.emit()\"\n (globalContextChange)=\"onGlobalContextChange($event)\"\n ></c8y-global-context-config>\n </fieldset>\n }\n `\n})\nexport class GlobalContextWidgetConfigComponent implements OnInit {\n // Component inputs\n configInput = input.required<GlobalContextState | null>({ alias: 'config' });\n widgetControlsInput = input.required<WidgetControls>({ alias: 'widgetControls' });\n isLoadingInput = input(false, { alias: 'isLoading' });\n\n readonly displayModeChange = output<GlobalContextDisplayMode>();\n readonly refresh = output<void>();\n readonly globalContextChange = output<GlobalContextState>();\n\n protected form: FormGroup;\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n\n private readonly fb = inject(FormBuilder);\n private readonly destroyRef = inject(DestroyRef);\n private readonly globalContextEventService = inject(GlobalContextEventService, {\n optional: true\n });\n private readonly _latestGlobalSnapshot = signal<GlobalContextState | null>(null);\n private readonly _latestConfig = signal<GlobalContextState | null>(null);\n private lastConfigInput: GlobalContextState | null = null;\n private readonly liveSnapshotState = signal<GlobalContextState | null>(null);\n private readonly historySnapshotState = signal<GlobalContextState | null>(null);\n private readonly lastActiveMode = signal<RefreshOption>(REFRESH_OPTION.LIVE);\n\n // Current display mode state\n readonly displayModeSig = signal<GlobalContextDisplayMode>(GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD);\n\n constructor() {\n // Sync form control with incoming displayMode without triggering change events\n effect(() => {\n const cfg = this.configInput();\n\n // Always ensure auto-refresh is enabled in the widget config\n const next =\n (cfg?.displayMode as GlobalContextDisplayMode) ?? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n const current = this.form?.get('displayMode')?.value as GlobalContextDisplayMode;\n if (current !== next && this.form) {\n untracked(() => {\n this.form.patchValue({ displayMode: next }, { emitEvent: false });\n this.displayModeSig.set(next);\n });\n }\n });\n\n // Keep child component config in sync with input changes\n effect(() => {\n const cfg = this.configInput();\n if (cfg && cfg !== this.lastConfigInput) {\n untracked(() => {\n this.lastConfigInput = cfg;\n const cloned = this.cloneSnapshot(cfg) as GlobalContextState;\n this._latestConfig.set(cloned);\n const mode = cloned.refreshOption ?? REFRESH_OPTION.LIVE;\n this.updateSnapshotForMode(mode, cloned);\n this.lastActiveMode.set(mode);\n });\n }\n\n if (!cfg && this.lastConfigInput) {\n untracked(() => {\n this.lastConfigInput = null;\n this._latestConfig.set(null);\n });\n }\n });\n }\n\n ngOnInit(): void {\n this.initializeForm();\n\n this.storeInitialStateChangeEvent();\n this.subscribeToGlobalContextStateChangeEvents();\n this.initializeContext();\n }\n\n onGlobalContextChange(newConfig: GlobalContextState): void {\n // Update local config first to prevent feedback loop\n const cloned = this.cloneSnapshot(newConfig) as GlobalContextState;\n this._latestConfig.set(cloned);\n this.lastConfigInput = null;\n const mode = cloned.refreshOption ?? REFRESH_OPTION.LIVE;\n this.updateSnapshotForMode(mode, cloned);\n this.lastActiveMode.set(mode);\n // Then emit to parent\n this.globalContextChange.emit(newConfig);\n }\n\n private initializeForm(): void {\n const initial =\n (this.configInput()?.displayMode as GlobalContextDisplayMode) ??\n GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n this.form = this.fb.group({\n displayMode: initial\n });\n\n // Emit display mode changes to parent\n this.form\n .get('displayMode')\n ?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((mode: GlobalContextDisplayMode) => {\n if (this.displayModeSig() !== mode) {\n this.displayModeSig.set(mode);\n }\n this.displayModeChange.emit(mode);\n // Also emit a normalized globalContextChange with a suggested context update\n const result = this.buildContextUpdateForDisplayMode(mode, {\n global: this._latestGlobalSnapshot(),\n widget: this._latestConfig()\n });\n this.syncWidgetSnapshotAfterHydration(mode, result);\n this.globalContextChange.emit(result.context as GlobalContextState);\n });\n }\n\n private storeInitialStateChangeEvent(): void {\n if (this.globalContextEventService) {\n const latest = this.globalContextEventService.getLatestValue(\n GLOBAL_CONTEXT_EVENTS.STATE_CHANGE\n );\n if (latest) {\n this._latestGlobalSnapshot.set(latest);\n }\n }\n }\n\n private subscribeToGlobalContextStateChangeEvents(): void {\n this.globalContextEventService\n .on(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(state => this._latestGlobalSnapshot.set(state));\n }\n\n private initializeContext(): void {\n const displayMode = this.form.get('displayMode').value;\n // const configInput = this.configInput();\n\n // If already in config mode with widget config, use it directly - don't build from snapshots\n if (displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n // Just emit the widget config as-is, effect will handle the rest\n return;\n }\n\n // Otherwise build from global/widget snapshots\n const result = this.buildContextUpdateForDisplayMode(displayMode, {\n global: this._latestGlobalSnapshot(),\n widget: this._latestConfig()\n });\n\n this.syncWidgetSnapshotAfterHydration(displayMode, result);\n this.globalContextChange.emit(result.context as GlobalContextState);\n }\n\n private buildContextUpdateForDisplayMode(\n displayMode: GlobalContextDisplayMode,\n snapshots: {\n global?: Partial<GlobalContextState> | null;\n widget?: Partial<GlobalContextState> | null;\n }\n ): { context: Partial<GlobalContextState>; hydratedFromGlobal: boolean } {\n const globalSnapshot = this.cloneSnapshot(snapshots.global);\n\n if (displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n return {\n context: { ...(globalSnapshot ?? {}), displayMode },\n hydratedFromGlobal: false\n };\n }\n\n const widgetSnapshot = this.cloneSnapshot(snapshots.widget ?? this._latestConfig());\n const primaryMode = this.lastActiveMode();\n const primarySnapshot = this.cloneSnapshot(\n primaryMode === REFRESH_OPTION.HISTORY\n ? this.historySnapshotState()\n : this.liveSnapshotState()\n );\n const secondarySnapshot = this.cloneSnapshot(\n primaryMode === REFRESH_OPTION.HISTORY\n ? this.liveSnapshotState()\n : this.historySnapshotState()\n );\n\n const candidate = this.isMeaningfulState(widgetSnapshot)\n ? widgetSnapshot\n : this.isMeaningfulState(primarySnapshot)\n ? primarySnapshot\n : secondarySnapshot;\n\n if (candidate) {\n return {\n context: { ...candidate, displayMode },\n hydratedFromGlobal: false\n };\n }\n\n return {\n context: { ...(globalSnapshot ?? {}), displayMode },\n hydratedFromGlobal: true\n };\n }\n\n private cloneSnapshot(\n snapshot: Partial<GlobalContextState> | GlobalContextState | null | undefined\n ): Partial<GlobalContextState> | null {\n if (!snapshot) {\n return null;\n }\n\n return structuredClone(snapshot);\n }\n\n private isMeaningfulState(\n snapshot: Partial<GlobalContextState> | null | undefined\n ): snapshot is Partial<GlobalContextState> {\n if (!snapshot) {\n return false;\n }\n\n const { dateTimeContext, refreshOption, refreshInterval, aggregation, isAutoRefreshEnabled } =\n snapshot;\n\n return (\n !!dateTimeContext ||\n refreshOption !== undefined ||\n refreshInterval !== undefined ||\n aggregation !== undefined ||\n isAutoRefreshEnabled !== undefined\n );\n }\n\n private syncWidgetSnapshotAfterHydration(\n mode: GlobalContextDisplayMode,\n result: { context: Partial<GlobalContextState>; hydratedFromGlobal: boolean }\n ): void {\n if (mode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n return;\n }\n\n const cloned = this.cloneSnapshot(\n result.context as GlobalContextState\n ) as GlobalContextState | null;\n if (!cloned) {\n return;\n }\n\n this._latestConfig.set(cloned);\n const modeToUpdate = cloned.refreshOption ?? this.lastActiveMode();\n this.updateSnapshotForMode(modeToUpdate, cloned);\n this.lastActiveMode.set(modeToUpdate);\n }\n\n private updateSnapshotForMode(mode: RefreshOption, snapshot: GlobalContextState): void {\n const cloned = this.cloneSnapshot(snapshot) as GlobalContextState | null;\n if (!cloned) {\n return;\n }\n\n if (mode === REFRESH_OPTION.HISTORY) {\n this.historySnapshotState.set({ ...cloned, refreshOption: REFRESH_OPTION.HISTORY });\n return;\n }\n\n this.liveSnapshotState.set({\n ...cloned,\n refreshOption: REFRESH_OPTION.LIVE,\n aggregation: null\n });\n }\n\n get liveSnapshot(): GlobalContextState | null {\n return this.liveSnapshotState();\n }\n\n get historySnapshot(): GlobalContextState | null {\n return this.historySnapshotState();\n }\n}\n","// Export core components\nexport * from './global-context.component';\nexport * from './global-context-inline.component';\nexport * from './global-context-config.component';\nexport * from './global-context-widget-config.component';\nexport * from './widget-inline/inline-link-controls.component';\n","// Export components\nexport * from './time-range-picker/date-time-context-picker.component';\nexport * from './time-range-display/time-range-display.component';\nexport * from './interval-picker/interval-picker.component';\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n inject\n} from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { C8yTranslatePipe } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\n\n@Component({\n selector: 'c8y-realtime-control',\n templateUrl: './realtime-control.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => RealtimeControlComponent),\n multi: true\n }\n ],\n standalone: true,\n imports: [TooltipModule, C8yTranslatePipe, FormsModule]\n})\nexport class RealtimeControlComponent implements ControlValueAccessor {\n readonly disableRealtimeLabel = gettext('Disable realtime');\n readonly enableRealtimeLabel = gettext('Enable realtime');\n\n isActive: boolean;\n touched = false;\n disabled = false;\n\n private cdr = inject(ChangeDetectorRef);\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = _ => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onTouched = () => {};\n\n writeValue(value: boolean): void {\n this.isActive = value;\n this.cdr.markForCheck();\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n registerOnTouched(onTouched: any): void {\n this.onTouched = onTouched;\n }\n\n markAsTouched(): void {\n if (!this.touched) {\n this.onTouched();\n this.touched = true;\n }\n }\n\n setDisabledState(disabled: boolean): void {\n this.disabled = disabled;\n }\n\n onButtonClick(): void {\n const newValue = !this.isActive;\n this.onChange(newValue);\n }\n}\n","@let buttonLabel = (isActive ? disableRealtimeLabel : enableRealtimeLabel) | translate;\n\n<button\n class=\"btn btn-icon c8y-realtime\"\n [attr.aria-label]=\"buttonLabel\"\n [tooltip]=\"tooltipTpl\"\n placement=\"top\"\n container=\"body\"\n type=\"button\"\n data-cy=\"global-context--realtime-toggle\"\n (click)=\"onButtonClick()\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n [disabled]=\"disabled\"\n>\n <span\n class=\"c8y-pulse m-0\"\n [class.active]=\"isActive\"\n [class.inactive]=\"!isActive\"\n ></span>\n</button>\n<ng-template #tooltipTpl>\n {{ buttonLabel }}\n</ng-template>\n","// Export components\nexport * from './auto-refresh/auto-refresh-control.component';\nexport * from './realtime-control/realtime-control.component';\n","// Export components\nexport * from './config-context-selector/config-context-selector.component';\nexport * from './configuration-controls/configuration-controls.component';\nexport * from './configuration-collapse/configuration-collapse.component';\nexport * from './live-mode-configuration-controls/live-mode-configuration-controls.component';\nexport * from './history-mode-configuration-controls/history-mode-configuration-controls.component';\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n inject,\n Input,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { BehaviorSubject, debounceTime, skip, take, tap } from 'rxjs';\n\nimport { AsyncPipe } from '@angular/common';\nimport { AggregationPickerComponent } from '../../features/aggregation/aggregation-picker';\nimport { AutoRefreshControlComponent } from '../../features/refresh/auto-refresh';\nimport { DateTimeContextPickerComponent } from '../../features/time-context/time-range-picker/date-time-context-picker.component';\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GlobalContextSettings,\n GlobalContextState,\n WidgetControls\n} from '../../models/global-context.model';\nimport { WidgetControlService } from '../../services/domain/widget-control.service';\nimport { GlobalContextFormService } from '../../services/state/global-context-form.service';\n\n@Component({\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AsyncPipe,\n IconDirective,\n ReactiveFormsModule,\n DateTimeContextPickerComponent,\n AggregationPickerComponent,\n AutoRefreshControlComponent,\n TooltipModule,\n C8yTranslatePipe\n ],\n selector: 'c8y-preview-controls',\n templateUrl: './preview-controls.component.html',\n styles: [\n `\n :host {\n position: relative;\n display: block;\n cursor: not-allowed;\n }\n\n /* Block all interactions with form controls */\n :host form {\n position: relative;\n pointer-events: none;\n user-select: none;\n }\n\n /* Add subtle visual indication of non-interactive state */\n :host form::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(255, 255, 255, 0.05);\n z-index: 1;\n pointer-events: none;\n }\n\n /* Ensure buttons and inputs look disabled */\n :host form button,\n :host form input,\n :host form select,\n :host form .dropdown-toggle,\n :host form .btn {\n cursor: not-allowed !important;\n opacity: 0.85;\n }\n\n /* Ensure all child interactive elements are non-interactive */\n :host form * {\n pointer-events: none !important;\n user-select: none !important;\n }\n `\n ]\n})\nexport class PreviewControlsComponent implements OnInit {\n // Constants\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n readonly REFRESH_OPTION = REFRESH_OPTION;\n\n // Form configuration\n form!: FormGroup;\n\n // State subjects\n private config$ = new BehaviorSubject<Partial<GlobalContextState> | null>(null);\n readonly inlineControlsSettings$ = new BehaviorSubject<Partial<GlobalContextSettings>>({});\n // UI state\n shouldDisableCustomInterval = { isDisabled: false, msg: null };\n\n // Injected dependencies\n private readonly destroyRef = inject(DestroyRef);\n private readonly globalContextFormService = inject(GlobalContextFormService);\n private readonly widgetControlService = inject(WidgetControlService);\n\n @Input() widgetControls: WidgetControls;\n\n private _currentConfig: Partial<GlobalContextState> = {};\n @Input()\n set config(value: GlobalContextState) {\n this._currentConfig = { ...this._currentConfig, ...value };\n this.config$.next(this._currentConfig);\n }\n get config(): Partial<GlobalContextState> | null {\n return this.config$.value;\n }\n\n ngOnInit(): void {\n this.initializeComponent();\n this.setupConfigChangeHandling();\n }\n\n /**\n * Returns the current inline controls settings\n */\n getInlineControlsSettings(): Partial<GlobalContextSettings> {\n return this.inlineControlsSettings$.value;\n }\n\n /**\n * Updates the inline controls settings\n */\n setInlineControlsSettings(settings: Partial<GlobalContextSettings>): void {\n this.inlineControlsSettings$.next(settings);\n }\n\n /**\n * Updates visibility of controls based on display mode and widget type\n */\n setControlsVisibility(context?: GlobalContextState): void {\n if (!this.config?.displayMode || !this.widgetControls) {\n return;\n }\n const displayMode = context?.displayMode ?? this.config.displayMode;\n\n const refreshOption =\n context?.refreshOption ?? (this.config.refreshOption || REFRESH_OPTION.LIVE);\n\n const { settings } = this.widgetControlService.resolveInlineControlSettings(\n this.widgetControls,\n displayMode,\n refreshOption\n );\n this.setInlineControlsSettings(settings);\n }\n\n /**\n * Main initialization logic for the component\n */\n private initializeComponent(): void {\n this.config$\n .pipe(\n take(1),\n tap(() => this.setupComponentState())\n )\n .subscribe();\n }\n\n /**\n * Sets up the initial component state\n */\n private setupComponentState(): void {\n this.setDefaultDisplayMode();\n this.initializeForm();\n this.setControlsVisibility(this._currentConfig);\n }\n\n /**\n * Sets up handling for config changes\n */\n private setupConfigChangeHandling(): void {\n this.config$\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n skip(1), // Skip the initial emission\n debounceTime(100),\n tap(config => {\n if (!config) {\n return;\n }\n this.setControlsVisibility(config);\n\n // Update form values with new config\n if (this.form) {\n this.form.patchValue(config, { emitEvent: false });\n }\n })\n )\n .subscribe();\n }\n\n /**\n * Builds the reactive form\n */\n private initializeForm(): void {\n if (this.form) {\n return;\n }\n this.form = this.globalContextFormService.buildForm(this.config || {});\n }\n\n /**\n * Sets default display mode if not provided\n */\n private setDefaultDisplayMode(): void {\n if (!this.config || 'displayMode' in this.config) {\n return;\n }\n this.config.displayMode = GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n}\n","<!-- Main Controls -->\n@let isConfigMode = config?.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n@let settings = inlineControlsSettings$ | async;\n\n@if (form && settings) {\n <form\n class=\"d-flex gap-16 p-l-16 p-r-16 p-b-8 inner-scroll\"\n [formGroup]=\"form\"\n >\n <!-- Control Group Container -->\n <div class=\"input-group w-auto\">\n <!-- Aggregation Picker -->\n @if (settings.showAggregation) {\n <c8y-aggregation-picker\n formControlName=\"aggregation\"\n [resetToDefault]=\"true\"\n ></c8y-aggregation-picker>\n }\n\n <!-- Auto Refresh Controls -->\n @if (settings.showAutoRefresh) {\n <!-- Auto Refresh Toggle -->\n <c8y-auto-refresh-control\n [isLoading]=\"isLoading\"\n [disableCounter]=\"shouldDisableCounter\"\n formControlName=\"isAutoRefreshEnabled\"\n [autoRefreshSeconds]=\"form.get('refreshInterval')?.value\"\n ></c8y-auto-refresh-control>\n }\n\n @if (settings.showTimeContext) {\n @let isHistoryMode = form.get('refreshOption')?.value === REFRESH_OPTION.HISTORY;\n @let configValue =\n isHistoryMode\n ? {\n showDateTo: true,\n showDateFrom: true\n }\n : {\n showDateTo: false,\n showDateFrom: true\n };\n <c8y-date-time-context-picker\n style=\"margin-left: -1px\"\n formControlName=\"dateTimeContext\"\n [shouldDisableInterval]=\"shouldDisableCustomInterval\"\n [config]=\"configValue\"\n ></c8y-date-time-context-picker>\n }\n\n <!-- Manual Refresh Button -->\n @if (settings.showRefresh) {\n <div class=\"input-group-btn\">\n <button\n class=\"btn btn-default\"\n [attr.aria-label]=\"'Refresh' | translate\"\n [tooltip]=\"'Refresh' | translate\"\n placement=\"bottom\"\n type=\"button\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n [disabled]=\"isLoading\"\n >\n <i\n [class.icon-spin]=\"isLoading\"\n [c8yIcon]=\"'refresh'\"\n ></i>\n </button>\n </div>\n }\n </div>\n </form>\n}\n","// Export shared components\nexport * from './context-controls/context-controls.component';\nexport * from './preview-controls/preview-controls.component';\n","import { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, WidgetControls } from '../../models/global-context.model';\n\nexport const DEFAULT_WIDGET_TEMPLATE: WidgetControls = {\n supports: ['refreshOption', 'displayMode'],\n configSettings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: {},\n [REFRESH_OPTION.HISTORY]: {}\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showTimeContext: true,\n showAutoRefresh: true,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: { showTimeContext: true }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showTimeContext: true,\n showAutoRefresh: true,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: { showTimeContext: true }\n }\n },\n settings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: false\n },\n [REFRESH_OPTION.HISTORY]: { showTimeContext: false }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showRefresh: true,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true\n }\n }\n },\n defaultLinks: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: { isAutoRefreshEnabled: true, dateTimeContext: true },\n [REFRESH_OPTION.HISTORY]: { dateTimeContext: true }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {},\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {}\n }\n};\n","import { cloneDeep } from 'lodash-es';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport { LinkStatesMap } from '../../models/control-flow.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GlobalContextSettings,\n GlobalContextState,\n GlobalContextKeys,\n WidgetControls\n} from '../../models/global-context.model';\nimport { DEFAULT_WIDGET_TEMPLATE } from './default-widget-template';\n\nexport type WidgetFeature =\n | 'liveRefresh'\n | 'refreshInterval'\n | 'timeRange'\n | 'dataAggregation'\n | 'displayMode'\n | 'refreshOption'\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {}); // Allows custom strings while preserving autocomplete for known values\n\n/**\n * Maps user-friendly feature names to their corresponding GlobalContextState property names.\n *\n * This allows developers to use intuitive names like 'liveRefresh' in widget control definitions\n * instead of the actual internal property names like 'isAutoRefreshEnabled'.\n *\n * @example\n * ```ts\n * defineWidgetControls({ supports: ['liveRefresh'] });\n * // Internally maps to 'isAutoRefreshEnabled'\n * ```\n */\nexport const WIDGET_FEATURE_MAP: Record<string, string> = {\n liveRefresh: 'isAutoRefreshEnabled',\n refreshInterval: 'refreshInterval',\n timeRange: 'dateTimeContext',\n dataAggregation: 'aggregation',\n displayMode: 'displayMode',\n refreshOption: 'refreshOption'\n};\n\n/**\n * Hierarchical configuration for widget control visibility and behavior across different contexts.\n *\n * This interface defines control settings organized by:\n * - Display mode (dashboard/config/viewAndConfig)\n * - Refresh option (live/history)\n * - View context (inline/configuration)\n *\n * Each level can specify which controls to show/hide and their default link states to the\n * global context. The structure mirrors how widgets are rendered in different scenarios.\n *\n * @example\n * ```ts\n * const settings: WidgetControlSettings = {\n * dashboard: {\n * live: {\n * inline: { showRefresh: true, showRefreshInterval: false }\n * }\n * },\n * defaultLinks: {\n * dashboard: {\n * live: { dateTimeContext: true, aggregation: true }\n * }\n * }\n * };\n * ```\n */\nexport interface WidgetControlSettings {\n dashboard?: {\n live?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n history?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n };\n config?: {\n live?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n history?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n };\n viewAndConfig?: {\n live?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n history?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n };\n\n /**\n * Defines which widget config properties should be linked to global context by default.\n * When a property is linked (true), changes to the global context will automatically\n * update the widget's corresponding configuration value.\n */\n defaultLinks?: {\n dashboard?: {\n live?: LinkStatesMap;\n history?: LinkStatesMap;\n };\n config?: {\n live?: LinkStatesMap;\n history?: LinkStatesMap;\n };\n viewAndConfig?: {\n live?: LinkStatesMap;\n history?: LinkStatesMap;\n };\n };\n}\n\n/**\n * Handler function for dynamic widget control behavior based on widget state.\n *\n * Allows custom logic to transform control settings and link states based on the current\n * widget configuration. Handlers receive the widget state and return modified control\n * settings that determine which controls are visible and how they behave.\n *\n * Use cases:\n * - Conditionally show/hide controls based on widget config\n * - Modify default link states based on widget data\n * - Implement widget-specific control behavior\n *\n * @example\n * ```ts\n * const handler: WidgetControlHandler = {\n * handler: ({ config }) => {\n * // Hide aggregation control if widget has no series configured\n * const showAggregation = config?.datapoints?.length > 0;\n * return {\n * inlineControlSettings: { !showAggregation },\n * dashboardControlSettings: { showAggregation },\n * links: { aggregation: showAggregation }\n * };\n * }\n * };\n * ```\n */\nexport interface WidgetControlHandler {\n handler: (state: {\n config?: GlobalContextState;\n inlineControlSettings?: Partial<GlobalContextSettings>;\n dashboardControlSettings?: Partial<GlobalContextSettings>;\n currentLinks?: LinkStatesMap;\n }) => {\n inlineControlSettings: Partial<GlobalContextSettings>;\n dashboardControlSettings: Partial<GlobalContextSettings>;\n links: Partial<LinkStatesMap>;\n options?: { noAutoRefreshCounter?: boolean };\n };\n}\n\n/**\n * Creates a comprehensive widget controls configuration for global context integration.\n *\n * This factory function generates the complete control structure that determines how a widget\n * interacts with the global context (time range, aggregation, auto-refresh). It handles:\n * - Feature support declaration\n * - Control visibility across different display modes and refresh options\n * - Default linking behavior between widget and global context\n * - Dynamic control behavior through custom handlers\n *\n * @param config - Configuration object for widget controls\n * @param config.name - Optional identifier for debugging and documentation\n * @param config.extends - Base WidgetControls to extend from (inherits all features and settings)\n * @param config.supports - Array of features this widget supports (e.g., ['timeRange', 'dataAggregation'])\n * When extending, supports are merged with base supports\n * @param config.supportedModes - Optional array of supported refresh modes (live, history).\n * Restricts which modes are available in the configuration UI. Defaults to both modes if not specified.\n * @param config.settings - Hierarchical control settings organized by display mode, refresh option, and view context\n * @param config.handlers - Named functions for dynamic control behavior based on widget state\n * @param config.options - Additional options like noAutoRefreshCounter\n *\n * @returns Complete WidgetControls object ready for use in widget definitions\n *\n * @example\n * ```ts\n * // Simple widget with time range support\n * const controls = defineWidgetControls({\n * name: 'simple-widget',\n * supports: ['timeRange'],\n * settings: {\n * dashboard: {\n * live: {\n * inline: { showRefresh: true }\n * }\n * }\n * }\n * });\n *\n * // Widget that only supports live mode\n * const liveOnlyControls = defineWidgetControls({\n * name: 'realtime-widget',\n * supports: ['timeRange', 'liveRefresh'],\n * supportedModes: [REFRESH_OPTION.LIVE],\n * settings: {\n * dashboard: {\n * live: {\n * inline: { showRefresh: true, showRefreshInterval: true }\n * }\n * }\n * }\n * });\n *\n * // Advanced widget extending default with custom handler\n * const advancedControls = defineWidgetControls({\n * name: 'chart-widget',\n * extends: DEFAULT_WIDGET_TEMPLATE,\n * supports: ['timeRange', 'dataAggregation'],\n * handlers: {\n * onConfigChange: {\n * handler: ({ config }) => ({\n * inlineControlSettings: { showAggregation: config?.series?.length > 0 },\n * dashboardControlSettings: {},\n * links: {}\n * })\n * }\n * }\n * });\n * ```\n */\nexport function defineWidgetControls(config: {\n name?: string;\n extends?: WidgetControls;\n supports?: WidgetFeature[];\n supportedModes?: RefreshOption[];\n settings?: WidgetControlSettings;\n handlers?: Record<string, WidgetControlHandler>;\n options?: { noAutoRefreshCounter?: boolean };\n}): WidgetControls {\n const baseControls = config.extends\n ? cloneDeep(config.extends)\n : cloneDeep(DEFAULT_WIDGET_TEMPLATE);\n\n let mappedSupports: GlobalContextKeys;\n\n if (config.supports) {\n // First convert to a Set to handle potential duplicates\n const supportsSet = new Set(config.supports);\n\n // If liveRefresh is included, automatically add refreshInterval\n if (supportsSet.has('liveRefresh') && !supportsSet.has('refreshInterval')) {\n supportsSet.add('refreshInterval');\n }\n\n mappedSupports = Array.from(supportsSet).map(featureName => {\n return WIDGET_FEATURE_MAP[featureName as string] || featureName;\n }) as GlobalContextKeys;\n } else {\n mappedSupports = baseControls.supports;\n }\n\n const controls: WidgetControls = {\n ...baseControls,\n // When extending, merge the supports arrays instead of replacing\n supports: config.extends\n ? [...new Set([...baseControls.supports, ...mappedSupports])]\n : mappedSupports,\n supportedModes: config.supportedModes || baseControls.supportedModes,\n options: config.options || baseControls.options,\n configSettings: cloneDeep(baseControls.configSettings),\n settings: cloneDeep(baseControls.settings),\n defaultLinks: cloneDeep(baseControls.defaultLinks || {}),\n stateHandlers: {}\n };\n\n if (config.settings) {\n applySettings(controls, config.settings);\n }\n\n if (config.handlers) {\n controls.stateHandlers = processHandlers(config.handlers);\n }\n\n return controls;\n}\n\n/**\n * Transforms and applies hierarchical settings to the widget controls structure.\n *\n * Takes the simplified WidgetControlSettings format and distributes the configuration\n * across the complete WidgetControls structure, populating both inline (settings) and\n * configuration panel (configSettings) branches for each display mode and refresh option.\n *\n * This function also processes defaultLinks and ensures they are properly distributed\n * to match the control settings hierarchy.\n *\n * @param controls - The WidgetControls object to modify (mutated in place)\n * @param settings - The simplified settings configuration to apply\n *\n */\nfunction applySettings(controls: WidgetControls, settings: WidgetControlSettings): void {\n const modeMap = {\n dashboard: GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD,\n config: GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG,\n viewAndConfig: GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n };\n\n for (const [settingsKey, modeValue] of Object.entries(modeMap)) {\n const modeSettings = settings[settingsKey as keyof WidgetControlSettings];\n if (!modeSettings) continue;\n\n if (modeSettings['live']) {\n if (!controls.settings[modeValue]) controls.settings[modeValue] = {};\n if (!controls.settings[modeValue][REFRESH_OPTION.LIVE]) {\n controls.settings[modeValue][REFRESH_OPTION.LIVE] = {};\n }\n if (!controls.configSettings[modeValue]) controls.configSettings[modeValue] = {};\n if (!controls.configSettings[modeValue][REFRESH_OPTION.LIVE]) {\n controls.configSettings[modeValue][REFRESH_OPTION.LIVE] = {};\n }\n\n if (modeSettings['live'].inline) {\n controls.settings[modeValue][REFRESH_OPTION.LIVE] = {\n ...modeSettings['live'].inline\n };\n }\n\n if (modeSettings['live'].configuration) {\n controls.configSettings[modeValue][REFRESH_OPTION.LIVE] = {\n ...modeSettings['live'].configuration\n };\n }\n }\n\n if (modeSettings['history']) {\n if (!controls.settings[modeValue]) controls.settings[modeValue] = {};\n if (!controls.settings[modeValue][REFRESH_OPTION.HISTORY]) {\n controls.settings[modeValue][REFRESH_OPTION.HISTORY] = {};\n }\n if (!controls.configSettings[modeValue]) controls.configSettings[modeValue] = {};\n if (!controls.configSettings[modeValue][REFRESH_OPTION.HISTORY]) {\n controls.configSettings[modeValue][REFRESH_OPTION.HISTORY] = {};\n }\n\n if (modeSettings['history'].inline) {\n controls.settings[modeValue][REFRESH_OPTION.HISTORY] = {\n ...modeSettings['history'].inline\n };\n }\n\n if (modeSettings['history'].configuration) {\n controls.configSettings[modeValue][REFRESH_OPTION.HISTORY] = {\n ...modeSettings['history'].configuration\n };\n }\n }\n }\n\n if (settings.defaultLinks) {\n if (!controls.defaultLinks) controls.defaultLinks = {};\n\n for (const [settingsKey, modeValue] of Object.entries(modeMap)) {\n const modeLinks = settings.defaultLinks[settingsKey as keyof typeof settings.defaultLinks];\n if (!modeLinks) continue;\n\n if (!controls.defaultLinks[modeValue]) controls.defaultLinks[modeValue] = {};\n\n if (modeLinks['live']) {\n controls.defaultLinks[modeValue][REFRESH_OPTION.LIVE] = {\n ...modeLinks['live']\n };\n }\n\n if (modeLinks['history']) {\n controls.defaultLinks[modeValue][REFRESH_OPTION.HISTORY] = {\n ...modeLinks['history']\n };\n }\n }\n }\n}\n\n/**\n * Wraps user-defined handlers into the stateHandlers format expected by WidgetControls.\n *\n * This function transforms the simplified WidgetControlHandler format into the internal\n * stateHandlers structure. Each handler receives the current widget state and returns\n * modified control settings and link states.\n *\n * The wrapper ensures handlers are always invoked (even without widget state) and properly\n * propagates the widget state to the handler function for decision-making.\n *\n * @param handlers - Map of handler names to WidgetControlHandler definitions\n * @returns Map of handler names to wrapped functions compatible with WidgetControls.stateHandlers\n *\n */\nfunction processHandlers(\n handlers: Record<string, WidgetControlHandler>\n): WidgetControls['stateHandlers'] {\n const stateHandlers: WidgetControls['stateHandlers'] = {};\n\n for (const [name, handler] of Object.entries(handlers)) {\n stateHandlers[name] = (widgetState = {}) => {\n if (widgetState?.config) {\n return handler.handler(widgetState);\n }\n\n return handler.handler({});\n };\n }\n\n return stateHandlers;\n}\n","import { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, WidgetState } from '../../models/global-context.model';\n\n/**\n * Type alias for handler state parameter used in guards\n * Using WidgetState since GuardState is a subset of it\n */\nexport type GuardState = WidgetState;\n\n/**\n * Guard functions for widget control handlers.\n * These functions help determine conditions for when handlers should execute or return early.\n */\n\n/**\n * Check if the current display mode is dashboard\n */\nexport function isDashboard(state: GuardState): boolean {\n return state.config?.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n}\n\n/**\n * Check if the current display mode is config\n */\nexport function isConfig(state: GuardState): boolean {\n return state.config?.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n}\n\n/**\n * Check if the current display mode is view and config\n */\nexport function isViewAndConfig(state: GuardState): boolean {\n return state.config?.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG;\n}\n\n/**\n * Check if the current refresh option is history\n */\nexport function isHistory(state: GuardState): boolean {\n return state.config?.refreshOption === REFRESH_OPTION.HISTORY;\n}\n\n/**\n * Check if the current refresh option is live\n */\nexport function isLive(state: GuardState): boolean {\n return state.config?.refreshOption === REFRESH_OPTION.LIVE;\n}\n\n/**\n * Check if dateTimeContext is linked\n */\nexport function isDateTimeContextLinked(state: GuardState): boolean {\n return state.currentLinks?.dateTimeContext === true;\n}\n\n/**\n * Check if dateTimeContext is unlinked\n */\nexport function isDateTimeContextUnlinked(state: GuardState): boolean {\n return state.currentLinks?.dateTimeContext === false;\n}\n\n/**\n * Check if aggregation is linked\n */\nexport function isAggregationLinked(state: GuardState): boolean {\n return state.currentLinks?.aggregation === true;\n}\n\n/**\n * Check if aggregation is unlinked\n */\nexport function isAggregationUnlinked(state: GuardState): boolean {\n return state.currentLinks?.aggregation === false;\n}\n\n/**\n * Check if auto-refresh is enabled (linked)\n */\nexport function isAutoRefreshEnabled(state: GuardState): boolean {\n return state.currentLinks?.isAutoRefreshEnabled === true;\n}\n\n/**\n * Check if auto-refresh is disabled (unlinked)\n */\nexport function isAutoRefreshDisabled(state: GuardState): boolean {\n return state.currentLinks?.isAutoRefreshEnabled === false;\n}\n\n/**\n * Namespace for all guard functions\n */\nexport const guards = {\n isDashboard,\n isConfig,\n isViewAndConfig,\n isHistory,\n isLive,\n isDateTimeContextLinked,\n isDateTimeContextUnlinked,\n isAggregationLinked,\n isAggregationUnlinked,\n isAutoRefreshEnabled,\n isAutoRefreshDisabled\n} as const;\n","import { LinkStatesMap } from '../../models/control-flow.model';\nimport {\n GlobalContextSettings,\n WidgetState,\n WidgetStateHandlerResult\n} from '../../models/global-context.model';\nimport { guards } from './guards';\n\n/**\n * Updates both inline and dashboard control settings simultaneously.\n *\n * @param state - Current widget state containing existing settings\n * @param inlineUpdates - Settings to apply to inline display mode\n * @param dashboardUpdates - Settings to apply to dashboard display mode\n * @returns Updated inline and dashboard control settings\n */\nexport function updateBothSettings(\n state: WidgetState,\n inlineUpdates: Partial<GlobalContextSettings>,\n dashboardUpdates: Partial<GlobalContextSettings>\n): Pick<WidgetStateHandlerResult, 'inlineControlSettings' | 'dashboardControlSettings'> {\n return {\n inlineControlSettings: {\n ...state.inlineControlSettings,\n ...inlineUpdates\n },\n dashboardControlSettings: {\n ...state.dashboardControlSettings,\n ...dashboardUpdates\n }\n };\n}\n\n/**\n * Creates a standardized result object for widget state handler responses.\n *\n * @param inlineSettings - Settings for inline display mode\n * @param dashboardSettings - Settings for dashboard display mode\n * @param links - Optional link state mappings for control synchronization\n * @param options - Optional configuration like noAutoRefreshCounter\n * @returns Standardized widget state handler result\n */\nexport function createResult(\n inlineSettings: Partial<GlobalContextSettings>,\n dashboardSettings: Partial<GlobalContextSettings>,\n links: Partial<LinkStatesMap> = {},\n options?: Record<string, unknown>\n): WidgetStateHandlerResult {\n return {\n inlineControlSettings: inlineSettings,\n dashboardControlSettings: dashboardSettings,\n links,\n options\n };\n}\n\n/**\n * Sets auto-refresh link state for dashboard display mode.\n *\n * @param state - Current widget state\n * @param enabled - Whether auto-refresh should be linked to global context\n * @returns Updated link states (empty object for non-dashboard modes)\n */\nexport function setAutoRefreshLinks(state: WidgetState, enabled: boolean): Partial<LinkStatesMap> {\n // Only dashboard mode supports auto-refresh linking\n if (!guards.isDashboard(state)) {\n return {};\n }\n return {\n ...state.currentLinks,\n isAutoRefreshEnabled: enabled\n };\n}\n\n/**\n * Sets auto-refresh control visibility and link state based on display mode.\n *\n * Implements inverse visibility pattern: auto-refresh is shown in dashboard mode\n * (where it can be linked) and hidden in inline mode (where widgets handle it directly).\n *\n * @param state - Current widget state\n * @param showInDashboard - Whether to show auto-refresh control in dashboard mode (inverted for inline)\n * @returns Complete widget state handler result with settings and links\n */\nexport function setAutoRefreshControlsVisibility(\n state: WidgetState,\n showInDashboard: boolean\n): WidgetStateHandlerResult {\n const settings = updateBothSettings(\n state,\n {\n showAutoRefresh: !showInDashboard\n },\n {\n showAutoRefresh: showInDashboard\n }\n );\n\n return createResult(\n settings.inlineControlSettings,\n settings.dashboardControlSettings,\n setAutoRefreshLinks(state, showInDashboard)\n );\n}\n","import { cloneDeep, merge } from 'lodash-es';\n\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n type GlobalContextKeys,\n type WidgetControls,\n type WidgetState\n} from '../../models/global-context.model';\nimport { guards } from './guards';\nimport {\n createResult,\n setAutoRefreshControlsVisibility,\n updateBothSettings\n} from './update-helpers';\n\nexport type PartialWidgetControls = Partial<WidgetControls> & { supports?: GlobalContextKeys };\n\n/**\n * Baseline control template used by most widgets. Mirrors the alarm list\n * widget behaviour and serves as the foundation for additional presets.\n *\n * @returns Partial widget controls describing the baseline template.\n */\nexport function buildBaselineControls(): PartialWidgetControls {\n return {\n supports: [\n 'refreshOption',\n 'displayMode',\n 'dateTimeContext',\n 'isAutoRefreshEnabled',\n 'refreshInterval'\n ] as GlobalContextKeys,\n settings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showTimeContext: true,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showTimeContext: false,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showRefresh: true,\n showTimeContext: false\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showRefreshInterval: true,\n showTimeContext: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true\n }\n }\n },\n configSettings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showRefreshInterval: true,\n showTimeContext: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true,\n showAggregation: false\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showRefreshInterval: true,\n showTimeContext: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true,\n showAggregation: false\n }\n }\n },\n defaultLinks: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: {\n dateTimeContext: true,\n isAutoRefreshEnabled: true\n },\n [REFRESH_OPTION.HISTORY]: {\n dateTimeContext: true\n }\n }\n },\n stateHandlers: createAutoRefreshHandlers()\n };\n}\n\n/**\n * Adds aggregation visibility and default link behaviour on top of the\n * baseline template.\n *\n * @returns Partial widget controls that enable aggregation.\n */\nexport function buildAggregationExtensions(): PartialWidgetControls {\n return {\n supports: ['aggregation'] as GlobalContextKeys,\n settings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n }\n },\n configSettings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n }\n },\n defaultLinks: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.HISTORY]: {\n dateTimeContext: true,\n aggregation: true\n }\n }\n }\n };\n}\n\n/**\n * Returns a deep-merged copy of the baseline and supplied partial overrides,\n * unionising supported keys and concatenating handlers.\n *\n * @param base Source template to extend.\n * @param addition Additional partial overrides to apply.\n * @returns Combined partial controls.\n */\nexport function mergePartialControls(\n base: PartialWidgetControls,\n addition: PartialWidgetControls\n): PartialWidgetControls {\n const result: PartialWidgetControls = cloneDeep(base);\n\n if (addition.supports?.length) {\n const supports = new Set(result.supports ?? []);\n addition.supports.forEach(support => supports.add(support));\n result.supports = Array.from(supports) as GlobalContextKeys;\n }\n\n if (addition.options) {\n result.options = { ...(result.options ?? {}), ...addition.options };\n }\n\n if (addition.settings) {\n result.settings = merge({}, result.settings ?? {}, addition.settings);\n }\n\n if (addition.configSettings) {\n result.configSettings = merge({}, result.configSettings ?? {}, addition.configSettings);\n }\n\n if (addition.defaultLinks) {\n result.defaultLinks = merge({}, result.defaultLinks ?? {}, addition.defaultLinks);\n }\n\n if (addition.stateHandlers) {\n result.stateHandlers = {\n ...(result.stateHandlers ?? {}),\n ...addition.stateHandlers\n };\n }\n\n return result;\n}\n\n/**\n * Factory returning scroll-friendly auto-refresh handlers used by multiple\n * presets.\n *\n * @returns Handler map compatible with {@link WidgetControls.stateHandlers}.\n */\nexport function createAutoRefreshHandlers() {\n return {\n enableAutoRefresh: (state: WidgetState) => enableAutoRefreshHandler(state),\n disableAutoRefresh: (state: WidgetState) => disableAutoRefreshHandler(state)\n };\n}\n\nfunction enableAutoRefreshHandler(state: WidgetState) {\n if (\n guards.isDateTimeContextUnlinked(state) ||\n guards.isAutoRefreshEnabled(state) ||\n guards.isHistory(state)\n ) {\n return createResult(\n state.inlineControlSettings ?? {},\n state.dashboardControlSettings ?? {},\n state.currentLinks ?? {}\n );\n }\n\n if (guards.isConfig(state) || guards.isViewAndConfig(state)) {\n const settings = updateBothSettings(\n state,\n { showAutoRefresh: true, showRefreshInterval: false },\n { showAutoRefresh: false }\n );\n return createResult(settings.inlineControlSettings, settings.dashboardControlSettings, {});\n }\n\n return setAutoRefreshControlsVisibility(state, true);\n}\n\nfunction disableAutoRefreshHandler(state: WidgetState) {\n if (guards.isAutoRefreshDisabled(state) || guards.isHistory(state)) {\n return createResult(\n state.inlineControlSettings ?? {},\n state.dashboardControlSettings ?? {},\n state.currentLinks ?? {}\n );\n }\n\n return setAutoRefreshControlsVisibility(state, false);\n}\n","import { cloneDeep } from 'lodash-es';\n\nimport { type WidgetControls } from '../../models/global-context.model';\nimport { DEFAULT_WIDGET_TEMPLATE } from './default-widget-template';\nimport {\n buildAggregationExtensions,\n buildBaselineControls,\n createAutoRefreshHandlers,\n mergePartialControls,\n type PartialWidgetControls\n} from './widget-controls-presets.helpers';\n\n/**\n * Identifier for a built-in widget controls preset. Each preset encapsulates a\n * reusable configuration that can be composed with others.\n */\nexport type WidgetPresetName = 'default' | 'defaultWithAggregation' | 'scrollHandlers';\n\n/**\n * Union describing how presets can be selected. Consumers can provide an\n * ordered array (preserving order of application) or a flag map where truthy\n * entries are included in insertion order.\n */\nexport type WidgetPresetSelection = WidgetPresetName[] | Partial<Record<WidgetPresetName, boolean>>;\n\n/** Structure supplied when presets should be expanded into `WidgetControls`. */\nexport interface WidgetControlsPresetConfig {\n presets: WidgetPresetSelection;\n customize?: (controls: WidgetControls) => WidgetControls;\n}\n\ntype WidgetControlsPresetDefinition = {\n name: WidgetPresetName;\n exclusiveGroup?: string;\n build: () => PartialWidgetControls;\n};\n\nconst PRESET_REGISTRY: Record<WidgetPresetName, WidgetControlsPresetDefinition> = {\n default: {\n name: 'default',\n exclusiveGroup: 'baseline',\n build: () => buildBaselineControls()\n },\n defaultWithAggregation: {\n name: 'defaultWithAggregation',\n exclusiveGroup: 'baseline',\n build: () => mergePartialControls(buildBaselineControls(), buildAggregationExtensions())\n },\n scrollHandlers: {\n name: 'scrollHandlers',\n build: () => ({ stateHandlers: createAutoRefreshHandlers() })\n }\n};\n\nexport function resolveWidgetControlsInput(\n input: WidgetControls | WidgetControlsPresetConfig\n): WidgetControls {\n if (isPresetConfig(input)) {\n return buildWidgetControlsFromPresets(input);\n }\n return input;\n}\n\n/**\n * Creates a fully hydrated {@link WidgetControls} by expanding the selected\n * presets (and optional customiser) against the default template.\n *\n * @param config Preset selection descriptor optionally providing a customize hook.\n * @returns Fully merged widget controls ready for consumption.\n */\nexport function buildWidgetControlsFromPresets(config: WidgetControlsPresetConfig): WidgetControls {\n const presetNames = normalizePresetSelection(config.presets);\n const definitions = presetNames.map(resolvePreset);\n\n warnForExclusiveConflicts(definitions);\n\n let built: WidgetControls = definitions.reduce<WidgetControls>((controls, definition) => {\n return mergeWidgetControls(controls, definition.build());\n }, cloneDeep(DEFAULT_WIDGET_TEMPLATE));\n\n if (config.customize) {\n built = config.customize(built);\n }\n\n return cloneDeep(built);\n}\n\n/**\n * Merges partial control metadata into a cloned base instance, unionising the\n * supported keys array and deep-merging nested settings/link structures.\n *\n * @param base Starting widget controls template.\n * @param addition Partial controls to merge into the template.\n * @returns Combined widget controls instance.\n */\nfunction mergeWidgetControls(\n base: WidgetControls,\n addition: PartialWidgetControls\n): WidgetControls {\n // Reuse the existing mergePartialControls function to avoid code duplication\n return mergePartialControls(base as PartialWidgetControls, addition) as WidgetControls;\n}\n\n/**\n * Normalises caller input to a deduplicated, ordered preset array.\n *\n * @param selection Value supplied to the presets API.\n * @returns Ordered list of preset identifiers without duplicates.\n */\nfunction normalizePresetSelection(selection: WidgetPresetSelection): WidgetPresetName[] {\n if (Array.isArray(selection)) {\n return dedupe(selection);\n }\n\n return dedupe(\n Object.entries(selection)\n .filter(([, enabled]) => Boolean(enabled))\n .map(([name]) => name as WidgetPresetName)\n );\n}\n\n/**\n * Removes duplicate preset names while preserving the first occurrence.\n *\n * @param values Sequence of preset identifiers.\n * @returns Deduplicated preset array.\n */\nfunction dedupe(values: WidgetPresetName[]): WidgetPresetName[] {\n const seen = new Set<WidgetPresetName>();\n const ordered: WidgetPresetName[] = [];\n\n for (const value of values) {\n if (!seen.has(value)) {\n ordered.push(value);\n seen.add(value);\n }\n }\n\n return ordered;\n}\n\n/**\n * Retrieves the preset definition or throws if it does not exist.\n *\n * @param name Name of the preset to resolve.\n * @returns Preset definition from the registry.\n */\nfunction resolvePreset(name: WidgetPresetName): WidgetControlsPresetDefinition {\n const definition = PRESET_REGISTRY[name];\n\n if (!definition) {\n throw new Error(`Unknown widget controls preset: ${name}`);\n }\n\n return definition;\n}\n\n/**\n * Emits a console warning whenever multiple presets from the same\n * `exclusiveGroup` are composed, signalling that later presets override\n * earlier ones.\n *\n * @param definitions Preset definitions selected for the current build.\n */\nfunction warnForExclusiveConflicts(definitions: WidgetControlsPresetDefinition[]): void {\n const groups = new Map<string, string>();\n\n definitions.forEach(definition => {\n if (!definition.exclusiveGroup) {\n return;\n }\n\n if (groups.has(definition.exclusiveGroup)) {\n const existing = groups.get(definition.exclusiveGroup);\n console.warn(\n `Widget controls preset \"${definition.name}\" overrides preset \"${existing}\" (exclusive group: ${definition.exclusiveGroup}).`\n );\n }\n\n groups.set(definition.exclusiveGroup, definition.name);\n });\n}\n\nfunction isPresetConfig(\n input: WidgetControls | WidgetControlsPresetConfig\n): input is WidgetControlsPresetConfig {\n return typeof (input as WidgetControlsPresetConfig)?.presets !== 'undefined';\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n ContentChild,\n DestroyRef,\n effect,\n EventEmitter,\n inject,\n input,\n OnInit,\n Output,\n signal,\n TemplateRef,\n untracked,\n ViewChild,\n WritableSignal\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { DashboardChildComponent } from '@c8y/ngx-components';\nimport { isEmpty, merge, pick } from 'lodash-es';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { Subject, throttleTime } from 'rxjs';\nimport { GlobalContextInlineComponent } from '../../core/global-context-inline.component';\nimport { GlobalContextWidgetConfigComponent } from '../../core/global-context-widget-config.component';\nimport { TIMING } from '../../models/constants';\nimport type { LinkStatesMap } from '../../models/control-flow.model';\nimport type {\n GlobalContextEvent,\n GlobalContextState,\n WidgetControls,\n WidgetDisplayMode\n} from '../../models/global-context.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n WIDGET_DISPLAY_MODE\n} from '../../models/global-context.model';\nimport { GlobalContextUtilsService } from '../../services/infrastructure/global-context-utils.service';\nimport { PreviewControlsComponent } from '../../shared/preview-controls';\nimport {\n formatDateTimeContextForEmission,\n isCompleteDateTimeContext\n} from '../../utils/global-context-defaults.util';\nimport { resolveWidgetControlsInput, type WidgetControlsPresetConfig } from '../widget-controls';\nimport { REFRESH_OPTION } from '../../models';\n\n@Component({\n selector: 'c8y-global-context-widget-wrapper',\n host: { class: 'sticky-top bg-component d-block min-width-0' },\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n GlobalContextInlineComponent,\n GlobalContextWidgetConfigComponent,\n NgTemplateOutlet,\n ReactiveFormsModule,\n PopoverModule,\n PreviewControlsComponent\n ],\n template: `\n @if (widgetControls()) {\n @let GLOBAL_CONTEXT_CONFIG = internalConfig();\n @let INLINE = WIDGET_DISPLAY_MODE.INLINE;\n @let CONFIG = WIDGET_DISPLAY_MODE.CONFIG;\n @let PREVIEW = WIDGET_DISPLAY_MODE.PREVIEW;\n @let DISPLAY_MODE = GLOBAL_CONTEXT_CONFIG?.displayMode;\n @let DASHBOARD = GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n\n @switch (displayMode()) {\n @case (INLINE) {\n <c8y-global-context-inline\n #globalContextInlineRef=\"globalContextInline\"\n [config]=\"GLOBAL_CONTEXT_CONFIG\"\n [widgetControls]=\"widgetControls()\"\n [isLoading]=\"isLoading()\"\n [dashboardChildForLegacy]=\"dashboardChildForLegacy()\"\n (refresh)=\"onRefresh()\"\n (globalContextChange)=\"onGlobalContextChange($event)\"\n >\n <ng-content></ng-content>\n <ng-container\n id=\"header\"\n [ngTemplateOutlet]=\"widgetHeaderRef\"\n [ngTemplateOutletInjector]=\"globalContextInlineRef.injector\"\n ></ng-container>\n <ng-container\n id=\"body\"\n [ngTemplateOutlet]=\"widgetBodyRef\"\n [ngTemplateOutletInjector]=\"globalContextInlineRef.injector\"\n ></ng-container>\n </c8y-global-context-inline>\n }\n @case (CONFIG) {\n <c8y-global-context-widget-config\n [config]=\"GLOBAL_CONTEXT_CONFIG\"\n [widgetControls]=\"widgetControls()\"\n [isLoading]=\"isLoading()\"\n (refresh)=\"onRefresh()\"\n (globalContextChange)=\"onGlobalContextChange($event)\"\n ></c8y-global-context-widget-config>\n }\n @case (PREVIEW) {\n <c8y-preview-controls\n [config]=\"GLOBAL_CONTEXT_CONFIG\"\n [widgetControls]=\"widgetControls()\"\n ></c8y-preview-controls>\n }\n }\n }\n `\n})\nexport class GlobalContextWidgetWrapperComponent implements OnInit {\n @ContentChild('widgetBody') widgetBodyRef!: TemplateRef<unknown>;\n @ContentChild('widgetHeader') widgetHeaderRef!: TemplateRef<unknown>;\n @ViewChild(GlobalContextInlineComponent)\n globalContextInlineComponent!: GlobalContextInlineComponent;\n\n // --- Services ---\n private readonly destroyRef = inject(DestroyRef);\n private readonly globalContextUtilsService = inject(GlobalContextUtilsService);\n\n // --- Inputs ---\n isLoading = input(false);\n displayMode = input<WidgetDisplayMode>(WIDGET_DISPLAY_MODE.INLINE);\n readonly widgetControlsConfig = input.required<WidgetControls | WidgetControlsPresetConfig>({\n alias: 'widgetControls'\n });\n widgetControls = computed(() => resolveWidgetControlsInput(this.widgetControlsConfig()));\n controlLinks = input<LinkStatesMap>({});\n dashboardChildForLegacy = input<DashboardChildComponent>();\n config = input<GlobalContextState>({});\n\n // --- State Management ---\n internalConfig: WritableSignal<GlobalContextState> = signal({});\n // Latest global snapshot cached for child config updates on mode change\n private widgetInitialConfig: GlobalContextState | null = null;\n // Last emitted state - used for diff calculation to avoid race conditions\n private lastEmittedState: WritableSignal<GlobalContextState> = signal({});\n\n // --- Outputs ---\n @Output() globalContextChange = new EventEmitter<GlobalContextEvent>();\n private readonly contextChangeSubject = new Subject<{\n context: GlobalContextState;\n diff: GlobalContextState;\n }>();\n\n // --- Constants for Template Binding ---\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n readonly WIDGET_DISPLAY_MODE = WIDGET_DISPLAY_MODE;\n\n constructor() {\n // Effect to reactively handle changes to the `config` input signal.\n effect(() => {\n const newConfig = this.config();\n // This effect runs whenever the `config` input changes.\n // `untracked` prevents the effect from re-running when `internalConfig` is updated inside the handler.\n untracked(() => this.handleConfigChange(newConfig));\n });\n }\n\n ngOnInit(): void {\n this.contextChangeSubject\n .pipe(throttleTime(TIMING.CONTEXT_THROTTLE), takeUntilDestroyed(this.destroyRef))\n .subscribe(({ context, diff }) => {\n this.globalContextChange.emit(structuredClone({ context, diff }));\n });\n }\n\n /**\n * Update dateTimeContext for internal widget interactions (e.g., slider drag).\n * This bypasses the config propagation logic and directly updates the inline component state.\n */\n updateDateTimeContext(dateTimeContext: any): void {\n this.globalContextInlineComponent?.updateDateTimeContext(dateTimeContext);\n }\n\n /**\n * Directly toggle all link controls to linked or unlinked state.\n * All controls are always toggled together as a unified group.\n *\n * @param isLinked - True to link all controls, false to unlink all controls\n * @param suppressRefresh - True to prevent refresh emission (data already loaded)\n * @param suppressEmit - True to prevent configuration change emission\n */\n toggleAllLinks(isLinked: boolean, suppressRefresh?: boolean, suppressEmit?: boolean): void {\n this.globalContextInlineComponent?.toggleAllLinks(isLinked, suppressRefresh, suppressEmit);\n }\n\n /**\n * Pause auto-refresh and unlink all controls from global context.\n * Useful when user is interacting with the widget (e.g., scrolling through a list)\n * and you want to prevent automatic updates.\n *\n * This does two things:\n * 1. Sets isAutoRefreshEnabled to false (stops the auto-refresh timer)\n * 2. Unlinks all controls (dateTimeContext, aggregation, isAutoRefreshEnabled)\n * from global context as they work as a unified group\n */\n pauseAutoRefresh(): void {\n this.globalContextInlineComponent?.pauseAutoRefresh();\n }\n\n /**\n * Resume auto-refresh and re-link all controls to global context.\n * Useful when user has finished interacting with the widget (e.g., scrolled back to top)\n * and you want to re-enable automatic updates.\n *\n * This does two things:\n * 1. Sets isAutoRefreshEnabled to true (starts the auto-refresh timer)\n * 2. Links all controls (dateTimeContext, aggregation, isAutoRefreshEnabled)\n * to global context as they work as a unified group\n */\n resumeAutoRefresh(): void {\n this.globalContextInlineComponent?.resumeAutoRefresh();\n }\n\n onGlobalContextChange(context: GlobalContextState): void {\n const template = this.widgetControls();\n\n // OVERRIDE CONTROLS BASED ON WIDGET MODE\n // Ensure aggregation is null in live mode BEFORE calculating diff\n // TODO: consider updating inline component to handle this logic.\n // Edge case: widget supports aggregation. In history mode, user selects aggregation different than null.\n // Then switches to live mode.\n // Second scenario: legacy widget migration where aggregation was set in config.\n const normalizedContext = { ...context };\n if (normalizedContext.refreshOption === REFRESH_OPTION.LIVE) {\n normalizedContext.aggregation = null;\n }\n\n // Use lastEmittedState instead of internalConfig to avoid race conditions\n // where handleConfigChange updates internalConfig before the inline component emits\n const previousState = this.lastEmittedState();\n const diff = this.globalContextUtilsService.getChangedFields(previousState, normalizedContext);\n\n const filteredContext = pick(normalizedContext, template.supports);\n const filteredDiff = pick(diff, template.supports);\n const formattedContext = formatDateTimeContextForEmission(filteredContext, template.supports);\n\n // Update lastEmittedState to track what we just emitted\n this.lastEmittedState.set(formattedContext);\n // Also update internalConfig to keep it in sync (for backward compatibility)\n this.internalConfig.update(cfg => ({ ...cfg, ...formattedContext }));\n this.contextChangeSubject.next({ context: formattedContext, diff: filteredDiff });\n }\n\n onRefresh(): void {\n this.onGlobalContextChange(this.internalConfig());\n }\n\n /**\n * Handles incoming config changes from the input, calculates the diff,\n * and updates the internal state.\n */\n private handleConfigChange(config: GlobalContextState): void {\n const controls = this.widgetControls();\n if (isEmpty(config) || !controls) {\n return;\n }\n\n const newState = pick(config, controls.supports);\n const diff = this.globalContextUtilsService.getChangedFields(this.internalConfig(), newState);\n\n const processedDiff = this._processConfigDiff(diff);\n if (isEmpty(processedDiff)) {\n return;\n }\n\n // Update the signal state immutably.\n this.internalConfig.update(cfg => merge({}, cfg, processedDiff));\n\n // the widget enters config mode. This provides a consistent \"reset\" point for the user.\n if (!this.widgetInitialConfig && this.displayMode() === WIDGET_DISPLAY_MODE.CONFIG) {\n this.widgetInitialConfig = structuredClone(this.internalConfig());\n }\n }\n\n /**\n * Pure helper function to process the configuration diff, applying special business\n * logic, like handling incomplete dateTimeContext.\n */\n private _processConfigDiff(diff: Partial<GlobalContextState>): Partial<GlobalContextState> {\n if (isEmpty(diff)) {\n return {};\n }\n\n // Preserves the critical business logic of preventing updates from an incomplete date-time range.\n if (!isCompleteDateTimeContext(diff)) {\n const { dateTimeContext: _dateTimeContext, ...restDiff } = diff;\n return restDiff;\n }\n\n return diff;\n }\n}\n","import { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GlobalContextDisplayMode,\n GlobalContextSettings\n} from '../../models/global-context.model';\n\nexport type DisplayMode = GlobalContextDisplayMode;\n\n/** Context control feature constants for type-safe access */\nexport const CONTEXT_FEATURE = {\n /** Time range selector for live mode (relative time window that moves with current time) */\n LIVE_TIME: 'liveTime',\n /** Time range selector for history mode (fixed date range for historical analysis) */\n HISTORY_TIME: 'historyTime',\n /** Data aggregation options (hourly, daily, etc.) - history mode only */\n AGGREGATION: 'aggregation',\n /** Auto-refresh toggle (fixed 5s interval) - live mode only */\n AUTO_REFRESH: 'autoRefresh',\n /** Manual refresh button */\n REFRESH: 'refresh'\n} as const;\n\nexport type ContextFeature = (typeof CONTEXT_FEATURE)[keyof typeof CONTEXT_FEATURE];\n\n/** Preset name constants for type-safe access */\nexport const PRESET_NAME = {\n DEFAULT: 'default',\n ALARM_LIST: 'alarmList',\n CHART: 'chart',\n LIVE_ONLY: 'liveOnly',\n HISTORY_ONLY: 'historyOnly',\n ALARM_LIST_CONFIG: 'alarmListConfig',\n ALARM_LIST_LEGACY: 'alarmListLegacy'\n} as const;\n\nexport type PresetName = (typeof PRESET_NAME)[keyof typeof PRESET_NAME];\n\nexport type PresetDefinition = {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: ContextFeature[];\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: ContextFeature[];\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: ContextFeature[];\n};\n\n/** Control presets for different widget types (mode constraints applied by applyModeConstraints) */\nexport const CONTROL_PRESETS: Record<PresetName, PresetDefinition> = {\n /** Full-featured preset for most widgets (supports both live and history modes) */\n [PRESET_NAME.DEFAULT]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [CONTEXT_FEATURE.LIVE_TIME, CONTEXT_FEATURE.HISTORY_TIME, CONTEXT_FEATURE.AUTO_REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH,\n CONTEXT_FEATURE.AGGREGATION,\n CONTEXT_FEATURE.REFRESH\n ]\n },\n\n /** For alarm/event lists (supports both live and history modes) */\n [PRESET_NAME.ALARM_LIST]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [CONTEXT_FEATURE.AUTO_REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ]\n },\n\n /** For alarm/event lists in config mode (supports both live and history modes with time in config) */\n [PRESET_NAME.ALARM_LIST_CONFIG]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH,\n CONTEXT_FEATURE.AGGREGATION\n ],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ]\n },\n\n /** For charts with aggregation support (supports both live and history modes) */\n [PRESET_NAME.CHART]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [CONTEXT_FEATURE.LIVE_TIME, CONTEXT_FEATURE.HISTORY_TIME, CONTEXT_FEATURE.AUTO_REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AGGREGATION,\n CONTEXT_FEATURE.AUTO_REFRESH,\n CONTEXT_FEATURE.REFRESH\n ]\n },\n\n /** For live-only widgets (no history mode support) */\n [PRESET_NAME.LIVE_ONLY]: {\n dashboard: [CONTEXT_FEATURE.LIVE_TIME, CONTEXT_FEATURE.AUTO_REFRESH],\n config: [CONTEXT_FEATURE.LIVE_TIME, CONTEXT_FEATURE.AUTO_REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH,\n CONTEXT_FEATURE.REFRESH\n ]\n },\n\n /** For history-only widgets (no live mode support) */\n [PRESET_NAME.HISTORY_ONLY]: {\n dashboard: [CONTEXT_FEATURE.HISTORY_TIME],\n config: [CONTEXT_FEATURE.HISTORY_TIME, CONTEXT_FEATURE.AGGREGATION],\n view_and_config: [\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AGGREGATION,\n CONTEXT_FEATURE.REFRESH\n ]\n },\n [PRESET_NAME.ALARM_LIST_LEGACY]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [CONTEXT_FEATURE.AUTO_REFRESH, CONTEXT_FEATURE.REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ]\n }\n};\n\n/**\n * Apply mode constraints (hard rules) to filter controls based on refresh option.\n *\n * @param controls - Array of control features\n * @param refreshOption - Current refresh option (REFRESH_OPTION.LIVE or REFRESH_OPTION.HISTORY)\n * @returns Filtered array with mode constraints applied\n */\nexport function applyModeConstraints(\n controls: ContextFeature[],\n refreshOption: RefreshOption\n): ContextFeature[] {\n if (refreshOption === REFRESH_OPTION.HISTORY) {\n // History mode: no auto-refresh, no live time\n return controls.filter(\n c => c !== CONTEXT_FEATURE.AUTO_REFRESH && c !== CONTEXT_FEATURE.LIVE_TIME\n );\n }\n if (refreshOption === REFRESH_OPTION.LIVE) {\n // Live mode: no aggregation, no history time\n return controls.filter(\n c => c !== CONTEXT_FEATURE.AGGREGATION && c !== CONTEXT_FEATURE.HISTORY_TIME\n );\n }\n return controls;\n}\n\n/**\n * Get supported modes from a preset definition.\n * Modes are derived from features:\n * - LIVE mode: supported if preset has AUTO_REFRESH (LIVE_TIME is optional)\n * - HISTORY mode: supported if preset has HISTORY_TIME\n *\n * @param controls - Preset name or definition\n * @param displayMode - Current display mode\n * @returns Array of supported refresh options\n */\nexport function getSupportedModes(\n controls: PresetName | PresetDefinition,\n displayMode: DisplayMode\n): RefreshOption[] {\n const presetDef = typeof controls === 'string' ? CONTROL_PRESETS[controls] : controls;\n const features = presetDef[displayMode];\n const modes: RefreshOption[] = [];\n\n // Support LIVE if has autoRefresh (with optional liveTime)\n if (features.includes(CONTEXT_FEATURE.AUTO_REFRESH)) {\n modes.push(REFRESH_OPTION.LIVE);\n }\n\n // Support HISTORY if has historyTime\n if (features.includes(CONTEXT_FEATURE.HISTORY_TIME)) {\n modes.push(REFRESH_OPTION.HISTORY);\n }\n\n // Fallback to LIVE if no mode features detected\n return modes.length > 0 ? modes : [REFRESH_OPTION.LIVE];\n}\n\n/**\n * Convert controls preset to GlobalContextSettings for registration.\n */\nexport function controlsToSettings(\n controls: PresetName | PresetDefinition,\n displayMode: DisplayMode,\n refreshOption: RefreshOption\n): Partial<GlobalContextSettings> {\n const presetDef = typeof controls === 'string' ? CONTROL_PRESETS[controls] : controls;\n const activeControls = applyModeConstraints(presetDef[displayMode], refreshOption);\n\n return {\n showTimeContext:\n activeControls.includes(CONTEXT_FEATURE.LIVE_TIME) ||\n activeControls.includes(CONTEXT_FEATURE.HISTORY_TIME),\n showAutoRefresh: activeControls.includes(CONTEXT_FEATURE.AUTO_REFRESH),\n showRefreshInterval: false,\n showAggregation: activeControls.includes(CONTEXT_FEATURE.AGGREGATION),\n showRefresh: activeControls.includes(CONTEXT_FEATURE.REFRESH)\n };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n inject,\n input,\n OnInit,\n output,\n signal,\n untracked\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe } from '@c8y/ngx-components';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { ConfigContextSelectorComponent } from '../../features/configuration/config-context-selector';\nimport { ConfigurationControlsComponent } from '../../features/configuration/configuration-controls/configuration-controls.component';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GLOBAL_CONTEXT_EVENTS,\n GlobalContextDisplayMode,\n GlobalContextState\n} from '../../models/global-context.model';\nimport { GlobalContextUtilsService } from '../../services/infrastructure/global-context-utils.service';\nimport { GlobalContextEventService } from '../../services/state/global-context-event.service';\nimport {\n controlsToSettings,\n getSupportedModes,\n PRESET_NAME,\n PresetDefinition,\n PresetName\n} from '../presets/control-presets';\n\n@Component({\n selector: 'c8y-config-mode-controls',\n standalone: true,\n imports: [\n ReactiveFormsModule,\n ConfigContextSelectorComponent,\n ConfigurationControlsComponent,\n C8yTranslatePipe,\n PopoverModule\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <form>\n <fieldset class=\"c8y-fieldset\">\n <legend>\n {{ 'Time context' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"\n 'Sync with dashboard settings or set independent time controls for this widget.'\n | translate\n \"\n placement=\"right\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-config-context-selector\n [formControl]=\"displayModeControl\"\n ></c8y-config-context-selector>\n </fieldset>\n </form>\n\n @if (displayMode() !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n <fieldset class=\"c8y-fieldset p-l-0 p-r-0 p-t-16\">\n <legend class=\"m-l-16\">{{ 'Widget time context' | translate }}</legend>\n <c8y-configuration-controls\n [settings]=\"settings()\"\n [controlsDisplayMode]=\"'horizontal'\"\n [tabsOutletName]=\"'verticalTabOutletForConfigurationModes'\"\n [activeMode]=\"refreshOption()\"\n [liveContext]=\"liveState()\"\n [historyContext]=\"historyState()\"\n [supportedModes]=\"supportedModes()\"\n (contextChange)=\"onConfigurationChange($event)\"\n (refreshOptionChange)=\"onRefreshOptionChange($event)\"\n ></c8y-configuration-controls>\n </fieldset>\n }\n `\n})\nexport class ConfigModeControls implements OnInit {\n private readonly destroyRef = inject(DestroyRef);\n private readonly globalContextUtils = inject(GlobalContextUtilsService);\n private readonly globalContextEventService = inject(GlobalContextEventService);\n\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n config = input.required<GlobalContextState>();\n\n configChange = output<{ context: GlobalContextState; diff: GlobalContextState }>();\n\n displayModeControl = new FormControl<GlobalContextDisplayMode>(\n GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD,\n { nonNullable: true }\n );\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n\n displayMode = signal<GlobalContextDisplayMode>(GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD);\n refreshOption = signal<RefreshOption>(REFRESH_OPTION.LIVE);\n liveState = signal<GlobalContextState | null>(null);\n historyState = signal<GlobalContextState | null>(null);\n private lastEmittedContext = signal<GlobalContextState>({});\n\n settings = computed(() =>\n controlsToSettings(this.controls(), this.displayMode(), this.refreshOption())\n );\n\n supportedModes = computed(() => getSupportedModes(this.controls(), this.displayMode()));\n\n constructor() {\n // Sync with incoming config\n effect(() => {\n const cfg = this.config();\n if (!cfg) return;\n\n untracked(() => {\n const mode =\n (cfg.displayMode as GlobalContextDisplayMode) ?? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n if (this.displayModeControl.value !== mode) {\n this.displayModeControl.setValue(mode, { emitEvent: false });\n this.displayMode.set(mode);\n }\n\n const refreshOpt = cfg.refreshOption ?? REFRESH_OPTION.LIVE;\n this.refreshOption.set(refreshOpt);\n\n if (refreshOpt === REFRESH_OPTION.LIVE) {\n this.liveState.set({ ...cfg });\n } else {\n this.historyState.set({ ...cfg });\n }\n\n this.lastEmittedContext.set(cfg);\n });\n });\n }\n\n ngOnInit(): void {\n this.displayModeControl.valueChanges\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(mode => {\n this.displayMode.set(mode);\n this.emitForDisplayMode(mode);\n });\n\n this.emitInitialState();\n }\n\n onRefreshOptionChange(option: RefreshOption): void {\n this.refreshOption.set(option);\n const snapshot = option === REFRESH_OPTION.LIVE ? this.liveState() : this.historyState();\n\n const context: GlobalContextState = {\n ...(snapshot ?? this.config()),\n refreshOption: option,\n displayMode: this.displayMode(),\n aggregation: option === REFRESH_OPTION.LIVE ? null : (snapshot ?? this.config()).aggregation\n };\n\n this.emit(context);\n }\n\n onConfigurationChange(changes: Partial<GlobalContextState>): void {\n const context: GlobalContextState = {\n ...this.config(),\n ...changes,\n refreshOption: this.refreshOption(),\n displayMode: this.displayMode()\n };\n\n // Update snapshot for current mode\n if (this.refreshOption() === REFRESH_OPTION.LIVE) {\n this.liveState.set({ ...context });\n } else {\n this.historyState.set({ ...context });\n }\n\n this.emit(context);\n }\n\n private emitInitialState(): void {\n const cfg = this.config();\n if (!cfg) return;\n\n const mode =\n (cfg.displayMode as GlobalContextDisplayMode) ?? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n const context: GlobalContextState =\n mode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n ? this.getGlobalContextState(mode)\n : { ...cfg, isGlobalContextReady: true };\n\n this.lastEmittedContext.set(context);\n this.configChange.emit({ context, diff: context });\n }\n\n private emitForDisplayMode(mode: GlobalContextDisplayMode): void {\n if (mode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n this.emit(this.getGlobalContextState(mode));\n } else {\n const snapshot =\n this.refreshOption() === REFRESH_OPTION.LIVE ? this.liveState() : this.historyState();\n this.emit({ ...(snapshot ?? this.config()), displayMode: mode, isGlobalContextReady: true });\n }\n }\n\n private emit(context: GlobalContextState): void {\n const diff = this.globalContextUtils.getChangedFields(this.lastEmittedContext(), context);\n if (Object.keys(diff).length === 0) return;\n\n this.lastEmittedContext.set(context);\n this.configChange.emit({ context, diff });\n }\n\n private getGlobalContextState(mode: GlobalContextDisplayMode): GlobalContextState {\n const globalState = this.globalContextEventService.getLatestValue(\n GLOBAL_CONTEXT_EVENTS.STATE_CHANGE\n ) as GlobalContextState | undefined;\n\n return globalState\n ? {\n displayMode: mode,\n dateTimeContext: globalState.dateTimeContext,\n refreshOption: globalState.refreshOption,\n aggregation: globalState.aggregation,\n isAutoRefreshEnabled: globalState.isAutoRefreshEnabled,\n refreshInterval: globalState.refreshInterval,\n isGlobalContextReady: true\n }\n : { displayMode: mode, isGlobalContextReady: true };\n }\n}\n","import { Component, computed, effect, inject, input, output, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { AggregationPickerComponent } from '../../features/aggregation/aggregation-picker/aggregation-picker.component';\nimport { AutoRefreshControlComponent } from '../../features/refresh/auto-refresh/auto-refresh-control.component';\nimport { DateTimeContextPickerComponent } from '../../features/time-context/time-range-picker/date-time-context-picker.component';\nimport { AggregationOptionStatus } from '../../models/aggregation.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GlobalContextState } from '../../models/global-context.model';\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport { AggregationValidationService } from '../../services/domain/aggregation-validation.service';\nimport { GlobalContextUtilsService } from '../../services/infrastructure/global-context-utils.service';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\nimport {\n applyModeConstraints,\n CONTEXT_FEATURE,\n CONTROL_PRESETS,\n DisplayMode,\n PresetDefinition,\n PresetName,\n PRESET_NAME\n} from '../presets/control-presets';\n\n@Component({\n selector: 'c8y-context-controls',\n standalone: true,\n imports: [\n ReactiveFormsModule,\n DateTimeContextPickerComponent,\n AggregationPickerComponent,\n AutoRefreshControlComponent,\n IconDirective,\n C8yTranslatePipe,\n TooltipModule\n ],\n template: `\n <form\n class=\"d-flex gap-16 p-l-16 p-r-16 p-b-8 inner-scroll h-auto min-width-0 widget-controls\"\n [formGroup]=\"form\"\n >\n <div class=\"input-group w-auto\">\n @if (visibleControls().includes('aggregation')) {\n <c8y-aggregation-picker\n formControlName=\"aggregation\"\n [disabledAggregations]=\"disabledAggregations()\"\n [resetToDefault]=\"true\"\n >\n </c8y-aggregation-picker>\n }\n\n @if (visibleControls().includes('autoRefresh')) {\n <c8y-auto-refresh-control\n formControlName=\"isAutoRefreshEnabled\"\n [autoRefreshSeconds]=\"autoRefreshSeconds()\"\n [isLoading]=\"isLoading()\"\n (refresh)=\"onRefresh()\"\n >\n </c8y-auto-refresh-control>\n }\n\n @if (visibleControls().includes('time')) {\n <c8y-date-time-context-picker\n style=\"margin-left: -1px\"\n formControlName=\"dateTimeContext\"\n [config]=\"dateTimePickerConfig()\"\n >\n </c8y-date-time-context-picker>\n }\n\n @if (visibleControls().includes('refresh')) {\n <div class=\"input-group-btn\">\n <button\n class=\"btn btn-default\"\n [attr.aria-label]=\"'Refresh' | translate\"\n [tooltip]=\"'Refresh' | translate\"\n placement=\"bottom\"\n container=\"body\"\n type=\"button\"\n [delay]=\"500\"\n [disabled]=\"isLoading()\"\n (click)=\"onRefresh()\"\n data-cy=\"widget-controls--refresh-button\"\n >\n <i [class.icon-spin]=\"isLoading()\" [c8yIcon]=\"'refresh'\"></i>\n </button>\n </div>\n }\n </div>\n </form>\n `\n})\nexport class ContextControlsComponent {\n private fb = inject(FormBuilder);\n private aggregationValidationService = inject(AggregationValidationService);\n private globalContextUtils = inject(GlobalContextUtilsService);\n\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n displayMode = input<DisplayMode>(GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD);\n config = input.required<GlobalContextState>();\n isLoading = input<boolean>(false);\n configChange = output<{ context: GlobalContextState; diff: GlobalContextState }>();\n refresh = output<void>();\n\n form: FormGroup;\n private lastEmittedState = signal<GlobalContextState>({});\n\n /**\n * Visible controls for the template.\n * LIVE_TIME and HISTORY_TIME are normalized to 'time' for template simplicity.\n */\n visibleControls = computed(() => {\n const controlsInput = this.controls();\n const presetDef =\n typeof controlsInput === 'string' ? CONTROL_PRESETS[controlsInput] : controlsInput;\n const baseControls = presetDef[this.displayMode()];\n const refreshOption = this.config().refreshOption || REFRESH_OPTION.LIVE;\n const filteredControls = applyModeConstraints(baseControls, refreshOption);\n\n // Normalize LIVE_TIME/HISTORY_TIME to 'time' for template\n return filteredControls.map(c =>\n c === CONTEXT_FEATURE.LIVE_TIME || c === CONTEXT_FEATURE.HISTORY_TIME ? 'time' : c\n );\n });\n\n disabledAggregations = computed((): AggregationOptionStatus => {\n const dateCtx = this.config().dateTimeContext;\n if (!dateCtx) return {};\n\n const [from, to] = this.parseDateRange(dateCtx);\n return this.aggregationValidationService.getDisabledAggregations([from, to]);\n });\n\n dateTimePickerConfig = computed(() => {\n const refreshOption = this.config().refreshOption;\n return refreshOption === REFRESH_OPTION.HISTORY\n ? { showDateFrom: true, showDateTo: true }\n : { showDateFrom: true, showDateTo: false };\n });\n\n autoRefreshSeconds = computed(\n () => this.config().refreshInterval || GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL\n );\n\n constructor() {\n this.form = this.fb.group({\n dateTimeContext: [null],\n aggregation: [null],\n isAutoRefreshEnabled: [false],\n refreshInterval: [GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL],\n refreshOption: [GLOBAL_CONTEXT_DEFAULTS.REFRESH_OPTION]\n });\n\n this.syncConfigToForm();\n this.subscribeToFormChanges();\n }\n\n onRefresh(): void {\n const { dateTimeContext } = this.config();\n if (!dateTimeContext) {\n this.refresh.emit();\n return;\n }\n\n const context = {\n ...this.config(),\n dateTimeContext: DateTimeContextUtil.normalizeForLive(dateTimeContext)\n };\n\n if (!this.emitIfChanged(context)) {\n this.refresh.emit();\n }\n }\n\n /** Emits configChange if context differs from last emitted state. Returns true if emitted. */\n private emitIfChanged(context: GlobalContextState): boolean {\n const diff = this.globalContextUtils.getChangedFields(this.lastEmittedState(), context);\n if (Object.keys(diff).length === 0) return false;\n\n this.lastEmittedState.set(context);\n this.configChange.emit({ context, diff });\n return true;\n }\n\n private syncConfigToForm(): void {\n effect(() => {\n const cfg = this.config();\n this.form.patchValue(cfg, { emitEvent: false });\n this.lastEmittedState.set(this.form.value as GlobalContextState);\n });\n }\n\n private subscribeToFormChanges(): void {\n this.form.valueChanges.pipe(takeUntilDestroyed()).subscribe(value => {\n const context = this.clearInvalidAggregation(value as GlobalContextState);\n this.emitIfChanged(context);\n });\n }\n\n /** Clears aggregation if in LIVE mode or invalid for current time range (HISTORY mode). */\n private clearInvalidAggregation(context: GlobalContextState): GlobalContextState {\n const { aggregation, dateTimeContext, refreshOption } = context;\n if (!aggregation) return context;\n\n // LIVE mode doesn't support aggregation\n if (refreshOption === REFRESH_OPTION.LIVE) {\n this.form.patchValue({ aggregation: null }, { emitEvent: false });\n return { ...context, aggregation: null };\n }\n\n // HISTORY mode: validate aggregation for time range\n if (!dateTimeContext) return context;\n\n const [from, to] = this.parseDateRange(dateTimeContext);\n const disabledAggs = this.aggregationValidationService.getDisabledAggregations([from, to]);\n if (disabledAggs[aggregation]) {\n this.form.patchValue({ aggregation: null }, { emitEvent: false });\n return { ...context, aggregation: null };\n }\n return context;\n }\n\n private parseDateRange(dateCtx: {\n dateFrom?: string | Date;\n dateTo?: string | Date;\n }): [Date, Date] {\n const from =\n typeof dateCtx.dateFrom === 'string' ? new Date(dateCtx.dateFrom) : dateCtx.dateFrom;\n const to = typeof dateCtx.dateTo === 'string' ? new Date(dateCtx.dateTo) : dateCtx.dateTo;\n return [from as Date, to as Date];\n }\n}\n","import {\n AfterViewInit,\n Component,\n computed,\n inject,\n input,\n OnDestroy,\n output,\n TemplateRef,\n ViewChild\n} from '@angular/core';\nimport { C8yTranslatePipe, DashboardChildComponent, IconDirective } from '@c8y/ngx-components';\nimport { TranslateService } from '@ngx-translate/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GlobalContextState } from '../../models/global-context.model';\nimport {\n applyModeConstraints,\n CONTROL_PRESETS,\n PRESET_NAME,\n PresetDefinition,\n PresetName\n} from '../presets/control-presets';\nimport { REFRESH_OPTION } from '../../models';\n\ninterface ControlDisplay {\n key: string;\n stateKey: string;\n cssClass: string;\n icon: string;\n label: string;\n}\n\n// Map preset controls to state keys\nconst CONTROL_DISPLAY_CONFIG: Record<string, ControlDisplay> = {\n liveTime: {\n key: 'liveTime',\n stateKey: 'dateTimeContext',\n cssClass: 'time-context',\n label: gettext('date/time'),\n icon: 'calendar'\n },\n historyTime: {\n key: 'historyTime',\n stateKey: 'dateTimeContext',\n cssClass: 'time-context',\n label: gettext('date/time'),\n icon: 'calendar'\n },\n aggregation: {\n key: 'aggregation',\n stateKey: 'aggregation',\n cssClass: 'aggregation',\n label: gettext('aggregation'),\n icon: 'input'\n },\n autoRefresh: {\n key: 'autoRefresh',\n stateKey: 'isAutoRefreshEnabled',\n cssClass: 'auto-refresh',\n label: gettext('auto refresh'),\n icon: 'refresh'\n }\n};\n\n@Component({\n selector: 'c8y-link-buttons',\n standalone: true,\n imports: [IconDirective, TooltipModule, C8yTranslatePipe],\n template: `\n <ng-template #headerContent>\n <button\n class=\"btn-icon-dot-set\"\n [class.active]=\"isLinked()\"\n [attr.aria-label]=\"'Global context sync controls' | translate\"\n [tooltip]=\"masterTooltipTemplate\"\n delay=\"500\"\n container=\"body\"\n (click)=\"toggle.emit(!isLinked())\"\n data-cy=\"global-context-link--all\"\n >\n <span class=\"btn-icon-dot__item default\" [class.active]=\"isLinked()\">\n <i [c8yIcon]=\"isLinked() ? 'link' : 'unlink'\"></i>\n </span>\n @for (control of visibleControls(); track control.stateKey) {\n <span\n [class]=\"control.cssClass + ' btn-icon-dot__item'\"\n [class.active]=\"isLinked()\"\n [attr.data-cy]=\"'global-context-link--' + control.stateKey\"\n >\n <i [c8yIcon]=\"control.icon\"></i>\n </span>\n }\n </button>\n <ng-template #masterTooltipTemplate>{{ masterTooltipText() }}</ng-template>\n </ng-template>\n `\n})\nexport class LinkButtonsComponent implements AfterViewInit, OnDestroy {\n private injectedDashboardChild = inject(DashboardChildComponent, { optional: true });\n private translateService = inject(TranslateService);\n\n @ViewChild('headerContent', { static: true, read: TemplateRef })\n private headerTemplateRef?: TemplateRef<unknown>;\n\n dashboardChild = input<DashboardChildComponent>();\n isLinked = input.required<boolean>();\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n config = input<GlobalContextState>({});\n\n toggle = output<boolean>();\n\n visibleControls = computed(() => {\n const controlsInput = this.controls();\n const presetDef =\n typeof controlsInput === 'string' ? CONTROL_PRESETS[controlsInput] : controlsInput;\n const refreshOption = this.config().refreshOption || REFRESH_OPTION.LIVE;\n const dashboardControls = presetDef[GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD];\n const activeControls = applyModeConstraints(dashboardControls, refreshOption);\n\n return activeControls.map(key => CONTROL_DISPLAY_CONFIG[key]).filter(Boolean);\n });\n\n masterTooltipText = computed<string>(() => {\n const controls = this.visibleControls();\n const clickToToggleLabel = this.translateService.instant(gettext('(click to toggle)'));\n\n if (!this.isLinked()) {\n const usingWidgetCustomTimeSettingsLabel = this.translateService.instant(\n gettext('Using widget custom time settings')\n );\n return `${usingWidgetCustomTimeSettingsLabel}\\n${clickToToggleLabel}`;\n }\n\n const linkedNames = controls.map(control => this.translateService.instant(control.label));\n\n const formatter = new Intl.ListFormat(\n this.translateService.getCurrentLang()?.replace('_', '-'),\n {\n type: 'conjunction'\n }\n );\n const linkedNamesList = formatter.format(linkedNames);\n const linkedToDashboardLabel = this.translateService.instant(gettext('Synced to dashboard:'));\n return `${linkedToDashboardLabel}\\n${linkedNamesList}\\n${clickToToggleLabel}`;\n });\n\n ngAfterViewInit(): void {\n const dashChild = this.getDashboardChild();\n\n if (dashChild && this.headerTemplateRef) {\n const headers = dashChild.additionalHeaderTemplates;\n if (!headers.includes(this.headerTemplateRef)) {\n headers.push(this.headerTemplateRef);\n }\n }\n }\n\n ngOnDestroy(): void {\n const dashChild = this.getDashboardChild();\n\n if (dashChild && this.headerTemplateRef) {\n const idx = dashChild.additionalHeaderTemplates.indexOf(this.headerTemplateRef);\n if (idx >= 0) {\n dashChild.additionalHeaderTemplates.splice(idx, 1);\n }\n }\n }\n\n private getDashboardChild(): DashboardChildComponent | null {\n return this.dashboardChild() ?? this.injectedDashboardChild ?? null;\n }\n}\n","import { Component, DestroyRef, effect, inject, input, output, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { DashboardChildComponent } from '@c8y/ngx-components';\nimport { EMPTY, merge, Subscription } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GLOBAL_CONTEXT_EVENTS,\n GlobalContextState\n} from '../../models/global-context.model';\nimport { GlobalContextEventService } from '../../services/state/global-context-event.service';\nimport { GlobalContextService } from '../../services/state/global-context.service';\nimport { GlobalContextUtilsService } from '../../services/infrastructure/global-context-utils.service';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\nimport { ContextControlsComponent } from '../context-controls/context-controls.component';\nimport { LinkButtonsComponent } from '../link-buttons/link-buttons.component';\nimport {\n controlsToSettings,\n PresetDefinition,\n PresetName,\n PRESET_NAME\n} from '../presets/control-presets';\n\n@Component({\n selector: 'c8y-global-context-connector',\n standalone: true,\n imports: [ContextControlsComponent, LinkButtonsComponent],\n template: `\n <c8y-link-buttons\n [dashboardChild]=\"dashboardChild()\"\n [isLinked]=\"isLinked()\"\n [controls]=\"controls()\"\n [config]=\"config()\"\n (toggle)=\"onLinkToggle($event)\"\n ></c8y-link-buttons>\n\n @if (!isLinked()) {\n <c8y-context-controls\n [controls]=\"controls()\"\n displayMode=\"dashboard\"\n [config]=\"config()\"\n [isLoading]=\"isLoading()\"\n (configChange)=\"onLocalChange($event)\"\n (refresh)=\"onLocalRefresh()\"\n ></c8y-context-controls>\n }\n `\n})\nexport class GlobalContextConnectorComponent {\n private eventService = inject(GlobalContextEventService);\n private globalContextService = inject(GlobalContextService);\n private globalContextUtils = inject(GlobalContextUtilsService);\n private destroyRef = inject(DestroyRef);\n private lastEmittedState = signal<GlobalContextState>({});\n\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n config = input.required<GlobalContextState>();\n isLoading = input<boolean>(false);\n dashboardChild = input.required<DashboardChildComponent>();\n linked = input<boolean | undefined>(undefined);\n\n configChange = output<{ context: GlobalContextState; diff: GlobalContextState }>();\n refresh = output<void>();\n\n isLinked = signal(true);\n\n constructor() {\n this.syncExternalLinkState();\n this.subscribeToGlobalContext();\n this.registerWithGlobalContext();\n this.trackLoadingState();\n\n this.destroyRef.onDestroy(() => {\n this.globalContextService.unregister(this.componentId);\n this.globalContextService.unregisterLoading(this.componentId);\n });\n }\n\n onLinkToggle(linked: boolean): void {\n this.isLinked.set(linked);\n if (linked) {\n const cached = this.eventService.getLatestValue(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE);\n if (cached) this.emitIfChanged(cached as GlobalContextState);\n }\n }\n\n onLocalChange(event: { context: GlobalContextState; diff: GlobalContextState }): void {\n this.lastEmittedState.set(event.context);\n this.configChange.emit(event);\n }\n\n onLocalRefresh(): void {\n const { dateTimeContext } = this.config();\n if (!dateTimeContext) {\n this.refresh.emit();\n return;\n }\n\n const context = {\n ...this.config(),\n dateTimeContext: DateTimeContextUtil.normalizeForLive(dateTimeContext)\n };\n\n if (!this.emitIfChanged(context)) {\n this.refresh.emit();\n }\n }\n\n /** Emits configChange if context differs from last emitted state. Returns true if emitted. */\n private emitIfChanged(context: GlobalContextState): boolean {\n const diff = this.globalContextUtils.getChangedFields(this.lastEmittedState(), context);\n if (Object.keys(diff).length === 0) return false;\n\n this.lastEmittedState.set(context);\n this.configChange.emit({ context, diff });\n return true;\n }\n\n private get componentId(): string {\n const data = this.dashboardChild()['data'];\n return data.id;\n }\n\n private syncExternalLinkState(): void {\n effect(() => {\n const external = this.linked();\n if (external !== undefined) this.isLinked.set(external);\n });\n }\n\n private subscribeToGlobalContext(): void {\n let subscription: Subscription | null = null;\n\n effect(() => {\n subscription?.unsubscribe();\n if (!this.isLinked()) return;\n\n const cached = this.eventService.getLatestValue(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE);\n if (cached) this.emitIfChanged(cached as GlobalContextState);\n\n const stateChanges$ = this.eventService.on(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE);\n const refresh$ = this.eventService.on(GLOBAL_CONTEXT_EVENTS.REFRESH).pipe(\n map(\n data =>\n ({\n ...this.config(),\n dateTimeContext: {\n dateFrom: data.dateFrom,\n dateTo: data.dateTo,\n interval: data.interval\n }\n }) as GlobalContextState\n )\n );\n\n subscription = merge(stateChanges$, refresh$)\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n catchError(() => EMPTY)\n )\n .subscribe(state => {\n if (state) this.emitIfChanged(state as GlobalContextState);\n });\n });\n }\n\n private registerWithGlobalContext(): void {\n effect(() => {\n if (this.isLinked()) {\n const settings = controlsToSettings(\n this.controls(),\n GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD,\n this.config().refreshOption || REFRESH_OPTION.LIVE\n );\n this.globalContextService.register(this.componentId, settings);\n } else {\n this.globalContextService.unregister(this.componentId);\n }\n });\n }\n\n private trackLoadingState(): void {\n effect(() => {\n const shouldTrack = this.isLinked() && this.isLoading();\n if (shouldTrack) {\n this.globalContextService.registerLoading(this.componentId);\n } else {\n this.globalContextService.unregisterLoading(this.componentId);\n }\n });\n }\n}\n","import { Component, input, output } from '@angular/core';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GlobalContextState } from '../../models/global-context.model';\nimport { ContextControlsComponent } from '../context-controls/context-controls.component';\nimport { DisplayMode, PresetDefinition, PresetName, PRESET_NAME } from '../presets/control-presets';\n\n@Component({\n selector: 'c8y-local-controls',\n standalone: true,\n imports: [ContextControlsComponent],\n host: {\n 'data-local-controls': 'true',\n '[class.disabled]': 'disabled()'\n },\n styles: [\n `\n .disabled-overlay {\n position: relative;\n cursor: not-allowed;\n }\n .disabled-overlay::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 10;\n }\n `\n ],\n template: `\n <div [class.disabled-overlay]=\"disabled()\">\n <c8y-context-controls\n [controls]=\"controls()\"\n [displayMode]=\"displayMode()\"\n [config]=\"config()\"\n [isLoading]=\"isLoading()\"\n (configChange)=\"configChange.emit($event)\"\n (refresh)=\"refresh.emit()\"\n ></c8y-context-controls>\n </div>\n `\n})\nexport class LocalControlsComponent {\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n displayMode = input<DisplayMode>(GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG);\n config = input.required<GlobalContextState>();\n isLoading = input<boolean>(false);\n disabled = input<boolean>(false);\n\n configChange = output<{ context: GlobalContextState; diff: GlobalContextState }>();\n refresh = output<void>();\n}\n","/** @deprecated Use LocalControlsComponent or GlobalContextConnectorComponent instead */\nexport * from './widget-wrapper';\n/** @deprecated Use LocalControlsComponent or GlobalContextConnectorComponent instead */\nexport * from './widget-controls';\n\nexport * from './config-mode-controls';\nexport * from './global-context-connector';\nexport * from './link-buttons';\nexport * from './local-controls';\nexport * from './presets';\n","import { NgModule } from '@angular/core';\nimport { hookActionBar } from '@c8y/ngx-components';\nimport { GlobalContextNavigationService } from './services/infrastructure/global-context-navigation.service';\n\n@NgModule({\n declarations: [],\n imports: [],\n exports: [],\n providers: [hookActionBar(GlobalContextNavigationService)]\n})\nexport class GlobalContextModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DateTimeContextPickerService","i1","i3","i2","FormsModule","filter","ContextControlsComponent","tap","sanitizeLocalStateHelper","sanitizeGlobalStateHelper","resolveWidgetDisplayModeHelper","mapToContextDisplayModeHelper","resolveVisibilityContextInternalHelper","handleFormChangeHelper","handleGlobalStateChangeHelper","executeHandlerHelper","validateAggregationLinkUtil","deriveAggregationValueUtil","resolveAggregationChangeForFormHelper","syncSourcesForRefreshOptionHelper","resolveAutoUnlinkAggregationChangeHelper","applyAggregationChangesForGlobalStateHelper","ensureDateTimeContextHelper","syncLocalEntriesWithGlobalHelper","deriveDisabledAggregationsHelper","buildControlLinkConfigHelper","calculateDisabledAggregationsFromContextHelper","handleLinkToggleHelper","toggleAllLinksHelper","applyConfigOverrideHelper","buildWidgetStateHelper","applyHandlerResultHelper","distinctUntilChanged","handleGlobalRefreshHelper","processRefreshEventHelper","getShouldDisableIntervalConfigHelper","patchFormValuesHelper","applyLocalAggregationChangeHelper","updateAggregationValueHelper","map","merge"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,MAAM,qBAAqB,GAAG;AACnC,IAAA,YAAY,EAAE,6BAA6B;AAC3C,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,qBAAqB,EAAE,sCAAsC;AAC7D,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,6BAA6B,EAAE,+BAA+B;AAC9D,IAAA,mBAAmB,EAAE;;IAGX;AAAZ,CAAA,UAAY,2BAA2B,EAAA;AACrC,IAAA,2BAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,2BAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,2BAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC;AACrC,CAAC,EAJW,2BAA2B,KAA3B,2BAA2B,GAAA,EAAA,CAAA,CAAA;IAkG3B;AAAZ,CAAA,UAAY,0BAA0B,EAAA;AACpC,IAAA,0BAAA,CAAA,mBAAA,CAAA,GAAA,iBAAqC;AACrC,IAAA,0BAAA,CAAA,iBAAA,CAAA,GAAA,eAAiC;AACjC,IAAA,0BAAA,CAAA,uBAAA,CAAA,GAAA,qBAA6C;AAC7C,IAAA,0BAAA,CAAA,0BAAA,CAAA,GAAA,wBAAmD;AACnD,IAAA,0BAAA,CAAA,2BAAA,CAAA,GAAA,0BAAsD;AACtD,IAAA,0BAAA,CAAA,2BAAA,CAAA,GAAA,0BAAsD;AACxD,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,GAAA,EAAA,CAAA,CAAA;AAgD/B,MAAM,qBAAqB,GAAG;AACnC,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,SAAS,EAAE;;AAwDN,MAAM,mBAAmB,GAAG;AACjC,IAAA,MAAM,EAAE,QAAQ;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AAnB,mBAAmB,EAAA,CAAA,CAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,aAFnB,CAAC,aAAa,CAAC,8BAA8B,CAAC,CAAC,EAAA,CAAA,CAAA;;4FAE/C,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAN/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE,CAAC,aAAa,CAAC,8BAA8B,CAAC;AAC1D,iBAAA;;;ACTD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-global-context.mjs","sources":["../../global-context/models/global-context.model.ts","../../global-context/models/auto-refresh.model.ts","../../global-context/models/interval-picker.model.ts","../../global-context/models/global-context-defaults.ts","../../global-context/models/control-flow.model.ts","../../global-context/models/aggregation.model.ts","../../global-context/models/constants.ts","../../global-context/utils/date-time-context.util.ts","../../global-context/utils/global-context-defaults.util.ts","../../global-context/services/state/global-context.service.ts","../../global-context/services/state/global-context-form.service.ts","../../global-context/services/state/global-context-event.service.ts","../../global-context/services/domain/widget-control.service.ts","../../global-context/services/domain/date-time-context-picker.service.ts","../../global-context/services/domain/widget-config-migration.service.ts","../../global-context/services/domain/global-context-validation.service.ts","../../global-context/services/domain/aggregation-validation.service.ts","../../global-context/services/domain/aggregation-picker.service.ts","../../global-context/services/infrastructure/global-context-utils.service.ts","../../global-context/features/aggregation/aggregation-picker/aggregation-picker.component.ts","../../global-context/features/aggregation/aggregation-picker/aggregation-picker.component.html","../../global-context/features/configuration/history-mode-configuration-controls/history-mode-configuration-controls.component.ts","../../global-context/features/configuration/history-mode-configuration-controls/history-mode-configuration-controls.component.html","../../global-context/features/time-context/interval-picker/interval-picker.component.ts","../../global-context/features/time-context/interval-picker/interval-picker.component.html","../../global-context/features/time-context/time-range-picker/date-time-context-picker.component.ts","../../global-context/features/time-context/time-range-picker/date-time-context-picker.component.html","../../global-context/features/configuration/live-mode-configuration-controls/live-mode-configuration-controls.component.ts","../../global-context/features/configuration/live-mode-configuration-controls/live-mode-configuration-controls.component.html","../../global-context/features/configuration/configuration-controls/configuration-controls.component.ts","../../global-context/features/configuration/configuration-collapse/configuration-collapse.component.ts","../../global-context/features/configuration/configuration-collapse/configuration-collapse.component.html","../../global-context/services/infrastructure/global-context-query.service.ts","../../global-context/features/aggregation/aggregation-display/aggregation-display.component.ts","../../global-context/features/aggregation/aggregation-display/aggregation-display.component.html","../../global-context/features/refresh/auto-refresh/auto-refresh-control.component.ts","../../global-context/features/refresh/auto-refresh/auto-refresh-control.component.html","../../global-context/features/time-context/time-range-display/time-range-display.component.ts","../../global-context/features/time-context/time-range-display/time-range-display.component.html","../../global-context/shared/context-controls/context-controls.component.ts","../../global-context/shared/context-controls/context-controls.component.html","../../global-context/core/global-context.component.ts","../../global-context/core/global-context.component.html","../../global-context/services/infrastructure/global-context-navigation.service.ts","../../global-context/core/widget-inline/inline-link-controls.component.ts","../../global-context/core/widget-inline/inline-link-helpers.ts","../../global-context/core/widget-inline/orchestrator/config-composer.util.ts","../../global-context/core/widget-inline/inline-refresh-helpers.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-aggregation.helper.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-context.helper.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-refresh.helper.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-state.helper.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-toggle.helper.ts","../../global-context/core/widget-inline/orchestrator/validation.util.ts","../../global-context/core/widget-inline/orchestrator/shared-mode-orchestrator.ts","../../global-context/core/widget-inline/orchestrator/history-mode-orchestrator.ts","../../global-context/core/widget-inline/orchestrator/live-mode-orchestrator.ts","../../global-context/core/widget-inline/orchestrator/global-context-inline-orchestrator.service.ts","../../global-context/core/global-context-inline.component.ts","../../global-context/core/global-context-inline.component.html","../../global-context/services/state/global-context-store.service.ts","../../global-context/core/global-context-config.component.ts","../../global-context/core/global-context-config.component.html","../../global-context/features/configuration/config-context-selector/config-context-selector.component.ts","../../global-context/core/global-context-widget-config.component.ts","../../global-context/core/index.ts","../../global-context/features/time-context/index.ts","../../global-context/features/refresh/realtime-control/realtime-control.component.ts","../../global-context/features/refresh/realtime-control/realtime-control.component.html","../../global-context/features/refresh/index.ts","../../global-context/features/configuration/index.ts","../../global-context/shared/preview-controls/preview-controls.component.ts","../../global-context/shared/preview-controls/preview-controls.component.html","../../global-context/shared/index.ts","../../global-context/integration/widget-controls/default-widget-template.ts","../../global-context/integration/widget-controls/widget-controls-factory.ts","../../global-context/integration/widget-controls/guards.ts","../../global-context/integration/widget-controls/update-helpers.ts","../../global-context/integration/widget-controls/widget-controls-presets.helpers.ts","../../global-context/integration/widget-controls/widget-controls-presets.ts","../../global-context/integration/widget-wrapper/global-context-widget-wrapper.component.ts","../../global-context/integration/presets/control-presets.ts","../../global-context/integration/config-mode-controls/config-mode-controls.component.ts","../../global-context/integration/context-controls/context-controls.component.ts","../../global-context/integration/link-buttons/link-buttons.component.ts","../../global-context/integration/global-context-connector/global-context-connector.component.ts","../../global-context/integration/local-controls/local-controls.component.ts","../../global-context/integration/index.ts","../../global-context/global-context.module.ts","../../global-context/c8y-ngx-components-global-context.ts"],"sourcesContent":["import { aggregationType } from '@c8y/client';\nimport { RefreshOption } from './auto-refresh.model';\nimport { LinkStatesMap } from './control-flow.model';\nimport { DateTimeContext } from './date-time-context-picker.model';\nimport { Interval, TimeInterval } from './interval-picker.model';\n\nexport const GLOBAL_CONTEXT_EVENTS = {\n STATE_CHANGE: 'GLOBAL_CONTEXT_STATE_CHANGE',\n REFRESH: 'REFRESH',\n REFRESH_OPTION_CHANGE: 'GLOBAL_CONTEXT_REFRESH_OPTION_CHANGE',\n UPDATE_GLOBAL_CONTEXT_LIVE: 'UPDATE_GLOBAL_CONTEXT_LIVE',\n UPDATE_GLOBAL_CONTEXT_HISTORY: 'UPDATE_GLOBAL_CONTEXT_HISTORY',\n INIT_GLOBAL_CONTEXT: 'INIT_GLOBAL_CONTEXT'\n} as const;\n\nexport enum GLOBAL_CONTEXT_DISPLAY_MODE {\n DASHBOARD = 'dashboard',\n CONFIG = 'config',\n VIEW_AND_CONFIG = 'view_and_config'\n}\n\nexport type GlobalContextKeys = (keyof GlobalContextState)[];\n\n/**\n * State object passed to widget state handlers\n */\nexport interface WidgetState {\n config?: GlobalContextState;\n inlineControlSettings?: Partial<GlobalContextSettings>;\n dashboardControlSettings?: Partial<GlobalContextSettings>;\n currentLinks?: LinkStatesMap;\n displayMode?: string;\n [key: string]: unknown;\n}\n\n/**\n * Result returned from widget state handlers\n */\nexport interface WidgetStateHandlerResult {\n inlineControlSettings: Partial<GlobalContextSettings>;\n dashboardControlSettings?: Partial<GlobalContextSettings>;\n links?: Partial<LinkStatesMap>;\n options?: { noAutoRefreshCounter?: boolean };\n}\n\nexport interface WidgetControls {\n supports: GlobalContextKeys;\n supportedModes?: RefreshOption[];\n options?: { noAutoRefreshCounter?: boolean };\n configSettings: {\n [mode in GLOBAL_CONTEXT_DISPLAY_MODE]?: {\n [option in RefreshOption]?: Partial<GlobalContextSettings>;\n };\n };\n settings: {\n [mode in GLOBAL_CONTEXT_DISPLAY_MODE]?: {\n [option in RefreshOption]?: Partial<GlobalContextSettings>;\n };\n };\n defaultLinks?: {\n [mode in GLOBAL_CONTEXT_DISPLAY_MODE]?: {\n [option in RefreshOption]?: LinkStatesMap;\n };\n };\n stateHandlers?: {\n [stateName: string]: (widgetState?: WidgetState) => WidgetStateHandlerResult;\n };\n}\n\n/** Settings to control which features are visible in the global context UI */\nexport interface GlobalContextSettings {\n showTimeContext: boolean;\n showAggregation: boolean;\n showAutoRefresh: boolean;\n showRefresh: boolean;\n showRefreshInterval: boolean;\n}\n\n/** Base interface for all global context events */\nexport interface GlobalContextEventBase<Type extends string, Payload> {\n type: Type;\n payload: Payload;\n timestamp?: number;\n}\n\n/**\n * Registry of all available global context events and their payloads\n *\n * Extend with new events by declaring module augmentation:\n * interface GlobalContextEventRegistry {\n * NEW_EVENT: boolean; // Add your event payload type\n * }\n */\nexport interface GlobalContextEventRegistry {\n [GLOBAL_CONTEXT_EVENTS.REFRESH]: {\n dateFrom?: string | Date;\n dateTo?: string | Date;\n interval?: TimeInterval;\n };\n [GLOBAL_CONTEXT_EVENTS.STATE_CHANGE]: Partial<GlobalContextState>;\n [GLOBAL_CONTEXT_EVENTS.REFRESH_OPTION_CHANGE]: RefreshOption;\n [GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_LIVE]: Partial<GlobalContextState>;\n [GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_HISTORY]: Partial<GlobalContextState>;\n [GLOBAL_CONTEXT_EVENTS.INIT_GLOBAL_CONTEXT]: void;\n}\n\n/** Union of all possible event type strings */\nexport type GlobalContextEventType = keyof GlobalContextEventRegistry;\n/** Union type of all possible global context events */\nexport type GlobalContextEventUnion = {\n [K in GlobalContextEventType]: GlobalContextEventBase<K, GlobalContextEventRegistry[K]>;\n}[GlobalContextEventType];\n\nexport enum DateContextQueryParamNames {\n DATE_CONTEXT_FROM = 'dateContextFrom',\n DATE_CONTEXT_TO = 'dateContextTo',\n DATE_CONTEXT_INTERVAL = 'dateContextInterval',\n DATE_CONTEXT_AGGREGATION = 'dateContextAggregation',\n DATE_CONTEXT_AUTO_REFRESH = 'globalContextAutoRefresh',\n DATE_CONTEXT_REFRESH_MODE = 'globalContextRefreshMode'\n}\n\ntype DateContextFromToQueryParams = {\n [DateContextQueryParamNames.DATE_CONTEXT_FROM]: string;\n [DateContextQueryParamNames.DATE_CONTEXT_TO]: string;\n [DateContextQueryParamNames.DATE_CONTEXT_INTERVAL]?: never;\n};\n\ntype DateContextIntervalQueryParams = {\n [DateContextQueryParamNames.DATE_CONTEXT_FROM]?: never;\n [DateContextQueryParamNames.DATE_CONTEXT_TO]?: never;\n [DateContextQueryParamNames.DATE_CONTEXT_INTERVAL]: Interval['id'];\n};\n\n/**\n * Input query params is an object representing all possible query params related to widget time context.\n * It can be provided by user typing them in browser URL address bar, so all of them should be considered.\n */\nexport type InputDateContextQueryParams = {\n [DateContextQueryParamNames.DATE_CONTEXT_FROM]?: string;\n [DateContextQueryParamNames.DATE_CONTEXT_TO]?: string;\n [DateContextQueryParamNames.DATE_CONTEXT_INTERVAL]?: Interval['id'];\n [DateContextQueryParamNames.DATE_CONTEXT_AGGREGATION]?: aggregationType;\n [DateContextQueryParamNames.DATE_CONTEXT_AUTO_REFRESH]?: boolean;\n [DateContextQueryParamNames.DATE_CONTEXT_REFRESH_MODE]?: string;\n};\n\n/**\n * Output query params is an object representing params that are applied to current URL in browser address bar.\n * These params are set programmatically.\n * Time context interval and time range described by date \"from\" and date \"to\" exclude each other.\n */\nexport type OutputDateContextQueryParams = (\n | DateContextFromToQueryParams\n | DateContextIntervalQueryParams\n) & {\n [DateContextQueryParamNames.DATE_CONTEXT_AGGREGATION]: aggregationType;\n};\n\nexport type GlobalContextDisplayMode = `${GLOBAL_CONTEXT_DISPLAY_MODE}`;\n\nexport const GLOBAL_CONTEXT_SOURCE = {\n WIDGET: 'widget',\n DASHBOARD: 'dashboard'\n} as const;\n\nexport type GlobalContextSource =\n (typeof GLOBAL_CONTEXT_SOURCE)[keyof typeof GLOBAL_CONTEXT_SOURCE];\n\n// TODO: This type should extend ContextWidgetConfig from @c8y/ngx-components/context-dashboard\n// but importing it creates a circular dependency (global-context <-> context-dashboard)\nexport interface GlobalContextState {\n dateTimeContext?: DateTimeContext;\n aggregation?: aggregationType | null;\n isAutoRefreshEnabled?: boolean;\n refreshInterval?: number;\n refreshOption?: RefreshOption;\n displayMode?: `${GLOBAL_CONTEXT_DISPLAY_MODE}`;\n source?: GlobalContextSource;\n eventSourceId?: string;\n /**\n * Flag indicating global context values have been applied.\n * For dashboard mode, widgets should wait for this flag before processing config.\n */\n isGlobalContextReady?: boolean;\n}\n\n/**\n * Interface for date context parameters passed to setDateContextQueryParams method.\n * Provides strong typing for all possible parameters.\n */\nexport interface DateContextParams {\n /** Time interval ID ('DAYS', 'HOURS', etc.) or 'custom' for date ranges */\n interval?: Interval['id'];\n /** Array containing [dateFrom, dateTo] strings or Date objects for custom date ranges */\n date?: (string | Date)[] | null;\n /** Data aggregation type ('HOURLY', 'DAILY', etc.) */\n aggregation?: aggregationType;\n /** Whether auto-refresh should be enabled */\n isAutoRefreshEnabled?: boolean;\n /** Refresh mode ('live' or 'history') */\n refreshOption?: RefreshOption;\n}\n\n/**\n * Result type for query parameter validation status.\n * Provides detailed validation information for debugging and UI state management.\n */\nexport interface ParameterValidationStatus {\n /** True if interval parameter is valid and selectable */\n interval: boolean;\n /** True if aggregation parameter is valid */\n aggregation: boolean;\n /** True if both dateFrom and dateTo form a valid date range */\n dateRange: boolean;\n /** Parsed boolean value, or undefined if invalid/missing */\n autoRefresh: boolean | undefined;\n}\n\nexport const WIDGET_DISPLAY_MODE = {\n INLINE: 'inline',\n CONFIG: 'config',\n PREVIEW: 'preview'\n} as const;\n\nexport type WidgetDisplayMode = (typeof WIDGET_DISPLAY_MODE)[keyof typeof WIDGET_DISPLAY_MODE];\n\nexport interface GlobalContextEvent {\n context: Partial<GlobalContextState>;\n diff: Partial<GlobalContextState>;\n}\n","export const REFRESH_OPTION = {\n LIVE: 'live',\n HISTORY: 'history'\n} as const;\n\nexport type RefreshOption = (typeof REFRESH_OPTION)[keyof typeof REFRESH_OPTION];\n","import { gettext } from '@c8y/ngx-components/gettext';\n\nconst todayDate = new Date();\n\nexport const TIME_SPAN_MS = {\n MINUTE: 1000 * 60,\n HOUR: 1000 * 60 * 60,\n DAY: 1000 * 60 * 60 * 24,\n WEEK: 1000 * 60 * 60 * 24 * 7,\n MONTH: todayDate.valueOf() - new Date(todayDate.setMonth(todayDate.getMonth() - 1)).valueOf()\n} as const;\n\nexport const TIME_INTERVAL = {\n NONE: 'none',\n MINUTES: 'minutes',\n HOURS: 'hours',\n DAYS: 'days',\n WEEKS: 'weeks',\n MONTHS: 'months',\n CUSTOM: 'custom'\n} as const;\n\nexport type TimeInterval = (typeof TIME_INTERVAL)[keyof typeof TIME_INTERVAL];\n\nexport type Interval = {\n id: 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'custom' | string;\n title: string;\n timespanInMs?: number;\n};\n\nexport type AlarmFilterInterval =\n | Interval\n | {\n id: 'none';\n title: string;\n timespanInMs?: number;\n };\n\nexport const INTERVALS: Interval[] = [\n {\n id: 'minutes',\n title: gettext('Last minute'),\n timespanInMs: TIME_SPAN_MS.MINUTE\n },\n {\n id: 'hours',\n title: gettext('Last hour'),\n timespanInMs: TIME_SPAN_MS.HOUR\n },\n {\n id: 'days',\n title: gettext('Last day'),\n timespanInMs: TIME_SPAN_MS.DAY\n },\n {\n id: 'weeks',\n title: gettext('Last week'),\n timespanInMs: TIME_SPAN_MS.WEEK\n },\n {\n id: 'months',\n title: gettext('Last month'),\n timespanInMs: TIME_SPAN_MS.MONTH\n },\n { id: 'custom', title: gettext('Custom') }\n];\n\nexport const INTERVAL_TITLES: Record<AlarmFilterInterval['id'], string> = {\n none: gettext('No date filter'),\n minutes: gettext('Last minute'),\n hours: gettext('Last hour'),\n days: gettext('Last day'),\n weeks: gettext('Last week'),\n months: gettext('Last month'),\n custom: gettext('Custom')\n};\n","import { REFRESH_OPTION } from './auto-refresh.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE } from './global-context.model';\nimport { TIME_INTERVAL } from './interval-picker.model';\n\n/**\n * Default values for global context configuration\n * Single source of truth for all default values across the global context feature\n */\nexport const GLOBAL_CONTEXT_DEFAULTS = {\n /** Default refresh option - live mode */\n REFRESH_OPTION: REFRESH_OPTION.LIVE,\n\n /** Default auto-refresh state */\n IS_AUTO_REFRESH_ENABLED: true,\n\n /** Default refresh interval in milliseconds (5 seconds) */\n REFRESH_INTERVAL: 5000,\n\n /** Default aggregation type */\n AGGREGATION: null,\n\n /** Default display mode */\n DISPLAY_MODE: GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD,\n\n /** Default date range duration in milliseconds (1 hour) */\n DATE_RANGE_DURATION_MS: 60 * 60 * 1000,\n\n /** Default time interval for custom ranges */\n TIME_INTERVAL: TIME_INTERVAL.HOURS\n} as const;\n","import { gettext } from '@c8y/ngx-components/gettext';\nimport { GlobalContextSettings, GlobalContextState } from './global-context.model';\n\n/**\n * Define the mapping between GlobalContextState keys and their equivalent in GlobalContextSettings\n */\nexport const LINK_BTNS_CONFIG: {\n [K in Extract<\n keyof GlobalContextState,\n 'dateTimeContext' | 'aggregation' | 'isAutoRefreshEnabled'\n >]: {\n /** Form control name, same as global state key */\n formControlName: K;\n /** Setting key in GlobalContextSettings */\n settingKey: keyof GlobalContextSettings;\n /** User-friendly label for UI */\n label: string;\n /** Css Class for link button visualization */\n cssClass: string;\n icon: string;\n };\n} = {\n dateTimeContext: {\n formControlName: 'dateTimeContext',\n settingKey: 'showTimeContext',\n label: gettext('date/time'),\n cssClass: 'time-context',\n icon: 'calendar'\n },\n isAutoRefreshEnabled: {\n formControlName: 'isAutoRefreshEnabled',\n settingKey: 'showAutoRefresh',\n label: gettext('auto refresh'),\n cssClass: 'auto-refresh',\n icon: 'refresh'\n },\n aggregation: {\n formControlName: 'aggregation',\n settingKey: 'showAggregation',\n label: gettext('aggregation'),\n cssClass: 'aggregation',\n icon: 'input'\n }\n} as const;\n\n/**\n * Type for link toggle event\n */\nexport interface LinkToggleEvent {\n key: Extract<\n keyof GlobalContextState,\n 'dateTimeContext' | 'aggregation' | 'isAutoRefreshEnabled'\n >;\n isLinked: boolean;\n}\n\n/**\n * Type for link states map\n */\nexport type LinkStatesMap = Partial<\n Record<\n Extract<keyof GlobalContextState, 'dateTimeContext' | 'aggregation' | 'isAutoRefreshEnabled'>,\n boolean\n >\n>;\n\n/**\n * Type for control configs map\n */\nexport type ControlConfigsMap = Partial<\n Record<\n Extract<keyof GlobalContextState, 'dateTimeContext' | 'aggregation' | 'isAutoRefreshEnabled'>,\n {\n cssClass?: string;\n linkTooltip?: string;\n unlinkTooltip?: string;\n icon?: string;\n disabled?: boolean;\n disabledTooltip?: string;\n autoUnlinked?: boolean;\n }\n >\n>;\n","import { aggregationType } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TIME_SPAN_MS } from './interval-picker.model';\n\nexport type Aggregation = {\n id: aggregationType | null;\n title: string;\n};\n\nexport const AGGREGATIONS: Aggregation[] = [\n { id: null, title: gettext('None') },\n { id: aggregationType.MINUTELY, title: gettext('Minutely') },\n { id: aggregationType.HOURLY, title: gettext('Hourly') },\n { id: aggregationType.DAILY, title: gettext('Daily') }\n];\n\nexport const AGGREGATION_LIMITS = {\n MINUTELY_LIMIT: TIME_SPAN_MS.MINUTE * 10,\n HOURLY_LIMIT: TIME_SPAN_MS.DAY * 1,\n DAILY_LIMIT: TIME_SPAN_MS.DAY * 4\n};\n\nexport const AGGREGATION_ICON_TYPE = {\n UNDEFINED: 'line-chart',\n MINUTELY: 'hourglass',\n HOURLY: 'clock-o',\n DAILY: 'calendar-o'\n} as const;\n\nexport type AggregationIconType =\n (typeof AGGREGATION_ICON_TYPE)[keyof typeof AGGREGATION_ICON_TYPE];\n\nexport const AGGREGATION_ICONS: Record<aggregationType | 'undefined', AggregationIconType> = {\n undefined: AGGREGATION_ICON_TYPE.UNDEFINED,\n MINUTELY: AGGREGATION_ICON_TYPE.MINUTELY,\n HOURLY: AGGREGATION_ICON_TYPE.HOURLY,\n DAILY: AGGREGATION_ICON_TYPE.DAILY\n};\n\nexport const AGGREGATION_TEXTS: Record<\n aggregationType | 'undefined' | 'null' | 'disabled',\n string\n> = {\n disabled: gettext('No aggregation with realtime enabled'),\n undefined: gettext('No aggregation'),\n null: gettext('No aggregation'),\n MINUTELY: gettext('Minutely aggregation'),\n HOURLY: gettext('Hourly aggregation'),\n DAILY: gettext('Daily aggregation')\n};\n\nexport const AGGREGATION_VALUES = {\n none: 'NONE',\n minutely: aggregationType.MINUTELY,\n hourly: aggregationType.HOURLY,\n daily: aggregationType.DAILY\n} as const;\n\nexport const AGGREGATION_VALUES_ARR = [\n AGGREGATION_VALUES.none,\n AGGREGATION_VALUES.minutely,\n AGGREGATION_VALUES.hourly,\n AGGREGATION_VALUES.daily\n] as const;\n\nexport const AGGREGATION_LABELS = {\n NONE: AGGREGATIONS[0].title,\n [aggregationType.MINUTELY]: AGGREGATIONS[1].title,\n [aggregationType.HOURLY]: AGGREGATIONS[2].title,\n [aggregationType.DAILY]: AGGREGATIONS[3].title\n} as const;\n\n/**\n * Represents the available aggregation options.\n * Aggregation 'none' is not handled by our backend.\n */\nexport type AggregationOption = typeof AGGREGATION_VALUES.none | `${aggregationType}`;\n/**\n * Represents the status of aggregation options.\n * Used to determine which aggregation options should be disabled.\n */\nexport type AggregationOptionStatus = {\n [key in AggregationOption]?: boolean;\n};\n\nexport interface AggregationState {\n aggregationType: aggregationType;\n isDisabled: boolean;\n}\n","/**\n * Time duration constants (ms)\n */\nexport const TIME_DURATION = {\n /** One hour in milliseconds */\n ONE_HOUR_MS: 60 * 60 * 1000,\n /** One minute in milliseconds */\n ONE_MINUTE_MS: 60 * 1000,\n /** One second in milliseconds */\n ONE_SECOND_MS: 1000\n} as const;\n\n/**\n * Timing constants for debouncing and throttling\n */\nexport const TIMING = {\n /** Debounce time for form value changes (ms) */\n FORM_DEBOUNCE: 100,\n /** Throttle time for context changes (ms) */\n CONTEXT_THROTTLE: 200,\n /** Tooltip delay time (ms) */\n TOOLTIP_DELAY: 500,\n /** Default debounce time (ms) */\n DEFAULT_DEBOUNCE: 100\n} as const;\n\n/**\n * UI priority constants\n */\nexport const UI_PRIORITIES = {\n /** High priority for configuration controls */\n CONFIGURATION_PRIORITY: 1000\n} as const;\n","import { DateTimeContext } from '../models/date-time-context-picker.model';\nimport { INTERVALS, TIME_INTERVAL, TimeInterval } from '../models/interval-picker.model';\n\n/**\n * Central utility for all DateTimeContext operations.\n * Single source of truth for date validation, conversion, and context normalization.\n */\nexport class DateTimeContextUtil {\n /**\n * Converts a value to a Date object, handling various input types.\n * Allows JavaScript's natural type coercion for compatibility with existing tests.\n */\n static toDate(value: unknown): Date | null {\n // Handle undefined explicitly - new Date(undefined) is Invalid Date\n if (value === undefined) {\n return null;\n }\n\n // Already a Date object\n if (value instanceof Date) {\n return isNaN(value.getTime()) ? null : value;\n }\n\n // Let JavaScript's natural type coercion handle all other cases\n // This allows null, false, true, numbers, strings to be handled like new Date() would\n const date = new Date(value as never);\n return isNaN(date.getTime()) ? null : date;\n }\n\n /**\n * Converts a date value to ISO string format.\n */\n static toIso(value: Date | string | null | undefined): string | null {\n const date = this.toDate(value);\n return date ? date.toISOString() : null;\n }\n\n /**\n * Normalizes an ISO string to remove milliseconds (sets to .000Z).\n * This ensures date comparisons ignore millisecond precision.\n *\n * @param isoString - ISO date string (e.g., \"2025-10-27T15:10:04.405Z\")\n * @returns ISO string with milliseconds zeroed (e.g., \"2025-10-27T15:10:04.000Z\")\n */\n static normalizeIsoToSeconds(isoString: string | null | undefined): string | null {\n if (!isoString || typeof isoString !== 'string') {\n return null;\n }\n\n // Parse the ISO string to a Date\n const date = this.toDate(isoString);\n if (!date) {\n return null;\n }\n\n // Set milliseconds to 0\n date.setMilliseconds(0);\n return date.toISOString();\n }\n\n /**\n * Validates if a single date value is valid.\n * Only accepts Date objects and valid date strings (not numbers, null, etc.)\n * This is the strict validation used for form inputs and user-facing APIs.\n */\n static isValidDate(value: unknown): boolean {\n // Only accept Date instances or strings\n if (value instanceof Date) {\n return !isNaN(value.getTime());\n }\n if (typeof value === 'string') {\n const date = new Date(value);\n return !isNaN(date.getTime());\n }\n return false;\n }\n\n /**\n * Validates if a value can be converted to a valid date.\n * Uses JavaScript's natural type coercion, accepting null, numbers, booleans, etc.\n * This is used internally for range validation.\n */\n static isCoercibleToDate(value: unknown): boolean {\n return this.toDate(value) !== null;\n }\n\n /**\n * Validates if a date range is valid (from < to).\n */\n static isValidRange(from: unknown, to: unknown): boolean {\n const fromDate = this.toDate(from);\n const toDate = this.toDate(to);\n\n // Both dates must be valid and fromDate must be before toDate\n return fromDate !== null && toDate !== null && fromDate < toDate;\n }\n\n /**\n * Validates if a date range is valid, allowing equal dates (from <= to).\n */\n static isValidRangeOrEqual(from: unknown, to: unknown): boolean {\n const fromDate = this.toDate(from);\n const toDate = this.toDate(to);\n\n // Both dates must be valid and fromDate must be before or equal to toDate\n return fromDate !== null && toDate !== null && fromDate <= toDate;\n }\n\n /**\n * Calculates date range from an interval.\n * Pure implementation based on INTERVALS configuration.\n */\n static dateRangeFromInterval(\n interval: TimeInterval,\n now: Date = new Date()\n ): [Date, Date] | null {\n // Special case: 'none' returns epoch to current time\n if (interval === 'none') {\n return [new Date(0), now];\n }\n\n // Special case: 'custom' has no default range\n if (interval === TIME_INTERVAL.CUSTOM) {\n return null;\n }\n\n // Find the interval configuration\n const intervalConfig = INTERVALS.find(({ id }) => id === interval);\n if (!intervalConfig || !intervalConfig.timespanInMs) {\n return null;\n }\n\n // Calculate date range: current time minus interval timespan\n const dateTo = new Date(now);\n const dateFrom = new Date(dateTo.valueOf() - intervalConfig.timespanInMs);\n return [dateFrom, dateTo];\n }\n\n /**\n * Ensures all dates in a DateTimeContext are ISO strings with milliseconds normalized to .000Z.\n */\n static ensureIsoContext(ctx: Partial<DateTimeContext>): DateTimeContext {\n const result: DateTimeContext = {\n interval: ctx.interval || TIME_INTERVAL.CUSTOM,\n dateFrom: null,\n dateTo: null\n };\n\n if (ctx.dateFrom) {\n const iso = this.toIso(ctx.dateFrom);\n result.dateFrom = this.normalizeIsoToSeconds(iso);\n }\n if (ctx.dateTo) {\n const iso = this.toIso(ctx.dateTo);\n result.dateTo = this.normalizeIsoToSeconds(iso);\n }\n\n return result;\n }\n\n /**\n * Normalizes a DateTimeContext for live mode.\n * - For non-custom intervals: recomputes range based on current time\n * - For custom interval: updates dateTo to current time\n */\n static normalizeForLive(ctx: Partial<DateTimeContext>, now: Date = new Date()): DateTimeContext {\n const interval = ctx.interval || TIME_INTERVAL.CUSTOM;\n\n if (interval !== TIME_INTERVAL.CUSTOM) {\n // Recompute range from interval\n const range = this.dateRangeFromInterval(interval, now);\n if (range) {\n return this.ensureIsoContext({\n interval,\n dateFrom: range[0],\n dateTo: range[1]\n });\n }\n }\n\n // For custom interval, keep dateFrom but update dateTo to now\n return this.ensureIsoContext({\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: ctx.dateFrom,\n dateTo: now\n });\n }\n\n /**\n * Normalizes a DateTimeContext for history mode.\n * Forces interval to CUSTOM and preserves explicit date range.\n */\n static normalizeForHistory(ctx: Partial<DateTimeContext>): DateTimeContext {\n return this.ensureIsoContext({\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: ctx.dateFrom,\n dateTo: ctx.dateTo\n });\n }\n\n /**\n * Type guard to check if a value is a valid DateTimeContext object.\n */\n static isValidDateTimeContext(context: unknown): context is DateTimeContext {\n if (!context || typeof context !== 'object') return false;\n\n const ctx = context as Record<string, unknown>;\n\n const hasDates = 'dateFrom' in ctx && 'dateTo' in ctx && 'interval' in ctx;\n if (!hasDates) return false;\n\n return (\n typeof ctx.interval === 'string' &&\n ctx.interval.length > 0 &&\n this.isValidDate(ctx.dateFrom) &&\n this.isValidDate(ctx.dateTo)\n );\n }\n\n /**\n * Checks if a partial DateTimeContext has all required fields.\n * Business logic: Allow single field updates or complete updates (all 3 fields),\n * but reject incomplete updates with 2 fields.\n */\n static isCompleteDateTimeContext(\n diff: Partial<{ dateTimeContext: Partial<DateTimeContext> }>\n ): boolean {\n // If no dateTimeContext in diff, it's considered complete\n if (!('dateTimeContext' in diff) || !diff.dateTimeContext) {\n return true;\n }\n\n const keys = Object.keys(diff.dateTimeContext);\n // Allow single field updates (e.g., just interval) or complete updates (all 3 fields)\n // Reject incomplete updates with 2 fields\n return keys.length === 1 || keys.length === 3;\n }\n\n /**\n * Formats a context for emission, ensuring ISO dates and filtering by supported fields.\n */\n static formatForEmission(\n context: Partial<{ dateTimeContext: Partial<DateTimeContext> }>,\n supports: string[]\n ): Partial<{ dateTimeContext: DateTimeContext }> {\n if (!supports.includes('dateTimeContext') || !context.dateTimeContext) {\n return {};\n }\n\n const dateTimeContext = context.dateTimeContext;\n\n // For live mode with custom interval, default dateTo to now if missing\n if (dateTimeContext.interval === TIME_INTERVAL.CUSTOM && !dateTimeContext.dateTo) {\n return {\n dateTimeContext: this.ensureIsoContext({\n ...dateTimeContext,\n dateTo: new Date()\n })\n };\n }\n\n return {\n dateTimeContext: this.ensureIsoContext(dateTimeContext)\n };\n }\n}\n","import { GLOBAL_CONTEXT_DEFAULTS } from '../models/global-context-defaults';\nimport type { DateTimeContext } from '../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../models/global-context.model';\nimport { DateTimeContextUtil } from './date-time-context.util';\n\n/**\n * Creates a complete default global context state\n *\n * @returns A complete GlobalContextState with all required properties set to sensible defaults\n */\nexport function createDefaultGlobalContextState(): GlobalContextState {\n const now = new Date();\n const dateFrom = new Date(now.getTime() - GLOBAL_CONTEXT_DEFAULTS.DATE_RANGE_DURATION_MS);\n\n return {\n dateTimeContext: {\n dateFrom: dateFrom.toISOString(),\n dateTo: now.toISOString(),\n interval: GLOBAL_CONTEXT_DEFAULTS.TIME_INTERVAL\n },\n refreshOption: GLOBAL_CONTEXT_DEFAULTS.REFRESH_OPTION,\n isAutoRefreshEnabled: GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n aggregation: GLOBAL_CONTEXT_DEFAULTS.AGGREGATION,\n displayMode: GLOBAL_CONTEXT_DEFAULTS.DISPLAY_MODE\n };\n}\n\n/**\n * Fills missing or invalid properties in a partial global context state with defaults\n *\n * @param state - Partial global context state that may have missing or invalid values\n * @returns Complete GlobalContextState with all required properties\n */\nexport function fillMissingDefaults(state: Partial<GlobalContextState>): GlobalContextState {\n const defaults = createDefaultGlobalContextState();\n\n // Use central utility to ensure ISO formatting for dateTimeContext\n const dateTimeContext = state.dateTimeContext\n ? DateTimeContextUtil.ensureIsoContext({\n ...defaults.dateTimeContext,\n ...state.dateTimeContext,\n // Use defaults for invalid dates\n dateFrom: DateTimeContextUtil.isValidDate(state.dateTimeContext?.dateFrom)\n ? state.dateTimeContext.dateFrom\n : defaults.dateTimeContext.dateFrom,\n dateTo: DateTimeContextUtil.isValidDate(state.dateTimeContext?.dateTo)\n ? state.dateTimeContext.dateTo\n : defaults.dateTimeContext.dateTo,\n interval: state.dateTimeContext?.interval || defaults.dateTimeContext.interval\n })\n : defaults.dateTimeContext;\n\n return {\n ...defaults,\n ...state,\n dateTimeContext,\n // Always override refreshInterval to use the fixed 5s default\n // This ensures old dashboards with custom intervals are migrated to the new fixed interval\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL\n };\n}\n\n/**\n * Validates if a value is a valid date (either Date object or ISO string)\n * Delegates to central utility for consistency.\n *\n * @param value - Value to validate (string, Date, or undefined)\n * @returns true if the value represents a valid date\n */\nexport function isValidDateValue(value: string | Date | undefined): value is string | Date {\n return DateTimeContextUtil.isValidDate(value);\n}\n\n/**\n * Checks if a date time context object has all required valid properties\n * Delegates to central utility for consistency.\n *\n * @param context - DateTimeContext to validate\n * @returns true if the context is complete and valid\n */\nexport function isValidDateTimeContext(context: unknown): context is DateTimeContext {\n return DateTimeContextUtil.isValidDateTimeContext(context);\n}\n\n/**\n * Checks if a dateTimeContext diff object is complete (has all 3 required fields).\n * Delegates to central utility for consistency.\n *\n * @param diff - Partial state that may contain dateTimeContext\n * @returns true if dateTimeContext is absent, has only 1 field, or has all 3 fields; false if it has 2 fields (incomplete)\n */\nexport function isCompleteDateTimeContext(diff: Partial<GlobalContextState>): boolean {\n return DateTimeContextUtil.isCompleteDateTimeContext(diff);\n}\n\n/**\n * Formats dateTimeContext for emission, handling date conversions and defaults.\n * Delegates to central utility for consistency.\n *\n * @param context - Global context state to format\n * @param supports - Array of supported fields from widget template\n * @returns Formatted context with properly formatted dateTimeContext\n */\nexport function formatDateTimeContextForEmission(\n context: Partial<GlobalContextState>,\n supports: string[]\n): Partial<GlobalContextState> {\n const result = DateTimeContextUtil.formatForEmission(context, supports);\n\n // Merge back with original context to preserve other fields\n return {\n ...context,\n ...result\n };\n}\n","import { computed, Injectable, signal } from '@angular/core';\nimport { ViewContext } from '@c8y/ngx-components';\nimport { BehaviorSubject, distinctUntilChanged, map, Observable, shareReplay } from 'rxjs';\nimport { GlobalContextSettings, GlobalContextState } from '../../models/global-context.model';\nimport { createDefaultGlobalContextState } from '../../utils/global-context-defaults.util';\n\n/**\n * Interface representing a registered widget's global context settings with its unique identifier.\n */\ninterface RegisteredGlobalContextSettings extends Partial<GlobalContextSettings> {\n /** Unique identifier for the widget that registered these settings */\n readonly id: string;\n}\n\n/**\n * Default settings applied when no widgets have registered any settings.\n */\nconst DEFAULT_GLOBAL_CONTEXT_SETTINGS: GlobalContextSettings = {\n showTimeContext: false,\n showAggregation: false,\n showAutoRefresh: false,\n showRefresh: false,\n showRefreshInterval: false\n} as const;\n\n/**\n * GlobalContextService manages widget settings registration and loading states.\n *\n * This service is responsible for:\n * - Registering and managing widget-specific global context settings\n * - Consolidating settings from multiple widgets using OR logic\n * - Tracking loading states across multiple widgets\n * - Providing default configurations for the global context\n *\n * @example\n * ```typescript\n * // Register widget settings\n * globalContextService.register('widget-1', { showTimeContext: true });\n *\n * // Get consolidated settings from all widgets\n * globalContextService.getConsolidatedSettings().subscribe(settings => {\n * console.log(settings); // { showTimeContext: true, ... }\n * });\n *\n * // Track loading state\n * globalContextService.registerLoading('widget-1');\n * console.log(globalContextService.isLoading()); // true\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextService {\n /**\n * Computed signal that indicates if any widgets are currently in a loading state.\n * Returns true if at least one widget has registered a loading state.\n */\n readonly isLoading = computed(() => this.loadingIds().size > 0);\n\n /** Target context for the global context service */\n protected readonly targetContext: ViewContext.Device | ViewContext.Group = ViewContext.Group;\n\n /** Observable stream of all registered widget settings */\n private readonly settings$ = new BehaviorSubject<readonly RegisteredGlobalContextSettings[]>([]);\n\n /** Signal storing unique identifiers of widgets currently in loading state */\n private readonly loadingIds = signal<Set<string>>(new Set());\n\n /**\n * Registers global context settings for a specific widget.\n * If settings for the same widget ID already exist, they will be updated.\n *\n * @param id - Unique identifier for the widget\n * @param settings - Partial global context settings to register\n *\n * @throws {Error} When id is empty or null\n *\n * @example\n * ```typescript\n * globalContextService.register('my-widget', {\n * showTimeContext: true,\n * showAutoRefresh: false\n * });\n * ```\n */\n register(id: string, settings: Partial<GlobalContextSettings>): void {\n this.validateWidgetId(id);\n\n const registeredSettings: RegisteredGlobalContextSettings = {\n ...settings,\n id\n };\n\n const currentSettings = this.settings$.value;\n const existingIndex = this.findSettingsIndex(id, currentSettings);\n\n if (existingIndex >= 0) {\n this.updateExistingSettings(existingIndex, registeredSettings, currentSettings);\n } else {\n this.addNewSettings(registeredSettings, currentSettings);\n }\n }\n\n /**\n * Retrieves all currently registered widget settings.\n *\n * @returns Array of all registered settings with their widget IDs\n */\n getSettings(): readonly RegisteredGlobalContextSettings[] {\n return this.settings$.value;\n }\n\n /**\n * Removes all registered widget settings.\n * This will cause the consolidated settings to return to default values.\n */\n resetSettings(): void {\n this.settings$.next([]);\n }\n\n /**\n * Unregisters settings for a specific widget.\n *\n * @param id - Unique identifier of the widget to unregister\n *\n * @example\n * ```typescript\n * globalContextService.unregister('my-widget');\n * ```\n */\n unregister(id: string): void {\n if (!id) return; // Silently ignore invalid IDs\n\n const currentSettings = this.settings$.value;\n const filteredSettings = currentSettings.filter(s => s.id !== id);\n\n if (filteredSettings.length !== currentSettings.length) {\n this.settings$.next(filteredSettings);\n }\n }\n\n /**\n * Returns an observable of consolidated global context settings.\n *\n * Settings are consolidated using OR logic - if any widget requires a setting to be shown,\n * it will be included in the consolidated result. The observable emits distinct values only\n * and is shared among all subscribers for optimal performance.\n *\n * @returns Observable that emits consolidated settings whenever they change\n *\n * @example\n * ```typescript\n * globalContextService.getConsolidatedSettings().subscribe(settings => {\n * if (settings.showTimeContext) {\n * // Show time context controls\n * }\n * });\n * ```\n */\n getConsolidatedSettings(): Observable<GlobalContextSettings> {\n return this.settings$.pipe(\n map(settingsArray => this.consolidateSettings(settingsArray)),\n distinctUntilChanged(this.areSettingsEqual),\n shareReplay(1)\n );\n }\n\n /**\n * Returns the default global context settings.\n * These settings are used when no widgets have registered any settings.\n *\n * @returns Default settings object with all options disabled\n */\n getDefaultSettings(): GlobalContextSettings {\n return { ...DEFAULT_GLOBAL_CONTEXT_SETTINGS };\n }\n\n /**\n * Registers a loading state for a specific widget.\n * This will cause the `isLoading` computed signal to return true.\n *\n * @param id - Unique identifier of the widget in loading state\n *\n * @example\n * ```typescript\n * globalContextService.registerLoading('my-widget');\n * console.log(globalContextService.isLoading()); // true\n * ```\n */\n registerLoading(id: string): void {\n if (!id) return; // Silently ignore invalid IDs\n\n this.loadingIds.update(ids => {\n const newIds = new Set(ids);\n newIds.add(id);\n return newIds;\n });\n }\n\n /**\n * Unregisters a loading state for a specific widget.\n * When no widgets are in loading state, `isLoading` will return false.\n *\n * @param id - Unique identifier of the widget to remove from loading state\n *\n * @example\n * ```typescript\n * globalContextService.unregisterLoading('my-widget');\n * ```\n */\n unregisterLoading(id: string): void {\n if (!id) return; // Silently ignore invalid IDs\n\n this.loadingIds.update(ids => {\n const newIds = new Set(ids);\n newIds.delete(id);\n return newIds;\n });\n }\n\n /**\n * Returns the default global context state.\n * This state is used as the initial configuration for new global context instances.\n *\n * @returns Default global context state with live refresh enabled and 1-minute time range\n *\n * @example\n * ```typescript\n * const defaultState = globalContextService.getDefaultState();\n * console.log(defaultState.refreshOption); // 'live'\n * ```\n */\n getDefaultState(): GlobalContextState {\n return createDefaultGlobalContextState();\n }\n\n /**\n * Validates that a widget ID is not empty or null.\n *\n * @param id - Widget ID to validate\n * @throws {Error} When ID is invalid\n */\n private validateWidgetId(id: string): void {\n if (!id || id.trim().length === 0) {\n throw new Error('Widget ID cannot be empty or null');\n }\n }\n\n /**\n * Finds the index of settings for a given widget ID.\n *\n * @param id - Widget ID to search for\n * @param settings - Array of settings to search in\n * @returns Index of the settings or -1 if not found\n */\n private findSettingsIndex(\n id: string,\n settings: readonly RegisteredGlobalContextSettings[]\n ): number {\n return settings.findIndex(s => s.id === id);\n }\n\n /**\n * Updates existing settings for a widget.\n *\n * @param index - Index of the settings to update\n * @param newSettings - New settings to apply\n * @param currentSettings - Current settings array\n */\n private updateExistingSettings(\n index: number,\n newSettings: RegisteredGlobalContextSettings,\n currentSettings: readonly RegisteredGlobalContextSettings[]\n ): void {\n const updatedSettings = [...currentSettings];\n updatedSettings[index] = newSettings;\n this.settings$.next(updatedSettings);\n }\n\n /**\n * Adds new settings to the settings array.\n *\n * @param newSettings - Settings to add\n * @param currentSettings - Current settings array\n */\n private addNewSettings(\n newSettings: RegisteredGlobalContextSettings,\n currentSettings: readonly RegisteredGlobalContextSettings[]\n ): void {\n this.settings$.next([...currentSettings, newSettings]);\n }\n\n /**\n * Consolidates multiple widget settings using OR logic.\n *\n * @param settingsArray - Array of widget settings to consolidate\n * @returns Consolidated settings object\n */\n private consolidateSettings(\n settingsArray: readonly RegisteredGlobalContextSettings[]\n ): GlobalContextSettings {\n return settingsArray.reduce(\n (consolidated, current) => ({\n showTimeContext: consolidated.showTimeContext || !!current.showTimeContext,\n showAggregation: consolidated.showAggregation || !!current.showAggregation,\n showAutoRefresh: consolidated.showAutoRefresh || !!current.showAutoRefresh,\n showRefresh: consolidated.showRefresh || !!current.showRefresh,\n showRefreshInterval: consolidated.showRefreshInterval || !!current.showRefreshInterval\n }),\n { ...DEFAULT_GLOBAL_CONTEXT_SETTINGS }\n );\n }\n\n /**\n * Compares two settings objects for deep equality.\n *\n * @param prev - Previous settings\n * @param curr - Current settings\n * @returns True if settings are equal, false otherwise\n */\n private areSettingsEqual(prev: GlobalContextSettings, curr: GlobalContextSettings): boolean {\n return (\n prev.showTimeContext === curr.showTimeContext &&\n prev.showAggregation === curr.showAggregation &&\n prev.showAutoRefresh === curr.showAutoRefresh &&\n prev.showRefresh === curr.showRefresh &&\n prev.showRefreshInterval === curr.showRefreshInterval\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { FormBuilder, type FormGroup } from '@angular/forms';\nimport { omit, pick } from 'lodash-es';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport type { GlobalContextState } from '../../models/global-context.model';\nimport { createDefaultGlobalContextState } from '../../utils/global-context-defaults.util';\n\n/**\n * Service responsible for building and managing form groups for global context configuration.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextFormService {\n private readonly fb = inject(FormBuilder);\n\n /**\n * Creates a FormGroup for global context configuration.\n * @param config Optional existing configuration to initialize form values\n * @param defaults Optional override values for specific controls\n * @returns A fully configured FormGroup\n */\n buildForm(\n config: Partial<GlobalContextState> = {},\n defaults?: Partial<GlobalContextState>,\n skipProp?: Array<keyof GlobalContextState>\n ) {\n // Get base default values\n const defaultValues = this.getDefaultValues();\n\n // Extract valid config values\n const validConfigKeys = Object.keys(defaultValues) as Array<keyof GlobalContextState>;\n const configValues = pick(config, validConfigKeys) as Partial<GlobalContextState>;\n\n // Merge configurations with appropriate precedence\n const mergedValues = structuredClone(this.mergeValues(defaultValues, configValues, defaults));\n const filtered = omit(mergedValues, skipProp) as Partial<GlobalContextState>;\n\n return skipProp ? this.fb.group(filtered) : this.fb.group(mergedValues);\n }\n\n /**\n * Extracts form values into a configuration object\n * @param form The form to extract values from\n * @returns GlobalContextConfig object\n */\n getConfigFromForm(form: FormGroup): GlobalContextState {\n if (!form) return null;\n\n // Get raw form values\n const formValue = form.getRawValue();\n\n return {\n dateTimeContext: formValue.dateTimeContext,\n aggregation: formValue.aggregation,\n isAutoRefreshEnabled: formValue.isAutoRefreshEnabled,\n // Always use fixed 5s interval, ignore any form value\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n refreshOption: formValue.refreshOption\n };\n }\n\n /**\n * Gets the default values for the global context form\n */\n getDefaultValues(): GlobalContextState {\n return createDefaultGlobalContextState();\n }\n\n /**\n * Merges default values with config and explicit overrides\n */\n private mergeValues(\n defaultValues: GlobalContextState,\n configValues: Partial<GlobalContextState>,\n overrideValues?: Partial<GlobalContextState>\n ): GlobalContextState {\n // First merge config values over defaults\n const mergedBasicValues: GlobalContextState = {\n ...defaultValues,\n ...configValues\n };\n\n // Special handling for dateTimeContext\n if (configValues.dateTimeContext) {\n mergedBasicValues.dateTimeContext = {\n ...defaultValues.dateTimeContext,\n ...configValues.dateTimeContext\n };\n }\n\n // Apply explicit overrides if present\n if (overrideValues) {\n const result: GlobalContextState = {\n ...mergedBasicValues,\n ...overrideValues\n };\n\n if (overrideValues.dateTimeContext) {\n result.dateTimeContext = {\n ...mergedBasicValues.dateTimeContext,\n ...overrideValues.dateTimeContext\n };\n }\n\n return result;\n }\n\n return mergedBasicValues;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, filter, fromEvent, map, Observable } from 'rxjs';\nimport {\n GLOBAL_CONTEXT_EVENTS,\n GlobalContextEventRegistry,\n GlobalContextEventType,\n GlobalContextEventUnion\n} from '../../models/global-context.model';\n\n/**\n * Configuration constants for the event service.\n */\nconst EVENT_CONFIG = {\n /** Name of the custom event dispatched on the window object */\n EVENT_NAME: 'global-context',\n /** Maximum number of cached event subjects to prevent memory leaks */\n MAX_CACHED_SUBJECTS: 50\n} as const;\n\n/**\n * GlobalContextEventService manages global context events using the browser's native event system.\n *\n * This service provides a type-safe wrapper around window custom events for global context communication.\n * It maintains event subjects for efficient observable-based event handling while ensuring proper\n * cleanup and memory management.\n *\n * Key features:\n * - Type-safe event emission and subscription\n * - Latest value caching for each event type\n * - Memory-efficient subject management\n * - Integration with browser's native event system\n *\n * @example\n * ```typescript\n * // Emit an event\n * eventService.emit('GLOBAL_CONTEXT_STATE_CHANGE', {\n * refreshOption: 'live',\n * isAutoRefreshEnabled: true\n * });\n *\n * // Subscribe to events\n * eventService.on('GLOBAL_CONTEXT_STATE_CHANGE').subscribe(state => {\n * console.log('State changed:', state);\n * });\n *\n * // Get the latest value\n * const latestState = eventService.getLatestValue('GLOBAL_CONTEXT_STATE_CHANGE');\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextEventService {\n /** Map storing BehaviorSubjects for each event type to cache latest values */\n private readonly eventSubjects = new Map<\n GlobalContextEventType,\n BehaviorSubject<GlobalContextEventRegistry[GlobalContextEventType] | null>\n >();\n\n /** Observable stream of all global context events from the window */\n private readonly events$ = fromEvent<CustomEvent<GlobalContextEventUnion>>(\n window,\n EVENT_CONFIG.EVENT_NAME\n ).pipe(map(event => event.detail));\n\n /**\n * Emits a global context event with type-safe payload.\n *\n * The event is both stored locally for latest value retrieval and dispatched\n * as a browser custom event for cross-component communication.\n *\n * @param type - The specific event type to emit (must be a valid GlobalContextEventType)\n * @param payload - Type-safe payload matching the event type requirements\n *\n * @throws {Error} When event type is invalid or payload validation fails\n *\n * @example\n * ```typescript\n * // Emit a state change event\n * eventService.emit('GLOBAL_CONTEXT_STATE_CHANGE', {\n * refreshOption: 'live',\n * isAutoRefreshEnabled: true\n * });\n *\n * // Emit a refresh event\n * eventService.emit('GLOBAL_CONTEXT_REFRESH', {\n * dateFrom: '2024-01-01',\n * dateTo: '2024-01-02'\n * });\n * ```\n */\n emit<T extends GlobalContextEventType>(type: T, payload?: GlobalContextEventRegistry[T]): void {\n const payloadCopy = structuredClone(payload);\n\n try {\n this.validateEventType(type);\n\n // Update the local subject with the new value\n const subject = this.getOrCreateEventSubject(type);\n subject.next(payloadCopy ?? null);\n\n // Dispatch the browser event for cross-component communication\n this.dispatchBrowserEvent(type, payloadCopy);\n } catch (error) {\n console.error(`Failed to emit global context event '${type}':`, error);\n throw error;\n }\n }\n\n /**\n * Creates an observable that emits whenever a specific event type occurs.\n *\n * The observable filters the global event stream to only emit events of the specified type.\n * This provides efficient, reactive event handling without manual event listener management.\n *\n * @param eventType - The specific event type to observe\n * @returns Observable that emits payloads of the specified event type\n *\n * @throws {Error} When event type is invalid\n *\n * @example\n * ```typescript\n * // Subscribe to state changes\n * eventService.on('GLOBAL_CONTEXT_STATE_CHANGE')\n * .pipe(takeUntilDestroyed())\n * .subscribe(state => {\n * console.log('New state:', state);\n * });\n *\n * // Subscribe to refresh events with filtering\n * eventService.on('GLOBAL_CONTEXT_REFRESH')\n * .pipe(\n * filter(data => data?.interval === 'MINUTES'),\n * takeUntilDestroyed()\n * )\n * .subscribe(refreshData => {\n * console.log('Minute-based refresh:', refreshData);\n * });\n * ```\n */\n on<T extends GlobalContextEventType>(eventType: T): Observable<GlobalContextEventRegistry[T]> {\n try {\n this.validateEventType(eventType);\n\n return this.events$.pipe(\n filter((event): event is GlobalContextEventUnion => event.type === eventType),\n map(event => event.payload as GlobalContextEventRegistry[T])\n );\n } catch (error) {\n console.error(`Failed to create observable for event '${eventType}':`, error);\n throw error;\n }\n }\n\n /**\n * Retrieves the most recently emitted value for a specific event type.\n *\n * This method provides synchronous access to the latest event data without\n * requiring a subscription. Returns null if no event of the specified type\n * has been emitted yet.\n *\n * @param eventType - The event type to retrieve the latest value for\n * @returns The latest emitted value or null if none exists\n *\n * @throws {Error} When event type is invalid\n *\n * @example\n * ```typescript\n * // Get the current state\n * const currentState = eventService.getLatestValue('GLOBAL_CONTEXT_STATE_CHANGE');\n * if (currentState) {\n * console.log('Current refresh option:', currentState.refreshOption);\n * }\n *\n * // Check for latest refresh data\n * const refreshData = eventService.getLatestValue('GLOBAL_CONTEXT_REFRESH');\n * if (refreshData?.dateFrom) {\n * console.log('Last refresh from:', refreshData.dateFrom);\n * }\n * ```\n */\n getLatestValue<T extends GlobalContextEventType>(\n eventType: T\n ): GlobalContextEventRegistry[T] | null {\n try {\n this.validateEventType(eventType);\n\n const value = this.getOrCreateEventSubject(eventType).getValue();\n return structuredClone(value);\n } catch (error) {\n console.error(`Failed to get latest value for event '${eventType}':`, error);\n throw error;\n }\n }\n\n /**\n * Synchronizes dateTimeContext from REFRESH event to STATE_CHANGE event.\n *\n * This method ensures that when a REFRESH event contains dateTimeContext data,\n * it updates the STATE_CHANGE event subject's value directly without emitting a new event.\n * This keeps the internal state synchronized without triggering listeners.\n *\n * @param refreshDateTimeContext - The dateTimeContext from the REFRESH event to sync\n *\n * @example\n * ```typescript\n * // When a refresh occurs with new dateTimeContext\n * const refreshData = { dateFrom: '2024-01-01', dateTo: '2024-01-02', interval: 'HOURLY' };\n * eventService.emit(GLOBAL_CONTEXT_EVENTS.REFRESH, refreshData);\n *\n * // Sync it to STATE_CHANGE internal state\n * eventService.syncRefreshToStateChange(refreshData);\n * ```\n */\n syncRefreshToStateChange(\n refreshDateTimeContext?: GlobalContextEventRegistry[typeof GLOBAL_CONTEXT_EVENTS.REFRESH]\n ): void {\n if (!refreshDateTimeContext) {\n return;\n }\n\n // Only update if we have all required properties for DateTimeContext\n if (\n refreshDateTimeContext.dateFrom &&\n refreshDateTimeContext.dateTo &&\n refreshDateTimeContext.interval\n ) {\n // Get the STATE_CHANGE subject\n const stateChangeSubject = this.getOrCreateEventSubject(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE);\n const currentState = stateChangeSubject.getValue() || {};\n\n // Merge refresh dateTimeContext into current state\n const updatedState = {\n ...currentState,\n dateTimeContext: {\n dateFrom: refreshDateTimeContext.dateFrom,\n dateTo: refreshDateTimeContext.dateTo,\n interval: refreshDateTimeContext.interval\n }\n };\n\n // Update the subject's value directly without emitting an event\n stateChangeSubject.next(updatedState);\n }\n }\n\n /**\n * Validates that an event type is not empty or invalid.\n *\n * @param eventType - The event type to validate\n * @throws {Error} When event type is invalid\n */\n private validateEventType(eventType: string): void {\n if (!eventType || typeof eventType !== 'string' || eventType.trim().length === 0) {\n throw new Error('Event type must be a non-empty string');\n }\n }\n\n /**\n * Dispatches a browser custom event for cross-component communication.\n *\n * @param type - Event type\n * @param payload - Event payload\n */\n private dispatchBrowserEvent<T extends GlobalContextEventType>(\n type: T,\n payload?: GlobalContextEventRegistry[T]\n ): void {\n const customEvent = new CustomEvent(EVENT_CONFIG.EVENT_NAME, {\n detail: {\n type,\n payload,\n timestamp: Date.now()\n }\n });\n\n window.dispatchEvent(customEvent);\n }\n\n /**\n * Gets or creates a BehaviorSubject for a specific event type.\n * Implements memory management by limiting the number of cached subjects.\n *\n * @param type - The event type\n * @returns BehaviorSubject for the event type\n */\n private getOrCreateEventSubject<T extends GlobalContextEventType>(\n type: T\n ): BehaviorSubject<GlobalContextEventRegistry[T] | null> {\n if (!this.eventSubjects.has(type)) {\n // Implement basic memory management\n this.ensureSubjectCacheLimit();\n\n const newSubject = new BehaviorSubject<GlobalContextEventRegistry[T] | null>(null);\n this.eventSubjects.set(type, newSubject as BehaviorSubject<any>);\n }\n\n return this.eventSubjects.get(type) as BehaviorSubject<GlobalContextEventRegistry[T] | null>;\n }\n\n /**\n * Ensures the event subject cache doesn't exceed the maximum limit.\n * Removes the oldest subjects when limit is reached.\n */\n private ensureSubjectCacheLimit(): void {\n if (this.eventSubjects.size >= EVENT_CONFIG.MAX_CACHED_SUBJECTS) {\n const firstKey = this.eventSubjects.keys().next().value;\n if (firstKey) {\n const subject = this.eventSubjects.get(firstKey);\n if (subject && !subject.closed) {\n subject.complete();\n }\n this.eventSubjects.delete(firstKey);\n }\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport { LinkStatesMap } from '../../models/control-flow.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GlobalContextDisplayMode,\n GlobalContextSettings,\n WidgetControls\n} from '../../models/global-context.model';\n\n/**\n * Standard result interface for all widget settings operations.\n * Used consistently across resolution, toggle, and configuration methods.\n */\nexport interface WidgetSettingsResult {\n /** Settings for inline (widget-level) controls (new naming) */\n settings: Partial<GlobalContextSettings>;\n /** Link states determining dashboard vs inline control visibility */\n links: LinkStatesMap;\n /** Settings for dashboard-level controls (new naming) */\n dashboardControls: Partial<GlobalContextSettings>;\n}\n\n/**\n * Service responsible for managing widget-level control settings and their interaction\n * with dashboard-level controls. Handles the resolution of settings based on display mode,\n * link states, and refresh options.\n *\n * Key responsibilities:\n * - Widget settings resolution for different display modes\n * - Link state management between inline and dashboard controls\n * - Dashboard control calculations based on link states\n * - Settings toggle operations for individual and bulk link changes\n */\n@Injectable({ providedIn: 'root' })\nexport class WidgetControlService {\n // ========================================\n // PUBLIC API METHODS\n // ========================================\n\n /**\n * Resolves widget settings for inline controls based on the specified mode and refresh option.\n * For dashboard mode, calculates the split between inline and dashboard controls.\n *\n * @param controls - Widget control configuration containing settings and links\n * @param mode - Display mode determining which settings to use\n * @param refreshOption - Refresh mode (live/history) for settings selection\n * @returns Resolved settings with inline controls, links, and dashboard controls\n */\n resolveInlineControlSettings(\n controls: WidgetControls,\n mode: GlobalContextDisplayMode,\n refreshOption: RefreshOption\n ): WidgetSettingsResult {\n const baseSettings = this.getInlineSettingsFromWidgetControls(controls, mode, refreshOption);\n const baseLinks = this.getDefaultLinksFromControls(controls, mode, refreshOption);\n\n if (mode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n // Calculate dashboard controls with the merged settings and links\n const { newSettings: newInlineSettings, dashboardSettings } = this.calculateDashboardSettings(\n baseSettings,\n baseLinks\n );\n return {\n settings: newInlineSettings,\n links: baseLinks,\n dashboardControls: dashboardSettings\n };\n }\n\n return {\n settings: baseSettings,\n links: baseLinks,\n dashboardControls: {}\n };\n }\n\n /**\n * Resolves widget settings for configuration controls based on the specified mode and refresh option.\n * Configuration controls are simpler and don't require dashboard control calculations.\n *\n * @param controls - Widget control configuration containing config settings\n * @param mode - Display mode determining which config settings to use\n * @param refreshOption - Refresh mode (live/history) for settings selection\n * @returns Resolved configuration settings with empty links and dashboard controls\n */\n resolveConfigControlSettings(\n controls: WidgetControls,\n mode: GlobalContextDisplayMode,\n refreshOption: RefreshOption\n ): WidgetSettingsResult {\n const baseSettings = this.getConfigSettingsFromWidgetControls(controls, mode, refreshOption);\n return {\n settings: baseSettings,\n links: {},\n dashboardControls: {}\n };\n }\n\n /**\n * Extracts inline settings from widget controls for the specified display mode and refresh option.\n * Applies fallback logic for invalid refresh options, defaulting to LIVE mode.\n *\n * @param controls - Widget control configuration\n * @param displayMode - Display mode (dashboard, config, view_and_config)\n * @param refreshOption - Refresh mode, may be invalid and will fallback to LIVE\n * @returns Inline settings for the specified mode and refresh option\n */\n getInlineSettingsFromWidgetControls(\n controls: WidgetControls,\n displayMode: GlobalContextDisplayMode,\n refreshOption: RefreshOption | string\n ): Partial<GlobalContextSettings> {\n const validatedRefresh = this.validateRefreshOption(refreshOption);\n const templateSettings = controls?.settings?.[displayMode]?.[validatedRefresh] || {};\n return { ...templateSettings };\n }\n\n /**\n * Extracts configuration settings from widget controls for the specified display mode and refresh option.\n * Applies fallback logic for invalid refresh options, defaulting to LIVE mode.\n *\n * @param controls - Widget control configuration\n * @param displayMode - Display mode (dashboard, config, view_and_config)\n * @param refreshOption - Refresh mode, may be invalid and will fallback to LIVE\n * @returns Configuration settings for the specified mode and refresh option\n */\n getConfigSettingsFromWidgetControls(\n controls: WidgetControls,\n displayMode: GlobalContextDisplayMode,\n refreshOption: RefreshOption | string\n ): Partial<GlobalContextSettings> {\n const validatedRefresh = this.validateRefreshOption(refreshOption);\n const configSettings = controls?.configSettings?.[displayMode]?.[validatedRefresh] || {};\n return { ...configSettings };\n }\n\n /**\n * Extracts default link states from widget controls for the specified display mode and refresh option.\n * Applies fallback logic for invalid refresh options, defaulting to LIVE mode.\n *\n * @param controls - Widget control configuration\n * @param displayMode - Display mode (dashboard, config, view_and_config)\n * @param refreshOption - Refresh mode, may be invalid and will fallback to LIVE\n * @returns Default link states for the specified mode and refresh option\n */\n getDefaultLinksFromControls(\n controls: WidgetControls,\n displayMode: GlobalContextDisplayMode,\n refreshOption: RefreshOption | string\n ): LinkStatesMap {\n const validatedRefresh = this.validateRefreshOption(refreshOption);\n const defaultLinks = controls?.defaultLinks?.[displayMode]?.[validatedRefresh] || {};\n return { ...defaultLinks };\n }\n\n /**\n * Toggles a single link state and recalculates the resulting settings and dashboard controls.\n * When a link is toggled, it affects how controls are distributed between inline and dashboard.\n *\n * @param linkKey - The key of the link to toggle\n * @param currentSettings - Current inline control settings\n * @param currentLinks - Current link states\n * @returns Updated settings with toggled link and recalculated dashboard controls\n */\n toggleControlLink(\n linkKey: string,\n currentSettings: Partial<GlobalContextSettings>,\n currentLinks: LinkStatesMap\n ): WidgetSettingsResult {\n const updatedLinks = { ...currentLinks };\n updatedLinks[linkKey] = !updatedLinks[linkKey];\n\n const { newSettings, dashboardSettings } = this.calculateDashboardSettings(\n currentSettings,\n updatedLinks\n );\n\n return {\n settings: newSettings,\n links: updatedLinks,\n dashboardControls: dashboardSettings\n };\n }\n\n /**\n * Sets all link states to the specified value and recalculates the resulting settings.\n * This is used for bulk operations like \"link all\" or \"unlink all\" controls.\n *\n * @param state - The state to set for all links (true = linked, false = unlinked)\n * @param currentSettings - Current inline control settings\n * @param currentLinks - Current link states\n * @returns Updated settings with all links set to the specified state\n */\n toggleAllControlLinks(\n state: boolean,\n currentSettings: Partial<GlobalContextSettings>,\n currentLinks: LinkStatesMap\n ): WidgetSettingsResult {\n const updatedLinks = { ...currentLinks };\n Object.keys(updatedLinks).forEach(key => {\n updatedLinks[key] = state;\n });\n\n const { newSettings, dashboardSettings } = this.calculateDashboardSettings(\n currentSettings,\n updatedLinks\n );\n\n return {\n settings: newSettings,\n links: updatedLinks,\n dashboardControls: dashboardSettings\n };\n }\n\n /**\n * Validates and normalizes a refresh option, providing fallback to LIVE for invalid values.\n * Handles type coercion and validates against the REFRESH_OPTION enum.\n *\n * @param refreshOption - Refresh option to validate (may be string or RefreshOption)\n * @returns Valid RefreshOption, defaulting to LIVE for invalid inputs\n */\n private validateRefreshOption(refreshOption: RefreshOption | string): RefreshOption {\n return Object.values(REFRESH_OPTION).includes(refreshOption as RefreshOption)\n ? (refreshOption as RefreshOption)\n : REFRESH_OPTION.LIVE;\n }\n\n /**\n * Calculates how settings should be split between dashboard and inline controls based on link states.\n * When a control is linked (true), it appears on the dashboard. When unlinked (false), it appears inline.\n * This method implements the core business logic for the dashboard/inline control relationship.\n *\n * @param settings - Base settings to split between dashboard and inline\n * @param links - Link states determining where each control should appear\n * @returns Object containing settings for both inline and dashboard controls\n */\n private calculateDashboardSettings(\n settings: Partial<GlobalContextSettings>,\n links: LinkStatesMap\n ): {\n newSettings: Partial<GlobalContextSettings>;\n dashboardSettings: Partial<GlobalContextSettings>;\n } {\n const inlineSettings = { ...(settings || {}) };\n const dashboardSettings: Partial<GlobalContextSettings> = {};\n\n // If links is empty, set all dashboard settings to false\n if (Object.keys(links ?? {}).length === 0) {\n if (settings && 'showTimeContext' in settings) dashboardSettings.showTimeContext = false;\n if (settings && 'showAutoRefresh' in settings) dashboardSettings.showAutoRefresh = false;\n if (settings && 'showRefresh' in settings) dashboardSettings.showRefresh = false;\n if (settings && 'showRefreshInterval' in settings)\n dashboardSettings.showRefreshInterval = false;\n if (settings && 'showAggregation' in settings) dashboardSettings.showAggregation = false;\n } else {\n // Otherwise, set based on links values\n if (settings && 'showTimeContext' in settings && 'dateTimeContext' in links) {\n dashboardSettings.showTimeContext = links.dateTimeContext;\n inlineSettings.showTimeContext = !links.dateTimeContext;\n }\n if (settings && 'showAutoRefresh' in settings && 'isAutoRefreshEnabled' in links) {\n dashboardSettings.showAutoRefresh = links.isAutoRefreshEnabled;\n inlineSettings.showAutoRefresh = !links.isAutoRefreshEnabled;\n }\n if (settings && 'showRefresh' in settings) {\n dashboardSettings.showRefresh = !settings.showRefresh;\n inlineSettings.showRefresh = settings.showRefresh;\n }\n if (settings && 'showRefreshInterval' in settings && 'isAutoRefreshEnabled' in links) {\n dashboardSettings.showRefreshInterval =\n settings.showRefreshInterval && links.isAutoRefreshEnabled;\n inlineSettings.showRefreshInterval = inlineSettings.showAutoRefresh;\n }\n if (settings && 'showAggregation' in settings && 'aggregation' in links) {\n dashboardSettings.showAggregation = links.aggregation;\n inlineSettings.showAggregation = !links.aggregation;\n }\n }\n\n return { newSettings: inlineSettings, dashboardSettings };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { type Interval, INTERVALS, type TimeInterval } from '../../models/interval-picker.model';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\n\n@Injectable({ providedIn: 'root' })\nexport class DateTimeContextPickerService {\n /**\n * Calculates date time context according to provided interval.\n *\n * @param intervalId - Interval id indicating time range\n * @returns Tuple of [dateFrom, dateTo] where dateTo is current time, or null if interval is invalid\n *\n * @example\n * ```typescript\n * // Returns [epoch, current date] for 'none' interval\n * service.getDateTimeContextByInterval('none');\n *\n * // Returns [1 hour ago, now] for 'hours' interval\n * service.getDateTimeContextByInterval('hours');\n *\n * // Returns null for invalid intervals\n * service.getDateTimeContextByInterval('invalid'); // null\n * ```\n */\n getDateTimeContextByInterval(intervalId: TimeInterval): [Date, Date] | null {\n // Delegate to the central utility\n return DateTimeContextUtil.dateRangeFromInterval(intervalId);\n }\n\n /**\n * Validates provided param for being selectable Interval id.\n * @param intervalId Interval id to be validated.\n * @returns True if provided id is valid, selectable Interval id and false if it's not.\n */\n isSelectableInterval(intervalId: Interval['id']): boolean {\n // Handle type safety - return false for non-string inputs\n if (typeof intervalId !== 'string') {\n return false;\n }\n\n // 'custom' interval is not selectable\n if (intervalId === 'custom') {\n return false;\n }\n\n // 'none' interval is selectable (special case)\n if (intervalId === 'none') {\n return true;\n }\n\n // Check if interval exists in INTERVALS array\n return INTERVALS.some(({ id }) => id === intervalId);\n }\n\n /**\n * Validates provided date \"from\" and date \"to\":\n * - if both dates are proper date strings/values\n * - if provided date from is earlier than date to.\n * @param stringifiedDateFrom Date \"from\" that should be validated.\n * @param stringifiedDateTo Date \"to\" that should be validated.\n * @returns Result of validation of dates range.\n */\n isValidDateRange(stringifiedDateFrom: string, stringifiedDateTo: string): boolean {\n // Delegate to the central utility\n return DateTimeContextUtil.isValidRange(stringifiedDateFrom, stringifiedDateTo);\n }\n\n /**\n * Validates provided aggregation type.\n * @param aggregation Aggregation type to be validated.\n * @returns Result of validation of aggregation.\n */\n isValidAggregation(aggregation: aggregationType | null): boolean {\n // null is a valid aggregation (no aggregation)\n if (aggregation === null) {\n return true;\n }\n\n // Check if aggregation is one of the valid enum values\n return Object.values(aggregationType).includes(aggregation);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport { DateTimeContext } from '../../models/date-time-context-picker.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GlobalContextState } from '../../models/global-context.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport { TIME_INTERVAL, TIME_SPAN_MS, TimeInterval } from '../../models/interval-picker.model';\nimport { DateTimeContextPickerService } from './date-time-context-picker.service';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\n\n/**\n * Legacy widget configuration interface representing the various formats used in older widgets.\n *\n * This interface captures all possible legacy configuration properties that need to be migrated\n * to the new GlobalContextState format. Legacy widgets could store these properties at different\n * nesting levels (root, config, or mapConfig) with varying naming conventions.\n *\n * Note: The field 'canDecoupleGlobalTimeContext' was intentionally excluded from migration logic.\n * This field was used in legacy configurations but is no longer relevant for the new Global Context system.\n */\nexport interface LegacyWidgetConfig {\n /**\n * Widget capability declarations from widget definitions.\n * These indicate which global context features the widget supports,\n * but don't represent the actual configuration values.\n */\n displaySettings?: {\n /** Whether widget supports global time context feature */\n globalTimeContext?: boolean;\n /** Whether widget supports auto-refresh feature */\n globalAutoRefreshContext?: boolean;\n /** Whether widget supports realtime updates */\n globalRealtimeContext?: boolean;\n /** Whether widget supports data aggregation */\n globalAggregationContext?: boolean;\n };\n\n /**\n * Actual widget instance configuration determining which features are active.\n * These take precedence over displaySettings when determining migration behavior.\n */\n /** Whether this widget instance uses global time context */\n widgetInstanceGlobalTimeContext?: boolean;\n /** Whether this widget instance uses global auto-refresh */\n widgetInstanceGlobalAutoRefreshContext?: boolean;\n /** @deprecated Deprecated field not used in migration */\n canDecoupleGlobalTimeContext?: boolean;\n /** Whether to display date selection controls in the widget */\n displayDateSelection?: boolean;\n\n /** Legacy time configuration properties (multiple formats supported) */\n /** Date range as array [from, to] - used by some widgets */\n dateFilter?: string[] | [string, string];\n /** Date range as array [from, to] - alternative legacy format */\n date?: string[] | [string, string];\n /** Start date as ISO string */\n dateFrom?: string;\n /** End date as ISO string */\n dateTo?: string;\n /** Time interval identifier (e.g., 'hours', 'days', 'none') */\n interval?: string;\n\n /** Legacy refresh configuration properties */\n /** Legacy refresh mode ('interval', 'global-interval', 'none') */\n refreshOption?: string;\n /** Whether auto-refresh is enabled */\n isAutoRefreshEnabled?: boolean;\n /** Refresh interval in milliseconds */\n refreshInterval?: number;\n /** Whether widget is in realtime mode */\n isRealtime?: boolean;\n /** Alternative realtime flag used by some widgets */\n realtime?: boolean;\n\n /**\n * Nested configuration objects where widgets might store their settings.\n * The migration service checks these nested levels to ensure all configuration is captured.\n */\n /** Map widget specific configuration */\n mapConfig?: Record<string, unknown>;\n /** Generic nested configuration */\n config?: Record<string, unknown>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class WidgetConfigMigrationService {\n constructor(private dateTimeContextPickerService: DateTimeContextPickerService) {}\n\n /**\n * Transforms legacy widget configurations into the standardized GlobalContextState format.\n *\n * This migration handles the transition from various legacy configuration formats to the new\n * unified global context system. It detects which properties need updating and\n * preserves configurations that are already in the correct format.\n *\n * **What is migrated:**\n * - `displayMode`: Derived from widgetInstanceGlobalTimeContext/AutoRefreshContext flags\n * - `dateTimeContext`: Normalized from dateFilter, date, dateFrom/dateTo, or interval fields\n * - `refreshOption`: Converted from legacy 'interval'/'global-interval'/'none' values to LIVE/HISTORY\n * - `isAutoRefreshEnabled` + `refreshInterval`: Determined from realtime flags and legacy settings\n * - `aggregation`: Normalized from legacy 'NONE' string to null\n *\n *\n * **Use case:**\n * Call this on every widget configuration before rendering to ensure compatibility with\n * the global context system, regardless of when the widget was created or last saved.\n *\n * @param config - Widget configuration object that may contain legacy or new format properties.\n * Can be any object type, but should contain widget configuration fields.\n * @returns Configuration with all required GlobalContextState properties, either migrated from\n * legacy format or preserved if already valid. Returns input unchanged if null/undefined.\n *\n * @example\n * ```ts\n * // Legacy config with old format\n * const legacyConfig = {\n * widgetInstanceGlobalTimeContext: true,\n * dateFrom: '2024-01-01',\n * dateTo: '2024-01-02',\n * refreshOption: 'interval'\n * };\n *\n * // After migration\n * const migrated = migrationService.migrateWidgetConfig(legacyConfig);\n * // {\n * // displayMode: 'dashboard',\n * // dateTimeContext: { dateFrom: '2024-01-01T00:00:00.000Z', dateTo: '2024-01-02T00:00:00.000Z', interval: 'custom' },\n * // refreshOption: 'live',\n * // isAutoRefreshEnabled: true,\n * // refreshInterval: 60000,\n * // aggregation: null\n * // }\n * ```\n */\n migrateWidgetConfig<T extends object = object>(config: T): Partial<GlobalContextState> {\n // Guard: Handle invalid config\n if (!config) {\n return config as Partial<GlobalContextState>;\n }\n\n // Cast to unknown first, then to our working type\n const configObj = config as unknown as Record<string, unknown>;\n\n // Check if already has valid new format (minimal check)\n const hasValidDisplayMode =\n typeof configObj.displayMode === 'string' && this.isValidDisplayMode(configObj.displayMode);\n const hasValidRefreshOption =\n typeof configObj.refreshOption === 'string' &&\n this.isValidRefreshOption(configObj.refreshOption);\n\n // If has basic valid format and no legacy fields needing migration, return as is\n if (hasValidDisplayMode && hasValidRefreshOption && !this.hasLegacyFields(configObj)) {\n return config as Partial<GlobalContextState>;\n }\n\n // Extract settings from all levels (including nested) for migration decisions\n const settingsForMigration = this.extractGlobalContextSettings(configObj);\n\n // Create a flat config without nested objects (to avoid duplication in output)\n const flatConfig = this.createFlatConfig(configObj);\n\n // Apply migrations based on the merged settings\n this.applyGlobalContextProperties(flatConfig, settingsForMigration);\n\n return flatConfig;\n }\n\n /**\n * Creates a flattened configuration by excluding nested configuration objects.\n *\n * Legacy widgets often stored settings in nested objects like `mapConfig` or `config`.\n * This method creates a copy of the configuration without these nested objects to prevent\n * duplication in the migrated output - the nested values are extracted and merged separately\n * by extractGlobalContextSettings().\n *\n * @param config - The raw widget configuration potentially containing nested objects\n * @returns Flattened configuration without mapConfig and config properties\n *\n */\n private createFlatConfig(config: Record<string, unknown>): Partial<GlobalContextState> {\n const { mapConfig: _mapConfig, config: _nestedConfig, ...flatConfig } = config;\n return structuredClone(flatConfig) as Partial<GlobalContextState>;\n }\n\n /**\n * Applies or migrates all global context properties to ensure complete configuration.\n *\n * This method implements a selective migration strategy:\n * - Checks which properties are missing or invalid in the current config\n * - Migrates only the properties that need updating\n * - Forces full migration when config has NO global context properties at all\n *\n * The method ensures that all widgets end up with valid displayMode, dateTimeContext,\n * refreshOption/isAutoRefreshEnabled/refreshInterval, and aggregation settings.\n *\n * @param config - The configuration object to modify (mutated in place)\n * @param mergedSettings - Combined settings from all config levels used for migration decisions\n *\n */\n private applyGlobalContextProperties(\n config: Partial<GlobalContextState>,\n mergedSettings: Record<string, unknown>\n ): void {\n // Check if this config has no global context properties at all\n const hasNoGlobalContext = this.hasNoGlobalContextProperties(config);\n\n // Check what needs migration\n const needsDisplayMode = !this.isValidDisplayMode(config.displayMode);\n const needsDateTimeContext = !config.dateTimeContext;\n const needsRefreshSettings = this.needsRefreshSettingsMigration(config, mergedSettings);\n const needsAggregation =\n (mergedSettings.aggregation as string) === 'NONE' || config.aggregation === undefined;\n\n // Apply migrations based on needs or if no global context exists\n if (needsDisplayMode || hasNoGlobalContext) {\n config.displayMode = this.resolveDisplayMode(mergedSettings);\n }\n\n if (needsDateTimeContext || hasNoGlobalContext) {\n config.dateTimeContext = this.resolveDateTimeContext(mergedSettings);\n }\n\n if (needsRefreshSettings || hasNoGlobalContext) {\n this.applyRefreshSettings(config, mergedSettings);\n }\n\n if (needsAggregation || hasNoGlobalContext) {\n config.aggregation = this.normalizeAggregation(config.aggregation);\n }\n }\n\n /**\n * Determines if a configuration completely lacks global context properties.\n *\n * Used to detect widgets that have never been configured for global context integration.\n * When true, the migration applies full default configuration rather than selective updates.\n *\n * @param config - The configuration to check\n * @returns true if all global context properties are missing or undefined\n *\n */\n private hasNoGlobalContextProperties(config: Partial<GlobalContextState>): boolean {\n return (\n !config.displayMode &&\n !config.dateTimeContext &&\n config.refreshOption === undefined &&\n config.isAutoRefreshEnabled === undefined &&\n config.refreshInterval === undefined &&\n config.aggregation === undefined\n );\n }\n\n /**\n * Applies refresh settings as a cohesive unit to ensure consistency.\n *\n * The three refresh properties (refreshOption, isAutoRefreshEnabled, refreshInterval) are\n * interdependent and must be migrated together to avoid inconsistent states:\n * - refreshOption determines the mode (LIVE vs HISTORY)\n * - isAutoRefreshEnabled controls whether auto-refresh is active\n * - refreshInterval sets the refresh frequency in milliseconds\n *\n * Special handling:\n * - Realtime widgets get LIVE mode with 5-second interval\n * - Legacy refreshOption values are normalized to LIVE or HISTORY\n * - Nested config refreshInterval values are prioritized\n *\n * @param config - The configuration object to update (mutated in place)\n * @param mergedSettings - Combined settings from all levels for migration decisions\n *\n */\n private applyRefreshSettings(\n config: Partial<GlobalContextState>,\n mergedSettings: Record<string, unknown>\n ): void {\n const isRealtime = this.isRealtimeWidget(mergedSettings);\n const legacyRefreshOption = mergedSettings.refreshOption;\n\n // Refresh Option\n if (!this.isValidRefreshOption(config.refreshOption)) {\n config.refreshOption = this.resolveRefreshOption(\n isRealtime,\n typeof legacyRefreshOption === 'string' ? legacyRefreshOption : undefined\n );\n }\n\n // Auto Refresh Enabled\n if (config.isAutoRefreshEnabled === undefined) {\n config.isAutoRefreshEnabled = this.resolveAutoRefreshEnabled(\n isRealtime,\n typeof legacyRefreshOption === 'string' ? legacyRefreshOption : undefined\n );\n }\n\n // Refresh Interval - always use default 5s interval (ignore stored values)\n // This ensures old dashboards with custom intervals are migrated to the fixed 5s interval\n config.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n }\n\n /**\n * Determines the appropriate display mode based on legacy widget configuration.\n *\n * Display mode controls how the widget integrates with global context:\n * - DASHBOARD: Fully controlled by dashboard-level global context\n * - CONFIG: Widget manages its own settings independently\n * - VIEW_AND_CONFIG: Widget shows inline controls and can configure itself\n *\n * Decision logic priority:\n * 1. displayDateSelection=true → VIEW_AND_CONFIG (explicit request for date controls)\n * 2. Both time and refresh are global → DASHBOARD (full integration)\n * 3. One global, one local → VIEW_AND_CONFIG (partial integration)\n * 4. One setting defined → DASHBOARD (assume global by default)\n * 5. Both undefined → CONFIG (widget manages itself)\n *\n * @param settings - Merged settings from all config levels\n * @returns The appropriate display mode for the widget\n *\n */\n private resolveDisplayMode(settings: Record<string, unknown>): GLOBAL_CONTEXT_DISPLAY_MODE {\n // Special case: Display date selection\n if (settings.displayDateSelection === true) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG;\n }\n\n const timeGlobal = settings.widgetInstanceGlobalTimeContext;\n const refreshGlobal = settings.widgetInstanceGlobalAutoRefreshContext;\n\n // Explicit configurations\n if (timeGlobal === true && refreshGlobal === true) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n\n if (timeGlobal === true && refreshGlobal === false) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG;\n }\n\n if (timeGlobal === false && refreshGlobal === true) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG;\n }\n\n // Single setting defined\n if (timeGlobal === true && refreshGlobal === undefined) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n\n if (timeGlobal === undefined && refreshGlobal === true) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n\n // Both undefined - widget manages itself\n if (timeGlobal === undefined && refreshGlobal === undefined) {\n return GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n }\n\n // Default to CONFIG (widget manages itself)\n return GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n }\n\n /**\n * Builds date/time context from various legacy configuration formats.\n *\n * Legacy widgets stored time configuration in many different ways. This method\n * normalizes all formats into the new DateTimeContext structure with consistent\n * ISO date strings and proper interval classification.\n *\n * Resolution priority:\n * 1. interval='none' → Always epoch (1970) to now with CUSTOM interval\n * 2. Predefined intervals (hours, days, etc.) → Calculate fresh dates based on interval\n * 3. Legacy date fields → Use provided dates with calculated/custom interval\n * 4. Widget needs time context → Apply default (last hour)\n * 5. Fallback → Last hour with HOURS interval\n *\n * Special cases:\n * - interval='none' always means \"all data\" regardless of other date fields\n * - Predefined intervals recalculate dates to be relative to current time\n * - Custom date ranges preserve the exact dates provided\n *\n * @param settings - Merged settings from all config levels\n * @returns Complete DateTimeContext with ISO dates and interval\n *\n */\n private resolveDateTimeContext(settings: Record<string, unknown>): DateTimeContext {\n // Special case: interval \"none\" always means \"all data from 1970 to now\"\n if (\n settings.interval &&\n typeof settings.interval === 'string' &&\n settings.interval.toLowerCase() === 'none'\n ) {\n return {\n dateFrom: '1970-01-01T00:00:00.000Z', // Always use epoch start\n dateTo: DateTimeContextUtil.toIso(new Date()), // Always use current time\n interval: TIME_INTERVAL.CUSTOM\n };\n }\n\n // Check if we have a predefined interval (not custom or none)\n // For predefined intervals, we should calculate fresh dates based on current time\n if (\n settings.interval &&\n typeof settings.interval === 'string' &&\n this.isPredefinedInterval(settings.interval)\n ) {\n const interval = this.resolveInterval(settings.interval as string);\n const dateRange = this.dateTimeContextPickerService.getDateTimeContextByInterval(interval);\n\n return DateTimeContextUtil.ensureIsoContext({\n dateFrom: dateRange![0],\n dateTo: dateRange![1],\n interval\n });\n }\n\n // Try legacy date fields (for custom intervals or when no interval specified)\n const legacyDates = this.extractLegacyDates(settings);\n if (legacyDates) {\n return {\n dateFrom: legacyDates.dateFrom,\n dateTo: legacyDates.dateTo,\n interval: this.calculateInterval(\n legacyDates.dateFrom,\n legacyDates.dateTo,\n typeof settings.interval === 'string' ? settings.interval : undefined\n )\n };\n }\n\n // Create default context if widget needs it\n if (this.needsDefaultDateTimeContext(settings)) {\n const interval = this.resolveInterval(settings.interval as string);\n const dateRange = this.dateTimeContextPickerService.getDateTimeContextByInterval(interval);\n\n return DateTimeContextUtil.ensureIsoContext({\n dateFrom: dateRange![0],\n dateTo: dateRange![1],\n interval\n });\n }\n\n // Absolute fallback: last hour\n return this.getDefaultDateTimeContext();\n }\n\n /**\n * Resolves the refresh option (LIVE or HISTORY) from legacy configuration.\n *\n * Maps legacy refresh option values to the new binary system:\n * - 'interval' or 'global-interval' → LIVE (auto-refresh enabled)\n * - 'none' → HISTORY (no auto-refresh)\n * - Realtime widgets with any option → LIVE\n * - Default → LIVE\n *\n * @param isRealtime - Whether the widget is in realtime mode\n * @param legacyOption - Legacy refreshOption value if present\n * @returns LIVE or HISTORY refresh option\n *\n */\n private resolveRefreshOption(isRealtime: boolean, legacyOption?: string): RefreshOption {\n // Only use LIVE for realtime if there's an actual legacy option indicating it\n if (isRealtime && legacyOption) {\n return REFRESH_OPTION.LIVE;\n }\n\n // Handle legacy refresh option\n const normalizedOption = legacyOption?.toLowerCase();\n switch (normalizedOption) {\n case 'global-interval':\n case 'interval':\n return REFRESH_OPTION.LIVE;\n case 'none':\n return REFRESH_OPTION.HISTORY;\n default:\n // Default to LIVE for all widgets (including interval='none')\n return REFRESH_OPTION.LIVE;\n }\n }\n\n /**\n * Resolves whether auto-refresh should be enabled based on widget configuration.\n *\n * Determines the initial state of the auto-refresh toggle:\n * - Realtime widgets → always enabled\n * - refreshOption='none' → disabled\n * - All other cases → enabled (including interval='none')\n *\n * @param isRealtime - Whether the widget is in realtime mode\n * @param legacyOption - Legacy refreshOption value if present\n * @returns true if auto-refresh should be enabled\n *\n */\n private resolveAutoRefreshEnabled(isRealtime: boolean, legacyOption?: string): boolean {\n if (isRealtime) {\n return true;\n }\n\n // Only disable auto-refresh if refreshOption is explicitly 'none'\n if (legacyOption && legacyOption.toLowerCase() === 'none') {\n return false;\n }\n\n return true; // Default to enabled (including interval='none')\n }\n\n /**\n * Detects if a widget is configured for realtime operation.\n *\n * Realtime widgets continuously update with live data and require special handling\n * with shorter refresh intervals (5 seconds) and LIVE mode.\n *\n * Detection criteria:\n * - Explicit realtime/isRealtime flags\n * - globalRealtimeContext capability + active refresh option\n *\n * @param settings - Widget settings to check\n * @returns true if widget should operate in realtime mode\n *\n */\n private isRealtimeWidget(settings: Record<string, unknown>): boolean {\n // Consider explicit realtime settings\n if (settings.realtime === true || settings.isRealtime === true) {\n return true;\n }\n\n // Also consider display settings if there's a refresh option indicating active refresh\n const displaySettings = settings.displaySettings as Record<string, unknown> | undefined;\n if (\n displaySettings?.globalRealtimeContext === true &&\n typeof settings.refreshOption === 'string' &&\n ['interval', 'global-interval'].includes(settings.refreshOption)\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Extracts date range from various legacy property formats.\n *\n * Legacy widgets stored dates in multiple ways. This method checks all possible\n * locations and returns the first valid date range found.\n *\n * Priority order:\n * 1. dateFrom + dateTo (most explicit)\n * 2. dateFilter array\n * 3. date array\n *\n * @param settings - Widget settings containing potential date properties\n * @returns Date range object or null if no valid dates found\n *\n */\n private extractLegacyDates(\n settings: Record<string, unknown>\n ): { dateFrom: string; dateTo: string } | null {\n // Priority 1: dateFrom/dateTo\n if (typeof settings.dateFrom === 'string' && typeof settings.dateTo === 'string') {\n return { dateFrom: settings.dateFrom, dateTo: settings.dateTo };\n }\n\n // Priority 2: dateFilter array\n if (Array.isArray(settings.dateFilter) && settings.dateFilter.length >= 2) {\n return { dateFrom: settings.dateFilter[0], dateTo: settings.dateFilter[1] };\n }\n\n // Priority 3: date array\n if (Array.isArray(settings.date) && settings.date.length >= 2) {\n return { dateFrom: settings.date[0], dateTo: settings.date[1] };\n }\n\n return null;\n }\n\n /**\n * Calculates the appropriate time interval based on date range duration.\n *\n * Uses the provided interval if valid, otherwise calculates from the date range span:\n * - ≤1 minute → MINUTES\n * - ≤1 hour → HOURS\n * - ≤1 day → DAYS\n * - ≤1 week → WEEKS\n * - ≤1 month → MONTHS\n * - >1 month → CUSTOM\n *\n * Special case: interval='none' → CUSTOM\n *\n * @param dateFrom - Start date as ISO string\n * @param dateTo - End date as ISO string\n * @param providedInterval - Optional interval from legacy config\n * @returns Appropriate TimeInterval enum value\n *\n */\n private calculateInterval(\n dateFrom: string,\n dateTo: string,\n providedInterval?: string\n ): TimeInterval {\n // Use provided interval if valid\n if (providedInterval) {\n // Handle case-insensitive 'none' variations\n if (providedInterval.toLowerCase() === 'none') {\n return TIME_INTERVAL.CUSTOM;\n }\n\n if (Object.values(TIME_INTERVAL).includes(providedInterval as TimeInterval)) {\n return providedInterval as TimeInterval;\n }\n }\n\n // Calculate from date range\n try {\n const from = new Date(dateFrom);\n const to = new Date(dateTo);\n const diffMs = to.getTime() - from.getTime();\n\n if (diffMs <= TIME_SPAN_MS.MINUTE) return TIME_INTERVAL.MINUTES;\n if (diffMs <= TIME_SPAN_MS.HOUR) return TIME_INTERVAL.HOURS;\n if (diffMs <= TIME_SPAN_MS.DAY) return TIME_INTERVAL.DAYS;\n if (diffMs <= TIME_SPAN_MS.WEEK) return TIME_INTERVAL.WEEKS;\n if (diffMs <= TIME_SPAN_MS.MONTH) return TIME_INTERVAL.MONTHS;\n\n return TIME_INTERVAL.CUSTOM;\n } catch {\n return TIME_INTERVAL.CUSTOM;\n }\n }\n\n /**\n * Resolves and validates a time interval string.\n *\n * @param interval - Interval string to validate\n * @returns Valid TimeInterval or HOURS as default\n *\n */\n private resolveInterval(interval?: string): TimeInterval {\n if (interval && this.dateTimeContextPickerService.isSelectableInterval(interval)) {\n return interval as TimeInterval;\n }\n return TIME_INTERVAL.HOURS;\n }\n\n /**\n * Normalizes legacy aggregation values to the new format.\n *\n * Converts legacy 'NONE' string to null (meaning no aggregation).\n *\n * @param value - Legacy aggregation value\n * @returns Normalized aggregationType or null\n *\n */\n private normalizeAggregation(value?: string | aggregationType | null): aggregationType | null {\n if (value === 'NONE' || value === undefined) {\n return null;\n }\n return value as aggregationType;\n }\n\n /**\n * Checks if an interval is predefined (relative to current time) rather than custom.\n *\n * Predefined intervals (hours, days, etc.) are recalculated relative to current time\n * during migration, while custom intervals preserve their exact date ranges.\n *\n * @param interval - Interval string to check\n * @returns true if interval is predefined (not CUSTOM or 'none')\n *\n */\n private isPredefinedInterval(interval: string): boolean {\n const predefinedIntervals: string[] = [\n TIME_INTERVAL.MINUTES,\n TIME_INTERVAL.HOURS,\n TIME_INTERVAL.DAYS,\n TIME_INTERVAL.WEEKS,\n TIME_INTERVAL.MONTHS\n ];\n return predefinedIntervals.includes(interval);\n }\n\n /**\n * Determines if a widget requires a default date/time context to be generated.\n *\n * Returns true when the widget has time-related settings but no explicit date values,\n * indicating it expects time context but didn't provide specific dates.\n *\n * @param settings - Widget settings to evaluate\n * @returns true if default date/time context should be applied\n *\n */\n private needsDefaultDateTimeContext(settings: Record<string, unknown>): boolean {\n const displaySettings = settings.displaySettings as Record<string, unknown> | undefined;\n const hasTimeSettings = !!(\n settings.displayDateSelection ||\n settings.widgetInstanceGlobalTimeContext !== undefined ||\n displaySettings?.globalTimeContext ||\n settings.interval\n );\n\n const hasExplicitDates = !!(\n (settings.dateFrom && settings.dateTo) ||\n settings.dateFilter ||\n settings.date\n );\n\n return hasTimeSettings && !hasExplicitDates;\n }\n\n /**\n * Creates a default date/time context for widgets without explicit time configuration.\n *\n * Returns the last hour as a safe default that works for most widgets.\n *\n * @returns DateTimeContext configured for the last hour\n *\n */\n private getDefaultDateTimeContext(): DateTimeContext {\n const interval = TIME_INTERVAL.HOURS;\n const dateRange = this.dateTimeContextPickerService.getDateTimeContextByInterval(interval);\n\n return DateTimeContextUtil.ensureIsoContext({\n dateFrom: dateRange![0],\n dateTo: dateRange![1],\n interval\n });\n }\n\n /**\n * Detects if a configuration contains legacy fields requiring migration.\n *\n * Recursively checks for legacy date fields, refresh options, aggregation values,\n * and nested configurations that need updating.\n *\n * @param config - Configuration object to check\n * @returns true if any legacy fields are found\n *\n */\n private hasLegacyFields(config: Record<string, unknown>): boolean {\n // Check for legacy date fields\n if (\n config.dateFilter ||\n config.date ||\n (config.dateFrom && config.dateTo && !config.dateTimeContext)\n ) {\n return true;\n }\n\n // Check for legacy refresh options (case-insensitive)\n if (\n typeof config.refreshOption === 'string' &&\n ['global-interval', 'interval', 'none'].includes(config.refreshOption.toLowerCase())\n ) {\n return true;\n }\n\n // Check for legacy aggregation\n if (config.aggregation === 'NONE') {\n return true;\n }\n\n // Check nested configs\n if (\n config.mapConfig &&\n typeof config.mapConfig === 'object' &&\n this.hasLegacyFields(config.mapConfig as Record<string, unknown>)\n ) {\n return true;\n }\n\n if (\n config.config &&\n typeof config.config === 'object' &&\n this.hasLegacyFields(config.config as Record<string, unknown>)\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Check if widget needs refresh settings migration.\n */\n private needsRefreshSettingsMigration(\n config: Partial<GlobalContextState>,\n settings: Record<string, unknown>\n ): boolean {\n // Already has valid refresh option\n if (this.isValidRefreshOption(config.refreshOption)) {\n // But check if realtime needs special handling\n const isRealtime = this.isRealtimeWidget(settings);\n if (\n isRealtime &&\n (config.refreshInterval === undefined || config.isAutoRefreshEnabled === undefined)\n ) {\n return true;\n }\n return false;\n }\n\n // Has legacy refresh option or undefined\n return true;\n }\n\n /**\n * Validates if a value is a recognized display mode.\n *\n * @param value - Value to validate\n * @returns true if value is a valid GLOBAL_CONTEXT_DISPLAY_MODE\n *\n */\n private isValidDisplayMode(value?: string): boolean {\n return (\n value === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD ||\n value === GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG ||\n value === GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n );\n }\n\n /**\n * Validates if a value is a recognized refresh option.\n *\n * @param value - Value to validate\n * @returns true if value is LIVE or HISTORY\n *\n */\n private isValidRefreshOption(value?: string): boolean {\n return value === REFRESH_OPTION.LIVE || value === REFRESH_OPTION.HISTORY;\n }\n\n /**\n * Extracts and merges global context settings from all configuration levels.\n *\n * Legacy widgets stored settings at different nesting levels (root, config, mapConfig).\n * This method extracts relevant settings from all levels and merges them with proper\n * precedence to ensure nothing is missed during migration.\n *\n * Precedence order (highest to lowest):\n * 1. mapConfig (most specific)\n * 2. config (nested level)\n * 3. root level (main config)\n *\n * @param config - Full widget configuration with potential nesting\n * @returns Merged settings object containing all relevant properties\n *\n */\n private extractGlobalContextSettings(config: Record<string, unknown>): Record<string, unknown> {\n const mainLevel = this.extractRelevantSettings(config);\n const configLevel =\n config.config && typeof config.config === 'object'\n ? this.extractRelevantSettings(config.config as Record<string, unknown>)\n : {};\n const mapConfigLevel =\n config.mapConfig && typeof config.mapConfig === 'object'\n ? this.extractRelevantSettings(config.mapConfig as Record<string, unknown>)\n : {};\n\n // Merge with precedence\n return {\n ...mainLevel,\n ...configLevel,\n ...mapConfigLevel\n };\n }\n\n /**\n * Filters a configuration object to include only global context relevant properties.\n *\n * Reduces noise by extracting only the properties needed for migration decisions,\n * ignoring widget-specific configuration that doesn't affect global context.\n *\n * @param obj - Configuration object to filter\n * @returns Object containing only relevant properties\n *\n */\n private extractRelevantSettings(obj: Record<string, unknown>): Record<string, unknown> {\n const relevantKeys = [\n 'displaySettings',\n 'widgetInstanceGlobalTimeContext',\n 'widgetInstanceGlobalAutoRefreshContext',\n 'dateFilter',\n 'date',\n 'dateFrom',\n 'dateTo',\n 'refreshOption',\n 'refreshInterval',\n 'displayDateSelection',\n 'isAutoRefreshEnabled',\n 'isRealtime',\n 'realtime',\n 'interval',\n 'aggregation'\n ];\n\n return Object.fromEntries(\n relevantKeys.filter(key => obj[key] !== undefined).map(key => [key, obj[key]])\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { Interval } from '../../models/interval-picker.model';\nimport { DateTimeContextPickerService } from './date-time-context-picker.service';\n\n/**\n * Service responsible for validating global context parameters.\n *\n * This service centralizes all validation logic for global context parameters,\n * including intervals, aggregations, date ranges, and boolean values.\n * It provides a single source of truth for validation rules across the application.\n *\n * @example\n * ```typescript\n * constructor(private validationService: GlobalContextValidationService) {}\n *\n * const isValid = this.validationService.isValidInterval('HOURS');\n * const dateRangeValid = this.validationService.isValidDateRange('2024-01-01', '2024-01-02');\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class GlobalContextValidationService {\n private dateTimeContextPickerService = inject(DateTimeContextPickerService);\n\n /**\n * Validates if the provided interval is selectable and supported.\n *\n * @param interval - The interval to validate\n * @returns True if the interval is valid and selectable, false otherwise\n *\n * @example\n * ```typescript\n * const isValid = validationService.isValidInterval('HOURS'); // true\n * const isInvalid = validationService.isValidInterval('INVALID'); // false\n * ```\n */\n isValidInterval(interval: string | unknown): boolean {\n return (\n typeof interval === 'string' &&\n this.dateTimeContextPickerService.isSelectableInterval(interval as Interval['id'])\n );\n }\n\n /**\n * Validates if the provided aggregation type is supported.\n *\n * @param aggregation - The aggregation type to validate\n * @returns True if the aggregation is valid, false otherwise\n *\n * @example\n * ```typescript\n * const isValid = validationService.isValidAggregation(aggregationType.HOURLY); // true\n * const isInvalid = validationService.isValidAggregation('INVALID' as any); // false\n * ```\n */\n isValidAggregation(aggregation: string | unknown): boolean {\n return (\n typeof aggregation === 'string' &&\n this.dateTimeContextPickerService.isValidAggregation(aggregation as aggregationType)\n );\n }\n\n /**\n * Validates if the provided date range is valid.\n *\n * @param dateFrom - The start date of the range\n * @param dateTo - The end date of the range\n * @returns True if the date range is valid, false otherwise\n *\n * @example\n * ```typescript\n * const isValid = validationService.isValidDateRange('2024-01-01', '2024-01-02'); // true\n * const isInvalid = validationService.isValidDateRange('invalid', '2024-01-02'); // false\n * ```\n */\n isValidDateRange(dateFrom: string, dateTo: string): boolean {\n return this.dateTimeContextPickerService.isValidDateRange(dateFrom, dateTo);\n }\n\n /**\n * Parses a string value to boolean or undefined.\n *\n * Only accepts the exact strings 'true' and 'false'. All other values,\n * including different cases, whitespace, or non-string types return undefined.\n *\n * @param value - The value to parse\n * @returns true for 'true', false for 'false', undefined for all other values\n *\n * @example\n * ```typescript\n * const result1 = validationService.parseBoolean('true'); // true\n * const result2 = validationService.parseBoolean('false'); // false\n * const result3 = validationService.parseBoolean('True'); // undefined\n * const result4 = validationService.parseBoolean(null); // undefined\n * ```\n */\n parseBoolean(value: string | unknown): boolean | undefined {\n if (typeof value !== 'string') return undefined;\n\n const map: Record<string, boolean> = {\n true: true,\n false: false\n };\n\n return map[value] ?? undefined;\n }\n\n /**\n * Validates multiple parameters at once and returns detailed results.\n *\n * @param params - Object containing parameters to validate\n * @returns Validation results for each parameter\n *\n * @example\n * ```typescript\n * const results = validationService.validateParameters({\n * interval: 'HOURS',\n * aggregation: aggregationType.HOURLY,\n * autoRefresh: 'true'\n * });\n * ```\n */\n validateParameters(params: {\n interval?: string | unknown;\n aggregation?: string | unknown;\n dateFrom?: string | null;\n dateTo?: string | null;\n autoRefresh?: string | unknown;\n }): {\n interval: boolean;\n aggregation: boolean;\n dateRange: boolean;\n autoRefresh: boolean | undefined;\n } {\n return {\n interval: params.interval ? this.isValidInterval(params.interval) : false,\n aggregation: params.aggregation ? this.isValidAggregation(params.aggregation) : false,\n dateRange:\n params.dateFrom && params.dateTo\n ? this.isValidDateRange(params.dateFrom, params.dateTo)\n : false,\n autoRefresh: params.autoRefresh ? this.parseBoolean(params.autoRefresh) : undefined\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { AggregationState } from '../../models/aggregation.model';\nimport { TIME_SPAN_MS } from '../../models/interval-picker.model';\n\n/**\n * AggregationValidationService handles the validation of time ranges against\n * aggregation type requirements in the global context system.\n *\n * This service determines which aggregation types (MINUTELY, HOURLY, DAILY) are valid\n * for a given time range based on predefined business rules. It provides the core\n * validation logic that determines UI state and aggregation availability.\n *\n * Key responsibilities:\n * - Validate time ranges against minimum aggregation requirements\n * - Calculate time range durations in milliseconds\n * - Transform validation results into UI-friendly disabled state maps\n * - Provide consistent validation logic across the application\n *\n * Validation Rules:\n * - MINUTELY: Disabled for time ranges <= 1 minute\n * - HOURLY: Disabled for time ranges <= 1 hour\n * - DAILY: Disabled for time ranges <= 1 day\n *\n * @example\n * ```typescript\n * const validationService = inject(AggregationValidationService);\n *\n * // Validate a 2-hour time range\n * const dateRange: [Date, Date] = [\n * new Date('2024-01-01T10:00:00Z'),\n * new Date('2024-01-01T12:00:00Z')\n * ];\n *\n * const disabledAggregations = validationService.getDisabledAggregations(dateRange);\n * console.log(disabledAggregations);\n * // { DAILY: true, HOURLY: false, MINUTELY: false }\n *\n * // Check if specific aggregation is valid\n * const isHourlyValid = validationService.isAggregationValid(dateRange, aggregationType.HOURLY);\n * console.log(isHourlyValid); // true (2 hours > 1 hour requirement)\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class AggregationValidationService {\n /**\n * Determines which aggregation types should be disabled for a given time range.\n *\n * This method validates the time range against all aggregation type requirements\n * and returns a map indicating which aggregations should be disabled in the UI.\n *\n * @param dateRange - Tuple of [dateFrom, dateTo] defining the time range\n * @returns Map of aggregation types to their disabled boolean state\n *\n * @example\n * ```typescript\n * const shortRange: [Date, Date] = [\n * new Date('2024-01-01T12:00:00Z'),\n * new Date('2024-01-01T12:30:00Z') // 30 minutes\n * ];\n *\n * const disabled = validationService.getDisabledAggregations(shortRange);\n * // { DAILY: true, HOURLY: true, MINUTELY: false }\n * ```\n */\n getDisabledAggregations([dateFrom, dateTo]: [Date, Date]): Partial<\n Record<aggregationType, boolean>\n > {\n const timeRangeValidations = this.validateTimeRanges([dateFrom, dateTo]);\n return this.transformValidationsToDisabledMap(timeRangeValidations);\n }\n\n /**\n * Checks if a specific aggregation type is valid for the given time range.\n *\n * This method provides a convenient way to check if a single aggregation type\n * meets the minimum time range requirements without needing to validate all types.\n *\n * @param dateRange - Tuple of [dateFrom, dateTo] defining the time range\n * @param aggregation - The aggregation type to validate\n * @returns True if the aggregation is valid for the time range, false if disabled\n *\n * @example\n * ```typescript\n * const oneHourRange: [Date, Date] = [\n * new Date('2024-01-01T12:00:00Z'),\n * new Date('2024-01-01T13:00:00Z')\n * ];\n *\n * const isMinutelyValid = validationService.isAggregationValid(oneHourRange, aggregationType.MINUTELY);\n * // true (1 hour > 1 minute requirement)\n *\n * const isDailyValid = validationService.isAggregationValid(oneHourRange, aggregationType.DAILY);\n * // false (1 hour <= 1 day requirement)\n * ```\n */\n isAggregationValid([dateFrom, dateTo]: [Date, Date], aggregation: aggregationType): boolean {\n const timeRangeInMs = this.getTimeRangeInMs(dateFrom, dateTo);\n\n switch (aggregation) {\n case aggregationType.DAILY:\n return timeRangeInMs > TIME_SPAN_MS.DAY;\n case aggregationType.HOURLY:\n return timeRangeInMs > TIME_SPAN_MS.HOUR;\n case aggregationType.MINUTELY:\n return timeRangeInMs > TIME_SPAN_MS.MINUTE;\n default:\n return false;\n }\n }\n\n /**\n * Calculates the time range duration in milliseconds.\n *\n * This method provides a standardized way to calculate time range durations\n * that can be used for validation and threshold comparisons.\n *\n * @param dateFrom - Start date of the range\n * @param dateTo - End date of the range\n * @returns Duration in milliseconds between the two dates\n *\n * @example\n * ```typescript\n * const duration = validationService.getTimeRangeInMs(\n * new Date('2024-01-01T10:00:00Z'),\n * new Date('2024-01-01T12:00:00Z')\n * );\n * console.log(duration); // 7200000 (2 hours in milliseconds)\n * ```\n */\n getTimeRangeInMs(dateFrom: Date, dateTo: Date): number {\n // Normalize dates to remove milliseconds for consistent comparisons\n // This prevents issues where date pickers might strip milliseconds inconsistently\n const normalizedFrom = new Date(dateFrom);\n normalizedFrom.setMilliseconds(0);\n\n const normalizedTo = new Date(dateTo);\n normalizedTo.setMilliseconds(0);\n\n return normalizedTo.valueOf() - normalizedFrom.valueOf();\n }\n\n /**\n * Validates time ranges against all aggregation type requirements.\n *\n * Determines which aggregation types should be disabled based on the time range duration.\n * Each aggregation type has a minimum time range requirement to be meaningful.\n *\n * Validation Logic:\n * - DAILY: Disabled if time range <= 1 day\n * - HOURLY: Disabled if time range <= 1 hour\n * - MINUTELY: Disabled if time range <= 1 minute\n *\n * @param dateRange - Tuple of [dateFrom, dateTo] to validate\n * @returns Array of aggregation states with their disabled status\n */\n private validateTimeRanges([dateFrom, dateTo]: [Date, Date]): AggregationState[] {\n const timeRangeInMs = this.getTimeRangeInMs(dateFrom, dateTo);\n\n return [\n {\n aggregationType: aggregationType.DAILY,\n isDisabled: timeRangeInMs <= TIME_SPAN_MS.DAY\n },\n {\n aggregationType: aggregationType.HOURLY,\n isDisabled: timeRangeInMs <= TIME_SPAN_MS.HOUR\n },\n {\n aggregationType: aggregationType.MINUTELY,\n isDisabled: timeRangeInMs <= TIME_SPAN_MS.MINUTE\n }\n ];\n }\n\n /**\n * Converts aggregation state array to a disabled aggregations map.\n *\n * Transforms the validation results into a map structure that indicates\n * which aggregation types should be disabled in the UI.\n *\n * @param timeRangeValidations - Array of aggregation states from validation\n * @returns Map of aggregation types to their disabled boolean state\n */\n private transformValidationsToDisabledMap(\n timeRangeValidations: AggregationState[]\n ): Partial<Record<aggregationType, boolean>> {\n return timeRangeValidations.reduce(\n (acc, { aggregationType, isDisabled }) => ({\n ...acc,\n [aggregationType]: isDisabled\n }),\n {}\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { AGGREGATION_LIMITS } from '../../models/aggregation.model';\nimport { AggregationValidationService } from './aggregation-validation.service';\n\n/**\n * Interface defining the result of aggregation calculation.\n * Contains both the selected aggregation and information about which aggregations are disabled.\n */\nexport interface AggregationCalculationResult {\n /** The selected aggregation type or null if no aggregation is selected */\n readonly selectedAggregation: aggregationType | null;\n /** Map of aggregation types to their disabled state */\n readonly disabledAggregations: Partial<Record<aggregationType, boolean>>;\n}\n\n/**\n * AggregationPickerService handles the logic for selecting appropriate data aggregations\n * based on time ranges and user preferences in the global context system.\n *\n * This service focuses on aggregation selection and automatic fallback logic when requested\n * aggregations are not appropriate for the data range. It delegates validation concerns\n * to the AggregationValidationService for better separation of concerns.\n *\n * Key responsibilities:\n * - Calculate optimal aggregation selection for given time ranges and preferences\n * - Handle automatic aggregation selection based on time range thresholds\n * - Provide fallback logic when requested aggregations are invalid\n * - Combine validation results with selection logic for complete aggregation calculation\n *\n * Auto-selection Logic:\n * - Uses AGGREGATION_LIMITS thresholds (10min, 1day, 4days) for fallback selection\n * - Delegates validation to AggregationValidationService\n * - Returns comprehensive results including both selection and validation state\n *\n * @example\n * ```typescript\n * const service = inject(AggregationPickerService);\n *\n * // Calculate aggregation for a 2-day time range\n * const dateRange: [Date, Date] = [\n * new Date('2024-01-01T00:00:00Z'),\n * new Date('2024-01-03T00:00:00Z')\n * ];\n *\n * const result = service.calculateAggregation(dateRange, aggregationType.HOURLY);\n * console.log(result.selectedAggregation); // 'HOURLY' (valid for 2-day range)\n * console.log(result.disabledAggregations); // { DAILY: true, HOURLY: false, MINUTELY: false }\n *\n * // Auto-selection when requested aggregation is disabled\n * const shortRange: [Date, Date] = [\n * new Date('2024-01-01T12:00:00Z'),\n * new Date('2024-01-01T12:30:00Z') // 30 minutes\n * ];\n *\n * const autoResult = service.calculateAggregation(shortRange, aggregationType.DAILY);\n * // DAILY is disabled for 30min range, so falls back to MINUTELY\n * console.log(autoResult.selectedAggregation); // 'MINUTELY'\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class AggregationPickerService {\n /** Service for validating time ranges against aggregation requirements */\n private readonly validationService = inject(AggregationValidationService);\n\n /**\n * Calculates the appropriate aggregation for a given time range and user preference.\n *\n * This method validates the time range against aggregation requirements and determines\n * which aggregations should be disabled. If the requested aggregation is not valid\n * for the time range, it automatically selects the most appropriate alternative.\n *\n * Validation Rules:\n * - MINUTELY: Requires time range > 1 minute\n * - HOURLY: Requires time range > 1 hour\n * - DAILY: Requires time range > 1 day\n *\n * Auto-selection Thresholds (when fallback is needed):\n * - >= 4 days: Selects DAILY aggregation\n * - >= 1 day: Selects HOURLY aggregation\n * - >= 10 minutes: Selects MINUTELY aggregation\n * - < 10 minutes: Returns null (no aggregation)\n *\n * @param dateRange - Tuple of [dateFrom, dateTo] defining the time range\n * @param requestedAggregation - User's preferred aggregation type or null for no preference\n * @returns Object containing the selected aggregation and disabled aggregation states\n *\n * @example\n * ```typescript\n * // Valid aggregation request\n * const result = service.calculateAggregation(\n * [new Date('2024-01-01'), new Date('2024-01-03')], // 2 days\n * aggregationType.HOURLY\n * );\n * // result.selectedAggregation === 'HOURLY' (valid for 2-day range)\n *\n * // Invalid aggregation request with fallback\n * const fallbackResult = service.calculateAggregation(\n * [new Date('2024-01-01T12:00'), new Date('2024-01-01T12:30')], // 30 minutes\n * aggregationType.DAILY // Not valid for 30min range\n * );\n * // fallbackResult.selectedAggregation === 'MINUTELY' (auto-selected)\n *\n * // Explicit null request\n * const nullResult = service.calculateAggregation(\n * [new Date('2024-01-01'), new Date('2024-01-03')],\n * null\n * );\n * // nullResult.selectedAggregation === null (as requested)\n * ```\n */\n calculateAggregation(\n [dateFrom, dateTo]: [Date, Date],\n requestedAggregation: aggregationType | null\n ): AggregationCalculationResult {\n const disabledAggregations = this.validationService.getDisabledAggregations([dateFrom, dateTo]);\n const timeRangeInMs = this.validationService.getTimeRangeInMs(dateFrom, dateTo);\n\n const isRequestedAggregationValid =\n requestedAggregation === null || !disabledAggregations[requestedAggregation];\n\n const selectedAggregation = isRequestedAggregationValid\n ? requestedAggregation\n : this.determineAggregation(timeRangeInMs);\n\n return {\n selectedAggregation,\n disabledAggregations\n };\n }\n\n /**\n * Determines the most appropriate aggregation type based on time range duration.\n *\n * Uses predefined thresholds to automatically select the best aggregation type\n * when the requested aggregation is not valid for the time range. This method\n * implements the fallback logic that ensures users always get meaningful aggregations.\n *\n * Selection Logic (based on AGGREGATION_LIMITS):\n * - >= 4 days (DAILY_LIMIT): Select DAILY aggregation\n * - >= 1 day (HOURLY_LIMIT): Select HOURLY aggregation\n * - >= 10 minutes (MINUTELY_LIMIT): Select MINUTELY aggregation\n * - < 10 minutes: Return null (no aggregation appropriate)\n *\n * @param timeRangeInMs - Duration of the time range in milliseconds\n * @returns The most appropriate aggregation type or null if no aggregation is suitable\n *\n * @example\n * ```typescript\n * // Large time range - selects DAILY\n * const dailyResult = service.determineAggregation(5 * 24 * 60 * 60 * 1000); // 5 days\n * // Returns aggregationType.DAILY\n *\n * // Medium time range - selects HOURLY\n * const hourlyResult = service.determineAggregation(2 * 24 * 60 * 60 * 1000); // 2 days\n * // Returns aggregationType.HOURLY\n *\n * // Small time range - selects MINUTELY\n * const minutelyResult = service.determineAggregation(30 * 60 * 1000); // 30 minutes\n * // Returns aggregationType.MINUTELY\n *\n * // Very small time range - no aggregation\n * const nullResult = service.determineAggregation(5 * 60 * 1000); // 5 minutes\n * // Returns null\n * ```\n */\n private determineAggregation(timeRangeInMs: number): aggregationType | null {\n if (timeRangeInMs >= AGGREGATION_LIMITS.DAILY_LIMIT) {\n return aggregationType.DAILY;\n } else if (timeRangeInMs >= AGGREGATION_LIMITS.HOURLY_LIMIT) {\n return aggregationType.HOURLY;\n } else if (timeRangeInMs >= AGGREGATION_LIMITS.MINUTELY_LIMIT) {\n return aggregationType.MINUTELY;\n }\n return null;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { isEqual, isObject, transform } from 'lodash-es';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextUtilsService {\n /**\n * Compares two objects and returns an object containing only the fields that changed.\n * For nested objects, recursively identifies changes at each level.\n * Converts Date objects to ISO strings for comparison and in the result.\n *\n * @param oldObj - The original object to compare\n * @param newObj - The new object to compare against\n * @returns An object containing only the changed fields and their new values\n * @throws Error if inputs are not valid objects\n */\n getChangedFields<T extends object>(oldObj: T, newObj: T): Partial<T> {\n // Validate inputs\n if (!isObject(oldObj) || !isObject(newObj)) {\n throw new Error('Both arguments must be objects');\n }\n\n // Set to track visited objects (to avoid infinite recursion on circular refs)\n const visited = new WeakSet<object>();\n\n const diff = this.findChanges(oldObj, newObj, visited);\n return (diff === undefined ? {} : diff) as Partial<T>;\n }\n\n /**\n * Checks if a value is a Date object\n * @param val - The value to check\n * @returns True if the value is a Date object\n */\n private isDate(val: unknown): val is Date {\n return val instanceof Date && !isNaN(val.getTime());\n }\n\n /**\n * Recursive helper function to find changes between two values\n * @param oldVal - Original value\n * @param newVal - New value to compare against\n * @param visited - Set to track visited objects to avoid circular references\n * @returns The changed value or undefined if no changes\n */\n private findChanges(oldVal: unknown, newVal: unknown, visited: WeakSet<object>): unknown {\n // Handle Date objects - convert to ISO string for comparison\n let oldDateString: string | undefined;\n if (this.isDate(oldVal)) {\n oldDateString = DateTimeContextUtil.normalizeIsoToSeconds(oldVal.toISOString());\n }\n if (this.isDate(newVal)) {\n const isoString = DateTimeContextUtil.normalizeIsoToSeconds(newVal.toISOString());\n // If old value wasn't a date, or if the ISO strings differ, return new ISO string\n if (!oldDateString || oldDateString !== isoString) {\n return isoString;\n }\n return undefined; // Dates are equal, no change\n }\n // Update oldVal if it was converted to string\n if (oldDateString) {\n oldVal = oldDateString;\n }\n\n // Handle ISO string comparisons - normalize to seconds precision\n if (typeof oldVal === 'string' && typeof newVal === 'string') {\n const normalizedOld = DateTimeContextUtil.normalizeIsoToSeconds(oldVal);\n const normalizedNew = DateTimeContextUtil.normalizeIsoToSeconds(newVal);\n\n // If both are valid ISO dates, compare normalized versions\n if (normalizedOld && normalizedNew) {\n if (normalizedOld === normalizedNew) {\n return undefined; // Dates are equal (ignoring milliseconds)\n }\n return normalizedNew; // Return normalized version\n }\n }\n\n // If we've seen this object reference before, break out (circular reference)\n if (isObject(oldVal) && isObject(newVal)) {\n if (visited.has(oldVal as object) || visited.has(newVal as object)) {\n return undefined; // avoid infinite loop, no changes deeper\n }\n visited.add(oldVal as object);\n visited.add(newVal as object);\n }\n\n // If values are deeply equal, no change; return nothing\n if (isEqual(oldVal, newVal)) {\n return undefined;\n }\n\n // If both values are objects, recurse into their properties\n if (isObject(oldVal) && isObject(newVal)) {\n const result = transform(\n newVal,\n (result: Record<string, unknown>, value: unknown, key: string) => {\n const change = this.findChanges(oldVal[key], value, visited);\n if (change !== undefined) {\n // Only include the key if there is a difference\n result[key] = change;\n }\n },\n Array.isArray(newVal) ? [] : {}\n ); // preserve array vs object in result\n\n // If result is empty (no changes found in nested objects), return undefined\n return Object.keys(result).length === 0 ? undefined : result;\n }\n\n // For primitive values (or if types differ), return the new value\n return newVal;\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n input,\n signal\n} from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { aggregationType } from '@c8y/client';\nimport { I18nModule, IconDirective } from '@c8y/ngx-components';\nimport { BsDropdownModule } from 'ngx-bootstrap/dropdown';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport {\n AGGREGATION_ICONS,\n AGGREGATION_TEXTS,\n AGGREGATIONS\n} from '../../../models/aggregation.model';\n\n@Component({\n selector: 'c8y-aggregation-picker',\n templateUrl: './aggregation-picker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AggregationPickerComponent),\n multi: true\n }\n ],\n standalone: true,\n imports: [TooltipModule, BsDropdownModule, I18nModule, IconDirective, FormsModule]\n})\nexport class AggregationPickerComponent implements ControlValueAccessor {\n /**\n * Configuration for disabling specific types of aggregation.\n * By default no aggregation type is disabled.\n *\n * Uses input transform to normalize null/undefined to empty object,\n * preventing template errors when accessing properties.\n */\n readonly disabledAggregations = input(\n {},\n {\n transform: (\n value: Partial<Record<aggregationType, boolean>> | null | undefined\n ): Partial<Record<aggregationType, boolean>> => value ?? {}\n }\n );\n\n /**\n * Whether to reset the aggregation value to default when disabled.\n * Default is false.\n */\n readonly resetToDefault = input(false);\n\n /**\n * Whether to show the aggregation picker options as a radio-group or as a dropdown.\n * Default is dropdown.\n */\n readonly layout = input<'radio' | 'dropdown'>('dropdown');\n\n private readonly _disabled = signal(false);\n readonly disabled = computed(() => this._disabled());\n\n readonly AGGREGATIONS = AGGREGATIONS;\n readonly AGGREGATION_ICONS = AGGREGATION_ICONS;\n readonly AGGREGATION_TEXTS = AGGREGATION_TEXTS;\n\n private readonly _value = signal<aggregationType | null>(null);\n readonly value = computed(() => this._value());\n private readonly _touched = signal(false);\n readonly touched = computed(() => this._touched());\n\n // Computed helpers for cleaner templates\n readonly currentText = computed(() => {\n const value = this._value();\n return value ? this.AGGREGATION_TEXTS[value] : this.AGGREGATION_TEXTS.undefined;\n });\n\n readonly currentIcon = computed(() => {\n const value = this._value();\n return value ? this.AGGREGATION_ICONS[value] : this.AGGREGATION_ICONS.undefined;\n });\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = _ => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onTouched = () => {};\n\n writeValue(value: aggregationType | null): void {\n if (this._value() === value) {\n return;\n }\n\n this._value.set(value);\n }\n\n registerOnChange(fn: (value: aggregationType | null) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(onTouched: () => void): void {\n this.onTouched = onTouched;\n }\n\n markAsTouched() {\n if (!this._touched()) {\n this.onTouched();\n this._touched.set(true);\n }\n }\n\n setDisabledState(disabled: boolean) {\n this._disabled.set(disabled);\n\n if (disabled && this.resetToDefault()) {\n this.resetValue();\n }\n }\n\n selectAggregation(aggregation: aggregationType | null): void {\n // Early return if value hasn't changed (no-op)\n if (aggregation === this._value()) {\n return;\n }\n\n this.markAsTouched();\n this._value.set(aggregation);\n this.onChange(aggregation);\n }\n\n private resetValue() {\n if (this._value() !== null) {\n this._value.set(null);\n this.onChange(null);\n }\n }\n}\n","@if (layout() === 'dropdown') {\n <div\n class=\"dropdown\"\n style=\"border: 0; margin-left: -1px\"\n container=\"body\"\n #dropdown=\"bs-dropdown\"\n dropdown\n [attr.data-cy]=\"'global-context--aggregation-picker'\"\n [insideClick]=\"true\"\n [isDisabled]=\"disabled()\"\n >\n <button\n class=\"dropdown-toggle form-control p-t-0 p-b-0 l-h-1 d-flex a-i-center\"\n [attr.aria-label]=\"currentText() | translate\"\n tooltip=\"{{ (disabled() ? AGGREGATION_TEXTS.disabled : currentText()) | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-expanded]=\"dropdown.isOpen\"\n type=\"button\"\n [attr.data-cy]=\"'global-context--aggregation-picker-' + value()\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n dropdownToggle\n >\n <i\n class=\"icon-14\"\n [c8yIcon]=\"currentIcon()\"\n ></i>\n <span class=\"caret m-r-8 m-l-4\"></span>\n </button>\n\n <ul\n class=\"dropdown-menu dropdown-menu-right--xs\"\n role=\"listbox\"\n *dropdownMenu\n >\n @for (aggregation of AGGREGATIONS; track aggregation.id || $index) {\n @let isDisabled = aggregation.id ? disabledAggregations()[aggregation.id] : false;\n <li\n [class.active]=\"aggregation.id === value()\"\n [class.disabled]=\"isDisabled\"\n >\n <button\n class=\"\"\n [attr.aria-selected]=\"aggregation.id === value()\"\n role=\"option\"\n (click)=\"selectAggregation(aggregation.id); dropdown.isOpen = false\"\n [disabled]=\"isDisabled\"\n [attr.data-cy]=\"'global-context--aggregation-picker-input-' + aggregation.id\"\n >\n <i\n class=\"icon-14\"\n [c8yIcon]=\"\n aggregation.id ? AGGREGATION_ICONS[aggregation.id] : AGGREGATION_ICONS.undefined\n \"\n ></i>\n <span>{{ aggregation.title | translate }}</span>\n </button>\n </li>\n }\n </ul>\n </div>\n}\n\n@if (layout() === 'radio') {\n <div\n class=\"radio-group d-flex-md a-i-center gap-16\"\n [attr.aria-label]=\"'Aggregation options' | translate\"\n role=\"radiogroup\"\n >\n @for (aggregation of AGGREGATIONS; track aggregation.id || $index) {\n @let isDisabled = aggregation.id ? disabledAggregations()[aggregation.id] : false;\n <label\n class=\"c8y-radio\"\n [attr.data-cy]=\"'global-context--aggregation-picker-input-' + aggregation.id\"\n >\n <input\n name=\"aggregation\"\n role=\"radio\"\n type=\"radio\"\n [value]=\"aggregation.id\"\n [checked]=\"aggregation.id === value()\"\n [disabled]=\"isDisabled\"\n (change)=\"selectAggregation(aggregation.id)\"\n />\n <span></span>\n <i\n class=\"icon-16 m-l-4\"\n [c8yIcon]=\"\n aggregation.id ? AGGREGATION_ICONS[aggregation.id] : AGGREGATION_ICONS.undefined\n \"\n ></i>\n <span>{{ aggregation.title | translate }}</span>\n </label>\n }\n </div>\n}\n","import { NgClass } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n inject,\n Input,\n output,\n signal\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n AbstractControl,\n FormBuilder,\n FormsModule,\n ReactiveFormsModule,\n ValidationErrors,\n ValidatorFn\n} from '@angular/forms';\nimport { aggregationType } from '@c8y/client';\nimport {\n C8yTranslatePipe,\n DateTimePickerModule,\n FormGroupComponent,\n I18nModule,\n IconDirective,\n MessageDirective,\n MessagesComponent\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { isEqual } from 'lodash-es';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { debounceTime } from 'rxjs';\nimport { AGGREGATION_TEXTS } from '../../../models/aggregation.model';\nimport { TIME_DURATION } from '../../../models/constants';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type {\n GlobalContextSettings,\n GlobalContextState\n} from '../../../models/global-context.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport { AggregationPickerService } from '../../../services/domain/aggregation-picker.service';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport { AggregationPickerComponent } from '../../aggregation/aggregation-picker';\n\n/**\n * Component for configuring history mode settings\n * Stateless component that emits changes immediately\n */\n@Component({\n selector: 'c8y-history-mode-configuration-controls',\n templateUrl: './history-mode-configuration-controls.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n C8yTranslatePipe,\n I18nModule,\n TooltipModule,\n ReactiveFormsModule,\n IconDirective,\n FormsModule,\n PopoverModule,\n FormGroupComponent,\n AggregationPickerComponent,\n MessagesComponent,\n MessageDirective,\n DateTimePickerModule,\n NgClass\n ]\n})\nexport class HistoryModeConfigurationControlsComponent {\n readonly AGGREGATION_TEXTS = AGGREGATION_TEXTS;\n readonly DATE_FORMAT = 'medium';\n\n readonly errorMessages = {\n dateAfterRangeMax: gettext('This date is after the latest allowed date.'),\n dateBeforeRangeMin: gettext('This date is before the earliest allowed date.'),\n invalidDateTime: gettext('This date is invalid.'),\n invalidDateRange: gettext('Start date must be before end date.')\n } as const;\n\n // Popover messages for translation extraction\n readonly TIME_RANGE_PICKER_POPOVER = gettext(\n 'Specify the exact start and end date/time of the time period to analyse. This provides a static view of historical data within the selected timeframe.'\n );\n readonly AGGREGATION_POPOVER = gettext(\n \"Groups data points into larger time intervals to simplify visualization and improve performance. 'None' shows raw data, while other options combine data points into minute, hour, or day groupings.\"\n );\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly formBuilder = inject(FormBuilder);\n private readonly aggregationPickerService = inject(AggregationPickerService);\n\n private readonly settingsSignal = signal<Partial<GlobalContextSettings>>({\n showAutoRefresh: true,\n showTimeContext: true,\n showAggregation: true\n });\n private readonly contextState = signal<GlobalContextState | null>(null);\n\n @Input()\n set settings(value: Partial<GlobalContextSettings> | null) {\n this.settingsSignal.set({\n showAutoRefresh: true,\n showTimeContext: true,\n showAggregation: true,\n ...(value ?? {})\n });\n }\n get settings(): Partial<GlobalContextSettings> {\n return this.settingsSignal();\n }\n\n @Input()\n set context(value: GlobalContextState | null) {\n const cloned = value ? structuredClone(value) : null;\n\n // Only update if context actually changed to avoid unnecessary form patches\n const prev = this.contextState();\n const isDifferent = !isEqual(prev, cloned);\n\n if (isDifferent) {\n this.contextState.set(cloned);\n this.patchFormFromContext(cloned);\n }\n }\n\n readonly contextChange = output<Partial<GlobalContextState>>();\n readonly validationStatus = output<boolean>();\n\n currentForm: ReturnType<typeof this.createForm>;\n readonly disabledAggregations = signal<Partial<Record<aggregationType, boolean>>>({});\n readonly dateFromErrors = signal<Record<string, any> | null>(null);\n readonly dateToErrors = signal<Record<string, any> | null>(null);\n\n constructor() {\n this.currentForm = this.createForm();\n\n this.currentForm.valueChanges\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(100))\n .subscribe(formValue => {\n this.handleFormValueChange(formValue as Partial<GlobalContextState>);\n });\n\n this.currentForm.statusChanges\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(100))\n .subscribe(() => {\n this.updateErrorSignals();\n this.validationStatus.emit(this.currentForm.valid);\n });\n\n this.updateErrorSignals();\n this.validationStatus.emit(this.currentForm.valid);\n }\n\n private updateErrorSignals(): void {\n const dateTimeContext = this.currentForm?.get('dateTimeContext');\n const dateFromControl = dateTimeContext?.get('dateFrom');\n const dateToControl = dateTimeContext?.get('dateTo');\n\n const dateFromControlErrors = dateFromControl?.errors || {};\n const groupErrors = dateTimeContext?.errors || {};\n\n if (Object.keys(dateFromControlErrors).length > 0) {\n this.dateFromErrors.set(dateFromControlErrors);\n } else if (Object.keys(groupErrors).length > 0) {\n this.dateFromErrors.set(groupErrors);\n } else {\n this.dateFromErrors.set(null);\n }\n\n const dateToControlErrors = dateToControl?.errors || {};\n this.dateToErrors.set(Object.keys(dateToControlErrors).length > 0 ? dateToControlErrors : null);\n }\n\n private handleFormValueChange(formValue: Partial<GlobalContextState>): void {\n const { dateTimeContext, aggregation } = formValue;\n\n if (!dateTimeContext) {\n return;\n }\n\n // Normalize seconds and milliseconds BEFORE validation to prevent precision issues\n const normalizedFrom = new Date(dateTimeContext.dateFrom);\n normalizedFrom.setSeconds(0, 0);\n const normalizedTo = new Date(dateTimeContext.dateTo);\n normalizedTo.setSeconds(0, 0);\n\n dateTimeContext.dateFrom = normalizedFrom.toISOString();\n dateTimeContext.dateTo = normalizedTo.toISOString();\n\n // Calculate disabled aggregations regardless of validation\n // This allows us to disable aggregations even for edge cases like dateFrom === dateTo\n dateTimeContext.interval = TIME_INTERVAL.CUSTOM;\n\n const { selectedAggregation, disabledAggregations } =\n this.aggregationPickerService.calculateAggregation(\n [new Date(dateTimeContext.dateFrom), new Date(dateTimeContext.dateTo)],\n aggregation ?? null\n );\n this.disabledAggregations.set(disabledAggregations);\n\n // Skip emission if validation fails (e.g., dateFrom > dateTo), but still update UI\n if (!this.isValidDateTimeContext(dateTimeContext)) {\n return;\n }\n\n if (selectedAggregation !== undefined) {\n this.currentForm.patchValue({ aggregation: selectedAggregation }, { emitEvent: false });\n }\n\n const emission = structuredClone(this.currentForm.value) as GlobalContextState;\n this.contextChange.emit(emission);\n }\n\n private isValidDateTimeContext(dateTimeContext: DateTimeContext | null): boolean {\n if (!dateTimeContext) {\n return false;\n }\n\n const normalizedFrom = new Date(dateTimeContext.dateFrom);\n normalizedFrom.setSeconds(0, 0);\n const normalizedTo = new Date(dateTimeContext.dateTo);\n normalizedTo.setSeconds(0, 0);\n\n return DateTimeContextUtil.isValidRange(normalizedFrom, normalizedTo);\n }\n\n private patchFormFromContext(context?: GlobalContextState | null): void {\n if (!this.currentForm) {\n return;\n }\n\n const ctx = context ?? this.contextState();\n\n if (!ctx) {\n const defaults = this.getDefaultDateRange();\n this.currentForm.patchValue(\n {\n dateTimeContext: {\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: defaults.dateFrom,\n dateTo: defaults.dateTo\n },\n aggregation: null\n },\n { emitEvent: false }\n );\n this.disabledAggregations.set({});\n this.validationStatus.emit(this.currentForm.valid);\n return;\n }\n\n let clonedContext: DateTimeContext | null = null;\n if (ctx.dateTimeContext) {\n clonedContext = structuredClone(ctx.dateTimeContext);\n } else {\n const defaults = this.getDefaultDateRange();\n clonedContext = {\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: defaults.dateFrom,\n dateTo: defaults.dateTo\n };\n }\n\n clonedContext.interval = TIME_INTERVAL.CUSTOM;\n\n const normalizedFrom = new Date(clonedContext.dateFrom);\n normalizedFrom.setSeconds(0, 0);\n const normalizedTo = new Date(clonedContext.dateTo);\n normalizedTo.setSeconds(0, 0);\n\n clonedContext.dateFrom = normalizedFrom.toISOString();\n clonedContext.dateTo = normalizedTo.toISOString();\n\n this.currentForm.patchValue(\n {\n dateTimeContext: clonedContext,\n aggregation: ctx.aggregation ?? null\n },\n { emitEvent: false }\n );\n\n // Update disabled aggregations but DON'T override the value\n const { disabledAggregations } = this.aggregationPickerService.calculateAggregation(\n [new Date(clonedContext.dateFrom), new Date(clonedContext.dateTo)],\n ctx.aggregation ?? null\n );\n this.disabledAggregations.set(disabledAggregations);\n this.validationStatus.emit(this.currentForm.valid);\n }\n\n private createForm() {\n const defaultDates = this.getDefaultDateRange();\n\n const dateTimeContext = this.formBuilder.group<DateTimeContext>(\n {\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: defaultDates.dateFrom,\n dateTo: defaultDates.dateTo\n },\n {\n validators: [this.createDateRangeValidator()]\n }\n );\n\n return this.formBuilder.group({\n dateTimeContext,\n aggregation: this.formBuilder.control<aggregationType | null>(null)\n });\n }\n\n private getDefaultDateRange(): { dateFrom: string; dateTo: string } {\n const now = new Date();\n now.setSeconds(0, 0);\n const oneHourAgo = new Date(now.getTime() - TIME_DURATION.ONE_HOUR_MS);\n oneHourAgo.setSeconds(0, 0);\n\n return {\n dateFrom: oneHourAgo.toISOString(),\n dateTo: now.toISOString()\n };\n }\n\n private createDateRangeValidator(): ValidatorFn {\n return (group: AbstractControl): ValidationErrors | null => {\n const dateFrom = group.get('dateFrom')?.value;\n const dateTo = group.get('dateTo')?.value;\n\n if (!dateFrom || !dateTo) {\n return null;\n }\n\n const normalizedFrom = new Date(dateFrom);\n normalizedFrom.setSeconds(0, 0);\n const normalizedTo = new Date(dateTo);\n normalizedTo.setSeconds(0, 0);\n\n if (!DateTimeContextUtil.isValidRange(normalizedFrom, normalizedTo)) {\n return { invalidDateRange: true };\n }\n\n return null;\n };\n }\n}\n","@if (currentForm) {\n @let SHOW_TIME_CONTEXT = settings.showTimeContext;\n @let SHOW_AGGREGATION = settings.showAggregation;\n\n <form [formGroup]=\"currentForm\">\n <div class=\"content-flex-100\">\n <div\n class=\"col-4\"\n [ngClass]=\"{ 'm-b-8': !SHOW_AGGREGATION }\"\n >\n @if (SHOW_TIME_CONTEXT) {\n @let dateTimeContext = currentForm.get('dateTimeContext');\n @let tempDateFromValue = dateTimeContext.get('dateFrom')?.value;\n @let tempDateToValue = dateTimeContext.get('dateTo')?.value;\n @let fromErrors = dateFromErrors();\n @let toErrors = dateToErrors();\n\n <fieldset class=\"c8y-fieldset\">\n <legend>\n <div class=\"standalone btn-icon-dot__item time-context m-r-4\">\n <i\n class=\"\"\n [c8yIcon]=\"'calendar'\"\n ></i>\n </div>\n {{ 'Date & time range' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"TIME_RANGE_PICKER_POPOVER | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-form-group class=\"content-flex-58 d-flex a-i-center m-b-0 p-t-16\">\n <c8y-form-group\n [class.has-error]=\"fromErrors\"\n class=\"form-group-sm d-flex a-i-center col-6 flex-wrap\"\n >\n <label\n class=\"m-b-sm-0 m-r-8 text-nowrap\"\n style=\"min-width: 30px\"\n [title]=\"'From`date`' | translate\"\n for=\"dateFrom\"\n translate\n >\n From`date`\n </label>\n <c8y-date-time-picker\n [class.has-error]=\"fromErrors\"\n id=\"dateFrom\"\n [maxDate]=\"tempDateToValue\"\n [placeholder]=\"'From`date`' | translate\"\n [formControl]=\"dateTimeContext.get('dateFrom')\"\n ></c8y-date-time-picker>\n <c8y-messages [show]=\"fromErrors\">\n <c8y-message\n name=\"dateAfterRangeMax\"\n [text]=\"errorMessages.dateAfterRangeMax | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateTime\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateRange\"\n [text]=\"errorMessages.invalidDateRange | translate\"\n ></c8y-message>\n </c8y-messages>\n </c8y-form-group>\n\n <c8y-form-group\n [class.has-error]=\"toErrors\"\n class=\"form-group-sm d-flex flex-wrap col-6 a-i-center\"\n >\n <label\n class=\"m-b-sm-0 text-nowrap m-r-8\"\n style=\"min-width: 30px\"\n [title]=\"'To`date`' | translate\"\n for=\"dateTo\"\n translate\n >\n To`date`\n </label>\n <c8y-date-time-picker\n [class.has-error]=\"toErrors\"\n id=\"dateTo\"\n [minDate]=\"tempDateFromValue\"\n [placeholder]=\"'To`date`' | translate\"\n [formControl]=\"dateTimeContext.get('dateTo')\"\n ></c8y-date-time-picker>\n <c8y-messages [show]=\"toErrors\">\n <c8y-message\n name=\"dateBeforeRangeMin\"\n [text]=\"errorMessages.dateBeforeRangeMin | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateTime\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n </c8y-messages>\n </c8y-form-group>\n </c8y-form-group>\n </fieldset>\n }\n </div>\n <div class=\"col-\">\n @if (SHOW_AGGREGATION) {\n @let selectedAggregation = currentForm.get('aggregation')?.value;\n\n <fieldset class=\"c8y-fieldset\">\n <legend>\n <div class=\"standalone btn-icon-dot__item aggregation m-r-4\">\n <i [c8yIcon]=\"'input'\"></i>\n </div>\n {{ 'Aggregation' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"AGGREGATION_POPOVER | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-form-group class=\"p-t-16 p-b-16 m-b-4\">\n <c8y-aggregation-picker\n formControlName=\"aggregation\"\n [resetToDefault]=\"true\"\n [disabledAggregations]=\"disabledAggregations()\"\n [layout]=\"'radio'\"\n ></c8y-aggregation-picker>\n </c8y-form-group>\n </fieldset>\n }\n </div>\n </div>\n </form>\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, forwardRef, Input } from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule\n} from '@angular/forms';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { BsDropdownModule } from 'ngx-bootstrap/dropdown';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport type { Interval } from '../../../models/interval-picker.model';\nimport { INTERVALS } from '../../../models/interval-picker.model';\n\n@Component({\n selector: 'c8y-interval-picker',\n templateUrl: './interval-picker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => IntervalPickerComponent),\n multi: true\n }\n ],\n standalone: true,\n imports: [\n CommonModule,\n FormsModule,\n A11yModule,\n ReactiveFormsModule,\n BsDropdownModule,\n IconDirective,\n PopoverModule,\n C8yTranslatePipe\n ]\n})\nexport class IntervalPickerComponent implements ControlValueAccessor {\n @Input() INTERVALS: Interval[] = [...INTERVALS];\n @Input() shouldDisableInterval = { isDisabled: false, msg: null };\n\n value: Interval['id'];\n touched = false;\n disabled = false;\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = _ => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onTouched = () => {};\n\n writeValue(value: Interval['id']) {\n this.value = value;\n }\n\n registerOnChange(fn: (value: Interval['id']) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(onTouched: () => void): void {\n this.onTouched = onTouched;\n }\n\n markAsTouched() {\n if (!this.touched) {\n this.onTouched();\n this.touched = true;\n }\n }\n\n onIntervalSelect(intervalId: Interval['id']) {\n this.markAsTouched();\n this.value = intervalId;\n this.onChange(intervalId);\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled = disabled;\n }\n}\n","@for (interval of INTERVALS; track interval.id) {\n @let isSelected = interval.id === value;\n @let checkVisibility = isSelected ? 'visible' : 'hidden';\n @let isIntervalDisabled = shouldDisableInterval?.isDisabled;\n @let isIntervalDisabledMsg = shouldDisableInterval?.msg;\n @let isCustom = interval.id === 'custom';\n\n <li [class.active]=\"isSelected\">\n <div\n [ngStyle]=\"{\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center'\n }\"\n >\n <button\n class=\"mr-2\"\n type=\"button\"\n [attr.data-cy]=\"'global-context--interval-' + interval.id\"\n (click)=\"onIntervalSelect(interval.id)\"\n [disabled]=\"isCustom && isIntervalDisabled\"\n >\n <span [class.text-primary]=\"isSelected\">\n <span\n [c8yIcon]=\"'check'\"\n [style.visibility]=\"checkVisibility\"\n ></span>\n {{ interval.title | translate }}\n </span>\n </button>\n </div>\n </li>\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n Input,\n OnInit,\n ViewChild,\n computed,\n forwardRef,\n inject,\n signal\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n ControlValueAccessor,\n FormBuilder,\n FormControl,\n FormGroup,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule\n} from '@angular/forms';\nimport {\n DatePipe,\n DateTimePickerModule,\n FormGroupComponent,\n I18nModule,\n IconDirective,\n MessageDirective,\n MessagesComponent\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { BsDropdownDirective, BsDropdownModule } from 'ngx-bootstrap/dropdown';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { distinctUntilChanged } from 'rxjs';\nimport {\n DateTimeContext,\n DateTimeContextPickerConfig\n} from '../../../models/date-time-context-picker.model';\nimport {\n INTERVAL_TITLES,\n TIME_INTERVAL,\n TimeInterval\n} from '../../../models/interval-picker.model';\nimport { DateTimeContextPickerService } from '../../../services/domain/date-time-context-picker.service';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport { IntervalPickerComponent } from '../interval-picker';\n\n@Component({\n selector: 'c8y-date-time-context-picker',\n templateUrl: './date-time-context-picker.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n ReactiveFormsModule,\n TooltipModule,\n BsDropdownModule,\n I18nModule,\n IconDirective,\n DatePipe,\n MessagesComponent,\n MessageDirective,\n FormGroupComponent,\n IntervalPickerComponent,\n DateTimePickerModule\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => DateTimeContextPickerComponent),\n multi: true\n }\n ]\n})\nexport class DateTimeContextPickerComponent implements OnInit, ControlValueAccessor {\n @Input() disabled = false;\n @Input() shouldDisableInterval: Record<string, boolean> = {};\n @Input() config: DateTimeContextPickerConfig = {\n showDateFrom: true,\n showDateTo: true\n };\n\n @ViewChild(BsDropdownDirective) dropdown?: BsDropdownDirective;\n\n private readonly service = inject(DateTimeContextPickerService);\n private readonly formBuilder = inject(FormBuilder);\n private readonly destroyRef = inject(DestroyRef);\n private readonly datePipe = inject(DatePipe);\n private readonly cdr = inject(ChangeDetectorRef);\n\n readonly INTERVALS = INTERVAL_TITLES;\n readonly DATE_FORMAT = 'medium';\n readonly TIME_INTERVAL = TIME_INTERVAL;\n\n readonly errorMessages = {\n dateAfterRangeMax: gettext('This date is after the latest allowed date.'),\n dateBeforeRangeMin: gettext('This date is before the earliest allowed date.'),\n invalidDateTime: gettext('This date is invalid.'),\n invalidDateRange: gettext('Start date must be before end date.')\n } as const;\n\n form!: FormGroup;\n tempDateFromControl!: FormControl;\n tempDateToControl!: FormControl;\n\n private readonly customSnapshot = signal<DateTimeContext | null>(null);\n private readonly isRestoring = signal(false);\n private readonly canEmit = signal(true);\n private readonly currentInterval = signal<TimeInterval | null>(null);\n private onChangeCallback?: (value: Partial<DateTimeContext>) => void;\n private onTouchedCallback?: () => void;\n\n readonly isCustomMode = computed(() => this.currentInterval() === TIME_INTERVAL.CUSTOM);\n readonly isEditing = computed(() => this.dropdown?.isOpen && this.isCustomMode());\n\n ngOnInit(): void {\n this.form = this.formBuilder.group<DateTimeContext>({\n interval: null,\n dateFrom: null,\n dateTo: null\n });\n this.tempDateFromControl = new FormControl(null);\n this.tempDateToControl = new FormControl(null);\n\n this.setupIntervalChangeHandler();\n }\n\n writeValue(value: DateTimeContext): void {\n // Prevent updates when dropdown is open and custom mode is active\n if (this.dropdown?.isOpen && this.isCustomMode()) return;\n\n if (value && this.form) {\n const normalized = this.normalizeContext(value);\n this.form.patchValue(normalized, { emitEvent: false });\n this.currentInterval.set(normalized.interval);\n\n if (normalized.interval === TIME_INTERVAL.CUSTOM) {\n this.canEmit.set(false);\n this.customSnapshot.set({ ...this.form.value });\n this.syncTempControls();\n } else {\n this.canEmit.set(true);\n this.customSnapshot.set(null);\n }\n this.cdr.markForCheck();\n }\n }\n\n registerOnChange(fn: (value: DateTimeContext) => void): void {\n this.onChangeCallback = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouchedCallback = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n isDisabled ? this.form.disable({ emitEvent: false }) : this.form.enable({ emitEvent: false });\n }\n\n onShownDropdown(): void {\n if (this.isCustomMode()) {\n this.syncTempControls();\n this.customSnapshot.set({ ...this.form.value });\n }\n }\n\n onHiddenDropdown(): void {\n const snapshot = this.customSnapshot();\n if (snapshot && this.isCustomMode()) {\n this.isRestoring.set(true);\n this.form.patchValue(snapshot, { emitEvent: true });\n this.currentInterval.set(snapshot.interval);\n this.isRestoring.set(false);\n this.customSnapshot.set(null);\n }\n\n this.canEmit.set(!this.isCustomMode());\n this.onTouchedCallback?.();\n }\n\n getDateRangeLabel(): string {\n const dateFrom = this.isEditing()\n ? this.tempDateFromControl?.value\n : this.form.get('dateFrom')?.value;\n const dateTo = this.isEditing()\n ? this.tempDateToControl?.value\n : this.form.get('dateTo')?.value;\n\n if (!dateFrom || !dateTo) return '';\n return `${this.datePipe.transform(dateFrom, this.DATE_FORMAT)} — ${this.datePipe.transform(dateTo, this.DATE_FORMAT)}`;\n }\n\n isApplyDisabled(): boolean {\n if (!this.isCustomMode()) return this.form.invalid;\n\n const tempFrom = this.tempDateFromControl?.value;\n const tempTo = this.tempDateToControl?.value;\n\n if (this.config?.showDateFrom && !tempFrom) return true;\n if (this.config?.showDateTo && !tempTo) return true;\n\n if (tempFrom && tempTo) {\n const fromTime = this.normalizeTimestamp(tempFrom);\n const toTime = this.normalizeTimestamp(tempTo);\n if (fromTime >= toTime) return true;\n }\n\n const formFrom = this.form.get('dateFrom')?.value;\n const formTo = this.form.get('dateTo')?.value;\n const hasChanged =\n (this.config?.showDateFrom && tempFrom !== formFrom) ||\n (this.config?.showDateTo && tempTo !== formTo);\n\n return !hasChanged;\n }\n\n getDateFromErrors() {\n if (!this.tempDateFromControl?.touched) return null;\n const errors = this.tempDateFromControl?.errors || {};\n\n if (\n !this.config?.showDateTo &&\n this.tempDateFromControl?.value &&\n this.tempDateToControl?.value\n ) {\n const fromTime = this.normalizeTimestamp(this.tempDateFromControl.value);\n const toTime = this.normalizeTimestamp(this.tempDateToControl.value);\n if (fromTime >= toTime) {\n const {\n dateAfterRangeMax: _dateAfterRangeMax,\n dateBeforeRangeMin: _dateBeforeRangeMin,\n ...rest\n } = errors;\n return { ...rest, invalidDateRange: true };\n }\n }\n\n return Object.keys(errors).length > 0 ? errors : null;\n }\n\n getDateToErrors() {\n if (!this.config?.showDateTo) return null;\n if (!this.tempDateToControl?.touched && !this.tempDateFromControl?.touched) return null;\n\n const errors = this.tempDateToControl?.errors || {};\n const fromVal = this.tempDateFromControl?.value;\n const toVal = this.tempDateToControl?.value;\n\n if (fromVal && toVal) {\n const fromTime = this.normalizeTimestamp(fromVal);\n const toTime = this.normalizeTimestamp(toVal);\n if (fromTime >= toTime) {\n const {\n dateAfterRangeMax: _dateAfterRangeMax,\n dateBeforeRangeMin: _dateBeforeRangeMin,\n ...rest\n } = errors;\n return { ...rest, invalidDateRange: true };\n }\n }\n\n return Object.keys(errors).length > 0 ? errors : null;\n }\n\n protected applyDateTimeContext(intervalVal: TimeInterval = TIME_INTERVAL.CUSTOM): void {\n if (intervalVal === null) return;\n\n if (intervalVal === TIME_INTERVAL.CUSTOM) {\n this.applyCustomDates();\n } else if (intervalVal === 'none') {\n this.updateDates([new Date(0), new Date()], intervalVal);\n } else {\n const dates = this.service.getDateTimeContextByInterval(intervalVal);\n this.updateDates(dates, intervalVal);\n }\n\n this.closeDropdown();\n this.onTouchedCallback?.();\n }\n\n protected reset(): void {\n const dates = this.service.getDateTimeContextByInterval(TIME_INTERVAL.DAYS);\n this.updateDates(dates, TIME_INTERVAL.DAYS);\n this.closeDropdown();\n }\n\n private setupIntervalChangeHandler(): void {\n this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(value => {\n if (this.canEmit() && !this.isRestoring() && this.onChangeCallback) {\n this.onChangeCallback({ ...value });\n }\n });\n\n this.form\n .get('interval')\n ?.valueChanges.pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))\n .subscribe(interval => {\n this.currentInterval.set(interval);\n if (this.isRestoring()) return;\n\n if (interval === TIME_INTERVAL.CUSTOM) {\n this.canEmit.set(false);\n this.customSnapshot.set({ ...this.form.value });\n this.syncTempControls();\n } else {\n this.canEmit.set(true);\n this.customSnapshot.set(null);\n this.applyDateTimeContext(interval);\n }\n });\n }\n\n private applyCustomDates(): void {\n const normalizeDate = (dateStr: string): string => {\n const date = new Date(dateStr);\n date.setSeconds(0, 0);\n return date.toISOString();\n };\n\n const dateFrom = this.tempDateFromControl.value\n ? normalizeDate(this.tempDateFromControl.value)\n : null;\n const dateTo = this.tempDateToControl.value\n ? normalizeDate(this.tempDateToControl.value)\n : null;\n\n const ensured = DateTimeContextUtil.ensureIsoContext({\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom,\n dateTo\n });\n\n const next: DateTimeContext = {\n interval: ensured.interval ?? TIME_INTERVAL.CUSTOM,\n dateFrom: ensured.dateFrom,\n dateTo: ensured.dateTo\n };\n\n this.canEmit.set(true);\n this.customSnapshot.set(null);\n\n this.form.patchValue(next, { emitEvent: false });\n if (this.onChangeCallback) {\n this.onChangeCallback({ ...next });\n }\n }\n\n private updateDates(dates: [Date, Date], interval: TimeInterval): void {\n const [dateFrom, dateTo] = dates.map(date => DateTimeContextUtil.toIso(date));\n this.form.patchValue({ dateFrom, dateTo, interval });\n }\n\n private syncTempControls(): void {\n const dateFrom = this.form.get('dateFrom')?.value;\n const dateTo = this.form.get('dateTo')?.value;\n this.tempDateFromControl.setValue(dateFrom, { emitEvent: false });\n this.tempDateToControl.setValue(dateTo, { emitEvent: false });\n }\n\n private normalizeContext(value: DateTimeContext): DateTimeContext {\n const normalized = { ...value };\n if (normalized?.dateFrom instanceof Date) {\n normalized.dateFrom = normalized.dateFrom.toISOString();\n }\n if (normalized?.dateTo instanceof Date) {\n normalized.dateTo = normalized.dateTo.toISOString();\n }\n return normalized;\n }\n\n private normalizeTimestamp(dateStr: string): number {\n const date = new Date(dateStr);\n date.setSeconds(0, 0);\n return date.getTime();\n }\n\n private closeDropdown(): void {\n if (this.dropdown?.isOpen) {\n this.dropdown.hide();\n }\n }\n}\n","@if (form) {\n @let intervalValue = form.get('interval')?.value;\n @let isIntervalNone = intervalValue === 'none';\n @let dateFromControl = form.get('dateFrom');\n @let dateToControl = form.get('dateTo');\n @let dateRangeLabel = getDateRangeLabel();\n\n <form [formGroup]=\"form\">\n <div\n class=\"dropdown max-width-100\"\n container=\"body\"\n #dropdown=\"bs-dropdown\"\n dropdown\n [insideClick]=\"true\"\n [isDisabled]=\"disabled\"\n (onShown)=\"onShownDropdown()\"\n (onHidden)=\"onHiddenDropdown()\"\n >\n <!-- Dropdown toggle button with better accessibility -->\n <button\n class=\"dropdown-toggle form-control l-h-tight d-flex a-i-center\"\n [attr.aria-label]=\"dateRangeLabel\"\n [tooltip]=\"dateRangeLabel\"\n placement=\"top\"\n container=\"body\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n dropdownToggle\n data-cy=\"c8y-date-time-context-picker--picker-toggle\"\n >\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"'schedule1'\"\n aria-hidden=\"true\"\n ></i>\n <div class=\"d-col text-left flex-grow min-width-0\">\n @if (isIntervalNone) {\n <span class=\"text-10 text-muted l-h-1\">\n {{ 'No date filter' | translate }}\n </span>\n } @else {\n <span\n class=\"text-10 text-muted l-h-1\"\n data-cy=\"c8y-date-time-context-picker--picker-label\"\n >\n {{ INTERVALS[intervalValue] | translate }}\n </span>\n <span\n class=\"text-12 l-h-1 text-medium text-truncate\"\n data-cy=\"c8y-date-time-context-picker--picker-time-range\"\n >\n {{ form.get('dateFrom')?.value | c8yDate: DATE_FORMAT }} —\n {{ form.get('dateTo')?.value | c8yDate: DATE_FORMAT }}\n </span>\n }\n </div>\n <span\n class=\"caret m-r-16 m-l-4\"\n aria-hidden=\"true\"\n ></span>\n </button>\n\n <!-- Dropdown menu -->\n <ul\n class=\"dropdown-menu dropdown-menu--date-range\"\n role=\"menu\"\n *dropdownMenu\n >\n @if (dropdown.isOpen) {\n <!-- Interval picker section -->\n <c8y-interval-picker\n class=\"d-contents\"\n formControlName=\"interval\"\n [shouldDisableInterval]=\"shouldDisableInterval\"\n ></c8y-interval-picker>\n\n <!-- Custom date range section -->\n @if (isCustomMode() && (config?.showDateFrom || config?.showDateTo)) {\n <div class=\"p-l-16 p-r-16\">\n @if (config?.showDateFrom) {\n <c8y-form-group [class.has-error]=\"getDateFromErrors()\">\n <label\n [title]=\"'From`date`' | translate\"\n for=\"dateFrom\"\n translate\n >\n From`date`\n </label>\n <c8y-date-time-picker\n [class.has-error]=\"getDateFromErrors()\"\n id=\"dateFrom\"\n [maxDate]=\"tempDateToControl?.value\"\n [placeholder]=\"'From`date`' | translate\"\n [formControl]=\"tempDateFromControl\"\n ></c8y-date-time-picker>\n <c8y-messages [show]=\"getDateFromErrors()\">\n <c8y-message\n name=\"dateAfterRangeMax\"\n [text]=\"errorMessages.dateAfterRangeMax | translate\"\n ></c8y-message>\n <c8y-message\n name=\"dateBeforeRangeMin\"\n [text]=\"errorMessages.dateBeforeRangeMin | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateTime\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"bsDate\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateRange\"\n [text]=\"errorMessages.invalidDateRange | translate\"\n ></c8y-message>\n </c8y-messages>\n </c8y-form-group>\n }\n\n @if (config?.showDateTo) {\n <c8y-form-group [class.has-error]=\"getDateToErrors()\">\n <label\n [title]=\"'To`date`' | translate\"\n for=\"dateTo\"\n translate\n >\n To`date`\n </label>\n <c8y-date-time-picker\n [class.has-error]=\"getDateToErrors()\"\n id=\"dateTo\"\n [minDate]=\"tempDateFromControl?.value\"\n [placeholder]=\"'To`date`' | translate\"\n [formControl]=\"tempDateToControl\"\n ></c8y-date-time-picker>\n <c8y-messages [show]=\"getDateToErrors()\">\n <c8y-message\n name=\"dateAfterRangeMax\"\n [text]=\"errorMessages.dateAfterRangeMax | translate\"\n ></c8y-message>\n <c8y-message\n name=\"dateBeforeRangeMin\"\n [text]=\"errorMessages.dateBeforeRangeMin | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateTime\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"bsDate\"\n [text]=\"errorMessages.invalidDateTime | translate\"\n ></c8y-message>\n <c8y-message\n name=\"invalidDateRange\"\n [text]=\"errorMessages.invalidDateRange | translate\"\n ></c8y-message>\n </c8y-messages>\n </c8y-form-group>\n }\n </div>\n\n <!-- Action buttons -->\n <div class=\"p-16 d-flex gap-8 separator-top\">\n <button\n class=\"btn btn-default btn-sm flex-grow\"\n title=\"{{ 'Reset' | translate }}\"\n type=\"button\"\n (click)=\"reset()\"\n translate\n >\n Reset\n </button>\n\n <button\n class=\"btn btn-primary btn-sm flex-grow\"\n title=\"{{ 'Apply' | translate }}\"\n type=\"button\"\n (click)=\"applyDateTimeContext()\"\n [disabled]=\"isApplyDisabled()\"\n translate\n >\n Apply\n </button>\n </div>\n }\n }\n </ul>\n </div>\n </form>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Input,\n inject,\n output,\n signal\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, FormGroupComponent, IconDirective } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { debounceTime } from 'rxjs';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../../models';\nimport type {\n GlobalContextSettings,\n GlobalContextState\n} from '../../../models/global-context.model';\nimport { fillMissingDefaults } from '../../../utils/global-context-defaults.util';\nimport { DateTimeContextPickerComponent } from '../../time-context/time-range-picker/date-time-context-picker.component';\n\n/**\n * Component for configuring live mode settings\n * Stateless component that emits changes immediately\n */\n@Component({\n selector: 'c8y-live-mode-configuration-controls',\n templateUrl: './live-mode-configuration-controls.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n C8yTranslatePipe,\n TooltipModule,\n ReactiveFormsModule,\n DateTimeContextPickerComponent,\n IconDirective,\n FormsModule,\n PopoverModule,\n FormGroupComponent\n ]\n})\nexport class LiveModeConfigurationControlsComponent {\n // Popover messages for translation extraction\n readonly REFRESH_POPOVER_MESSAGE = gettext(\n 'The update method is determined by the widget type. Some widgets support real-time updates via WebSocket connection, while others use periodic refreshes.'\n );\n readonly TIME_RANGE_PICKER_POPOVER = gettext(\n 'Sets a rolling time window relative to the current time. As time progresses, the window automatically shifts to maintain the selected duration, always showing the most recent data.'\n );\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly formBuilder = inject(FormBuilder);\n\n private readonly settingsSignal = signal<Partial<GlobalContextSettings>>({\n showAutoRefresh: true,\n showTimeContext: true\n });\n private readonly defaultLiveContext = fillMissingDefaults({ refreshOption: REFRESH_OPTION.LIVE });\n private readonly currentContext = signal<GlobalContextState>(\n structuredClone(this.defaultLiveContext)\n );\n\n @Input()\n set settings(value: Partial<GlobalContextSettings> | null) {\n this.settingsSignal.set({\n showAutoRefresh: true,\n showTimeContext: true,\n ...(value ?? {})\n });\n }\n get settings(): Partial<GlobalContextSettings> {\n return this.settingsSignal();\n }\n\n @Input()\n set context(value: GlobalContextState | null) {\n if (!value) {\n return;\n }\n\n const normalized = fillMissingDefaults({\n ...value,\n refreshOption: REFRESH_OPTION.LIVE\n });\n const cloned = structuredClone(normalized);\n\n this.currentContext.set(cloned);\n this.patchFormFromContext(cloned);\n }\n\n readonly contextChange = output<Partial<GlobalContextState>>();\n\n form: ReturnType<typeof this.createForm>;\n\n constructor() {\n this.form = this.createForm();\n\n this.form.valueChanges\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(100))\n .subscribe(value => {\n this.contextChange.emit({\n dateTimeContext: value.dateTimeContext ?? null,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n isAutoRefreshEnabled: value.isAutoRefreshEnabled ?? null,\n aggregation: null\n });\n });\n\n this.patchFormFromContext(this.currentContext());\n }\n\n private createForm() {\n return this.formBuilder.group({\n dateTimeContext: this.formBuilder.control<DateTimeContext | null>(null),\n refreshInterval: this.formBuilder.control<number>(GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL),\n isAutoRefreshEnabled: this.formBuilder.control<boolean | null>(true)\n });\n }\n\n private patchFormFromContext(context?: GlobalContextState): void {\n if (!this.form) {\n return;\n }\n\n const ctx = context ?? this.currentContext();\n const { dateTimeContext, isAutoRefreshEnabled } = ctx;\n this.form.patchValue(\n {\n dateTimeContext: dateTimeContext ? structuredClone(dateTimeContext) : null,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n isAutoRefreshEnabled: isAutoRefreshEnabled ?? null\n },\n { emitEvent: false }\n );\n }\n}\n","@if (form) {\n @let SHOW_TIME_CONTEXT = settings.showTimeContext;\n @let SHOW_AUTO_REFRESH = settings.showAutoRefresh;\n\n <form [formGroup]=\"form\">\n <div class=\"content-flex-82\">\n <div class=\"col-5\">\n @if (SHOW_TIME_CONTEXT) {\n <fieldset class=\"c8y-fieldset\">\n <legend>\n <div class=\"standalone btn-icon-dot__item time-context m-r-4\">\n <i [c8yIcon]=\"'calendar'\"></i>\n </div>\n {{ 'Date & time' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"TIME_RANGE_PICKER_POPOVER | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-form-group class=\"m-b-4 p-t-16 p-b-16\">\n <c8y-date-time-context-picker\n formControlName=\"dateTimeContext\"\n [config]=\"{ showDateTo: false, showDateFrom: true }\"\n ></c8y-date-time-context-picker>\n </c8y-form-group>\n </fieldset>\n }\n </div>\n <div class=\"col-3\">\n @if (SHOW_AUTO_REFRESH) {\n <fieldset class=\"c8y-fieldset\">\n <legend class=\"d-flex\">\n <div class=\"standalone btn-icon-dot__item auto-refresh m-r-4\">\n <i [c8yIcon]=\"'refresh'\"></i>\n </div>\n {{ 'Auto refresh' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"REFRESH_POPOVER_MESSAGE | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-form-group class=\"m-b-8 form-group-sm p-t-16 p-b-16\">\n <div class=\"d-flex gap-8 a-i-center\">\n <label class=\"c8y-switch c8y-switch--inline\">\n <input\n type=\"checkbox\"\n #arInput\n formControlName=\"isAutoRefreshEnabled\"\n />\n <span></span>\n <span>\n {{ 'Auto refresh enabled' | translate }}\n </span>\n </label>\n </div>\n </c8y-form-group>\n </fieldset>\n }\n </div>\n </div>\n </form>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n TemplateRef,\n computed,\n effect,\n input,\n output,\n viewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport {\n C8yTranslatePipe,\n FormsModule,\n IconDirective,\n TabWithTemplate,\n TabsOutletComponent\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type {\n GlobalContextSettings,\n GlobalContextState\n} from '../../../models/global-context.model';\nimport { HistoryModeConfigurationControlsComponent } from '../history-mode-configuration-controls/history-mode-configuration-controls.component';\nimport { LiveModeConfigurationControlsComponent } from '../live-mode-configuration-controls/live-mode-configuration-controls.component';\n\ntype InlineTab = TabWithTemplate & { isActive?: boolean };\n\n@Component({\n selector: 'c8y-configuration-controls',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"p-relative fit-h\">\n <div [attr.class]=\"containerClass()\">\n <c8y-tabs-outlet\n [orientation]=\"controlsDisplayMode()\"\n [outletName]=\"resolvedOutletName()\"\n [attr.outletname]=\"resolvedOutletName()\"\n [openFirstTab]=\"false\"\n [tabs]=\"inlineTabs()\"\n ></c8y-tabs-outlet>\n\n @if (selectedMode() === REFRESH_OPTION.LIVE) {\n <div class=\"p-l-24 p-r-24 fit-w min-width-0\">\n <c8y-live-mode-configuration-controls\n [settings]=\"settings()\"\n [context]=\"liveContext()\"\n (contextChange)=\"handleLiveChanges($event)\"\n ></c8y-live-mode-configuration-controls>\n </div>\n }\n\n @if (selectedMode() === REFRESH_OPTION.HISTORY) {\n <div class=\"p-l-24 p-r-24 fit-w min-width-0\">\n <c8y-history-mode-configuration-controls\n [settings]=\"settings()\"\n [context]=\"historyContext()\"\n (contextChange)=\"handleHistoryChanges($event)\"\n (validationStatus)=\"handleValidationStatus($event)\"\n ></c8y-history-mode-configuration-controls>\n </div>\n }\n </div>\n\n <ng-template #LiveTab>\n <i [c8yIcon]=\"'process'\"></i>\n <div>\n <p class=\"text-bold\">{{ MODE_LABELS.LIVE | translate }}</p>\n <p class=\"tab-description text-12 l-h-tight\">\n {{ MODE_DESCRIPTIONS.LIVE | translate }}\n </p>\n </div>\n </ng-template>\n <ng-template #HistoryTab>\n <i [c8yIcon]=\"'schedule1'\"></i>\n <div>\n <p class=\"text-bold\">{{ MODE_LABELS.HISTORY | translate }}</p>\n <p class=\"tab-description text-12 l-h-tight\">\n {{ MODE_DESCRIPTIONS.HISTORY | translate }}\n </p>\n </div>\n </ng-template>\n </div>\n `,\n standalone: true,\n imports: [\n TooltipModule,\n CollapseModule,\n TabsOutletComponent,\n ReactiveFormsModule,\n FormsModule,\n PopoverModule,\n HistoryModeConfigurationControlsComponent,\n LiveModeConfigurationControlsComponent,\n C8yTranslatePipe,\n IconDirective\n ]\n})\nexport class ConfigurationControlsComponent {\n readonly MODE_LABELS = {\n LIVE: gettext('Live'),\n HISTORY: gettext('History')\n } as const;\n\n readonly MODE_DESCRIPTIONS = {\n LIVE: gettext('Dynamic time window that moves with current time to show recent data.'),\n HISTORY: gettext('Fixed time period for analyzing historical data.')\n } as const;\n readonly REFRESH_OPTION = REFRESH_OPTION;\n\n readonly controlsDisplayMode = input<'horizontal' | 'vertical'>('vertical');\n readonly settings = input<Partial<GlobalContextSettings>>({\n showAutoRefresh: true,\n showTimeContext: true,\n showAggregation: true\n });\n readonly activeMode = input<RefreshOption>(REFRESH_OPTION.LIVE);\n readonly liveContext = input<GlobalContextState | null>(null);\n readonly historyContext = input<GlobalContextState | null>(null);\n readonly supportedModes = input<RefreshOption[]>([REFRESH_OPTION.LIVE, REFRESH_OPTION.HISTORY]);\n\n readonly tabsOutletName = input<string | null>(null);\n private readonly liveTabSelect = new EventEmitter<void>();\n private readonly historyTabSelect = new EventEmitter<void>();\n readonly refreshOptionChange = output<RefreshOption>();\n readonly contextChange = output<Partial<GlobalContextState>>();\n readonly validationStatus = output<boolean>();\n\n readonly selectedMode = computed(() => this.activeMode());\n readonly containerClass = computed(() =>\n this.controlsDisplayMode() === 'horizontal' ? 'horizontal d-col' : 'd-flex'\n );\n readonly resolvedOutletName = computed(\n () => this.tabsOutletName() ?? 'verticalTabOutletForConfigurationModes'\n );\n\n readonly liveTabTemplate = viewChild<TemplateRef<any>>('LiveTab');\n readonly historyTabTemplate = viewChild<TemplateRef<any>>('HistoryTab');\n\n readonly inlineTabs = computed(() => {\n const liveTemp = this.liveTabTemplate();\n const historyTemp = this.historyTabTemplate();\n\n if (!liveTemp || !historyTemp) {\n return [];\n }\n\n const modes = this.supportedModes();\n const allTabs: InlineTab[] = [\n {\n title: this.MODE_LABELS.LIVE,\n template: liveTemp,\n showAlways: true,\n tabsOutlet: this.resolvedOutletName(),\n onSelect: this.liveTabSelect,\n isActive: this.selectedMode() === REFRESH_OPTION.LIVE\n },\n {\n title: this.MODE_LABELS.HISTORY,\n template: historyTemp,\n showAlways: true,\n tabsOutlet: this.resolvedOutletName(),\n onSelect: this.historyTabSelect,\n isActive: this.selectedMode() === REFRESH_OPTION.HISTORY\n }\n ];\n\n return allTabs.filter((tab, index) => {\n const mode = index === 0 ? REFRESH_OPTION.LIVE : REFRESH_OPTION.HISTORY;\n return modes.includes(mode);\n });\n });\n\n constructor() {\n this.liveTabSelect\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.handleTabSelect(REFRESH_OPTION.LIVE));\n this.historyTabSelect\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.handleTabSelect(REFRESH_OPTION.HISTORY));\n\n // Validate active mode and fallback to first available if not supported\n effect(() => {\n const currentMode = this.activeMode();\n const modes = this.supportedModes();\n\n if (!modes.includes(currentMode) && modes.length > 0) {\n this.refreshOptionChange.emit(modes[0]);\n }\n });\n\n // Emit validation status when mode changes\n effect(() => {\n const mode = this.selectedMode();\n if (mode === REFRESH_OPTION.LIVE) {\n this.validationStatus.emit(true);\n }\n });\n }\n\n handleTabSelect(mode: RefreshOption): void {\n if (this.selectedMode() === mode) {\n return;\n }\n\n this.refreshOptionChange.emit(mode);\n }\n\n handleLiveChanges(changes: Partial<GlobalContextState>): void {\n this.contextChange.emit({ ...changes, refreshOption: REFRESH_OPTION.LIVE });\n }\n\n handleHistoryChanges(changes: Partial<GlobalContextState>): void {\n this.contextChange.emit({ ...changes, refreshOption: REFRESH_OPTION.HISTORY });\n }\n\n handleValidationStatus(isValid: boolean): void {\n this.validationStatus.emit(isValid);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n Input,\n output,\n signal\n} from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, FormsModule } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { isEqual } from 'lodash-es';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport { TIME_DURATION } from '../../../models/constants';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport { fillMissingDefaults } from '../../../utils/global-context-defaults.util';\nimport { ConfigurationControlsComponent } from '../configuration-controls/configuration-controls.component';\n\n@Component({\n selector: 'c8y-configuration-collapse',\n templateUrl: './configuration-collapse.component.html',\n host: { class: 'd-contents' },\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n TooltipModule,\n CollapseModule,\n ReactiveFormsModule,\n FormsModule,\n PopoverModule,\n ConfigurationControlsComponent,\n C8yTranslatePipe\n ]\n})\nexport class ConfigurationCollapseComponent {\n readonly REFRESH_OPTION = REFRESH_OPTION;\n\n readonly isCollapsed = signal(true);\n readonly shouldSave = signal(false);\n readonly hasPendingChanges = signal(false);\n readonly activeMode = signal<RefreshOption>(REFRESH_OPTION.LIVE);\n readonly supportedModes = input<RefreshOption[]>([REFRESH_OPTION.LIVE, REFRESH_OPTION.HISTORY]);\n readonly isFormValid = signal(true);\n\n readonly helpText = gettext(\n 'When checked, saves these settings as the default configuration for this dashboard. If unchecked, changes will only apply for the current session and will reset when you reload the page.'\n );\n\n private readonly latestContext = signal<GlobalContextState | null>(null);\n private readonly snapshots = signal<Record<RefreshOption, GlobalContextState | null>>({\n [REFRESH_OPTION.LIVE]: null,\n [REFRESH_OPTION.HISTORY]: null\n });\n\n readonly liveViewContext = computed(() => {\n return this.snapshots()[REFRESH_OPTION.LIVE] ?? undefined;\n });\n readonly historyViewContext = computed(() => {\n return this.snapshots()[REFRESH_OPTION.HISTORY] ?? undefined;\n });\n\n @Input() set context(value: GlobalContextState) {\n if (!value) {\n return;\n }\n\n this.latestContext.set(structuredClone(value));\n\n // CRITICAL: Don't update form snapshots while dropdown is open\n // User is actively editing - external updates would overwrite their changes\n if (this.isCollapsed()) {\n this.activeMode.set(value.refreshOption ?? REFRESH_OPTION.LIVE);\n\n this.snapshots.set({\n [REFRESH_OPTION.LIVE]:\n value.refreshOption === REFRESH_OPTION.LIVE ? structuredClone(value) : null,\n [REFRESH_OPTION.HISTORY]:\n value.refreshOption === REFRESH_OPTION.HISTORY ? structuredClone(value) : null\n });\n\n this.hasPendingChanges.set(false);\n } else {\n // Dropdown is open - only recalculate if current state differs from latest\n this.recalculatePendingChanges();\n }\n }\n\n readonly contextChange = output<Partial<GlobalContextState>>();\n readonly refreshOptionChange = output<RefreshOption>();\n readonly savePreferenceChange = output<boolean>();\n\n toggle(): void {\n this.isCollapsed.update(value => !value);\n }\n\n close(): void {\n if (this.isCollapsed()) {\n return;\n }\n\n this.isCollapsed.set(true);\n this.resetToLatest();\n }\n\n onCollapsed(): void {\n this.isCollapsed.set(true);\n this.shouldSave.set(false);\n this.resetToLatest();\n }\n\n onExpanded(): void {\n this.isCollapsed.set(false);\n\n const mode = this.activeMode();\n const snapshot = this.snapshots()[mode];\n\n if (!snapshot) {\n const defaultContext = this.createDefaultContext(mode);\n this.snapshots.update(previous => ({\n ...previous,\n [mode]: structuredClone(defaultContext)\n }));\n }\n\n this.recalculatePendingChanges();\n }\n\n onModeChange(changes: Partial<GlobalContextState>): void {\n const mode = changes.refreshOption ?? this.activeMode();\n if (!mode) {\n return;\n }\n\n const current = this.snapshots()[mode]\n ? structuredClone(this.snapshots()[mode]!)\n : this.createDefaultContext(mode);\n\n const { refreshOption: _ignored, ...rest } = changes;\n const merged: GlobalContextState = { ...current, ...rest, refreshOption: mode };\n\n if (mode === REFRESH_OPTION.LIVE) {\n const normalized = fillMissingDefaults({ ...merged, refreshOption: REFRESH_OPTION.LIVE });\n merged.dateTimeContext = normalized.dateTimeContext;\n merged.isAutoRefreshEnabled = normalized.isAutoRefreshEnabled;\n merged.refreshInterval = normalized.refreshInterval;\n }\n\n this.snapshots.update(previous => ({\n ...previous,\n [mode]: structuredClone(merged)\n }));\n\n if (mode === this.activeMode()) {\n this.recalculatePendingChanges();\n }\n }\n\n onModeSelected(mode: RefreshOption): void {\n if (this.activeMode() === mode) {\n return;\n }\n\n this.activeMode.set(mode);\n\n const snapshot = this.snapshots()[mode];\n if (!snapshot) {\n const defaultContext = this.createDefaultContext(mode);\n this.snapshots.update(previous => ({\n ...previous,\n [mode]: structuredClone(defaultContext)\n }));\n }\n\n this.recalculatePendingChanges();\n }\n\n apply(): void {\n const shouldPersist = this.shouldSave();\n this.savePreferenceChange.emit(shouldPersist);\n\n if (!this.hasPendingChanges()) {\n return;\n }\n\n const mode = this.activeMode();\n const activeSnapshot = this.snapshots()[mode];\n if (!activeSnapshot) {\n return;\n }\n\n const payload = structuredClone(activeSnapshot);\n\n this.contextChange.emit(payload);\n this.refreshOptionChange.emit(mode);\n\n this.latestContext.set(structuredClone(payload));\n\n this.hasPendingChanges.set(false);\n this.shouldSave.set(false);\n this.isCollapsed.set(true);\n }\n\n shouldSaveInDashboard(change: boolean): void {\n this.shouldSave.set(change);\n }\n\n onValidationStatusChange(isValid: boolean): void {\n this.isFormValid.set(isValid);\n }\n\n private resetToLatest(): void {\n const latest = this.latestContext();\n const latestMode = latest?.refreshOption ?? REFRESH_OPTION.LIVE;\n\n this.snapshots.set({\n [REFRESH_OPTION.LIVE]:\n latest && latestMode === REFRESH_OPTION.LIVE ? structuredClone(latest) : null,\n [REFRESH_OPTION.HISTORY]:\n latest && latestMode === REFRESH_OPTION.HISTORY ? structuredClone(latest) : null\n });\n\n this.activeMode.set(latestMode);\n this.hasPendingChanges.set(false);\n this.shouldSave.set(false);\n this.isFormValid.set(true);\n }\n\n private createDefaultContext(mode: RefreshOption): GlobalContextState {\n if (mode === REFRESH_OPTION.LIVE) {\n return fillMissingDefaults({ refreshOption: REFRESH_OPTION.LIVE });\n }\n\n const now = new Date();\n const dateTo = now.toISOString();\n const dateFrom = new Date(now.getTime() - TIME_DURATION.ONE_HOUR_MS).toISOString();\n\n return {\n refreshOption: REFRESH_OPTION.HISTORY,\n dateTimeContext: {\n dateFrom,\n dateTo,\n interval: TIME_INTERVAL.CUSTOM\n },\n aggregation: null\n };\n }\n\n private recalculatePendingChanges(): void {\n const latest = this.latestContext();\n if (!latest) {\n this.hasPendingChanges.set(false);\n return;\n }\n\n const latestMode = latest.refreshOption ?? REFRESH_OPTION.LIVE;\n if (this.activeMode() !== latestMode) {\n this.hasPendingChanges.set(true);\n return;\n }\n\n const snapshot = this.snapshots()[this.activeMode()];\n if (!snapshot) {\n this.hasPendingChanges.set(false);\n return;\n }\n\n this.hasPendingChanges.set(!isEqual(snapshot, latest));\n }\n}\n","<div\n class=\"c8y-global-context\"\n [collapse]=\"isCollapsed()\"\n (collapsed)=\"onCollapsed()\"\n (expanded)=\"onExpanded()\"\n [isAnimated]=\"true\"\n>\n <div class=\"p-t-16 p-b-16 p-l-24 p-r-24 separator-bottom\">\n <span\n class=\"h4\"\n translate\n >\n Time mode\n </span>\n </div>\n <div>\n @if (!isCollapsed()) {\n <c8y-configuration-controls\n [activeMode]=\"activeMode()\"\n [liveContext]=\"liveViewContext()\"\n [historyContext]=\"historyViewContext()\"\n [supportedModes]=\"supportedModes()\"\n (refreshOptionChange)=\"onModeSelected($event)\"\n (contextChange)=\"onModeChange($event)\"\n (validationStatus)=\"onValidationStatusChange($event)\"\n ></c8y-configuration-controls>\n }\n </div>\n <div class=\"c8y-top-drawer--footer\">\n <div class=\"d-flex a-i-center gap-8\">\n <button\n class=\"btn btn-default\"\n [title]=\"'Close help' | translate\"\n aria-controls=\"collapseHelp\"\n [attr.aria-expanded]=\"!isCollapsed()\"\n type=\"button\"\n (click)=\"toggle()\"\n translate\n >\n Close\n </button>\n <button\n class=\"btn btn-primary\"\n [title]=\"'Apply global context' | translate\"\n aria-controls=\"collapseHelp\"\n [attr.aria-expanded]=\"!isCollapsed()\"\n type=\"button\"\n (click)=\"apply()\"\n [disabled]=\"!hasPendingChanges() || !isFormValid()\"\n translate\n data-cy=\"global-date-context--Apply-button\"\n >\n Apply\n </button>\n\n <label class=\"c8y-checkbox d-flex align-items-center m-b-0\">\n <input\n class=\"m-r-4\"\n type=\"checkbox\"\n [ngModel]=\"shouldSave()\"\n (ngModelChange)=\"shouldSaveInDashboard($event)\"\n />\n <span class=\"a-s-center m-r-8\"></span>\n <span\n class=\"text-truncate\"\n translate\n >\n Save in dashboard configuration\n </span>\n <button\n class=\"btn-help btn-help--sm m-l-4\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"helpText | translate\"\n placement=\"right\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </label>\n </div>\n </div>\n</div>\n","import { inject, Injectable } from '@angular/core';\nimport { ActivatedRoute, NavigationExtras, Router } from '@angular/router';\nimport { aggregationType } from '@c8y/client';\nimport { map, Observable } from 'rxjs';\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport {\n DateContextParams,\n DateContextQueryParamNames,\n GlobalContextState,\n InputDateContextQueryParams,\n ParameterValidationStatus\n} from '../../models/global-context.model';\nimport { Interval, TIME_INTERVAL, TimeInterval } from '../../models/interval-picker.model';\nimport { DateTimeContextPickerService } from '../domain/date-time-context-picker.service';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\nimport { GlobalContextValidationService } from '../domain/global-context-validation.service';\n\n/**\n * Service responsible for managing date context query parameters in the URL.\n *\n * This service provides a centralized way to handle reading, writing, and validation\n * of date context query parameters. It supports both interval-based and date-range-based\n * time contexts, with interval taking precedence when both are present.\n *\n * Key features:\n * - Reactive query parameter changes via observables\n * - Validation of query parameter values\n * - Conversion between query parameters and typed objects\n * - URL navigation with proper parameter handling\n * - Support for both interval and custom date ranges\n *\n * @example\n * ```typescript\n * // Subscribe to query parameter changes\n * queryService.queryParamsChange$().subscribe(params => {\n * console.log('Date context params:', params);\n * });\n *\n * // Set new query parameters\n * queryService.setDateContextQueryParams({\n * interval: TIME_INTERVAL.DAYS,\n * aggregation: aggregationType.HOURLY,\n * isAutoRefreshEnabled: true,\n * refreshOption: 'live'\n * });\n *\n * // Get context from current URL\n * const context = queryService.dateTimeContextFromQueryParams();\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class GlobalContextQueryService {\n private activatedRoute = inject(ActivatedRoute);\n private dateTimeContextPickerService = inject(DateTimeContextPickerService);\n private router = inject(Router);\n private validationService = inject(GlobalContextValidationService);\n\n /**\n * Stores the state when browser navigation occurs via back/forward buttons.\n * Used to preserve the global context state during browser history navigation\n * to ensure consistency between URL and component state.\n */\n navigationPopState = null;\n\n /**\n * Returns an observable that emits processed date context query parameters.\n *\n * This observable emits every time the route's query parameters change, providing\n * validated and typed parameter values. Invalid parameter values are automatically\n * filtered out and replaced with null or undefined as appropriate.\n *\n * The emitted object includes:\n * - `dateContextInterval`: Validated interval ID or null\n * - `dateContextAggregation`: Validated aggregation type or null\n * - `globalContextAutoRefresh`: Parsed boolean value or undefined\n * - All other original query parameters (preserved as-is)\n *\n * @returns Observable that emits InputDateContextQueryParams whenever route query params change\n *\n * @example\n * ```typescript\n * // Subscribe to parameter changes\n * queryService.queryParamsChange$().pipe(\n * takeUntilDestroyed()\n * ).subscribe(params => {\n * if (params.dateContextInterval) {\n * console.log('Valid interval:', params.dateContextInterval);\n * }\n * if (params.globalContextAutoRefresh === true) {\n * console.log('Auto-refresh is enabled');\n * }\n * });\n * ```\n */\n queryParamsChange$(): Observable<InputDateContextQueryParams> {\n // Get root route for consistent query param access\n let currentRoute = this.activatedRoute;\n while (currentRoute.parent) {\n currentRoute = currentRoute.parent;\n }\n\n return currentRoute.queryParams.pipe(\n map((params: Record<DateContextQueryParamNames, string>) => this.processQueryParams(params))\n );\n }\n\n /**\n * Creates a global context state object from the current route's query parameters.\n *\n * This method reads the current query parameters and attempts to build a valid\n * GlobalContextState object. It handles validation of parameters and applies\n * business logic for parameter precedence and conflicts.\n *\n * **Parameter Precedence Rules:**\n * 1. **Interval takes precedence**: If a valid interval is provided, any date range\n * parameters (dateFrom/dateTo) are ignored and recalculated based on the interval\n * 2. **Date range fallback**: If no valid interval is found, the method attempts\n * to use explicit date range parameters\n * 3. **Partial context**: If only non-temporal parameters are valid (aggregation,\n * refresh settings), a partial context without dateTimeContext is returned\n *\n * **Validation Logic:**\n * - Intervals are validated through DateTimeContextPickerService.isSelectableInterval()\n * - Date ranges are validated through DateTimeContextPickerService.isValidDateRange()\n * - Boolean parameters are strictly parsed (only 'true'/'false' strings accepted)\n * - Invalid refresh modes default to 'live'\n *\n * @returns Partial GlobalContextState object with valid parameters, or null if no valid context can be built\n *\n * @example\n * ```typescript\n * // With interval parameter: ?dateContextInterval=DAYS&dateContextAggregation=HOURLY\n * const context = queryService.dateTimeContextFromQueryParams();\n * // Returns: {\n * // aggregation: 'HOURLY',\n * // dateTimeContext: {\n * // dateFrom: '2024-01-01T00:00:00.000Z',\n * // dateTo: '2024-01-02T00:00:00.000Z',\n * // interval: 'DAYS'\n * // }\n * // }\n *\n * // With date range: ?dateContextFrom=2024-01-01&dateContextTo=2024-01-02\n * const context2 = queryService.dateTimeContextFromQueryParams();\n * // Returns: {\n * // dateTimeContext: {\n * // dateFrom: '2024-01-01',\n * // dateTo: '2024-01-02',\n * // interval: 'custom'\n * // }\n * // }\n *\n * // Invalid parameters\n * const context3 = queryService.dateTimeContextFromQueryParams();\n * // Returns: null\n * ```\n */\n dateTimeContextFromQueryParams(): Partial<GlobalContextState> | null {\n // Try multiple methods to get query params due to Angular routing inconsistencies\n let params = {};\n\n // Method 1: Navigate up to root route to get query params\n // Query params can be \"lost\" in child routes, so we traverse to the root\n // where they are most reliably available during navigation\n let currentRoute = this.activatedRoute;\n while (currentRoute.parent) {\n currentRoute = currentRoute.parent;\n }\n params = currentRoute.snapshot.queryParams;\n\n // Method 2: Fallback to manual URL parsing if root route params are empty\n if (!params || Object.keys(params).length === 0) {\n const currentUrl = this.router.url;\n if (currentUrl) {\n const questionMarkIndex = currentUrl.indexOf('?');\n if (questionMarkIndex > -1) {\n const queryString = currentUrl.substring(questionMarkIndex + 1);\n const urlParams = new URLSearchParams(queryString);\n params = {};\n urlParams.forEach((value, key) => {\n params[key] = value;\n });\n }\n }\n }\n\n // Extract and validate query parameters\n const dateContextInterval = params[DateContextQueryParamNames.DATE_CONTEXT_INTERVAL];\n const isValidInterval =\n this.dateTimeContextPickerService.isSelectableInterval(dateContextInterval);\n\n // Build the base context object without undefined values\n const baseContext: Partial<GlobalContextState> = {};\n\n const aggregation = params[DateContextQueryParamNames.DATE_CONTEXT_AGGREGATION];\n if (aggregation) {\n baseContext.aggregation = aggregation;\n }\n\n const refreshOption = params[DateContextQueryParamNames.DATE_CONTEXT_REFRESH_MODE];\n if (refreshOption) {\n baseContext.refreshOption =\n refreshOption === REFRESH_OPTION.HISTORY || refreshOption === REFRESH_OPTION.LIVE\n ? refreshOption\n : GLOBAL_CONTEXT_DEFAULTS.REFRESH_OPTION;\n }\n\n const isAutoRefreshEnabled = this.validationService.parseBoolean(\n params[DateContextQueryParamNames.DATE_CONTEXT_AUTO_REFRESH]\n );\n if (isAutoRefreshEnabled !== undefined) {\n baseContext.isAutoRefreshEnabled = isAutoRefreshEnabled;\n }\n\n // Try to get context from interval first\n if (isValidInterval && dateContextInterval) {\n const intervalId = dateContextInterval as Interval['id'];\n const range = DateTimeContextUtil.dateRangeFromInterval(\n intervalId as unknown as TimeInterval\n );\n if (range) {\n const [dateFrom, dateTo] = range;\n return {\n ...baseContext,\n dateTimeContext: DateTimeContextUtil.ensureIsoContext({\n interval: intervalId as unknown as TimeInterval,\n dateFrom,\n dateTo\n })\n };\n }\n }\n\n // If interval not provided, try getting date range from query params\n const dateRange = this.getDateContextFromQueryParams();\n if (dateRange) {\n return {\n ...baseContext,\n dateTimeContext: DateTimeContextUtil.ensureIsoContext({\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: dateRange[0],\n dateTo: dateRange[1]\n })\n };\n }\n\n // If we have some context values but no valid time range,\n // check if we should return the partial context or null\n if (Object.keys(baseContext).length > 0) {\n return baseContext;\n }\n\n // No valid context found at all\n return null;\n }\n\n /**\n * Updates the URL query parameters with new date context values.\n *\n * This method translates a context state object into URL query parameters and\n * navigates to update the current route. It handles the mutual exclusivity\n * between interval-based and date-range-based parameters.\n *\n * **Parameter Logic:**\n * - **Interval mode**: When a valid interval is provided (not 'custom'),\n * date-specific parameters (dateFrom/dateTo) are cleared\n * - **Date range mode**: When interval is 'custom' or undefined,\n * interval parameter is cleared and date range parameters are set\n * - **Navigation behavior**: Uses 'merge' strategy to preserve other query parameters\n * - **Browser history**: Handles popstate navigation differently than programmatic navigation\n *\n * **Performance Optimization:**\n * The method includes normalization logic to prevent unnecessary navigation\n * when the new parameters would result in the same normalized URL state.\n *\n * @param contextState Object containing the new context state values\n * @param contextState.interval - Time interval ('DAYS', 'HOURS', etc.) or 'custom'\n * @param contextState.date - Array of [dateFrom, dateTo] strings for custom ranges\n * @param contextState.aggregation - Data aggregation type ('HOURLY', 'DAILY', etc.)\n * @param contextState.isAutoRefreshEnabled - Whether auto-refresh should be enabled\n * @param contextState.refreshOption - Refresh mode ('live' or 'history')\n *\n * @example\n * ```typescript\n * // Set interval-based context\n * queryService.setDateContextQueryParams({\n * interval: TIME_INTERVAL.DAYS,\n * aggregation: aggregationType.HOURLY,\n * isAutoRefreshEnabled: true,\n * refreshOption: 'live'\n * });\n * // Results in: https://example.com/apps/cockpit/#/?dateContextInterval=DAYS&dateContextAggregation=HOURLY&globalContextAutoRefresh=true&globalContextRefreshMode=live\n *\n * // Set custom date range context\n * queryService.setDateContextQueryParams({\n * interval: TIME_INTERVAL.CUSTOM,\n * date: ['2024-01-01T00:00:00.000Z', '2024-01-02T00:00:00.000Z'],\n * aggregation: aggregationType.DAILY,\n * isAutoRefreshEnabled: false,\n * refreshOption: 'history'\n * });\n * // Results in: https://example.com/apps/cockpit/#/?dateContextFrom=2024-01-01T00:00:00.000Z&dateContextTo=2024-01-02T00:00:00.000Z&dateContextAggregation=DAILY&globalContextAutoRefresh=false&globalContextRefreshMode=history\n * ```\n */\n setDateContextQueryParams(contextState: DateContextParams): void {\n const { interval, date, aggregation, isAutoRefreshEnabled, refreshOption } = contextState;\n const queryParams = this.buildQueryParams({\n interval,\n date,\n aggregation,\n isAutoRefreshEnabled,\n refreshOption\n });\n\n const navigation = this.router.getCurrentNavigation();\n\n this.navigateWithQueryParams(queryParams, {\n queryParamsHandling: 'merge',\n state: {\n clearParams: navigation?.trigger === 'popstate' ? false : true\n }\n });\n }\n\n /**\n * Removes all date context query parameters from the current URL.\n *\n * This method performs a selective cleanup by detecting which date context\n * parameters are currently present in the URL and removing only those.\n * It preserves all non-date-context parameters unchanged.\n *\n * **Behavior:**\n * - **Selective removal**: Only removes parameters that are actually present\n * - **Preserve other params**: Non-date-context parameters remain unchanged\n * - **No-op optimization**: If no date context parameters exist, no navigation occurs\n * - **Merge strategy**: Uses 'merge' queryParamsHandling to maintain other URL state\n *\n * **Parameters removed (if present):**\n * - `dateContextFrom`\n * - `dateContextTo`\n * - `dateContextInterval`\n * - `dateContextAggregation`\n * - `globalContextAutoRefresh`\n * - `globalContextRefreshMode`\n *\n * @example\n * ```typescript\n * // Current URL: https://example.com/apps/cockpit/#/dashboard?dateContextInterval=DAYS&dateContextAggregation=HOURLY&otherParam=value\n * queryService.checkAndRemoveDateContextParams();\n * // Result URL: https://example.com/apps/cockpit/#/dashboard?otherParam=value\n *\n * // Current URL: https://example.com/apps/cockpit/#/dashboard?someOtherParam=value (no date context params)\n * queryService.checkAndRemoveDateContextParams();\n * // Result: No navigation occurs (no-op)\n * ```\n */\n checkAndRemoveDateContextParams(): void {\n const currentParams = this.activatedRoute.snapshot.queryParams;\n const dateContextParamNames = Object.values(DateContextQueryParamNames);\n\n // Check if any date context params exist in the current URL\n const dateContextParamsPresent = dateContextParamNames.some(\n paramName => currentParams[paramName] !== undefined\n );\n\n if (dateContextParamsPresent) {\n // Create an object with null values for all date context params that are present\n const paramsToRemove = dateContextParamNames.reduce(\n (acc, paramName) => {\n if (currentParams[paramName] !== undefined) {\n acc[paramName] = null;\n }\n return acc;\n },\n {} as Record<string, null>\n );\n\n // Only navigate if there are params to remove\n if (Object.keys(paramsToRemove).length > 0) {\n this.navigateWithQueryParams(paramsToRemove, { queryParamsHandling: 'merge' });\n }\n }\n }\n\n /**\n * Gets the current parameter validation status for debugging and UI state management.\n *\n * This method analyzes the current query parameters and returns detailed validation\n * information for each parameter type. Useful for debugging parameter issues and\n * providing user feedback about parameter validity.\n *\n * @returns ParameterValidationStatus object containing validation results for each parameter type\n *\n * @example\n * ```typescript\n * const status = queryService.getParameterValidationStatus();\n *\n * if (!status.interval && !status.dateRange) {\n * console.warn('No valid time context found in URL parameters');\n * }\n *\n * if (status.autoRefresh === undefined) {\n * console.info('Auto-refresh parameter not specified or invalid');\n * }\n *\n * // Use for conditional UI rendering\n * const hasValidTimeContext = status.interval || status.dateRange;\n * ```\n */\n getParameterValidationStatus(): ParameterValidationStatus {\n // Get params from root route\n let currentRoute = this.activatedRoute;\n while (currentRoute.parent) {\n currentRoute = currentRoute.parent;\n }\n const params = currentRoute.snapshot.queryParams;\n\n return this.validationService.validateParameters({\n interval: params[DateContextQueryParamNames.DATE_CONTEXT_INTERVAL],\n aggregation: params[DateContextQueryParamNames.DATE_CONTEXT_AGGREGATION],\n dateFrom: params[DateContextQueryParamNames.DATE_CONTEXT_FROM],\n dateTo: params[DateContextQueryParamNames.DATE_CONTEXT_TO],\n autoRefresh: params[DateContextQueryParamNames.DATE_CONTEXT_AUTO_REFRESH]\n });\n }\n\n /**\n * Validates if the current query parameters represent a valid global context.\n *\n * This is a convenience method that combines parameter validation with context building\n * to determine if the URL contains sufficient valid parameters to create a global context.\n *\n * @returns True if current parameters can build a valid global context, false otherwise\n *\n * @example\n * ```typescript\n * if (queryService.hasValidContext()) {\n * const context = queryService.dateTimeContextFromQueryParams();\n * // Context is guaranteed to be non-null\n * } else {\n * // Show default state or parameter input form\n * }\n * ```\n */\n hasValidContext(): boolean {\n const context = this.dateTimeContextFromQueryParams();\n return (\n context !== null && (context.dateTimeContext !== undefined || Object.keys(context).length > 0)\n );\n }\n\n /**\n * Builds query parameters based on the provided context state.\n * Chooses between interval-based or date-range-based parameters.\n *\n * @param contextState The global context state containing interval, date, aggregation, etc.\n * @returns Record of query parameters to be set in the URL\n */\n private buildQueryParams(\n contextState: DateContextParams\n ): Record<DateContextQueryParamNames, null | string | boolean> {\n const { interval, date, aggregation, isAutoRefreshEnabled, refreshOption } = contextState;\n if (interval && interval !== TIME_INTERVAL.CUSTOM) {\n return this.buildIntervalBasedQueryParams(\n interval,\n aggregation,\n isAutoRefreshEnabled,\n refreshOption\n );\n } else {\n return this.buildDateRangeBasedQueryParams(\n date,\n aggregation,\n isAutoRefreshEnabled,\n refreshOption\n );\n }\n }\n\n /**\n * Builds query parameters for interval-based time context.\n * Clears date-specific parameters and sets interval-related ones.\n *\n * @param interval The time interval\n * @param aggregation The aggregation type\n * @param isAutoRefreshEnabled Auto-refresh enabled flag\n * @param refreshOption The refresh option ('live' or 'history')\n * @returns Query parameters object for interval-based context\n */\n private buildIntervalBasedQueryParams(\n interval: string,\n aggregation: string | null,\n isAutoRefreshEnabled: boolean,\n refreshOption: string\n ): Record<DateContextQueryParamNames, null | string | boolean> {\n return {\n dateContextInterval: interval,\n dateContextAggregation: aggregation,\n dateContextTo: null,\n dateContextFrom: null,\n globalContextAutoRefresh: isAutoRefreshEnabled,\n globalContextRefreshMode: refreshOption\n };\n }\n\n /**\n * Builds query parameters for date-range-based time context.\n * Clears interval parameter and sets date-specific ones.\n *\n * @param date Array containing [dateFrom, dateTo] strings or Date objects, or null\n * @param aggregation The aggregation type\n * @param isAutoRefreshEnabled Auto-refresh enabled flag\n * @param refreshOption The refresh option ('live' or 'history')\n * @returns Query parameters object for date-range-based context\n */\n private buildDateRangeBasedQueryParams(\n date: (string | Date)[] | null,\n aggregation: string | null,\n isAutoRefreshEnabled: boolean,\n refreshOption: string\n ): Record<DateContextQueryParamNames, null | string | boolean> {\n return {\n dateContextFrom: date && date[0] ? DateTimeContextUtil.toIso(date[0]) : null,\n dateContextTo: date && date[1] ? DateTimeContextUtil.toIso(date[1]) : null,\n dateContextAggregation: aggregation,\n dateContextInterval: null,\n globalContextAutoRefresh: isAutoRefreshEnabled,\n globalContextRefreshMode: refreshOption\n };\n }\n\n /**\n * Helper method to navigate with query parameters\n * Centralizes navigation logic for consistent handling across methods\n *\n * @param queryParams The query parameters to set\n * @param options Additional navigation options\n */\n private navigateWithQueryParams(\n queryParams: Record<string, any>,\n options: Partial<NavigationExtras> = {}\n ): void {\n // Get root route for navigation\n let rootRoute = this.activatedRoute;\n while (rootRoute.parent) {\n rootRoute = rootRoute.parent;\n }\n\n const currentParams = rootRoute.snapshot.queryParams;\n\n // Helper to normalize boolean-like values\n const normalize = (obj: Record<string, any>) =>\n Object.fromEntries(\n Object.entries(obj)\n .filter(([_, v]) => v !== undefined && v !== null && v !== '')\n .map(([k, v]) => [k, v === 'true' ? true : v === 'false' ? false : v])\n );\n\n const current = normalize(currentParams);\n const next = normalize(queryParams);\n\n const hasChanged = JSON.stringify(current) !== JSON.stringify(next);\n\n if (hasChanged) {\n const navigationExtras: NavigationExtras = {\n relativeTo: rootRoute,\n queryParams,\n ...options\n };\n\n this.router.navigate([], navigationExtras);\n }\n }\n\n /**\n * Parses and validates date context from query params described by date \"from\" and date \"to\".\n *\n * @returns Date context as tuple of date \"from\" and date \"to\", or null if date context is invalid.\n */\n private getDateContextFromQueryParams(): [string, string] | null {\n // Get params from root route\n let currentRoute = this.activatedRoute;\n while (currentRoute.parent) {\n currentRoute = currentRoute.parent;\n }\n const params = currentRoute.snapshot.queryParams;\n const dateContextFrom = params[DateContextQueryParamNames.DATE_CONTEXT_FROM];\n const dateContextTo = params[DateContextQueryParamNames.DATE_CONTEXT_TO];\n\n if (this.validationService.isValidDateRange(dateContextFrom, dateContextTo)) {\n return [dateContextFrom, dateContextTo];\n }\n return null;\n }\n\n /**\n * Maps query params object to proper type with validation.\n *\n * Transforms raw string query parameters into properly typed values,\n * filtering out invalid values and converting boolean strings.\n *\n * @param params Query parameters object with string values only.\n * @returns Query params object of proper type with validated values.\n */\n private processQueryParams(\n params: Record<DateContextQueryParamNames, string>\n ): InputDateContextQueryParams {\n // Use validation service to get validated values in one call\n const validated = this.validationService.validateParameters({\n interval: params.dateContextInterval,\n aggregation: params.dateContextAggregation,\n autoRefresh: params.globalContextAutoRefresh\n });\n\n return {\n ...params,\n dateContextInterval: validated.interval\n ? (params.dateContextInterval as Interval['id'])\n : null,\n dateContextAggregation: validated.aggregation\n ? (params.dateContextAggregation as aggregationType)\n : null,\n globalContextAutoRefresh: validated.autoRefresh\n };\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { AGGREGATION_ICONS, AGGREGATION_TEXTS } from '../../../models/aggregation.model';\n\n@Component({\n selector: 'c8y-aggregation-display',\n templateUrl: './aggregation-display.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [C8yTranslatePipe, IconDirective]\n})\nexport class AggregationDisplayComponent {\n readonly aggregation = input<aggregationType | null>(null);\n readonly AGGREGATION_ICONS = AGGREGATION_ICONS;\n readonly AGGREGATION_TEXTS = AGGREGATION_TEXTS;\n}\n","<div class=\"d-flex a-i-center l-h-tight form-control\">\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"aggregation() ? AGGREGATION_ICONS[aggregation()] : AGGREGATION_ICONS.undefined\"\n ></i>\n <div class=\"d-col text-left fit-w min-width-0\">\n <span\n class=\"text-10 l-h-1 text-muted text-truncate\"\n title=\"{{ 'Aggregation' | translate }}\"\n >\n {{ 'Aggregation' | translate }}\n </span>\n <span\n class=\"text-12 l-h-1 text-medium text-truncate\"\n title=\"{{ AGGREGATION_TEXTS[aggregation()] | translate }}\"\n data-cy=\"global-date-context--Aggregation-display-value\"\n >\n {{ AGGREGATION_TEXTS[aggregation()] | translate }}\n </span>\n </div>\n</div>\n","import { AsyncPipe } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n EventEmitter,\n forwardRef,\n HostListener,\n inject,\n Input,\n OnDestroy,\n Output,\n ViewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n C8yTranslatePipe,\n CountdownIntervalComponent,\n CountdownIntervalModule,\n IconDirective\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { BehaviorSubject } from 'rxjs';\nimport { filter, tap, withLatestFrom } from 'rxjs/operators';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../../models';\n\n/**\n * Source of auto-refresh state change.\n */\nenum AutoRefreshChangeSource {\n /** External change from user interaction or form value changes */\n External = 'external',\n /** Internal change from tab visibility detection */\n Visibility = 'visibility'\n}\n\n/**\n * Auto-refresh toggle control with countdown timer.\n *\n * Displays a toggle button that enables/disables automatic refresh with a visual countdown\n * showing time until next refresh. Integrates with Angular forms via ControlValueAccessor.\n */\n@Component({\n selector: 'c8y-auto-refresh-control',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AutoRefreshControlComponent),\n multi: true\n }\n ],\n standalone: true,\n imports: [CountdownIntervalModule, C8yTranslatePipe, TooltipModule, IconDirective, AsyncPipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './auto-refresh-control.component.html'\n})\nexport class AutoRefreshControlComponent implements AfterViewInit, OnDestroy, ControlValueAccessor {\n countdownIntervalConfig = {\n enforcePulseIcon: false\n };\n\n @Input() isAutoRefreshConnected = false;\n\n @Input()\n set autoRefreshSeconds(_value: number) {\n // Value hardcoded to 5000ms for now, as per requirements\n // It will be adjusted later when dynamic intervals are supported (based on the request execution time)\n this.autoRefreshSeconds$ = new BehaviorSubject<number>(\n GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL\n );\n\n // Always show pulse icon, never show countdown timer\n this.countdownIntervalConfig = {\n enforcePulseIcon: true\n };\n }\n\n @Input() disableCounter = false;\n\n readonly DISABLE_AUTO_REFRESH = gettext('Auto refresh enabled');\n readonly ENABLE_AUTO_REFRESH = gettext('Auto refresh paused');\n readonly DEFAULT_INTERVAL_VALUE = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n\n private countdownComponentReady$ = new BehaviorSubject<CountdownIntervalComponent | null>(null);\n private readonly loading$ = new BehaviorSubject<boolean>(false);\n private readonly destroyRef = inject(DestroyRef);\n private readonly cdr = inject(ChangeDetectorRef);\n\n // Grace period handling for widgets without proper loading state\n private gracePeriodTimeout: ReturnType<typeof setTimeout> | null = null;\n\n // Track if auto-refresh was disabled by tab visibility (not user action)\n private disabledByTabVisibility = false;\n\n @Input() isEnabled: boolean;\n\n private _isLoading: boolean;\n\n @Input()\n set isLoading(value: boolean) {\n const wasLoading = this._isLoading;\n this._isLoading = value;\n\n // If loading started, cancel any pending grace period\n if (value && this.gracePeriodTimeout) {\n this.clearGracePeriod();\n }\n\n this.loading$.next(value);\n\n // Handle loading -> not loading transition\n if (wasLoading && !value && this.countdownIntervalComponent) {\n this.countdownIntervalComponent.reset();\n }\n }\n get isLoading(): boolean {\n return this._isLoading;\n }\n\n @ViewChild(CountdownIntervalComponent)\n countdownIntervalComponent: CountdownIntervalComponent;\n\n @Output() loadingChange = new EventEmitter<boolean>();\n\n @Output() refresh = new EventEmitter<void>();\n\n autoRefreshSeconds$: BehaviorSubject<number>;\n\n onChange: (value: boolean) => void;\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onTouched = () => {};\n\n ngAfterViewInit() {\n this.countdownComponentReady$.next(this.countdownIntervalComponent);\n this.setUpOnCountdownEndedListener();\n this.setupLoadingHandler();\n this.syncCountdownState();\n }\n\n ngOnDestroy() {\n this.clearGracePeriod();\n }\n\n @HostListener('document:visibilitychange')\n onVisibilityChange(): void {\n if (document.hidden && this.isEnabled) {\n this.disabledByTabVisibility = true;\n this.setAutoRefreshEnabled(false, AutoRefreshChangeSource.Visibility);\n } else {\n if (this.disabledByTabVisibility) {\n this.setAutoRefreshEnabled(true, AutoRefreshChangeSource.Visibility);\n }\n }\n }\n\n toggleIntervalRefresh() {\n this.setAutoRefreshEnabled(!this.isEnabled, AutoRefreshChangeSource.External);\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n writeValue(showIntervalRefresh: boolean): void {\n this.isEnabled = showIntervalRefresh;\n\n // External state change always clears the flag\n // This ensures visibility doesn't re-enable after external disable\n this.disabledByTabVisibility = false;\n\n this.syncCountdownState();\n this.cdr.markForCheck();\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n resetCountdown() {\n this.clearGracePeriod();\n this.countdownIntervalComponent?.reset();\n }\n\n /**\n * Internal method to change auto-refresh state with proper flag management.\n * @param enabled - New enabled state\n * @param source - Source of the change (External or Visibility)\n */\n private setAutoRefreshEnabled(enabled: boolean, source: AutoRefreshChangeSource): void {\n this.isEnabled = enabled;\n\n if (enabled || source === AutoRefreshChangeSource.External) {\n this.disabledByTabVisibility = false;\n }\n\n if (source === AutoRefreshChangeSource.External) {\n this.onChange(this.isEnabled);\n }\n\n this.syncCountdownState();\n this.cdr.markForCheck();\n }\n\n private setupLoadingHandler() {\n this.loading$\n .pipe(\n withLatestFrom(this.countdownComponentReady$),\n filter(([_, component]) => component !== null),\n tap(([isLoading, component]) => {\n if (isLoading) {\n // Stop without showing \"0\" - keep the last countdown value visible\n component?.stop(false);\n }\n // Reset is now handled in the isLoading setter\n }),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe();\n }\n\n private setUpOnCountdownEndedListener() {\n this.countdownIntervalComponent?.countdownEnded\n .pipe(\n filter(() => this.isEnabled),\n tap(() => this.handleCountdownEnded()),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe();\n }\n\n private handleCountdownEnded(): void {\n this.refresh.emit();\n\n // For widgets not connected to auto-refresh, implement grace period\n if (!this.isAutoRefreshConnected) {\n // Give widget 500ms to set loading state\n this.gracePeriodTimeout = setTimeout(() => {\n // If still no loading state, reset the countdown\n if (!this.isLoading) {\n this.resetCountdown();\n }\n this.gracePeriodTimeout = null;\n }, 500);\n }\n }\n\n private syncCountdownState(): void {\n if (!this.countdownIntervalComponent) return;\n\n if (this.isEnabled && !this.isLoading) {\n this.countdownIntervalComponent.start();\n } else if (!this.isEnabled) {\n this.countdownIntervalComponent.stop();\n }\n }\n\n private clearGracePeriod(): void {\n if (this.gracePeriodTimeout) {\n clearTimeout(this.gracePeriodTimeout);\n this.gracePeriodTimeout = null;\n }\n }\n}\n","@let autoRefreshTooltip = (isEnabled ? DISABLE_AUTO_REFRESH : ENABLE_AUTO_REFRESH) | translate;\n@let countdownInterval = (autoRefreshSeconds$ | async) ?? DEFAULT_INTERVAL_VALUE;\n\n<button\n [class.btn]=\"disableCounter\"\n [class.btn-link]=\"disableCounter\"\n [class.c8y-realtime]=\"disableCounter\"\n [class.toggle-countdown]=\"!disableCounter\"\n [attr.aria-label]=\"autoRefreshTooltip\"\n [tooltip]=\"tooltipTpl\"\n placement=\"bottom\"\n container=\"body\"\n [delay]=\"500\"\n (click)=\"toggleIntervalRefresh(); $event.stopPropagation()\"\n [adaptivePosition]=\"false\"\n [disabled]=\"isLoading\"\n mode\n data-cy=\"global-date-context--Auto-refresh-toggle\"\n>\n <div class=\"d-flex a-i-center\">\n @if (!disableCounter) {\n <c8y-countdown-interval\n #countdown\n [hidden]=\"!isEnabled\"\n [countdownInterval]=\"countdownInterval\"\n [config]=\"countdownIntervalConfig\"\n ></c8y-countdown-interval>\n }\n\n @if (!isEnabled) {\n <i\n class=\"icon-20 text-primary\"\n [c8yIcon]=\"'pause-circle'\"\n data-cy=\"global-date-context--Auto-refresh-toggle-pause\"\n ></i>\n } @else if (disableCounter) {\n <span class=\"c8y-pulse m-0 active\"></span>\n }\n </div>\n</button>\n\n<ng-template #tooltipTpl>\n {{ autoRefreshTooltip }}\n</ng-template>\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\nimport { C8yTranslatePipe, DatePipe, IconDirective } from '@c8y/ngx-components';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport { INTERVAL_TITLES } from '../../../models/interval-picker.model';\n\n@Component({\n selector: 'c8y-time-range-display',\n templateUrl: './time-range-display.component.html',\n standalone: true,\n imports: [IconDirective, C8yTranslatePipe, DatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class TimeRangeDisplayComponent {\n REFRESH_OPTION = REFRESH_OPTION;\n @Input() dateTimeContext: DateTimeContext;\n @Input() mode: 'from' | 'to' | 'default' = 'default';\n\n dateTo = new Date();\n\n readonly INTERVALS = INTERVAL_TITLES;\n readonly DATE_FORMAT = 'medium';\n}\n","@if (dateTimeContext) {\n <div class=\"d-flex a-i-center l-h-tight form-control\">\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"'schedule1'\"\n ></i>\n <div class=\"d-col text-left fit-w min-width-0\">\n <span\n class=\"text-10 l-h-1 text-muted\"\n data-cy=\"global-date-context--Selected-interval\"\n >\n {{ INTERVALS[dateTimeContext.interval] | translate }}\n </span>\n\n @if (mode === 'from') {\n <span\n class=\"text-12 text-medium text-truncate\"\n title=\"{{ dateTimeContext.dateFrom | c8yDate: DATE_FORMAT }}\"\n >\n {{ 'From`date`' | translate }} {{ dateTimeContext.dateFrom | c8yDate: DATE_FORMAT }}\n </span>\n }\n\n @if (mode === 'to') {\n <span\n class=\"text-12 l-h-1 text-medium text-truncate\"\n title=\"{{ dateTimeContext.dateTo | c8yDate: DATE_FORMAT }}\"\n >\n {{ 'To`date`' | translate }} {{ dateTimeContext.dateTo | c8yDate: DATE_FORMAT }}\n </span>\n }\n\n @if (mode === 'default') {\n <span\n class=\"text-12 l-h-1 text-medium text-truncate\"\n title=\"{{ dateTimeContext.dateFrom | c8yDate: DATE_FORMAT }} — {{\n dateTimeContext.dateTo | c8yDate: DATE_FORMAT\n }}\"\n data-cy=\"global-date-context--Selected-time-range\"\n >\n {{ dateTimeContext.dateFrom | c8yDate: DATE_FORMAT }} —\n {{ dateTimeContext.dateTo | c8yDate: DATE_FORMAT }}\n </span>\n }\n </div>\n </div>\n}\n","import { AsyncPipe, TitleCasePipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n EventEmitter,\n inject,\n Input,\n OnInit,\n Output\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, FormsModule } from '@c8y/ngx-components';\nimport { pick } from 'lodash-es';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport {\n BehaviorSubject,\n debounceTime,\n distinctUntilChanged,\n map,\n Observable,\n startWith\n} from 'rxjs';\nimport { AggregationDisplayComponent } from '../../features/aggregation/aggregation-display/aggregation-display.component';\nimport { AutoRefreshControlComponent } from '../../features/refresh/auto-refresh/auto-refresh-control.component';\nimport { TimeRangeDisplayComponent } from '../../features/time-context/time-range-display/time-range-display.component';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport { GlobalContextSettings, GlobalContextState } from '../../models/global-context.model';\nimport { GlobalContextFormService } from '../../services/state/global-context-form.service';\n\n/**\n * Context controls component for managing global context state and refresh options.\n *\n * Provides controls for time range, aggregation, and auto-refresh functionality\n * with reactive form handling and optimized change detection.\n *\n * @usageNotes\n *\n * ### Basic Usage\n * ```html\n * <c8y-context-controls\n * [settings]=\"globalSettings\"\n * [context]=\"currentContext\"\n * [isLoading]=\"loading\"\n * (contextChange)=\"handleContextChange($event)\"\n * (refresh)=\"handleRefresh()\"\n * (contextClick)=\"handleClick($event)\">\n * </c8y-context-controls>\n * ```\n *\n */\n@Component({\n selector: 'c8y-context-controls',\n standalone: true,\n templateUrl: './context-controls.component.html',\n imports: [\n C8yTranslatePipe,\n TooltipModule,\n CollapseModule,\n ReactiveFormsModule,\n FormsModule,\n PopoverModule,\n AutoRefreshControlComponent,\n TitleCasePipe,\n TimeRangeDisplayComponent,\n AggregationDisplayComponent,\n AsyncPipe\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContextControlsComponent implements OnInit {\n // Static properties\n readonly REFRESH_OPTION = REFRESH_OPTION;\n\n // Inputs\n @Input() showDisplayModeLabel = false;\n @Input() isLoading = false;\n\n @Input()\n set settings(value: GlobalContextSettings) {\n this._settings.next(value);\n }\n get settings(): GlobalContextSettings {\n return this._settings.value;\n }\n\n @Input()\n set context(value: GlobalContextState) {\n this._context.next(value);\n }\n get context(): GlobalContextState {\n return this._context.value;\n }\n\n // Outputs\n @Output() contextChange = new EventEmitter<Partial<GlobalContextState>>();\n @Output() refresh = new EventEmitter<void>();\n @Output() contextClick = new EventEmitter<Event>();\n\n // Public properties\n form: ReturnType<(typeof this.globalContextFormService)['buildForm']>;\n isAnySettingEnabled = true;\n refreshOption: RefreshOption;\n isAutoRefreshConnected = false;\n\n // Private properties\n private readonly globalContextFormService = inject(GlobalContextFormService);\n private readonly destroyRef = inject(DestroyRef);\n private readonly cd = inject(ChangeDetectorRef);\n private readonly _settings = new BehaviorSubject<GlobalContextSettings>(null);\n private readonly _context = new BehaviorSubject<GlobalContextState>(null);\n private readonly _isAnySettingsEnabled$ = new BehaviorSubject<boolean>(true);\n\n // Reactive state with optimized observables\n readonly isAnySettingsEnabled$: Observable<boolean> = this._isAnySettingsEnabled$.pipe(\n debounceTime(500),\n startWith(true),\n distinctUntilChanged()\n );\n\n // Lifecycle hooks\n ngOnInit(): void {\n this.initializeForm();\n this.setupContextSubscription();\n this.setupSettingsSubscription();\n this.setupFormValueChanges();\n }\n\n // Private methods\n private initializeForm(): void {\n this.form = this.globalContextFormService.buildForm(this.context, {});\n this.refreshOption = this.context?.refreshOption || REFRESH_OPTION.LIVE;\n }\n\n private setupContextSubscription(): void {\n this._context.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(context => {\n if (this.form && context) {\n this.form.patchValue(context, { emitEvent: false });\n }\n if (context && 'refreshOption' in context) {\n this.refreshOption = context.refreshOption;\n }\n });\n }\n\n private setupSettingsSubscription(): void {\n this._settings\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map(settings => this.extractRelevantSettings(settings)),\n distinctUntilChanged()\n )\n .subscribe(settingsToCheck => {\n const hasEnabledSettings = Object.values(settingsToCheck).some(setting => setting);\n this._isAnySettingsEnabled$.next(hasEnabledSettings);\n this.isAutoRefreshConnected = settingsToCheck.showAutoRefresh;\n this.cd.markForCheck();\n });\n }\n\n private setupFormValueChanges(): void {\n this.form.valueChanges\n .pipe(startWith(this.form.value), takeUntilDestroyed(this.destroyRef), distinctUntilChanged())\n .subscribe(value => {\n this.contextChange.emit(value);\n });\n }\n\n private extractRelevantSettings(settings: GlobalContextSettings): {\n showTimeContext: boolean;\n showAggregation: boolean;\n showAutoRefresh: boolean;\n } {\n const requiredKeys: (keyof GlobalContextSettings)[] = [\n 'showTimeContext',\n 'showAggregation',\n 'showAutoRefresh'\n ];\n\n return pick(settings, requiredKeys);\n }\n}\n","@if (form) {\n @let SHOW_TIME_CONTEXT = settings.showTimeContext;\n @let SHOW_AGGREGATION = settings.showAggregation;\n @let SHOW_AUTO_REFRESH = settings.showAutoRefresh;\n @let refreshIntervalValue = form?.get('refreshInterval')?.value;\n @let isLiveMode = refreshOption === REFRESH_OPTION.LIVE;\n\n @if (isLiveMode) {\n <form\n class=\"input-group\"\n [formGroup]=\"form\"\n >\n <c8y-auto-refresh-control\n #autoRefreshControl\n [isLoading]=\"isLoading\"\n [isAutoRefreshConnected]=\"isAutoRefreshConnected\"\n formControlName=\"isAutoRefreshEnabled\"\n [autoRefreshSeconds]=\"refreshIntervalValue\"\n (refresh)=\"refresh.emit()\"\n ></c8y-auto-refresh-control>\n <button\n class=\"btn-clean d-flex p-l-xs-16 p-r-xs-16 m-t-xs-8 m-b-xs-8 min-width-0\"\n style=\"margin-left: -1px\"\n (click)=\"contextClick.emit($event); $event.stopPropagation()\"\n >\n <div\n class=\"d-col a-i-start form-control\"\n style=\"flex: 0\"\n >\n <p class=\"text-muted fit-w text-10 l-h-1\">\n {{ 'Time mode' | translate }}\n </p>\n <p\n class=\"text-bold text-12 fit-w l-h-1\"\n data-cy=\"global-time-context-controls--Display-mode\"\n >\n {{ refreshOption | translate | titlecase }}\n </p>\n </div>\n\n @let interval = form.get('dateTimeContext')?.value?.interval;\n @let isCustomInterval = interval === 'custom';\n\n <c8y-time-range-display\n style=\"margin-left: -1px; min-width: 0\"\n [dateTimeContext]=\"form.get('dateTimeContext')?.value\"\n ></c8y-time-range-display>\n\n @if (!(isAnySettingsEnabled$ | async)) {\n <div\n class=\"d-col a-i-center form-control\"\n style=\"margin-left: -1px; flex: 0\"\n >\n <i\n class=\"dlt-c8y-icon-disconnected icon-20 text-danger\"\n [tooltip]=\"'No synced widgets' | translate\"\n placement=\"right\"\n container=\"body\"\n [delay]=\"500\"\n data-cy=\"global-time-context-controls--Widgets-disconnected\"\n ></i>\n </div>\n }\n </button>\n </form>\n } @else {\n <form [formGroup]=\"form\">\n <button\n class=\"btn-clean d-flex p-l-xs-16 p-r-xs-16 m-t-xs-8 m-b-xs-8\"\n (click)=\"contextClick.emit($event); $event.stopPropagation()\"\n >\n <div\n class=\"d-col a-i-center form-control\"\n style=\"flex: 0\"\n >\n <i class=\"dlt-c8y-icon-schedule1 icon-20 text-primary\"></i>\n </div>\n\n <div\n class=\"d-col a-i-start form-control\"\n style=\"margin-left: -1px; flex: 0\"\n >\n <p class=\"text-muted fit-w text-10 l-h-1\">\n {{ 'Time mode' | translate }}\n </p>\n <p\n class=\"text-bold text-12 fit-w l-h-1\"\n data-cy=\"global-time-context-controls--Display-mode\"\n >\n {{ refreshOption | translate | titlecase }}\n </p>\n </div>\n\n <c8y-time-range-display\n style=\"margin-left: -1px; min-width: 0\"\n [dateTimeContext]=\"form.get('dateTimeContext')?.value\"\n ></c8y-time-range-display>\n <c8y-aggregation-display\n style=\"margin-left: -1px; min-width: 0\"\n [aggregation]=\"form.get('aggregation')?.value\"\n ></c8y-aggregation-display>\n\n @if (!(isAnySettingsEnabled$ | async)) {\n <div\n class=\"d-col a-i-center form-control\"\n style=\"margin-left: -1px; flex: 0\"\n >\n <i\n class=\"dlt-c8y-icon-disconnected icon-20 text-danger\"\n [tooltip]=\"'No synced widgets' | translate\"\n placement=\"right\"\n container=\"body\"\n [delay]=\"500\"\n data-cy=\"global-time-context-controls--Widgets-disconnected\"\n ></i>\n </div>\n }\n </button>\n </form>\n }\n}\n","import { Location } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n inject,\n signal,\n ViewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport {\n ActivatedRoute,\n ActivationEnd,\n Navigation,\n NavigationEnd,\n NavigationStart,\n Router\n} from '@angular/router';\nimport { AlertService } from '@c8y/ngx-components';\nimport { ContextDashboardStateService } from '@c8y/ngx-components/context-dashboard-state';\nimport { isEqual, pick, some } from 'lodash-es';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport {\n combineLatest,\n debounceTime,\n distinctUntilChanged,\n filter,\n firstValueFrom,\n fromEvent,\n map,\n shareReplay,\n startWith,\n tap\n} from 'rxjs';\n\nimport { ConfigurationCollapseComponent } from '../features/configuration/configuration-collapse/configuration-collapse.component';\nimport type { RefreshOption } from '../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../models/auto-refresh.model';\nimport {\n DashboardChildConfig,\n DashboardChildSlot,\n DashboardManagedObject\n} from '../models/dashboard-context.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../models/global-context-defaults';\nimport type { DateTimeContext } from '../models/date-time-context-picker.model';\nimport type { GlobalContextSettings, GlobalContextState } from '../models/global-context.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GLOBAL_CONTEXT_EVENTS,\n GLOBAL_CONTEXT_SOURCE\n} from '../models/global-context.model';\nimport { INTERVALS, TIME_INTERVAL } from '../models/interval-picker.model';\nimport { AggregationPickerService } from '../services/domain/aggregation-picker.service';\nimport { GlobalContextQueryService } from '../services/infrastructure/global-context-query.service';\nimport { GlobalContextEventService } from '../services/state/global-context-event.service';\nimport { GlobalContextFormService } from '../services/state/global-context-form.service';\nimport { GlobalContextService } from '../services/state/global-context.service';\nimport { ContextControlsComponent } from '../shared/context-controls/context-controls.component';\nimport { DateTimeContextUtil } from '../utils/date-time-context.util';\n\n/**\n * GlobalContextComponent\n *\n * This component manages the global context across the application.\n * It synchronizes state between:\n * - Form UI state (user interactions)\n * - URL parameters (for permalink support)\n * - Dashboard state (for dashboard-specific settings)\n *\n * Key lifecycle phases:\n * 1. Initial load: URL params > Dashboard defaults > Form defaults\n * 2. User interactions: Form > URL params + Dashboard state\n * 3. Dashboard switching: Consider dashboard defaults if no settings\n */\n@Component({\n standalone: true,\n imports: [\n ReactiveFormsModule,\n TooltipModule,\n ContextControlsComponent,\n ConfigurationCollapseComponent\n ],\n selector: 'c8y-global-context',\n host: { class: 'min-width-0' },\n templateUrl: './global-context.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class GlobalContextComponent implements AfterViewInit {\n // Service Dependencies\n private readonly destroyRef = inject(DestroyRef);\n private readonly router = inject(Router);\n private readonly location = inject(Location);\n private readonly activatedRoute = inject(ActivatedRoute);\n private readonly alertService = inject(AlertService);\n private readonly cd = inject(ChangeDetectorRef);\n\n // Context Services\n readonly globalContextService = inject(GlobalContextService);\n readonly globalContextEventService = inject(GlobalContextEventService);\n private readonly globalContextFormService = inject(GlobalContextFormService);\n private readonly globalContextQueryService = inject(GlobalContextQueryService);\n private readonly aggregationPickerService = inject(AggregationPickerService);\n private readonly contextDashboardStateService = inject(ContextDashboardStateService, {\n optional: true\n }) as ContextDashboardStateService<GlobalContextState>;\n\n // Component State\n private blockUrlSync = true; // Start with blocking enabled to prevent early syncs\n private readonly navigationState$ = this.createNavigationStateStream();\n private initialUrlParams: Partial<GlobalContextState> | null = null;\n readonly intervals = INTERVALS;\n form!: ReturnType<typeof this.globalContextFormService.buildForm>;\n settings: GlobalContextSettings = this.globalContextService.getDefaultSettings();\n shouldSaveDashboardState = false;\n globalContextState = signal<GlobalContextState | null>(null);\n isVisible = signal<boolean>(false);\n\n @ViewChild(ConfigurationCollapseComponent, { static: false })\n configurationCollapseComponent!: ConfigurationCollapseComponent;\n\n constructor() {\n // Capture URL params immediately in constructor before anything can clear them\n const urlParams = this.globalContextQueryService.dateTimeContextFromQueryParams();\n if (urlParams && Object.keys(urlParams).length > 0) {\n this.initialUrlParams = urlParams;\n }\n // Keep blockUrlSync as true for all cases initially - will be unblocked after init\n }\n\n ngAfterViewInit() {\n this.initializeComponent();\n this.setupGlobalContextEvents();\n this.setupNavigationHandling();\n this.setupWidgetConfigListener();\n }\n\n onRefresh(): void {\n const currentState = this.getGlobalContextState();\n if (!currentState) return;\n\n if (this.isCustomInterval()) {\n this.handleCustomIntervalRefresh(currentState);\n } else {\n this.handleStandardIntervalRefresh();\n }\n }\n\n updateQueryParamsWithoutNavigation(\n queryParams: Record<string, string | number | boolean | null>\n ): void {\n const urlTree = this.router.createUrlTree([], {\n relativeTo: this.activatedRoute,\n queryParams: {\n ...this.activatedRoute.snapshot.queryParams,\n ...queryParams\n }\n });\n\n const url = this.router.serializeUrl(urlTree);\n this.location.replaceState(url);\n }\n\n onChanges(changes: GlobalContextState): void {\n // User has made a manual change - unblock URL sync\n if (this.blockUrlSync) {\n this.blockUrlSync = false;\n }\n\n const processedChanges = this.processStateChanges(changes);\n const stateToSave = this.extractSaveableState(processedChanges);\n const stateToEmit = structuredClone(processedChanges);\n\n this.patchGlobalContextState(stateToSave);\n this.broadcastStateChanges(stateToEmit);\n this.scheduleQueryParamSync();\n this.saveDashboardStateIfNeeded(stateToSave);\n }\n\n onRefreshOptionChanges(refreshOption: RefreshOption) {\n this.globalContextEventService.emit('GLOBAL_CONTEXT_REFRESH_OPTION_CHANGE', refreshOption);\n }\n\n getGlobalContextState(): GlobalContextState | null {\n return this.globalContextState();\n }\n\n updateGlobalContextState(globalContextState: GlobalContextState): void {\n const adjustedState = this.adjustGlobalState(globalContextState);\n\n // Remove non-persistent fields\n delete adjustedState.source;\n delete adjustedState.eventSourceId;\n\n this.patchGlobalContextState(adjustedState);\n }\n\n patchGlobalContextState(partialState: Partial<GlobalContextState>): boolean {\n const adjustedState = this.adjustGlobalState(partialState);\n const currentState = this.globalContextState();\n\n if (this.isStateUnchanged(currentState, adjustedState)) {\n return false;\n }\n\n this.globalContextState.set({ ...(currentState ?? {}), ...adjustedState });\n\n return true;\n }\n\n adjustGlobalState(globalContextState: GlobalContextState): Partial<GlobalContextState> {\n const gcCopy = structuredClone(globalContextState);\n\n const { dateTimeContext, aggregation } = gcCopy;\n\n // Adjust aggregation based on date range\n if ('aggregation' in gcCopy) {\n const { selectedAggregation } = this.aggregationPickerService.calculateAggregation(\n [new Date(dateTimeContext.dateFrom), new Date(dateTimeContext.dateTo)],\n aggregation\n );\n\n gcCopy.aggregation = selectedAggregation;\n }\n return gcCopy;\n }\n\n private setupWidgetConfigListener(): void {\n // Listen for dashboard save events to re-evaluate visibility\n this.contextDashboardStateService?.dashboardSaved\n .pipe(\n filter(Boolean),\n takeUntilDestroyed(this.destroyRef),\n tap(dashboard => {\n // Update visibility based on dashboard children\n const shouldShow = this.shouldShowGlobalContextForDashboard(dashboard);\n this.isVisible.set(shouldShow);\n })\n )\n ?.subscribe();\n }\n private createNavigationStateStream() {\n return this.router.events.pipe(\n takeUntilDestroyed(this.destroyRef),\n filter(\n e =>\n e instanceof NavigationStart || e instanceof NavigationEnd || e instanceof ActivationEnd\n ),\n map(e => e instanceof NavigationStart),\n startWith(false),\n tap(isNavigationStart => {\n if (isNavigationStart) {\n this.configurationCollapseComponent?.close();\n }\n }),\n shareReplay(1)\n );\n }\n\n private setupNavigationHandling(): void {\n this.router.events\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n filter(event => event instanceof NavigationEnd),\n filter(() => !this.isNavigationInProgress()),\n tap(() => this.handleNavigationEnd())\n )\n ?.subscribe();\n }\n\n private isNavigationInProgress(): boolean {\n // Prevent unnecessary data refetching during navigation.\n // Exception: allow events when navigation is user-triggered.\n // Without this, leaving dashboard triggers `GLOBAL_CONTEXT_EVENTS.STATE_CHANGE`,\n // causing unwanted widget data refetch.\n return (\n !!this.router.getCurrentNavigation() &&\n this.router.getCurrentNavigation().trigger !== 'popstate'\n );\n }\n\n private setupGlobalContextEvents(): void {\n this.setupContextHistoryEvents();\n this.setupContextLiveEvents();\n }\n\n private setupContextHistoryEvents(): void {\n fromEvent<CustomEvent>(window, GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_HISTORY)\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(250))\n ?.subscribe(event => {\n const detail = event.detail;\n if (detail?.type === GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_HISTORY) {\n detail.payload.refreshOption = REFRESH_OPTION.HISTORY;\n this.onChanges(detail.payload);\n }\n });\n }\n\n private setupContextLiveEvents(): void {\n fromEvent<CustomEvent>(window, GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_LIVE)\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(250))\n ?.subscribe(event => {\n const detail = event.detail;\n if (detail?.type === GLOBAL_CONTEXT_EVENTS.UPDATE_GLOBAL_CONTEXT_LIVE) {\n detail.payload.refreshOption = REFRESH_OPTION.LIVE;\n this.onChanges(detail.payload);\n }\n });\n }\n\n private handleNavigationEnd(): void {\n this.applyUrlStateIfPresent();\n }\n\n private applyUrlStateIfPresent(): void {\n const queryParamsContext = this.globalContextQueryService.dateTimeContextFromQueryParams();\n\n if (queryParamsContext) {\n const isStateChanged = this.patchGlobalContextState(queryParamsContext);\n\n if (isStateChanged) {\n this.emitStateChange();\n }\n }\n }\n\n private handleCustomIntervalRefresh(state: GlobalContextState): void {\n const { dateTimeContext, refreshOption } = state;\n\n if (refreshOption === REFRESH_OPTION.LIVE) {\n this.refreshCustomLiveInterval(dateTimeContext);\n } else if (refreshOption === REFRESH_OPTION.HISTORY) {\n this.refreshCustomHistoryInterval(dateTimeContext);\n }\n }\n\n private refreshCustomLiveInterval(dateTimeContext: DateTimeContext): void {\n const updatedContext = DateTimeContextUtil.normalizeForLive(dateTimeContext);\n\n this.patchGlobalContextState({ dateTimeContext: updatedContext });\n\n const { dateTimeContext: currentContext } = this.getGlobalContextState();\n const fromIso =\n DateTimeContextUtil.toIso(currentContext.dateFrom) || DateTimeContextUtil.toIso(new Date());\n const toIso =\n DateTimeContextUtil.toIso(currentContext.dateTo) || DateTimeContextUtil.toIso(new Date());\n this.updateQueryParamsWithoutNavigation({\n dateContextFrom: fromIso,\n dateContextTo: toIso\n });\n\n this.globalContextEventService.emit(GLOBAL_CONTEXT_EVENTS.REFRESH, { ...currentContext });\n }\n\n private refreshCustomHistoryInterval(dateTimeContext: DateTimeContext): void {\n const normalizedContext = DateTimeContextUtil.normalizeForHistory(dateTimeContext);\n\n this.globalContextEventService.emit(GLOBAL_CONTEXT_EVENTS.REFRESH, normalizedContext);\n }\n\n private handleStandardIntervalRefresh(): void {\n this.updateDateTimeContext();\n const { dateTimeContext } = this.getGlobalContextState();\n this.globalContextEventService.emit(GLOBAL_CONTEXT_EVENTS.REFRESH, { ...dateTimeContext });\n this.globalContextEventService.syncRefreshToStateChange({ ...dateTimeContext });\n }\n\n private processStateChanges(changes: GlobalContextState): GlobalContextState {\n const processedChanges = { ...changes };\n\n if (this.shouldSetCustomDateTo(processedChanges.dateTimeContext)) {\n processedChanges.dateTimeContext.dateTo = DateTimeContextUtil.toIso(new Date());\n }\n\n return processedChanges;\n }\n\n private shouldSetCustomDateTo(dateTimeContext: DateTimeContext): boolean {\n return (\n dateTimeContext &&\n dateTimeContext.interval === TIME_INTERVAL.CUSTOM &&\n !dateTimeContext.dateTo\n );\n }\n\n private extractSaveableState(changes: GlobalContextState): Partial<GlobalContextState> {\n return pick(changes, [\n 'dateTimeContext',\n 'aggregation',\n 'isAutoRefreshEnabled',\n 'refreshInterval',\n 'refreshOption',\n 'displayMode'\n ]);\n }\n\n private broadcastStateChanges(stateToEmit: GlobalContextState): void {\n this.emitStateChange(stateToEmit);\n this.contextDashboardStateService?.updateGlobalState(structuredClone(stateToEmit));\n }\n\n private scheduleQueryParamSync(): void {\n queueMicrotask(() => this.syncFormStateToQueryParams());\n }\n\n private saveDashboardStateIfNeeded(stateToSave: Partial<GlobalContextState>): void {\n if (!this.shouldSaveDashboardState) return;\n\n try {\n this.contextDashboardStateService?.saveDashboardState(\n this.contextDashboardStateService.selected$.value,\n structuredClone(stateToSave)\n );\n } catch (error) {\n this.alertService.addServerFailure(error);\n }\n }\n\n private isStateUnchanged(\n currentState: GlobalContextState | null,\n newState: Partial<GlobalContextState>\n ): boolean {\n if (!currentState) return false;\n\n const keys = Object.keys(newState) as (keyof GlobalContextState)[];\n const currentStateSubset = pick(currentState, keys);\n return isEqual(currentStateSubset, newState);\n }\n\n private emitStateChange(state?: GlobalContextState): void {\n const stateToEmit = state ?? this.getGlobalContextState();\n\n if (!stateToEmit) {\n return;\n }\n\n this.globalContextEventService.emit(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE, {\n source: GLOBAL_CONTEXT_SOURCE.DASHBOARD,\n eventSourceId: null,\n ...structuredClone(stateToEmit)\n });\n }\n\n private async initializeComponent(): Promise<void> {\n await this.initGlobalContextState();\n this.setupStateSubscriptions();\n\n // Unblock URL sync after initialization if no initial URL params\n if (!this.initialUrlParams) {\n this.blockUrlSync = false;\n }\n }\n\n private setupStateSubscriptions(): void {\n this.setupDashboardSubscription();\n this.emitStateChange();\n this.setupSettingsSubscription();\n }\n\n private async initGlobalContextState() {\n const initialState = await this.buildInitialState();\n\n this.updateGlobalContextState(initialState);\n }\n\n private async buildInitialState(): Promise<GlobalContextState> {\n // Get the selected dashboard (works for both dashboard and device routes)\n const selectedDashboard = await firstValueFrom(\n this.contextDashboardStateService?.selected$.pipe(filter(Boolean))\n );\n\n // Check if we're on a dashboard or device route\n const currentUrl = this.router.url;\n const isDashboardRoute = currentUrl?.includes('/dashboard/');\n const isDeviceRoute = currentUrl?.includes('/device/') && currentUrl?.includes('/device-info');\n\n // Determine visibility based on route type\n if (isDashboardRoute) {\n // Dashboard route - check children for displayMode\n const shouldShow = this.shouldShowGlobalContextForDashboard(selectedDashboard);\n this.isVisible.set(shouldShow);\n\n // Even if not visible, continue to build and return proper state\n // This ensures widgets can still get initial state via event service\n // Temporary solution, should be removed and isDeviceRoute check should be added to isDashboardRoute || isDeviceRoute\n // As for now dashboard children do not have proper configuration in the devicemanagement device-info dashboard\n } else if (isDeviceRoute) {\n const shouldShow = this.shouldShowGlobalContextForDashboard(selectedDashboard);\n this.isVisible.set(shouldShow ?? false);\n // Home dashboard\n } else if (selectedDashboard && this.shouldShowGlobalContextForDashboard(selectedDashboard)) {\n this.isVisible.set(true);\n }\n\n // Build state exactly like dashboard routes\n const globalContextDefaultState = this.globalContextService.getDefaultState();\n const dashboardGlobalContextState = selectedDashboard?.c8y_Dashboard?.dashboardState ?? {};\n const urlParams = this.initialUrlParams ?? {};\n const userInputQueryParams = { ...(this.globalContextQueryService.navigationPopState ?? {}) };\n\n this.globalContextQueryService.navigationPopState = null;\n\n let currentState: GlobalContextState = {\n ...globalContextDefaultState,\n ...dashboardGlobalContextState,\n ...urlParams,\n ...userInputQueryParams\n };\n\n // In live mode we always need to keep a valid date range (based on the interval)\n if (currentState.refreshOption === REFRESH_OPTION.LIVE) {\n const normalized =\n currentState?.dateTimeContext.interval === TIME_INTERVAL.CUSTOM\n ? DateTimeContextUtil.normalizeForLive(currentState.dateTimeContext)\n : (() => {\n const range = DateTimeContextUtil.dateRangeFromInterval(\n currentState.dateTimeContext?.interval\n );\n if (!range) return currentState.dateTimeContext;\n return DateTimeContextUtil.ensureIsoContext({\n interval: currentState.dateTimeContext.interval,\n dateFrom: range[0],\n dateTo: range[1]\n });\n })();\n\n currentState = {\n ...currentState,\n dateTimeContext: normalized\n };\n }\n\n // Always enforce the fixed 5s refresh interval\n // This ensures old dashboards with custom intervals stored in dashboardState are migrated\n currentState.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n\n return currentState;\n }\n\n private setupDashboardSubscription(): void {\n this.contextDashboardStateService?.selected$\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n tap(() => this.globalContextService.resetSettings()),\n filter(Boolean),\n tap(() => this.handleDashboardNavigation())\n )\n ?.subscribe();\n }\n\n private handleDashboardNavigation(): void {\n const navigation = this.router.getCurrentNavigation();\n const queryParamsContext = this.globalContextQueryService.dateTimeContextFromQueryParams();\n\n if (this.isPopstateNavigation(navigation)) {\n this.handlePopstateNavigation(queryParamsContext);\n }\n }\n\n private isPopstateNavigation(navigation: Navigation | null): boolean {\n return navigation?.trigger === 'popstate';\n }\n\n private handlePopstateNavigation(queryParamsContext: Partial<GlobalContextState>): void {\n if (queryParamsContext) {\n this.patchGlobalContextState(queryParamsContext);\n\n this.globalContextQueryService.navigationPopState = { ...this.globalContextState() };\n\n this.syncFormStateToQueryParams();\n }\n }\n\n private setupSettingsSubscription(): void {\n combineLatest([this.globalContextService.getConsolidatedSettings(), this.navigationState$])\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n tap(([settings]) => this.updateSettings(settings)),\n filter(([, navigationInProgress]) => !navigationInProgress),\n distinctUntilChanged((prev, curr) => isEqual(prev[0], curr[0]))\n )\n ?.subscribe(([settings]) => this.handleSettingsChange(settings));\n }\n\n private updateSettings(settings: GlobalContextSettings): void {\n this.settings = { ...settings };\n this.cd.markForCheck();\n }\n\n private handleSettingsChange(settings: GlobalContextSettings): void {\n const hasEnabledSettings = some(settings, Boolean);\n\n if (hasEnabledSettings) {\n this.syncFormStateToQueryParams();\n }\n }\n\n private syncFormStateToQueryParams(): void {\n // Block sync until initialization is complete AND user has interacted (if URL params exist)\n if (this.blockUrlSync) {\n return;\n }\n\n const currentState = this.getGlobalContextState();\n\n if (!currentState) return;\n\n const queryParams = this.buildQueryParamsFromState(currentState);\n\n this.globalContextQueryService.setDateContextQueryParams(queryParams);\n }\n\n private buildQueryParamsFromState(state: GlobalContextState) {\n const isAnyTrue = Object.values(this.settings).some(value => value === true);\n\n const queryParams = {\n interval: this.getIntervalForQuery(state),\n date: this.getDateRangeForQuery(state),\n aggregation: this.getAggregationForQuery(state),\n isAutoRefreshEnabled: this.getAutoRefreshForQuery(state),\n refreshOption: isAnyTrue ? state.refreshOption || REFRESH_OPTION.LIVE : null\n };\n\n return queryParams;\n }\n\n private getIntervalForQuery(state: GlobalContextState) {\n return this.settings.showTimeContext ? state.dateTimeContext?.interval || null : null;\n }\n\n private getDateRangeForQuery(state: GlobalContextState) {\n if (!this.settings.showTimeContext || !state.dateTimeContext) {\n return null;\n }\n return [state.dateTimeContext.dateFrom, state.dateTimeContext.dateTo];\n }\n\n private getAggregationForQuery(state: GlobalContextState) {\n // Live mode never has aggregation (business rule)\n if (state?.refreshOption === REFRESH_OPTION.LIVE) {\n return null;\n }\n // Include aggregation in URL if it has a value for History mode\n // This ensures aggregation is persisted in dashboard URLs\n return state?.aggregation || null;\n }\n\n private getAutoRefreshForQuery(state: GlobalContextState) {\n return this.settings.showAutoRefresh ? !!state.isAutoRefreshEnabled : null;\n }\n\n private isCustomInterval(): boolean {\n const state = this.getGlobalContextState();\n return state?.dateTimeContext?.interval === TIME_INTERVAL.CUSTOM;\n }\n\n private updateDateTimeContext(): void {\n const state = this.getGlobalContextState();\n const currentInterval = state?.dateTimeContext?.interval;\n\n if (!currentInterval) return;\n\n const range = DateTimeContextUtil.dateRangeFromInterval(currentInterval);\n if (!range) return;\n const [dateFrom, dateTo] = range;\n const ctx = DateTimeContextUtil.ensureIsoContext({\n interval: currentInterval,\n dateFrom,\n dateTo\n });\n this.patchGlobalContextState({ dateTimeContext: ctx });\n }\n\n /**\n * Checks if global context should be shown based on dashboard children configuration\n * NOTE: Using DashboardManagedObject instead of ContextDashboardManagedObject\n * to avoid circular dependency issues with the type imports.\n * @param dashboard - The dashboard object containing children\n * @returns true if any child has displayMode set to 'dashboard', false otherwise\n */\n private shouldShowGlobalContextForDashboard(\n dashboard: DashboardManagedObject | null | undefined\n ): boolean {\n // If no dashboard or no c8y_Dashboard property, show by default\n if (!dashboard?.c8y_Dashboard) {\n return true;\n }\n\n const children = dashboard.c8y_Dashboard.children;\n\n // If no children, don't show global context\n if (!children || typeof children !== 'object' || Object.keys(children).length === 0) {\n return false;\n }\n\n // Check if any child needs global context\n return Object.values(children).some((child: DashboardChildSlot | null | undefined) => {\n const config: DashboardChildConfig | null | undefined = child?.config;\n\n if (!config) {\n return false;\n }\n\n const {\n widgetInstanceGlobalAutoRefreshContext,\n widgetInstanceGlobalTimeContext,\n displayMode\n } = config;\n\n // Show global context if widget uses it in any way\n // - 'dashboard' mode: fully connected to global context\n if (displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n return true;\n }\n\n // For backwards compatibility: check legacy fields if displayMode is not set\n if (!displayMode) {\n const hasTimeContext = widgetInstanceGlobalTimeContext === true;\n const hasRefreshContext = widgetInstanceGlobalAutoRefreshContext === true;\n const timeExplicitlyFalse = widgetInstanceGlobalTimeContext === false;\n const refreshExplicitlyFalse = widgetInstanceGlobalAutoRefreshContext === false;\n\n // Hide when contexts are incompatible: one is true and the other is explicitly false\n const hasIncompatibleConfiguration =\n (hasTimeContext && refreshExplicitlyFalse) || (hasRefreshContext && timeExplicitlyFalse);\n\n if (hasIncompatibleConfiguration) {\n return false;\n }\n\n // Show if at least one context is explicitly true\n return hasTimeContext || hasRefreshContext;\n }\n\n return false;\n });\n }\n}\n","@if (globalContextState() !== null && isVisible()) {\n <c8y-context-controls\n [settings]=\"settings\"\n [context]=\"globalContextState()\"\n [isLoading]=\"globalContextService.isLoading()\"\n (refresh)=\"onRefresh()\"\n (contextChange)=\"onChanges($event)\"\n (contextClick)=\"gcs.toggle()\"\n ></c8y-context-controls>\n\n <c8y-configuration-collapse\n #gcs\n [context]=\"globalContextState()\"\n (contextChange)=\"onChanges($event)\"\n (refreshOptionChange)=\"onRefreshOptionChanges($event)\"\n (savePreferenceChange)=\"shouldSaveDashboardState = $event\"\n ></c8y-configuration-collapse>\n}\n","import { inject, Injectable, signal } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { ActionBarFactory, ActionBarItem, ContextRouteService } from '@c8y/ngx-components';\nimport { GlobalContextComponent } from '../../core/global-context.component';\nimport { GlobalContextQueryService } from './global-context-query.service';\n\n/**\n * Constants defining the supported route paths for global context integration.\n */\nexport const ROUTE_PATHS = {\n /** Home route path identifier */\n HOME: 'home',\n /** Dashboard route path identifier */\n DASHBOARD: 'dashboard',\n /** General route path identifier */\n GENERAL: 'general',\n /** Device info route path identifier */\n DEVICE: 'device-info'\n} as const;\n\n/**\n * Type definition for supported route path values.\n */\nexport type RoutePath = (typeof ROUTE_PATHS)[keyof typeof ROUTE_PATHS];\n\n/**\n * Interface defining the structure of a global context instance.\n * Contains both the ActionBar configuration and metadata about the current route context.\n */\nexport interface GlobalContextInstance {\n /** ActionBar item configuration for rendering the global context component */\n readonly actionBarItem: ActionBarItem;\n /** Source route path that created this instance */\n readonly source: RoutePath | null;\n /** Unique identifier for the source (e.g., dashboard ID) */\n readonly sourceId: string | null;\n}\n\n/**\n * Default global context instance configuration.\n */\nconst DEFAULT_INSTANCE: GlobalContextInstance = {\n actionBarItem: {\n component: GlobalContextComponent,\n placement: 'left'\n },\n source: null,\n sourceId: null\n} as const;\n\n/**\n * GlobalContextNavigationService manages the integration of global context functionality\n * with Angular's routing system and the Cumulocity ActionBar.\n *\n * This service implements the ActionBarFactory interface to provide context-aware\n * global context components in different route contexts (home, dashboard, general).\n * It handles route transitions, manages query parameter cleanup, and maintains\n * instance state across navigation.\n *\n * Key responsibilities:\n * - Determine when and where to show global context components\n * - Manage global context instances across different routes\n * - Handle query parameter cleanup during navigation\n * - Provide ActionBar integration for the global context component\n *\n * @example\n * ```typescript\n * // Service is automatically used by ActionBar system\n * // Get current instance\n * const instance = navigationService.getInstance();\n * console.log(instance.source); // 'home' | 'dashboard' | null\n *\n * // Manual instance management (rarely needed)\n * navigationService.setInstance({\n * actionBarItem: { component: GlobalContextComponent, placement: 'left' },\n * source: 'dashboard',\n * sourceId: 'my-dashboard-id'\n * });\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class GlobalContextNavigationService implements ActionBarFactory {\n /** Service for managing global context query parameters */\n private readonly globalContextQueryService = inject(GlobalContextQueryService);\n\n /** Service for accessing route context data */\n private readonly contextRoute = inject(ContextRouteService);\n\n /** Angular router for navigation state access */\n private readonly router = inject(Router);\n\n /** Signal storing the current global context instance configuration */\n private readonly instance = signal<GlobalContextInstance>({\n ...DEFAULT_INSTANCE,\n source: ROUTE_PATHS.HOME\n });\n\n /**\n * Determines the appropriate ActionBarItem based on the current route context.\n *\n * This is the main entry point called by the ActionBar system to determine\n * if and how the global context component should be displayed for a given route.\n *\n * Route handling logic:\n * - Home routes: Always show global context\n * - Dashboard routes: Show if valid dashboard ID exists\n * - Device routes: Show if valid device ID exists\n * - General routes: Hide global context\n * - Other routes: Show only if context data is available\n *\n * @param activeRoute - The currently active Angular route\n * @returns ActionBarItem configuration or null if global context should not be shown\n *\n * @example\n * ```typescript\n * // Called automatically by ActionBar system\n * const actionBarItem = navigationService.get(activatedRoute);\n * if (actionBarItem) {\n * // Global context will be shown in ActionBar\n * }\n * ```\n */\n get(activeRoute: ActivatedRoute): ActionBarItem | null {\n const contextData = this.contextRoute.getContextData(activeRoute);\n const currentPath = this.extractCurrentPath(activeRoute);\n\n // Handle home route - always show global context\n if (this.isHomePath(currentPath)) {\n return this.handleHome();\n }\n\n // Handle general route - never show global context\n if (this.isGeneralPath(currentPath)) {\n this.resetInstance();\n return null;\n }\n\n // Handle dashboard route - show if valid dashboard context\n if (this.isDashboardRoute(activeRoute)) {\n return this.handleDashboard(activeRoute);\n }\n\n if (this.isDevicePath(currentPath)) {\n return this.handleDevice(activeRoute);\n }\n\n // For other routes, check if we have context data\n if (!contextData) {\n return null;\n }\n\n // Check if we need to clean up from previous contexts\n const current = this.getInstance();\n\n // Clean up if we were on a dashboard and now we're not\n if (current.source === ROUTE_PATHS.DASHBOARD) {\n this.handleQueryParamCleanup(true);\n this.resetInstance();\n return null;\n }\n\n // Check if we're on a device sub-route (has device ID but not device-info)\n const deviceId = this.extractDeviceId(activeRoute);\n if (deviceId) {\n // We're on a device route, but not device-info\n // Check if we need to clean up from a previous device-info view\n if (current.source === ROUTE_PATHS.DEVICE) {\n this.handleQueryParamCleanup(true);\n this.resetInstance();\n }\n return null;\n }\n\n // Default: don't show global context for unknown routes\n return null;\n }\n\n /**\n * Retrieves the current global context instance configuration.\n *\n * The instance contains both the ActionBar configuration and metadata\n * about the current route context that created this instance.\n *\n * @returns Current GlobalContextInstance with ActionBar config and route metadata\n *\n * @example\n * ```typescript\n * const instance = navigationService.getInstance();\n * console.log(instance.source); // 'home', 'dashboard', or null\n * console.log(instance.sourceId); // dashboard ID if applicable\n *\n * // Use ActionBar configuration\n * const actionBarItem = instance.actionBarItem;\n * ```\n */\n getInstance(): GlobalContextInstance {\n return this.instance();\n }\n\n /**\n * Sets a new global context instance configuration.\n *\n * This method allows manual control over the global context instance,\n * though it's typically managed automatically by the route handlers.\n * Passing null will reset the instance to default configuration.\n *\n * @param instance - New instance configuration or null to reset to defaults\n *\n * @example\n * ```typescript\n * // Set custom instance\n * navigationService.setInstance({\n * actionBarItem: {\n * component: GlobalContextComponent,\n * placement: 'right'\n * },\n * source: 'dashboard',\n * sourceId: 'custom-dashboard'\n * });\n *\n * // Reset to defaults\n * navigationService.setInstance(null);\n * ```\n */\n setInstance(instance: GlobalContextInstance | null): void {\n if (instance === null) {\n this.resetInstance();\n } else {\n this.instance.set(instance);\n }\n }\n\n /**\n * Handles navigation to home routes.\n *\n * Home routes always display the global context component.\n * Updates the instance if the source has changed.\n *\n * @returns ActionBarItem configuration for home context\n */\n private handleHome(): ActionBarItem {\n const current = this.getInstance();\n\n // Only update instance if source has changed\n if (current.source !== ROUTE_PATHS.HOME) {\n const homeInstance: GlobalContextInstance = {\n actionBarItem: {\n component: GlobalContextComponent,\n placement: 'left'\n },\n source: ROUTE_PATHS.HOME,\n sourceId: null\n };\n\n this.instance.set(homeInstance);\n }\n\n return this.getInstance().actionBarItem;\n }\n\n /**\n * Handles navigation to dashboard routes.\n *\n * Dashboard routes display global context only if a valid dashboard ID exists.\n * Manages query parameter cleanup during dashboard transitions.\n *\n * @param activeRoute - The active route containing dashboard parameters\n * @returns ActionBarItem configuration for dashboard context or null if invalid\n */\n private handleDashboard(activeRoute: ActivatedRoute): ActionBarItem | null {\n const dashboardId = this.extractDashboardId(activeRoute);\n\n if (!dashboardId) {\n return null;\n }\n\n const current = this.getInstance();\n\n // Return existing instance if same dashboard\n if (current.source === ROUTE_PATHS.DASHBOARD && current.sourceId === dashboardId) {\n return current.actionBarItem;\n }\n\n // We're changing contexts if coming from a different dashboard\n const isChangingContext =\n current.source === ROUTE_PATHS.DASHBOARD && current.sourceId !== dashboardId;\n this.handleQueryParamCleanup(isChangingContext);\n\n // Create new dashboard instance\n const dashboardInstance: GlobalContextInstance = {\n actionBarItem: {\n component: GlobalContextComponent,\n placement: 'left'\n },\n source: ROUTE_PATHS.DASHBOARD,\n sourceId: dashboardId\n };\n\n this.instance.set(dashboardInstance);\n return this.getInstance().actionBarItem;\n }\n\n private handleDevice(activeRoute: ActivatedRoute): ActionBarItem | null {\n const deviceId = this.extractDeviceId(activeRoute);\n\n if (!deviceId) {\n return null;\n }\n\n const current = this.getInstance();\n\n // Return existing instance if same device\n if (current.source === ROUTE_PATHS.DEVICE && current.sourceId === deviceId) {\n return current.actionBarItem;\n }\n\n // We're changing contexts if coming from a different device\n const isChangingContext =\n current.source === ROUTE_PATHS.DEVICE && current.sourceId !== deviceId;\n this.handleQueryParamCleanup(isChangingContext);\n\n // Create new device instance\n const deviceInstance: GlobalContextInstance = {\n actionBarItem: {\n component: GlobalContextComponent,\n placement: 'left'\n },\n source: ROUTE_PATHS.DEVICE,\n sourceId: deviceId\n };\n\n this.instance.set(deviceInstance);\n return this.getInstance().actionBarItem;\n }\n\n /**\n * Extracts the current path from an activated route.\n *\n * @param activeRoute - The route to extract path from\n * @returns The first URL segment path or undefined\n */\n private extractCurrentPath(activeRoute: ActivatedRoute): string | undefined {\n return activeRoute?.snapshot?.url?.[0]?.path;\n }\n\n /**\n * Extracts dashboard ID from route parameters.\n *\n * @param activeRoute - The route containing dashboard parameters\n * @returns Dashboard ID or undefined if not present\n */\n private extractDashboardId(activeRoute: ActivatedRoute): string | undefined {\n const dashboardId = activeRoute?.snapshot?.params?.['dashboardId'];\n return dashboardId && typeof dashboardId === 'string' ? dashboardId : undefined;\n }\n\n /**\n * Extracts device ID from route parameters.\n *\n * @param activeRoute - The route containing device parameters\n * @returns Device ID or undefined if not present\n */\n private extractDeviceId(activeRoute: ActivatedRoute): string | undefined {\n let currentRoute: ActivatedRoute | null = activeRoute;\n while (currentRoute) {\n const deviceId = currentRoute.snapshot.params['id'];\n if (deviceId && typeof deviceId === 'string') {\n return deviceId;\n }\n currentRoute = currentRoute.parent;\n }\n return undefined;\n }\n\n /**\n * Checks if the current path is a home route.\n *\n * @param path - Path to check\n * @returns True if path is home route\n */\n private isHomePath(path: string | undefined): boolean {\n return path === ROUTE_PATHS.HOME;\n }\n\n /**\n * Checks if the current path is a dashboard route.\n * Handles both direct dashboard routes and nested dashboard routes (e.g., group dashboards)\n *\n * @param activeRoute - The active route to check\n * @returns True if this is a dashboard route\n */\n private isDashboardRoute(activeRoute: ActivatedRoute): boolean {\n try {\n // Check if any segment in the URL path is 'dashboard'\n const urlSegments = activeRoute?.snapshot?.url || [];\n const hasDashboardSegment = urlSegments.some(\n segment => segment.path === ROUTE_PATHS.DASHBOARD\n );\n\n // Also check if we have a dashboardId parameter (for nested routes)\n const hasDashboardId = !!activeRoute?.snapshot?.params?.['dashboardId'];\n\n return hasDashboardSegment || hasDashboardId;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Checks if the current path is a dashboard route.\n *\n * @param path - Path to check\n * @returns True if path is dashboard route\n */\n private isDashboardPath(path: string | undefined): boolean {\n return path === ROUTE_PATHS.DASHBOARD;\n }\n\n private isDevicePath(path: string | undefined): boolean {\n return path === ROUTE_PATHS.DEVICE;\n }\n\n /**\n * Checks if the current path is a general route.\n *\n * @param path - Path to check\n * @returns True if path is general route\n */\n private isGeneralPath(path: string | undefined): boolean {\n return path === ROUTE_PATHS.GENERAL;\n }\n\n /**\n * Handles query parameter cleanup during navigation.\n *\n * Cleans up global context query parameters when:\n * 1. Explicitly requested via navigation state\n * 2. Actually changing contexts (different dashboard/device)\n */\n private handleQueryParamCleanup(isChangingContext = false): void {\n const navigation = this.router.getCurrentNavigation();\n\n // Clear params when explicitly requested OR when changing contexts\n const shouldClearParams =\n navigation?.extras?.state?.clearParams === true || (navigation !== null && isChangingContext);\n\n if (shouldClearParams) {\n this.globalContextQueryService.checkAndRemoveDateContextParams();\n }\n }\n\n /**\n * Resets the instance to default configuration.\n */\n private resetInstance(): void {\n this.instance.set({ ...DEFAULT_INSTANCE });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n EventEmitter,\n inject,\n Input,\n OnInit,\n Output,\n signal\n} from '@angular/core';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { TranslateService } from '@ngx-translate/core';\n\nimport type { LinkControlConfig, LinkControlInfo } from './inline-context.models';\n\n/**\n * Component to display and manage link controls for global context items\n */\n@Component({\n selector: 'c8y-global-context-link-controls',\n standalone: true,\n imports: [IconDirective, TooltipModule, C8yTranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n styles: [\n `\n .btn-icon-dot[disabled] {\n cursor: not-allowed;\n opacity: 0.75;\n }\n\n .btn-icon-dot.link-auto-unlinked,\n .btn-icon-dot.link-auto-unlinked:focus {\n box-shadow: 0 0 0 2px var(--c8y-palette-status-danger);\n border-color: var(--c8y-palette-status-danger);\n }\n `\n ],\n template: `\n @if (showLinks()) {\n <button\n class=\"btn-icon-dot-set\"\n [class.active]=\"someControlsLinked()\"\n [attr.aria-label]=\"'Global context sync controls' | translate\"\n [tooltip]=\"masterTooltipTemplate\"\n delay=\"500\"\n container=\"body\"\n (click)=\"toggleAll()\"\n data-cy=\"global-context-link--all\"\n >\n <span class=\"btn-icon-dot__item default\" [class.active]=\"allControlsLinked()\">\n <i [c8yIcon]=\"someControlsLinked() ? 'link' : 'unlink'\"></i>\n </span>\n <!-- Individual Link icons -->\n @for (control of visibleControls(); track control.key) {\n <span\n [class]=\"control.cssClass + ' btn-icon-dot__item'\"\n [class.active]=\"control.isLinked\"\n [class.link-disabled]=\"control.disabled\"\n [class.link-auto-unlinked]=\"control.autoUnlinked\"\n [attr.data-cy]=\"'global-context-link--' + control.key\"\n >\n <i [c8yIcon]=\"control.icon\"></i>\n </span>\n }\n </button>\n <ng-template #masterTooltipTemplate>{{ masterTooltipText() | translate }}</ng-template>\n }\n `\n})\nexport class GlobalContextLinkControlsComponent implements OnInit {\n // Single output event - all controls toggle together (v2 pattern)\n @Output() allLinksToggled = new EventEmitter<boolean>();\n\n private translateService: TranslateService = inject(TranslateService);\n private _linkStates: { [key: string]: boolean } = {};\n private linkStatesSignal = signal<{ [key: string]: boolean }>({});\n private controlConfigsSignal = signal<Record<string, LinkControlConfig>>({});\n\n showLinks = computed<boolean>(() => {\n const linkStates = this.linkStatesSignal();\n return Object.keys(linkStates).length > 0;\n });\n\n visibleControls = computed<LinkControlInfo[]>(() => {\n const linkStates = this.linkStatesSignal();\n const controlConfigs = this.controlConfigsSignal();\n\n return Object.entries(linkStates)\n .filter(([key]) => controlConfigs[key])\n .map(([key, isLinked]) => ({\n key,\n isLinked,\n cssClass: (controlConfigs[key]?.cssClass || 'default').trim(),\n icon: controlConfigs[key]?.icon || '',\n disabled: !!controlConfigs[key]?.disabled,\n disabledTooltip: controlConfigs[key]?.disabledTooltip,\n autoUnlinked: !!controlConfigs[key]?.autoUnlinked\n }));\n });\n\n allControlsLinked = computed<boolean>(() => {\n const controls = this.visibleControls();\n return controls.length > 0 && controls.every(control => control.isLinked);\n });\n\n someControlsLinked = computed<boolean>(() => {\n const controls = this.visibleControls();\n return controls.length > 0 && controls.some(control => control.isLinked);\n });\n\n masterTooltipText = computed<string>(() => {\n const controls = this.visibleControls();\n const linkedControls = controls.filter(control => control.isLinked);\n const controlConfigs = this.controlConfigsSignal();\n const clickToToggleLabel = this.translateService.instant(gettext('(click to toggle)'));\n\n if (linkedControls.length === 0) {\n const usingWidgetCustomTimeSettingsLabel = this.translateService.instant(\n gettext('Using widget custom time settings')\n );\n return `${usingWidgetCustomTimeSettingsLabel}\\n${clickToToggleLabel}`;\n }\n\n const linkedNames = linkedControls.map(control => {\n const config = controlConfigs[control.key];\n return this.translateService.instant(config?.label);\n });\n\n const formatter = new Intl.ListFormat(\n this.translateService.getCurrentLang()?.replace('_', '-'),\n { type: 'conjunction' }\n );\n const linkedNamesList = formatter.format(linkedNames);\n const linkedToDashboardLabel = this.translateService.instant(gettext('Synced to dashboard:'));\n return `${linkedToDashboardLabel}\\n${linkedNamesList}\\n${clickToToggleLabel}`;\n });\n\n @Input()\n set linkStates(value: { [key: string]: boolean }) {\n this._linkStates = value || {};\n this.linkStatesSignal.set(this._linkStates);\n }\n get linkStates(): { [key: string]: boolean } {\n return this._linkStates;\n }\n\n @Input()\n set controlConfigs(value: Record<string, LinkControlConfig>) {\n this.controlConfigsSignal.set(value || {});\n }\n\n ngOnInit(): void {\n this.linkStatesSignal.set(this._linkStates);\n }\n\n toggleAll(): void {\n const newLinkState = !this.allControlsLinked();\n const updatedLinkStates = { ...this._linkStates };\n const config = this.controlConfigsSignal();\n\n // Update only controls that are part of the current configuration\n for (const key of Object.keys(config)) {\n if (key in updatedLinkStates && !config[key]?.disabled) {\n updatedLinkStates[key] = newLinkState;\n }\n }\n this._linkStates = updatedLinkStates;\n this.linkStatesSignal.set(this._linkStates);\n this.allLinksToggled.emit(newLinkState);\n }\n}\n","import { aggregationType } from '@c8y/client';\nimport {\n LINK_BTNS_CONFIG,\n type ControlConfigsMap,\n type LinkStatesMap,\n type LinkToggleEvent\n} from '../../models/control-flow.model';\nimport type {\n GlobalContextSettings,\n GlobalContextState,\n WidgetState,\n WidgetStateHandlerResult\n} from '../../models/global-context.model';\nimport type { LinkHelpersContext } from './inline-context.models';\n\nexport function handleLinkToggle(\n ctx: LinkHelpersContext,\n event: LinkToggleEvent,\n options?: { suppressEmit?: boolean; fromHandler?: boolean }\n): boolean {\n const sources = ctx.getFieldSources();\n if (!options?.fromHandler) {\n resetHandlerOverrides(ctx);\n }\n\n if (event.isLinked && event.key === 'aggregation' && sources.dateTimeContext === 'local') {\n const localDateTimeContext = ctx.getLocalState().dateTimeContext;\n const validation = ctx.orchestrator.validateAggregationLink({\n globalAggregation: ctx.getGlobalState().aggregation,\n localDateTimeContext,\n calculateValidAggregation: (_dateRange, target) => ({\n selectedAggregation: ctx.orchestrator.calculateAggregation(\n localDateTimeContext,\n target as aggregationType | null\n )\n })\n });\n\n if (!validation.canLink) {\n ctx.updateAggregationValue(validation.nextAggregation ?? null);\n return false;\n }\n }\n\n const outcome = ctx.orchestrator.toggleLink({\n key: event.key,\n isLinked: event.isLinked,\n fieldSources: sources\n });\n\n applyLocalStateToForm(ctx, outcome.snapshotKeys);\n\n if (outcome.recalcLocalAggregation) {\n ctx.recalcLocalAggregation();\n }\n\n if (outcome.recalcGlobalAggregation) {\n ctx.recalcGlobalAggregation();\n }\n\n if (!options?.suppressEmit) {\n ctx.emitBasedOnFieldSources();\n if (outcome.shouldEmitRefresh) {\n ctx.emitRefresh(null);\n }\n }\n\n if (outcome.clearLocalKeys.length) {\n outcome.clearLocalKeys.forEach(key => applyGlobalValueToForm(ctx, key));\n }\n\n syncWithEffectiveConfig(ctx, outcome.snapshotKeys);\n\n return outcome.shouldEmitRefresh;\n}\n\nexport function toggleAllLinks(\n ctx: LinkHelpersContext,\n args: {\n keys: Array<keyof LinkStatesMap>;\n isLinked: boolean;\n suppressRefresh: boolean;\n suppressEmit: boolean;\n }\n): void {\n resetHandlerOverrides(ctx);\n let supportedLinks: Array<keyof LinkStatesMap> = [...args.keys];\n\n if (!supportedLinks.length) {\n return;\n }\n\n const currentSources = ctx.getFieldSources();\n\n if (args.isLinked && supportedLinks.includes('aggregation')) {\n const dateTimeWillStayLocal =\n currentSources.dateTimeContext === 'local' && !supportedLinks.includes('dateTimeContext');\n\n if (dateTimeWillStayLocal) {\n const localDateTimeContext = ctx.getLocalState().dateTimeContext;\n const validation = ctx.orchestrator.validateAggregationLink({\n globalAggregation: ctx.getGlobalState().aggregation,\n localDateTimeContext,\n calculateValidAggregation: (_dateRange, target) => ({\n selectedAggregation: ctx.orchestrator.calculateAggregation(\n localDateTimeContext,\n target as aggregationType | null\n )\n })\n });\n\n if (!validation.canLink) {\n supportedLinks = supportedLinks.filter(link => link !== 'aggregation');\n ctx.updateAggregationValue(validation.nextAggregation ?? null);\n }\n }\n }\n\n if (!supportedLinks.length) {\n return;\n }\n\n const outcome = ctx.orchestrator.toggleAllLinks({\n keys: supportedLinks,\n isLinked: args.isLinked,\n fieldSources: currentSources\n });\n\n if (outcome.clearLocalKeys.length) {\n outcome.clearLocalKeys.forEach(key => applyGlobalValueToForm(ctx, key));\n }\n\n if (outcome.snapshotKeys.length) {\n applyLocalStateToForm(ctx, outcome.snapshotKeys);\n }\n\n if (outcome.recalcLocalAggregation) {\n ctx.recalcLocalAggregation();\n }\n\n if (outcome.recalcGlobalAggregation) {\n ctx.recalcGlobalAggregation();\n }\n\n // Only emit configuration updates if not suppressed\n if (!args.suppressEmit) {\n ctx.emitBasedOnFieldSources();\n }\n\n // Only emit refresh if not suppressed (when unlinking, data is already loaded)\n if (outcome.shouldEmitRefresh && !args.suppressRefresh) {\n ctx.emitRefresh(null);\n }\n\n syncWithEffectiveConfig(ctx, outcome.snapshotKeys);\n}\n\nexport function applyConfigOverride(\n ctx: LinkHelpersContext,\n config: Partial<GlobalContextState>\n): void {\n const fieldsToUpdate = [\n 'isAutoRefreshEnabled',\n 'refreshInterval',\n 'refreshOption',\n 'dateTimeContext',\n 'aggregation'\n ] as const;\n\n fieldsToUpdate.forEach(field => {\n if (config[field] !== undefined) {\n updateFormAndLocalState(ctx, field, config[field]);\n }\n });\n}\n\nexport function buildWidgetState(\n ctx: LinkHelpersContext,\n configOverride?: GlobalContextState | null\n): WidgetState {\n const config = configOverride ?? ctx.getEffectiveConfig();\n return {\n config,\n inlineControlSettings: ctx.inlineSettings(),\n dashboardControlSettings: ctx.dashboardControlSettings(),\n currentLinks: ctx.controlLinkStatus(),\n displayMode: config?.displayMode\n };\n}\n\nexport function applyHandlerResult(\n ctx: LinkHelpersContext,\n result: WidgetStateHandlerResult\n): boolean {\n let shouldEmitRefresh = false;\n\n if (result.inlineControlSettings) {\n ctx.setInlineOverrides(structuredClone(result.inlineControlSettings));\n }\n\n if (result.dashboardControlSettings) {\n ctx.setDashboardOverrides(structuredClone(result.dashboardControlSettings));\n }\n\n if (result.links) {\n shouldEmitRefresh = processLinkUpdates(ctx, result.links, { suppressEmit: true });\n }\n\n if (result.options) {\n processOptions(ctx, result.options);\n }\n\n return shouldEmitRefresh;\n}\n\nexport function processLinkUpdates(\n ctx: LinkHelpersContext,\n links: Partial<LinkStatesMap>,\n options?: { suppressEmit?: boolean }\n): boolean {\n let shouldEmitRefresh = false;\n\n Object.entries(links).forEach(([key, isLinked]) => {\n const linkKey = key as LinkToggleEvent['key'];\n const refreshRequested = handleLinkToggle(\n ctx,\n { key: linkKey, isLinked: !!isLinked },\n { suppressEmit: true, fromHandler: true }\n );\n\n shouldEmitRefresh = shouldEmitRefresh || refreshRequested;\n });\n\n if (!options?.suppressEmit) {\n ctx.emitBasedOnFieldSources();\n if (shouldEmitRefresh) {\n ctx.emitRefresh(null);\n }\n }\n\n return shouldEmitRefresh;\n}\n\nexport function processOptions(ctx: LinkHelpersContext, options: Record<string, unknown>): void {\n if (options.noAutoRefreshCounter !== undefined) {\n ctx.setShouldDisableCounter(!!options.noAutoRefreshCounter);\n }\n}\n\nexport function resetHandlerOverrides(ctx: LinkHelpersContext): void {\n if (Object.keys(ctx.inlineOverrides()).length) {\n ctx.setInlineOverrides({});\n }\n if (Object.keys(ctx.dashboardOverrides()).length) {\n ctx.setDashboardOverrides({});\n }\n}\n\nexport function buildControlLinkConfig(\n ctx: LinkHelpersContext,\n settings: Partial<GlobalContextSettings>,\n linkStates: LinkStatesMap | null\n): { controlConfig: ControlConfigsMap; filteredStates: LinkStatesMap } {\n const config: ControlConfigsMap = {};\n const filteredStates: LinkStatesMap = {};\n const disableReasons = ctx.orchestrator.getLinkDisableReasons();\n const aggregationReason = ctx.orchestrator.getAggregationUnlinkReason();\n const isAggregationAutoUnlinked =\n aggregationReason?.source === 'validation' && aggregationReason.canAutoRecover;\n\n const desiredKeys = new Set<keyof LinkStatesMap>();\n\n if (settings.showTimeContext) {\n desiredKeys.add('dateTimeContext');\n }\n if (settings.showAggregation) {\n desiredKeys.add('aggregation');\n }\n if (settings.showAutoRefresh) {\n desiredKeys.add('isAutoRefreshEnabled');\n }\n\n if (linkStates) {\n Object.keys(linkStates).forEach(key => {\n desiredKeys.add(key as keyof LinkStatesMap);\n });\n }\n\n const BASE_ORDER: Array<keyof LinkStatesMap> = [\n 'dateTimeContext',\n 'aggregation',\n 'isAutoRefreshEnabled'\n ];\n\n const orderedKeys = [\n ...BASE_ORDER.filter(key => desiredKeys.has(key)),\n ...Array.from(desiredKeys)\n .filter(key => !BASE_ORDER.includes(key))\n .sort()\n ];\n\n orderedKeys.forEach(key => {\n const baseConfig = LINK_BTNS_CONFIG[key];\n if (baseConfig) {\n const disableReason = disableReasons?.[key as keyof GlobalContextState];\n const baseCssClass = (baseConfig.cssClass ?? '').trim();\n const baseAutoUnlinked =\n key === 'aggregation'\n ? isAggregationAutoUnlinked\n : (baseConfig as { autoUnlinked?: boolean }).autoUnlinked;\n config[key] = {\n ...baseConfig,\n cssClass: baseCssClass || 'default',\n disabled: !!disableReason,\n disabledTooltip: disableReason ?? baseConfig.label,\n ...(baseAutoUnlinked !== undefined ? { autoUnlinked: baseAutoUnlinked } : {})\n };\n filteredStates[key] = linkStates?.[key] ?? false;\n }\n });\n\n return { controlConfig: config, filteredStates };\n}\n\nfunction updateFormAndLocalState<T extends keyof GlobalContextState>(\n ctx: LinkHelpersContext,\n field: T,\n value: GlobalContextState[T]\n): void {\n const control = ctx.form()?.get(field as string);\n if (control) {\n control.setValue(value, { emitEvent: false });\n }\n ctx.updateLocalState(state => ({ ...state, [field]: value }));\n}\n\nfunction applyGlobalValueToForm(ctx: LinkHelpersContext, key: keyof GlobalContextState): void {\n const control = ctx.form()?.get(key as string);\n if (!control) {\n return;\n }\n\n const globalState = ctx.getGlobalState();\n const configState = ctx.getInitialConfig();\n const globalStateValue = globalState[key];\n const configValue = configState ? configState[key] : undefined;\n let valueToApply = globalStateValue !== undefined ? globalStateValue : configValue;\n\n if (key === 'aggregation') {\n valueToApply = ctx.orchestrator.deriveAggregationValue(ctx.getEffectiveConfig());\n }\n\n control.setValue(valueToApply ?? null, { emitEvent: false });\n\n if (key === 'isAutoRefreshEnabled') {\n const refreshIntervalControl = ctx.form()?.get('refreshInterval');\n const refreshOptionControl = ctx.form()?.get('refreshOption');\n const refreshIntervalValue =\n ctx.getGlobalState().refreshInterval ?? ctx.getInitialConfig()?.refreshInterval ?? null;\n const refreshOptionValue =\n ctx.getGlobalState().refreshOption ?? ctx.getInitialConfig()?.refreshOption ?? null;\n\n refreshIntervalControl?.setValue(refreshIntervalValue, { emitEvent: false });\n refreshOptionControl?.setValue(refreshOptionValue, { emitEvent: false });\n }\n}\n\nfunction updateFormField(\n ctx: LinkHelpersContext,\n key: keyof GlobalContextState,\n value: GlobalContextState[keyof GlobalContextState] | null | undefined\n): void {\n const control = ctx.form()?.get(key as string);\n if (control) {\n const nextValue = value === undefined ? null : structuredClone(value);\n control.setValue(nextValue as unknown, { emitEvent: false });\n }\n}\n\nfunction syncWithEffectiveConfig(\n ctx: LinkHelpersContext,\n keys: Array<keyof GlobalContextState>\n): void {\n if (!keys.length) {\n return;\n }\n\n const latest = ctx.getEffectiveConfig();\n\n keys.forEach(key => {\n if (latest[key] === undefined) {\n return;\n }\n\n const value = structuredClone(latest[key]) as GlobalContextState[keyof GlobalContextState];\n ctx.updateLocalState(current => ({ ...current, [key]: value }));\n updateFormField(ctx, key, value);\n });\n}\n\nfunction applyLocalStateToForm(\n ctx: LinkHelpersContext,\n keys: Array<keyof GlobalContextState>\n): void {\n if (!keys.length) {\n return;\n }\n\n const localState = ctx.getLocalState();\n\n keys.forEach(key => {\n if (Object.prototype.hasOwnProperty.call(localState, key)) {\n const value = localState[key];\n updateFormField(ctx, key, value ?? null);\n }\n });\n}\n","import { GLOBAL_CONTEXT_DEFAULTS } from '../../../models/global-context-defaults';\nimport type { GlobalContextState } from '../../../models/global-context.model';\n\nexport const FIELD_SOURCE_LOCAL = 'local' as const;\nexport const FIELD_SOURCE_GLOBAL = 'global' as const;\nexport type FieldSource = typeof FIELD_SOURCE_LOCAL | typeof FIELD_SOURCE_GLOBAL;\n\nexport type FieldSourcesMap = Partial<Record<keyof GlobalContextState, FieldSource>>;\n\nexport interface EffectiveConfigContext {\n baseConfig: GlobalContextState | null | undefined;\n localState: Partial<GlobalContextState>;\n globalState: Partial<GlobalContextState>;\n fieldSources: FieldSourcesMap;\n}\n\nconst CORE_GLOBAL_CONTEXT_FIELDS: Array<keyof GlobalContextState> = [\n 'dateTimeContext',\n 'aggregation',\n 'isAutoRefreshEnabled',\n 'refreshInterval',\n 'refreshOption',\n 'source'\n];\n\nexport function composeEffectiveConfig(context: EffectiveConfigContext): GlobalContextState {\n const baseConfiguration: Partial<GlobalContextState> = structuredClone(context.baseConfig ?? {});\n const configuration: Partial<\n Record<keyof GlobalContextState, GlobalContextState[keyof GlobalContextState]>\n > = { ...baseConfiguration };\n\n CORE_GLOBAL_CONTEXT_FIELDS.forEach(key => {\n const resolvedValue = resolveConfigurationValue(\n key,\n context.fieldSources,\n context.localState,\n context.globalState,\n baseConfiguration\n );\n if (resolvedValue === undefined) {\n delete configuration[key];\n } else {\n configuration[key] = resolvedValue;\n }\n });\n\n Object.entries(context.globalState).forEach(([key, value]) => {\n const isStandardKey = CORE_GLOBAL_CONTEXT_FIELDS.includes(key as keyof GlobalContextState);\n if (!isStandardKey && value !== undefined) {\n (configuration as Record<string, unknown>)[key] = structuredClone(value);\n }\n });\n\n return configuration as GlobalContextState;\n}\n\nfunction resolveConfigurationValue<K extends keyof GlobalContextState>(\n key: K,\n sources: FieldSourcesMap,\n localStateValues: Partial<GlobalContextState>,\n globalStateValues: Partial<GlobalContextState>,\n baseConfiguration: Partial<GlobalContextState>\n): GlobalContextState[K] | undefined {\n const localValue = localStateValues[key];\n const globalValue = globalStateValues[key];\n const baseValue = baseConfiguration[key];\n\n if (sources[key] === FIELD_SOURCE_LOCAL && localValue !== undefined) {\n return safeCloneValue(localValue);\n }\n\n if (sources[key] === FIELD_SOURCE_GLOBAL && globalValue !== undefined) {\n return safeCloneValue(globalValue);\n }\n\n if (baseValue !== undefined) {\n return safeCloneValue(baseValue);\n }\n\n switch (key) {\n case 'isAutoRefreshEnabled':\n return GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED as GlobalContextState[K];\n case 'refreshOption':\n return GLOBAL_CONTEXT_DEFAULTS.REFRESH_OPTION as GlobalContextState[K];\n case 'refreshInterval':\n return GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL as GlobalContextState[K];\n case 'aggregation':\n return GLOBAL_CONTEXT_DEFAULTS.AGGREGATION as GlobalContextState[K];\n case 'displayMode':\n return GLOBAL_CONTEXT_DEFAULTS.DISPLAY_MODE as GlobalContextState[K];\n case 'dateTimeContext':\n return undefined;\n case 'source':\n return undefined;\n case 'eventSourceId':\n return undefined;\n case 'isGlobalContextReady':\n return undefined;\n default: {\n // Exhaustive check: ensures all keys are handled at compile time\n const _exhaustive: never = key;\n return undefined;\n }\n }\n}\n\nfunction safeCloneValue<T>(value: T): T {\n return typeof value === 'object' && value !== null ? structuredClone(value) : value;\n}\n","import { aggregationType } from '@c8y/client';\nimport type { DateTimeContext } from '../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../models/global-context.model';\nimport type { TimeInterval } from '../../models/interval-picker.model';\nimport { TIME_INTERVAL } from '../../models/interval-picker.model';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\nimport type { RefreshHelpersContext } from './inline-context.models';\nimport { FIELD_SOURCE_GLOBAL, FIELD_SOURCE_LOCAL } from './orchestrator/config-composer.util';\nimport type { RefreshResult } from './orchestrator/global-context-inline-orchestrator.service';\nimport type { AggregationChangeInstruction } from './orchestrator/shared-mode-orchestrator.types';\n\nexport function recalculateAggregationForLocalDateTime(ctx: RefreshHelpersContext): void {\n const localDateTimeContext = ctx.getLocalState().dateTimeContext;\n const currentAggregation = ctx.form()?.get('aggregation')?.value as aggregationType | null;\n\n if (!localDateTimeContext) {\n return;\n }\n\n const adjustment = ctx.orchestrator.adjustAggregationForDateTime({\n dateTimeContext: localDateTimeContext,\n aggregation: currentAggregation\n });\n\n if (adjustment.changed) {\n updateAggregationValue(ctx, adjustment.nextAggregation);\n }\n}\n\nexport function recalculateAggregationForGlobalDateTime(ctx: RefreshHelpersContext): void {\n const globalDateTimeContext =\n ctx.getGlobalState().dateTimeContext ?? ctx.getInitialConfig()?.dateTimeContext;\n const currentAggregation = ctx.form()?.get('aggregation')?.value as aggregationType | null;\n\n if (!globalDateTimeContext) {\n return;\n }\n\n const adjustment = ctx.orchestrator.adjustAggregationForDateTime({\n dateTimeContext: globalDateTimeContext,\n aggregation: currentAggregation\n });\n\n if (adjustment.changed) {\n updateAggregationValue(ctx, adjustment.nextAggregation);\n }\n}\n\nexport function handleGlobalRefresh(\n ctx: RefreshHelpersContext,\n globalDateTimeContext: DateTimeContext\n): void {\n const sources = ctx.getFieldSources();\n\n ctx.updateGlobalState(current => ({\n ...current,\n dateTimeContext: structuredClone(globalDateTimeContext)\n }));\n\n // If auto-refresh is unlinked (manual mode), don't auto-emit on global refresh\n // Linked fields like dateTime will still sync via syncLocalEntriesWithGlobal()\n if (sources.isAutoRefreshEnabled === FIELD_SOURCE_LOCAL) {\n return;\n }\n\n processRefreshEvent(ctx, { globalDateTimeContext });\n}\n\nexport function processRefreshEvent(\n ctx: RefreshHelpersContext,\n params: { globalDateTimeContext?: DateTimeContext | null }\n): RefreshResult {\n const outcome = ctx.orchestrator.processRefresh({\n globalDateTimeContext: params.globalDateTimeContext,\n generateFreshDateTime: interval => generateFreshDateTimeContext(interval)\n });\n\n applyRefreshOutcome(ctx, outcome);\n\n return outcome;\n}\n\nexport function applyRefreshOutcome(ctx: RefreshHelpersContext, outcome: RefreshResult): void {\n if (outcome.updatedLocalDateTime) {\n const next = structuredClone(outcome.updatedLocalDateTime);\n updateLocalDateTimeContext(ctx, next);\n updateFormDateTimeContext(ctx, next);\n } else if (outcome.refreshPayload) {\n const baseContext = ctx.getEffectiveConfig().dateTimeContext ?? {\n dateFrom: undefined,\n dateTo: undefined,\n interval: TIME_INTERVAL.CUSTOM\n };\n const next = structuredClone(baseContext);\n Object.assign(next, outcome.refreshPayload);\n updateFormDateTimeContext(ctx, next);\n }\n\n ctx.emitBasedOnFieldSources();\n\n if (outcome.shouldEmitRefresh) {\n ctx.emitRefresh(outcome.refreshPayload ?? null);\n }\n}\n\nexport function getShouldDisableIntervalConfig(\n ctx: RefreshHelpersContext\n): Record<string, boolean> {\n const sources = ctx.getFieldSources();\n return sources.dateTimeContext === FIELD_SOURCE_GLOBAL ? { custom: true } : {};\n}\n\nexport function deriveDisabledAggregations(\n ctx: RefreshHelpersContext\n): Partial<Record<aggregationType, boolean>> {\n const configuration = ctx.getEffectiveConfig();\n const dateTimeContext = configuration?.dateTimeContext;\n\n if (!dateTimeContext) {\n return {};\n }\n\n return calculateDisabledAggregationsFromContext(ctx, dateTimeContext);\n}\n\nexport function calculateDisabledAggregationsFromContext(\n ctx: RefreshHelpersContext,\n dateTimeContext: DateTimeContext\n): Partial<Record<aggregationType, boolean>> {\n if (hasValidDateRange(dateTimeContext)) {\n return calculateFromDateRange(ctx, dateTimeContext);\n }\n\n if (hasValidInterval(dateTimeContext)) {\n return calculateFromInterval(ctx, dateTimeContext.interval!);\n }\n\n return {};\n}\n\nfunction calculateFromDateRange(\n ctx: RefreshHelpersContext,\n dateTimeContext: DateTimeContext\n): Partial<Record<aggregationType, boolean>> {\n try {\n const dateRange = createDateRange(dateTimeContext);\n return ctx.aggregationValidationService.getDisabledAggregations(dateRange);\n } catch (error) {\n return {};\n }\n}\n\nfunction calculateFromInterval(\n ctx: RefreshHelpersContext,\n interval: TimeInterval | string\n): Partial<Record<aggregationType, boolean>> {\n const range = DateTimeContextUtil.dateRangeFromInterval(interval as TimeInterval);\n if (!range) {\n return {};\n }\n\n try {\n return ctx.aggregationValidationService.getDisabledAggregations(range);\n } catch (error) {\n return {};\n }\n}\n\nfunction hasValidInterval(dateTimeContext: DateTimeContext): boolean {\n return !!dateTimeContext.interval && dateTimeContext.interval !== TIME_INTERVAL.CUSTOM;\n}\n\nfunction createDateRange(dateTimeContext: DateTimeContext): [Date, Date] {\n return [new Date(dateTimeContext.dateFrom), new Date(dateTimeContext.dateTo)];\n}\n\nfunction hasValidDateRange(dateTimeContext: DateTimeContext | null): boolean {\n return !!dateTimeContext?.dateFrom && !!dateTimeContext?.dateTo;\n}\n\nexport function generateFreshDateTimeContext(interval: TimeInterval): DateTimeContext {\n const range = DateTimeContextUtil.dateRangeFromInterval(interval);\n if (!range) {\n const now = new Date();\n return DateTimeContextUtil.ensureIsoContext({ interval, dateFrom: now, dateTo: now });\n }\n return DateTimeContextUtil.ensureIsoContext({ interval, dateFrom: range[0], dateTo: range[1] });\n}\n\nexport function patchFormValues(\n ctx: RefreshHelpersContext,\n formUpdates: Partial<GlobalContextState>\n): void {\n const form = ctx.form();\n if (!form || !Object.keys(formUpdates).length) {\n return;\n }\n\n form.patchValue(formUpdates, { emitEvent: false });\n}\n\nexport function updateAggregationValue(\n ctx: RefreshHelpersContext,\n aggregation: aggregationType | null\n): void {\n ctx.form()?.get('aggregation')?.setValue(aggregation, { emitEvent: false });\n ctx.updateLocalState(current => ({\n ...current,\n aggregation\n }));\n}\n\nexport function applyLocalAggregationChange(\n ctx: RefreshHelpersContext,\n change: AggregationChangeInstruction\n): void {\n updateAggregationValue(ctx, change.nextAggregation ?? null);\n}\n\nfunction updateLocalDateTimeContext(ctx: RefreshHelpersContext, newContext: DateTimeContext): void {\n ctx.updateLocalState(current => ({ ...current, dateTimeContext: newContext }));\n}\n\nfunction updateFormDateTimeContext(ctx: RefreshHelpersContext, newContext: DateTimeContext): void {\n ctx.form()?.get('dateTimeContext')?.setValue(newContext, { emitEvent: false });\n}\n","import type { aggregationType } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type { AggregationChangeInstruction } from './shared-mode-orchestrator.types';\nimport type { AggregationValidationResult } from './validation.util';\n\nexport const AGGREGATION_SYNC_FAILED = gettext('Cannot sync aggregation with dashboard');\n\nexport interface AggregationAdjustmentFn {\n (params: {\n dateTimeContext: DateTimeContext | null | undefined;\n aggregation: aggregationType | null | undefined;\n }): { nextAggregation: aggregationType | null; changed: boolean };\n}\n\nexport interface ResolveAggregationChangeForFormParams {\n formValue: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n globalAggregation: aggregationType | null | undefined;\n currentAggregation: aggregationType | null | undefined;\n adjustAggregationForDateTime: AggregationAdjustmentFn;\n updateFieldSources: (updater: (current: FieldSourcesMap) => FieldSourcesMap) => void;\n}\n\nexport function resolveAggregationChangeForForm(\n params: ResolveAggregationChangeForFormParams\n): AggregationChangeInstruction | null {\n const { formValue, sources } = params;\n const dateTimeContext = formValue.dateTimeContext;\n\n if (!dateTimeContext) {\n return null;\n }\n\n if (\n sources.dateTimeContext === FIELD_SOURCE_LOCAL &&\n sources.aggregation === FIELD_SOURCE_GLOBAL\n ) {\n if (params.globalAggregation === undefined) {\n return null;\n }\n\n const adjustment = params.adjustAggregationForDateTime({\n dateTimeContext,\n aggregation: params.globalAggregation ?? null\n });\n\n if (!adjustment.changed) {\n return null;\n }\n\n params.updateFieldSources(current => ({\n ...current,\n aggregation: FIELD_SOURCE_LOCAL\n }));\n\n return {\n nextAggregation: adjustment.nextAggregation,\n alertMessage: AGGREGATION_SYNC_FAILED\n };\n }\n\n const adjustment = params.adjustAggregationForDateTime({\n dateTimeContext,\n aggregation: params.currentAggregation ?? null\n });\n\n if (!adjustment.changed) {\n return null;\n }\n\n return {\n nextAggregation: adjustment.nextAggregation\n };\n}\n\nexport interface ResolveAutoUnlinkParams {\n globalAggregation: aggregationType | null | undefined;\n localDateTimeContext: DateTimeContext | null | undefined;\n adjustAggregationForDateTime: AggregationAdjustmentFn;\n updateFieldSources: (updater: (current: FieldSourcesMap) => FieldSourcesMap) => void;\n}\n\nexport function resolveAutoUnlinkAggregationChange(\n params: ResolveAutoUnlinkParams\n): AggregationChangeInstruction | null {\n if (params.globalAggregation === undefined) {\n return null;\n }\n\n const context = params.localDateTimeContext;\n\n if (!context?.dateFrom || !context?.dateTo) {\n params.updateFieldSources(current => ({\n ...current,\n aggregation: FIELD_SOURCE_LOCAL\n }));\n\n return {\n nextAggregation: null,\n alertMessage: AGGREGATION_SYNC_FAILED\n };\n }\n\n const adjustment = params.adjustAggregationForDateTime({\n dateTimeContext: context,\n aggregation: params.globalAggregation ?? null\n });\n\n if (!adjustment.changed) {\n return null;\n }\n\n params.updateFieldSources(current => ({\n ...current,\n aggregation: FIELD_SOURCE_LOCAL\n }));\n\n return {\n nextAggregation: adjustment.nextAggregation,\n alertMessage: AGGREGATION_SYNC_FAILED\n };\n}\n\nexport interface ApplyAggregationForGlobalStateParams {\n incomingState: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n formUpdates: Partial<GlobalContextState>;\n adjustAggregationForDateTime: AggregationAdjustmentFn;\n localAggregationSnapshot: aggregationType | null;\n globalAggregationSnapshot: aggregationType | null;\n applyLocalAggregationChange: (change: AggregationChangeInstruction) => void;\n}\n\nexport function applyAggregationChangesForGlobalState(\n params: ApplyAggregationForGlobalStateParams\n): boolean {\n const { incomingState, sources, formUpdates } = params;\n const dateTimeContext = formUpdates.dateTimeContext ?? incomingState.dateTimeContext;\n\n if (!dateTimeContext) {\n return false;\n }\n\n const aggregationTarget =\n sources.aggregation === FIELD_SOURCE_LOCAL\n ? params.localAggregationSnapshot\n : (incomingState.aggregation ?? params.globalAggregationSnapshot);\n\n const adjustment = params.adjustAggregationForDateTime({\n dateTimeContext,\n aggregation: aggregationTarget ?? null\n });\n\n if (!adjustment.changed) {\n return false;\n }\n\n if (sources.aggregation === FIELD_SOURCE_LOCAL) {\n params.applyLocalAggregationChange({ nextAggregation: adjustment.nextAggregation });\n } else {\n formUpdates.aggregation = adjustment.nextAggregation;\n }\n\n return true;\n}\n\nexport interface AggregationValidationDeps {\n sources?: FieldSourcesMap;\n localDateTimeContext: DateTimeContext | null | undefined;\n globalAggregation: aggregationType | null | undefined;\n validateAggregationLink: (context: {\n globalAggregation: aggregationType | null | undefined;\n localDateTimeContext?: DateTimeContext | null;\n calculateValidAggregation: (\n range: [Date, Date],\n target: aggregationType | null\n ) => { selectedAggregation: aggregationType | null };\n }) => AggregationValidationResult;\n calculateAggregation: (\n dateTimeContext: DateTimeContext | null | undefined,\n target: aggregationType | null | undefined\n ) => aggregationType | null;\n}\n\nexport interface AggregationValidationOutcome {\n isValid: boolean;\n message?: string;\n}\n\nexport function evaluateAggregationValidation(\n deps: AggregationValidationDeps\n): AggregationValidationOutcome | null {\n const sources = deps.sources;\n\n if (!sources || sources.aggregation !== FIELD_SOURCE_LOCAL) {\n return null;\n }\n\n if (sources.dateTimeContext !== FIELD_SOURCE_LOCAL) {\n return { isValid: true };\n }\n\n const linkResult = deps.validateAggregationLink({\n globalAggregation: deps.globalAggregation,\n localDateTimeContext: deps.localDateTimeContext,\n calculateValidAggregation: (_range, target) => ({\n selectedAggregation: deps.calculateAggregation(\n deps.localDateTimeContext,\n (target ?? null) as aggregationType | null\n )\n })\n });\n\n if (linkResult.canLink) {\n return { isValid: true };\n }\n\n return {\n isValid: false,\n message: AGGREGATION_SYNC_FAILED\n };\n}\n","import { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type {\n AggregationChangeInstruction,\n ExecuteHandlerContext,\n HandleFormChangeContext,\n HandleGlobalStateChangeContext\n} from './shared-mode-orchestrator.types';\n\nexport interface FormChangeDependencies {\n resolveAggregationChangeForForm: (params: {\n formValue: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n }) => AggregationChangeInstruction | null;\n setAggregationValidationState: (isValid: boolean, message?: string | null) => void;\n computeEffectiveConfig: () => GlobalContextState;\n updateAggregationDisableReason: () => void;\n}\n\nfunction assignClonedValue<K extends keyof GlobalContextState>(\n target: Partial<GlobalContextState>,\n key: K,\n value: GlobalContextState[K]\n): void {\n target[key] = structuredClone(value);\n}\n\nexport function handleFormChange(\n context: HandleFormChangeContext,\n deps: FormChangeDependencies\n): void {\n const {\n formValue,\n getFieldSources,\n applyFormChangesToLocalState,\n shouldValidateAggregation,\n applyLocalAggregationChange,\n applyRefreshOptionChange,\n previousRefresh,\n updateGlobalStateFromForm,\n emitUpdate,\n emitRefresh\n } = context;\n\n applyFormChangesToLocalState(formValue);\n\n const sources = getFieldSources();\n let didChange = false;\n\n if (shouldValidateAggregation(formValue)) {\n const aggregationChange = deps.resolveAggregationChangeForForm({\n formValue,\n sources\n });\n\n if (aggregationChange) {\n applyLocalAggregationChange(aggregationChange);\n deps.setAggregationValidationState(\n !aggregationChange.alertMessage,\n aggregationChange.alertMessage\n );\n didChange = true;\n }\n }\n\n const nextRefresh = formValue.refreshOption ?? previousRefresh;\n applyRefreshOptionChange(previousRefresh, nextRefresh);\n\n const updatedSources = getFieldSources();\n updateGlobalStateFromForm(formValue, updatedSources);\n\n emitUpdate(deps.computeEffectiveConfig());\n\n if (didChange) {\n emitRefresh(null);\n }\n\n deps.updateAggregationDisableReason();\n}\n\nexport interface GlobalStateChangeDependencies {\n resolveAutoUnlinkAggregationChange: (\n aggregation: GlobalContextState['aggregation']\n ) => AggregationChangeInstruction | null;\n setAggregationValidationState: (isValid: boolean, message?: string | null) => void;\n updateFieldSources: (updater: (current: FieldSourcesMap) => FieldSourcesMap) => void;\n applyAggregationChangesForGlobalState: (params: {\n incomingState: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n formUpdates: Partial<GlobalContextState>;\n applyLocalAggregationChange: (change: AggregationChangeInstruction) => void;\n }) => boolean;\n updateLocalState: (\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ) => void;\n computeEffectiveConfig: () => GlobalContextState;\n updateAggregationDisableReason: () => void;\n}\n\nexport function handleGlobalStateChange(\n context: HandleGlobalStateChangeContext,\n deps: GlobalStateChangeDependencies\n): void {\n const {\n state,\n getFieldSources,\n previousRefresh,\n processGlobalStateChange,\n shouldValidateAggregationForUnlinkedDateTime,\n applyLocalAggregationChange,\n applyRefreshOptionChange,\n patchForm,\n emitUpdate,\n emitRefresh\n } = context;\n\n const sources = getFieldSources();\n const formUpdates = processGlobalStateChange(state, sources);\n let didAnyChange = false;\n let shouldReevaluateDisableReason = true;\n\n if (shouldValidateAggregationForUnlinkedDateTime(state, sources)) {\n const change = deps.resolveAutoUnlinkAggregationChange(state.aggregation);\n if (change) {\n delete (formUpdates as Record<string, unknown>).aggregation;\n deps.updateFieldSources(current => ({\n ...current,\n aggregation: FIELD_SOURCE_LOCAL\n }));\n deps.setAggregationValidationState(false);\n applyLocalAggregationChange(change);\n didAnyChange = true;\n shouldReevaluateDisableReason = false;\n }\n } else if (\n deps.applyAggregationChangesForGlobalState({\n incomingState: state,\n sources,\n formUpdates,\n applyLocalAggregationChange\n })\n ) {\n didAnyChange = true;\n }\n\n const nextRefresh = state.refreshOption ?? previousRefresh;\n const refreshChanged = nextRefresh !== previousRefresh;\n applyRefreshOptionChange(previousRefresh, nextRefresh);\n\n // When switching to Live mode with CUSTOM interval, always update form with normalized dateTimeContext\n if (\n refreshChanged &&\n nextRefresh === REFRESH_OPTION.LIVE &&\n state.dateTimeContext?.interval === TIME_INTERVAL.CUSTOM\n ) {\n formUpdates.dateTimeContext = state.dateTimeContext;\n }\n\n if (refreshChanged && getFieldSources().isAutoRefreshEnabled === FIELD_SOURCE_LOCAL) {\n delete formUpdates.isAutoRefreshEnabled;\n delete formUpdates.refreshInterval;\n delete formUpdates.refreshOption;\n }\n\n if (refreshChanged) {\n didAnyChange = true;\n }\n\n if (Object.keys(formUpdates).length) {\n deps.updateLocalState(current => {\n const updated = { ...current };\n (Object.keys(formUpdates) as Array<keyof GlobalContextState>).forEach(key => {\n const value = formUpdates[key];\n if (sources[key] === FIELD_SOURCE_GLOBAL && value !== undefined) {\n assignClonedValue(updated, key, value);\n }\n });\n return updated;\n });\n patchForm(formUpdates);\n didAnyChange = true;\n }\n\n emitUpdate(deps.computeEffectiveConfig());\n\n if (didAnyChange) {\n emitRefresh(null);\n }\n\n if (shouldReevaluateDisableReason) {\n deps.updateAggregationDisableReason();\n }\n}\n\nexport interface ExecuteHandlerDependencies {\n computeEffectiveConfig: () => GlobalContextState;\n}\n\nexport function executeHandler(\n context: ExecuteHandlerContext,\n deps: ExecuteHandlerDependencies\n): void {\n const {\n handler,\n configOverride,\n previousRefresh,\n applyRefreshOptionChange,\n buildWidgetState,\n applyHandlerResult,\n applyConfigOverride,\n emitBasedOnFieldSources,\n requestRefresh\n } = context;\n\n if (!handler) {\n return;\n }\n\n if (configOverride?.refreshOption !== undefined) {\n applyRefreshOptionChange(previousRefresh, configOverride.refreshOption);\n }\n\n const result = handler(buildWidgetState(configOverride));\n let shouldEmitRefresh = false;\n\n if (result) {\n shouldEmitRefresh = applyHandlerResult(result);\n }\n\n if (configOverride) {\n applyConfigOverride(configOverride);\n }\n\n emitBasedOnFieldSources(deps.computeEffectiveConfig());\n if (shouldEmitRefresh) {\n requestRefresh();\n }\n}\n","import type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport type { TimeInterval } from '../../../models/interval-picker.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type { RefreshResult } from './shared-mode-orchestrator.types';\n\nexport interface RefreshContext {\n effectiveConfig: GlobalContextState;\n fieldSources: FieldSourcesMap;\n globalDateTimeContext?: DateTimeContext | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n}\n\nexport interface RefreshDependencies {\n supportsAutoRefresh: (config: GlobalContextState) => boolean;\n}\n\nexport function calculateRefreshOutcome(\n context: RefreshContext,\n deps: RefreshDependencies\n): RefreshResult {\n const { fieldSources, effectiveConfig } = context;\n\n if (fieldSources.isAutoRefreshEnabled === FIELD_SOURCE_LOCAL) {\n return handleLocalAutoRefresh(context, deps);\n }\n\n if (fieldSources.dateTimeContext === FIELD_SOURCE_GLOBAL) {\n return {\n refreshPayload: context.globalDateTimeContext ?? null,\n shouldEmitRefresh: true\n };\n }\n\n if (!deps.supportsAutoRefresh(effectiveConfig)) {\n return {\n refreshPayload: null,\n shouldEmitRefresh: true\n };\n }\n\n const interval = resolveRefreshInterval(fieldSources, effectiveConfig.dateTimeContext?.interval);\n const freshContext = buildFreshContext(context, interval);\n\n return {\n refreshPayload: null,\n updatedLocalDateTime: freshContext,\n shouldEmitRefresh: true\n };\n}\n\nexport function handleLocalAutoRefresh(\n context: RefreshContext,\n deps: RefreshDependencies\n): RefreshResult {\n const { fieldSources, effectiveConfig } = context;\n const result: RefreshResult = { refreshPayload: null, shouldEmitRefresh: true };\n\n if (fieldSources.dateTimeContext === FIELD_SOURCE_GLOBAL) {\n const resolvedContext =\n context.globalDateTimeContext ?? effectiveConfig.dateTimeContext ?? null;\n\n if (resolvedContext) {\n result.refreshPayload = structuredClone(resolvedContext);\n return result;\n }\n\n if (!deps.supportsAutoRefresh(effectiveConfig)) {\n return result;\n }\n\n const interval = resolveRefreshInterval(\n fieldSources,\n effectiveConfig.dateTimeContext?.interval\n );\n result.refreshPayload = buildFreshContext(context, interval);\n return result;\n }\n\n if (!deps.supportsAutoRefresh(effectiveConfig)) {\n return result;\n }\n\n const interval = resolveRefreshInterval(fieldSources, effectiveConfig.dateTimeContext?.interval);\n result.updatedLocalDateTime = buildFreshContext(context, interval);\n return result;\n}\n\nexport function resolveRefreshInterval(\n fieldSources: FieldSourcesMap,\n configInterval: TimeInterval | undefined\n): TimeInterval {\n if (fieldSources.dateTimeContext === FIELD_SOURCE_LOCAL && configInterval) {\n return configInterval;\n }\n\n return configInterval ?? TIME_INTERVAL.CUSTOM;\n}\n\nexport function buildFreshContext(\n context: RefreshContext,\n interval: TimeInterval\n): DateTimeContext {\n if (interval === TIME_INTERVAL.CUSTOM) {\n const source = context.effectiveConfig.dateTimeContext;\n\n if (source?.dateFrom) {\n return DateTimeContextUtil.normalizeForLive(source);\n }\n\n const generated = context.generateFreshDateTime(TIME_INTERVAL.CUSTOM);\n if (generated) {\n return generated;\n }\n\n return {\n interval: TIME_INTERVAL.CUSTOM,\n dateFrom: null,\n dateTo: null\n } satisfies DateTimeContext;\n }\n\n return context.generateFreshDateTime(interval);\n}\n","import type { WritableSignal } from '@angular/core';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport type { LinkStatesMap } from '../../../models/control-flow.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n type GlobalContextDisplayMode,\n type GlobalContextState,\n WIDGET_DISPLAY_MODE,\n type WidgetControls,\n type WidgetDisplayMode\n} from '../../../models/global-context.model';\nimport type { WidgetControlService } from '../../../services/domain/widget-control.service';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport { createDefaultGlobalContextState } from '../../../utils/global-context-defaults.util';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../../models/global-context-defaults';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type { VisibilityContext } from './shared-mode-orchestrator.types';\n\nexport function mapToContextDisplayMode(displayMode: WidgetDisplayMode): GlobalContextDisplayMode {\n switch (displayMode) {\n case WIDGET_DISPLAY_MODE.CONFIG:\n return GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n case WIDGET_DISPLAY_MODE.INLINE:\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n default:\n return GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n}\n\nexport function resolveWidgetDisplayMode(\n initialConfig: GlobalContextState | null,\n globalState: Partial<GlobalContextState>\n): WidgetDisplayMode {\n const raw = initialConfig?.displayMode ?? globalState.displayMode;\n if (raw === GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG) return WIDGET_DISPLAY_MODE.CONFIG;\n if (raw === GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG) return WIDGET_DISPLAY_MODE.INLINE;\n return WIDGET_DISPLAY_MODE.INLINE;\n}\n\nexport function resolveVisibilityContextInternal(\n config: GlobalContextState,\n widgetControlsSignal: WritableSignal<WidgetControls | null>,\n fieldSourcesSignal: WritableSignal<FieldSourcesMap>,\n globalStateSignal: WritableSignal<Partial<GlobalContextState>>,\n widgetControlService: WidgetControlService,\n getDefaultRefreshOption: () => RefreshOption\n): VisibilityContext | null {\n const controls = widgetControlsSignal();\n if (!controls || !config.displayMode) return null;\n const refreshOption =\n (config.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n ? globalStateSignal().refreshOption\n : config.refreshOption) ?? getDefaultRefreshOption();\n const baseVisibility = widgetControlService.resolveInlineControlSettings(\n controls,\n config.displayMode,\n refreshOption\n ) ?? {\n settings: {},\n links: {},\n dashboardControls: {}\n };\n if (config.displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) return baseVisibility;\n let settings = baseVisibility.settings || {};\n let links = { ...(baseVisibility.links || {}) } as LinkStatesMap;\n let dashboard = baseVisibility.dashboardControls || {};\n const sources = fieldSourcesSignal() || {};\n (Object.keys(links) as Array<keyof LinkStatesMap>).forEach(key => {\n const desired =\n (sources as FieldSourcesMap)[key as keyof GlobalContextState] === FIELD_SOURCE_GLOBAL;\n if (!!links[key] === desired) return;\n const toggled = widgetControlService.toggleControlLink(key as string, settings, links);\n settings = toggled.settings;\n links = toggled.links as LinkStatesMap;\n dashboard = toggled.dashboardControls;\n });\n return { settings, links, dashboardControls: dashboard };\n}\n\nexport function syncSourcesForRefreshOption(\n displayMode: WidgetDisplayMode,\n refreshOption: RefreshOption,\n controls: WidgetControls | null,\n fieldSourcesSignal: WritableSignal<FieldSourcesMap>,\n getDefaultRefreshOption: () => RefreshOption,\n setFieldSources: (sources: FieldSourcesMap) => void\n): void {\n const sources = { ...fieldSourcesSignal() };\n if (!sources) return;\n sources.refreshOption = sources.refreshOption ?? FIELD_SOURCE_LOCAL;\n if (controls?.supports?.includes('isAutoRefreshEnabled')) {\n sources.isAutoRefreshEnabled = sources.isAutoRefreshEnabled ?? FIELD_SOURCE_LOCAL;\n sources.refreshInterval = sources.refreshInterval ?? FIELD_SOURCE_LOCAL;\n }\n if (displayMode === WIDGET_DISPLAY_MODE.CONFIG) {\n sources.refreshOption = FIELD_SOURCE_LOCAL;\n sources.isAutoRefreshEnabled = FIELD_SOURCE_LOCAL;\n sources.refreshInterval = FIELD_SOURCE_LOCAL;\n }\n if (refreshOption !== getDefaultRefreshOption())\n sources.isAutoRefreshEnabled = FIELD_SOURCE_LOCAL;\n setFieldSources(sources);\n}\n\nexport function sanitizeLocalState(\n state: Partial<GlobalContextState> | null | undefined,\n configSignal: WritableSignal<GlobalContextState>,\n ensureDateTimeContext: (\n context: GlobalContextState['dateTimeContext'] | null | undefined\n ) => DateTimeContext\n): Partial<GlobalContextState> {\n const snapshot = { ...state };\n if (snapshot.dateTimeContext === null) delete snapshot.dateTimeContext;\n else if (snapshot.dateTimeContext !== undefined)\n snapshot.dateTimeContext = ensureDateTimeContext(snapshot.dateTimeContext);\n // Always enforce the fixed 5s refresh interval\n if (snapshot.refreshInterval !== undefined) {\n snapshot.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n }\n return snapshot;\n}\n\nexport function sanitizeGlobalState(\n state: Partial<GlobalContextState> | null | undefined,\n configSignal: WritableSignal<GlobalContextState>,\n normalizeRefreshOption: (option: RefreshOption | undefined) => RefreshOption,\n getDefaultRefreshOption: () => RefreshOption,\n ensureDateTimeContext: (\n context: GlobalContextState['dateTimeContext'] | null | undefined\n ) => DateTimeContext\n): Partial<GlobalContextState> {\n const snapshot = { ...state };\n if (snapshot.dateTimeContext !== undefined)\n snapshot.dateTimeContext = ensureDateTimeContext(snapshot.dateTimeContext);\n snapshot.refreshOption = normalizeRefreshOption(\n snapshot.refreshOption ?? getDefaultRefreshOption()\n );\n // Always enforce the fixed 5s refresh interval\n if (snapshot.refreshInterval !== undefined) {\n snapshot.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n }\n return snapshot;\n}\n\nexport function ensureDateTimeContext(\n context: GlobalContextState['dateTimeContext'] | null | undefined,\n configSignal: WritableSignal<GlobalContextState>\n): DateTimeContext {\n const defaults =\n configSignal().dateTimeContext ?? createDefaultGlobalContextState().dateTimeContext;\n const iso = DateTimeContextUtil.ensureIsoContext(context ?? defaults);\n return {\n interval: iso.interval ?? defaults.interval,\n dateFrom: iso.dateFrom ?? defaults.dateFrom,\n dateTo: iso.dateTo ?? defaults.dateTo\n };\n}\n\nexport function syncLocalEntriesWithGlobal(\n fieldSourcesSignal: WritableSignal<FieldSourcesMap>,\n globalStateSignal: WritableSignal<Partial<GlobalContextState>>,\n localStateSignal: WritableSignal<Partial<GlobalContextState>>\n): void {\n const sources = fieldSourcesSignal();\n const globalState = globalStateSignal();\n if (!sources || !globalState) return;\n localStateSignal.update(current => {\n const working: Partial<GlobalContextState> = { ...current };\n (Object.keys(globalState) as Array<keyof GlobalContextState>).forEach(key => {\n if (sources[key] === FIELD_SOURCE_GLOBAL) {\n const value = globalState[key];\n if (value === undefined) {\n delete working[key];\n } else {\n (working as any)[key] = structuredClone(value);\n }\n }\n });\n return working;\n });\n}\n","import type { LinkStatesMap } from '../../../models/control-flow.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './config-composer.util';\nimport type { LinkToggleOutcome } from './shared-mode-orchestrator.types';\n\nexport interface LinkToggleArgs {\n key: keyof LinkStatesMap;\n isLinked: boolean;\n fieldSources: FieldSourcesMap;\n}\n\nexport interface ToggleAllArgs {\n keys: Array<keyof LinkStatesMap>;\n isLinked: boolean;\n fieldSources: FieldSourcesMap;\n}\n\nexport function computeLinkToggle(args: LinkToggleArgs): LinkToggleOutcome {\n const { key, isLinked, fieldSources } = args;\n const updatedFieldSources: FieldSourcesMap = { ...fieldSources };\n const snapshotKeys = new Set<keyof GlobalContextState>();\n const clearLocalKeys = new Set<keyof GlobalContextState>();\n const targetSource = isLinked ? FIELD_SOURCE_GLOBAL : FIELD_SOURCE_LOCAL;\n\n updatedFieldSources[key as keyof GlobalContextState] = targetSource;\n\n if (isLinked) {\n clearLocalKeys.add(key as keyof GlobalContextState);\n } else {\n snapshotKeys.add(key as keyof GlobalContextState);\n }\n\n if (key === 'dateTimeContext') {\n updatedFieldSources.refreshOption = targetSource;\n if (isLinked) {\n clearLocalKeys.add('refreshOption');\n } else {\n snapshotKeys.add('refreshOption');\n }\n }\n\n let recalcLocalAggregation = false;\n let recalcGlobalAggregation = false;\n\n if (!isLinked && key === 'aggregation' && fieldSources.dateTimeContext === FIELD_SOURCE_LOCAL) {\n recalcLocalAggregation = true;\n }\n\n if (isLinked && key === 'dateTimeContext' && fieldSources.aggregation === FIELD_SOURCE_LOCAL) {\n recalcGlobalAggregation = true;\n }\n\n let shouldEmitRefresh = false;\n\n if (key === 'isAutoRefreshEnabled') {\n updatedFieldSources.refreshInterval = targetSource;\n updatedFieldSources.refreshOption = targetSource;\n shouldEmitRefresh = !isLinked;\n\n if (isLinked) {\n clearLocalKeys.add('refreshInterval');\n clearLocalKeys.add('refreshOption');\n } else {\n snapshotKeys.add('refreshInterval');\n snapshotKeys.add('refreshOption');\n }\n }\n\n return {\n fieldSources: updatedFieldSources,\n snapshotKeys: Array.from(snapshotKeys),\n shouldEmitRefresh,\n recalcLocalAggregation,\n recalcGlobalAggregation,\n clearLocalKeys: Array.from(clearLocalKeys)\n };\n}\n\nexport function computeToggleAll(args: ToggleAllArgs): LinkToggleOutcome {\n const { keys, isLinked, fieldSources } = args;\n const updatedFieldSources: FieldSourcesMap = { ...fieldSources };\n const snapshotKeys = new Set<keyof GlobalContextState>();\n const clearLocalKeys = new Set<keyof GlobalContextState>();\n\n let shouldEmitRefresh = false;\n let recalcLocalAggregation = false;\n let recalcGlobalAggregation = false;\n\n keys.forEach(key => {\n const targetSource = isLinked ? FIELD_SOURCE_GLOBAL : FIELD_SOURCE_LOCAL;\n updatedFieldSources[key as keyof GlobalContextState] = targetSource;\n\n if (isLinked) {\n clearLocalKeys.add(key as keyof GlobalContextState);\n } else {\n snapshotKeys.add(key as keyof GlobalContextState);\n }\n\n if (key === 'dateTimeContext') {\n updatedFieldSources.refreshOption = targetSource;\n if (isLinked) {\n clearLocalKeys.add('refreshOption');\n } else {\n snapshotKeys.add('refreshOption');\n }\n }\n\n if (!isLinked && key === 'aggregation' && fieldSources.dateTimeContext === FIELD_SOURCE_LOCAL) {\n recalcLocalAggregation = true;\n }\n\n if (isLinked && key === 'dateTimeContext' && fieldSources.aggregation === FIELD_SOURCE_LOCAL) {\n recalcGlobalAggregation = true;\n }\n\n if (key === 'isAutoRefreshEnabled') {\n updatedFieldSources.refreshInterval = targetSource;\n updatedFieldSources.refreshOption = targetSource;\n shouldEmitRefresh = !isLinked;\n\n if (isLinked) {\n clearLocalKeys.add('refreshInterval');\n clearLocalKeys.add('refreshOption');\n } else {\n snapshotKeys.add('refreshInterval');\n snapshotKeys.add('refreshOption');\n }\n }\n });\n\n return {\n fieldSources: updatedFieldSources,\n snapshotKeys: Array.from(snapshotKeys),\n shouldEmitRefresh,\n recalcLocalAggregation,\n recalcGlobalAggregation,\n clearLocalKeys: Array.from(clearLocalKeys)\n };\n}\n","import { aggregationType } from '@c8y/client';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\n\nexport interface AggregationValidationContext {\n globalAggregation: aggregationType | null | undefined;\n localDateTimeContext?: DateTimeContext | null;\n calculateValidAggregation: (\n dateRange: [Date, Date],\n target: aggregationType | null\n ) => {\n selectedAggregation: aggregationType | null;\n };\n}\n\nexport interface AggregationValidationResult {\n canLink: boolean;\n nextAggregation: aggregationType | null;\n message?: string;\n}\n\nexport function validateAggregationLink(\n context: AggregationValidationContext\n): AggregationValidationResult {\n const { globalAggregation, localDateTimeContext } = context;\n\n if (globalAggregation === undefined) {\n return { canLink: true, nextAggregation: null };\n }\n\n if (!localDateTimeContext?.dateFrom || !localDateTimeContext?.dateTo) {\n return { canLink: true, nextAggregation: globalAggregation };\n }\n\n try {\n const dateRange: [Date, Date] = [\n new Date(localDateTimeContext.dateFrom),\n new Date(localDateTimeContext.dateTo)\n ];\n\n const result = context.calculateValidAggregation(dateRange, globalAggregation);\n\n if (result.selectedAggregation !== globalAggregation) {\n return {\n canLink: false,\n nextAggregation: result.selectedAggregation,\n message: 'Cannot sync aggregation with dashboard date range'\n };\n }\n\n return { canLink: true, nextAggregation: globalAggregation };\n } catch (error) {\n return { canLink: false, nextAggregation: null };\n }\n}\n\nexport function deriveAggregationValue(config: GlobalContextState): aggregationType | null {\n return config.dateTimeContext && config.dateTimeContext.interval === 'none'\n ? null\n : (config.aggregation ?? null);\n}\n","import { Injectable, WritableSignal, signal } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { Subject } from 'rxjs';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport type { LinkStatesMap } from '../../../models/control-flow.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type {\n GlobalContextEvent,\n GlobalContextState,\n WidgetControls,\n WidgetDisplayMode\n} from '../../../models/global-context.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n WIDGET_DISPLAY_MODE\n} from '../../../models/global-context.model';\nimport type { TimeInterval } from '../../../models/interval-picker.model';\nimport { AggregationPickerService } from '../../../services/domain/aggregation-picker.service';\nimport { WidgetControlService } from '../../../services/domain/widget-control.service';\nimport { GlobalContextService } from '../../../services/state/global-context.service';\nimport { createDefaultGlobalContextState } from '../../../utils/global-context-defaults.util';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../../models/global-context-defaults';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n composeEffectiveConfig,\n type FieldSourcesMap\n} from './config-composer.util';\nimport {\n AGGREGATION_SYNC_FAILED,\n applyAggregationChangesForGlobalState as applyAggregationChangesForGlobalStateHelper,\n evaluateAggregationValidation,\n resolveAggregationChangeForForm as resolveAggregationChangeForFormHelper,\n resolveAutoUnlinkAggregationChange as resolveAutoUnlinkAggregationChangeHelper\n} from './shared-mode-aggregation.helper';\nimport {\n executeHandler as executeHandlerHelper,\n handleFormChange as handleFormChangeHelper,\n handleGlobalStateChange as handleGlobalStateChangeHelper\n} from './shared-mode-context.helper';\nimport type {\n AggregationChangeInstruction,\n AggregationUnlinkReason,\n ExecuteHandlerContext,\n HandleFormChangeContext,\n HandleGlobalStateChangeContext,\n LinkToggleOutcome,\n ModeServices,\n RefreshResult,\n VisibilityContext\n} from './shared-mode-orchestrator.types';\nimport { calculateRefreshOutcome } from './shared-mode-refresh.helper';\nimport {\n ensureDateTimeContext as ensureDateTimeContextHelper,\n mapToContextDisplayMode as mapToContextDisplayModeHelper,\n resolveVisibilityContextInternal as resolveVisibilityContextInternalHelper,\n resolveWidgetDisplayMode as resolveWidgetDisplayModeHelper,\n sanitizeGlobalState as sanitizeGlobalStateHelper,\n sanitizeLocalState as sanitizeLocalStateHelper,\n syncLocalEntriesWithGlobal as syncLocalEntriesWithGlobalHelper,\n syncSourcesForRefreshOption as syncSourcesForRefreshOptionHelper\n} from './shared-mode-state.helper';\nimport { computeLinkToggle, computeToggleAll } from './shared-mode-toggle.helper';\nimport {\n deriveAggregationValue as deriveAggregationValueUtil,\n validateAggregationLink as validateAggregationLinkUtil,\n type AggregationValidationContext,\n type AggregationValidationResult\n} from './validation.util';\n\n@Injectable()\nexport class SharedModeOrchestrator {\n private readonly widgetControlService: WidgetControlService;\n private readonly aggregationPickerService: AggregationPickerService;\n private readonly globalContextService: GlobalContextService;\n private readonly mode: RefreshOption;\n private configSignal: WritableSignal<GlobalContextState> = signal(\n createDefaultGlobalContextState()\n );\n private widgetControlsSignal: WritableSignal<WidgetControls | null> = signal(null);\n private displayModeSignal: WritableSignal<WidgetDisplayMode> = signal(WIDGET_DISPLAY_MODE.INLINE);\n private loadingSignal: WritableSignal<boolean> = signal(false);\n private fieldSourcesSignal: WritableSignal<FieldSourcesMap> = signal({});\n private localStateSignal: WritableSignal<Partial<GlobalContextState>> = signal({});\n private globalStateSignal: WritableSignal<Partial<GlobalContextState>> = signal({});\n private linkDisableReasonsSignal: WritableSignal<\n Partial<Record<keyof GlobalContextState, string>>\n > = signal({});\n private aggregationUnlinkReason: AggregationUnlinkReason | null = null;\n private latestVisibility: VisibilityContext | null = null;\n readonly globalContextChange$ = new Subject<GlobalContextEvent>();\n readonly refresh$ = new Subject<void>();\n constructor(mode: RefreshOption, services: ModeServices) {\n this.mode = mode;\n this.widgetControlService = services.widgetControlService;\n this.aggregationPickerService = services.aggregationPickerService;\n this.globalContextService = services.globalContextService;\n }\n initConfig(config: GlobalContextState | null | undefined): void {\n const cloned = structuredClone(config ?? createDefaultGlobalContextState());\n // Always enforce the fixed 5s refresh interval\n cloned.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n this.configSignal.set(cloned);\n }\n initWidgetControls(controls: WidgetControls | null | undefined): void {\n this.widgetControlsSignal.set(controls ?? null);\n }\n setDisplayMode(mode: WidgetDisplayMode | null | undefined): void {\n this.displayModeSignal.set(mode ?? WIDGET_DISPLAY_MODE.INLINE);\n }\n getDisplayMode(): WidgetDisplayMode {\n return this.displayModeSignal();\n }\n setLoading(isLoading: boolean): void {\n this.loadingSignal.set(!!isLoading);\n }\n getFieldSources(): FieldSourcesMap {\n return this.fieldSourcesSignal();\n }\n setFieldSources(value: FieldSourcesMap): void {\n this.fieldSourcesSignal.set(value ?? {});\n this.syncLocalEntriesWithGlobal();\n }\n updateFieldSources(updater: (sources: FieldSourcesMap) => FieldSourcesMap): void {\n this.fieldSourcesSignal.update(current => updater({ ...current }) ?? {});\n this.syncLocalEntriesWithGlobal();\n }\n getLocalState(): Partial<GlobalContextState> {\n return this.localStateSignal();\n }\n setLocalState(state: Partial<GlobalContextState>): void {\n const sanitized = sanitizeLocalStateHelper(state, this.configSignal, ctx =>\n this.ensureDateTimeContext(ctx)\n );\n this.localStateSignal.set(sanitized);\n }\n updateLocalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n this.localStateSignal.update(current =>\n sanitizeLocalStateHelper(updater({ ...current }) ?? {}, this.configSignal, ctx =>\n this.ensureDateTimeContext(ctx)\n )\n );\n }\n getGlobalState(): Partial<GlobalContextState> {\n return this.globalStateSignal();\n }\n setGlobalState(state: Partial<GlobalContextState>): void {\n this.globalStateSignal.set(\n sanitizeGlobalStateHelper(\n state,\n this.configSignal,\n opt => this.normalizeRefreshOption(opt),\n () => this.getDefaultRefreshOption(),\n ctx => this.ensureDateTimeContext(ctx)\n )\n );\n this.syncLocalEntriesWithGlobal();\n }\n updateGlobalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n this.globalStateSignal.update(current =>\n sanitizeGlobalStateHelper(\n updater({ ...current }) ?? {},\n this.configSignal,\n opt => this.normalizeRefreshOption(opt),\n () => this.getDefaultRefreshOption(),\n ctx => this.ensureDateTimeContext(ctx)\n )\n );\n this.syncLocalEntriesWithGlobal();\n }\n initializeStateAndSources(params: {\n initialConfig: GlobalContextState | null;\n globalState: Partial<GlobalContextState>;\n isDashboard: boolean;\n widgetControls?: WidgetControls | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n forcedRefreshOption?: RefreshOption;\n }): void {\n const {\n initialConfig,\n globalState,\n isDashboard,\n widgetControls,\n generateFreshDateTime,\n forcedRefreshOption\n } = params;\n const normalizedGlobalState = structuredClone(globalState ?? {});\n if (forcedRefreshOption) normalizedGlobalState.refreshOption = forcedRefreshOption;\n this.initConfig(initialConfig);\n this.setGlobalState(normalizedGlobalState);\n this.initWidgetControls(widgetControls);\n const widgetDisplayMode = resolveWidgetDisplayModeHelper(initialConfig, normalizedGlobalState);\n const controls = widgetControls ?? this.widgetControlsSignal();\n\n const localState: Partial<GlobalContextState> = initialConfig ? { ...initialConfig } : {};\n const fieldSources: FieldSourcesMap = {};\n const globalSnapshot: Partial<GlobalContextState> = structuredClone(\n normalizedGlobalState ?? {}\n );\n\n // Simple rule: Dashboard mode → ALL sources global, Non-dashboard → ALL sources local\n const defaultSource = isDashboard ? FIELD_SOURCE_GLOBAL : FIELD_SOURCE_LOCAL;\n\n (Object.keys(localState) as Array<keyof GlobalContextState>).forEach(key => {\n fieldSources[key] = defaultSource;\n });\n\n // Ensure all supported controls have field sources\n if (controls?.supports) {\n controls.supports.forEach(field => {\n if (!fieldSources[field]) {\n fieldSources[field] = defaultSource;\n }\n });\n }\n\n // Source is ALWAYS global (tracks event origin)\n fieldSources.source = FIELD_SOURCE_GLOBAL;\n\n this.applyInitialModeAdjustments({\n isDashboard,\n localState,\n fieldSources,\n generateFreshDateTime\n });\n this.setFieldSources(fieldSources);\n this.setLocalState(localState);\n this.setGlobalState(globalSnapshot);\n this.setDisplayMode(widgetDisplayMode);\n this.linkDisableReasonsSignal.set({});\n this.updateAggregationDisableReason();\n }\n getConfigSnapshot(): GlobalContextState {\n return this.configSignal();\n }\n computeEffectiveConfig(baseConfig: GlobalContextState | null | undefined): GlobalContextState {\n const localState = this.localStateSignal();\n const globalState = this.globalStateSignal();\n const fieldSources = this.fieldSourcesSignal();\n\n // Normalize baseConfig to enforce fixed 5s refresh interval\n const normalizedBaseConfig = baseConfig\n ? {\n ...baseConfig,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL\n }\n : baseConfig;\n\n const composed = composeEffectiveConfig({\n baseConfig: normalizedBaseConfig,\n localState,\n globalState,\n fieldSources\n });\n\n const displayMode =\n baseConfig?.displayMode ??\n this.globalStateSignal().displayMode ??\n mapToContextDisplayModeHelper(this.displayModeSignal());\n const configWithMode = { ...composed, displayMode };\n this.latestVisibility = resolveVisibilityContextInternalHelper(\n configWithMode,\n this.widgetControlsSignal,\n this.fieldSourcesSignal,\n this.globalStateSignal,\n this.widgetControlService,\n () => this.getDefaultRefreshOption()\n );\n return configWithMode;\n }\n getLatestVisibility(): VisibilityContext | null {\n return this.latestVisibility;\n }\n resolveVisibilityContext(\n config: GlobalContextState | null | undefined\n ): VisibilityContext | null {\n return config\n ? resolveVisibilityContextInternalHelper(\n config,\n this.widgetControlsSignal,\n this.fieldSourcesSignal,\n this.globalStateSignal,\n this.widgetControlService,\n () => this.getDefaultRefreshOption()\n )\n : null;\n }\n handleFormChange(context: HandleFormChangeContext): void {\n handleFormChangeHelper(context, {\n resolveAggregationChangeForForm: params => this.resolveAggregationChangeForForm(params),\n setAggregationValidationState: (isValid, message) =>\n this.setAggregationValidationState(isValid, message),\n computeEffectiveConfig: () => this.computeEffectiveConfig(this.configSignal()),\n updateAggregationDisableReason: () => this.updateAggregationDisableReason()\n });\n }\n handleGlobalStateChange(context: HandleGlobalStateChangeContext): void {\n handleGlobalStateChangeHelper(context, {\n resolveAutoUnlinkAggregationChange: aggregation =>\n this.resolveAutoUnlinkAggregationChange(aggregation),\n setAggregationValidationState: (isValid, message) =>\n this.setAggregationValidationState(isValid, message),\n updateFieldSources: updater => this.updateFieldSources(updater),\n applyAggregationChangesForGlobalState: params =>\n this.applyAggregationChangesForGlobalState(params),\n updateLocalState: updater => this.updateLocalState(updater),\n computeEffectiveConfig: () => this.computeEffectiveConfig(this.configSignal()),\n updateAggregationDisableReason: () => this.updateAggregationDisableReason()\n });\n }\n toggleLink(args: {\n key: keyof LinkStatesMap;\n isLinked: boolean;\n fieldSources?: FieldSourcesMap;\n }): LinkToggleOutcome {\n const prevGlobal = this.getGlobalState();\n const prevLocal = this.getLocalState();\n const prevEffective = this.computeEffectiveConfig(this.configSignal());\n if (args.key === 'aggregation') this.handleAggregationManualToggle(args.isLinked);\n const outcome = computeLinkToggle({\n key: args.key,\n isLinked: args.isLinked,\n fieldSources: args.fieldSources ?? this.getFieldSources()\n });\n this.setFieldSources(outcome.fieldSources);\n if (args.key === 'dateTimeContext' && !args.isLinked)\n this.promoteEffectiveDateTimeToLocal(prevEffective);\n this.syncLocalStateForLinkOutcome({\n outcome,\n previousGlobalState: prevGlobal,\n previousLocalState: prevLocal,\n previousEffectiveConfig: prevEffective\n });\n this.updateAggregationDisableReason();\n return outcome;\n }\n toggleAllLinks(args: {\n keys: Array<keyof LinkStatesMap>;\n isLinked: boolean;\n fieldSources?: FieldSourcesMap;\n }): LinkToggleOutcome {\n const prevGlobal = this.getGlobalState();\n const prevLocal = this.getLocalState();\n const prevEffective = this.computeEffectiveConfig(this.configSignal());\n if (args.keys.includes('aggregation')) this.handleAggregationManualToggle(args.isLinked);\n const outcome = computeToggleAll({\n keys: args.keys,\n isLinked: args.isLinked,\n fieldSources: args.fieldSources ?? this.getFieldSources()\n });\n this.setFieldSources(outcome.fieldSources);\n if (!args.isLinked && args.keys.includes('dateTimeContext'))\n this.promoteEffectiveDateTimeToLocal(prevEffective);\n this.syncLocalStateForLinkOutcome({\n outcome,\n previousGlobalState: prevGlobal,\n previousLocalState: prevLocal,\n previousEffectiveConfig: prevEffective\n });\n this.updateAggregationDisableReason();\n return outcome;\n }\n executeHandler(context: ExecuteHandlerContext): void {\n executeHandlerHelper(context, {\n computeEffectiveConfig: () => this.computeEffectiveConfig(this.configSignal())\n });\n }\n processRefresh(params: {\n globalDateTimeContext?: DateTimeContext | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n }): RefreshResult {\n const result = calculateRefreshOutcome(\n {\n effectiveConfig: this.computeEffectiveConfig(this.configSignal()),\n fieldSources: this.fieldSourcesSignal(),\n globalDateTimeContext: params.globalDateTimeContext,\n generateFreshDateTime: params.generateFreshDateTime\n },\n { supportsAutoRefresh: config => this.supportsAutoRefresh(config) }\n );\n if (result.updatedLocalDateTime)\n this.updateLocalState(current => ({\n ...current,\n dateTimeContext: structuredClone(result.updatedLocalDateTime)\n }));\n if (result.refreshPayload) {\n const merged = {\n ...(this.globalStateSignal().dateTimeContext ?? {}),\n ...result.refreshPayload\n } as DateTimeContext;\n this.updateGlobalState(state => ({ ...state, dateTimeContext: structuredClone(merged) }));\n }\n return result;\n }\n applyRefreshOptionChange(params: {\n previousRefresh?: RefreshOption;\n nextRefresh?: RefreshOption;\n }): { refreshOption?: RefreshOption; forceDisableAutoRefresh?: boolean } {\n const { previousRefresh, nextRefresh } = params;\n if (!nextRefresh || nextRefresh === previousRefresh) return {};\n const resolved = this.normalizeRefreshOption(nextRefresh);\n this.syncSourcesForRefreshOption(\n this.displayModeSignal(),\n resolved,\n this.widgetControlsSignal()\n );\n const sources = this.fieldSourcesSignal();\n if (sources.refreshOption === FIELD_SOURCE_LOCAL) {\n this.updateLocalState(current =>\n current.refreshOption === resolved ? current : { ...current, refreshOption: resolved }\n );\n } else {\n this.updateLocalState(current => {\n if (current.refreshOption === undefined) return current;\n const { refreshOption: _drop, ...rest } = current;\n return rest;\n });\n }\n if (sources.isAutoRefreshEnabled === FIELD_SOURCE_GLOBAL) {\n this.updateLocalState(current => {\n if (current.isAutoRefreshEnabled === undefined) return current;\n const { isAutoRefreshEnabled: _drop, ...rest } = current;\n return rest;\n });\n }\n this.applyModeSpecificRefreshOptionChange(resolved, sources);\n this.updateAggregationDisableReason();\n return {\n refreshOption: resolved,\n forceDisableAutoRefresh: this.shouldForceDisableAutoRefresh(resolved)\n };\n }\n updateGlobalStateFromForm(\n formValue: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): void {\n const nextSources = structuredClone(sources ?? {});\n this.setFieldSources(nextSources);\n const next: Partial<GlobalContextState> = structuredClone(this.getGlobalState() ?? {});\n (Object.keys(formValue) as Array<keyof GlobalContextState>).forEach(key => {\n if (nextSources[key] !== FIELD_SOURCE_GLOBAL) return;\n const value = formValue[key];\n if (value !== undefined) {\n (next as any)[key] = structuredClone(value);\n }\n });\n this.setGlobalState(next);\n }\n processGlobalStateChange(\n state: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): Partial<GlobalContextState> {\n const normalizedState = structuredClone(state ?? {});\n const nextGlobalState: Partial<GlobalContextState> = structuredClone(\n this.getGlobalState() ?? {}\n );\n const formUpdates: Partial<GlobalContextState> = {};\n (Object.keys(normalizedState) as Array<keyof GlobalContextState>).forEach(key => {\n const value = normalizedState[key];\n if (value === undefined) return;\n (nextGlobalState as any)[key] = structuredClone(value);\n if (sources[key] === FIELD_SOURCE_GLOBAL) {\n (formUpdates as any)[key] = structuredClone(value);\n }\n });\n this.setGlobalState(nextGlobalState);\n return formUpdates;\n }\n validateAggregationLink(context: AggregationValidationContext): AggregationValidationResult {\n return validateAggregationLinkUtil(context);\n }\n deriveAggregationValue(config: GlobalContextState | null | undefined): aggregationType | null {\n return config ? deriveAggregationValueUtil(config) : null;\n }\n calculateAggregation(\n dateTimeContext: DateTimeContext | null | undefined,\n currentAggregation: aggregationType | null | undefined\n ): aggregationType | null {\n if (!dateTimeContext?.dateFrom || !dateTimeContext?.dateTo) return currentAggregation ?? null;\n try {\n const range: [Date, Date] = [\n new Date(dateTimeContext.dateFrom),\n new Date(dateTimeContext.dateTo)\n ];\n const result = this.aggregationPickerService.calculateAggregation(\n range,\n currentAggregation ?? null\n );\n return result.selectedAggregation ?? null;\n } catch (_error) {\n return currentAggregation ?? null;\n }\n }\n adjustAggregationForDateTime(params: {\n dateTimeContext?: DateTimeContext | null;\n aggregation?: aggregationType | null;\n }): { nextAggregation: aggregationType | null; changed: boolean } {\n const nextAggregation = this.calculateAggregation(\n params.dateTimeContext ?? null,\n params.aggregation ?? null\n );\n return {\n nextAggregation,\n changed: params.aggregation !== undefined && nextAggregation !== params.aggregation\n };\n }\n resolveAggregationChangeForForm(params: {\n formValue: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n }): AggregationChangeInstruction | null {\n const globalAggregation =\n this.globalStateSignal().aggregation ?? this.configSignal().aggregation ?? null;\n const currentAggregation =\n this.localStateSignal().aggregation ??\n params.formValue.aggregation ??\n this.configSignal().aggregation ??\n null;\n return resolveAggregationChangeForFormHelper({\n formValue: params.formValue,\n sources: params.sources,\n globalAggregation,\n currentAggregation,\n adjustAggregationForDateTime: args => this.adjustAggregationForDateTime(args),\n updateFieldSources: updater => this.updateFieldSources(updater)\n });\n }\n shouldValidateAggregationForUnlinkedDateTime(\n state: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): boolean {\n return (\n sources.dateTimeContext === FIELD_SOURCE_LOCAL &&\n sources.aggregation === FIELD_SOURCE_LOCAL &&\n state.dateTimeContext !== undefined\n );\n }\n getLinkDisableReasons(): Partial<Record<keyof GlobalContextState, string>> {\n return this.linkDisableReasonsSignal();\n }\n getAggregationUnlinkReason(): AggregationUnlinkReason | null {\n return this.aggregationUnlinkReason;\n }\n emitConfiguration(\n componentId: string,\n configuration: GlobalContextState | null | undefined\n ): GlobalContextState {\n const resolvedConfig = configuration ?? this.computeEffectiveConfig(this.configSignal());\n\n if (resolvedConfig.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n this.globalContextService.register(\n componentId,\n this.latestVisibility?.dashboardControls ?? {}\n );\n } else {\n this.globalContextService.unregister(componentId);\n }\n return resolvedConfig;\n }\n ngOnDestroy(): void {\n this.globalContextChange$.complete();\n this.refresh$.complete();\n }\n protected applyInitialModeAdjustments(_: {\n isDashboard: boolean;\n localState: Partial<GlobalContextState>;\n fieldSources: FieldSourcesMap;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n }): void {\n // mode-specific overrides handled by subclasses\n }\n protected normalizeRefreshOption(nextRefresh: RefreshOption): RefreshOption {\n return nextRefresh;\n }\n protected applyModeSpecificRefreshOptionChange(\n _refreshOption: RefreshOption,\n _sources: FieldSourcesMap\n ): void {\n // mode-specific overrides handled by subclasses\n }\n protected shouldForceDisableAutoRefresh(_refreshOption: RefreshOption): boolean {\n return false;\n }\n protected getDefaultRefreshOption(): RefreshOption {\n return this.mode;\n }\n protected supportsAutoRefresh(config: GlobalContextState): boolean {\n return config.refreshOption === this.getDefaultRefreshOption();\n }\n private syncSourcesForRefreshOption(\n displayMode: WidgetDisplayMode,\n refreshOption: RefreshOption,\n controls: WidgetControls | null\n ): void {\n syncSourcesForRefreshOptionHelper(\n displayMode,\n refreshOption,\n controls,\n this.fieldSourcesSignal,\n () => this.getDefaultRefreshOption(),\n sources => this.setFieldSources(sources)\n );\n }\n private setLinkDisableReason(key: keyof GlobalContextState, reason: string | undefined): void {\n this.linkDisableReasonsSignal.update(current => ({ ...current, [key]: reason }));\n }\n private handleAggregationManualToggle(isLinked: boolean): void {\n if (isLinked) {\n this.setAggregationValidationState(true);\n } else {\n this.setLinkDisableReason('aggregation', undefined);\n this.setAggregationUnlinkReason({ source: 'user', canAutoRecover: false });\n }\n }\n private setAggregationUnlinkReason(reason: AggregationUnlinkReason | null): void {\n this.aggregationUnlinkReason = reason;\n }\n private updateAggregationDisableReason(): void {\n const outcome = evaluateAggregationValidation({\n sources: this.fieldSourcesSignal(),\n localDateTimeContext:\n this.localStateSignal().dateTimeContext ?? this.configSignal().dateTimeContext ?? null,\n globalAggregation:\n this.globalStateSignal().aggregation ?? this.configSignal().aggregation ?? null,\n validateAggregationLink: context => this.validateAggregationLink(context),\n calculateAggregation: (context, target) => this.calculateAggregation(context, target)\n });\n if (!outcome) {\n this.setAggregationValidationState(true);\n return;\n }\n if (!outcome.isValid) {\n this.setAggregationValidationState(false, outcome.message ?? AGGREGATION_SYNC_FAILED);\n return;\n }\n this.setAggregationValidationState(true);\n if (this.attemptAggregationAutoRecover()) return;\n }\n private setAggregationValidationState(isValid: boolean, message?: string | null): void {\n if (isValid) {\n this.setLinkDisableReason('aggregation', undefined);\n this.setAggregationUnlinkReason(null);\n return;\n }\n const resolved = message ?? AGGREGATION_SYNC_FAILED;\n this.setLinkDisableReason('aggregation', resolved);\n this.setAggregationUnlinkReason({\n source: 'validation',\n canAutoRecover: true,\n message: resolved\n });\n }\n private resolveAutoUnlinkAggregationChange(\n globalAggregation: aggregationType | null | undefined\n ): AggregationChangeInstruction | null {\n return resolveAutoUnlinkAggregationChangeHelper({\n globalAggregation,\n localDateTimeContext: this.localStateSignal().dateTimeContext,\n adjustAggregationForDateTime: args => this.adjustAggregationForDateTime(args),\n updateFieldSources: updater => this.updateFieldSources(updater)\n });\n }\n private applyAggregationChangesForGlobalState(params: {\n incomingState: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n formUpdates: Partial<GlobalContextState>;\n applyLocalAggregationChange: (change: AggregationChangeInstruction) => void;\n }): boolean {\n return applyAggregationChangesForGlobalStateHelper({\n incomingState: params.incomingState,\n sources: params.sources,\n formUpdates: params.formUpdates,\n adjustAggregationForDateTime: args => this.adjustAggregationForDateTime(args),\n localAggregationSnapshot:\n this.localStateSignal().aggregation ?? this.configSignal().aggregation ?? null,\n globalAggregationSnapshot:\n this.globalStateSignal().aggregation ?? this.configSignal().aggregation ?? null,\n applyLocalAggregationChange: params.applyLocalAggregationChange\n });\n }\n private canAutoRecoverAggregation(): boolean {\n return (\n this.aggregationUnlinkReason?.source === 'validation' &&\n this.aggregationUnlinkReason.canAutoRecover === true\n );\n }\n private attemptAggregationAutoRecover(): boolean {\n if (!this.canAutoRecoverAggregation()) return false;\n this.setAggregationUnlinkReason(null);\n this.updateFieldSources(current => ({ ...current, aggregation: FIELD_SOURCE_GLOBAL }));\n this.updateLocalState(current => {\n if (current.aggregation === undefined) return current;\n const { aggregation: _drop, ...rest } = current;\n return rest;\n });\n return true;\n }\n private syncLocalStateForLinkOutcome(params: {\n outcome: LinkToggleOutcome;\n previousGlobalState: Partial<GlobalContextState>;\n previousLocalState: Partial<GlobalContextState>;\n previousEffectiveConfig: GlobalContextState;\n }): void {\n const { outcome, previousGlobalState, previousLocalState, previousEffectiveConfig } = params;\n if (!outcome.clearLocalKeys.length && !outcome.snapshotKeys.length) return;\n const configSnapshot = structuredClone(this.configSignal());\n this.updateLocalState(current => {\n const updated = { ...current };\n outcome.clearLocalKeys.forEach(key => delete updated[key]);\n outcome.snapshotKeys.forEach(key => {\n const typedKey = key as keyof GlobalContextState;\n let candidate = previousLocalState[typedKey] as\n | GlobalContextState[typeof typedKey]\n | null\n | undefined;\n if (candidate === undefined)\n candidate =\n previousEffectiveConfig[typedKey] ??\n previousGlobalState[typedKey] ??\n configSnapshot[typedKey];\n const resolved = this.resolveSnapshotValue(typedKey, candidate);\n if (resolved === undefined) delete updated[typedKey];\n else (updated as Record<string, unknown>)[typedKey as string] = resolved as unknown;\n });\n return updated;\n });\n }\n private resolveSnapshotValue(\n key: keyof GlobalContextState,\n candidate: GlobalContextState[keyof GlobalContextState] | null | undefined\n ): GlobalContextState[keyof GlobalContextState] | undefined {\n if (candidate !== undefined && candidate !== null) {\n if (key === 'dateTimeContext')\n return this.ensureDateTimeContext(candidate as DateTimeContext);\n if (key === 'refreshOption') return this.normalizeRefreshOption(candidate as RefreshOption);\n return structuredClone(candidate as GlobalContextState[keyof GlobalContextState]);\n }\n if (key === 'dateTimeContext') return this.ensureDateTimeContext(null);\n if (key === 'refreshOption') return this.normalizeRefreshOption(this.getDefaultRefreshOption());\n return undefined;\n }\n private promoteEffectiveDateTimeToLocal(previousEffectiveConfig: GlobalContextState): void {\n const snapshot = previousEffectiveConfig?.dateTimeContext;\n if (!snapshot) return;\n this.updateLocalState(current => ({ ...current, dateTimeContext: structuredClone(snapshot) }));\n }\n private ensureDateTimeContext(\n context: GlobalContextState['dateTimeContext'] | null | undefined\n ): DateTimeContext {\n return ensureDateTimeContextHelper(context, this.configSignal);\n }\n private syncLocalEntriesWithGlobal(): void {\n syncLocalEntriesWithGlobalHelper(\n this.fieldSourcesSignal,\n this.globalStateSignal,\n this.localStateSignal\n );\n }\n}\nexport type {\n AggregationUnlinkReason,\n LinkToggleOutcome,\n ModeServices,\n RefreshResult,\n VisibilityContext\n} from './shared-mode-orchestrator.types';\n","import { Injectable } from '@angular/core';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport { FieldSourcesMap } from './config-composer.util';\nimport { SharedModeOrchestrator, type ModeServices } from './shared-mode-orchestrator';\n\n@Injectable()\nexport class HistoryModeOrchestrator extends SharedModeOrchestrator {\n constructor(services: ModeServices) {\n super(REFRESH_OPTION.HISTORY, services);\n }\n\n protected override normalizeRefreshOption(_nextRefresh: RefreshOption): RefreshOption {\n return REFRESH_OPTION.HISTORY;\n }\n\n protected override applyModeSpecificRefreshOptionChange(\n refreshOption: RefreshOption,\n _sources: FieldSourcesMap\n ): void {\n if (refreshOption !== REFRESH_OPTION.HISTORY) {\n return;\n }\n\n this.updateLocalState(current => {\n if (current.isAutoRefreshEnabled === false) {\n return current;\n }\n return { ...current, isAutoRefreshEnabled: false };\n });\n }\n\n protected override shouldForceDisableAutoRefresh(refreshOption: RefreshOption): boolean {\n return refreshOption === REFRESH_OPTION.HISTORY;\n }\n\n protected override supportsAutoRefresh(_config: GlobalContextState): boolean {\n return false;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type { GlobalContextState } from '../../../models/global-context.model';\nimport type { TimeInterval } from '../../../models/interval-picker.model';\nimport { TIME_INTERVAL } from '../../../models/interval-picker.model';\nimport { DateTimeContextUtil } from '../../../utils/date-time-context.util';\nimport { FieldSourcesMap } from './config-composer.util';\nimport { SharedModeOrchestrator, type ModeServices } from './shared-mode-orchestrator';\n\n@Injectable()\nexport class LiveModeOrchestrator extends SharedModeOrchestrator {\n constructor(services: ModeServices) {\n super(REFRESH_OPTION.LIVE, services);\n }\n\n protected override applyInitialModeAdjustments(params: {\n isDashboard: boolean;\n localState: Partial<GlobalContextState>;\n fieldSources: FieldSourcesMap;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n }): void {\n const { isDashboard, localState, generateFreshDateTime } = params;\n\n // Live mode never has aggregation (business rule)\n delete localState.aggregation;\n\n const interval = localState?.dateTimeContext?.interval;\n\n if (isDashboard || localState?.refreshOption !== REFRESH_OPTION.LIVE || !interval) {\n return;\n }\n\n // For CUSTOM interval: keep dateFrom, update dateTo to now\n // For other intervals: generate fresh dateTimeContext\n if (interval === TIME_INTERVAL.CUSTOM) {\n if (localState.dateTimeContext) {\n localState.dateTimeContext = DateTimeContextUtil.normalizeForLive(\n localState.dateTimeContext\n );\n }\n } else {\n const fresh = generateFreshDateTime(interval as TimeInterval);\n localState.dateTimeContext = fresh;\n }\n }\n}\n","import { Injectable, OnDestroy, inject } from '@angular/core';\nimport { aggregationType } from '@c8y/client';\nimport { Subject, Subscription } from 'rxjs';\nimport type { RefreshOption } from '../../../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../../../models/auto-refresh.model';\nimport type { LinkStatesMap } from '../../../models/control-flow.model';\nimport type { DateTimeContext } from '../../../models/date-time-context-picker.model';\nimport type {\n GlobalContextEvent,\n GlobalContextState,\n WidgetControls,\n WidgetDisplayMode\n} from '../../../models/global-context.model';\nimport type { TimeInterval } from '../../../models/interval-picker.model';\nimport { AggregationPickerService } from '../../../services/domain/aggregation-picker.service';\nimport { WidgetControlService } from '../../../services/domain/widget-control.service';\nimport { GlobalContextService } from '../../../services/state/global-context.service';\nimport { type FieldSourcesMap } from './config-composer.util';\nimport { HistoryModeOrchestrator } from './history-mode-orchestrator';\nimport { LiveModeOrchestrator } from './live-mode-orchestrator';\nimport { SharedModeOrchestrator } from './shared-mode-orchestrator';\nimport type {\n AggregationChangeInstruction,\n AggregationUnlinkReason,\n ExecuteHandlerContext,\n HandleFormChangeContext,\n HandleGlobalStateChangeContext,\n LinkToggleOutcome,\n ModeServices,\n RefreshResult,\n VisibilityContext\n} from './shared-mode-orchestrator.types';\nimport type { AggregationValidationContext, AggregationValidationResult } from './validation.util';\n\n@Injectable()\nexport class GlobalContextInlineOrchestratorService implements OnDestroy {\n private readonly widgetControlService = inject(WidgetControlService);\n private readonly aggregationPickerService = inject(AggregationPickerService);\n private readonly globalContextService = inject(GlobalContextService);\n\n private readonly live: LiveModeOrchestrator;\n private readonly history: HistoryModeOrchestrator;\n private active: SharedModeOrchestrator;\n private activeMode: RefreshOption = REFRESH_OPTION.LIVE;\n private lastLiveAutoRefresh: boolean | undefined;\n private readonly subscriptions: Subscription[] = [];\n private initSnapshot: {\n initialConfig: GlobalContextState | null;\n widgetControls?: WidgetControls | null;\n isDashboard: boolean;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n } | null = null;\n private modeSnapshots: Record<RefreshOption, Partial<GlobalContextState>> = {\n [REFRESH_OPTION.LIVE]: {},\n [REFRESH_OPTION.HISTORY]: {}\n };\n readonly globalContextChange$ = new Subject<GlobalContextEvent>();\n readonly refresh$ = new Subject<void>();\n\n constructor() {\n const services: ModeServices = {\n widgetControlService: this.widgetControlService,\n aggregationPickerService: this.aggregationPickerService,\n globalContextService: this.globalContextService\n };\n this.live = new LiveModeOrchestrator(services);\n this.history = new HistoryModeOrchestrator(services);\n this.active = this.live;\n\n this.subscriptions.push(\n this.live.globalContextChange$.subscribe(event => this.globalContextChange$.next(event)),\n this.history.globalContextChange$.subscribe(event => this.globalContextChange$.next(event)),\n this.live.refresh$.subscribe(() => this.refresh$.next()),\n this.history.refresh$.subscribe(() => this.refresh$.next())\n );\n }\n\n initConfig(config: GlobalContextState | null | undefined): void {\n this.live.initConfig(config);\n this.history.initConfig(config);\n }\n\n initWidgetControls(controls: WidgetControls | null | undefined): void {\n this.live.initWidgetControls(controls);\n this.history.initWidgetControls(controls);\n }\n\n setDisplayMode(mode: WidgetDisplayMode | null | undefined): void {\n this.live.setDisplayMode(mode);\n this.history.setDisplayMode(mode);\n }\n\n getDisplayMode(): WidgetDisplayMode {\n return this.getActive().getDisplayMode();\n }\n\n setLoading(isLoading: boolean): void {\n this.getActive().setLoading(isLoading);\n }\n\n getFieldSources(): FieldSourcesMap {\n return this.getActive().getFieldSources();\n }\n\n setFieldSources(value: FieldSourcesMap): void {\n this.getActive().setFieldSources(value);\n }\n\n updateFieldSources(updater: (sources: FieldSourcesMap) => FieldSourcesMap): void {\n this.getActive().updateFieldSources(updater);\n }\n\n getLocalState(): Partial<GlobalContextState> {\n return this.getActive().getLocalState();\n }\n\n setLocalState(state: Partial<GlobalContextState>): void {\n this.getActive().setLocalState(state);\n }\n\n updateLocalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n this.getActive().updateLocalState(updater);\n }\n\n getGlobalState(): Partial<GlobalContextState> {\n return this.getActive().getGlobalState();\n }\n\n setGlobalState(state: Partial<GlobalContextState>): void {\n const targetMode = (state?.refreshOption as RefreshOption) ?? this.activeMode;\n const normalized = this.normalizeGlobalStateForMode(\n targetMode,\n state,\n this.initSnapshot?.initialConfig ?? null\n );\n\n this.updateModeSnapshot(targetMode, normalized);\n this.propagateSnapshots();\n }\n\n updateGlobalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n const targetMode = this.activeMode;\n const current = this.modeSnapshots[targetMode] ?? {};\n const updated = updater(structuredClone(current)) ?? {};\n const normalized = this.normalizeGlobalStateForMode(\n targetMode,\n updated,\n this.initSnapshot?.initialConfig ?? null\n );\n\n this.updateModeSnapshot(targetMode, normalized);\n this.propagateSnapshots();\n }\n\n initializeStateAndSources(params: {\n initialConfig: GlobalContextState | null;\n globalState: Partial<GlobalContextState>;\n isDashboard: boolean;\n widgetControls?: WidgetControls | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n forcedRefreshOption?: RefreshOption;\n }): void {\n const baseGlobalState = structuredClone(params.globalState ?? {});\n const liveState = this.normalizeGlobalStateForMode(\n REFRESH_OPTION.LIVE,\n baseGlobalState,\n params.initialConfig\n );\n const historyState = this.normalizeGlobalStateForMode(\n REFRESH_OPTION.HISTORY,\n baseGlobalState,\n params.initialConfig\n );\n\n this.updateModeSnapshot(REFRESH_OPTION.LIVE, liveState);\n this.updateModeSnapshot(REFRESH_OPTION.HISTORY, historyState);\n\n this.initSnapshot = {\n initialConfig: params.initialConfig,\n widgetControls: params.widgetControls ?? null,\n isDashboard: params.isDashboard,\n generateFreshDateTime: params.generateFreshDateTime\n };\n\n const liveParams = {\n ...params,\n globalState: structuredClone(this.modeSnapshots[REFRESH_OPTION.LIVE]),\n forcedRefreshOption: REFRESH_OPTION.LIVE\n };\n const historyParams = {\n ...params,\n globalState: structuredClone(this.modeSnapshots[REFRESH_OPTION.HISTORY]),\n forcedRefreshOption: REFRESH_OPTION.HISTORY\n };\n\n this.live.initializeStateAndSources(liveParams);\n this.history.initializeStateAndSources(historyParams);\n\n // After initialization, sync the fresh states back to snapshots\n // (applyInitialModeAdjustments may have generated fresh dates in local state)\n // Use computeEffectiveConfig to merge local+global states\n const liveEffective = this.live.computeEffectiveConfig(params.initialConfig);\n const historyEffective = this.history.computeEffectiveConfig(params.initialConfig);\n\n this.updateModeSnapshot(REFRESH_OPTION.LIVE, liveEffective);\n this.updateModeSnapshot(REFRESH_OPTION.HISTORY, historyEffective);\n\n // For standalone mode, use widget's refreshOption, not global state\n // For dashboard mode, use global state's refreshOption\n const desiredMode = params.isDashboard\n ? (params.forcedRefreshOption ??\n baseGlobalState.refreshOption ??\n params.initialConfig?.refreshOption ??\n this.activeMode)\n : (params.forcedRefreshOption ?? params.initialConfig?.refreshOption ?? this.activeMode);\n\n this.ensureMode(desiredMode);\n }\n\n handleFormChange(context: HandleFormChangeContext): void {\n const nextRefresh = context.formValue.refreshOption ?? context.previousRefresh;\n this.ensureMode(nextRefresh ?? this.activeMode);\n this.getActive().handleFormChange(context);\n }\n\n handleGlobalStateChange(context: HandleGlobalStateChangeContext): void {\n const nextRefresh = context.state.refreshOption ?? context.previousRefresh;\n this.ensureMode(nextRefresh ?? this.activeMode);\n this.getActive().handleGlobalStateChange(context);\n this.syncActiveSnapshot();\n }\n\n toggleLink(args: {\n key: keyof LinkStatesMap;\n isLinked: boolean;\n fieldSources?: FieldSourcesMap;\n }): LinkToggleOutcome {\n return this.getActive().toggleLink(args);\n }\n\n toggleAllLinks(args: {\n keys: Array<keyof LinkStatesMap>;\n isLinked: boolean;\n fieldSources?: FieldSourcesMap;\n }): LinkToggleOutcome {\n return this.getActive().toggleAllLinks(args);\n }\n\n executeHandler(context: ExecuteHandlerContext): void {\n const nextRefresh = context.configOverride?.refreshOption ?? context.previousRefresh;\n this.ensureMode(nextRefresh ?? this.activeMode);\n this.getActive().executeHandler(context);\n }\n\n processRefresh(params: {\n globalDateTimeContext?: DateTimeContext | null;\n generateFreshDateTime: (interval: TimeInterval) => DateTimeContext;\n }): RefreshResult {\n // Choose orchestrator based on mode:\n // - Dashboard mode: use global state's refreshOption\n // - Standalone mode: use effective config's refreshOption (local state)\n const isDashboard = this.initSnapshot?.isDashboard ?? false;\n const effectiveRefreshOption = isDashboard\n ? (this.getGlobalState().refreshOption ?? this.activeMode)\n : (this.getActive().computeEffectiveConfig(this.initSnapshot?.initialConfig ?? null)\n .refreshOption ?? this.activeMode);\n\n this.ensureMode(effectiveRefreshOption);\n return this.getActive().processRefresh(params);\n }\n\n applyRefreshOptionChange(params: {\n previousRefresh?: RefreshOption;\n nextRefresh?: RefreshOption;\n }): { refreshOption?: RefreshOption; forceDisableAutoRefresh?: boolean } {\n const desiredMode = params.nextRefresh ?? this.activeMode;\n this.ensureMode(desiredMode);\n\n const outcome = this.getActive().applyRefreshOptionChange(params);\n\n if (outcome.refreshOption) {\n this.ensureMode(outcome.refreshOption);\n }\n\n return outcome;\n }\n\n updateGlobalStateFromForm(\n formValue: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): void {\n this.getActive().updateGlobalStateFromForm(formValue, sources);\n this.syncActiveSnapshot();\n }\n\n processGlobalStateChange(\n state: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): Partial<GlobalContextState> {\n const result = this.getActive().processGlobalStateChange(state, sources);\n this.syncActiveSnapshot();\n return result;\n }\n\n validateAggregationLink(context: AggregationValidationContext): AggregationValidationResult {\n return this.getActive().validateAggregationLink(context);\n }\n\n deriveAggregationValue(config: GlobalContextState | null | undefined): aggregationType | null {\n return this.getActive().deriveAggregationValue(config);\n }\n\n calculateAggregation(\n dateTimeContext: DateTimeContext | null | undefined,\n currentAggregation: aggregationType | null | undefined\n ): aggregationType | null {\n return this.getActive().calculateAggregation(dateTimeContext, currentAggregation);\n }\n\n adjustAggregationForDateTime(params: {\n dateTimeContext: DateTimeContext;\n aggregation: aggregationType | null;\n }): { nextAggregation: aggregationType | null; changed: boolean } {\n return this.getActive().adjustAggregationForDateTime(params);\n }\n\n resolveAggregationChangeForForm(params: {\n formValue: Partial<GlobalContextState>;\n sources: FieldSourcesMap;\n }): AggregationChangeInstruction | null {\n return this.getActive().resolveAggregationChangeForForm(params);\n }\n\n shouldValidateAggregationForUnlinkedDateTime(\n state: Partial<GlobalContextState>,\n sources: FieldSourcesMap\n ): boolean {\n return this.getActive().shouldValidateAggregationForUnlinkedDateTime(state, sources);\n }\n\n getLinkDisableReasons(): Partial<Record<keyof GlobalContextState, string>> {\n return this.getActive().getLinkDisableReasons();\n }\n\n getAggregationUnlinkReason(): AggregationUnlinkReason | null {\n return this.getActive().getAggregationUnlinkReason();\n }\n\n computeEffectiveConfig(baseConfig: GlobalContextState | null | undefined): GlobalContextState {\n return this.getActive().computeEffectiveConfig(baseConfig);\n }\n\n resolveVisibilityContext(\n config: GlobalContextState | null | undefined\n ): VisibilityContext | null {\n return this.getActive().resolveVisibilityContext(config);\n }\n\n emitConfiguration(\n componentId: string,\n configuration: GlobalContextState | null | undefined\n ): GlobalContextState {\n return this.getActive().emitConfiguration(componentId, configuration);\n }\n\n getLatestVisibility(): VisibilityContext | null {\n return this.getActive().getLatestVisibility();\n }\n\n getConfigSnapshot(): GlobalContextState {\n return this.getActive().getConfigSnapshot();\n }\n\n ngOnDestroy(): void {\n this.subscriptions.forEach(subscription => subscription.unsubscribe());\n this.live.ngOnDestroy();\n this.history.ngOnDestroy();\n }\n\n private ensureMode(refreshOption?: RefreshOption | null): void {\n const desired =\n refreshOption === REFRESH_OPTION.HISTORY ? REFRESH_OPTION.HISTORY : REFRESH_OPTION.LIVE;\n const previous = this.activeMode;\n\n if (desired === previous) {\n return;\n }\n\n this.activeMode = desired;\n this.active = desired === REFRESH_OPTION.HISTORY ? this.history : this.live;\n this.resetActiveMode();\n }\n\n private getActive(): SharedModeOrchestrator {\n return this.active;\n }\n\n private resetActiveMode(): void {\n if (!this.initSnapshot) {\n return;\n }\n\n const isDashboard = this.initSnapshot.isDashboard;\n const snapshot = this.modeSnapshots[this.activeMode] ?? {};\n\n // For standalone mode, use the snapshot as initialConfig so fresh dates are preserved\n // For dashboard mode, use original initialConfig and snapshot goes to globalState\n const effectiveInitialConfig = isDashboard\n ? this.initSnapshot.initialConfig\n : (snapshot as GlobalContextState);\n\n const params = {\n initialConfig: effectiveInitialConfig,\n globalState: structuredClone(snapshot),\n isDashboard,\n widgetControls: this.initSnapshot.widgetControls,\n generateFreshDateTime: this.initSnapshot.generateFreshDateTime,\n forcedRefreshOption: this.activeMode\n };\n\n this.getActive().initializeStateAndSources(params);\n }\n\n private normalizeGlobalStateForMode(\n mode: RefreshOption,\n state: Partial<GlobalContextState> | null | undefined,\n initialConfig: GlobalContextState | null\n ): Partial<GlobalContextState> {\n const seed: Partial<GlobalContextState> = {\n ...(this.modeSnapshots?.[mode] ?? {}),\n ...(state ?? {})\n };\n const normalized = structuredClone(seed);\n\n normalized.refreshOption = mode;\n\n if (mode === REFRESH_OPTION.LIVE) {\n const restored =\n this.lastLiveAutoRefresh ??\n state?.isAutoRefreshEnabled ??\n initialConfig?.isAutoRefreshEnabled;\n\n if (restored !== undefined) {\n normalized.isAutoRefreshEnabled = restored;\n } else {\n delete normalized.isAutoRefreshEnabled;\n }\n\n // Live mode always has aggregation=null (business rule)\n delete normalized.aggregation;\n } else {\n if (state?.isAutoRefreshEnabled !== undefined) {\n this.lastLiveAutoRefresh = state.isAutoRefreshEnabled;\n }\n normalized.isAutoRefreshEnabled = false;\n }\n\n return normalized;\n }\n\n private syncActiveSnapshot(propagate = true): void {\n const current = this.getActive().getGlobalState() ?? {};\n this.updateModeSnapshot(this.activeMode, current);\n if (propagate) {\n this.propagateSnapshots();\n }\n }\n\n private updateModeSnapshot(mode: RefreshOption, snapshot: Partial<GlobalContextState>): void {\n this.modeSnapshots[mode] = structuredClone(snapshot ?? {});\n\n if (mode === REFRESH_OPTION.LIVE) {\n this.captureLiveAutoRefresh(this.modeSnapshots[mode]);\n }\n }\n\n private propagateSnapshots(): void {\n this.live.setGlobalState(structuredClone(this.modeSnapshots[REFRESH_OPTION.LIVE] ?? {}));\n this.history.setGlobalState(structuredClone(this.modeSnapshots[REFRESH_OPTION.HISTORY] ?? {}));\n }\n\n private captureLiveAutoRefresh(state: Partial<GlobalContextState> | null | undefined): void {\n if (!state) {\n return;\n }\n\n const refreshOption = state.refreshOption ?? REFRESH_OPTION.LIVE;\n\n if (refreshOption !== REFRESH_OPTION.LIVE) {\n return;\n }\n\n if (state.isAutoRefreshEnabled !== undefined) {\n this.lastLiveAutoRefresh = state.isAutoRefreshEnabled;\n }\n }\n}\n\nexport type {\n AggregationUnlinkReason,\n RefreshResult,\n VisibilityContext\n} from './shared-mode-orchestrator';\n","import { NgTemplateOutlet, NgClass } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n EffectRef,\n inject,\n input,\n OnDestroy,\n OnInit,\n output,\n signal,\n TemplateRef,\n ViewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { aggregationType } from '@c8y/client';\nimport { C8yTranslatePipe, DashboardChildComponent, IconDirective } from '@c8y/ngx-components';\nimport { isEqual } from 'lodash-es';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { distinctUntilChanged } from 'rxjs/operators';\nimport { AggregationPickerComponent } from '../features/aggregation/aggregation-picker';\nimport { AutoRefreshControlComponent } from '../features/refresh/auto-refresh';\nimport { DateTimeContextPickerComponent } from '../features/time-context/time-range-picker/date-time-context-picker.component';\nimport type { RefreshOption } from '../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../models/auto-refresh.model';\nimport type {\n ControlConfigsMap,\n LinkStatesMap,\n LinkToggleEvent\n} from '../models/control-flow.model';\nimport { LINK_BTNS_CONFIG } from '../models/control-flow.model';\nimport type { DateTimeContext } from '../models/date-time-context-picker.model';\nimport type {\n GlobalContextDisplayMode,\n GlobalContextSettings,\n GlobalContextState,\n WidgetControls,\n WidgetDisplayMode,\n WidgetState,\n WidgetStateHandlerResult\n} from '../models/global-context.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GLOBAL_CONTEXT_EVENTS,\n WIDGET_DISPLAY_MODE\n} from '../models/global-context.model';\nimport { AggregationValidationService } from '../services/domain/aggregation-validation.service';\nimport { GlobalContextEventService } from '../services/state/global-context-event.service';\nimport { GlobalContextFormService } from '../services/state/global-context-form.service';\nimport { GlobalContextService } from '../services/state/global-context.service';\nimport type {\n LinkHelpersContext,\n RefreshHelpersContext\n} from './widget-inline/inline-context.models';\nimport { GlobalContextLinkControlsComponent } from './widget-inline/inline-link-controls.component';\nimport {\n applyConfigOverride as applyConfigOverrideHelper,\n applyHandlerResult as applyHandlerResultHelper,\n buildControlLinkConfig as buildControlLinkConfigHelper,\n buildWidgetState as buildWidgetStateHelper,\n handleLinkToggle as handleLinkToggleHelper,\n toggleAllLinks as toggleAllLinksHelper\n} from './widget-inline/inline-link-helpers';\nimport {\n applyLocalAggregationChange as applyLocalAggregationChangeHelper,\n calculateDisabledAggregationsFromContext as calculateDisabledAggregationsFromContextHelper,\n deriveDisabledAggregations as deriveDisabledAggregationsHelper,\n generateFreshDateTimeContext,\n getShouldDisableIntervalConfig as getShouldDisableIntervalConfigHelper,\n handleGlobalRefresh as handleGlobalRefreshHelper,\n patchFormValues as patchFormValuesHelper,\n processRefreshEvent as processRefreshEventHelper,\n recalculateAggregationForGlobalDateTime,\n recalculateAggregationForLocalDateTime,\n updateAggregationValue as updateAggregationValueHelper\n} from './widget-inline/inline-refresh-helpers';\nimport {\n FIELD_SOURCE_GLOBAL,\n FIELD_SOURCE_LOCAL,\n type FieldSourcesMap\n} from './widget-inline/orchestrator/config-composer.util';\nimport {\n GlobalContextInlineOrchestratorService,\n type RefreshResult,\n type VisibilityContext\n} from './widget-inline/orchestrator/global-context-inline-orchestrator.service';\nimport type { AggregationChangeInstruction } from './widget-inline/orchestrator/shared-mode-orchestrator.types';\nconst EMIT_EVENT_DISABLED = { emitEvent: false };\n@Component({\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n ReactiveFormsModule,\n GlobalContextLinkControlsComponent,\n AggregationPickerComponent,\n AutoRefreshControlComponent,\n DateTimeContextPickerComponent,\n IconDirective,\n C8yTranslatePipe,\n TooltipModule,\n NgTemplateOutlet,\n NgClass\n ],\n selector: 'c8y-global-context-inline',\n templateUrl: './global-context-inline.component.html',\n exportAs: 'globalContextInline',\n providers: [GlobalContextInlineOrchestratorService]\n})\nexport class GlobalContextInlineComponent implements OnInit, AfterViewInit, OnDestroy {\n private readonly componentId = crypto.randomUUID();\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n readonly REFRESH_OPTION = REFRESH_OPTION;\n // --- Service Injections ---\n private readonly destroyReference = inject(DestroyRef);\n private readonly globalContextService = inject(GlobalContextService);\n private readonly globalContextEventService = inject(GlobalContextEventService);\n private readonly globalContextFormService = inject(GlobalContextFormService);\n private readonly aggregationValidationService = inject(AggregationValidationService);\n private readonly orchestrator = inject(GlobalContextInlineOrchestratorService);\n private readonly injectedDashboardChild = inject(DashboardChildComponent, { optional: true });\n // --- Inputs ---\n widgetControls = input.required<WidgetControls>();\n config = input<GlobalContextState | null>(null);\n isLoading = input(false);\n dashboardChildForLegacy = input<DashboardChildComponent>();\n // --- Outputs ---\n readonly refresh = output<Partial<DateTimeContext> | null>();\n readonly globalContextChange = output<Partial<GlobalContextState>>();\n // --- Signals for State Management ---\n private inlineOverrides = signal<Partial<GlobalContextSettings>>({});\n private dashboardOverrides = signal<Partial<GlobalContextSettings>>({});\n private viewInitCompleted = signal(false);\n // --- Derived State from Signals ---\n readonly effectiveConfig = computed(() =>\n this.orchestrator.computeEffectiveConfig(this.config())\n );\n private readonly visibilityContext = computed<VisibilityContext | null>(() =>\n this.orchestrator.resolveVisibilityContext(this.effectiveConfig())\n );\n readonly inlineSettings = computed(() => {\n const base = this.visibilityContext()?.settings ?? {};\n return { ...base, ...this.inlineOverrides() };\n });\n readonly dashboardControlSettings = computed(() => {\n const base = this.visibilityContext()?.dashboardControls ?? {};\n return { ...base, ...this.dashboardOverrides() };\n });\n readonly controlLinkStatus = computed(() => this.visibilityContext()?.links ?? {});\n readonly disabledAggregations = computed(() =>\n deriveDisabledAggregationsHelper(this.getRefreshContext())\n );\n readonly linkDisplayModel = computed(() => {\n const settings = this.inlineSettings() ?? {};\n const linkStates = this.controlLinkStatus() ?? {};\n const { controlConfig, filteredStates } = buildControlLinkConfigHelper(\n this.getLinkContext(),\n settings,\n Object.keys(linkStates).length ? linkStates : null\n );\n\n return {\n controlConfig,\n linkStates: filteredStates,\n showHeaderLinks: this.effectiveConfig().displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n };\n });\n // --- Other Properties ---\n form!: FormGroup;\n shouldDisableCounter = false;\n readonly controlLinksConfig: ControlConfigsMap = LINK_BTNS_CONFIG;\n @ViewChild('headerContent', { static: true, read: TemplateRef })\n private headerTemplateRef?: TemplateRef<unknown>;\n private registeredHeaderTemplate: TemplateRef<unknown> | null = null;\n private registeredDashboardChild: DashboardChildComponent | null = null;\n private headerEffectRef: EffectRef | null = null;\n private linkContextCache: LinkHelpersContext | null = null;\n constructor() {\n // Effects are set up once, initialization will set form afterwards\n this.setupEffects();\n effect(() => {\n const cfg = this.config();\n this.orchestrator.initConfig(cfg ?? {});\n this.orchestrator.setDisplayMode(this.mapToWidgetDisplayMode(cfg?.displayMode));\n this.orchestrator.initWidgetControls(this.widgetControls());\n });\n this.headerEffectRef = effect(() => {\n if (!this.viewInitCompleted()) {\n return;\n }\n const displayMode = this.effectiveConfig().displayMode;\n const dashboardChild = this.resolveDashboardChild();\n const shouldProject =\n !!dashboardChild && displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n const template = shouldProject ? (this.headerTemplateRef ?? null) : null;\n this.updateDashboardHeaderRegistration(template, dashboardChild);\n });\n }\n getDisabledAggregations(): Partial<Record<aggregationType, boolean>> {\n const dateTimeContext = this.getFormDateTimeContext();\n if (!this.hasValidDateRange(dateTimeContext)) {\n return this.disabledAggregations();\n }\n return calculateDisabledAggregationsFromContextHelper(\n this.getRefreshContext(),\n dateTimeContext as DateTimeContext\n );\n }\n shouldShowHeaderLinks(): boolean {\n return this.linkDisplayModel().showHeaderLinks;\n }\n shouldRenderHeaderInline(): boolean {\n const dashboardChild = this.resolveDashboardChild();\n return (\n !dashboardChild ||\n this.effectiveConfig().displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n );\n }\n getAutoRefreshSeconds(): number | null {\n if (!this.form) return null;\n const value = this.form.get('refreshInterval')?.value;\n return value == null ? null : typeof value === 'string' ? Number(value) : value;\n }\n getIntervalDisableConfig(): Record<string, boolean> {\n return this.getShouldDisableIntervalConfig();\n }\n ngOnInit(): void {\n this.initialize();\n }\n ngAfterViewInit(): void {\n this.viewInitCompleted.set(true);\n const dashboardChild = this.resolveDashboardChild();\n const displayMode = this.effectiveConfig().displayMode;\n const template =\n dashboardChild && displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n ? (this.headerTemplateRef ?? null)\n : null;\n this.updateDashboardHeaderRegistration(template, dashboardChild);\n }\n ngOnDestroy(): void {\n this.headerEffectRef?.destroy();\n this.cleanupRegisteredHeaderTemplate();\n this.globalContextService.unregister(this.componentId);\n this.globalContextService.unregisterLoading(this.componentId);\n }\n // --- Public API methods (ordering: public before private) ---\n handleLinkToggle(\n event: LinkToggleEvent,\n options?: {\n suppressEmit?: boolean;\n fromHandler?: boolean;\n }\n ): boolean {\n return handleLinkToggleHelper(this.getLinkContext(), event, options);\n }\n toggleAllLinks(isLinked: boolean, suppressRefresh?: boolean, suppressEmit?: boolean): void {\n const supportedLinks = Object.keys(this.controlLinkStatus() || {}) as Array<\n keyof LinkStatesMap\n >;\n if (!supportedLinks.length) {\n return;\n }\n\n // When unlinking: suppress both refresh and emit (data is already loaded)\n // When linking: allow both refresh and emit unless explicitly suppressed\n const shouldSuppressRefresh = suppressRefresh ?? !isLinked;\n const shouldSuppressEmit = suppressEmit ?? !isLinked;\n\n toggleAllLinksHelper(this.getLinkContext(), {\n keys: supportedLinks as Array<keyof LinkStatesMap>,\n isLinked,\n suppressRefresh: shouldSuppressRefresh,\n suppressEmit: shouldSuppressEmit\n });\n }\n\n updateDateTimeContext(dateTimeContext: any): void {\n this.orchestrator.updateLocalState(state => ({\n ...state,\n dateTimeContext: structuredClone(dateTimeContext)\n }));\n\n const dateTimeControl = this.form?.get('dateTimeContext');\n if (dateTimeControl) {\n dateTimeControl.setValue(structuredClone(dateTimeContext), { emitEvent: false });\n }\n }\n\n /**\n * Pause auto-refresh: sets isAutoRefreshEnabled to false and unlinks all controls.\n * This stops the auto-refresh timer and prevents the widget from receiving\n * updates from the global context.\n *\n * NOTE: Does NOT trigger any refresh or emit - data is already loaded, no updates needed.\n */\n pauseAutoRefresh(): void {\n // Step 1: Unlink all controls without any emissions (data already loaded)\n this.toggleAllLinks(\n false, // isLinked = false\n true, // suppressRefresh = true\n true // suppressEmit = true\n );\n\n // Step 2: Set isAutoRefreshEnabled to false without emitting events\n this.setAutoRefreshEnabled(false);\n }\n\n /**\n * Resume auto-refresh: sets isAutoRefreshEnabled to true and links all controls.\n * This starts the auto-refresh timer and allows the widget to receive\n * updates from the global context.\n *\n * NOTE: Triggers emissions and refresh to sync with the current global context state.\n */\n resumeAutoRefresh(): void {\n this.toggleAllLinks(true, false, false);\n this.setAutoRefreshEnabled(true);\n }\n\n triggerHandler(handlerName: string, configOverride?: GlobalContextState | null): void {\n const handler = this.widgetControls()?.stateHandlers?.[handlerName];\n const previousRefresh = this.effectiveConfig().refreshOption;\n this.orchestrator.executeHandler({\n handler,\n configOverride,\n previousRefresh,\n applyRefreshOptionChange: (prev, next) => this.applyRefreshOptionChange(prev, next),\n buildWidgetState: override => this.buildWidgetState(override ?? null),\n applyHandlerResult: result => this.applyHandlerResult(result),\n applyConfigOverride: config => {\n if (config) {\n this.applyConfigOverride(config);\n }\n },\n emitBasedOnFieldSources: config => this.emitConfiguration(config),\n requestRefresh: () => this.refresh.emit(null)\n });\n }\n onLocalRefreshTrigger(): void {\n const outcome = this.processRefreshEvent({\n globalDateTimeContext:\n this.getGlobalState().dateTimeContext ?? this.config()?.dateTimeContext ?? null\n });\n if (!outcome.shouldEmitRefresh) {\n this.refresh.emit(null);\n }\n }\n\n private setAutoRefreshEnabled(enabled: boolean): void {\n const autoRefreshControl = this.form?.get('isAutoRefreshEnabled');\n if (autoRefreshControl && autoRefreshControl.value !== enabled) {\n autoRefreshControl.setValue(enabled, { emitEvent: false });\n }\n }\n\n private mapToWidgetDisplayMode(mode?: GlobalContextDisplayMode | null): WidgetDisplayMode {\n switch (mode) {\n case GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG:\n return WIDGET_DISPLAY_MODE.CONFIG;\n case GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG:\n return WIDGET_DISPLAY_MODE.INLINE;\n case GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD:\n return WIDGET_DISPLAY_MODE.INLINE;\n case null:\n case undefined:\n return WIDGET_DISPLAY_MODE.INLINE;\n default: {\n // Exhaustive check: ensures all modes are handled at compile time\n // TypeScript can't verify template literal types match enum members perfectly\n const _exhaustive: never = mode as never;\n return WIDGET_DISPLAY_MODE.INLINE;\n }\n }\n }\n private applyConfigOverride(config: Partial<GlobalContextState>): void {\n applyConfigOverrideHelper(this.getLinkContext(), config);\n }\n private buildWidgetState(configOverride?: GlobalContextState | null): WidgetState {\n return buildWidgetStateHelper(this.getLinkContext(), configOverride);\n }\n private applyHandlerResult(result: WidgetStateHandlerResult): boolean {\n return applyHandlerResultHelper(this.getLinkContext(), result);\n }\n\n private getFormDateTimeContext(): DateTimeContext | null {\n return this.form?.get('dateTimeContext')?.value;\n }\n\n private hasValidDateRange(dateTimeContext: DateTimeContext | null): boolean {\n return !!dateTimeContext?.dateFrom && !!dateTimeContext?.dateTo;\n }\n private applyRefreshOptionChange(\n previousRefresh: RefreshOption | undefined,\n nextRefresh: RefreshOption | undefined\n ): void {\n const outcome = this.orchestrator.applyRefreshOptionChange({\n previousRefresh,\n nextRefresh\n });\n if (!outcome.refreshOption) {\n return;\n }\n this.inlineOverrides.set({});\n this.dashboardOverrides.set({});\n this.form?.patchValue({ refreshOption: outcome.refreshOption }, EMIT_EVENT_DISABLED);\n if (outcome.forceDisableAutoRefresh) {\n this.form?.patchValue({ isAutoRefreshEnabled: false }, EMIT_EVENT_DISABLED);\n }\n }\n private getFieldSources(): FieldSourcesMap {\n return this.orchestrator.getFieldSources() || {};\n }\n private getLocalState(): Partial<GlobalContextState> {\n return this.orchestrator.getLocalState();\n }\n private updateLocalState(\n updater: (state: Partial<GlobalContextState>) => Partial<GlobalContextState>\n ): void {\n this.orchestrator.updateLocalState(updater);\n }\n private getGlobalState(): Partial<GlobalContextState> {\n return this.orchestrator.getGlobalState();\n }\n private initialize(): void {\n const initialConfig = this.config() || {};\n this.inlineOverrides.set({});\n this.dashboardOverrides.set({});\n this.orchestrator.initConfig(initialConfig);\n this.orchestrator.initWidgetControls(this.widgetControls());\n this.orchestrator.setDisplayMode(this.getInitialDisplayMode(initialConfig));\n this.initializeForm(initialConfig);\n this.initializeStateAndSources(initialConfig);\n this.syncFormWithEffectiveConfig();\n this.setupSubscriptions();\n this.emitBasedOnFieldSources();\n this.setupWidgetOptions();\n }\n private getInitialDisplayMode(initialConfig: GlobalContextState | null): WidgetDisplayMode {\n const mode = initialConfig?.displayMode ?? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n switch (mode) {\n case GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG:\n return WIDGET_DISPLAY_MODE.CONFIG;\n case GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG:\n return WIDGET_DISPLAY_MODE.INLINE;\n case GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD:\n return WIDGET_DISPLAY_MODE.INLINE;\n default: {\n // Exhaustive check: ensures all modes are handled at compile time\n // TypeScript can't verify template literal types match enum members perfectly\n const _exhaustive: never = mode as never;\n return WIDGET_DISPLAY_MODE.INLINE;\n }\n }\n }\n private initializeForm(initialConfig: GlobalContextState | null): void {\n this.form = this.globalContextFormService.buildForm(initialConfig);\n }\n private syncFormWithEffectiveConfig(): void {\n const effectiveValues = this.effectiveConfig();\n if (effectiveValues && this.form) {\n this.form.patchValue(effectiveValues, EMIT_EVENT_DISABLED);\n }\n }\n private setupWidgetOptions(): void {\n const template = this.widgetControls();\n this.shouldDisableCounter = !!template?.options?.noAutoRefreshCounter;\n }\n private setupEffects(): void {\n // Remove automatic form syncing - form should be controlled by local state changes\n // and user interactions only, not by derived effective config\n // Register loading state reactively\n effect(() => {\n const loading = this.isLoading();\n const inDashboard =\n this.effectiveConfig().displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n const autoLinked = this.getFieldSources()?.isAutoRefreshEnabled === FIELD_SOURCE_GLOBAL;\n if (inDashboard && autoLinked && loading) {\n this.globalContextService.registerLoading(this.componentId);\n } else {\n this.globalContextService.unregisterLoading(this.componentId);\n }\n });\n }\n private setupSubscriptions(): void {\n this.subscribeToFormChanges();\n if (this.isDashboardMode()) {\n this.subscribeToGlobalStateChanges();\n this.subscribeToGlobalRefreshEvents();\n }\n }\n private subscribeToFormChanges(): void {\n this.form.valueChanges\n .pipe(\n distinctUntilChanged((previous, current) => isEqual(previous, current)),\n takeUntilDestroyed(this.destroyReference)\n )\n .subscribe(formValue => {\n this.handleFormChange(formValue);\n });\n }\n private handleFormChange(formValue: Partial<GlobalContextState>): void {\n const sources = this.getFieldSources();\n const normalizedFormValue = { ...formValue };\n\n if (\n this.effectiveConfig().refreshOption === REFRESH_OPTION.HISTORY &&\n sources.refreshOption === FIELD_SOURCE_LOCAL &&\n formValue.refreshOption === REFRESH_OPTION.LIVE\n ) {\n normalizedFormValue.refreshOption = REFRESH_OPTION.HISTORY;\n this.form.patchValue({ refreshOption: REFRESH_OPTION.HISTORY }, EMIT_EVENT_DISABLED);\n }\n\n this.orchestrator.handleFormChange({\n formValue: normalizedFormValue,\n getFieldSources: () => this.getFieldSources(),\n applyFormChangesToLocalState: value => this.applyFormChangesToLocalState(value),\n shouldValidateAggregation: value => this.shouldValidateAggregation(value),\n applyLocalAggregationChange: change => this.applyLocalAggregationChange(change),\n applyRefreshOptionChange: (prev, next) => this.applyRefreshOptionChange(prev, next),\n previousRefresh: this.effectiveConfig().refreshOption,\n updateGlobalStateFromForm: (value, sources) =>\n this.orchestrator.updateGlobalStateFromForm(value, sources as FieldSourcesMap),\n emitUpdate: config => this.emitConfiguration(config),\n emitRefresh: payload => this.refresh.emit(payload ?? null)\n });\n }\n private shouldValidateAggregation(formValue: Partial<GlobalContextState>): boolean {\n return !!formValue.dateTimeContext && !!this.form.get('aggregation');\n }\n private applyFormChangesToLocalState(formValue: Partial<GlobalContextState>): void {\n this.updateLocalState(current => ({ ...current, ...formValue }));\n }\n private subscribeToGlobalStateChanges(): void {\n this.globalContextEventService\n .on(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE)\n .pipe(takeUntilDestroyed(this.destroyReference))\n .subscribe(state => this.handleGlobalStateChange(state));\n }\n private handleGlobalStateChange(state: Partial<GlobalContextState> | null): void {\n if (!state) {\n return;\n }\n this.orchestrator.handleGlobalStateChange({\n state,\n getFieldSources: () => this.getFieldSources(),\n previousRefresh: this.effectiveConfig().refreshOption,\n processGlobalStateChange: (incoming, sources) =>\n this.orchestrator.processGlobalStateChange(incoming, sources as FieldSourcesMap),\n shouldValidateAggregationForUnlinkedDateTime: (incoming, sources) =>\n this.orchestrator.shouldValidateAggregationForUnlinkedDateTime(\n incoming,\n sources as FieldSourcesMap\n ),\n applyLocalAggregationChange: change => this.applyLocalAggregationChange(change),\n applyRefreshOptionChange: (prev, next) => this.applyRefreshOptionChange(prev, next),\n patchForm: updates => this.patchFormValues(updates),\n emitUpdate: config => this.emitConfiguration(config),\n emitRefresh: payload => this.refresh.emit(payload ?? null)\n });\n }\n private subscribeToGlobalRefreshEvents(): void {\n this.globalContextEventService\n .on(GLOBAL_CONTEXT_EVENTS.REFRESH)\n .pipe(takeUntilDestroyed(this.destroyReference))\n .subscribe(dateTimeContext => {\n if (dateTimeContext) {\n this.handleGlobalRefresh(dateTimeContext as DateTimeContext);\n }\n });\n }\n private isDashboardMode(config: GlobalContextState | null = null): boolean {\n if (config) {\n return config.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n return this.effectiveConfig().displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n private initializeStateAndSources(initialConfig: GlobalContextState | null): void {\n const isDashboard = this.isDashboardMode(initialConfig);\n const globalState =\n this.globalContextEventService.getLatestValue(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE) || {};\n this.orchestrator.initializeStateAndSources({\n initialConfig,\n globalState,\n isDashboard,\n widgetControls: this.widgetControls(),\n generateFreshDateTime: interval => generateFreshDateTimeContext(interval)\n });\n }\n\n private handleGlobalRefresh(globalDateTimeContext: DateTimeContext): void {\n handleGlobalRefreshHelper(this.getRefreshContext(), globalDateTimeContext);\n }\n private processRefreshEvent(params: {\n globalDateTimeContext?: DateTimeContext | null;\n }): RefreshResult {\n return processRefreshEventHelper(this.getRefreshContext(), params);\n }\n\n private getShouldDisableIntervalConfig(): Record<string, boolean> {\n return getShouldDisableIntervalConfigHelper(this.getRefreshContext());\n }\n\n private resolveDashboardChild(): DashboardChildComponent | null {\n return this.dashboardChildForLegacy() ?? this.injectedDashboardChild ?? null;\n }\n private updateDashboardHeaderRegistration(\n template: TemplateRef<unknown> | null,\n dashboardChild: DashboardChildComponent | null\n ): void {\n // Handle early exits and cleanup in one conditional block\n const isDifferentDashboardChild =\n this.registeredDashboardChild && this.registeredDashboardChild !== dashboardChild;\n const isMissingRequiredData = !template || !dashboardChild;\n const isAlreadyRegistered =\n this.registeredHeaderTemplate === template &&\n this.registeredDashboardChild === dashboardChild;\n\n if (isDifferentDashboardChild || isMissingRequiredData) {\n this.removeHeaderFromDashboard();\n if (isMissingRequiredData) {\n return;\n }\n }\n\n if (isAlreadyRegistered) {\n return;\n }\n\n this.removeHeaderFromDashboard();\n const headers = dashboardChild.additionalHeaderTemplates;\n if (!headers.includes(template)) {\n headers.push(template);\n }\n this.registeredHeaderTemplate = template;\n this.registeredDashboardChild = dashboardChild;\n }\n private cleanupRegisteredHeaderTemplate(): void {\n this.removeHeaderFromDashboard();\n }\n private removeHeaderFromDashboard(): void {\n if (this.registeredDashboardChild && this.registeredHeaderTemplate) {\n const headers = this.registeredDashboardChild.additionalHeaderTemplates;\n const index = headers.indexOf(this.registeredHeaderTemplate);\n if (index >= 0) {\n headers.splice(index, 1);\n }\n }\n this.registeredHeaderTemplate = null;\n this.registeredDashboardChild = null;\n }\n private emitBasedOnFieldSources(): void {\n this.emitConfiguration(this.effectiveConfig());\n }\n private emitConfiguration(configuration: GlobalContextState): void {\n const safe = this.orchestrator.emitConfiguration(this.componentId, configuration);\n this.globalContextChange.emit(safe);\n }\n private patchFormValues(formUpdates: Partial<GlobalContextState>): void {\n patchFormValuesHelper(this.getRefreshContext(), formUpdates);\n }\n\n private applyLocalAggregationChange(change: AggregationChangeInstruction): void {\n applyLocalAggregationChangeHelper(this.getRefreshContext(), change);\n }\n private getRefreshContext(): RefreshHelpersContext {\n return {\n orchestrator: this.orchestrator,\n aggregationValidationService: this.aggregationValidationService,\n getFieldSources: () => this.getFieldSources(),\n getLocalState: () => this.getLocalState(),\n getGlobalState: () => this.getGlobalState(),\n updateLocalState: updater => this.updateLocalState(updater),\n updateGlobalState: updater => this.orchestrator.updateGlobalState(updater),\n getEffectiveConfig: () => this.effectiveConfig(),\n getInitialConfig: () => this.config(),\n emitBasedOnFieldSources: () => this.emitBasedOnFieldSources(),\n emitRefresh: payload => this.refresh.emit(payload ?? null),\n form: () => this.form\n };\n }\n private getLinkContext(): LinkHelpersContext {\n if (!this.linkContextCache) {\n this.linkContextCache = this.createLinkContext();\n }\n return this.linkContextCache;\n }\n\n private createLinkContext(): LinkHelpersContext {\n return {\n orchestrator: this.orchestrator,\n getFieldSources: () => this.getFieldSources(),\n getEffectiveConfig: () => this.effectiveConfig(),\n getInitialConfig: () => this.config(),\n getLocalState: () => this.getLocalState(),\n getGlobalState: () => this.getGlobalState(),\n updateLocalState: updater => this.updateLocalState(updater),\n emitBasedOnFieldSources: () => this.emitBasedOnFieldSources(),\n emitRefresh: payload => this.refresh.emit(payload ?? null),\n form: () => this.form,\n inlineOverrides: this.inlineOverrides.asReadonly(),\n setInlineOverrides: value => this.inlineOverrides.set(value),\n dashboardOverrides: this.dashboardOverrides.asReadonly(),\n setDashboardOverrides: value => this.dashboardOverrides.set(value),\n inlineSettings: () => this.inlineSettings() ?? {},\n dashboardControlSettings: () => this.dashboardControlSettings() ?? {},\n controlLinkStatus: () => this.controlLinkStatus() ?? {},\n updateAggregationValue: aggregation =>\n updateAggregationValueHelper(this.getRefreshContext(), aggregation),\n applyLocalAggregationChange: change =>\n applyLocalAggregationChangeHelper(this.getRefreshContext(), change),\n recalcLocalAggregation: () =>\n recalculateAggregationForLocalDateTime(this.getRefreshContext()),\n recalcGlobalAggregation: () =>\n recalculateAggregationForGlobalDateTime(this.getRefreshContext()),\n setShouldDisableCounter: value => {\n this.shouldDisableCounter = value;\n }\n };\n }\n}\n","<ng-template #headerContent>\n @let linkModel = linkDisplayModel();\n <ng-content select=\"#header\"></ng-content>\n\n @if (shouldShowHeaderLinks()) {\n <c8y-global-context-link-controls\n [linkStates]=\"linkModel.linkStates\"\n [controlConfigs]=\"linkModel.controlConfig\"\n (allLinksToggled)=\"toggleAllLinks($event)\"\n ></c8y-global-context-link-controls>\n }\n</ng-template>\n\n<ng-template #inlineContent>\n @let settings = inlineSettings();\n @let linkModel = linkDisplayModel();\n\n @if (form && settings) {\n <form\n class=\"d-flex gap-16 p-l-16 p-r-16 inner-scroll\"\n [ngClass]=\"{\n 'p-b-8':\n settings.showTimeContext ||\n settings.showRefresh ||\n settings.showAutoRefresh ||\n settings.showAggregation\n }\"\n [formGroup]=\"form\"\n >\n <div class=\"input-group w-auto input-group-sm\">\n @if (settings.showAggregation) {\n <c8y-aggregation-picker\n data-cy=\"global-inline-date-context--Aggregation-display\"\n [disabledAggregations]=\"getDisabledAggregations()\"\n formControlName=\"aggregation\"\n [resetToDefault]=\"true\"\n ></c8y-aggregation-picker>\n }\n\n @if (settings.showAutoRefresh) {\n <c8y-auto-refresh-control\n [isLoading]=\"isLoading()\"\n [disableCounter]=\"shouldDisableCounter\"\n formControlName=\"isAutoRefreshEnabled\"\n [autoRefreshSeconds]=\"getAutoRefreshSeconds()\"\n [isAutoRefreshConnected]=\"linkModel.linkStates.isAutoRefreshEnabled ?? false\"\n (refresh)=\"onLocalRefreshTrigger()\"\n ></c8y-auto-refresh-control>\n }\n\n @if (settings.showTimeContext) {\n @let isHistoryMode = form.get('refreshOption')?.value === REFRESH_OPTION.HISTORY;\n <c8y-date-time-context-picker\n style=\"margin-left: -1px\"\n formControlName=\"dateTimeContext\"\n [shouldDisableInterval]=\"getIntervalDisableConfig()\"\n [config]=\"\n isHistoryMode\n ? { showDateTo: true, showDateFrom: true }\n : { showDateTo: false, showDateFrom: true }\n \"\n ></c8y-date-time-context-picker>\n }\n\n @if (settings.showRefresh) {\n <div class=\"input-group-btn\">\n <button\n class=\"btn btn-default\"\n [attr.aria-label]=\"'Refresh' | translate\"\n [tooltip]=\"'Refresh' | translate\"\n placement=\"bottom\"\n container=\"body\"\n type=\"button\"\n data-cy=\"global-inline-date-context--reload-button\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n [disabled]=\"isLoading()\"\n (click)=\"refresh.emit(null)\"\n >\n <i\n [class.icon-spin]=\"isLoading()\"\n [c8yIcon]=\"'refresh'\"\n ></i>\n </button>\n </div>\n }\n </div>\n </form>\n }\n\n <ng-content select=\"#body\"></ng-content>\n</ng-template>\n\n@switch (effectiveConfig().displayMode) {\n @case (GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG) {\n <ng-container [ngTemplateOutlet]=\"inlineContent\"></ng-container>\n }\n @case (GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG) {\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n <ng-container [ngTemplateOutlet]=\"inlineContent\"></ng-container>\n }\n @default {\n @if (shouldRenderHeaderInline()) {\n <ng-container [ngTemplateOutlet]=\"headerContent\"></ng-container>\n }\n <ng-container [ngTemplateOutlet]=\"inlineContent\"></ng-container>\n }\n}\n","import { Injectable, WritableSignal, computed, inject, signal } from '@angular/core';\nimport { REFRESH_OPTION, type RefreshOption } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n type GlobalContextSettings,\n type WidgetControls,\n type GlobalContextDisplayMode,\n type GlobalContextState\n} from '../../models/global-context.model';\nimport { TIME_INTERVAL } from '../../models/interval-picker.model';\nimport { fillMissingDefaults } from '../../utils/global-context-defaults.util';\nimport { WidgetControlService } from '../domain/widget-control.service';\nimport { GlobalContextUtilsService } from '../infrastructure/global-context-utils.service';\n\n/**\n * GlobalContextConfigStoreService\n *\n * Component-scoped store that manages widget-level Global Context configuration.\n * - Holds separate Live/History modes\n * - Tracks refreshOption (tab) and displayMode\n * - Normalizes incoming configs (Live → aggregation=null; History → interval=CUSTOM)\n * - Applies targeted patches to the current mode\n * - Avoids redundant recomputation via shallow diffing\n *\n * Provided in component scope (see providers of c8y-global-context-config).\n */\n@Injectable()\nexport class GlobalContextConfigStoreService {\n /** Utility for diffing before signal writes */\n private readonly utils = inject(GlobalContextUtilsService);\n /** Widget control template used for computing visibility settings */\n private readonly widgetControlService = inject(WidgetControlService);\n\n /** Widget controls definition (what a widget supports) provided by the host component */\n private readonly _widgetControls: WritableSignal<WidgetControls | null> = signal(null);\n\n /**\n * Live mode of the widget time context state.\n * Null until the store is hydrated with the first input.\n */\n readonly liveState: WritableSignal<GlobalContextState | null> = signal(null);\n\n /**\n * History mode of the widget time context state.\n * Null until the store is hydrated with the first input.\n */\n readonly historyState: WritableSignal<GlobalContextState | null> = signal(null);\n\n /** Currently selected tab (refresh option). Defaults to LIVE. */\n readonly refreshOption: WritableSignal<RefreshOption> = signal(REFRESH_OPTION.LIVE);\n\n /** Current display mode for the widget (config or view_and_config). */\n readonly displayMode: WritableSignal<GlobalContextDisplayMode> = signal(\n GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG\n );\n\n /** Whether the store has processed the first hydrate() call. */\n readonly initialized: WritableSignal<boolean> = signal(false);\n\n /**\n * Computed visibility settings for controls, based on the current widget controls,\n * display mode, and selected refresh option. If widgetControls are not provided yet,\n * defaults to showing all controls.\n */\n readonly settings = computed<Partial<GlobalContextSettings>>(() => {\n this.activeConfig();\n const { settings } = this.widgetControlService.resolveConfigControlSettings(\n this._widgetControls(),\n this.displayMode(),\n this.refreshOption()\n );\n return settings;\n });\n\n /**\n * Inline visibility and dashboard control settings derived for the Inline component.\n * Uses default link states from the widget controls; dynamic link toggling remains\n * handled by the Inline component.\n */\n readonly inlineSettings = computed(() => {\n const res = this.widgetControlService.resolveInlineControlSettings(\n this._widgetControls(),\n this.displayMode(),\n this.refreshOption()\n );\n return res; // { settings, links, dashboardControls }\n });\n\n /**\n * Effective configuration for the currently selected tab.\n * Consumers should read this to render the UI.\n */\n readonly activeConfig = computed(() => {\n return this.refreshOption() === REFRESH_OPTION.LIVE ? this.liveState() : this.historyState();\n });\n\n /**\n * Hydrates the store from an external config input.\n * After the first call, preserves the user's tab selection.\n * @param config - Incoming widget-level global context configuration\n */\n hydrate(config: GlobalContextState): void {\n const norm = this.normalize(config);\n\n if (!this.initialized()) {\n // Initialize both modes with the same dateTimeContext for consistency\n // This ensures when user switches modes, they see the same time range initially\n const sharedDateTimeContext = norm.dateTimeContext;\n\n const baseLive = fillMissingDefaults({\n displayMode: norm.displayMode,\n refreshOption: REFRESH_OPTION.LIVE,\n isAutoRefreshEnabled: GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n aggregation: null,\n dateTimeContext: sharedDateTimeContext\n });\n const baseHistory = this.enforceHistory(\n fillMissingDefaults({\n displayMode: norm.displayMode,\n refreshOption: REFRESH_OPTION.HISTORY,\n isAutoRefreshEnabled: false,\n dateTimeContext: sharedDateTimeContext,\n // Preserve null aggregation from the source mode instead of using default\n aggregation: norm.aggregation\n })\n );\n\n if (norm.refreshOption === REFRESH_OPTION.LIVE) {\n this.liveState.set(norm);\n this.historyState.set(baseHistory);\n } else {\n this.liveState.set(baseLive);\n this.historyState.set(this.enforceHistory(norm));\n }\n this.refreshOption.set(norm.refreshOption);\n this.displayMode.set(norm.displayMode);\n this.initialized.set(true);\n return;\n }\n\n // Subsequent updates: update matching state only, preserve tab selection\n if (norm.refreshOption === REFRESH_OPTION.LIVE) {\n this.setIfChanged(this.liveState, norm);\n } else {\n this.setIfChanged(this.historyState, this.enforceHistory(norm));\n }\n\n // Keep display mode in sync\n if (this.displayMode() !== norm.displayMode) {\n this.setDisplayMode(norm.displayMode);\n }\n }\n\n /**\n * Sets the widget controls template. Required for computing visibility via `settings`.\n */\n setWidgetControls(controls: WidgetControls): void {\n this._widgetControls.set(controls);\n }\n\n /**\n * Sets the display mode and syncs the mode to both modes.\n * Does not change the selected tab.\n * @param mode - Display mode to set (CONFIG or VIEW_AND_CONFIG)\n */\n setDisplayMode(mode: GlobalContextDisplayMode): void {\n if (this.displayMode() === mode) {\n return;\n }\n this.displayMode.set(mode);\n\n const live = this.liveState();\n const history = this.historyState();\n if (live) {\n this.setIfChanged(this.liveState, { ...live, displayMode: mode });\n }\n if (history) {\n this.setIfChanged(this.historyState, { ...history, displayMode: mode });\n }\n }\n\n /**\n * Explicitly selects the tab (Live/History). Does not mutate stored values for either\n * refresh mode; it only switches which mode is active.\n * @param option - Target refresh option (LIVE or HISTORY)\n */\n setRefreshOption(option: RefreshOption): void {\n if (this.refreshOption() === option) {\n return;\n }\n this.refreshOption.set(option);\n }\n\n /**\n * Hydrates the snapshot for a specific refresh mode without altering the current selection.\n * Used by widget configuration to restore per-mode state across component lifecycles.\n */\n setSnapshot(option: RefreshOption, snapshot: GlobalContextState | null): void {\n if (!snapshot) {\n return;\n }\n\n if (option === REFRESH_OPTION.LIVE) {\n // Don't use fillMissingDefaults here as it can overwrite the dateTimeContext\n // The snapshot is already complete from the tab switch logic\n const normalized: GlobalContextState = {\n ...snapshot,\n refreshOption: REFRESH_OPTION.LIVE,\n aggregation: null\n };\n if (normalized.displayMode && this.displayMode() !== normalized.displayMode) {\n this.displayMode.set(normalized.displayMode);\n }\n this.setIfChanged(this.liveState, normalized);\n return;\n }\n\n // For History, enforce the interval=CUSTOM rule but don't regenerate dates\n const normalizedHistory: GlobalContextState = this.enforceHistory({\n ...snapshot,\n refreshOption: REFRESH_OPTION.HISTORY\n });\n if (normalizedHistory.displayMode && this.displayMode() !== normalizedHistory.displayMode) {\n this.displayMode.set(normalizedHistory.displayMode);\n }\n this.setIfChanged(this.historyState, normalizedHistory);\n }\n\n /**\n * Applies a partial update to the currently selected refresh mode.\n * Enforces business rules (Live: aggregation=null; History: interval=CUSTOM) before commit.\n * @param changes - Partial changes to apply to the current refresh mode\n */\n patchCurrent(changes: Partial<GlobalContextState>): void {\n const isLive = this.refreshOption() === REFRESH_OPTION.LIVE;\n const target = isLive ? this.liveState : this.historyState;\n const prev = target();\n\n if (!prev) {\n return;\n }\n\n // Filter out refreshInterval from changes - it's fixed at 5s and should not be user-modifiable\n const { refreshInterval: _, ...allowedChanges } = changes;\n\n let next: GlobalContextState = { ...prev, ...allowedChanges } as GlobalContextState;\n\n if (!isLive) {\n next = this.enforceHistory(next);\n } else {\n // Live must not carry aggregation\n next.aggregation = null;\n }\n\n // Always enforce the fixed refresh interval\n next.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n\n this.setIfChanged(target, next);\n }\n\n /**\n * Resets both Live and History modes to defaults, preserving the current\n * selected tab and display mode.\n */\n resetAllModesToDefaults(): void {\n const mode = this.displayMode();\n const baseLive = fillMissingDefaults({\n displayMode: mode,\n refreshOption: REFRESH_OPTION.LIVE,\n isAutoRefreshEnabled: GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n aggregation: null\n });\n const baseHistory = this.enforceHistory(\n fillMissingDefaults({\n displayMode: mode,\n refreshOption: REFRESH_OPTION.HISTORY,\n isAutoRefreshEnabled: false\n })\n );\n this.liveState.set(baseLive);\n this.historyState.set(baseHistory);\n }\n\n /**\n * Resets a single mode (live/history) to defaults, preserving the current\n * display mode and selected tab.\n */\n resetModeToDefaults(target: RefreshOption): void {\n const mode = this.displayMode();\n if (target === REFRESH_OPTION.LIVE) {\n const baseLive = fillMissingDefaults({\n displayMode: mode,\n refreshOption: REFRESH_OPTION.LIVE,\n isAutoRefreshEnabled: GLOBAL_CONTEXT_DEFAULTS.IS_AUTO_REFRESH_ENABLED,\n refreshInterval: GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL,\n aggregation: null\n });\n this.liveState.set(baseLive);\n } else {\n const baseHistory = this.enforceHistory(\n fillMissingDefaults({\n displayMode: mode,\n refreshOption: REFRESH_OPTION.HISTORY,\n isAutoRefreshEnabled: false\n })\n );\n this.historyState.set(baseHistory);\n }\n }\n\n /**\n * Selects a value from the active configuration using a projector function.\n * Returns a signal that updates whenever the active configuration changes.\n */\n select<K>(project: (s: GlobalContextState) => K) {\n return computed<K | null>(() => {\n const cfg = this.activeConfig();\n return cfg ? project(cfg) : null;\n });\n }\n\n /**\n * Normalizes an incoming configuration to internal invariants.\n * @param config - Raw incoming config\n * @returns A normalized config respecting store rules\n */\n private normalize(config: GlobalContextState): GlobalContextState {\n const norm = fillMissingDefaults(config);\n if (![REFRESH_OPTION.LIVE, REFRESH_OPTION.HISTORY].includes(norm.refreshOption)) {\n norm.refreshOption = REFRESH_OPTION.LIVE;\n }\n if (\n norm.displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG &&\n norm.displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n ) {\n norm.displayMode = GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n }\n if (norm.refreshOption === REFRESH_OPTION.LIVE) {\n norm.aggregation = null;\n }\n // Always enforce the fixed 5s refresh interval\n norm.refreshInterval = GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL;\n if (norm.refreshOption === REFRESH_OPTION.HISTORY) {\n return this.enforceHistory(norm);\n }\n return norm;\n }\n\n /**\n * Ensures state represents a valid History configuration (interval=CUSTOM).\n * @param state - State candidate to coerce to History rules\n * @returns A state object compliant with History mode rules\n */\n private enforceHistory(state: GlobalContextState): GlobalContextState {\n return {\n ...state,\n refreshOption: REFRESH_OPTION.HISTORY,\n ...(state.dateTimeContext && {\n dateTimeContext: { ...state.dateTimeContext, interval: TIME_INTERVAL.CUSTOM }\n })\n };\n }\n\n /**\n * Writes to a signal only if the next value differs from the current one.\n * Prevents unnecessary change detection and effect triggering.\n * @param target - Signal to update\n * @param next - Next value to set if changed\n */\n private setIfChanged(\n target: WritableSignal<GlobalContextState | null>,\n next: GlobalContextState\n ): void {\n const prev = target();\n if (!prev) {\n target.set(next);\n return;\n }\n const diff = this.utils.getChangedFields(prev, next);\n\n if (Object.keys(diff).length > 0) {\n target.set(next);\n }\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n output,\n untracked\n} from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { ConfigurationControlsComponent } from '../features/configuration/configuration-controls/configuration-controls.component';\nimport { REFRESH_OPTION } from '../models/auto-refresh.model';\nimport type { GlobalContextState, WidgetControls } from '../models/global-context.model';\nimport { GlobalContextConfigStoreService } from '../services/state/global-context-store.service';\n\n/**\n * GlobalContextConfigComponent\n *\n * Presentation + state coordination for the widget's Global Context controls.\n * - Hydrates a component-scoped store from the incoming `config` input.\n * - Renders Live/History configuration controls via `ConfigurationControlsComponent`.\n * - Emits a normalized `GlobalContextState` when user changes either the tab\n * (refreshOption) or any control value within the current tab.\n * - Does not emit during initial hydrate; emissions only happen on user actions.\n */\n@Component({\n standalone: true,\n imports: [\n ReactiveFormsModule,\n TooltipModule,\n PopoverModule,\n CollapseModule,\n ConfigurationControlsComponent\n ],\n selector: 'c8y-global-context-config',\n templateUrl: './global-context-config.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [GlobalContextConfigStoreService]\n})\nexport class GlobalContextConfigComponent {\n private readonly store = inject(GlobalContextConfigStoreService);\n\n configInput = input.required<GlobalContextState>({ alias: 'config' });\n isLoading = input(false);\n widgetControls = input.required<WidgetControls>();\n liveSnapshotInput = input<GlobalContextState | null>(null, { alias: 'liveSnapshot' });\n historySnapshotInput = input<GlobalContextState | null>(null, { alias: 'historySnapshot' });\n\n readonly activeConfig = computed(() => this.store.activeConfig());\n readonly liveConfig = computed(() => this.store.liveState());\n readonly historyConfig = computed(() => this.store.historyState());\n readonly refreshOption = computed(() => this.store.refreshOption());\n readonly settings = computed(() => this.store.settings());\n readonly supportedModes = computed(\n () => this.widgetControls().supportedModes ?? [REFRESH_OPTION.LIVE, REFRESH_OPTION.HISTORY]\n );\n isExpanded = false;\n\n readonly refresh = output<void>();\n readonly globalContextChange = output<GlobalContextState>();\n\n constructor() {\n // Consolidated hydration & widget controls effect\n effect(() => {\n const config = this.configInput();\n const controls = this.widgetControls();\n\n untracked(() => {\n if (config) {\n this.store.hydrate(config);\n }\n if (controls) {\n this.store.setWidgetControls(controls);\n }\n // Touch settings once both are available to trigger hydration\n if (config && controls && this.activeConfig()) {\n this.settings();\n }\n });\n });\n\n // Consolidated snapshot setting effect\n effect(() => {\n const liveSnapshot = this.liveSnapshotInput();\n const historySnapshot = this.historySnapshotInput();\n\n untracked(() => {\n if (liveSnapshot) {\n this.store.setSnapshot(REFRESH_OPTION.LIVE, liveSnapshot);\n }\n if (historySnapshot) {\n this.store.setSnapshot(REFRESH_OPTION.HISTORY, historySnapshot);\n }\n });\n });\n }\n\n onConfigurationChanges(changes: Partial<GlobalContextState>): void {\n const current = this.activeConfig();\n if (!current) {\n return;\n }\n\n if (this.isRefreshOptionChange(changes, current)) {\n const { refreshOption } = changes;\n\n // Get the target mode's existing state to preserve its interval/preset\n const targetState =\n refreshOption === REFRESH_OPTION.LIVE ? this.store.liveState() : this.store.historyState();\n\n // Build target snapshot: inherit time range (dateFrom/dateTo) but preserve target mode's interval\n const targetSnapshot: GlobalContextState = {\n ...current,\n refreshOption,\n dateTimeContext:\n current.dateTimeContext && targetState?.dateTimeContext\n ? {\n ...structuredClone(current.dateTimeContext),\n interval: targetState.dateTimeContext.interval // Preserve target's interval\n }\n : current.dateTimeContext,\n // Reset aggregation for Live mode, preserve for History\n aggregation: refreshOption === REFRESH_OPTION.LIVE ? null : current.aggregation\n };\n\n // CRITICAL: Set snapshot BEFORE changing refreshOption to prevent race condition\n this.store.setSnapshot(refreshOption, targetSnapshot);\n this.store.setRefreshOption(refreshOption);\n\n this.emitActive();\n return;\n }\n\n // Capture state before patch to detect actual changes\n const stateBefore = this.store.activeConfig();\n this.store.patchCurrent(changes);\n const stateAfter = this.store.activeConfig();\n\n // Only emit if the state actually changed\n // The store's setIfChanged method prevents unnecessary updates,\n // so we check if the reference changed to know if an update occurred\n if (stateBefore !== stateAfter) {\n this.emitActive();\n }\n }\n\n /** Emits the current normalized active state if available */\n private emitActive(): void {\n const state = this.store.activeConfig();\n if (state) {\n this.globalContextChange.emit(state);\n }\n }\n\n private isRefreshOptionChange(\n changes: Partial<GlobalContextState>,\n current: Partial<GlobalContextState>\n ): boolean {\n return (\n Object.keys(changes).length === 1 &&\n 'refreshOption' in changes &&\n changes.refreshOption !== current.refreshOption\n );\n }\n}\n","<c8y-configuration-controls\n [settings]=\"settings()\"\n [controlsDisplayMode]=\"'horizontal'\"\n [tabsOutletName]=\"'verticalTabOutletForConfigurationModes'\"\n [activeMode]=\"refreshOption()\"\n [liveContext]=\"liveConfig()\"\n [historyContext]=\"historyConfig()\"\n [supportedModes]=\"supportedModes()\"\n (contextChange)=\"onConfigurationChanges($event)\"\n (refreshOptionChange)=\"onConfigurationChanges({ refreshOption: $event })\"\n></c8y-configuration-controls>\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n forwardRef,\n inject,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n ControlValueAccessor,\n FormBuilder,\n FormsModule,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule\n} from '@angular/forms';\nimport { C8yTranslatePipe } from '@c8y/ngx-components';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { map } from 'rxjs/operators';\nimport type { ContextConfig } from '../../../models/context-config.model';\nimport type { GlobalContextDisplayMode } from '../../../models/global-context.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE } from '../../../models/global-context.model';\n\n@Component({\n selector: 'c8y-config-context-selector',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (form) {\n @let isWidgetContext = form.get('context')?.value === 'widget';\n @let helpText = 'Show controls directly in the widget view for easier access.' | translate;\n\n <form class=\"form-group m-b-8\" [formGroup]=\"form\">\n <div class=\"d-flex gap-8 a-i-center\">\n <label class=\"c8y-radio\">\n <input\n type=\"radio\"\n value=\"dashboard\"\n data-cy=\"c8y-config-context-selector--dashboard-mode\"\n formControlName=\"context\"\n />\n <span class=\"a-s-center\"></span>\n <span translate>Dashboard</span>\n </label>\n <label class=\"c8y-radio\">\n <input\n type=\"radio\"\n value=\"widget\"\n data-cy=\"c8y-config-context-selector--config-mode\"\n formControlName=\"context\"\n />\n <span class=\"a-s-center\"></span>\n <span translate>Widget</span>\n </label>\n </div>\n\n @if (isWidgetContext) {\n <div class=\"m-t-8\">\n <label class=\"c8y-checkbox\">\n <input\n type=\"checkbox\"\n data-cy=\"c8y-config-context-selector--view-and-config-mode\"\n formControlName=\"showInWidget\"\n />\n <span class=\"a-s-center\"></span>\n <span translate>Show in widget</span>\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"helpText\"\n placement=\"right\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </label>\n </div>\n }\n </form>\n }\n `,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ConfigContextSelectorComponent),\n multi: true\n }\n ],\n imports: [C8yTranslatePipe, FormsModule, ReactiveFormsModule, PopoverModule]\n})\nexport class ConfigContextSelectorComponent implements ControlValueAccessor, OnInit {\n private readonly fb = inject(FormBuilder);\n private readonly destroyRef = inject(DestroyRef);\n\n protected form!: ReturnType<typeof this.initForm>;\n\n protected get isWidgetContext(): boolean {\n return this.form?.get('context')?.value === 'widget';\n }\n\n ngOnInit(): void {\n this.form = this.initForm();\n this.setupValueChanges();\n }\n\n writeValue(value: GlobalContextDisplayMode): void {\n if (!value) return;\n\n const formValue: ContextConfig = {\n context: value === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD ? 'dashboard' : 'widget',\n showInWidget: value === GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n };\n\n this.form?.patchValue(formValue, { emitEvent: false });\n }\n\n registerOnChange(fn: (value: GlobalContextDisplayMode) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n isDisabled ? this.form?.disable() : this.form?.enable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChange: (value: GlobalContextDisplayMode) => void = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onTouched: () => void = () => {};\n\n private initForm() {\n return this.fb.group<ContextConfig>({\n context: 'widget',\n showInWidget: false\n });\n }\n\n private setupValueChanges(): void {\n this.form.valueChanges\n .pipe(\n map(({ context, showInWidget }: ContextConfig) =>\n context === 'dashboard'\n ? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n : showInWidget\n ? GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n : GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG\n ),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe(dateSelection => {\n this.onChange(dateSelection);\n this.onTouched();\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n effect,\n inject,\n input,\n OnInit,\n output,\n signal,\n untracked\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe } from '@c8y/ngx-components';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { ConfigContextSelectorComponent } from '../features/configuration/config-context-selector';\nimport type { RefreshOption } from '../models/auto-refresh.model';\nimport { REFRESH_OPTION } from '../models/auto-refresh.model';\nimport type {\n GlobalContextDisplayMode,\n GlobalContextState,\n WidgetControls\n} from '../models/global-context.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GLOBAL_CONTEXT_EVENTS } from '../models/global-context.model';\nimport { GlobalContextEventService } from '../services/state/global-context-event.service';\nimport { GlobalContextConfigComponent } from './global-context-config.component';\n\n/**\n * Widget configuration component for time context settings.\n *\n * Allows widgets to either sync with dashboard-level time settings (dashboard mode)\n * or use independent time controls (widget mode). When in widget mode, displays\n * additional configuration controls for time range, aggregation, and refresh settings.\n */\n@Component({\n selector: 'c8y-global-context-widget-config',\n standalone: true,\n imports: [\n ReactiveFormsModule,\n ConfigContextSelectorComponent,\n GlobalContextConfigComponent,\n C8yTranslatePipe,\n PopoverModule\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <form [formGroup]=\"form\">\n <fieldset class=\"c8y-fieldset\">\n <legend>\n {{ 'Time context' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"\n 'Sync with dashboard settings or set independent time controls for this widget.'\n | translate\n \"\n placement=\"right\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-config-context-selector formControlName=\"displayMode\"></c8y-config-context-selector>\n </fieldset>\n </form>\n\n @if (configInput()?.displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n <fieldset class=\"c8y-fieldset p-l-0 p-r-0 p-t-16\">\n <legend class=\"m-l-16\">{{ 'Widget time context' | translate }}</legend>\n <c8y-global-context-config\n [config]=\"_latestConfig()\"\n [widgetControls]=\"widgetControlsInput()\"\n [isLoading]=\"isLoadingInput()\"\n [liveSnapshot]=\"liveSnapshot\"\n [historySnapshot]=\"historySnapshot\"\n (refresh)=\"refresh.emit()\"\n (globalContextChange)=\"onGlobalContextChange($event)\"\n ></c8y-global-context-config>\n </fieldset>\n }\n `\n})\nexport class GlobalContextWidgetConfigComponent implements OnInit {\n // Component inputs\n configInput = input.required<GlobalContextState | null>({ alias: 'config' });\n widgetControlsInput = input.required<WidgetControls>({ alias: 'widgetControls' });\n isLoadingInput = input(false, { alias: 'isLoading' });\n\n readonly displayModeChange = output<GlobalContextDisplayMode>();\n readonly refresh = output<void>();\n readonly globalContextChange = output<GlobalContextState>();\n\n protected form: FormGroup;\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n\n private readonly fb = inject(FormBuilder);\n private readonly destroyRef = inject(DestroyRef);\n private readonly globalContextEventService = inject(GlobalContextEventService, {\n optional: true\n });\n private readonly _latestGlobalSnapshot = signal<GlobalContextState | null>(null);\n private readonly _latestConfig = signal<GlobalContextState | null>(null);\n private lastConfigInput: GlobalContextState | null = null;\n private readonly liveSnapshotState = signal<GlobalContextState | null>(null);\n private readonly historySnapshotState = signal<GlobalContextState | null>(null);\n private readonly lastActiveMode = signal<RefreshOption>(REFRESH_OPTION.LIVE);\n\n // Current display mode state\n readonly displayModeSig = signal<GlobalContextDisplayMode>(GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD);\n\n constructor() {\n // Sync form control with incoming displayMode without triggering change events\n effect(() => {\n const cfg = this.configInput();\n\n // Always ensure auto-refresh is enabled in the widget config\n const next =\n (cfg?.displayMode as GlobalContextDisplayMode) ?? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n const current = this.form?.get('displayMode')?.value as GlobalContextDisplayMode;\n if (current !== next && this.form) {\n untracked(() => {\n this.form.patchValue({ displayMode: next }, { emitEvent: false });\n this.displayModeSig.set(next);\n });\n }\n });\n\n // Keep child component config in sync with input changes\n effect(() => {\n const cfg = this.configInput();\n if (cfg && cfg !== this.lastConfigInput) {\n untracked(() => {\n this.lastConfigInput = cfg;\n const cloned = this.cloneSnapshot(cfg) as GlobalContextState;\n this._latestConfig.set(cloned);\n const mode = cloned.refreshOption ?? REFRESH_OPTION.LIVE;\n this.updateSnapshotForMode(mode, cloned);\n this.lastActiveMode.set(mode);\n });\n }\n\n if (!cfg && this.lastConfigInput) {\n untracked(() => {\n this.lastConfigInput = null;\n this._latestConfig.set(null);\n });\n }\n });\n }\n\n ngOnInit(): void {\n this.initializeForm();\n\n this.storeInitialStateChangeEvent();\n this.subscribeToGlobalContextStateChangeEvents();\n this.initializeContext();\n }\n\n onGlobalContextChange(newConfig: GlobalContextState): void {\n // Update local config first to prevent feedback loop\n const cloned = this.cloneSnapshot(newConfig) as GlobalContextState;\n this._latestConfig.set(cloned);\n this.lastConfigInput = null;\n const mode = cloned.refreshOption ?? REFRESH_OPTION.LIVE;\n this.updateSnapshotForMode(mode, cloned);\n this.lastActiveMode.set(mode);\n // Then emit to parent\n this.globalContextChange.emit(newConfig);\n }\n\n private initializeForm(): void {\n const initial =\n (this.configInput()?.displayMode as GlobalContextDisplayMode) ??\n GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n this.form = this.fb.group({\n displayMode: initial\n });\n\n // Emit display mode changes to parent\n this.form\n .get('displayMode')\n ?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((mode: GlobalContextDisplayMode) => {\n if (this.displayModeSig() !== mode) {\n this.displayModeSig.set(mode);\n }\n this.displayModeChange.emit(mode);\n // Also emit a normalized globalContextChange with a suggested context update\n const result = this.buildContextUpdateForDisplayMode(mode, {\n global: this._latestGlobalSnapshot(),\n widget: this._latestConfig()\n });\n this.syncWidgetSnapshotAfterHydration(mode, result);\n this.globalContextChange.emit(result.context as GlobalContextState);\n });\n }\n\n private storeInitialStateChangeEvent(): void {\n if (this.globalContextEventService) {\n const latest = this.globalContextEventService.getLatestValue(\n GLOBAL_CONTEXT_EVENTS.STATE_CHANGE\n );\n if (latest) {\n this._latestGlobalSnapshot.set(latest);\n }\n }\n }\n\n private subscribeToGlobalContextStateChangeEvents(): void {\n this.globalContextEventService\n .on(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(state => this._latestGlobalSnapshot.set(state));\n }\n\n private initializeContext(): void {\n const displayMode = this.form.get('displayMode').value;\n // const configInput = this.configInput();\n\n // If already in config mode with widget config, use it directly - don't build from snapshots\n if (displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n // Just emit the widget config as-is, effect will handle the rest\n return;\n }\n\n // Otherwise build from global/widget snapshots\n const result = this.buildContextUpdateForDisplayMode(displayMode, {\n global: this._latestGlobalSnapshot(),\n widget: this._latestConfig()\n });\n\n this.syncWidgetSnapshotAfterHydration(displayMode, result);\n this.globalContextChange.emit(result.context as GlobalContextState);\n }\n\n private buildContextUpdateForDisplayMode(\n displayMode: GlobalContextDisplayMode,\n snapshots: {\n global?: Partial<GlobalContextState> | null;\n widget?: Partial<GlobalContextState> | null;\n }\n ): { context: Partial<GlobalContextState>; hydratedFromGlobal: boolean } {\n const globalSnapshot = this.cloneSnapshot(snapshots.global);\n\n if (displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n return {\n context: { ...(globalSnapshot ?? {}), displayMode },\n hydratedFromGlobal: false\n };\n }\n\n const widgetSnapshot = this.cloneSnapshot(snapshots.widget ?? this._latestConfig());\n const primaryMode = this.lastActiveMode();\n const primarySnapshot = this.cloneSnapshot(\n primaryMode === REFRESH_OPTION.HISTORY\n ? this.historySnapshotState()\n : this.liveSnapshotState()\n );\n const secondarySnapshot = this.cloneSnapshot(\n primaryMode === REFRESH_OPTION.HISTORY\n ? this.liveSnapshotState()\n : this.historySnapshotState()\n );\n\n const candidate = this.isMeaningfulState(widgetSnapshot)\n ? widgetSnapshot\n : this.isMeaningfulState(primarySnapshot)\n ? primarySnapshot\n : secondarySnapshot;\n\n if (candidate) {\n return {\n context: { ...candidate, displayMode },\n hydratedFromGlobal: false\n };\n }\n\n return {\n context: { ...(globalSnapshot ?? {}), displayMode },\n hydratedFromGlobal: true\n };\n }\n\n private cloneSnapshot(\n snapshot: Partial<GlobalContextState> | GlobalContextState | null | undefined\n ): Partial<GlobalContextState> | null {\n if (!snapshot) {\n return null;\n }\n\n return structuredClone(snapshot);\n }\n\n private isMeaningfulState(\n snapshot: Partial<GlobalContextState> | null | undefined\n ): snapshot is Partial<GlobalContextState> {\n if (!snapshot) {\n return false;\n }\n\n const { dateTimeContext, refreshOption, refreshInterval, aggregation, isAutoRefreshEnabled } =\n snapshot;\n\n return (\n !!dateTimeContext ||\n refreshOption !== undefined ||\n refreshInterval !== undefined ||\n aggregation !== undefined ||\n isAutoRefreshEnabled !== undefined\n );\n }\n\n private syncWidgetSnapshotAfterHydration(\n mode: GlobalContextDisplayMode,\n result: { context: Partial<GlobalContextState>; hydratedFromGlobal: boolean }\n ): void {\n if (mode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n return;\n }\n\n const cloned = this.cloneSnapshot(\n result.context as GlobalContextState\n ) as GlobalContextState | null;\n if (!cloned) {\n return;\n }\n\n this._latestConfig.set(cloned);\n const modeToUpdate = cloned.refreshOption ?? this.lastActiveMode();\n this.updateSnapshotForMode(modeToUpdate, cloned);\n this.lastActiveMode.set(modeToUpdate);\n }\n\n private updateSnapshotForMode(mode: RefreshOption, snapshot: GlobalContextState): void {\n const cloned = this.cloneSnapshot(snapshot) as GlobalContextState | null;\n if (!cloned) {\n return;\n }\n\n if (mode === REFRESH_OPTION.HISTORY) {\n this.historySnapshotState.set({ ...cloned, refreshOption: REFRESH_OPTION.HISTORY });\n return;\n }\n\n this.liveSnapshotState.set({\n ...cloned,\n refreshOption: REFRESH_OPTION.LIVE,\n aggregation: null\n });\n }\n\n get liveSnapshot(): GlobalContextState | null {\n return this.liveSnapshotState();\n }\n\n get historySnapshot(): GlobalContextState | null {\n return this.historySnapshotState();\n }\n}\n","// Export core components\nexport * from './global-context.component';\nexport * from './global-context-inline.component';\nexport * from './global-context-config.component';\nexport * from './global-context-widget-config.component';\nexport * from './widget-inline/inline-link-controls.component';\n","// Export components\nexport * from './time-range-picker/date-time-context-picker.component';\nexport * from './time-range-display/time-range-display.component';\nexport * from './interval-picker/interval-picker.component';\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n inject\n} from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { C8yTranslatePipe } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\n\n@Component({\n selector: 'c8y-realtime-control',\n templateUrl: './realtime-control.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => RealtimeControlComponent),\n multi: true\n }\n ],\n standalone: true,\n imports: [TooltipModule, C8yTranslatePipe, FormsModule]\n})\nexport class RealtimeControlComponent implements ControlValueAccessor {\n readonly disableRealtimeLabel = gettext('Disable realtime');\n readonly enableRealtimeLabel = gettext('Enable realtime');\n\n isActive: boolean;\n touched = false;\n disabled = false;\n\n private cdr = inject(ChangeDetectorRef);\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange = _ => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onTouched = () => {};\n\n writeValue(value: boolean): void {\n this.isActive = value;\n this.cdr.markForCheck();\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n registerOnTouched(onTouched: any): void {\n this.onTouched = onTouched;\n }\n\n markAsTouched(): void {\n if (!this.touched) {\n this.onTouched();\n this.touched = true;\n }\n }\n\n setDisabledState(disabled: boolean): void {\n this.disabled = disabled;\n }\n\n onButtonClick(): void {\n const newValue = !this.isActive;\n this.onChange(newValue);\n }\n}\n","@let buttonLabel = (isActive ? disableRealtimeLabel : enableRealtimeLabel) | translate;\n\n<button\n class=\"btn btn-icon c8y-realtime\"\n [attr.aria-label]=\"buttonLabel\"\n [tooltip]=\"tooltipTpl\"\n placement=\"top\"\n container=\"body\"\n type=\"button\"\n data-cy=\"global-context--realtime-toggle\"\n (click)=\"onButtonClick()\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n [disabled]=\"disabled\"\n>\n <span\n class=\"c8y-pulse m-0\"\n [class.active]=\"isActive\"\n [class.inactive]=\"!isActive\"\n ></span>\n</button>\n<ng-template #tooltipTpl>\n {{ buttonLabel }}\n</ng-template>\n","// Export components\nexport * from './auto-refresh/auto-refresh-control.component';\nexport * from './realtime-control/realtime-control.component';\n","// Export components\nexport * from './config-context-selector/config-context-selector.component';\nexport * from './configuration-controls/configuration-controls.component';\nexport * from './configuration-collapse/configuration-collapse.component';\nexport * from './live-mode-configuration-controls/live-mode-configuration-controls.component';\nexport * from './history-mode-configuration-controls/history-mode-configuration-controls.component';\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n inject,\n Input,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { BehaviorSubject, debounceTime, skip, take, tap } from 'rxjs';\n\nimport { AsyncPipe } from '@angular/common';\nimport { AggregationPickerComponent } from '../../features/aggregation/aggregation-picker';\nimport { AutoRefreshControlComponent } from '../../features/refresh/auto-refresh';\nimport { DateTimeContextPickerComponent } from '../../features/time-context/time-range-picker/date-time-context-picker.component';\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GlobalContextSettings,\n GlobalContextState,\n WidgetControls\n} from '../../models/global-context.model';\nimport { WidgetControlService } from '../../services/domain/widget-control.service';\nimport { GlobalContextFormService } from '../../services/state/global-context-form.service';\n\n@Component({\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AsyncPipe,\n IconDirective,\n ReactiveFormsModule,\n DateTimeContextPickerComponent,\n AggregationPickerComponent,\n AutoRefreshControlComponent,\n TooltipModule,\n C8yTranslatePipe\n ],\n selector: 'c8y-preview-controls',\n templateUrl: './preview-controls.component.html',\n styles: [\n `\n :host {\n position: relative;\n display: block;\n cursor: not-allowed;\n }\n\n /* Block all interactions with form controls */\n :host form {\n position: relative;\n pointer-events: none;\n user-select: none;\n }\n\n /* Add subtle visual indication of non-interactive state */\n :host form::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(255, 255, 255, 0.05);\n z-index: 1;\n pointer-events: none;\n }\n\n /* Ensure buttons and inputs look disabled */\n :host form button,\n :host form input,\n :host form select,\n :host form .dropdown-toggle,\n :host form .btn {\n cursor: not-allowed !important;\n opacity: 0.85;\n }\n\n /* Ensure all child interactive elements are non-interactive */\n :host form * {\n pointer-events: none !important;\n user-select: none !important;\n }\n `\n ]\n})\nexport class PreviewControlsComponent implements OnInit {\n // Constants\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n readonly REFRESH_OPTION = REFRESH_OPTION;\n\n // Form configuration\n form!: FormGroup;\n\n // State subjects\n private config$ = new BehaviorSubject<Partial<GlobalContextState> | null>(null);\n readonly inlineControlsSettings$ = new BehaviorSubject<Partial<GlobalContextSettings>>({});\n // UI state\n shouldDisableCustomInterval = { isDisabled: false, msg: null };\n\n // Injected dependencies\n private readonly destroyRef = inject(DestroyRef);\n private readonly globalContextFormService = inject(GlobalContextFormService);\n private readonly widgetControlService = inject(WidgetControlService);\n\n @Input() widgetControls: WidgetControls;\n\n private _currentConfig: Partial<GlobalContextState> = {};\n @Input()\n set config(value: GlobalContextState) {\n this._currentConfig = { ...this._currentConfig, ...value };\n this.config$.next(this._currentConfig);\n }\n get config(): Partial<GlobalContextState> | null {\n return this.config$.value;\n }\n\n ngOnInit(): void {\n this.initializeComponent();\n this.setupConfigChangeHandling();\n }\n\n /**\n * Returns the current inline controls settings\n */\n getInlineControlsSettings(): Partial<GlobalContextSettings> {\n return this.inlineControlsSettings$.value;\n }\n\n /**\n * Updates the inline controls settings\n */\n setInlineControlsSettings(settings: Partial<GlobalContextSettings>): void {\n this.inlineControlsSettings$.next(settings);\n }\n\n /**\n * Updates visibility of controls based on display mode and widget type\n */\n setControlsVisibility(context?: GlobalContextState): void {\n if (!this.config?.displayMode || !this.widgetControls) {\n return;\n }\n const displayMode = context?.displayMode ?? this.config.displayMode;\n\n const refreshOption =\n context?.refreshOption ?? (this.config.refreshOption || REFRESH_OPTION.LIVE);\n\n const { settings } = this.widgetControlService.resolveInlineControlSettings(\n this.widgetControls,\n displayMode,\n refreshOption\n );\n this.setInlineControlsSettings(settings);\n }\n\n /**\n * Main initialization logic for the component\n */\n private initializeComponent(): void {\n this.config$\n .pipe(\n take(1),\n tap(() => this.setupComponentState())\n )\n .subscribe();\n }\n\n /**\n * Sets up the initial component state\n */\n private setupComponentState(): void {\n this.setDefaultDisplayMode();\n this.initializeForm();\n this.setControlsVisibility(this._currentConfig);\n }\n\n /**\n * Sets up handling for config changes\n */\n private setupConfigChangeHandling(): void {\n this.config$\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n skip(1), // Skip the initial emission\n debounceTime(100),\n tap(config => {\n if (!config) {\n return;\n }\n this.setControlsVisibility(config);\n\n // Update form values with new config\n if (this.form) {\n this.form.patchValue(config, { emitEvent: false });\n }\n })\n )\n .subscribe();\n }\n\n /**\n * Builds the reactive form\n */\n private initializeForm(): void {\n if (this.form) {\n return;\n }\n this.form = this.globalContextFormService.buildForm(this.config || {});\n }\n\n /**\n * Sets default display mode if not provided\n */\n private setDefaultDisplayMode(): void {\n if (!this.config || 'displayMode' in this.config) {\n return;\n }\n this.config.displayMode = GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n }\n}\n","<!-- Main Controls -->\n@let isConfigMode = config?.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n@let settings = inlineControlsSettings$ | async;\n\n@if (form && settings) {\n <form\n class=\"d-flex gap-16 p-l-16 p-r-16 p-b-8 inner-scroll\"\n [formGroup]=\"form\"\n >\n <!-- Control Group Container -->\n <div class=\"input-group w-auto\">\n <!-- Aggregation Picker -->\n @if (settings.showAggregation) {\n <c8y-aggregation-picker\n formControlName=\"aggregation\"\n [resetToDefault]=\"true\"\n ></c8y-aggregation-picker>\n }\n\n <!-- Auto Refresh Controls -->\n @if (settings.showAutoRefresh) {\n <!-- Auto Refresh Toggle -->\n <c8y-auto-refresh-control\n [isLoading]=\"isLoading\"\n [disableCounter]=\"shouldDisableCounter\"\n formControlName=\"isAutoRefreshEnabled\"\n [autoRefreshSeconds]=\"form.get('refreshInterval')?.value\"\n ></c8y-auto-refresh-control>\n }\n\n @if (settings.showTimeContext) {\n @let isHistoryMode = form.get('refreshOption')?.value === REFRESH_OPTION.HISTORY;\n @let configValue =\n isHistoryMode\n ? {\n showDateTo: true,\n showDateFrom: true\n }\n : {\n showDateTo: false,\n showDateFrom: true\n };\n <c8y-date-time-context-picker\n style=\"margin-left: -1px\"\n formControlName=\"dateTimeContext\"\n [shouldDisableInterval]=\"shouldDisableCustomInterval\"\n [config]=\"configValue\"\n ></c8y-date-time-context-picker>\n }\n\n <!-- Manual Refresh Button -->\n @if (settings.showRefresh) {\n <div class=\"input-group-btn\">\n <button\n class=\"btn btn-default\"\n [attr.aria-label]=\"'Refresh' | translate\"\n [tooltip]=\"'Refresh' | translate\"\n placement=\"bottom\"\n type=\"button\"\n [adaptivePosition]=\"false\"\n [delay]=\"500\"\n [disabled]=\"isLoading\"\n >\n <i\n [class.icon-spin]=\"isLoading\"\n [c8yIcon]=\"'refresh'\"\n ></i>\n </button>\n </div>\n }\n </div>\n </form>\n}\n","// Export shared components\nexport * from './context-controls/context-controls.component';\nexport * from './preview-controls/preview-controls.component';\n","import { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, WidgetControls } from '../../models/global-context.model';\n\nexport const DEFAULT_WIDGET_TEMPLATE: WidgetControls = {\n supports: ['refreshOption', 'displayMode'],\n configSettings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: {},\n [REFRESH_OPTION.HISTORY]: {}\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showTimeContext: true,\n showAutoRefresh: true,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: { showTimeContext: true }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showTimeContext: true,\n showAutoRefresh: true,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: { showTimeContext: true }\n }\n },\n settings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: false\n },\n [REFRESH_OPTION.HISTORY]: { showTimeContext: false }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showRefresh: true,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true\n }\n }\n },\n defaultLinks: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: { isAutoRefreshEnabled: true, dateTimeContext: true },\n [REFRESH_OPTION.HISTORY]: { dateTimeContext: true }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {},\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {}\n }\n};\n","import { cloneDeep } from 'lodash-es';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport { LinkStatesMap } from '../../models/control-flow.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GlobalContextSettings,\n GlobalContextState,\n GlobalContextKeys,\n WidgetControls\n} from '../../models/global-context.model';\nimport { DEFAULT_WIDGET_TEMPLATE } from './default-widget-template';\n\nexport type WidgetFeature =\n | 'liveRefresh'\n | 'refreshInterval'\n | 'timeRange'\n | 'dataAggregation'\n | 'displayMode'\n | 'refreshOption'\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {}); // Allows custom strings while preserving autocomplete for known values\n\n/**\n * Maps user-friendly feature names to their corresponding GlobalContextState property names.\n *\n * This allows developers to use intuitive names like 'liveRefresh' in widget control definitions\n * instead of the actual internal property names like 'isAutoRefreshEnabled'.\n *\n * @example\n * ```ts\n * defineWidgetControls({ supports: ['liveRefresh'] });\n * // Internally maps to 'isAutoRefreshEnabled'\n * ```\n */\nexport const WIDGET_FEATURE_MAP: Record<string, string> = {\n liveRefresh: 'isAutoRefreshEnabled',\n refreshInterval: 'refreshInterval',\n timeRange: 'dateTimeContext',\n dataAggregation: 'aggregation',\n displayMode: 'displayMode',\n refreshOption: 'refreshOption'\n};\n\n/**\n * Hierarchical configuration for widget control visibility and behavior across different contexts.\n *\n * This interface defines control settings organized by:\n * - Display mode (dashboard/config/viewAndConfig)\n * - Refresh option (live/history)\n * - View context (inline/configuration)\n *\n * Each level can specify which controls to show/hide and their default link states to the\n * global context. The structure mirrors how widgets are rendered in different scenarios.\n *\n * @example\n * ```ts\n * const settings: WidgetControlSettings = {\n * dashboard: {\n * live: {\n * inline: { showRefresh: true, showRefreshInterval: false }\n * }\n * },\n * defaultLinks: {\n * dashboard: {\n * live: { dateTimeContext: true, aggregation: true }\n * }\n * }\n * };\n * ```\n */\nexport interface WidgetControlSettings {\n dashboard?: {\n live?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n history?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n };\n config?: {\n live?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n history?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n };\n viewAndConfig?: {\n live?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n history?: {\n inline?: Partial<GlobalContextSettings>;\n configuration?: Partial<GlobalContextSettings>;\n };\n };\n\n /**\n * Defines which widget config properties should be linked to global context by default.\n * When a property is linked (true), changes to the global context will automatically\n * update the widget's corresponding configuration value.\n */\n defaultLinks?: {\n dashboard?: {\n live?: LinkStatesMap;\n history?: LinkStatesMap;\n };\n config?: {\n live?: LinkStatesMap;\n history?: LinkStatesMap;\n };\n viewAndConfig?: {\n live?: LinkStatesMap;\n history?: LinkStatesMap;\n };\n };\n}\n\n/**\n * Handler function for dynamic widget control behavior based on widget state.\n *\n * Allows custom logic to transform control settings and link states based on the current\n * widget configuration. Handlers receive the widget state and return modified control\n * settings that determine which controls are visible and how they behave.\n *\n * Use cases:\n * - Conditionally show/hide controls based on widget config\n * - Modify default link states based on widget data\n * - Implement widget-specific control behavior\n *\n * @example\n * ```ts\n * const handler: WidgetControlHandler = {\n * handler: ({ config }) => {\n * // Hide aggregation control if widget has no series configured\n * const showAggregation = config?.datapoints?.length > 0;\n * return {\n * inlineControlSettings: { !showAggregation },\n * dashboardControlSettings: { showAggregation },\n * links: { aggregation: showAggregation }\n * };\n * }\n * };\n * ```\n */\nexport interface WidgetControlHandler {\n handler: (state: {\n config?: GlobalContextState;\n inlineControlSettings?: Partial<GlobalContextSettings>;\n dashboardControlSettings?: Partial<GlobalContextSettings>;\n currentLinks?: LinkStatesMap;\n }) => {\n inlineControlSettings: Partial<GlobalContextSettings>;\n dashboardControlSettings: Partial<GlobalContextSettings>;\n links: Partial<LinkStatesMap>;\n options?: { noAutoRefreshCounter?: boolean };\n };\n}\n\n/**\n * Creates a comprehensive widget controls configuration for global context integration.\n *\n * This factory function generates the complete control structure that determines how a widget\n * interacts with the global context (time range, aggregation, auto-refresh). It handles:\n * - Feature support declaration\n * - Control visibility across different display modes and refresh options\n * - Default linking behavior between widget and global context\n * - Dynamic control behavior through custom handlers\n *\n * @param config - Configuration object for widget controls\n * @param config.name - Optional identifier for debugging and documentation\n * @param config.extends - Base WidgetControls to extend from (inherits all features and settings)\n * @param config.supports - Array of features this widget supports (e.g., ['timeRange', 'dataAggregation'])\n * When extending, supports are merged with base supports\n * @param config.supportedModes - Optional array of supported refresh modes (live, history).\n * Restricts which modes are available in the configuration UI. Defaults to both modes if not specified.\n * @param config.settings - Hierarchical control settings organized by display mode, refresh option, and view context\n * @param config.handlers - Named functions for dynamic control behavior based on widget state\n * @param config.options - Additional options like noAutoRefreshCounter\n *\n * @returns Complete WidgetControls object ready for use in widget definitions\n *\n * @example\n * ```ts\n * // Simple widget with time range support\n * const controls = defineWidgetControls({\n * name: 'simple-widget',\n * supports: ['timeRange'],\n * settings: {\n * dashboard: {\n * live: {\n * inline: { showRefresh: true }\n * }\n * }\n * }\n * });\n *\n * // Widget that only supports live mode\n * const liveOnlyControls = defineWidgetControls({\n * name: 'realtime-widget',\n * supports: ['timeRange', 'liveRefresh'],\n * supportedModes: [REFRESH_OPTION.LIVE],\n * settings: {\n * dashboard: {\n * live: {\n * inline: { showRefresh: true, showRefreshInterval: true }\n * }\n * }\n * }\n * });\n *\n * // Advanced widget extending default with custom handler\n * const advancedControls = defineWidgetControls({\n * name: 'chart-widget',\n * extends: DEFAULT_WIDGET_TEMPLATE,\n * supports: ['timeRange', 'dataAggregation'],\n * handlers: {\n * onConfigChange: {\n * handler: ({ config }) => ({\n * inlineControlSettings: { showAggregation: config?.series?.length > 0 },\n * dashboardControlSettings: {},\n * links: {}\n * })\n * }\n * }\n * });\n * ```\n */\nexport function defineWidgetControls(config: {\n name?: string;\n extends?: WidgetControls;\n supports?: WidgetFeature[];\n supportedModes?: RefreshOption[];\n settings?: WidgetControlSettings;\n handlers?: Record<string, WidgetControlHandler>;\n options?: { noAutoRefreshCounter?: boolean };\n}): WidgetControls {\n const baseControls = config.extends\n ? cloneDeep(config.extends)\n : cloneDeep(DEFAULT_WIDGET_TEMPLATE);\n\n let mappedSupports: GlobalContextKeys;\n\n if (config.supports) {\n // First convert to a Set to handle potential duplicates\n const supportsSet = new Set(config.supports);\n\n // If liveRefresh is included, automatically add refreshInterval\n if (supportsSet.has('liveRefresh') && !supportsSet.has('refreshInterval')) {\n supportsSet.add('refreshInterval');\n }\n\n mappedSupports = Array.from(supportsSet).map(featureName => {\n return WIDGET_FEATURE_MAP[featureName as string] || featureName;\n }) as GlobalContextKeys;\n } else {\n mappedSupports = baseControls.supports;\n }\n\n const controls: WidgetControls = {\n ...baseControls,\n // When extending, merge the supports arrays instead of replacing\n supports: config.extends\n ? [...new Set([...baseControls.supports, ...mappedSupports])]\n : mappedSupports,\n supportedModes: config.supportedModes || baseControls.supportedModes,\n options: config.options || baseControls.options,\n configSettings: cloneDeep(baseControls.configSettings),\n settings: cloneDeep(baseControls.settings),\n defaultLinks: cloneDeep(baseControls.defaultLinks || {}),\n stateHandlers: {}\n };\n\n if (config.settings) {\n applySettings(controls, config.settings);\n }\n\n if (config.handlers) {\n controls.stateHandlers = processHandlers(config.handlers);\n }\n\n return controls;\n}\n\n/**\n * Transforms and applies hierarchical settings to the widget controls structure.\n *\n * Takes the simplified WidgetControlSettings format and distributes the configuration\n * across the complete WidgetControls structure, populating both inline (settings) and\n * configuration panel (configSettings) branches for each display mode and refresh option.\n *\n * This function also processes defaultLinks and ensures they are properly distributed\n * to match the control settings hierarchy.\n *\n * @param controls - The WidgetControls object to modify (mutated in place)\n * @param settings - The simplified settings configuration to apply\n *\n */\nfunction applySettings(controls: WidgetControls, settings: WidgetControlSettings): void {\n const modeMap = {\n dashboard: GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD,\n config: GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG,\n viewAndConfig: GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG\n };\n\n for (const [settingsKey, modeValue] of Object.entries(modeMap)) {\n const modeSettings = settings[settingsKey as keyof WidgetControlSettings];\n if (!modeSettings) continue;\n\n if (modeSettings['live']) {\n if (!controls.settings[modeValue]) controls.settings[modeValue] = {};\n if (!controls.settings[modeValue][REFRESH_OPTION.LIVE]) {\n controls.settings[modeValue][REFRESH_OPTION.LIVE] = {};\n }\n if (!controls.configSettings[modeValue]) controls.configSettings[modeValue] = {};\n if (!controls.configSettings[modeValue][REFRESH_OPTION.LIVE]) {\n controls.configSettings[modeValue][REFRESH_OPTION.LIVE] = {};\n }\n\n if (modeSettings['live'].inline) {\n controls.settings[modeValue][REFRESH_OPTION.LIVE] = {\n ...modeSettings['live'].inline\n };\n }\n\n if (modeSettings['live'].configuration) {\n controls.configSettings[modeValue][REFRESH_OPTION.LIVE] = {\n ...modeSettings['live'].configuration\n };\n }\n }\n\n if (modeSettings['history']) {\n if (!controls.settings[modeValue]) controls.settings[modeValue] = {};\n if (!controls.settings[modeValue][REFRESH_OPTION.HISTORY]) {\n controls.settings[modeValue][REFRESH_OPTION.HISTORY] = {};\n }\n if (!controls.configSettings[modeValue]) controls.configSettings[modeValue] = {};\n if (!controls.configSettings[modeValue][REFRESH_OPTION.HISTORY]) {\n controls.configSettings[modeValue][REFRESH_OPTION.HISTORY] = {};\n }\n\n if (modeSettings['history'].inline) {\n controls.settings[modeValue][REFRESH_OPTION.HISTORY] = {\n ...modeSettings['history'].inline\n };\n }\n\n if (modeSettings['history'].configuration) {\n controls.configSettings[modeValue][REFRESH_OPTION.HISTORY] = {\n ...modeSettings['history'].configuration\n };\n }\n }\n }\n\n if (settings.defaultLinks) {\n if (!controls.defaultLinks) controls.defaultLinks = {};\n\n for (const [settingsKey, modeValue] of Object.entries(modeMap)) {\n const modeLinks = settings.defaultLinks[settingsKey as keyof typeof settings.defaultLinks];\n if (!modeLinks) continue;\n\n if (!controls.defaultLinks[modeValue]) controls.defaultLinks[modeValue] = {};\n\n if (modeLinks['live']) {\n controls.defaultLinks[modeValue][REFRESH_OPTION.LIVE] = {\n ...modeLinks['live']\n };\n }\n\n if (modeLinks['history']) {\n controls.defaultLinks[modeValue][REFRESH_OPTION.HISTORY] = {\n ...modeLinks['history']\n };\n }\n }\n }\n}\n\n/**\n * Wraps user-defined handlers into the stateHandlers format expected by WidgetControls.\n *\n * This function transforms the simplified WidgetControlHandler format into the internal\n * stateHandlers structure. Each handler receives the current widget state and returns\n * modified control settings and link states.\n *\n * The wrapper ensures handlers are always invoked (even without widget state) and properly\n * propagates the widget state to the handler function for decision-making.\n *\n * @param handlers - Map of handler names to WidgetControlHandler definitions\n * @returns Map of handler names to wrapped functions compatible with WidgetControls.stateHandlers\n *\n */\nfunction processHandlers(\n handlers: Record<string, WidgetControlHandler>\n): WidgetControls['stateHandlers'] {\n const stateHandlers: WidgetControls['stateHandlers'] = {};\n\n for (const [name, handler] of Object.entries(handlers)) {\n stateHandlers[name] = (widgetState = {}) => {\n if (widgetState?.config) {\n return handler.handler(widgetState);\n }\n\n return handler.handler({});\n };\n }\n\n return stateHandlers;\n}\n","import { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, WidgetState } from '../../models/global-context.model';\n\n/**\n * Type alias for handler state parameter used in guards\n * Using WidgetState since GuardState is a subset of it\n */\nexport type GuardState = WidgetState;\n\n/**\n * Guard functions for widget control handlers.\n * These functions help determine conditions for when handlers should execute or return early.\n */\n\n/**\n * Check if the current display mode is dashboard\n */\nexport function isDashboard(state: GuardState): boolean {\n return state.config?.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n}\n\n/**\n * Check if the current display mode is config\n */\nexport function isConfig(state: GuardState): boolean {\n return state.config?.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG;\n}\n\n/**\n * Check if the current display mode is view and config\n */\nexport function isViewAndConfig(state: GuardState): boolean {\n return state.config?.displayMode === GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG;\n}\n\n/**\n * Check if the current refresh option is history\n */\nexport function isHistory(state: GuardState): boolean {\n return state.config?.refreshOption === REFRESH_OPTION.HISTORY;\n}\n\n/**\n * Check if the current refresh option is live\n */\nexport function isLive(state: GuardState): boolean {\n return state.config?.refreshOption === REFRESH_OPTION.LIVE;\n}\n\n/**\n * Check if dateTimeContext is linked\n */\nexport function isDateTimeContextLinked(state: GuardState): boolean {\n return state.currentLinks?.dateTimeContext === true;\n}\n\n/**\n * Check if dateTimeContext is unlinked\n */\nexport function isDateTimeContextUnlinked(state: GuardState): boolean {\n return state.currentLinks?.dateTimeContext === false;\n}\n\n/**\n * Check if aggregation is linked\n */\nexport function isAggregationLinked(state: GuardState): boolean {\n return state.currentLinks?.aggregation === true;\n}\n\n/**\n * Check if aggregation is unlinked\n */\nexport function isAggregationUnlinked(state: GuardState): boolean {\n return state.currentLinks?.aggregation === false;\n}\n\n/**\n * Check if auto-refresh is enabled (linked)\n */\nexport function isAutoRefreshEnabled(state: GuardState): boolean {\n return state.currentLinks?.isAutoRefreshEnabled === true;\n}\n\n/**\n * Check if auto-refresh is disabled (unlinked)\n */\nexport function isAutoRefreshDisabled(state: GuardState): boolean {\n return state.currentLinks?.isAutoRefreshEnabled === false;\n}\n\n/**\n * Namespace for all guard functions\n */\nexport const guards = {\n isDashboard,\n isConfig,\n isViewAndConfig,\n isHistory,\n isLive,\n isDateTimeContextLinked,\n isDateTimeContextUnlinked,\n isAggregationLinked,\n isAggregationUnlinked,\n isAutoRefreshEnabled,\n isAutoRefreshDisabled\n} as const;\n","import { LinkStatesMap } from '../../models/control-flow.model';\nimport {\n GlobalContextSettings,\n WidgetState,\n WidgetStateHandlerResult\n} from '../../models/global-context.model';\nimport { guards } from './guards';\n\n/**\n * Updates both inline and dashboard control settings simultaneously.\n *\n * @param state - Current widget state containing existing settings\n * @param inlineUpdates - Settings to apply to inline display mode\n * @param dashboardUpdates - Settings to apply to dashboard display mode\n * @returns Updated inline and dashboard control settings\n */\nexport function updateBothSettings(\n state: WidgetState,\n inlineUpdates: Partial<GlobalContextSettings>,\n dashboardUpdates: Partial<GlobalContextSettings>\n): Pick<WidgetStateHandlerResult, 'inlineControlSettings' | 'dashboardControlSettings'> {\n return {\n inlineControlSettings: {\n ...state.inlineControlSettings,\n ...inlineUpdates\n },\n dashboardControlSettings: {\n ...state.dashboardControlSettings,\n ...dashboardUpdates\n }\n };\n}\n\n/**\n * Creates a standardized result object for widget state handler responses.\n *\n * @param inlineSettings - Settings for inline display mode\n * @param dashboardSettings - Settings for dashboard display mode\n * @param links - Optional link state mappings for control synchronization\n * @param options - Optional configuration like noAutoRefreshCounter\n * @returns Standardized widget state handler result\n */\nexport function createResult(\n inlineSettings: Partial<GlobalContextSettings>,\n dashboardSettings: Partial<GlobalContextSettings>,\n links: Partial<LinkStatesMap> = {},\n options?: Record<string, unknown>\n): WidgetStateHandlerResult {\n return {\n inlineControlSettings: inlineSettings,\n dashboardControlSettings: dashboardSettings,\n links,\n options\n };\n}\n\n/**\n * Sets auto-refresh link state for dashboard display mode.\n *\n * @param state - Current widget state\n * @param enabled - Whether auto-refresh should be linked to global context\n * @returns Updated link states (empty object for non-dashboard modes)\n */\nexport function setAutoRefreshLinks(state: WidgetState, enabled: boolean): Partial<LinkStatesMap> {\n // Only dashboard mode supports auto-refresh linking\n if (!guards.isDashboard(state)) {\n return {};\n }\n return {\n ...state.currentLinks,\n isAutoRefreshEnabled: enabled\n };\n}\n\n/**\n * Sets auto-refresh control visibility and link state based on display mode.\n *\n * Implements inverse visibility pattern: auto-refresh is shown in dashboard mode\n * (where it can be linked) and hidden in inline mode (where widgets handle it directly).\n *\n * @param state - Current widget state\n * @param showInDashboard - Whether to show auto-refresh control in dashboard mode (inverted for inline)\n * @returns Complete widget state handler result with settings and links\n */\nexport function setAutoRefreshControlsVisibility(\n state: WidgetState,\n showInDashboard: boolean\n): WidgetStateHandlerResult {\n const settings = updateBothSettings(\n state,\n {\n showAutoRefresh: !showInDashboard\n },\n {\n showAutoRefresh: showInDashboard\n }\n );\n\n return createResult(\n settings.inlineControlSettings,\n settings.dashboardControlSettings,\n setAutoRefreshLinks(state, showInDashboard)\n );\n}\n","import { cloneDeep, merge } from 'lodash-es';\n\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n type GlobalContextKeys,\n type WidgetControls,\n type WidgetState\n} from '../../models/global-context.model';\nimport { guards } from './guards';\nimport {\n createResult,\n setAutoRefreshControlsVisibility,\n updateBothSettings\n} from './update-helpers';\n\nexport type PartialWidgetControls = Partial<WidgetControls> & { supports?: GlobalContextKeys };\n\n/**\n * Baseline control template used by most widgets. Mirrors the alarm list\n * widget behaviour and serves as the foundation for additional presets.\n *\n * @returns Partial widget controls describing the baseline template.\n */\nexport function buildBaselineControls(): PartialWidgetControls {\n return {\n supports: [\n 'refreshOption',\n 'displayMode',\n 'dateTimeContext',\n 'isAutoRefreshEnabled',\n 'refreshInterval'\n ] as GlobalContextKeys,\n settings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showTimeContext: true,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showTimeContext: false,\n showRefreshInterval: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showRefresh: true,\n showTimeContext: false\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showRefreshInterval: true,\n showTimeContext: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true\n }\n }\n },\n configSettings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showRefreshInterval: true,\n showTimeContext: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true,\n showAggregation: false\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.LIVE]: {\n showAutoRefresh: true,\n showRefreshInterval: true,\n showTimeContext: true\n },\n [REFRESH_OPTION.HISTORY]: {\n showTimeContext: true,\n showAggregation: false\n }\n }\n },\n defaultLinks: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.LIVE]: {\n dateTimeContext: true,\n isAutoRefreshEnabled: true\n },\n [REFRESH_OPTION.HISTORY]: {\n dateTimeContext: true\n }\n }\n },\n stateHandlers: createAutoRefreshHandlers()\n };\n}\n\n/**\n * Adds aggregation visibility and default link behaviour on top of the\n * baseline template.\n *\n * @returns Partial widget controls that enable aggregation.\n */\nexport function buildAggregationExtensions(): PartialWidgetControls {\n return {\n supports: ['aggregation'] as GlobalContextKeys,\n settings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n }\n },\n configSettings: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n },\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: {\n [REFRESH_OPTION.HISTORY]: {\n showAggregation: true\n }\n }\n },\n defaultLinks: {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: {\n [REFRESH_OPTION.HISTORY]: {\n dateTimeContext: true,\n aggregation: true\n }\n }\n }\n };\n}\n\n/**\n * Returns a deep-merged copy of the baseline and supplied partial overrides,\n * unionising supported keys and concatenating handlers.\n *\n * @param base Source template to extend.\n * @param addition Additional partial overrides to apply.\n * @returns Combined partial controls.\n */\nexport function mergePartialControls(\n base: PartialWidgetControls,\n addition: PartialWidgetControls\n): PartialWidgetControls {\n const result: PartialWidgetControls = cloneDeep(base);\n\n if (addition.supports?.length) {\n const supports = new Set(result.supports ?? []);\n addition.supports.forEach(support => supports.add(support));\n result.supports = Array.from(supports) as GlobalContextKeys;\n }\n\n if (addition.options) {\n result.options = { ...(result.options ?? {}), ...addition.options };\n }\n\n if (addition.settings) {\n result.settings = merge({}, result.settings ?? {}, addition.settings);\n }\n\n if (addition.configSettings) {\n result.configSettings = merge({}, result.configSettings ?? {}, addition.configSettings);\n }\n\n if (addition.defaultLinks) {\n result.defaultLinks = merge({}, result.defaultLinks ?? {}, addition.defaultLinks);\n }\n\n if (addition.stateHandlers) {\n result.stateHandlers = {\n ...(result.stateHandlers ?? {}),\n ...addition.stateHandlers\n };\n }\n\n return result;\n}\n\n/**\n * Factory returning scroll-friendly auto-refresh handlers used by multiple\n * presets.\n *\n * @returns Handler map compatible with {@link WidgetControls.stateHandlers}.\n */\nexport function createAutoRefreshHandlers() {\n return {\n enableAutoRefresh: (state: WidgetState) => enableAutoRefreshHandler(state),\n disableAutoRefresh: (state: WidgetState) => disableAutoRefreshHandler(state)\n };\n}\n\nfunction enableAutoRefreshHandler(state: WidgetState) {\n if (\n guards.isDateTimeContextUnlinked(state) ||\n guards.isAutoRefreshEnabled(state) ||\n guards.isHistory(state)\n ) {\n return createResult(\n state.inlineControlSettings ?? {},\n state.dashboardControlSettings ?? {},\n state.currentLinks ?? {}\n );\n }\n\n if (guards.isConfig(state) || guards.isViewAndConfig(state)) {\n const settings = updateBothSettings(\n state,\n { showAutoRefresh: true, showRefreshInterval: false },\n { showAutoRefresh: false }\n );\n return createResult(settings.inlineControlSettings, settings.dashboardControlSettings, {});\n }\n\n return setAutoRefreshControlsVisibility(state, true);\n}\n\nfunction disableAutoRefreshHandler(state: WidgetState) {\n if (guards.isAutoRefreshDisabled(state) || guards.isHistory(state)) {\n return createResult(\n state.inlineControlSettings ?? {},\n state.dashboardControlSettings ?? {},\n state.currentLinks ?? {}\n );\n }\n\n return setAutoRefreshControlsVisibility(state, false);\n}\n","import { cloneDeep } from 'lodash-es';\n\nimport { type WidgetControls } from '../../models/global-context.model';\nimport { DEFAULT_WIDGET_TEMPLATE } from './default-widget-template';\nimport {\n buildAggregationExtensions,\n buildBaselineControls,\n createAutoRefreshHandlers,\n mergePartialControls,\n type PartialWidgetControls\n} from './widget-controls-presets.helpers';\n\n/**\n * Identifier for a built-in widget controls preset. Each preset encapsulates a\n * reusable configuration that can be composed with others.\n */\nexport type WidgetPresetName = 'default' | 'defaultWithAggregation' | 'scrollHandlers';\n\n/**\n * Union describing how presets can be selected. Consumers can provide an\n * ordered array (preserving order of application) or a flag map where truthy\n * entries are included in insertion order.\n */\nexport type WidgetPresetSelection = WidgetPresetName[] | Partial<Record<WidgetPresetName, boolean>>;\n\n/** Structure supplied when presets should be expanded into `WidgetControls`. */\nexport interface WidgetControlsPresetConfig {\n presets: WidgetPresetSelection;\n customize?: (controls: WidgetControls) => WidgetControls;\n}\n\ntype WidgetControlsPresetDefinition = {\n name: WidgetPresetName;\n exclusiveGroup?: string;\n build: () => PartialWidgetControls;\n};\n\nconst PRESET_REGISTRY: Record<WidgetPresetName, WidgetControlsPresetDefinition> = {\n default: {\n name: 'default',\n exclusiveGroup: 'baseline',\n build: () => buildBaselineControls()\n },\n defaultWithAggregation: {\n name: 'defaultWithAggregation',\n exclusiveGroup: 'baseline',\n build: () => mergePartialControls(buildBaselineControls(), buildAggregationExtensions())\n },\n scrollHandlers: {\n name: 'scrollHandlers',\n build: () => ({ stateHandlers: createAutoRefreshHandlers() })\n }\n};\n\nexport function resolveWidgetControlsInput(\n input: WidgetControls | WidgetControlsPresetConfig\n): WidgetControls {\n if (isPresetConfig(input)) {\n return buildWidgetControlsFromPresets(input);\n }\n return input;\n}\n\n/**\n * Creates a fully hydrated {@link WidgetControls} by expanding the selected\n * presets (and optional customiser) against the default template.\n *\n * @param config Preset selection descriptor optionally providing a customize hook.\n * @returns Fully merged widget controls ready for consumption.\n */\nexport function buildWidgetControlsFromPresets(config: WidgetControlsPresetConfig): WidgetControls {\n const presetNames = normalizePresetSelection(config.presets);\n const definitions = presetNames.map(resolvePreset);\n\n warnForExclusiveConflicts(definitions);\n\n let built: WidgetControls = definitions.reduce<WidgetControls>((controls, definition) => {\n return mergeWidgetControls(controls, definition.build());\n }, cloneDeep(DEFAULT_WIDGET_TEMPLATE));\n\n if (config.customize) {\n built = config.customize(built);\n }\n\n return cloneDeep(built);\n}\n\n/**\n * Merges partial control metadata into a cloned base instance, unionising the\n * supported keys array and deep-merging nested settings/link structures.\n *\n * @param base Starting widget controls template.\n * @param addition Partial controls to merge into the template.\n * @returns Combined widget controls instance.\n */\nfunction mergeWidgetControls(\n base: WidgetControls,\n addition: PartialWidgetControls\n): WidgetControls {\n // Reuse the existing mergePartialControls function to avoid code duplication\n return mergePartialControls(base as PartialWidgetControls, addition) as WidgetControls;\n}\n\n/**\n * Normalises caller input to a deduplicated, ordered preset array.\n *\n * @param selection Value supplied to the presets API.\n * @returns Ordered list of preset identifiers without duplicates.\n */\nfunction normalizePresetSelection(selection: WidgetPresetSelection): WidgetPresetName[] {\n if (Array.isArray(selection)) {\n return dedupe(selection);\n }\n\n return dedupe(\n Object.entries(selection)\n .filter(([, enabled]) => Boolean(enabled))\n .map(([name]) => name as WidgetPresetName)\n );\n}\n\n/**\n * Removes duplicate preset names while preserving the first occurrence.\n *\n * @param values Sequence of preset identifiers.\n * @returns Deduplicated preset array.\n */\nfunction dedupe(values: WidgetPresetName[]): WidgetPresetName[] {\n const seen = new Set<WidgetPresetName>();\n const ordered: WidgetPresetName[] = [];\n\n for (const value of values) {\n if (!seen.has(value)) {\n ordered.push(value);\n seen.add(value);\n }\n }\n\n return ordered;\n}\n\n/**\n * Retrieves the preset definition or throws if it does not exist.\n *\n * @param name Name of the preset to resolve.\n * @returns Preset definition from the registry.\n */\nfunction resolvePreset(name: WidgetPresetName): WidgetControlsPresetDefinition {\n const definition = PRESET_REGISTRY[name];\n\n if (!definition) {\n throw new Error(`Unknown widget controls preset: ${name}`);\n }\n\n return definition;\n}\n\n/**\n * Emits a console warning whenever multiple presets from the same\n * `exclusiveGroup` are composed, signalling that later presets override\n * earlier ones.\n *\n * @param definitions Preset definitions selected for the current build.\n */\nfunction warnForExclusiveConflicts(definitions: WidgetControlsPresetDefinition[]): void {\n const groups = new Map<string, string>();\n\n definitions.forEach(definition => {\n if (!definition.exclusiveGroup) {\n return;\n }\n\n if (groups.has(definition.exclusiveGroup)) {\n const existing = groups.get(definition.exclusiveGroup);\n console.warn(\n `Widget controls preset \"${definition.name}\" overrides preset \"${existing}\" (exclusive group: ${definition.exclusiveGroup}).`\n );\n }\n\n groups.set(definition.exclusiveGroup, definition.name);\n });\n}\n\nfunction isPresetConfig(\n input: WidgetControls | WidgetControlsPresetConfig\n): input is WidgetControlsPresetConfig {\n return typeof (input as WidgetControlsPresetConfig)?.presets !== 'undefined';\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n ContentChild,\n DestroyRef,\n effect,\n EventEmitter,\n inject,\n input,\n OnInit,\n Output,\n signal,\n TemplateRef,\n untracked,\n ViewChild,\n WritableSignal\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { DashboardChildComponent } from '@c8y/ngx-components';\nimport { isEmpty, merge, pick } from 'lodash-es';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { Subject, throttleTime } from 'rxjs';\nimport { GlobalContextInlineComponent } from '../../core/global-context-inline.component';\nimport { GlobalContextWidgetConfigComponent } from '../../core/global-context-widget-config.component';\nimport { TIMING } from '../../models/constants';\nimport type { LinkStatesMap } from '../../models/control-flow.model';\nimport type {\n GlobalContextEvent,\n GlobalContextState,\n WidgetControls,\n WidgetDisplayMode\n} from '../../models/global-context.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n WIDGET_DISPLAY_MODE\n} from '../../models/global-context.model';\nimport { GlobalContextUtilsService } from '../../services/infrastructure/global-context-utils.service';\nimport { PreviewControlsComponent } from '../../shared/preview-controls';\nimport {\n formatDateTimeContextForEmission,\n isCompleteDateTimeContext\n} from '../../utils/global-context-defaults.util';\nimport { resolveWidgetControlsInput, type WidgetControlsPresetConfig } from '../widget-controls';\nimport { REFRESH_OPTION } from '../../models';\n\n@Component({\n selector: 'c8y-global-context-widget-wrapper',\n host: { class: 'sticky-top bg-component d-block min-width-0' },\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n GlobalContextInlineComponent,\n GlobalContextWidgetConfigComponent,\n NgTemplateOutlet,\n ReactiveFormsModule,\n PopoverModule,\n PreviewControlsComponent\n ],\n template: `\n @if (widgetControls()) {\n @let GLOBAL_CONTEXT_CONFIG = internalConfig();\n @let INLINE = WIDGET_DISPLAY_MODE.INLINE;\n @let CONFIG = WIDGET_DISPLAY_MODE.CONFIG;\n @let PREVIEW = WIDGET_DISPLAY_MODE.PREVIEW;\n @let DISPLAY_MODE = GLOBAL_CONTEXT_CONFIG?.displayMode;\n @let DASHBOARD = GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n\n @switch (displayMode()) {\n @case (INLINE) {\n <c8y-global-context-inline\n #globalContextInlineRef=\"globalContextInline\"\n [config]=\"GLOBAL_CONTEXT_CONFIG\"\n [widgetControls]=\"widgetControls()\"\n [isLoading]=\"isLoading()\"\n [dashboardChildForLegacy]=\"dashboardChildForLegacy()\"\n (refresh)=\"onRefresh()\"\n (globalContextChange)=\"onGlobalContextChange($event)\"\n >\n <ng-content></ng-content>\n <ng-container\n id=\"header\"\n [ngTemplateOutlet]=\"widgetHeaderRef\"\n [ngTemplateOutletInjector]=\"globalContextInlineRef.injector\"\n ></ng-container>\n <ng-container\n id=\"body\"\n [ngTemplateOutlet]=\"widgetBodyRef\"\n [ngTemplateOutletInjector]=\"globalContextInlineRef.injector\"\n ></ng-container>\n </c8y-global-context-inline>\n }\n @case (CONFIG) {\n <c8y-global-context-widget-config\n [config]=\"GLOBAL_CONTEXT_CONFIG\"\n [widgetControls]=\"widgetControls()\"\n [isLoading]=\"isLoading()\"\n (refresh)=\"onRefresh()\"\n (globalContextChange)=\"onGlobalContextChange($event)\"\n ></c8y-global-context-widget-config>\n }\n @case (PREVIEW) {\n <c8y-preview-controls\n [config]=\"GLOBAL_CONTEXT_CONFIG\"\n [widgetControls]=\"widgetControls()\"\n ></c8y-preview-controls>\n }\n }\n }\n `\n})\nexport class GlobalContextWidgetWrapperComponent implements OnInit {\n @ContentChild('widgetBody') widgetBodyRef!: TemplateRef<unknown>;\n @ContentChild('widgetHeader') widgetHeaderRef!: TemplateRef<unknown>;\n @ViewChild(GlobalContextInlineComponent)\n globalContextInlineComponent!: GlobalContextInlineComponent;\n\n // --- Services ---\n private readonly destroyRef = inject(DestroyRef);\n private readonly globalContextUtilsService = inject(GlobalContextUtilsService);\n\n // --- Inputs ---\n isLoading = input(false);\n displayMode = input<WidgetDisplayMode>(WIDGET_DISPLAY_MODE.INLINE);\n readonly widgetControlsConfig = input.required<WidgetControls | WidgetControlsPresetConfig>({\n alias: 'widgetControls'\n });\n widgetControls = computed(() => resolveWidgetControlsInput(this.widgetControlsConfig()));\n controlLinks = input<LinkStatesMap>({});\n dashboardChildForLegacy = input<DashboardChildComponent>();\n config = input<GlobalContextState>({});\n\n // --- State Management ---\n internalConfig: WritableSignal<GlobalContextState> = signal({});\n // Latest global snapshot cached for child config updates on mode change\n private widgetInitialConfig: GlobalContextState | null = null;\n // Last emitted state - used for diff calculation to avoid race conditions\n private lastEmittedState: WritableSignal<GlobalContextState> = signal({});\n\n // --- Outputs ---\n @Output() globalContextChange = new EventEmitter<GlobalContextEvent>();\n private readonly contextChangeSubject = new Subject<{\n context: GlobalContextState;\n diff: GlobalContextState;\n }>();\n\n // --- Constants for Template Binding ---\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n readonly WIDGET_DISPLAY_MODE = WIDGET_DISPLAY_MODE;\n\n constructor() {\n // Effect to reactively handle changes to the `config` input signal.\n effect(() => {\n const newConfig = this.config();\n // This effect runs whenever the `config` input changes.\n // `untracked` prevents the effect from re-running when `internalConfig` is updated inside the handler.\n untracked(() => this.handleConfigChange(newConfig));\n });\n }\n\n ngOnInit(): void {\n this.contextChangeSubject\n .pipe(throttleTime(TIMING.CONTEXT_THROTTLE), takeUntilDestroyed(this.destroyRef))\n .subscribe(({ context, diff }) => {\n this.globalContextChange.emit(structuredClone({ context, diff }));\n });\n }\n\n /**\n * Update dateTimeContext for internal widget interactions (e.g., slider drag).\n * This bypasses the config propagation logic and directly updates the inline component state.\n */\n updateDateTimeContext(dateTimeContext: any): void {\n this.globalContextInlineComponent?.updateDateTimeContext(dateTimeContext);\n }\n\n /**\n * Directly toggle all link controls to linked or unlinked state.\n * All controls are always toggled together as a unified group.\n *\n * @param isLinked - True to link all controls, false to unlink all controls\n * @param suppressRefresh - True to prevent refresh emission (data already loaded)\n * @param suppressEmit - True to prevent configuration change emission\n */\n toggleAllLinks(isLinked: boolean, suppressRefresh?: boolean, suppressEmit?: boolean): void {\n this.globalContextInlineComponent?.toggleAllLinks(isLinked, suppressRefresh, suppressEmit);\n }\n\n /**\n * Pause auto-refresh and unlink all controls from global context.\n * Useful when user is interacting with the widget (e.g., scrolling through a list)\n * and you want to prevent automatic updates.\n *\n * This does two things:\n * 1. Sets isAutoRefreshEnabled to false (stops the auto-refresh timer)\n * 2. Unlinks all controls (dateTimeContext, aggregation, isAutoRefreshEnabled)\n * from global context as they work as a unified group\n */\n pauseAutoRefresh(): void {\n this.globalContextInlineComponent?.pauseAutoRefresh();\n }\n\n /**\n * Resume auto-refresh and re-link all controls to global context.\n * Useful when user has finished interacting with the widget (e.g., scrolled back to top)\n * and you want to re-enable automatic updates.\n *\n * This does two things:\n * 1. Sets isAutoRefreshEnabled to true (starts the auto-refresh timer)\n * 2. Links all controls (dateTimeContext, aggregation, isAutoRefreshEnabled)\n * to global context as they work as a unified group\n */\n resumeAutoRefresh(): void {\n this.globalContextInlineComponent?.resumeAutoRefresh();\n }\n\n onGlobalContextChange(context: GlobalContextState): void {\n const template = this.widgetControls();\n\n // OVERRIDE CONTROLS BASED ON WIDGET MODE\n // Ensure aggregation is null in live mode BEFORE calculating diff\n // TODO: consider updating inline component to handle this logic.\n // Edge case: widget supports aggregation. In history mode, user selects aggregation different than null.\n // Then switches to live mode.\n // Second scenario: legacy widget migration where aggregation was set in config.\n const normalizedContext = { ...context };\n if (normalizedContext.refreshOption === REFRESH_OPTION.LIVE) {\n normalizedContext.aggregation = null;\n }\n\n // Use lastEmittedState instead of internalConfig to avoid race conditions\n // where handleConfigChange updates internalConfig before the inline component emits\n const previousState = this.lastEmittedState();\n const diff = this.globalContextUtilsService.getChangedFields(previousState, normalizedContext);\n\n const filteredContext = pick(normalizedContext, template.supports);\n const filteredDiff = pick(diff, template.supports);\n const formattedContext = formatDateTimeContextForEmission(filteredContext, template.supports);\n\n // Update lastEmittedState to track what we just emitted\n this.lastEmittedState.set(formattedContext);\n // Also update internalConfig to keep it in sync (for backward compatibility)\n this.internalConfig.update(cfg => ({ ...cfg, ...formattedContext }));\n this.contextChangeSubject.next({ context: formattedContext, diff: filteredDiff });\n }\n\n onRefresh(): void {\n this.onGlobalContextChange(this.internalConfig());\n }\n\n /**\n * Handles incoming config changes from the input, calculates the diff,\n * and updates the internal state.\n */\n private handleConfigChange(config: GlobalContextState): void {\n const controls = this.widgetControls();\n if (isEmpty(config) || !controls) {\n return;\n }\n\n const newState = pick(config, controls.supports);\n const diff = this.globalContextUtilsService.getChangedFields(this.internalConfig(), newState);\n\n const processedDiff = this._processConfigDiff(diff);\n if (isEmpty(processedDiff)) {\n return;\n }\n\n // Update the signal state immutably.\n this.internalConfig.update(cfg => merge({}, cfg, processedDiff));\n\n // the widget enters config mode. This provides a consistent \"reset\" point for the user.\n if (!this.widgetInitialConfig && this.displayMode() === WIDGET_DISPLAY_MODE.CONFIG) {\n this.widgetInitialConfig = structuredClone(this.internalConfig());\n }\n }\n\n /**\n * Pure helper function to process the configuration diff, applying special business\n * logic, like handling incomplete dateTimeContext.\n */\n private _processConfigDiff(diff: Partial<GlobalContextState>): Partial<GlobalContextState> {\n if (isEmpty(diff)) {\n return {};\n }\n\n // Preserves the critical business logic of preventing updates from an incomplete date-time range.\n if (!isCompleteDateTimeContext(diff)) {\n const { dateTimeContext: _dateTimeContext, ...restDiff } = diff;\n return restDiff;\n }\n\n return diff;\n }\n}\n","import { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GlobalContextDisplayMode,\n GlobalContextSettings\n} from '../../models/global-context.model';\n\nexport type DisplayMode = GlobalContextDisplayMode;\n\n/** Context control feature constants for type-safe access */\nexport const CONTEXT_FEATURE = {\n /** Time range selector for live mode (relative time window that moves with current time) */\n LIVE_TIME: 'liveTime',\n /** Time range selector for history mode (fixed date range for historical analysis) */\n HISTORY_TIME: 'historyTime',\n /** Data aggregation options (hourly, daily, etc.) - history mode only */\n AGGREGATION: 'aggregation',\n /** Auto-refresh toggle (fixed 5s interval) - live mode only */\n AUTO_REFRESH: 'autoRefresh',\n /** Manual refresh button */\n REFRESH: 'refresh'\n} as const;\n\nexport type ContextFeature = (typeof CONTEXT_FEATURE)[keyof typeof CONTEXT_FEATURE];\n\n/** Preset name constants for type-safe access */\nexport const PRESET_NAME = {\n DEFAULT: 'default',\n ALARM_LIST: 'alarmList',\n CHART: 'chart',\n LIVE_ONLY: 'liveOnly',\n HISTORY_ONLY: 'historyOnly',\n ALARM_LIST_CONFIG: 'alarmListConfig',\n ALARM_LIST_LEGACY: 'alarmListLegacy'\n} as const;\n\nexport type PresetName = (typeof PRESET_NAME)[keyof typeof PRESET_NAME];\n\nexport type PresetDefinition = {\n [GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD]: ContextFeature[];\n [GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG]: ContextFeature[];\n [GLOBAL_CONTEXT_DISPLAY_MODE.VIEW_AND_CONFIG]: ContextFeature[];\n};\n\n/** Control presets for different widget types (mode constraints applied by applyModeConstraints) */\nexport const CONTROL_PRESETS: Record<PresetName, PresetDefinition> = {\n /** Full-featured preset for most widgets (supports both live and history modes) */\n [PRESET_NAME.DEFAULT]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [CONTEXT_FEATURE.LIVE_TIME, CONTEXT_FEATURE.HISTORY_TIME, CONTEXT_FEATURE.AUTO_REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH,\n CONTEXT_FEATURE.AGGREGATION,\n CONTEXT_FEATURE.REFRESH\n ]\n },\n\n /** For alarm/event lists (supports both live and history modes) */\n [PRESET_NAME.ALARM_LIST]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [CONTEXT_FEATURE.AUTO_REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ]\n },\n\n /** For alarm/event lists in config mode (supports both live and history modes with time in config) */\n [PRESET_NAME.ALARM_LIST_CONFIG]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH,\n CONTEXT_FEATURE.AGGREGATION\n ],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ]\n },\n\n /** For charts with aggregation support (supports both live and history modes) */\n [PRESET_NAME.CHART]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [CONTEXT_FEATURE.LIVE_TIME, CONTEXT_FEATURE.HISTORY_TIME, CONTEXT_FEATURE.AUTO_REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AGGREGATION,\n CONTEXT_FEATURE.AUTO_REFRESH,\n CONTEXT_FEATURE.REFRESH\n ]\n },\n\n /** For live-only widgets (no history mode support) */\n [PRESET_NAME.LIVE_ONLY]: {\n dashboard: [CONTEXT_FEATURE.LIVE_TIME, CONTEXT_FEATURE.AUTO_REFRESH],\n config: [CONTEXT_FEATURE.LIVE_TIME, CONTEXT_FEATURE.AUTO_REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH,\n CONTEXT_FEATURE.REFRESH\n ]\n },\n\n /** For history-only widgets (no live mode support) */\n [PRESET_NAME.HISTORY_ONLY]: {\n dashboard: [CONTEXT_FEATURE.HISTORY_TIME],\n config: [CONTEXT_FEATURE.HISTORY_TIME, CONTEXT_FEATURE.AGGREGATION],\n view_and_config: [\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AGGREGATION,\n CONTEXT_FEATURE.REFRESH\n ]\n },\n [PRESET_NAME.ALARM_LIST_LEGACY]: {\n dashboard: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ],\n config: [CONTEXT_FEATURE.AUTO_REFRESH, CONTEXT_FEATURE.REFRESH],\n view_and_config: [\n CONTEXT_FEATURE.LIVE_TIME,\n CONTEXT_FEATURE.HISTORY_TIME,\n CONTEXT_FEATURE.AUTO_REFRESH\n ]\n }\n};\n\n/**\n * Apply mode constraints (hard rules) to filter controls based on refresh option.\n *\n * @param controls - Array of control features\n * @param refreshOption - Current refresh option (REFRESH_OPTION.LIVE or REFRESH_OPTION.HISTORY)\n * @returns Filtered array with mode constraints applied\n */\nexport function applyModeConstraints(\n controls: ContextFeature[],\n refreshOption: RefreshOption\n): ContextFeature[] {\n if (refreshOption === REFRESH_OPTION.HISTORY) {\n // History mode: no auto-refresh, no live time\n return controls.filter(\n c => c !== CONTEXT_FEATURE.AUTO_REFRESH && c !== CONTEXT_FEATURE.LIVE_TIME\n );\n }\n if (refreshOption === REFRESH_OPTION.LIVE) {\n // Live mode: no aggregation, no history time\n return controls.filter(\n c => c !== CONTEXT_FEATURE.AGGREGATION && c !== CONTEXT_FEATURE.HISTORY_TIME\n );\n }\n return controls;\n}\n\n/**\n * Get supported modes from a preset definition.\n * Modes are derived from features:\n * - LIVE mode: supported if preset has AUTO_REFRESH (LIVE_TIME is optional)\n * - HISTORY mode: supported if preset has HISTORY_TIME\n *\n * @param controls - Preset name or definition\n * @param displayMode - Current display mode\n * @returns Array of supported refresh options\n */\nexport function getSupportedModes(\n controls: PresetName | PresetDefinition,\n displayMode: DisplayMode\n): RefreshOption[] {\n const presetDef = typeof controls === 'string' ? CONTROL_PRESETS[controls] : controls;\n const features = presetDef[displayMode];\n const modes: RefreshOption[] = [];\n\n // Support LIVE if has autoRefresh (with optional liveTime)\n if (features.includes(CONTEXT_FEATURE.AUTO_REFRESH)) {\n modes.push(REFRESH_OPTION.LIVE);\n }\n\n // Support HISTORY if has historyTime\n if (features.includes(CONTEXT_FEATURE.HISTORY_TIME)) {\n modes.push(REFRESH_OPTION.HISTORY);\n }\n\n // Fallback to LIVE if no mode features detected\n return modes.length > 0 ? modes : [REFRESH_OPTION.LIVE];\n}\n\n/**\n * Convert controls preset to GlobalContextSettings for registration.\n */\nexport function controlsToSettings(\n controls: PresetName | PresetDefinition,\n displayMode: DisplayMode,\n refreshOption: RefreshOption\n): Partial<GlobalContextSettings> {\n const presetDef = typeof controls === 'string' ? CONTROL_PRESETS[controls] : controls;\n const activeControls = applyModeConstraints(presetDef[displayMode], refreshOption);\n\n return {\n showTimeContext:\n activeControls.includes(CONTEXT_FEATURE.LIVE_TIME) ||\n activeControls.includes(CONTEXT_FEATURE.HISTORY_TIME),\n showAutoRefresh: activeControls.includes(CONTEXT_FEATURE.AUTO_REFRESH),\n showRefreshInterval: false,\n showAggregation: activeControls.includes(CONTEXT_FEATURE.AGGREGATION),\n showRefresh: activeControls.includes(CONTEXT_FEATURE.REFRESH)\n };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n inject,\n input,\n OnInit,\n output,\n signal,\n untracked\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe } from '@c8y/ngx-components';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { ConfigContextSelectorComponent } from '../../features/configuration/config-context-selector';\nimport { ConfigurationControlsComponent } from '../../features/configuration/configuration-controls/configuration-controls.component';\nimport { REFRESH_OPTION, RefreshOption } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GLOBAL_CONTEXT_EVENTS,\n GlobalContextDisplayMode,\n GlobalContextState\n} from '../../models/global-context.model';\nimport { GlobalContextUtilsService } from '../../services/infrastructure/global-context-utils.service';\nimport { GlobalContextEventService } from '../../services/state/global-context-event.service';\nimport {\n controlsToSettings,\n getSupportedModes,\n PRESET_NAME,\n PresetDefinition,\n PresetName\n} from '../presets/control-presets';\n\n@Component({\n selector: 'c8y-config-mode-controls',\n standalone: true,\n imports: [\n ReactiveFormsModule,\n ConfigContextSelectorComponent,\n ConfigurationControlsComponent,\n C8yTranslatePipe,\n PopoverModule\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <form>\n <fieldset class=\"c8y-fieldset\">\n <legend>\n {{ 'Time context' | translate }}\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"\n 'Sync with dashboard settings or set independent time controls for this widget.'\n | translate\n \"\n placement=\"right\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n [adaptivePosition]=\"true\"\n ></button>\n </legend>\n <c8y-config-context-selector\n [formControl]=\"displayModeControl\"\n ></c8y-config-context-selector>\n </fieldset>\n </form>\n\n @if (displayMode() !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n <fieldset class=\"c8y-fieldset p-l-0 p-r-0 p-t-16\">\n <legend class=\"m-l-16\">{{ 'Widget time context' | translate }}</legend>\n <c8y-configuration-controls\n [settings]=\"settings()\"\n [controlsDisplayMode]=\"'horizontal'\"\n [tabsOutletName]=\"'verticalTabOutletForConfigurationModes'\"\n [activeMode]=\"refreshOption()\"\n [liveContext]=\"liveState()\"\n [historyContext]=\"historyState()\"\n [supportedModes]=\"supportedModes()\"\n (contextChange)=\"onConfigurationChange($event)\"\n (refreshOptionChange)=\"onRefreshOptionChange($event)\"\n ></c8y-configuration-controls>\n </fieldset>\n }\n `\n})\nexport class ConfigModeControls implements OnInit {\n private readonly destroyRef = inject(DestroyRef);\n private readonly globalContextUtils = inject(GlobalContextUtilsService);\n private readonly globalContextEventService = inject(GlobalContextEventService);\n\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n config = input.required<GlobalContextState>();\n\n configChange = output<{ context: GlobalContextState; diff: GlobalContextState }>();\n\n displayModeControl = new FormControl<GlobalContextDisplayMode>(\n GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD,\n { nonNullable: true }\n );\n readonly GLOBAL_CONTEXT_DISPLAY_MODE = GLOBAL_CONTEXT_DISPLAY_MODE;\n\n displayMode = signal<GlobalContextDisplayMode>(GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD);\n refreshOption = signal<RefreshOption>(REFRESH_OPTION.LIVE);\n liveState = signal<GlobalContextState | null>(null);\n historyState = signal<GlobalContextState | null>(null);\n private lastEmittedContext = signal<GlobalContextState>({});\n\n settings = computed(() =>\n controlsToSettings(this.controls(), this.displayMode(), this.refreshOption())\n );\n\n supportedModes = computed(() => getSupportedModes(this.controls(), this.displayMode()));\n\n constructor() {\n // Sync with incoming config\n effect(() => {\n const cfg = this.config();\n if (!cfg) return;\n\n untracked(() => {\n const mode =\n (cfg.displayMode as GlobalContextDisplayMode) ?? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n if (this.displayModeControl.value !== mode) {\n this.displayModeControl.setValue(mode, { emitEvent: false });\n this.displayMode.set(mode);\n }\n\n const refreshOpt = cfg.refreshOption ?? REFRESH_OPTION.LIVE;\n this.refreshOption.set(refreshOpt);\n\n if (refreshOpt === REFRESH_OPTION.LIVE) {\n this.liveState.set({ ...cfg });\n } else {\n this.historyState.set({ ...cfg });\n }\n\n this.lastEmittedContext.set(cfg);\n });\n });\n }\n\n ngOnInit(): void {\n this.displayModeControl.valueChanges\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(mode => {\n this.displayMode.set(mode);\n this.emitForDisplayMode(mode);\n });\n\n this.emitInitialState();\n }\n\n onRefreshOptionChange(option: RefreshOption): void {\n this.refreshOption.set(option);\n const snapshot = option === REFRESH_OPTION.LIVE ? this.liveState() : this.historyState();\n\n const context: GlobalContextState = {\n ...(snapshot ?? this.config()),\n refreshOption: option,\n displayMode: this.displayMode(),\n aggregation: option === REFRESH_OPTION.LIVE ? null : (snapshot ?? this.config()).aggregation\n };\n\n this.emit(context);\n }\n\n onConfigurationChange(changes: Partial<GlobalContextState>): void {\n const context: GlobalContextState = {\n ...this.config(),\n ...changes,\n refreshOption: this.refreshOption(),\n displayMode: this.displayMode()\n };\n\n // Update snapshot for current mode\n if (this.refreshOption() === REFRESH_OPTION.LIVE) {\n this.liveState.set({ ...context });\n } else {\n this.historyState.set({ ...context });\n }\n\n this.emit(context);\n }\n\n private emitInitialState(): void {\n const cfg = this.config();\n if (!cfg) return;\n\n const mode =\n (cfg.displayMode as GlobalContextDisplayMode) ?? GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;\n const context: GlobalContextState =\n mode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD\n ? this.getGlobalContextState(mode)\n : { ...cfg, isGlobalContextReady: true };\n\n this.lastEmittedContext.set(context);\n this.configChange.emit({ context, diff: context });\n }\n\n private emitForDisplayMode(mode: GlobalContextDisplayMode): void {\n if (mode === GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {\n this.emit(this.getGlobalContextState(mode));\n } else {\n const snapshot =\n this.refreshOption() === REFRESH_OPTION.LIVE ? this.liveState() : this.historyState();\n this.emit({ ...(snapshot ?? this.config()), displayMode: mode, isGlobalContextReady: true });\n }\n }\n\n private emit(context: GlobalContextState): void {\n const diff = this.globalContextUtils.getChangedFields(this.lastEmittedContext(), context);\n if (Object.keys(diff).length === 0) return;\n\n this.lastEmittedContext.set(context);\n this.configChange.emit({ context, diff });\n }\n\n private getGlobalContextState(mode: GlobalContextDisplayMode): GlobalContextState {\n const globalState = this.globalContextEventService.getLatestValue(\n GLOBAL_CONTEXT_EVENTS.STATE_CHANGE\n ) as GlobalContextState | undefined;\n\n return globalState\n ? {\n displayMode: mode,\n dateTimeContext: globalState.dateTimeContext,\n refreshOption: globalState.refreshOption,\n aggregation: globalState.aggregation,\n isAutoRefreshEnabled: globalState.isAutoRefreshEnabled,\n refreshInterval: globalState.refreshInterval,\n isGlobalContextReady: true\n }\n : { displayMode: mode, isGlobalContextReady: true };\n }\n}\n","import { Component, computed, effect, inject, input, output, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { C8yTranslatePipe, IconDirective } from '@c8y/ngx-components';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { AggregationPickerComponent } from '../../features/aggregation/aggregation-picker/aggregation-picker.component';\nimport { AutoRefreshControlComponent } from '../../features/refresh/auto-refresh/auto-refresh-control.component';\nimport { DateTimeContextPickerComponent } from '../../features/time-context/time-range-picker/date-time-context-picker.component';\nimport { AggregationOptionStatus } from '../../models/aggregation.model';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GlobalContextState } from '../../models/global-context.model';\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport { GLOBAL_CONTEXT_DEFAULTS } from '../../models/global-context-defaults';\nimport { AggregationValidationService } from '../../services/domain/aggregation-validation.service';\nimport { GlobalContextUtilsService } from '../../services/infrastructure/global-context-utils.service';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\nimport {\n applyModeConstraints,\n CONTEXT_FEATURE,\n CONTROL_PRESETS,\n DisplayMode,\n PresetDefinition,\n PresetName,\n PRESET_NAME\n} from '../presets/control-presets';\n\n@Component({\n selector: 'c8y-context-controls',\n standalone: true,\n imports: [\n ReactiveFormsModule,\n DateTimeContextPickerComponent,\n AggregationPickerComponent,\n AutoRefreshControlComponent,\n IconDirective,\n C8yTranslatePipe,\n TooltipModule\n ],\n template: `\n <form\n class=\"d-flex gap-16 p-l-16 p-r-16 p-b-8 inner-scroll h-auto min-width-0 widget-controls\"\n [formGroup]=\"form\"\n >\n <div class=\"input-group w-auto\">\n @if (visibleControls().includes('aggregation')) {\n <c8y-aggregation-picker\n formControlName=\"aggregation\"\n [disabledAggregations]=\"disabledAggregations()\"\n [resetToDefault]=\"true\"\n >\n </c8y-aggregation-picker>\n }\n\n @if (visibleControls().includes('autoRefresh')) {\n <c8y-auto-refresh-control\n formControlName=\"isAutoRefreshEnabled\"\n [autoRefreshSeconds]=\"autoRefreshSeconds()\"\n [isLoading]=\"isLoading()\"\n (refresh)=\"onRefresh()\"\n >\n </c8y-auto-refresh-control>\n }\n\n @if (visibleControls().includes('time')) {\n <c8y-date-time-context-picker\n style=\"margin-left: -1px\"\n formControlName=\"dateTimeContext\"\n [config]=\"dateTimePickerConfig()\"\n >\n </c8y-date-time-context-picker>\n }\n\n @if (visibleControls().includes('refresh')) {\n <div class=\"input-group-btn\">\n <button\n class=\"btn btn-default\"\n [attr.aria-label]=\"'Refresh' | translate\"\n [tooltip]=\"'Refresh' | translate\"\n placement=\"bottom\"\n container=\"body\"\n type=\"button\"\n [delay]=\"500\"\n [disabled]=\"isLoading()\"\n (click)=\"onRefresh()\"\n data-cy=\"widget-controls--refresh-button\"\n >\n <i [class.icon-spin]=\"isLoading()\" [c8yIcon]=\"'refresh'\"></i>\n </button>\n </div>\n }\n </div>\n </form>\n `\n})\nexport class ContextControlsComponent {\n private fb = inject(FormBuilder);\n private aggregationValidationService = inject(AggregationValidationService);\n private globalContextUtils = inject(GlobalContextUtilsService);\n\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n displayMode = input<DisplayMode>(GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD);\n config = input.required<GlobalContextState>();\n isLoading = input<boolean>(false);\n configChange = output<{ context: GlobalContextState; diff: GlobalContextState }>();\n refresh = output<void>();\n\n form: FormGroup;\n private lastEmittedState = signal<GlobalContextState>({});\n\n /**\n * Visible controls for the template.\n * LIVE_TIME and HISTORY_TIME are normalized to 'time' for template simplicity.\n */\n visibleControls = computed(() => {\n const controlsInput = this.controls();\n const presetDef =\n typeof controlsInput === 'string' ? CONTROL_PRESETS[controlsInput] : controlsInput;\n const baseControls = presetDef[this.displayMode()];\n const refreshOption = this.config().refreshOption || REFRESH_OPTION.LIVE;\n const filteredControls = applyModeConstraints(baseControls, refreshOption);\n\n // Normalize LIVE_TIME/HISTORY_TIME to 'time' for template\n return filteredControls.map(c =>\n c === CONTEXT_FEATURE.LIVE_TIME || c === CONTEXT_FEATURE.HISTORY_TIME ? 'time' : c\n );\n });\n\n disabledAggregations = computed((): AggregationOptionStatus => {\n const dateCtx = this.config().dateTimeContext;\n if (!dateCtx) return {};\n\n const [from, to] = this.parseDateRange(dateCtx);\n return this.aggregationValidationService.getDisabledAggregations([from, to]);\n });\n\n dateTimePickerConfig = computed(() => {\n const refreshOption = this.config().refreshOption;\n return refreshOption === REFRESH_OPTION.HISTORY\n ? { showDateFrom: true, showDateTo: true }\n : { showDateFrom: true, showDateTo: false };\n });\n\n autoRefreshSeconds = computed(\n () => this.config().refreshInterval || GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL\n );\n\n constructor() {\n this.form = this.fb.group({\n dateTimeContext: [null],\n aggregation: [null],\n isAutoRefreshEnabled: [false],\n refreshInterval: [GLOBAL_CONTEXT_DEFAULTS.REFRESH_INTERVAL],\n refreshOption: [GLOBAL_CONTEXT_DEFAULTS.REFRESH_OPTION]\n });\n\n this.syncConfigToForm();\n this.subscribeToFormChanges();\n }\n\n onRefresh(): void {\n const { dateTimeContext } = this.config();\n if (!dateTimeContext) {\n this.refresh.emit();\n return;\n }\n\n const context = {\n ...this.config(),\n dateTimeContext: DateTimeContextUtil.normalizeForLive(dateTimeContext)\n };\n\n if (!this.emitIfChanged(context)) {\n this.refresh.emit();\n }\n }\n\n /** Emits configChange if context differs from last emitted state. Returns true if emitted. */\n private emitIfChanged(context: GlobalContextState): boolean {\n const diff = this.globalContextUtils.getChangedFields(this.lastEmittedState(), context);\n if (Object.keys(diff).length === 0) return false;\n\n this.lastEmittedState.set(context);\n this.configChange.emit({ context, diff });\n return true;\n }\n\n private syncConfigToForm(): void {\n effect(() => {\n const cfg = this.config();\n this.form.patchValue(cfg, { emitEvent: false });\n this.lastEmittedState.set(this.form.value as GlobalContextState);\n });\n }\n\n private subscribeToFormChanges(): void {\n this.form.valueChanges.pipe(takeUntilDestroyed()).subscribe(value => {\n const context = this.clearInvalidAggregation(value as GlobalContextState);\n this.emitIfChanged(context);\n });\n }\n\n /** Clears aggregation if in LIVE mode or invalid for current time range (HISTORY mode). */\n private clearInvalidAggregation(context: GlobalContextState): GlobalContextState {\n const { aggregation, dateTimeContext, refreshOption } = context;\n if (!aggregation) return context;\n\n // LIVE mode doesn't support aggregation\n if (refreshOption === REFRESH_OPTION.LIVE) {\n this.form.patchValue({ aggregation: null }, { emitEvent: false });\n return { ...context, aggregation: null };\n }\n\n // HISTORY mode: validate aggregation for time range\n if (!dateTimeContext) return context;\n\n const [from, to] = this.parseDateRange(dateTimeContext);\n const disabledAggs = this.aggregationValidationService.getDisabledAggregations([from, to]);\n if (disabledAggs[aggregation]) {\n this.form.patchValue({ aggregation: null }, { emitEvent: false });\n return { ...context, aggregation: null };\n }\n return context;\n }\n\n private parseDateRange(dateCtx: {\n dateFrom?: string | Date;\n dateTo?: string | Date;\n }): [Date, Date] {\n const from =\n typeof dateCtx.dateFrom === 'string' ? new Date(dateCtx.dateFrom) : dateCtx.dateFrom;\n const to = typeof dateCtx.dateTo === 'string' ? new Date(dateCtx.dateTo) : dateCtx.dateTo;\n return [from as Date, to as Date];\n }\n}\n","import {\n AfterViewInit,\n Component,\n computed,\n inject,\n input,\n OnDestroy,\n output,\n TemplateRef,\n ViewChild\n} from '@angular/core';\nimport { C8yTranslatePipe, DashboardChildComponent, IconDirective } from '@c8y/ngx-components';\nimport { TranslateService } from '@ngx-translate/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GlobalContextState } from '../../models/global-context.model';\nimport {\n applyModeConstraints,\n CONTROL_PRESETS,\n PRESET_NAME,\n PresetDefinition,\n PresetName\n} from '../presets/control-presets';\nimport { REFRESH_OPTION } from '../../models';\n\ninterface ControlDisplay {\n key: string;\n stateKey: string;\n cssClass: string;\n icon: string;\n label: string;\n}\n\n// Map preset controls to state keys\nconst CONTROL_DISPLAY_CONFIG: Record<string, ControlDisplay> = {\n liveTime: {\n key: 'liveTime',\n stateKey: 'dateTimeContext',\n cssClass: 'time-context',\n label: gettext('date/time'),\n icon: 'calendar'\n },\n historyTime: {\n key: 'historyTime',\n stateKey: 'dateTimeContext',\n cssClass: 'time-context',\n label: gettext('date/time'),\n icon: 'calendar'\n },\n aggregation: {\n key: 'aggregation',\n stateKey: 'aggregation',\n cssClass: 'aggregation',\n label: gettext('aggregation'),\n icon: 'input'\n },\n autoRefresh: {\n key: 'autoRefresh',\n stateKey: 'isAutoRefreshEnabled',\n cssClass: 'auto-refresh',\n label: gettext('auto refresh'),\n icon: 'refresh'\n }\n};\n\n@Component({\n selector: 'c8y-link-buttons',\n standalone: true,\n imports: [IconDirective, TooltipModule, C8yTranslatePipe],\n template: `\n <ng-template #headerContent>\n <button\n class=\"btn-icon-dot-set\"\n [class.active]=\"isLinked()\"\n [attr.aria-label]=\"'Global context sync controls' | translate\"\n [tooltip]=\"masterTooltipTemplate\"\n delay=\"500\"\n container=\"body\"\n (click)=\"toggle.emit(!isLinked())\"\n data-cy=\"global-context-link--all\"\n >\n <span class=\"btn-icon-dot__item default\" [class.active]=\"isLinked()\">\n <i [c8yIcon]=\"isLinked() ? 'link' : 'unlink'\"></i>\n </span>\n @for (control of visibleControls(); track control.stateKey) {\n <span\n [class]=\"control.cssClass + ' btn-icon-dot__item'\"\n [class.active]=\"isLinked()\"\n [attr.data-cy]=\"'global-context-link--' + control.stateKey\"\n >\n <i [c8yIcon]=\"control.icon\"></i>\n </span>\n }\n </button>\n <ng-template #masterTooltipTemplate>{{ masterTooltipText() }}</ng-template>\n </ng-template>\n `\n})\nexport class LinkButtonsComponent implements AfterViewInit, OnDestroy {\n private injectedDashboardChild = inject(DashboardChildComponent, { optional: true });\n private translateService = inject(TranslateService);\n\n @ViewChild('headerContent', { static: true, read: TemplateRef })\n private headerTemplateRef?: TemplateRef<unknown>;\n\n dashboardChild = input<DashboardChildComponent>();\n isLinked = input.required<boolean>();\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n config = input<GlobalContextState>({});\n\n toggle = output<boolean>();\n\n visibleControls = computed(() => {\n const controlsInput = this.controls();\n const presetDef =\n typeof controlsInput === 'string' ? CONTROL_PRESETS[controlsInput] : controlsInput;\n const refreshOption = this.config().refreshOption || REFRESH_OPTION.LIVE;\n const dashboardControls = presetDef[GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD];\n const activeControls = applyModeConstraints(dashboardControls, refreshOption);\n\n return activeControls.map(key => CONTROL_DISPLAY_CONFIG[key]).filter(Boolean);\n });\n\n masterTooltipText = computed<string>(() => {\n const controls = this.visibleControls();\n const clickToToggleLabel = this.translateService.instant(gettext('(click to toggle)'));\n\n if (!this.isLinked()) {\n const usingWidgetCustomTimeSettingsLabel = this.translateService.instant(\n gettext('Using widget custom time settings')\n );\n return `${usingWidgetCustomTimeSettingsLabel}\\n${clickToToggleLabel}`;\n }\n\n const linkedNames = controls.map(control => this.translateService.instant(control.label));\n\n const formatter = new Intl.ListFormat(\n this.translateService.getCurrentLang()?.replace('_', '-'),\n {\n type: 'conjunction'\n }\n );\n const linkedNamesList = formatter.format(linkedNames);\n const linkedToDashboardLabel = this.translateService.instant(gettext('Synced to dashboard:'));\n return `${linkedToDashboardLabel}\\n${linkedNamesList}\\n${clickToToggleLabel}`;\n });\n\n ngAfterViewInit(): void {\n const dashChild = this.getDashboardChild();\n\n if (dashChild && this.headerTemplateRef) {\n const headers = dashChild.additionalHeaderTemplates;\n if (!headers.includes(this.headerTemplateRef)) {\n headers.push(this.headerTemplateRef);\n }\n }\n }\n\n ngOnDestroy(): void {\n const dashChild = this.getDashboardChild();\n\n if (dashChild && this.headerTemplateRef) {\n const idx = dashChild.additionalHeaderTemplates.indexOf(this.headerTemplateRef);\n if (idx >= 0) {\n dashChild.additionalHeaderTemplates.splice(idx, 1);\n }\n }\n }\n\n private getDashboardChild(): DashboardChildComponent | null {\n return this.dashboardChild() ?? this.injectedDashboardChild ?? null;\n }\n}\n","import { Component, DestroyRef, effect, inject, input, output, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { DashboardChildComponent } from '@c8y/ngx-components';\nimport { EMPTY, merge, Subscription } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\nimport { REFRESH_OPTION } from '../../models/auto-refresh.model';\nimport {\n GLOBAL_CONTEXT_DISPLAY_MODE,\n GLOBAL_CONTEXT_EVENTS,\n GlobalContextState\n} from '../../models/global-context.model';\nimport { GlobalContextEventService } from '../../services/state/global-context-event.service';\nimport { GlobalContextService } from '../../services/state/global-context.service';\nimport { GlobalContextUtilsService } from '../../services/infrastructure/global-context-utils.service';\nimport { DateTimeContextUtil } from '../../utils/date-time-context.util';\nimport { ContextControlsComponent } from '../context-controls/context-controls.component';\nimport { LinkButtonsComponent } from '../link-buttons/link-buttons.component';\nimport {\n controlsToSettings,\n PresetDefinition,\n PresetName,\n PRESET_NAME\n} from '../presets/control-presets';\n\n@Component({\n selector: 'c8y-global-context-connector',\n standalone: true,\n imports: [ContextControlsComponent, LinkButtonsComponent],\n template: `\n <c8y-link-buttons\n [dashboardChild]=\"dashboardChild()\"\n [isLinked]=\"isLinked()\"\n [controls]=\"controls()\"\n [config]=\"config()\"\n (toggle)=\"onLinkToggle($event)\"\n ></c8y-link-buttons>\n\n @if (!isLinked()) {\n <c8y-context-controls\n [controls]=\"controls()\"\n displayMode=\"dashboard\"\n [config]=\"config()\"\n [isLoading]=\"isLoading()\"\n (configChange)=\"onLocalChange($event)\"\n (refresh)=\"onLocalRefresh()\"\n ></c8y-context-controls>\n }\n `\n})\nexport class GlobalContextConnectorComponent {\n private eventService = inject(GlobalContextEventService);\n private globalContextService = inject(GlobalContextService);\n private globalContextUtils = inject(GlobalContextUtilsService);\n private destroyRef = inject(DestroyRef);\n private lastEmittedState = signal<GlobalContextState>({});\n\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n config = input.required<GlobalContextState>();\n isLoading = input<boolean>(false);\n dashboardChild = input.required<DashboardChildComponent>();\n linked = input<boolean | undefined>(undefined);\n\n configChange = output<{ context: GlobalContextState; diff: GlobalContextState }>();\n refresh = output<void>();\n\n isLinked = signal(true);\n\n constructor() {\n this.syncExternalLinkState();\n this.subscribeToGlobalContext();\n this.registerWithGlobalContext();\n this.trackLoadingState();\n\n this.destroyRef.onDestroy(() => {\n this.globalContextService.unregister(this.componentId);\n this.globalContextService.unregisterLoading(this.componentId);\n });\n }\n\n onLinkToggle(linked: boolean): void {\n this.isLinked.set(linked);\n if (linked) {\n const cached = this.eventService.getLatestValue(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE);\n if (cached) this.emitIfChanged(cached as GlobalContextState);\n }\n }\n\n onLocalChange(event: { context: GlobalContextState; diff: GlobalContextState }): void {\n this.lastEmittedState.set(event.context);\n this.configChange.emit(event);\n }\n\n onLocalRefresh(): void {\n const { dateTimeContext } = this.config();\n if (!dateTimeContext) {\n this.refresh.emit();\n return;\n }\n\n const context = {\n ...this.config(),\n dateTimeContext: DateTimeContextUtil.normalizeForLive(dateTimeContext)\n };\n\n if (!this.emitIfChanged(context)) {\n this.refresh.emit();\n }\n }\n\n /** Emits configChange if context differs from last emitted state. Returns true if emitted. */\n private emitIfChanged(context: GlobalContextState): boolean {\n const diff = this.globalContextUtils.getChangedFields(this.lastEmittedState(), context);\n if (Object.keys(diff).length === 0) return false;\n\n this.lastEmittedState.set(context);\n this.configChange.emit({ context, diff });\n return true;\n }\n\n private get componentId(): string {\n const data = this.dashboardChild()['data'];\n return data.id;\n }\n\n private syncExternalLinkState(): void {\n effect(() => {\n const external = this.linked();\n if (external !== undefined) this.isLinked.set(external);\n });\n }\n\n private subscribeToGlobalContext(): void {\n let subscription: Subscription | null = null;\n\n effect(() => {\n subscription?.unsubscribe();\n if (!this.isLinked()) return;\n\n const cached = this.eventService.getLatestValue(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE);\n if (cached) this.emitIfChanged(cached as GlobalContextState);\n\n const stateChanges$ = this.eventService.on(GLOBAL_CONTEXT_EVENTS.STATE_CHANGE);\n const refresh$ = this.eventService.on(GLOBAL_CONTEXT_EVENTS.REFRESH).pipe(\n map(\n data =>\n ({\n ...this.config(),\n dateTimeContext: {\n dateFrom: data.dateFrom,\n dateTo: data.dateTo,\n interval: data.interval\n }\n }) as GlobalContextState\n )\n );\n\n subscription = merge(stateChanges$, refresh$)\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n catchError(() => EMPTY)\n )\n .subscribe(state => {\n if (state) this.emitIfChanged(state as GlobalContextState);\n });\n });\n }\n\n private registerWithGlobalContext(): void {\n effect(() => {\n if (this.isLinked()) {\n const settings = controlsToSettings(\n this.controls(),\n GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD,\n this.config().refreshOption || REFRESH_OPTION.LIVE\n );\n this.globalContextService.register(this.componentId, settings);\n } else {\n this.globalContextService.unregister(this.componentId);\n }\n });\n }\n\n private trackLoadingState(): void {\n effect(() => {\n const shouldTrack = this.isLinked() && this.isLoading();\n if (shouldTrack) {\n this.globalContextService.registerLoading(this.componentId);\n } else {\n this.globalContextService.unregisterLoading(this.componentId);\n }\n });\n }\n}\n","import { Component, input, output } from '@angular/core';\nimport { GLOBAL_CONTEXT_DISPLAY_MODE, GlobalContextState } from '../../models/global-context.model';\nimport { ContextControlsComponent } from '../context-controls/context-controls.component';\nimport { DisplayMode, PresetDefinition, PresetName, PRESET_NAME } from '../presets/control-presets';\n\n@Component({\n selector: 'c8y-local-controls',\n standalone: true,\n imports: [ContextControlsComponent],\n host: {\n 'data-local-controls': 'true',\n '[class.disabled]': 'disabled()'\n },\n styles: [\n `\n .disabled-overlay {\n position: relative;\n cursor: not-allowed;\n }\n .disabled-overlay::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 10;\n }\n `\n ],\n template: `\n <div [class.disabled-overlay]=\"disabled()\">\n <c8y-context-controls\n [controls]=\"controls()\"\n [displayMode]=\"displayMode()\"\n [config]=\"config()\"\n [isLoading]=\"isLoading()\"\n (configChange)=\"configChange.emit($event)\"\n (refresh)=\"refresh.emit()\"\n ></c8y-context-controls>\n </div>\n `\n})\nexport class LocalControlsComponent {\n controls = input<PresetName | PresetDefinition>(PRESET_NAME.DEFAULT);\n displayMode = input<DisplayMode>(GLOBAL_CONTEXT_DISPLAY_MODE.CONFIG);\n config = input.required<GlobalContextState>();\n isLoading = input<boolean>(false);\n disabled = input<boolean>(false);\n\n configChange = output<{ context: GlobalContextState; diff: GlobalContextState }>();\n refresh = output<void>();\n}\n","/** @deprecated Use LocalControlsComponent or GlobalContextConnectorComponent instead */\nexport * from './widget-wrapper';\n/** @deprecated Use LocalControlsComponent or GlobalContextConnectorComponent instead */\nexport * from './widget-controls';\n\nexport * from './config-mode-controls';\nexport * from './global-context-connector';\nexport * from './link-buttons';\nexport * from './local-controls';\nexport * from './presets';\n","import { NgModule } from '@angular/core';\nimport { hookActionBar } from '@c8y/ngx-components';\nimport { GlobalContextNavigationService } from './services/infrastructure/global-context-navigation.service';\n\n@NgModule({\n declarations: [],\n imports: [],\n exports: [],\n providers: [hookActionBar(GlobalContextNavigationService)]\n})\nexport class GlobalContextModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DateTimeContextPickerService","i1","i3","i2","FormsModule","filter","ContextControlsComponent","tap","sanitizeLocalStateHelper","sanitizeGlobalStateHelper","resolveWidgetDisplayModeHelper","mapToContextDisplayModeHelper","resolveVisibilityContextInternalHelper","handleFormChangeHelper","handleGlobalStateChangeHelper","executeHandlerHelper","validateAggregationLinkUtil","deriveAggregationValueUtil","resolveAggregationChangeForFormHelper","syncSourcesForRefreshOptionHelper","resolveAutoUnlinkAggregationChangeHelper","applyAggregationChangesForGlobalStateHelper","ensureDateTimeContextHelper","syncLocalEntriesWithGlobalHelper","deriveDisabledAggregationsHelper","buildControlLinkConfigHelper","calculateDisabledAggregationsFromContextHelper","handleLinkToggleHelper","toggleAllLinksHelper","applyConfigOverrideHelper","buildWidgetStateHelper","applyHandlerResultHelper","distinctUntilChanged","handleGlobalRefreshHelper","processRefreshEventHelper","getShouldDisableIntervalConfigHelper","patchFormValuesHelper","applyLocalAggregationChangeHelper","updateAggregationValueHelper","map","merge"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,MAAM,qBAAqB,GAAG;AACnC,IAAA,YAAY,EAAE,6BAA6B;AAC3C,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,qBAAqB,EAAE,sCAAsC;AAC7D,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,6BAA6B,EAAE,+BAA+B;AAC9D,IAAA,mBAAmB,EAAE;;IAGX;AAAZ,CAAA,UAAY,2BAA2B,EAAA;AACrC,IAAA,2BAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,2BAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,2BAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC;AACrC,CAAC,EAJW,2BAA2B,KAA3B,2BAA2B,GAAA,EAAA,CAAA,CAAA;IAkG3B;AAAZ,CAAA,UAAY,0BAA0B,EAAA;AACpC,IAAA,0BAAA,CAAA,mBAAA,CAAA,GAAA,iBAAqC;AACrC,IAAA,0BAAA,CAAA,iBAAA,CAAA,GAAA,eAAiC;AACjC,IAAA,0BAAA,CAAA,uBAAA,CAAA,GAAA,qBAA6C;AAC7C,IAAA,0BAAA,CAAA,0BAAA,CAAA,GAAA,wBAAmD;AACnD,IAAA,0BAAA,CAAA,2BAAA,CAAA,GAAA,0BAAsD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