@gooddata/sdk-ui-dashboard 11.49.0-alpha.0 → 11.49.0

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.
Files changed (92) hide show
  1. package/esm/__version.d.ts +1 -1
  2. package/esm/__version.d.ts.map +1 -1
  3. package/esm/__version.js +1 -1
  4. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertFormState.d.ts +64 -0
  5. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertFormState.d.ts.map +1 -0
  6. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertFormState.js +221 -0
  7. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.d.ts +22 -23
  8. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.d.ts.map +1 -1
  9. package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.js +15 -160
  10. package/esm/presentation/localization/bundles/de-DE.localization-bundle.d.ts +2 -0
  11. package/esm/presentation/localization/bundles/de-DE.localization-bundle.d.ts.map +1 -1
  12. package/esm/presentation/localization/bundles/de-DE.localization-bundle.js +2 -0
  13. package/esm/presentation/localization/bundles/en-AU.localization-bundle.d.ts +2 -0
  14. package/esm/presentation/localization/bundles/en-AU.localization-bundle.d.ts.map +1 -1
  15. package/esm/presentation/localization/bundles/en-AU.localization-bundle.js +2 -0
  16. package/esm/presentation/localization/bundles/en-GB.localization-bundle.d.ts +2 -0
  17. package/esm/presentation/localization/bundles/en-GB.localization-bundle.d.ts.map +1 -1
  18. package/esm/presentation/localization/bundles/en-GB.localization-bundle.js +2 -0
  19. package/esm/presentation/localization/bundles/es-419.localization-bundle.d.ts +2 -0
  20. package/esm/presentation/localization/bundles/es-419.localization-bundle.d.ts.map +1 -1
  21. package/esm/presentation/localization/bundles/es-419.localization-bundle.js +2 -0
  22. package/esm/presentation/localization/bundles/es-ES.localization-bundle.d.ts +2 -0
  23. package/esm/presentation/localization/bundles/es-ES.localization-bundle.d.ts.map +1 -1
  24. package/esm/presentation/localization/bundles/es-ES.localization-bundle.js +2 -0
  25. package/esm/presentation/localization/bundles/fi-FI.localization-bundle.d.ts +2 -0
  26. package/esm/presentation/localization/bundles/fi-FI.localization-bundle.d.ts.map +1 -1
  27. package/esm/presentation/localization/bundles/fi-FI.localization-bundle.js +2 -0
  28. package/esm/presentation/localization/bundles/fr-CA.localization-bundle.d.ts +2 -0
  29. package/esm/presentation/localization/bundles/fr-CA.localization-bundle.d.ts.map +1 -1
  30. package/esm/presentation/localization/bundles/fr-CA.localization-bundle.js +2 -0
  31. package/esm/presentation/localization/bundles/fr-FR.localization-bundle.d.ts +2 -0
  32. package/esm/presentation/localization/bundles/fr-FR.localization-bundle.d.ts.map +1 -1
  33. package/esm/presentation/localization/bundles/fr-FR.localization-bundle.js +2 -0
  34. package/esm/presentation/localization/bundles/id-ID.localization-bundle.d.ts +2 -0
  35. package/esm/presentation/localization/bundles/id-ID.localization-bundle.d.ts.map +1 -1
  36. package/esm/presentation/localization/bundles/id-ID.localization-bundle.js +2 -0
  37. package/esm/presentation/localization/bundles/it-IT.localization-bundle.d.ts +2 -0
  38. package/esm/presentation/localization/bundles/it-IT.localization-bundle.d.ts.map +1 -1
  39. package/esm/presentation/localization/bundles/it-IT.localization-bundle.js +2 -0
  40. package/esm/presentation/localization/bundles/ja-JP.localization-bundle.d.ts +2 -0
  41. package/esm/presentation/localization/bundles/ja-JP.localization-bundle.d.ts.map +1 -1
  42. package/esm/presentation/localization/bundles/ja-JP.localization-bundle.js +2 -0
  43. package/esm/presentation/localization/bundles/ko-KR.localization-bundle.d.ts +2 -0
  44. package/esm/presentation/localization/bundles/ko-KR.localization-bundle.d.ts.map +1 -1
  45. package/esm/presentation/localization/bundles/ko-KR.localization-bundle.js +2 -0
  46. package/esm/presentation/localization/bundles/nl-NL.localization-bundle.d.ts +2 -0
  47. package/esm/presentation/localization/bundles/nl-NL.localization-bundle.d.ts.map +1 -1
  48. package/esm/presentation/localization/bundles/nl-NL.localization-bundle.js +4 -2
  49. package/esm/presentation/localization/bundles/pl-PL.localization-bundle.d.ts +2 -0
  50. package/esm/presentation/localization/bundles/pl-PL.localization-bundle.d.ts.map +1 -1
  51. package/esm/presentation/localization/bundles/pl-PL.localization-bundle.js +2 -0
  52. package/esm/presentation/localization/bundles/pt-BR.localization-bundle.d.ts +2 -0
  53. package/esm/presentation/localization/bundles/pt-BR.localization-bundle.d.ts.map +1 -1
  54. package/esm/presentation/localization/bundles/pt-BR.localization-bundle.js +6 -4
  55. package/esm/presentation/localization/bundles/pt-PT.localization-bundle.d.ts +2 -0
  56. package/esm/presentation/localization/bundles/pt-PT.localization-bundle.d.ts.map +1 -1
  57. package/esm/presentation/localization/bundles/pt-PT.localization-bundle.js +2 -0
  58. package/esm/presentation/localization/bundles/ru-RU.localization-bundle.d.ts +2 -0
  59. package/esm/presentation/localization/bundles/ru-RU.localization-bundle.d.ts.map +1 -1
  60. package/esm/presentation/localization/bundles/ru-RU.localization-bundle.js +2 -0
  61. package/esm/presentation/localization/bundles/sl-SI.localization-bundle.d.ts +2 -0
  62. package/esm/presentation/localization/bundles/sl-SI.localization-bundle.d.ts.map +1 -1
  63. package/esm/presentation/localization/bundles/sl-SI.localization-bundle.js +2 -0
  64. package/esm/presentation/localization/bundles/th-TH.localization-bundle.d.ts +2 -0
  65. package/esm/presentation/localization/bundles/th-TH.localization-bundle.d.ts.map +1 -1
  66. package/esm/presentation/localization/bundles/th-TH.localization-bundle.js +2 -0
  67. package/esm/presentation/localization/bundles/tr-TR.localization-bundle.d.ts +2 -0
  68. package/esm/presentation/localization/bundles/tr-TR.localization-bundle.d.ts.map +1 -1
  69. package/esm/presentation/localization/bundles/tr-TR.localization-bundle.js +4 -2
  70. package/esm/presentation/localization/bundles/uk-UA.localization-bundle.d.ts +2 -0
  71. package/esm/presentation/localization/bundles/uk-UA.localization-bundle.d.ts.map +1 -1
  72. package/esm/presentation/localization/bundles/uk-UA.localization-bundle.js +2 -0
  73. package/esm/presentation/localization/bundles/vi-VN.localization-bundle.d.ts +2 -0
  74. package/esm/presentation/localization/bundles/vi-VN.localization-bundle.d.ts.map +1 -1
  75. package/esm/presentation/localization/bundles/vi-VN.localization-bundle.js +2 -0
  76. package/esm/presentation/localization/bundles/zh-HK.localization-bundle.d.ts +2 -0
  77. package/esm/presentation/localization/bundles/zh-HK.localization-bundle.d.ts.map +1 -1
  78. package/esm/presentation/localization/bundles/zh-HK.localization-bundle.js +2 -0
  79. package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.d.ts +2 -0
  80. package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.d.ts.map +1 -1
  81. package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.js +2 -0
  82. package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.d.ts +2 -0
  83. package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.d.ts.map +1 -1
  84. package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.js +2 -0
  85. package/esm/presentation/widget/common/configuration/DateDatasetDropdown.d.ts.map +1 -1
  86. package/esm/presentation/widget/common/configuration/DateDatasetDropdown.js +1 -1
  87. package/esm/presentation/widget/insight/ViewModeDashboardInsight/InsightDrillDialog/useDrillDialogExportItems.d.ts.map +1 -1
  88. package/esm/presentation/widget/insight/ViewModeDashboardInsight/InsightDrillDialog/useDrillDialogExportItems.js +4 -1
  89. package/package.json +21 -21
  90. package/styles/css/main.css +160 -18
  91. package/styles/css/main.css.map +1 -1
  92. package/styles/scss/main.scss +1 -0
