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

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.
@@ -1,4 +1,4 @@
1
- export declare const LIB_VERSION = "11.49.0-alpha.0";
1
+ export declare const LIB_VERSION = "11.49.0-alpha.1";
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
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-alpha.1";
4
4
  export const LIB_DESCRIPTION = "GoodData SDK - Dashboard Component";
5
5
  export const LIB_NAME = "@gooddata/sdk-ui-dashboard";
@@ -0,0 +1,57 @@
1
+ import { type Dispatch, type SetStateAction } from "react";
2
+ import { type DateAttributeGranularity, type IAlertAnomalyDetectionGranularity, type IAlertAnomalyDetectionSensitivity, type IAlertComparisonOperator, type IAlertRelativeArithmeticOperator, type IAlertRelativeOperator, type IAlertTriggerInterval, type IAlertTriggerMode, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IAutomationRecipient, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type IUser, type IWorkspaceUser, type WeekStart } from "@gooddata/sdk-model";
3
+ import { type AlertAttribute, type AlertMetric, type AlertMetricComparatorType } from "../../types.js";
4
+ import { type IMeasureFormatMap } from "../utils/getters.js";
5
+ /**
6
+ * Props for {@link useAlertFormState}.
7
+ * @internal
8
+ */
9
+ export interface IUseAlertFormStateProps {
10
+ setEditedAutomation: Dispatch<SetStateAction<IAutomationMetadataObjectDefinition | undefined>>;
11
+ supportedMeasures: AlertMetric[];
12
+ supportedAttributes: AlertAttribute[];
13
+ measureFormatMap: IMeasureFormatMap;
14
+ weekStart: WeekStart;
15
+ timezone: string | undefined;
16
+ enableAlertOncePerInterval: boolean;
17
+ notificationChannels: INotificationChannelIdentifier[] | INotificationChannelMetadataObject[];
18
+ currentUser: IUser;
19
+ users: IWorkspaceUser[];
20
+ alertToEdit?: IAutomationMetadataObject;
21
+ }
22
+ /**
23
+ * Extracts the alerting dialog's form change-handlers and their local UI state out of `useEditAlert`
24
+ * into a focused hook. Pure refactor — no behavior change.
25
+ *
26
+ * Part 1 of 2: this hook receives `setEditedAutomation` (and the derived inputs) as params; the
27
+ * `editedAutomation` draft, its `createDefaultAlert` initializer, `originalAutomation`, and
28
+ * `useAutomationAlertParameters` stay in `useEditAlert` for now and fold into this hook in a
29
+ * follow-up.
30
+ *
31
+ * All inputs are params except `intl`, which the hook reads via `useIntl()` internally
32
+ * (`onDestinationChange` formats a warning message).
33
+ *
34
+ * @internal
35
+ */
36
+ export declare function useAlertFormState({ setEditedAutomation, supportedMeasures, supportedAttributes, measureFormatMap, weekStart, timezone, enableAlertOncePerInterval, notificationChannels, currentUser, users, alertToEdit }: IUseAlertFormStateProps): {
37
+ onTitleChange: (value: string, isValid: boolean) => void;
38
+ onMeasureChange: (measure: AlertMetric) => void;
39
+ onAttributeChange: (attribute: AlertAttribute | undefined, value: {
40
+ title: string;
41
+ value: string;
42
+ name: string;
43
+ } | undefined) => void;
44
+ onComparisonOperatorChange: (measure: AlertMetric, comparisonOperator: IAlertComparisonOperator) => void;
45
+ onRelativeOperatorChange: (measure: AlertMetric, relativeOperator: IAlertRelativeOperator, arithmeticOperator: IAlertRelativeArithmeticOperator) => void;
46
+ onAnomalyDetectionChange: (measure: AlertMetric) => void;
47
+ onComparisonTypeChange: (measure: AlertMetric | undefined, relativeOperator: [IAlertRelativeOperator, IAlertRelativeArithmeticOperator] | undefined, comparisonType: AlertMetricComparatorType, granularity?: DateAttributeGranularity | undefined) => void;
48
+ onSensitivityChange: (sensitivity: IAlertAnomalyDetectionSensitivity) => void;
49
+ onTriggerIntervalChange: (triggerInterval: IAlertTriggerInterval, dirty?: boolean) => void;
50
+ onGranularityChange: (measure: AlertMetric | undefined, granularity: IAlertAnomalyDetectionGranularity) => void;
51
+ onDestinationChange: (destinationId: string) => void;
52
+ onTriggerModeChange: (triggerMode: IAlertTriggerMode) => void;
53
+ onRecipientsChange: (updatedRecipients: IAutomationRecipient[]) => void;
54
+ warningMessage: string | undefined;
55
+ isTitleValid: boolean;
56
+ };
57
+ //# 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":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAyB,MAAM,OAAO,CAAC;AAIlF,OAAO,EACH,KAAK,wBAAwB,EAC7B,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,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,SAAS,EACjB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAY7D;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACpC,mBAAmB,EAAE,QAAQ,CAAC,cAAc,CAAC,mCAAmC,GAAG,SAAS,CAAC,CAAC,CAAC;IAC/F,iBAAiB,EAAE,WAAW,EAAE,CAAC;IACjC,mBAAmB,EAAE,cAAc,EAAE,CAAC;IACtC,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,0BAA0B,EAAE,OAAO,CAAC;IACpC,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAC9F,WAAW,EAAE,KAAK,CAAC;IACnB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,yBAAyB,CAAC;CAC3C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,EACX,KAAK,EACL,WAAW,EACd,EAAE,uBAAuB;;;;;;;;;;;;;;;;;;;;EAiSzB"}
@@ -0,0 +1,157 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { useCallback, useState } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import { convertCurrentUserToAutomationRecipient } from "../../../shared/utils/automationUtils.js";
5
+ import { transformAlertByAnomalyDetection, transformAlertByAttribute, transformAlertByComparisonOperator, transformAlertByDestination, transformAlertByGranularity, transformAlertByMetric, transformAlertByRelativeOperator, transformAlertBySensitivity, } from "../utils/transformation.js";
6
+ /**
7
+ * Extracts the alerting dialog's form change-handlers and their local UI state out of `useEditAlert`
8
+ * into a focused hook. Pure refactor — no behavior change.
9
+ *
10
+ * Part 1 of 2: this hook receives `setEditedAutomation` (and the derived inputs) as params; the
11
+ * `editedAutomation` draft, its `createDefaultAlert` initializer, `originalAutomation`, and
12
+ * `useAutomationAlertParameters` stay in `useEditAlert` for now and fold into this hook in a
13
+ * follow-up.
14
+ *
15
+ * All inputs are params except `intl`, which the hook reads via `useIntl()` internally
16
+ * (`onDestinationChange` formats a warning message).
17
+ *
18
+ * @internal
19
+ */
20
+ export function useAlertFormState({ setEditedAutomation, supportedMeasures, supportedAttributes, measureFormatMap, weekStart, timezone, enableAlertOncePerInterval, notificationChannels, currentUser, users, alertToEdit, }) {
21
+ const intl = useIntl();
22
+ // Local state
23
+ const [warningMessage, setWarningMessage] = useState(undefined);
24
+ const [isTitleValid, setIsTitleValid] = useState(true);
25
+ const [triggerIntervalDirty, setTriggerIntervalDirty] = useState(false);
26
+ //
27
+ // Handlers
28
+ //
29
+ const onTitleChange = (value, isValid) => {
30
+ setIsTitleValid(isValid);
31
+ setEditedAutomation((s) => (s ? { ...s, title: value } : undefined));
32
+ };
33
+ const onMeasureChange = useCallback((measure) => {
34
+ setEditedAutomation((alert) => alert
35
+ ? transformAlertByMetric(supportedMeasures, alert, measure, measureFormatMap, weekStart, timezone)
36
+ : undefined);
37
+ }, [setEditedAutomation, measureFormatMap, supportedMeasures, weekStart, timezone]);
38
+ const onAttributeChange = useCallback((attribute, value) => {
39
+ setEditedAutomation((alert) => alert
40
+ ? transformAlertByAttribute(supportedAttributes, alert, attribute, value)
41
+ : undefined);
42
+ }, [setEditedAutomation, supportedAttributes]);
43
+ const onComparisonOperatorChange = useCallback((measure, comparisonOperator) => {
44
+ setEditedAutomation((alert) => alert
45
+ ? transformAlertByComparisonOperator(supportedMeasures, alert, measure, comparisonOperator)
46
+ : undefined);
47
+ }, [setEditedAutomation, supportedMeasures]);
48
+ const onRelativeOperatorChange = useCallback((measure, relativeOperator, arithmeticOperator) => {
49
+ setEditedAutomation((alert) => alert
50
+ ? transformAlertByRelativeOperator(supportedMeasures, alert, measure, relativeOperator, arithmeticOperator, measureFormatMap)
51
+ : undefined);
52
+ }, [setEditedAutomation, measureFormatMap, supportedMeasures]);
53
+ const onAnomalyDetectionChange = useCallback((measure) => {
54
+ setTriggerIntervalDirty(false);
55
+ setEditedAutomation((alert) => alert
56
+ ? transformAlertByAnomalyDetection(supportedMeasures, alert, measure, weekStart, timezone, enableAlertOncePerInterval)
57
+ : undefined);
58
+ }, [setEditedAutomation, supportedMeasures, weekStart, timezone, enableAlertOncePerInterval]);
59
+ const onComparisonTypeChange = useCallback((measure, relativeOperator, comparisonType, granularity) => {
60
+ if (!measure || !relativeOperator || !relativeOperator) {
61
+ return;
62
+ }
63
+ const [relativeOperatorValue, arithmeticOperator] = relativeOperator;
64
+ setEditedAutomation((alert) => alert
65
+ ? transformAlertByRelativeOperator(supportedMeasures, alert, measure, relativeOperatorValue, arithmeticOperator, measureFormatMap, comparisonType, granularity)
66
+ : undefined);
67
+ }, [setEditedAutomation, measureFormatMap, supportedMeasures]);
68
+ const onSensitivityChange = useCallback((sensitivity) => {
69
+ setEditedAutomation((alert) => alert
70
+ ? transformAlertBySensitivity(alert, sensitivity)
71
+ : undefined);
72
+ }, [setEditedAutomation]);
73
+ const onTriggerIntervalChange = useCallback((triggerInterval, dirty = true) => {
74
+ setTriggerIntervalDirty(dirty);
75
+ setEditedAutomation((s) => s
76
+ ? {
77
+ ...s,
78
+ alert: {
79
+ ...s.alert,
80
+ trigger: { ...s.alert.trigger, interval: triggerInterval },
81
+ },
82
+ }
83
+ : undefined);
84
+ }, [setEditedAutomation]);
85
+ const onGranularityChange = useCallback((measure, granularity) => {
86
+ if (!measure) {
87
+ return;
88
+ }
89
+ setEditedAutomation((alert) => alert
90
+ ? transformAlertByGranularity(supportedMeasures, alert, measure, granularity, weekStart)
91
+ : undefined);
92
+ if (!triggerIntervalDirty) {
93
+ onTriggerIntervalChange(granularity === "HOUR" ? "DAY" : granularity, false);
94
+ }
95
+ }, [setEditedAutomation, onTriggerIntervalChange, supportedMeasures, triggerIntervalDirty, weekStart]);
96
+ const onDestinationChange = useCallback((destinationId) => {
97
+ const previousDestination = notificationChannels.find((channel) => alertToEdit?.notificationChannel === channel.id);
98
+ const selectedDestination = notificationChannels.find((channel) => destinationId === channel.id);
99
+ /**
100
+ * When allowed recipients are changed from "ALL" to "CREATOR", show warning message
101
+ */
102
+ const showWarningMessage = selectedDestination?.allowedRecipients === "creator" &&
103
+ previousDestination?.allowedRecipients !== "creator";
104
+ setWarningMessage(showWarningMessage
105
+ ? intl.formatMessage({ id: "insightAlert.config.warning.destination" })
106
+ : undefined);
107
+ /**
108
+ * Reset recipients when new notification channel only allows the author/creator
109
+ */
110
+ const updatedRecipients = selectedDestination?.allowedRecipients === "creator"
111
+ ? [convertCurrentUserToAutomationRecipient(users ?? [], currentUser)]
112
+ : undefined;
113
+ setEditedAutomation((alert) => alert
114
+ ? transformAlertByDestination(alert, destinationId, updatedRecipients)
115
+ : undefined);
116
+ }, [
117
+ setEditedAutomation,
118
+ alertToEdit?.notificationChannel,
119
+ currentUser,
120
+ notificationChannels,
121
+ intl,
122
+ users,
123
+ ]);
124
+ const onTriggerModeChange = useCallback((triggerMode) => {
125
+ setEditedAutomation((s) => s
126
+ ? {
127
+ ...s,
128
+ alert: { ...s.alert, trigger: { ...s.alert.trigger, mode: triggerMode } },
129
+ }
130
+ : undefined);
131
+ }, [setEditedAutomation]);
132
+ const onRecipientsChange = useCallback((updatedRecipients) => {
133
+ setEditedAutomation((s) => s
134
+ ? {
135
+ ...s,
136
+ recipients: updatedRecipients,
137
+ }
138
+ : undefined);
139
+ }, [setEditedAutomation]);
140
+ return {
141
+ onTitleChange,
142
+ onMeasureChange,
143
+ onAttributeChange,
144
+ onComparisonOperatorChange,
145
+ onRelativeOperatorChange,
146
+ onAnomalyDetectionChange,
147
+ onComparisonTypeChange,
148
+ onSensitivityChange,
149
+ onTriggerIntervalChange,
150
+ onGranularityChange,
151
+ onDestinationChange,
152
+ onTriggerModeChange,
153
+ onRecipientsChange,
154
+ warningMessage,
155
+ isTitleValid,
156
+ };
157
+ }
@@ -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 IAutomationMetadataObjectDefinition, 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,39 +23,39 @@ 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;
@@ -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":"AAIA,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EAEb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,OAAO,EACZ,KAAK,cAAc,EACtB,MAAM,qBAAqB,CAAC;AAyB7B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmRpB"}
@@ -1,6 +1,5 @@
1
1
  // (C) 2019-2026 GoodData Corporation
