@gooddata/sdk-ui-dashboard 11.53.0-alpha.2 → 11.53.0-alpha.4
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/NOTICE +6 -6
- package/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/index.d.ts +4 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/AlertingDialogFilters.d.ts +8 -0
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/AlertingDialogFilters.d.ts.map +1 -0
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/AlertingDialogFilters.js +13 -0
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.js +14 -3
- package/esm/presentation/automations/alerting/types.d.ts +26 -1
- package/esm/presentation/automations/alerting/types.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts +2 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +27 -3
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduledEmailDialogFilters.d.ts +7 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduledEmailDialogFilters.d.ts.map +1 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduledEmailDialogFilters.js +11 -0
- package/esm/presentation/automations/scheduledEmail/types.d.ts +89 -3
- package/esm/presentation/automations/scheduledEmail/types.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/automationParameters.d.ts +17 -1
- package/esm/presentation/automations/shared/automationFilters/automationParameters.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/useAutomationFilters.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/useAutomationFilters.js +7 -51
- package/esm/presentation/automations/shared/automationFilters/utils.d.ts +21 -0
- package/esm/presentation/automations/shared/automationFilters/utils.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/utils.js +57 -0
- package/esm/presentation/automations/shared/slots/types.d.ts +42 -0
- package/esm/presentation/automations/shared/slots/types.d.ts.map +1 -1
- package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.d.ts.map +1 -1
- package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.js +4 -4
- package/esm/sdk-ui-dashboard.d.ts +188 -2
- package/package.json +21 -21
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ComponentType, type KeyboardEvent, type Ref } from "react";
|
|
2
|
-
import { type FilterContextItem, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type IWidget } from "@gooddata/sdk-model";
|
|
2
|
+
import { type FilterContextItem, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type IWidget, type IdentifierRef, type ParameterValue } from "@gooddata/sdk-model";
|
|
3
3
|
import { type GoodDataSdkError } from "@gooddata/sdk-ui";
|
|
4
|
-
import { type
|
|
4
|
+
import { type IAutomationFiltersTab } from "../../../model/store/filtering/types.js";
|
|
5
|
+
import { type IAutomationParameter } from "../shared/automationFilters/automationParameters.js";
|
|
6
|
+
import { type IAutomationDialogFiltersProps, type IAutomationDialogHeaderProps, type ISlotProps } from "../shared/slots/types.js";
|
|
5
7
|
/**
|
|
6
8
|
* @alpha
|
|
7
9
|
*/
|
|
@@ -139,6 +141,73 @@ export interface IScheduledEmailDialogHeaderProps extends IAutomationDialogHeade
|
|
|
139
141
|
export type ScheduledEmailDialogHeaderDefaultProps = IScheduledEmailDialogHeaderProps & {
|
|
140
142
|
ref?: Ref<HTMLInputElement>;
|
|
141
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* Props of the default scheduled email dialog's filters region (the Filters tab content).
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* The region is bimodal: whenever `filtersByTab` is present with more than one tab, the by-tab
|
|
149
|
+
* members (`filtersByTab` and the `*ByTab` parameter family) drive rendering and the flat
|
|
150
|
+
* handlers are unused; otherwise the flat members drive it and the by-tab members are unused.
|
|
151
|
+
* `defaultProps` always carries both families so a wrap stays faithful in either mode.
|
|
152
|
+
*
|
|
153
|
+
* @alpha
|
|
154
|
+
*/
|
|
155
|
+
export interface IScheduledEmailDialogFiltersProps extends IAutomationDialogFiltersProps {
|
|
156
|
+
/**
|
|
157
|
+
* Whether the schedule stores its own filters instead of using the latest saved dashboard
|
|
158
|
+
* filters.
|
|
159
|
+
*/
|
|
160
|
+
storeFilters: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Toggles filter (and parameter) persistence. The current filters must be passed back —
|
|
163
|
+
* flat mode as `(value, selectedFilters, undefined)`, by-tab mode as
|
|
164
|
+
* `(value, undefined, editedFiltersByTab)`; calling it with the value alone leaves the
|
|
165
|
+
* draft's export definitions out of sync with the toggle.
|
|
166
|
+
*/
|
|
167
|
+
onStoreFiltersChange: (value: boolean, filters?: FilterContextItem[], filtersByTab?: Record<string, FilterContextItem[]>) => void;
|
|
168
|
+
/**
|
|
169
|
+
* Whether the schedule targets the whole dashboard (shows the store-filters checkbox)
|
|
170
|
+
* rather than a single widget.
|
|
171
|
+
*/
|
|
172
|
+
isDashboardAutomation: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Filters structured per dashboard tab; when present with more than one tab, the region
|
|
175
|
+
* renders in by-tab mode.
|
|
176
|
+
*/
|
|
177
|
+
filtersByTab?: IAutomationFiltersTab[];
|
|
178
|
+
/**
|
|
179
|
+
* Edited filter selection per tab.
|
|
180
|
+
*/
|
|
181
|
+
editedFiltersByTab?: Record<string, FilterContextItem[]>;
|
|
182
|
+
/**
|
|
183
|
+
* Replaces a tab's filter selection with the complete updated record.
|
|
184
|
+
*/
|
|
185
|
+
onFiltersByTabChange?: (filtersByTab: Record<string, FilterContextItem[]>) => void;
|
|
186
|
+
/**
|
|
187
|
+
* Parameter chips per tab (by-tab mode).
|
|
188
|
+
*/
|
|
189
|
+
parametersByTab?: Record<string, IAutomationParameter[]>;
|
|
190
|
+
/**
|
|
191
|
+
* Addable workspace parameters per tab (by-tab mode).
|
|
192
|
+
*/
|
|
193
|
+
availableParametersByTab?: Record<string, IAutomationParameter[]>;
|
|
194
|
+
/**
|
|
195
|
+
* Called when a parameter is added in a tab section (by-tab mode).
|
|
196
|
+
*/
|
|
197
|
+
onParameterAddByTab?: (tabId: string, ref: IdentifierRef) => void;
|
|
198
|
+
/**
|
|
199
|
+
* Called when a parameter chip's value is edited in a tab section (by-tab mode).
|
|
200
|
+
*/
|
|
201
|
+
onParameterChangeByTab?: (tabId: string, ref: IdentifierRef, value: ParameterValue) => void;
|
|
202
|
+
/**
|
|
203
|
+
* Called when a parameter chip is removed in a tab section (by-tab mode).
|
|
204
|
+
*/
|
|
205
|
+
onParameterDeleteByTab?: (tabId: string, ref: IdentifierRef) => void;
|
|
206
|
+
/**
|
|
207
|
+
* Whether workspace parameters are enabled; adjusts the store-filters tooltip copy.
|
|
208
|
+
*/
|
|
209
|
+
parametersEnabled?: boolean;
|
|
210
|
+
}
|
|
142
211
|
/**
|
|
143
212
|
* Section-level overrides of the default scheduled email dialog.
|
|
144
213
|
*
|
|
@@ -150,6 +219,21 @@ export interface IScheduledEmailDialogSlots {
|
|
|
150
219
|
* identity — see {@link ISlotProps}.
|
|
151
220
|
*/
|
|
152
221
|
Header?: ComponentType<ISlotProps<ScheduledEmailDialogHeaderDefaultProps>>;
|
|
222
|
+
/**
|
|
223
|
+
* Wraps or replaces the Filters tab content (the filter and parameter chips). Must have a
|
|
224
|
+
* stable reference identity — see {@link ISlotProps}.
|
|
225
|
+
*
|
|
226
|
+
* Renders only in the fully rendered dialog **and only while the Filters tab is selected**:
|
|
227
|
+
* not while the dialog context reports loading, not while the stale-filters confirmation
|
|
228
|
+
* step is shown, and not on the General tab. The dialog opens on the General tab, so the
|
|
229
|
+
* slot is not mounted initially, and it unmounts — losing any local state — on every switch
|
|
230
|
+
* away from the Filters tab.
|
|
231
|
+
*
|
|
232
|
+
* A replacement takes over computing the next filters array: `onFiltersChange` /
|
|
233
|
+
* `onFiltersByTabChange` expect the complete selection, and `onStoreFiltersChange` must be
|
|
234
|
+
* passed the current filters — see {@link IScheduledEmailDialogFiltersProps}.
|
|
235
|
+
*/
|
|
236
|
+
Filters?: ComponentType<ISlotProps<IScheduledEmailDialogFiltersProps>>;
|
|
153
237
|
}
|
|
154
238
|
/**
|
|
155
239
|
* Props of {@link DefaultScheduledEmailDialog}.
|
|
@@ -157,7 +241,9 @@ export interface IScheduledEmailDialogSlots {
|
|
|
157
241
|
* @remarks
|
|
158
242
|
* Extends the shared {@link IScheduledEmailDialogProps} with customization only the default implementation
|
|
159
243
|
* supports. Slots render only in the fully rendered dialog: not while the dialog context reports
|
|
160
|
-
* loading, and not while the stale-filters confirmation step is shown.
|
|
244
|
+
* loading, and not while the stale-filters confirmation step is shown. The Filters slot
|
|
245
|
+
* additionally renders only while the Filters tab is selected — see
|
|
246
|
+
* {@link IScheduledEmailDialogSlots.Filters}.
|
|
161
247
|
*
|
|
162
248
|
* @alpha
|
|
163
249
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/presentation/automations/scheduledEmail/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/presentation/automations/scheduledEmail/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAChG,OAAO,EACH,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,UAAU,EAClB,MAAM,0BAA0B,CAAC;AAMlC;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,yBAAyB,CAAC;IAElD;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAE/F;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAEvC;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;IAE1B;;;;OAIG;IAC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C,UAAU,CAAC,iCAAiC,CAAC,CAAC,CAAC;CAC1E;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iCAAkC,SAAQ,0BAA0B;IACjF;;;OAGG;IACH,KAAK,CAAC,EAAE,0BAA0B,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,WAAW,oCAAoC;IACjD;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;IAErC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAE/F;;;;;OAKG;IACH,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAE1C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,yBAAyB,KAAK,IAAI,CAAC;IAE5D;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAE7B;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACrD;AAMD;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,aAAa,CAAC,0BAA0B,CAAC,CAAC;AAE5F;;GAEG;AACH,MAAM,MAAM,6CAA6C,GACrD,aAAa,CAAC,oCAAoC,CAAC,CAAC"}
|
|
@@ -4,13 +4,29 @@ import { type DashboardParameterMode, type IAutomationMetadataObjectDefinition,
|
|
|
4
4
|
* dialog. The `value` is the current effective value the headless run will capture; `definition`
|
|
5
5
|
* picks which control renders.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @alpha
|
|
8
8
|
*/
|
|
9
9
|
export interface IAutomationParameter {
|
|
10
|
+
/**
|
|
11
|
+
* Reference to the workspace parameter this row represents.
|
|
12
|
+
*/
|
|
10
13
|
ref: IdentifierRef;
|
|
14
|
+
/**
|
|
15
|
+
* Title shown on the parameter chip: the dashboard-level label when the dashboard defines one,
|
|
16
|
+
* otherwise the workspace parameter's title, otherwise the identifier.
|
|
17
|
+
*/
|
|
11
18
|
title: string;
|
|
19
|
+
/**
|
|
20
|
+
* The current effective value — the value a headless run of the automation will capture.
|
|
21
|
+
*/
|
|
12
22
|
value: ParameterValue;
|
|
23
|
+
/**
|
|
24
|
+
* Dashboard-level mode of the parameter, controlling whether its chip is editable in the dialog.
|
|
25
|
+
*/
|
|
13
26
|
mode: DashboardParameterMode;
|
|
27
|
+
/**
|
|
28
|
+
* Resolved definition of the parameter; determines which editing control the chip renders.
|
|
29
|
+
*/
|
|
14
30
|
definition: IParameterDefinition;
|
|
15
31
|
}
|
|
16
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automationParameters.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/automationFilters/automationParameters.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,sBAAsB,EAE3B,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,cAAc,EAKtB,MAAM,qBAAqB,CAAC;AAI7B;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"automationParameters.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/automationFilters/automationParameters.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,sBAAsB,EAE3B,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EA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E,EAChC,OAAO,EAAE,wBAAwB,EAAE,GACpC,sBAAsB,EAAE,CAG1B;AAED;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CAClD,UAAU,EAAE,oBAAoB,EAAE,GACnC,yBAAyB,EAAE,CAO7B;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACtC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,EACvD,WAAW,EAAE,OAAO,GACrB,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC,GAAG,SAAS,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,UAAQ,GAAG,OAAO,CAEpG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutomationFilters.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/automationFilters/useAutomationFilters.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAA0C,MAAM,OAAO,CAAC;AAItF,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EAEnC,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"useAutomationFilters.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/automationFilters/useAutomationFilters.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAA0C,MAAM,OAAO,CAAC;AAItF,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EAEnC,KAAK,MAAM,EACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAiFxF;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC3C,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,cAAc,EAAE,iBAAiB,EAAE,CAAC;IACpC,kCAAkC;IAClC,aAAa,EAAE,iBAAiB,EAAE,CAAC;IACnC,2DAA2D;IAC3D,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,8DAA8D;IAC9D,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,sFAAsF;IACtF,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,4DAA4D;IAC5D,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,4CAA4C;IAC5C,gBAAgB,EAAE,+BAA+B,EAAE,CAAC;IACpD,uCAAuC;IACvC,WAAW,EAAE,8BAA8B,EAAE,CAAC;CACjD;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;CAkOhC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;CAuOrC,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// (C) 2025-2026 GoodData Corporation
|
|
2
2
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
-
import { areObjRefsEqual, dashboardAttributeFilterItemDisplayForm, isDashboardAttributeFilterItem, isDashboardDateFilter, isDashboardMeasureValueFilter, } from "@gooddata/sdk-model";
|
|
5
4
|
import { useAutomationsContext } from "../../contexts/AutomationsContext.js";
|
|
6
|
-
import {
|
|
5
|
+
import { applyFilterChange, getCatalogAttributesByFilters, getCatalogDateDatasetsByFilters, getCatalogMeasuresByFilters, getFilterTitle, getNonHiddenFilters, getNonSelectedFilters, removeFilterFrom, resolveFilterToAdd, resolveTabFilterToAdd, } from "./utils.js";
|
|
7
6
|
/**
|
|
8
7
|
* Computes visible filters by removing hidden filters.
|
|
9
8
|
*/
|
|
@@ -98,12 +97,7 @@ export const useAutomationFilters = ({ availableFilters, selectedFilters, onFilt
|
|
|
98
97
|
const filterTitle = getFilterTitle(filter, allAttributes, allDateDatasets, intl);
|
|
99
98
|
const message = intl.formatMessage({ id: "automationFilters.announcement.filterChanged" }, { title: filterTitle });
|
|
100
99
|
announceFiltersChanged(message);
|
|
101
|
-
const updatedFilters = selectedFilters
|
|
102
|
-
if (areFiltersMatchedByIdentifier(prevFilter, filter)) {
|
|
103
|
-
return filter;
|
|
104
|
-
}
|
|
105
|
-
return prevFilter;
|
|
106
|
-
});
|
|
100
|
+
const updatedFilters = applyFilterChange(selectedFilters, filter);
|
|
107
101
|
onFiltersChange(updatedFilters);
|
|
108
102
|
},
|
|
109
103
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -112,26 +106,14 @@ export const useAutomationFilters = ({ availableFilters, selectedFilters, onFilt
|
|
|
112
106
|
const filterTitle = getFilterTitle(filter, allAttributes, allDateDatasets, intl);
|
|
113
107
|
const message = intl.formatMessage({ id: "automationFilters.announcement.filterRemoved" }, { title: filterTitle });
|
|
114
108
|
announceFiltersChanged(message);
|
|
115
|
-
const updatedFilters = selectedFilters
|
|
109
|
+
const updatedFilters = removeFilterFrom(selectedFilters, filter);
|
|
116
110
|
onFiltersChange(updatedFilters);
|
|
117
111
|
focusFilterGroup();
|
|
118
112
|
},
|
|
119
113
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
114
|
[onFiltersChange, focusFilterGroup, selectedFilters, allAttributes, allDateDatasets, intl]);
|
|
121
115
|
const handleAddFilter = useCallback((catalogItemRef, attributes, dateDatasets) => {
|
|
122
|
-
|
|
123
|
-
// the filter is using different display form.
|
|
124
|
-
const selectedAttributeDisplayForms = attributes
|
|
125
|
-
.find((attribute) => attribute.displayForms.some((df) => areObjRefsEqual(df.ref, catalogItemRef)))
|
|
126
|
-
?.displayForms?.map((df) => df.ref) ?? [];
|
|
127
|
-
const selectedDateDataSets = dateDatasets.filter((ds) => areObjRefsEqual(ds.dataSet.ref, catalogItemRef));
|
|
128
|
-
const attributeFilter = selectedAttributeDisplayForms.reduce((acc, displayFormRef) => acc || getFilterByCatalogItemRef(displayFormRef, nonSelectedFilters), undefined);
|
|
129
|
-
const dateFilter = selectedDateDataSets.reduce((acc, dateDataSet) => acc || getFilterByCatalogItemRef(dateDataSet.dataSet.ref, nonSelectedFilters), undefined);
|
|
130
|
-
// For MVF: the dropdown emits the metric's catalog ref directly; look it up by ref.
|
|
131
|
-
const measureFilter = getFilterByCatalogItemRef(catalogItemRef, nonSelectedFilters);
|
|
132
|
-
const filter = attributeFilter ||
|
|
133
|
-
dateFilter ||
|
|
134
|
-
(measureFilter && isDashboardMeasureValueFilter(measureFilter) ? measureFilter : undefined);
|
|
116
|
+
const filter = resolveFilterToAdd(catalogItemRef, nonSelectedFilters, attributes, dateDatasets);
|
|
135
117
|
if (filter) {
|
|
136
118
|
const filterTitle = getFilterTitle(filter, allAttributes, allDateDatasets, intl);
|
|
137
119
|
const message = intl.formatMessage({ id: "automationFilters.announcement.filterAdded" }, { title: filterTitle });
|
|
@@ -259,11 +241,7 @@ export const useAutomationFiltersByTab = ({ filtersByTab, editedFiltersByTab, on
|
|
|
259
241
|
if (!updatedFilter) {
|
|
260
242
|
return;
|
|
261
243
|
}
|
|
262
|
-
const
|
|
263
|
-
const updatedTabFilters = currentTabFilters.map((f) => {
|
|
264
|
-
const currentFilterLocalId = getFilterLocalIdentifier(f);
|
|
265
|
-
return currentFilterLocalId === filterLocalId ? updatedFilter : f;
|
|
266
|
-
});
|
|
244
|
+
const updatedTabFilters = applyFilterChange(currentTabFilters, updatedFilter);
|
|
267
245
|
onFiltersByTabChange({
|
|
268
246
|
...editedFiltersByTab,
|
|
269
247
|
[tabId]: updatedTabFilters,
|
|
@@ -274,11 +252,7 @@ export const useAutomationFiltersByTab = ({ filtersByTab, editedFiltersByTab, on
|
|
|
274
252
|
return;
|
|
275
253
|
}
|
|
276
254
|
const currentTabFilters = editedFiltersByTab[tabId] ?? [];
|
|
277
|
-
const
|
|
278
|
-
const updatedTabFilters = currentTabFilters.filter((f) => {
|
|
279
|
-
const currentFilterLocalId = getFilterLocalIdentifier(f);
|
|
280
|
-
return currentFilterLocalId !== filterLocalId;
|
|
281
|
-
});
|
|
255
|
+
const updatedTabFilters = removeFilterFrom(currentTabFilters, filterToDelete);
|
|
282
256
|
onFiltersByTabChange({
|
|
283
257
|
...editedFiltersByTab,
|
|
284
258
|
[tabId]: updatedTabFilters,
|
|
@@ -293,25 +267,7 @@ export const useAutomationFiltersByTab = ({ filtersByTab, editedFiltersByTab, on
|
|
|
293
267
|
if (!tabData) {
|
|
294
268
|
return;
|
|
295
269
|
}
|
|
296
|
-
|
|
297
|
-
// the filter is using different display form (same logic as flat version).
|
|
298
|
-
const selectedAttributeDisplayForms = attributes
|
|
299
|
-
.find((attribute) => attribute.displayForms.some((df) => areObjRefsEqual(df.ref, displayForm)))
|
|
300
|
-
?.displayForms?.map((df) => df.ref) ?? [];
|
|
301
|
-
const selectedDateDataSets = dateDatasets.filter((ds) => areObjRefsEqual(ds.dataSet.ref, displayForm));
|
|
302
|
-
// Search through all display forms to find matching filter
|
|
303
|
-
const availableFilter = tabData.availableFilters.find((f) => {
|
|
304
|
-
if (isDashboardAttributeFilterItem(f)) {
|
|
305
|
-
return selectedAttributeDisplayForms.some((dfRef) => areObjRefsEqual(dashboardAttributeFilterItemDisplayForm(f), dfRef));
|
|
306
|
-
}
|
|
307
|
-
else if (isDashboardDateFilter(f)) {
|
|
308
|
-
return selectedDateDataSets.some((ds) => areObjRefsEqual(f.dateFilter.dataSet, ds.dataSet.ref));
|
|
309
|
-
}
|
|
310
|
-
else if (isDashboardMeasureValueFilter(f)) {
|
|
311
|
-
return areObjRefsEqual(f.dashboardMeasureValueFilter.measure, displayForm);
|
|
312
|
-
}
|
|
313
|
-
return false;
|
|
314
|
-
});
|
|
270
|
+
const availableFilter = resolveTabFilterToAdd(displayForm, tabData.availableFilters, attributes, dateDatasets);
|
|
315
271
|
if (availableFilter) {
|
|
316
272
|
onFiltersByTabChange({
|
|
317
273
|
...editedFiltersByTab,
|
|
@@ -4,6 +4,27 @@ import { type ExtendedDashboardWidget } from "../../../../model/types/layoutType
|
|
|
4
4
|
export declare const getFilterLocalIdentifier: (filter: FilterContextItem) => string | undefined;
|
|
5
5
|
export declare const validateAllFilterLocalIdentifiers: (filters: FilterContextItem[]) => boolean;
|
|
6
6
|
export declare const areFiltersMatchedByIdentifier: (filter1: FilterContextItem, filter2: FilterContextItem) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Returns `filters` with the entry matching `changed` (by filter local identifier) replaced by
|
|
9
|
+
* `changed`; non-matching entries keep their references.
|
|
10
|
+
*/
|
|
11
|
+
export declare function applyFilterChange(filters: FilterContextItem[], changed: FilterContextItem): FilterContextItem[];
|
|
12
|
+
/**
|
|
13
|
+
* Returns `filters` without the entry matching `toRemove` (by filter local identifier).
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeFilterFrom(filters: FilterContextItem[], toRemove: FilterContextItem): FilterContextItem[];
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the filter to add for a catalog item picked in the Add dropdown, searching `candidates`
|
|
18
|
+
* (the not-yet-selected filters). Attribute items match through every display form of the owning
|
|
19
|
+
* attribute, date items through their dataset, measure items by the metric's own ref (MVF only).
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveFilterToAdd(catalogItemRef: ObjRef, candidates: FilterContextItem[], attributes: ICatalogAttribute[], dateDatasets: ICatalogDateDataset[]): FilterContextItem | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* By-tab variant of {@link resolveFilterToAdd}: searches a tab's `availableFilters` by filter
|
|
24
|
+
* shape. Deliberately not converged with the flat resolver — the candidate sets differ
|
|
25
|
+
* (available vs non-selected), so unifying them changes duplicate-add behavior.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveTabFilterToAdd(catalogItemRef: ObjRef, availableFilters: FilterContextItem[], attributes: ICatalogAttribute[], dateDatasets: ICatalogDateDataset[]): FilterContextItem | undefined;
|
|
7
28
|
export declare const getNonSelectedFilters: (allFilters: FilterContextItem[], selectedFilters: FilterContextItem[]) => FilterContextItem[];
|
|
8
29
|
export declare const getCatalogAttributesByFilters: (filters: FilterContextItem[], attributes: ICatalogAttribute[], attributeConfigs: IDashboardAttributeFilterConfig[]) => ICatalogAttribute[];
|
|
9
30
|
export declare const getCatalogMeasuresByFilters: (filters: FilterContextItem[], measures: ICatalogMeasure[], mvfConfigs: IDashboardMeasureValueFilterConfig[]) => ICatalogMeasure[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/automationFilters/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,MAAM,EA6Bd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEtF,eAAO,MAAM,wBAAwB,mDAEpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,2CAE7C,CAAC;AAEF,eAAO,MAAM,6BAA6B,qEAKzC,CAAC;AAEF,eAAO,MAAM,qBAAqB,gGASjC,CAAC;AAEF,eAAO,MAAM,6BAA6B,6IA0BzC,CAAC;AAEF,eAAO,MAAM,2BAA2B,oIAqBvC,CAAC;AAEF,eAAO,MAAM,+BAA+B,4IAwB3C,CAAC;AAEF,eAAO,MAAM,yBAAyB,8EAcrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,uOA0B/B,CAAC;AAEF,eAAO,MAAM,0BAA0B,sGAYtC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAuB5D;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CA+C3E;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,qHAMnD;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,uBAAuB,GAAG,OAAO,CA+B3G;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAazE;AAED,eAAO,MAAM,cAAc,oIA8C1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/automationFilters/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,MAAM,EA6Bd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEtF,eAAO,MAAM,wBAAwB,mDAEpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,2CAE7C,CAAC;AAEF,eAAO,MAAM,6BAA6B,qEAKzC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,OAAO,EAAE,iBAAiB,EAAE,EAC5B,OAAO,EAAE,iBAAiB,GAC3B,iBAAiB,EAAE,CAErB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,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@@ export const validateAllFilterLocalIdentifiers = (filters) => {
|
|
|
10
10
|
export const areFiltersMatchedByIdentifier = (filter1, filter2) => {
|
|
11
11
|
return getFilterLocalIdentifier(filter1) === getFilterLocalIdentifier(filter2);
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Returns `filters` with the entry matching `changed` (by filter local identifier) replaced by
|
|
15
|
+
* `changed`; non-matching entries keep their references.
|
|
16
|
+
*/
|
|
17
|
+
export function applyFilterChange(filters, changed) {
|
|
18
|
+
return filters.map((filter) => (areFiltersMatchedByIdentifier(filter, changed) ? changed : filter));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns `filters` without the entry matching `toRemove` (by filter local identifier).
|
|
22
|
+
*/
|
|
23
|
+
export function removeFilterFrom(filters, toRemove) {
|
|
24
|
+
return filters.filter((filter) => !areFiltersMatchedByIdentifier(filter, toRemove));
|
|
25
|
+
}
|
|
26
|
+
function getCatalogItemTargets(catalogItemRef, attributes, dateDatasets) {
|
|
27
|
+
// The dropdown may emit a different display form than the filter uses, so all display forms
|
|
28
|
+
// of the owning attribute are candidates.
|
|
29
|
+
const attributeDisplayForms = attributes
|
|
30
|
+
.find((attribute) => attribute.displayForms.some((df) => areObjRefsEqual(df.ref, catalogItemRef)))
|
|
31
|
+
?.displayForms?.map((df) => df.ref) ?? [];
|
|
32
|
+
const dateDataSets = dateDatasets.filter((ds) => areObjRefsEqual(ds.dataSet.ref, catalogItemRef));
|
|
33
|
+
return { attributeDisplayForms, dateDataSets };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolves the filter to add for a catalog item picked in the Add dropdown, searching `candidates`
|
|
37
|
+
* (the not-yet-selected filters). Attribute items match through every display form of the owning
|
|
38
|
+
* attribute, date items through their dataset, measure items by the metric's own ref (MVF only).
|
|
39
|
+
*/
|
|
40
|
+
export function resolveFilterToAdd(catalogItemRef, candidates, attributes, dateDatasets) {
|
|
41
|
+
const { attributeDisplayForms, dateDataSets } = getCatalogItemTargets(catalogItemRef, attributes, dateDatasets);
|
|
42
|
+
const attributeFilter = attributeDisplayForms.reduce((acc, displayFormRef) => acc || getFilterByCatalogItemRef(displayFormRef, candidates), undefined);
|
|
43
|
+
const dateFilter = dateDataSets.reduce((acc, dateDataSet) => acc || getFilterByCatalogItemRef(dateDataSet.dataSet.ref, candidates), undefined);
|
|
44
|
+
// For MVF: the dropdown emits the metric's catalog ref directly; look it up by ref.
|
|
45
|
+
const measureFilter = getFilterByCatalogItemRef(catalogItemRef, candidates);
|
|
46
|
+
return (attributeFilter ||
|
|
47
|
+
dateFilter ||
|
|
48
|
+
(measureFilter && isDashboardMeasureValueFilter(measureFilter) ? measureFilter : undefined));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* By-tab variant of {@link resolveFilterToAdd}: searches a tab's `availableFilters` by filter
|
|
52
|
+
* shape. Deliberately not converged with the flat resolver — the candidate sets differ
|
|
53
|
+
* (available vs non-selected), so unifying them changes duplicate-add behavior.
|
|
54
|
+
*/
|
|
55
|
+
export function resolveTabFilterToAdd(catalogItemRef, availableFilters, attributes, dateDatasets) {
|
|
56
|
+
const { attributeDisplayForms, dateDataSets } = getCatalogItemTargets(catalogItemRef, attributes, dateDatasets);
|
|
57
|
+
return availableFilters.find((f) => {
|
|
58
|
+
if (isDashboardAttributeFilterItem(f)) {
|
|
59
|
+
return attributeDisplayForms.some((dfRef) => areObjRefsEqual(dashboardAttributeFilterItemDisplayForm(f), dfRef));
|
|
60
|
+
}
|
|
61
|
+
else if (isDashboardDateFilter(f)) {
|
|
62
|
+
return dateDataSets.some((ds) => areObjRefsEqual(f.dateFilter.dataSet, ds.dataSet.ref));
|
|
63
|
+
}
|
|
64
|
+
else if (isDashboardMeasureValueFilter(f)) {
|
|
65
|
+
return areObjRefsEqual(f.dashboardMeasureValueFilter.measure, catalogItemRef);
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
13
70
|
export const getNonSelectedFilters = (allFilters, selectedFilters) => {
|
|
14
71
|
return allFilters.filter((allFilter) => {
|
|
15
72
|
return !selectedFilters.some((selectedFilter) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type ComponentType, type ReactNode } from "react";
|
|
2
|
+
import { type FilterContextItem, type IdentifierRef, type ParameterValue } from "@gooddata/sdk-model";
|
|
3
|
+
import { type IAutomationParameter } from "../automationFilters/automationParameters.js";
|
|
2
4
|
/**
|
|
3
5
|
* Contract of a section-level slot: the default implementation and the exact props the default
|
|
4
6
|
* dialog would render it with.
|
|
@@ -55,4 +57,44 @@ export interface IAutomationDialogHeaderProps {
|
|
|
55
57
|
*/
|
|
56
58
|
onChange: (value: string) => void;
|
|
57
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Members shared by both automation dialogs' filters regions.
|
|
62
|
+
*
|
|
63
|
+
* @alpha
|
|
64
|
+
*/
|
|
65
|
+
export interface IAutomationDialogFiltersProps {
|
|
66
|
+
/**
|
|
67
|
+
* All filters the automation could select from.
|
|
68
|
+
*/
|
|
69
|
+
availableFilters: FilterContextItem[] | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The automation's current filter selection.
|
|
72
|
+
*/
|
|
73
|
+
selectedFilters: FilterContextItem[];
|
|
74
|
+
/**
|
|
75
|
+
* Replaces the selection with the complete updated array. The dialog state applies it
|
|
76
|
+
* wholesale — change/remove/add gestures must submit the whole array, not a delta.
|
|
77
|
+
*/
|
|
78
|
+
onFiltersChange: (filters: FilterContextItem[]) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Parameter chips to render. Empty or undefined while the `enableParameters` feature is off.
|
|
81
|
+
*/
|
|
82
|
+
parameters?: IAutomationParameter[];
|
|
83
|
+
/**
|
|
84
|
+
* Workspace parameters addable via the "+" menu.
|
|
85
|
+
*/
|
|
86
|
+
availableParameters?: IAutomationParameter[];
|
|
87
|
+
/**
|
|
88
|
+
* Called when a parameter is added from the "+" menu.
|
|
89
|
+
*/
|
|
90
|
+
onParameterAdd: (ref: IdentifierRef) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Called when a parameter chip's value is edited.
|
|
93
|
+
*/
|
|
94
|
+
onParameterChange: (ref: IdentifierRef, value: ParameterValue) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Called when a parameter chip is removed.
|
|
97
|
+
*/
|
|
98
|
+
onParameterDelete: (ref: IdentifierRef) => void;
|
|
99
|
+
}
|
|
58
100
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/slots/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,UAAU,CAAC,MAAM;IAC9B;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE/B;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IACzC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,kBAAkB,EAAE,SAAS,CAAC;IAE9B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/slots/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa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;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultDashboardSettingsDialog.d.ts","sourceRoot":"","sources":["../../../src/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAoD,MAAM,OAAO,CAAC;AA2C5F,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAGhE;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,EAC3C,SAAS,EACT,OAAO,EACP,QAAQ,EACX,EAAE,6BAA6B,GAAG,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"DefaultDashboardSettingsDialog.d.ts","sourceRoot":"","sources":["../../../src/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAoD,MAAM,OAAO,CAAC;AA2C5F,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAGhE;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,EAC3C,SAAS,EACT,OAAO,EACP,QAAQ,EACX,EAAE,6BAA6B,GAAG,YAAY,GAAG,IAAI,CAiRrD"}
|
|
@@ -121,7 +121,7 @@ export function DefaultDashboardSettingsDialog({ isVisible, onApply, onCancel /*
|
|
|
121
121
|
timezoneId,
|
|
122
122
|
}),
|
|
123
123
|
});
|
|
124
|
-
} }), _jsx(ConfigurationOption, { label: intl.formatMessage({
|
|
124
|
+
} }), _jsx(ConfigurationOption, { dataTestId: "s-timezone-allow-user-override", label: intl.formatMessage({
|
|
125
125
|
id: "settingsDashboardDialog.section.timezone.allowUserOverride.toggle",
|
|
126
126
|
}), tooltip: intl.formatMessage({
|
|
127
127
|
id: "settingsDashboardDialog.section.timezone.allowUserOverride.toggle.tooltip",
|
|
@@ -133,7 +133,7 @@ export function DefaultDashboardSettingsDialog({ isVisible, onApply, onCancel /*
|
|
|
133
133
|
allowUserOverrideInViewMode: isChecked,
|
|
134
134
|
}),
|
|
135
135
|
});
|
|
136
|
-
} }), _jsx(ConfigurationOption, { label: intl.formatMessage({
|
|
136
|
+
} }), _jsx(ConfigurationOption, { dataTestId: "s-timezone-show-info", label: intl.formatMessage({
|
|
137
137
|
id: "settingsDashboardDialog.section.timezone.showTimezoneInfo.toggle",
|
|
138
138
|
}), tooltip: intl.formatMessage({
|
|
139
139
|
id: "settingsDashboardDialog.section.timezone.showTimezoneInfo.toggle.tooltip",
|
|
@@ -149,8 +149,8 @@ export function DefaultDashboardSettingsDialog({ isVisible, onApply, onCancel /*
|
|
|
149
149
|
] })) : null] }) }));
|
|
150
150
|
}
|
|
151
151
|
const BUBBLE_ALIGN_POINTS = [{ align: "bc tl" }];
|
|
152
|
-
function ConfigurationOption({ label, tooltip, isChecked, onChange }) {
|
|
153
|
-
return (_jsx("div", { className: "configuration-category-item", children: _jsxs("label", { className: "input-checkbox-toggle", children: [
|
|
152
|
+
function ConfigurationOption({ label, tooltip, isChecked, onChange, dataTestId }) {
|
|
153
|
+
return (_jsx("div", { className: "configuration-category-item", children: _jsxs("label", { className: "input-checkbox-toggle", "data-testid": dataTestId, children: [
|
|
154
154
|
_jsx("input", { type: "checkbox", checked: isChecked, onChange: (e) => {
|
|
155
155
|
onChange(e.currentTarget.checked);
|
|
156
156
|
} }), _jsxs("span", { className: "input-label-text", children: [label, _jsxs(BubbleHoverTrigger, { showDelay: 0, hideDelay: 0, eventsOnBubble: true, className: "configuration-category-item-tooltip-icon", children: [
|