@@ -1,4 +1,4 @@
1
- export declare const LIB_VERSION = "11.49.0-alpha.0";
1
+ export declare const LIB_VERSION = "11.49.0";
2
2
  export declare const LIB_DESCRIPTION = "GoodData SDK - Dashboard Component";
3
3
  export declare const LIB_NAME = "@gooddata/sdk-ui-dashboard";
4
4
  //# sourceMappingURL=__version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"__version.d.ts","sourceRoot":"","sources":["../src/__version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAE7C,eAAO,MAAM,eAAe,uCAAuC,CAAC;AAEpE,eAAO,MAAM,QAAQ,+BAA+B,CAAC"}
1
+ {"version":3,"file":"__version.d.ts","sourceRoot":"","sources":["../src/__version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,eAAO,MAAM,eAAe,uCAAuC,CAAC;AAEpE,eAAO,MAAM,QAAQ,+BAA+B,CAAC"}
package/esm/__version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // (C) 2021 GoodData Corporation
2
2
  // DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD
3
- export const LIB_VERSION = "11.49.0-alpha.0";
3
+ export const LIB_VERSION = "11.49.0";
4
4
  export const LIB_DESCRIPTION = "GoodData SDK - Dashboard Component";
5
5
  export const LIB_NAME = "@gooddata/sdk-ui-dashboard";
@@ -0,0 +1,64 @@
1
+ import { type DateAttributeGranularity, type FilterContextItem, type IAlertAnomalyDetectionGranularity, type IAlertAnomalyDetectionSensitivity, type IAlertComparisonOperator, type IAlertRelativeArithmeticOperator, type IAlertRelativeOperator, type IAlertTriggerInterval, type IAlertTriggerMode, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IAutomationRecipient, type IAutomationVisibleFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type IWidget, type IWorkspaceUser } from "@gooddata/sdk-model";
2
+ import { type AlertAttribute, type AlertMetric, type AlertMetricComparatorType } from "../../types.js";
3
+ import { type IMeasureFormatMap } from "../utils/getters.js";
4
+ /**
5
+ * Props for {@link useAlertFormState}.
6
+ * @internal
7
+ */
8
+ export interface IUseAlertFormStateProps {
9
+ alertToEdit?: IAutomationMetadataObject;
10
+ insight?: IInsight;
11
+ widget?: IWidget;
12
+ notificationChannels: INotificationChannelIdentifier[] | INotificationChannelMetadataObject[];
13
+ users: IWorkspaceUser[];
14
+ editedAutomationFilters?: FilterContextItem[];
15
+ availableFiltersAsVisibleFilters?: IAutomationVisibleFilter[] | undefined;
16
+ externalRecipientOverride?: string;
17
+ supportedMeasures: AlertMetric[];
18
+ supportedAttributes: AlertAttribute[];
19
+ measureFormatMap: IMeasureFormatMap;
20
+ }
21
+ /**
22
+ * Owns the alerting dialog's editable state: the `editedAutomation` draft (initialized either
23
+ * from `alertToEdit` or via `createDefaultAlert`), its `originalAutomation` baseline, the
24
+ * automation's execution parameters, and the form's change-handlers and local UI state.
25
+ *
26
+ * Dashboard configuration (`weekStart`, `timezone`, `enableAlertOncePerInterval`, `currentUser`)
27
+ * is read from {@link useAutomationsContext} and {@link useAlertingDialogContext} rather than
28
+ * passed in as props. All other inputs are params, except `intl`, which is read via `useIntl()`.
29
+ *
30
+ * @internal
31
+ */
32
+ export declare function useAlertFormState({ alertToEdit, insight, widget, notificationChannels, users, editedAutomationFilters, availableFiltersAsVisibleFilters, externalRecipientOverride, supportedMeasures, supportedAttributes, measureFormatMap }: IUseAlertFormStateProps): {
33
+ editedAutomation: IAutomationMetadataObjectDefinition | undefined;
34
+ setEditedAutomation: import("react").Dispatch<import("react").SetStateAction<IAutomationMetadataObjectDefinition | undefined>>;
35
+ originalAutomation: IAutomationMetadataObjectDefinition | undefined;
36
+ defaultUser: IWorkspaceUser;
37
+ defaultRecipient: IAutomationRecipient;
38
+ automationParameters: import("../../../shared/automationFilters/automationParameters.js").IAutomationParameter[];
39
+ availableParameters: import("../../../shared/automationFilters/automationParameters.js").IAutomationParameter[];
40
+ onParameterChange: (ref: import("@gooddata/sdk-model").IdentifierRef, value: string | number) => void;
41
+ onParameterDelete: (ref: import("@gooddata/sdk-model").IdentifierRef) => void;
42
+ onParameterAdd: (ref: import("@gooddata/sdk-model").IdentifierRef) => void;
43
+ dropStaleParameters: () => void;
44
+ onTitleChange: (value: string, isValid: boolean) => void;
45
+ onMeasureChange: (measure: AlertMetric) => void;
46
+ onAttributeChange: (attribute: AlertAttribute | undefined, value: {
47
+ title: string;
48
+ value: string;
49
+ name: string;
50
+ } | undefined) => void;
51
+ onComparisonOperatorChange: (measure: AlertMetric, comparisonOperator: IAlertComparisonOperator) => void;
52
+ onRelativeOperatorChange: (measure: AlertMetric, relativeOperator: IAlertRelativeOperator, arithmeticOperator: IAlertRelativeArithmeticOperator) => void;
53
+ onAnomalyDetectionChange: (measure: AlertMetric) => void;
54
+ onComparisonTypeChange: (measure: AlertMetric | undefined, relativeOperator: [IAlertRelativeOperator, IAlertRelativeArithmeticOperator] | undefined, comparisonType: AlertMetricComparatorType, granularity?: DateAttributeGranularity | undefined) => void;
55
+ onSensitivityChange: (sensitivity: IAlertAnomalyDetectionSensitivity) => void;
56
+ onTriggerIntervalChange: (triggerInterval: IAlertTriggerInterval, dirty?: boolean) => void;
57
+ onGranularityChange: (measure: AlertMetric | undefined, granularity: IAlertAnomalyDetectionGranularity) => void;
58
+ onDestinationChange: (destinationId: string) => void;
59
+ onTriggerModeChange: (triggerMode: IAlertTriggerMode) => void;
60
+ onRecipientsChange: (updatedRecipients: IAutomationRecipient[]) => void;
61
+ warningMessage: string | undefined;
62
+ isTitleValid: boolean;
63
+ };
64
+ //# sourceMappingURL=useAlertFormState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAlertFormState.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/hooks/useAlertFormState.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EAEb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,OAAO,EACZ,KAAK,cAAc,EACtB,MAAM,qBAAqB,CAAC;AAgB7B,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEvG,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAY7D;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACpC,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAC9F,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,uBAAuB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9C,gCAAgC,CAAC,EAAE,wBAAwB,EAAE,GAAG,SAAS,CAAC;IAC1E,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,iBAAiB,EAAE,WAAW,EAAE,CAAC;IACjC,mBAAmB,EAAE,cAAc,EAAE,CAAC;IACtC,gBAAgB,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,WAAW,EACX,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,KAAK,EACL,uBAAuB,EACvB,gCAAgC,EAChC,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACnB,EAAE,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkZzB"}
@@ -0,0 +1,221 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { useCallback, useState } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import { useAlertingDialogContext } from "../../../contexts/AlertingDialogContext.js";
5
+ import { useAutomationsContext } from "../../../contexts/AutomationsContext.js";
6
+ import { setAlertExecutionParameters } from "../../../shared/automationFilters/automationParameters.js";
7
+ import { useAutomationAlertParameters } from "../../../shared/automationFilters/useAutomationAlertParameters.js";
8
+ import { getAppliedWidgetFilters, getVisibleFiltersByFilters, resolveMvfDimensionalityLocalRefs, } from "../../../shared/automationFilters/utils.js";
9
+ import { convertCurrentUserToAutomationRecipient, convertCurrentUserToWorkspaceUser, convertExternalRecipientToAutomationRecipient, } from "../../../shared/utils/automationUtils.js";
10
+ import { createDefaultAlert } from "../utils/convertors.js";
11
+ import { transformAlertByAnomalyDetection, transformAlertByAttribute, transformAlertByComparisonOperator, transformAlertByDestination, transformAlertByGranularity, transformAlertByMetric, transformAlertByRelativeOperator, transformAlertBySensitivity, } from "../utils/transformation.js";
12
+ /**
13
+ * Owns the alerting dialog's editable state: the `editedAutomation` draft (initialized either
14
+ * from `alertToEdit` or via `createDefaultAlert`), its `originalAutomation` baseline, the
15
+ * automation's execution parameters, and the form's change-handlers and local UI state.
16
+ *
17
+ * Dashboard configuration (`weekStart`, `timezone`, `enableAlertOncePerInterval`, `currentUser`)
18
+ * is read from {@link useAutomationsContext} and {@link useAlertingDialogContext} rather than
19
+ * passed in as props. All other inputs are params, except `intl`, which is read via `useIntl()`.
20
+ *
21
+ * @internal
22
+ */
23
+ export function useAlertFormState({ alertToEdit, insight, widget, notificationChannels, users, editedAutomationFilters, availableFiltersAsVisibleFilters, externalRecipientOverride, supportedMeasures, supportedAttributes, measureFormatMap, }) {
24
+ const intl = useIntl();
25
+ const { weekStart, timezone, settings, currentUser, features: { enableAlertOncePerInterval }, } = useAutomationsContext();
26
+ const { dashboardId, hiddenFilters: dashboardHiddenFilters, commonDateFilterId, dashboardEvaluationFrequency, widgetLocalIdToTabIdMap: widgetTabMap, parameterValues, } = useAlertingDialogContext();
27
+ // Determine target tab ID if widget is present
28
+ const targetTabIdentifier = widget?.localIdentifier ? widgetTabMap[widget.localIdentifier] : undefined;
29
+ // Default values
30
+ const defaultMeasure = supportedMeasures[0];
31
+ const defaultUser = convertCurrentUserToWorkspaceUser(users ?? [], currentUser);
32
+ const defaultRecipient = externalRecipientOverride
33
+ ? convertExternalRecipientToAutomationRecipient(externalRecipientOverride)
34
+ : convertCurrentUserToAutomationRecipient(users ?? [], currentUser);
35
+ const defaultNotificationChannelId = notificationChannels[0]?.id;
36
+ const resolvedAlertToEdit = (() => {
37
+ if (!alertToEdit) {
38
+ return undefined;
39
+ }
40
+ const filters = alertToEdit.alert?.execution?.filters;
41
+ if (!alertToEdit.alert || !filters?.length || !insight) {
42
+ return alertToEdit;
43
+ }
44
+ const resolvedFilters = resolveMvfDimensionalityLocalRefs(filters, insight);
45
+ if (resolvedFilters === filters) {
46
+ return alertToEdit;
47
+ }
48
+ return {
49
+ ...alertToEdit,
50
+ alert: {
51
+ ...alertToEdit.alert,
52
+ execution: {
53
+ ...alertToEdit.alert.execution,
54
+ filters: resolvedFilters,
55
+ },
56
+ },
57
+ };
58
+ })();
59
+ const [editedAutomation, setEditedAutomation] = useState(() => {
60
+ if (resolvedAlertToEdit) {
61
+ return resolvedAlertToEdit;
62
+ }
63
+ const defaultNewAlert = createDefaultAlert(getAppliedWidgetFilters(editedAutomationFilters ?? [], dashboardHiddenFilters, widget, insight, commonDateFilterId, true, false), supportedMeasures, defaultMeasure, defaultNotificationChannelId, defaultRecipient, measureFormatMap, undefined, dashboardEvaluationFrequency
64
+ ? {
65
+ cron: dashboardEvaluationFrequency,
66
+ timezone: settings?.alertDefault?.defaultTimezone,
67
+ }
68
+ : undefined, getVisibleFiltersByFilters(editedAutomationFilters, availableFiltersAsVisibleFilters, true), widget?.localIdentifier, dashboardId, widget?.title, targetTabIdentifier);
69
+ return defaultNewAlert && parameterValues.length > 0
70
+ ? setAlertExecutionParameters(defaultNewAlert, parameterValues)
71
+ : defaultNewAlert;
72
+ });
73
+ const [originalAutomation] = useState(editedAutomation);
74
+ const { automationParameters, availableParameters, onParameterChange, onParameterDelete, onParameterAdd, dropStaleParameters, } = useAutomationAlertParameters({ editedAutomation, setEditedAutomation, widgetRef: widget?.ref });
75
+ // Local state
76
+ const [warningMessage, setWarningMessage] = useState(undefined);
77
+ const [isTitleValid, setIsTitleValid] = useState(true);
78
+ const [triggerIntervalDirty, setTriggerIntervalDirty] = useState(false);
79
+ //
80
+ // Handlers
81
+ //
82
+ const onTitleChange = (value, isValid) => {
83
+ setIsTitleValid(isValid);
84
+ setEditedAutomation((s) => (s ? { ...s, title: value } : undefined));
85
+ };
86
+ const onMeasureChange = useCallback((measure) => {
87
+ setEditedAutomation((alert) => alert
88
+ ? transformAlertByMetric(supportedMeasures, alert, measure, measureFormatMap, weekStart, timezone)
89
+ : undefined);
90
+ }, [setEditedAutomation, measureFormatMap, supportedMeasures, weekStart, timezone]);
91
+ const onAttributeChange = useCallback((attribute, value) => {
92
+ setEditedAutomation((alert) => alert
93
+ ? transformAlertByAttribute(supportedAttributes, alert, attribute, value)
94
+ : undefined);
95
+ }, [setEditedAutomation, supportedAttributes]);
96
+ const onComparisonOperatorChange = useCallback((measure, comparisonOperator) => {
97
+ setEditedAutomation((alert) => alert
98
+ ? transformAlertByComparisonOperator(supportedMeasures, alert, measure, comparisonOperator)
99
+ : undefined);
100
+ }, [setEditedAutomation, supportedMeasures]);
101
+ const onRelativeOperatorChange = useCallback((measure, relativeOperator, arithmeticOperator) => {
102
+ setEditedAutomation((alert) => alert
103
+ ? transformAlertByRelativeOperator(supportedMeasures, alert, measure, relativeOperator, arithmeticOperator, measureFormatMap)
104
+ : undefined);
105
+ }, [setEditedAutomation, measureFormatMap, supportedMeasures]);
106
+ const onAnomalyDetectionChange = useCallback((measure) => {
107
+ setTriggerIntervalDirty(false);
108
+ setEditedAutomation((alert) => alert
109
+ ? transformAlertByAnomalyDetection(supportedMeasures, alert, measure, weekStart, timezone, enableAlertOncePerInterval)
110
+ : undefined);
111
+ }, [setEditedAutomation, supportedMeasures, weekStart, timezone, enableAlertOncePerInterval]);
112
+ const onComparisonTypeChange = useCallback((measure, relativeOperator, comparisonType, granularity) => {
113
+ if (!measure || !relativeOperator || !relativeOperator) {
114
+ return;
115
+ }
116
+ const [relativeOperatorValue, arithmeticOperator] = relativeOperator;
117
+ setEditedAutomation((alert) => alert
118
+ ? transformAlertByRelativeOperator(supportedMeasures, alert, measure, relativeOperatorValue, arithmeticOperator, measureFormatMap, comparisonType, granularity)
119
+ : undefined);
120
+ }, [setEditedAutomation, measureFormatMap, supportedMeasures]);
121
+ const onSensitivityChange = useCallback((sensitivity) => {
122
+ setEditedAutomation((alert) => alert
123
+ ? transformAlertBySensitivity(alert, sensitivity)
124
+ : undefined);
125
+ }, [setEditedAutomation]);
126
+ const onTriggerIntervalChange = useCallback((triggerInterval, dirty = true) => {
127
+ setTriggerIntervalDirty(dirty);
128
+ setEditedAutomation((s) => s
129
+ ? {
130
+ ...s,
131
+ alert: {
132
+ ...s.alert,
133
+ trigger: { ...s.alert.trigger, interval: triggerInterval },
134
+ },
135
+ }
136
+ : undefined);
137
+ }, [setEditedAutomation]);
138
+ const onGranularityChange = useCallback((measure, granularity) => {
139
+ if (!measure) {
140
+ return;
141
+ }
142
+ setEditedAutomation((alert) => alert
143
+ ? transformAlertByGranularity(supportedMeasures, alert, measure, granularity, weekStart)
144
+ : undefined);
145
+ if (!triggerIntervalDirty) {
146
+ onTriggerIntervalChange(granularity === "HOUR" ? "DAY" : granularity, false);
147
+ }
148
+ }, [setEditedAutomation, onTriggerIntervalChange, supportedMeasures, triggerIntervalDirty, weekStart]);
149
+ const onDestinationChange = useCallback((destinationId) => {
150
+ const previousDestination = notificationChannels.find((channel) => alertToEdit?.notificationChannel === channel.id);
151
+ const selectedDestination = notificationChannels.find((channel) => destinationId === channel.id);
152
+ /**
153
+ * When allowed recipients are changed from "ALL" to "CREATOR", show warning message
154
+ */
155
+ const showWarningMessage = selectedDestination?.allowedRecipients === "creator" &&
156
+ previousDestination?.allowedRecipients !== "creator";
157
+ setWarningMessage(showWarningMessage
158
+ ? intl.formatMessage({ id: "insightAlert.config.warning.destination" })
159
+ : undefined);
160
+ /**
161
+ * Reset recipients when new notification channel only allows the author/creator
162
+ */
163
+ const updatedRecipients = selectedDestination?.allowedRecipients === "creator"
164
+ ? [convertCurrentUserToAutomationRecipient(users ?? [], currentUser)]
165
+ : undefined;
166
+ setEditedAutomation((alert) => alert
167
+ ? transformAlertByDestination(alert, destinationId, updatedRecipients)
168
+ : undefined);
169
+ }, [
170
+ setEditedAutomation,
171
+ alertToEdit?.notificationChannel,
172
+ currentUser,
173
+ notificationChannels,
174
+ intl,
175
+ users,
176
+ ]);
177
+ const onTriggerModeChange = useCallback((triggerMode) => {
178
+ setEditedAutomation((s) => s
179
+ ? {
180
+ ...s,
181
+ alert: { ...s.alert, trigger: { ...s.alert.trigger, mode: triggerMode } },
182
+ }
183
+ : undefined);
184
+ }, [setEditedAutomation]);
185
+ const onRecipientsChange = useCallback((updatedRecipients) => {
186
+ setEditedAutomation((s) => s
187
+ ? {
188
+ ...s,
189
+ recipients: updatedRecipients,
190
+ }
191
+ : undefined);
192
+ }, [setEditedAutomation]);
193
+ return {
194
+ editedAutomation,
195
+ setEditedAutomation,
196
+ originalAutomation,
197
+ defaultUser,
198
+ defaultRecipient,
199
+ automationParameters,
200
+ availableParameters,
201
+ onParameterChange,
202
+ onParameterDelete,
203
+ onParameterAdd,
204
+ dropStaleParameters,
205
+ onTitleChange,
206
+ onMeasureChange,
207
+ onAttributeChange,
208
+ onComparisonOperatorChange,
209
+ onRelativeOperatorChange,
210
+ onAnomalyDetectionChange,
211
+ onComparisonTypeChange,
212
+ onSensitivityChange,
213
+ onTriggerIntervalChange,
214
+ onGranularityChange,
215
+ onDestinationChange,
216
+ onTriggerModeChange,
217
+ onRecipientsChange,
218
+ warningMessage,
219
+ isTitleValid,
220
+ };
221
+ }
@@ -1,5 +1,4 @@
1
- import { type DateAttributeGranularity, type FilterContextItem, type IAlertAnomalyDetectionGranularity, type IAlertAnomalyDetectionSensitivity, type IAlertComparisonOperator, type IAlertRelativeArithmeticOperator, type IAlertRelativeOperator, type IAlertTriggerInterval, type IAlertTriggerMode, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IAutomationRecipient, type IAutomationVisibleFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type IWidget, type IWorkspaceUser } from "@gooddata/sdk-model";
2
- import { type AlertAttribute, type AlertMetric, type AlertMetricComparatorType } from "../../types.js";
1
+ import { type FilterContextItem, type IAutomationMetadataObject, type IAutomationVisibleFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type IWidget, type IWorkspaceUser } from "@gooddata/sdk-model";
3
2
  export interface IUseEditAlertProps {
4
3
  alertToEdit?: IAutomationMetadataObject;
5
4
  notificationChannels: INotificationChannelIdentifier[] | INotificationChannelMetadataObject[];
@@ -15,7 +14,7 @@ export interface IUseEditAlertProps {
15
14
  }
16
15
  export declare function useEditAlert({ alertToEdit, notificationChannels, insight, widget, users, editedAutomationFilters, maxAutomationsRecipients, setEditedAutomationFilters, availableFiltersAsVisibleFilters, filtersForNewAutomation, externalRecipientOverride }: IUseEditAlertProps): {
17
16
  onTitleChange: (value: string, isValid: boolean) => void;
18
- onRecipientsChange: (updatedRecipients: IAutomationRecipient[]) => void;
17
+ onRecipientsChange: (updatedRecipients: import("@gooddata/sdk-model").IAutomationRecipient[]) => void;
19
18
  onFiltersChange: (filters: FilterContextItem[]) => void;
20
19
  onApplyCurrentFilters: () => void;
21
20
  automationParameters: import("../../../shared/automationFilters/automationParameters.js").IAutomationParameter[];
@@ -24,46 +23,46 @@ export declare function useEditAlert({ alertToEdit, notificationChannels, insigh
24
23
  onParameterDelete: (ref: import("@gooddata/sdk-model").IdentifierRef) => void;
25
24
  onParameterAdd: (ref: import("@gooddata/sdk-model").IdentifierRef) => void;
26
25
  dropStaleParameters: () => void;
27
- onMeasureChange: (measure: AlertMetric) => void;
26
+ onMeasureChange: (measure: import("../../types.js").AlertMetric) => void;
28
27
  getAttributeValues: (attr: import("@gooddata/sdk-model").IAttributeMetadataObject) => import("./useAttributeValuesFromExecResults.js").AttributeValue[];
29
- onAttributeChange: (attribute: AlertAttribute | undefined, value: {
28
+ onAttributeChange: (attribute: import("../../types.js").AlertAttribute | undefined, value: {
30
29
  title: string;
31
30
  value: string;
32
31
  name: string;
33
32
  } | undefined) => void;
34
- onComparisonOperatorChange: (measure: AlertMetric, comparisonOperator: IAlertComparisonOperator) => void;
35
- onRelativeOperatorChange: (measure: AlertMetric, relativeOperator: IAlertRelativeOperator, arithmeticOperator: IAlertRelativeArithmeticOperator) => void;
36
- onAnomalyDetectionChange: (measure: AlertMetric) => void;
37
- onSensitivityChange: (sensitivity: IAlertAnomalyDetectionSensitivity) => void;
38
- onGranularityChange: (measure: AlertMetric | undefined, granularity: IAlertAnomalyDetectionGranularity) => void;
33
+ onComparisonOperatorChange: (measure: import("../../types.js").AlertMetric, comparisonOperator: import("@gooddata/sdk-model").IAlertComparisonOperator) => void;
34
+ onRelativeOperatorChange: (measure: import("../../types.js").AlertMetric, relativeOperator: import("@gooddata/sdk-model").IAlertRelativeOperator, arithmeticOperator: import("@gooddata/sdk-model").IAlertRelativeArithmeticOperator) => void;
35
+ onAnomalyDetectionChange: (measure: import("../../types.js").AlertMetric) => void;
36
+ onSensitivityChange: (sensitivity: import("@gooddata/sdk-model").IAlertAnomalyDetectionSensitivity) => void;
37
+ onGranularityChange: (measure: import("../../types.js").AlertMetric | undefined, granularity: import("@gooddata/sdk-model").IAlertAnomalyDetectionGranularity) => void;
39
38
  onChange: (e: string | number, event?: import("react").ChangeEvent<HTMLInputElement> | undefined) => void;
40
39
  onBlur: (event: import("react").FocusEvent<HTMLInputElement, Element>) => void;
41
- onComparisonTypeChange: (measure: AlertMetric | undefined, relativeOperator: [IAlertRelativeOperator, IAlertRelativeArithmeticOperator] | undefined, comparisonType: AlertMetricComparatorType, granularity?: DateAttributeGranularity | undefined) => void;
40
+ onComparisonTypeChange: (measure: import("../../types.js").AlertMetric | undefined, relativeOperator: [import("@gooddata/sdk-model").IAlertRelativeOperator, import("@gooddata/sdk-model").IAlertRelativeArithmeticOperator] | undefined, comparisonType: import("../../types.js").AlertMetricComparatorType, granularity?: import("@gooddata/sdk-model").DateAttributeGranularity | undefined) => void;
42
41
  onDestinationChange: (destinationId: string) => void;
43
- onTriggerModeChange: (triggerMode: IAlertTriggerMode) => void;
44
- onTriggerIntervalChange: (triggerInterval: IAlertTriggerInterval, dirty?: boolean) => void;
45
- selectedMeasure: AlertMetric | undefined;
42
+ onTriggerModeChange: (triggerMode: import("@gooddata/sdk-model").IAlertTriggerMode) => void;
43
+ onTriggerIntervalChange: (triggerInterval: import("@gooddata/sdk-model").IAlertTriggerInterval, dirty?: boolean) => void;
44
+ selectedMeasure: import("../../types.js").AlertMetric | undefined;
46
45
  canChangeMeasure: boolean;
47
- supportedMeasures: AlertMetric[];
48
- selectedAttribute: AlertAttribute | undefined;
46
+ supportedMeasures: import("../../types.js").AlertMetric[];
47
+ selectedAttribute: import("../../types.js").AlertAttribute | undefined;
49
48
  selectedValue: string | null | undefined;
50
- supportedAttributes: AlertAttribute[];
49
+ supportedAttributes: import("../../types.js").AlertAttribute[];
51
50
  catalogAttributes: import("@gooddata/sdk-model").ICatalogAttribute[];
52
51
  catalogDateDatasets: import("@gooddata/sdk-model").ICatalogDateDataset[];
53
52
  isResultLoading: boolean;
54
53
  isInvalidConnectionToInsight: "" | boolean | undefined;
55
54
  selectedAiOperator: "AI.ANOMALY_DETECTION" | undefined;
56
- selectedSensitivity: IAlertAnomalyDetectionSensitivity | undefined;
57
- selectedGranularity: IAlertAnomalyDetectionGranularity | undefined;
58
- selectedComparisonOperator: IAlertComparisonOperator | undefined;
59
- selectedRelativeOperator: [IAlertRelativeOperator, IAlertRelativeArithmeticOperator] | undefined;
55
+ selectedSensitivity: import("@gooddata/sdk-model").IAlertAnomalyDetectionSensitivity | undefined;
56
+ selectedGranularity: import("@gooddata/sdk-model").IAlertAnomalyDetectionGranularity | undefined;
57
+ selectedComparisonOperator: import("@gooddata/sdk-model").IAlertComparisonOperator | undefined;
58
+ selectedRelativeOperator: [import("@gooddata/sdk-model").IAlertRelativeOperator, import("@gooddata/sdk-model").IAlertRelativeArithmeticOperator] | undefined;
60
59
  value: number | undefined;
61
60
  selectedComparator: import("../../types.js").AlertMetricComparator | undefined;
62
61
  separators: import("@gooddata/sdk-model").ISeparators;
63
62
  warningMessage: string | undefined;
64
63
  defaultUser: IWorkspaceUser;
65
- originalAutomation: IAutomationMetadataObjectDefinition | undefined;
66
- editedAutomation: IAutomationMetadataObjectDefinition | undefined;
64
+ originalAutomation: import("@gooddata/sdk-model").IAutomationMetadataObjectDefinition | undefined;
65
+ editedAutomation: import("@gooddata/sdk-model").IAutomationMetadataObjectDefinition | undefined;
67
66
  allowOnlyLoggedUserRecipients: boolean;
68
67
  allowExternalRecipients: boolean;
69
68
  validationErrorMessage: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useEditAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EAEb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,OAAO,EACZ,KAAK,cAAc,EACtB,MAAM,qBAAqB,CAAC;AAgB7B,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAmBvG,MAAM,WAAW,kBAAkB;IAC/B,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAC9F,wBAAwB,EAAE,MAAM,CAAC;IACjC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,uBAAuB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE9C,0BAA0B,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IACnE,gCAAgC,CAAC,EAAE,wBAAwB,EAAE,GAAG,SAAS,CAAC;IAC1E,uBAAuB,EAAE,iBAAiB,EAAE,CAAC;IAC7C,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,wBAAgB,YAAY,CAAC,EACzB,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,KAAK,EACL,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,gCAAgC,EAChC,uBAAuB,EACvB,yBAAyB,EAC5B,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqepB"}
1
+ {"version":3,"file":"useEditAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EACb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,OAAO,EACZ,KAAK,cAAc,EACtB,MAAM,qBAAqB,CAAC;AAY7B,MAAM,WAAW,kBAAkB;IAC/B,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAC9F,wBAAwB,EAAE,MAAM,CAAC;IACjC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,uBAAuB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE9C,0BAA0B,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IACnE,gCAAgC,CAAC,EAAE,wBAAwB,EAAE,GAAG,SAAS,CAAC;IAC1E,uBAAuB,EAAE,iBAAiB,EAAE,CAAC;IAC7C,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,wBAAgB,YAAY,CAAC,EACzB,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,KAAK,EACL,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,gCAAgC,EAChC,uBAAuB,EACvB,yBAAyB,EAC5B,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsLpB"}
@@ -1,77 +1,30 @@
1
1
  // (C) 2019-2026 GoodData Corporation
2
- import { useCallback, useState } from "react";
3
- import { useIntl } from "react-intl";
4
2
  import { useAlertingDialogContext } from "../../../contexts/AlertingDialogContext.js";
5
3
  import { useAutomationsContext } from "../../../contexts/AutomationsContext.js";
6
- import { setAlertExecutionParameters } from "../../../shared/automationFilters/automationParameters.js";
7
- import { useAutomationAlertParameters } from "../../../shared/automationFilters/useAutomationAlertParameters.js";
8
- import { getAppliedWidgetFilters, getVisibleFiltersByFilters, resolveMvfDimensionalityLocalRefs, } from "../../../shared/automationFilters/utils.js";
9
- import { convertCurrentUserToAutomationRecipient, convertCurrentUserToWorkspaceUser, convertExternalRecipientToAutomationRecipient, } from "../../../shared/utils/automationUtils.js";
10
- import { createDefaultAlert } from "../utils/convertors.js";
11
- import { transformAlertByAnomalyDetection, transformAlertByAttribute, transformAlertByComparisonOperator, transformAlertByDestination, transformAlertByGranularity, transformAlertByMetric, transformAlertByRelativeOperator, transformAlertBySensitivity, } from "../utils/transformation.js";
12
4
  import { useAlertFilters } from "./useAlertFilters.js";
5
+ import { useAlertFormState } from "./useAlertFormState.js";
13
6
  import { useAlertFormValidation } from "./useAlertFormValidation.js";
14
7
  import { useAlertSelectedValues } from "./useAlertSelectedValues.js";
15
8
  import { useAlertSupportedMetrics } from "./useAlertSupportedMetrics.js";
16
9
  import { useAlertThreshold } from "./useAlertThreshold.js";
17
10
  export function useEditAlert({ alertToEdit, notificationChannels, insight, widget, users, editedAutomationFilters, maxAutomationsRecipients, setEditedAutomationFilters, availableFiltersAsVisibleFilters, filtersForNewAutomation, externalRecipientOverride, }) {
18
- const intl = useIntl();
19
- const { catalogDateDatasets, catalogAttributes, currentUser, separators, weekStart, timezone, settings, allowHourlyRecurrence, features: { enableAlertOncePerInterval }, } = useAutomationsContext();
11
+ const { catalogDateDatasets, catalogAttributes, separators, weekStart, timezone, allowHourlyRecurrence } = useAutomationsContext();
20
12
  const isInvalidConnectionToInsight = alertToEdit?.metadata?.widget && !insight;
21
- const { dashboardId, hiddenFilters: dashboardHiddenFilters, commonDateFilterId, dashboardEvaluationFrequency, widgetLocalIdToTabIdMap: widgetTabMap, parameterValues, } = useAlertingDialogContext();
22
- // Determine target tab ID if widget is present
23
- const targetTabIdentifier = widget?.localIdentifier ? widgetTabMap[widget.localIdentifier] : undefined;
13
+ const { hiddenFilters: dashboardHiddenFilters, commonDateFilterId } = useAlertingDialogContext();
24
14
  const { measureFormatMap, supportedMeasures, supportedAttributes, isResultLoading, getAttributeValues, getMetricValue, } = useAlertSupportedMetrics({ insight, widget, alertToEdit });
25
- // Default values
26
- const defaultMeasure = supportedMeasures[0];
27
- const defaultUser = convertCurrentUserToWorkspaceUser(users ?? [], currentUser);
28
- const defaultRecipient = externalRecipientOverride
29
- ? convertExternalRecipientToAutomationRecipient(externalRecipientOverride)
30
- : convertCurrentUserToAutomationRecipient(users ?? [], currentUser);
31
- const defaultNotificationChannelId = notificationChannels[0]?.id;
32
- // Local state
33
- const [warningMessage, setWarningMessage] = useState(undefined);
34
- const [isTitleValid, setIsTitleValid] = useState(true);
35
- const [triggerIntervalDirty, setTriggerIntervalDirty] = useState(false);
36
- const resolvedAlertToEdit = (() => {
37
- if (!alertToEdit) {
38
- return undefined;
39
- }
40
- const filters = alertToEdit.alert?.execution?.filters;
41
- if (!alertToEdit.alert || !filters?.length || !insight) {
42
- return alertToEdit;
43
- }
44
- const resolvedFilters = resolveMvfDimensionalityLocalRefs(filters, insight);
45
- if (resolvedFilters === filters) {
46
- return alertToEdit;
47
- }
48
- return {
49
- ...alertToEdit,
50
- alert: {
51
- ...alertToEdit.alert,
52
- execution: {
53
- ...alertToEdit.alert.execution,
54
- filters: resolvedFilters,
55
- },
56
- },
57
- };
58
- })();
59
- const [editedAutomation, setEditedAutomation] = useState(() => {
60
- if (resolvedAlertToEdit) {
61
- return resolvedAlertToEdit;
62
- }
63
- const defaultNewAlert = createDefaultAlert(getAppliedWidgetFilters(editedAutomationFilters ?? [], dashboardHiddenFilters, widget, insight, commonDateFilterId, true, false), supportedMeasures, defaultMeasure, defaultNotificationChannelId, defaultRecipient, measureFormatMap, undefined, dashboardEvaluationFrequency
64
- ? {
65
- cron: dashboardEvaluationFrequency,
66
- timezone: settings?.alertDefault?.defaultTimezone,
67
- }
68
- : undefined, getVisibleFiltersByFilters(editedAutomationFilters, availableFiltersAsVisibleFilters, true), widget?.localIdentifier, dashboardId, widget?.title, targetTabIdentifier);
69
- return defaultNewAlert && parameterValues.length > 0
70
- ? setAlertExecutionParameters(defaultNewAlert, parameterValues)
71
- : defaultNewAlert;
15
+ const { editedAutomation, setEditedAutomation, originalAutomation, defaultUser, defaultRecipient, automationParameters, availableParameters, onParameterChange, onParameterDelete, onParameterAdd, dropStaleParameters, onTitleChange, onMeasureChange, onAttributeChange, onComparisonOperatorChange, onRelativeOperatorChange, onAnomalyDetectionChange, onComparisonTypeChange, onSensitivityChange, onTriggerIntervalChange, onGranularityChange, onDestinationChange, onTriggerModeChange, onRecipientsChange, warningMessage, isTitleValid, } = useAlertFormState({
16
+ alertToEdit,
17
+ insight,
18
+ widget,
19
+ notificationChannels,
20
+ users,
21
+ editedAutomationFilters,
22
+ availableFiltersAsVisibleFilters,
23
+ externalRecipientOverride,
24
+ supportedMeasures,
25
+ supportedAttributes,
26
+ measureFormatMap,
72
27
  });
73
- const [originalAutomation] = useState(editedAutomation);
74
- const { automationParameters, availableParameters, onParameterChange, onParameterDelete, onParameterAdd, dropStaleParameters, } = useAutomationAlertParameters({ editedAutomation, setEditedAutomation, widgetRef: widget?.ref });
75
28
  //
76
29
  // Selected values
77
30
  //
@@ -81,104 +34,6 @@ export function useEditAlert({ alertToEdit, notificationChannels, insight, widge
81
34
  supportedAttributes,
82
35
  notificationChannels,
83
36
  });
84
- //
85
- // Handlers
86
- //
87
- const onTitleChange = (value, isValid) => {
88
- setIsTitleValid(isValid);
89
- setEditedAutomation((s) => (s ? { ...s, title: value } : undefined));
90
- };
91
- const onMeasureChange = useCallback((measure) => {
92
- setEditedAutomation((alert) => alert
93
- ? transformAlertByMetric(supportedMeasures, alert, measure, measureFormatMap, weekStart, timezone)
94
- : undefined);
95
- }, [measureFormatMap, supportedMeasures, weekStart, timezone]);
96
- const onAttributeChange = useCallback((attribute, value) => {
97
- setEditedAutomation((alert) => alert
98
- ? transformAlertByAttribute(supportedAttributes, alert, attribute, value)
99
- : undefined);
100
- }, [supportedAttributes]);
101
- const onComparisonOperatorChange = useCallback((measure, comparisonOperator) => {
102
- setEditedAutomation((alert) => alert
103
- ? transformAlertByComparisonOperator(supportedMeasures, alert, measure, comparisonOperator)
104
- : undefined);
105
- }, [supportedMeasures]);
106
- const onRelativeOperatorChange = useCallback((measure, relativeOperator, arithmeticOperator) => {
107
- setEditedAutomation((alert) => alert
108
- ? transformAlertByRelativeOperator(supportedMeasures, alert, measure, relativeOperator, arithmeticOperator, measureFormatMap)
109
- : undefined);
110
- }, [measureFormatMap, supportedMeasures]);
111
- const onAnomalyDetectionChange = useCallback((measure) => {
112
- setTriggerIntervalDirty(false);
113
- setEditedAutomation((alert) => transformAlertByAnomalyDetection(supportedMeasures, alert, measure, weekStart, timezone, enableAlertOncePerInterval));
114
- }, [supportedMeasures, weekStart, timezone, enableAlertOncePerInterval]);
115
- const onComparisonTypeChange = useCallback((measure, relativeOperator, comparisonType, granularity) => {
116
- if (!measure || !relativeOperator || !relativeOperator) {
117
- return;
118
- }
119
- const [relativeOperatorValue, arithmeticOperator] = relativeOperator;
120
- setEditedAutomation((alert) => alert
121
- ? transformAlertByRelativeOperator(supportedMeasures, alert, measure, relativeOperatorValue, arithmeticOperator, measureFormatMap, comparisonType, granularity)
122
- : undefined);
123
- }, [measureFormatMap, supportedMeasures]);
124
- const onSensitivityChange = useCallback((sensitivity) => {
125
- setEditedAutomation((alert) => transformAlertBySensitivity(alert, sensitivity));
126
- }, []);
127
- const onTriggerIntervalChange = useCallback((triggerInterval, dirty = true) => {
128
- setTriggerIntervalDirty(dirty);
129
- setEditedAutomation((s) => s
130
- ? {
131
- ...s,
132
- alert: { ...s.alert, trigger: { ...s.alert.trigger, interval: triggerInterval } },
133
- }
134
- : undefined);
135
- }, []);
136
- const onGranularityChange = useCallback((measure, granularity) => {
137
- if (!measure) {
138
- return;
139
- }
140
- setEditedAutomation((alert) => transformAlertByGranularity(supportedMeasures, alert, measure, granularity, weekStart));
141
- if (!triggerIntervalDirty) {
142
- onTriggerIntervalChange(granularity === "HOUR" ? "DAY" : granularity, false);
143
- }
144
- }, [onTriggerIntervalChange, supportedMeasures, triggerIntervalDirty, weekStart]);
145
- const onDestinationChange = useCallback((destinationId) => {
146
- const previousDestination = notificationChannels.find((channel) => alertToEdit?.notificationChannel === channel.id);
147
- const selectedDestination = notificationChannels.find((channel) => destinationId === channel.id);
148
- /**
149
- * When allowed recipients are changed from "ALL" to "CREATOR", show warning message
150
- */
151
- const showWarningMessage = selectedDestination?.allowedRecipients === "creator" &&
152
- previousDestination?.allowedRecipients !== "creator";
153
- setWarningMessage(showWarningMessage
154
- ? intl.formatMessage({ id: "insightAlert.config.warning.destination" })
155
- : undefined);
156
- /**
157
- * Reset recipients when new notification channel only allows the author/creator
158
- */
159
- const updatedRecipients = selectedDestination?.allowedRecipients === "creator"
160
- ? [convertCurrentUserToAutomationRecipient(users ?? [], currentUser)]
161
- : undefined;
162
- setEditedAutomation((alert) => alert
163
- ? transformAlertByDestination(alert, destinationId, updatedRecipients)
164
- : undefined);
165
- }, [alertToEdit?.notificationChannel, currentUser, notificationChannels, intl, users]);
166
- const onTriggerModeChange = useCallback((triggerMode) => {
167
- setEditedAutomation((s) => s
168
- ? {
169
- ...s,
170
- alert: { ...s.alert, trigger: { ...s.alert.trigger, mode: triggerMode } },
171
- }
172
- : undefined);
173
- }, []);
174
- const onRecipientsChange = useCallback((updatedRecipients) => {
175
- setEditedAutomation((s) => s
176
- ? {
177
- ...s,
178
- recipients: updatedRecipients,
179
- }
180
- : undefined);
181
- }, []);
182
37
  const { onFiltersChange, onApplyCurrentFilters } = useAlertFilters({
183
38
  setEditedAutomation,
184
39
  setEditedAutomationFilters,
@@ -143,6 +143,8 @@ export declare const de_DE: {
143
143
  "filters.configurationPanel.userFilterSave.toggle.tooltip": string;
144
144
  "filters.configurationPanel.filterViews.toggle": string;
145
145
  "filters.configurationPanel.filterViews.toggle.tooltip": string;
146
+ "filters.configurationPanel.persistentFiltersAcrossTabs.toggle": string;
147
+ "filters.configurationPanel.persistentFiltersAcrossTabs.toggle.tooltip": string;
146
148
  "settingsDashboardDialog.sectionHeaders.dateDataset": string;
147
149
  "settingsDashboardDialog.sectionHeaders.dateDataset.tooltip": string;
148
150
  "dateDataset.autoSelect": string;
@@ -1 +1 @@
1
- {"version":3,"file":"de-DE.localization-bundle.d.ts","sourceRoot":"","sources":["../../../../src/presentation/localization/bundles/de-DE.localization-bundle.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAs2BjB,CAAC"}
1
+ {"version":3,"file":"de-DE.localization-bundle.d.ts","sourceRoot":"","sources":["../../../../src/presentation/localization/bundles/de-DE.localization-bundle.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAw2BjB,CAAC"}
@@ -145,6 +145,8 @@ export const de_DE = {
145
145
  "filters.configurationPanel.userFilterSave.toggle.tooltip": "Automatisches Speichern des letzten Status der Filter zulassen. Wenn Benutzer zurückkehren, bleiben ihre Filter so, wie sie sie verlassen haben.",
146
146
  "filters.configurationPanel.filterViews.toggle": "Gespeicherte Ansichten",
147
147
  "filters.configurationPanel.filterViews.toggle.tooltip": "<p>Ermöglicht Benutzern, den Filterstatus als persönliche Ansicht zu speichern, zu der sie später zurückkehren können.</p><p>Nur der Benutzer, der die Ansicht gespeichert hat, kann darauf zugreifen und sie als Standardansicht festlegen.</p>",
148
+ "filters.configurationPanel.persistentFiltersAcrossTabs.toggle": "Persistente Filter über Tabs hinweg",
149
+ "filters.configurationPanel.persistentFiltersAcrossTabs.toggle.tooltip": "Persistente Filter über Tabs hinweg zulassen. Wenn aktiviert, bleiben Filter über Tabs hinweg erhalten.",
148
150
  "settingsDashboardDialog.sectionHeaders.dateDataset": "Datumsbereich in Beschreibungen",
149
151
  "settingsDashboardDialog.sectionHeaders.dateDataset.tooltip": "Datumsdatensatz, der vom Datumsbereichsfilter für Metrikreferenzen in Abschnittsbeschreibungen verwendet wird.",
150
152
  "dateDataset.autoSelect": "Automatische Auswahl",