2
- import { useCallback, useState } from "react";
3
- import { useIntl } from "react-intl";
2
+ import { useState } from "react";
4
3
  import { useAlertingDialogContext } from "../../../contexts/AlertingDialogContext.js";
5
4
  import { useAutomationsContext } from "../../../contexts/AutomationsContext.js";
6
5
  import { setAlertExecutionParameters } from "../../../shared/automationFilters/automationParameters.js";
@@ -8,14 +7,13 @@ import { useAutomationAlertParameters } from "../../../shared/automationFilters/
8
7
  import { getAppliedWidgetFilters, getVisibleFiltersByFilters, resolveMvfDimensionalityLocalRefs, } from "../../../shared/automationFilters/utils.js";
9
8
  import { convertCurrentUserToAutomationRecipient, convertCurrentUserToWorkspaceUser, convertExternalRecipientToAutomationRecipient, } from "../../../shared/utils/automationUtils.js";
10
9
  import { createDefaultAlert } from "../utils/convertors.js";
11
- import { transformAlertByAnomalyDetection, transformAlertByAttribute, transformAlertByComparisonOperator, transformAlertByDestination, transformAlertByGranularity, transformAlertByMetric, transformAlertByRelativeOperator, transformAlertBySensitivity, } from "../utils/transformation.js";
12
10
  import { useAlertFilters } from "./useAlertFilters.js";
11
+ import { useAlertFormState } from "./useAlertFormState.js";
13
12
  import { useAlertFormValidation } from "./useAlertFormValidation.js";
14
13
  import { useAlertSelectedValues } from "./useAlertSelectedValues.js";
15
14
  import { useAlertSupportedMetrics } from "./useAlertSupportedMetrics.js";
16
15
  import { useAlertThreshold } from "./useAlertThreshold.js";
17
16
  export function useEditAlert({ alertToEdit, notificationChannels, insight, widget, users, editedAutomationFilters, maxAutomationsRecipients, setEditedAutomationFilters, availableFiltersAsVisibleFilters, filtersForNewAutomation, externalRecipientOverride, }) {
18
- const intl = useIntl();
19
17
  const { catalogDateDatasets, catalogAttributes, currentUser, separators, weekStart, timezone, settings, allowHourlyRecurrence, features: { enableAlertOncePerInterval }, } = useAutomationsContext();
20
18
  const isInvalidConnectionToInsight = alertToEdit?.metadata?.widget && !insight;
21
19
  const { dashboardId, hiddenFilters: dashboardHiddenFilters, commonDateFilterId, dashboardEvaluationFrequency, widgetLocalIdToTabIdMap: widgetTabMap, parameterValues, } = useAlertingDialogContext();
@@ -29,10 +27,6 @@ export function useEditAlert({ alertToEdit, notificationChannels, insight, widge
29
27
  ? convertExternalRecipientToAutomationRecipient(externalRecipientOverride)
30
28
  : convertCurrentUserToAutomationRecipient(users ?? [], currentUser);
31
29
  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
30
  const resolvedAlertToEdit = (() => {
37
31
  if (!alertToEdit) {
38
32
  return undefined;
@@ -84,101 +78,19 @@ export function useEditAlert({ alertToEdit, notificationChannels, insight, widge
84
78
  //
85
79
  // Handlers
86
80
  //
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
- }, []);
81
+ const { onTitleChange, onMeasureChange, onAttributeChange, onComparisonOperatorChange, onRelativeOperatorChange, onAnomalyDetectionChange, onComparisonTypeChange, onSensitivityChange, onTriggerIntervalChange, onGranularityChange, onDestinationChange, onTriggerModeChange, onRecipientsChange, warningMessage, isTitleValid, } = useAlertFormState({
82
+ setEditedAutomation,
83
+ supportedMeasures,
84
+ supportedAttributes,
85
+ measureFormatMap,
86
+ weekStart,
87
+ timezone,
88
+ enableAlertOncePerInterval,
89
+ notificationChannels,
90
+ currentUser,
91
+ users,
92
+ alertToEdit,
93
+ });
182
94
  const { onFiltersChange, onApplyCurrentFilters } = useAlertFilters({
183
95
  setEditedAutomation,
184
96
  setEditedAutomationFilters,
@@ -1 +1 @@
1
- {"version":3,"file":"useDrillDialogExportItems.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/ViewModeDashboardInsight/InsightDrillDialog/useDrillDialogExportItems.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAQpG,MAAM,WAAW,aAAa;IAC1B,WAAW,EAAE;QACT,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,QAAQ,CAAC;KAClB,CAAC;CACL;AAED,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AACnD,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;AAEzE,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAKvB,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;4BAgJrC,CAAC"}
1
+ {"version":3,"file":"useDrillDialogExportItems.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/ViewModeDashboardInsight/InsightDrillDialog/useDrillDialogExportItems.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAQpG,MAAM,WAAW,aAAa;IAC1B,WAAW,EAAE;QACT,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,QAAQ,CAAC;KAClB,CAAC;CACL;AAED,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AACnD,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;AAEzE,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAKvB,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;4BAoJrC,CAAC"}
@@ -95,7 +95,10 @@ export const useDrillDialogExportItems = ({ isExporting, isDropdownDisabled, isE
95
95
  // When the execution reached a result limit, keep the (disabled) formatted export items in the menu
96
96
  // so the user sees they are unavailable because of the limit, instead of hiding them.
97
97
  if (hasLimitBreaks) {
98
- return allItems;
98
+ const visibleItems = isExportRawVisible
99
+ ? allItems
100
+ : allItems.filter((item) => item.id !== "csv-raw");
101
+ return visibleItems;
99
102
  }
100
103
  // Otherwise, when raw exports are not shown, disabled items are hidden as usual.
101
104
  return allItems.filter((item) => !item.isDisabled);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-dashboard",
3
- "version": "11.49.0-alpha.0",
3
+ "version": "11.49.0-alpha.1",
4
4
  "description": "GoodData SDK - Dashboard Component",
5
5
  "license": "LicenseRef-LICENSE",
6
6
  "author": "GoodData Corporation",
@@ -60,20 +60,20 @@
60
60
  "ts-invariant": "0.10.3",
61
61
  "tslib": "2.8.1",
62
62
  "uuid": "11.1.1",
63
- "@gooddata/sdk-backend-spi": "11.49.0-alpha.0",
64
- "@gooddata/sdk-backend-base": "11.49.0-alpha.0",
65
- "@gooddata/sdk-model": "11.49.0-alpha.0",
66
- "@gooddata/sdk-ui": "11.49.0-alpha.0",
67
- "@gooddata/sdk-ui-charts": "11.49.0-alpha.0",
68
- "@gooddata/sdk-ui-ext": "11.49.0-alpha.0",
69
- "@gooddata/sdk-ui-filters": "11.49.0-alpha.0",
70
- "@gooddata/sdk-ui-kit": "11.49.0-alpha.0",
71
- "@gooddata/sdk-ui-pivot": "11.49.0-alpha.0",
72
- "@gooddata/sdk-ui-geo": "11.49.0-alpha.0",
73
- "@gooddata/sdk-ui-theme-provider": "11.49.0-alpha.0",
74
- "@gooddata/sdk-ui-semantic-search": "11.49.0-alpha.0",
75
- "@gooddata/sdk-ui-vis-commons": "11.49.0-alpha.0",
76
- "@gooddata/util": "11.49.0-alpha.0"
63
+ "@gooddata/sdk-backend-base": "11.49.0-alpha.1",
64
+ "@gooddata/sdk-backend-spi": "11.49.0-alpha.1",
65
+ "@gooddata/sdk-ui": "11.49.0-alpha.1",
66
+ "@gooddata/sdk-model": "11.49.0-alpha.1",
67
+ "@gooddata/sdk-ui-charts": "11.49.0-alpha.1",
68
+ "@gooddata/sdk-ui-ext": "11.49.0-alpha.1",
69
+ "@gooddata/sdk-ui-filters": "11.49.0-alpha.1",
70
+ "@gooddata/sdk-ui-geo": "11.49.0-alpha.1",
71
+ "@gooddata/sdk-ui-kit": "11.49.0-alpha.1",
72
+ "@gooddata/sdk-ui-pivot": "11.49.0-alpha.1",
73
+ "@gooddata/sdk-ui-semantic-search": "11.49.0-alpha.1",
74
+ "@gooddata/sdk-ui-theme-provider": "11.49.0-alpha.1",
75
+ "@gooddata/sdk-ui-vis-commons": "11.49.0-alpha.1",
76
+ "@gooddata/util": "11.49.0-alpha.1"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@microsoft/api-documenter": "^7.17.0",
@@ -119,12 +119,12 @@
119
119
  "typescript": "5.9.3",
120
120
  "vitest": "4.1.8",
121
121
  "vitest-dom": "0.1.1",
122
- "@gooddata/eslint-config": "11.49.0-alpha.0",
123
- "@gooddata/i18n-toolkit": "11.49.0-alpha.0",
124
- "@gooddata/oxlint-config": "11.49.0-alpha.0",
125
- "@gooddata/reference-workspace": "11.49.0-alpha.0",
126
- "@gooddata/sdk-backend-mockingbird": "11.49.0-alpha.0",
127
- "@gooddata/stylelint-config": "11.49.0-alpha.0"
122
+ "@gooddata/eslint-config": "11.49.0-alpha.1",
123
+ "@gooddata/i18n-toolkit": "11.49.0-alpha.1",
124
+ "@gooddata/oxlint-config": "11.49.0-alpha.1",
125
+ "@gooddata/reference-workspace": "11.49.0-alpha.1",
126
+ "@gooddata/sdk-backend-mockingbird": "11.49.0-alpha.1",
127
+ "@gooddata/stylelint-config": "11.49.0-alpha.1"
128
128
  },
129
129
  "peerDependencies": {
130
130
  "react": "^18.0.0 || ^19.0.0",