@gooddata/sdk-ui-dashboard 10.9.0-alpha.7 → 10.9.0-alpha.9
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/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/model/commandHandlers/filterContext/attributeFilter/changeAttributeDisplayFormHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/filterContext/attributeFilter/changeAttributeDisplayFormHandler.js +24 -0
- package/esm/model/commandHandlers/filterContext/attributeFilter/changeAttributeDisplayFormHandler.js.map +1 -1
- package/esm/presentation/localization/bundles/de-DE.json +1 -0
- package/esm/presentation/localization/bundles/en-AU.json +475 -0
- package/esm/presentation/localization/bundles/en-GB.json +1 -0
- package/esm/presentation/localization/bundles/en-US.json +5 -0
- package/esm/presentation/localization/bundles/es-419.json +1 -0
- package/esm/presentation/localization/bundles/es-ES.json +1 -0
- package/esm/presentation/localization/bundles/fi-FI.json +475 -0
- package/esm/presentation/localization/bundles/fr-CA.json +1 -0
- package/esm/presentation/localization/bundles/fr-FR.json +1 -0
- package/esm/presentation/localization/bundles/it-IT.json +1 -0
- package/esm/presentation/localization/bundles/ja-JP.json +1 -0
- package/esm/presentation/localization/bundles/nl-NL.json +1 -0
- package/esm/presentation/localization/bundles/pt-BR.json +1 -0
- package/esm/presentation/localization/bundles/pt-PT.json +1 -0
- package/esm/presentation/localization/bundles/zh-Hans.json +1 -0
- package/esm/presentation/localization/bundles/zh-Hant.json +475 -0
- package/esm/presentation/localization/bundles/zh-Yue.json +475 -0
- package/esm/presentation/localization/translations.d.ts.map +1 -1
- package/esm/presentation/localization/translations.js +8 -0
- package/esm/presentation/localization/translations.js.map +1 -1
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertActionsDropdown.d.ts +10 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertActionsDropdown.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertActionsDropdown.js +68 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertActionsDropdown.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertComparisonOperatorSelect.d.ts +8 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertComparisonOperatorSelect.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertComparisonOperatorSelect.js +23 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertComparisonOperatorSelect.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDestinationSelect.d.ts +9 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDestinationSelect.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDestinationSelect.js +23 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDestinationSelect.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.d.ts +9 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.js +22 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertTriggerModeSelect.d.ts +8 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertTriggerModeSelect.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertTriggerModeSelect.js +32 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertTriggerModeSelect.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsList.d.ts +15 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsList.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsList.js +16 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsList.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.d.ts +12 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.js +16 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.d.ts +15 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.js +7 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.d.ts +17 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.js +40 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.d.ts +10 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.js +34 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/constants.d.ts +23 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/constants.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/constants.js +35 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/constants.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.d.ts +21 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.js +95 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.d.ts +27 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.js +127 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.d.ts +15 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.js +85 -0
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.js.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlerts.d.ts +4 -0
- package/esm/presentation/widget/insight/configuration/InsightAlerts.d.ts.map +1 -0
- package/esm/presentation/widget/insight/configuration/InsightAlerts.js +38 -0
- package/esm/presentation/widget/insight/configuration/InsightAlerts.js.map +1 -0
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.d.ts +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.d.ts.map +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.js +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.d.ts +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.d.ts.map +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.js +4 -3
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.js.map +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.d.ts.map +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.js +3 -3
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.js.map +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.d.ts +1 -0
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.d.ts.map +1 -1
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.js +20 -7
- package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.js.map +1 -1
- package/esm/presentation/widget/insightMenu/index.d.ts +1 -1
- package/esm/presentation/widget/insightMenu/index.d.ts.map +1 -1
- package/esm/presentation/widget/insightMenu/types.d.ts +25 -3
- package/esm/presentation/widget/insightMenu/types.d.ts.map +1 -1
- package/esm/presentation/widget/widget/InsightWidget/DefaultDashboardInsightWidget.js +4 -1
- package/esm/presentation/widget/widget/InsightWidget/DefaultDashboardInsightWidget.js.map +1 -1
- package/esm/presentation/widget/widget/InsightWidget/useInsightMenu.d.ts +1 -0
- package/esm/presentation/widget/widget/InsightWidget/useInsightMenu.d.ts.map +1 -1
- package/esm/presentation/widget/widget/InsightWidget/useInsightMenu.js +3 -1
- package/esm/presentation/widget/widget/InsightWidget/useInsightMenu.js.map +1 -1
- package/esm/sdk-ui-dashboard.d.ts +27 -3
- package/package.json +15 -15
- package/styles/css/alerting.css +209 -0
- package/styles/css/alerting.css.map +1 -0
- package/styles/css/main.css +208 -0
- package/styles/css/main.css.map +1 -1
- package/styles/scss/alerting.scss +249 -0
- package/styles/scss/main.scss +1 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// (C) 2022-2024 GoodData Corporation
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import isEqual from "lodash/isEqual.js";
|
|
4
|
+
import { getComparisonOperatorTitle, getMeasureTitle } from "./utils.js";
|
|
5
|
+
export const useEditAlert = ({ alert, onCreate, onUpdate }) => {
|
|
6
|
+
const [viewMode, setViewMode] = useState("edit");
|
|
7
|
+
const [updatedAlert, setUpdatedAlert] = useState(alert);
|
|
8
|
+
const changeMeasure = (measure) => {
|
|
9
|
+
setUpdatedAlert((alert) => ({
|
|
10
|
+
...alert,
|
|
11
|
+
title: getMeasureTitle(measure) ?? "",
|
|
12
|
+
description: `${getComparisonOperatorTitle(updatedAlert.alert.condition.operator)} ${alert.alert.condition.right}`,
|
|
13
|
+
alert: {
|
|
14
|
+
...alert.alert,
|
|
15
|
+
condition: {
|
|
16
|
+
...alert.alert.condition,
|
|
17
|
+
left: measure,
|
|
18
|
+
},
|
|
19
|
+
execution: {
|
|
20
|
+
...alert.alert.execution,
|
|
21
|
+
measures: [measure],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
const changeComparisonOperator = (comparisonOperator) => {
|
|
27
|
+
setUpdatedAlert((alert) => ({
|
|
28
|
+
...alert,
|
|
29
|
+
description: `${getComparisonOperatorTitle(comparisonOperator)} ${updatedAlert.alert.condition.right}`,
|
|
30
|
+
alert: {
|
|
31
|
+
...alert.alert,
|
|
32
|
+
condition: {
|
|
33
|
+
...alert.alert.condition,
|
|
34
|
+
operator: comparisonOperator,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
const changeValue = (value) => {
|
|
40
|
+
setUpdatedAlert((alert) => ({
|
|
41
|
+
...alert,
|
|
42
|
+
description: `${getComparisonOperatorTitle(updatedAlert.alert.condition.operator)} ${alert.alert.condition.right}`,
|
|
43
|
+
alert: {
|
|
44
|
+
...alert.alert,
|
|
45
|
+
condition: {
|
|
46
|
+
...alert.alert.condition,
|
|
47
|
+
right: value,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
const changeDestination = (destinationId) => {
|
|
53
|
+
setUpdatedAlert((alert) => ({
|
|
54
|
+
...alert,
|
|
55
|
+
webhook: destinationId,
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
const configureAlert = () => {
|
|
59
|
+
setViewMode("configuration");
|
|
60
|
+
};
|
|
61
|
+
const saveAlertConfiguration = (alert) => {
|
|
62
|
+
setUpdatedAlert(alert);
|
|
63
|
+
cancelAlertConfiguration();
|
|
64
|
+
};
|
|
65
|
+
const cancelAlertConfiguration = () => {
|
|
66
|
+
setViewMode("edit");
|
|
67
|
+
};
|
|
68
|
+
const createAlert = () => {
|
|
69
|
+
onCreate?.(updatedAlert);
|
|
70
|
+
};
|
|
71
|
+
const updateAlert = () => {
|
|
72
|
+
onUpdate?.(updatedAlert);
|
|
73
|
+
};
|
|
74
|
+
const isValueDefined = typeof updatedAlert.alert?.condition.right !== "undefined";
|
|
75
|
+
const isAlertChanged = !isEqual(updatedAlert, alert);
|
|
76
|
+
const canSubmit = isValueDefined && isAlertChanged;
|
|
77
|
+
return {
|
|
78
|
+
viewMode,
|
|
79
|
+
updatedAlert,
|
|
80
|
+
canSubmit,
|
|
81
|
+
//
|
|
82
|
+
changeComparisonOperator,
|
|
83
|
+
changeMeasure,
|
|
84
|
+
changeValue,
|
|
85
|
+
changeDestination,
|
|
86
|
+
//
|
|
87
|
+
configureAlert,
|
|
88
|
+
saveAlertConfiguration,
|
|
89
|
+
cancelAlertConfiguration,
|
|
90
|
+
//
|
|
91
|
+
createAlert,
|
|
92
|
+
updateAlert,
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=useEditAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditAlert.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQzE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAsB,EAAE,EAAE;IAC9E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAA2B,MAAM,CAAC,CAAC;IAC3E,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAA4B,KAAK,CAAC,CAAC;IAEnF,MAAM,aAAa,GAAG,CAAC,OAAiB,EAAE,EAAE;QACxC,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACxB,GAAG,KAAK;YACR,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE;YACrC,WAAW,EAAE,GAAG,0BAA0B,CAAC,YAAY,CAAC,KAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAC9E,KAAK,CAAC,KAAM,CAAC,SAAS,CAAC,KAC3B,EAAE;YACF,KAAK,EAAE;gBACH,GAAG,KAAK,CAAC,KAAM;gBACf,SAAS,EAAE;oBACP,GAAG,KAAK,CAAC,KAAM,CAAC,SAAS;oBACzB,IAAI,EAAE,OAAO;iBAChB;gBACD,SAAS,EAAE;oBACP,GAAG,KAAK,CAAC,KAAM,CAAC,SAAS;oBACzB,QAAQ,EAAE,CAAC,OAAO,CAAC;iBACtB;aACJ;SACJ,CAAC,CAAC,CAAC;IACR,CAAC,CAAC;IAEF,MAAM,wBAAwB,GAAG,CAAC,kBAA4C,EAAE,EAAE;Q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AEF,MAAM,wBAAwB,GAAG,GAAG,EAAE;QAClC,WAAW,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACrB,QAAQ,EAAE,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACrB,QAAQ,EAAE,CAAC,YAAyC,CAAC,CAAC;IAC1D,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,OAAO,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,KAAK,WAAW,CAAC;IAClF,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACrD,MAAM,SAAS,GAAG,cAAc,IAAI,cAAc,CAAC;IAEnD,OAAO;QACH,QAAQ;QACR,YAAY;QACZ,SAAS;QACT,EAAE;QACF,wBAAwB;QACxB,aAAa;QACb,WAAW;QACX,iBAAiB;QACjB,EAAE;QACF,cAAc;QACd,sBAAsB;QACtB,wBAAwB;QACxB,EAAE;QACF,WAAW;QACX,WAAW;KACd,CAAC;AACN,CAAC,CAAC"}
|
package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IAutomationMetadataObject, IAutomationMetadataObjectDefinition, IInsightWidget } from "@gooddata/sdk-model";
|
|
2
|
+
import { INotificationChannel } from "./constants.js";
|
|
3
|
+
type InsightWidgetAlertingViewMode = "list" | "edit" | "create";
|
|
4
|
+
export interface IInsightWidgetAlertingProps {
|
|
5
|
+
widget: IInsightWidget;
|
|
6
|
+
closeInsightWidgetMenu: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const useInsightWidgetAlerting: ({ widget, closeInsightWidgetMenu }: IInsightWidgetAlertingProps) => {
|
|
9
|
+
destinations: INotificationChannel[];
|
|
10
|
+
alerts: IAutomationMetadataObject[];
|
|
11
|
+
viewMode: InsightWidgetAlertingViewMode;
|
|
12
|
+
editingAlert: IAutomationMetadataObject | null;
|
|
13
|
+
creatingAlert: IAutomationMetadataObjectDefinition;
|
|
14
|
+
initiateAlertCreation: () => void;
|
|
15
|
+
initiateAlertEditing: (alert: IAutomationMetadataObject) => void;
|
|
16
|
+
updateExistingAlert: (alert: IAutomationMetadataObject) => void;
|
|
17
|
+
saveNewAlert: (alert: IAutomationMetadataObjectDefinition) => void;
|
|
18
|
+
pauseExistingAlert: (alert: IAutomationMetadataObject) => void;
|
|
19
|
+
resumeExistingAlert: (alert: IAutomationMetadataObject) => void;
|
|
20
|
+
deleteExistingAlert: (alert: IAutomationMetadataObject) => void;
|
|
21
|
+
cancelAlertEditing: () => void;
|
|
22
|
+
cancelAlertCreation: () => void;
|
|
23
|
+
hasAlerts: boolean;
|
|
24
|
+
supportedMeasures: import("@gooddata/sdk-model").IMeasure<import("@gooddata/sdk-model").IMeasureDefinitionType>[];
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=useInsightAlerting.d.ts.map
|
package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInsightAlerting.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.ts"],"names":[],"mappings":"AACA,OAAO,EACH,yBAAyB,EACzB,mCAAmC,EAEnC,cAAc,EACjB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,KAAK,6BAA6B,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEhE,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,cAAc,CAAC;IACvB,sBAAsB,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,wBAAwB,uCAAwC,2BAA2B;;;;;;;kCA8D/D,yBAAyB;iCAK1B,yBAAyB;0BAjChC,mCAAmC;gCA+C7B,yBAAyB;iCAexB,yBAAyB;iCAezB,yBAAyB;;;;;CA6BhE,CAAC"}
|
package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { useToastMessage } from "@gooddata/sdk-ui-kit";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { v4 as uuidv4 } from "uuid";
|
|
4
|
+
import { useDashboardSelector, selectInsightByWidgetRef } from "../../../../../model/index.js";
|
|
5
|
+
import { createDefaultAlert, getSupportedInsightMeasuresByInsight } from "./utils.js";
|
|
6
|
+
export const useInsightWidgetAlerting = ({ widget, closeInsightWidgetMenu }) => {
|
|
7
|
+
const { addSuccess } = useToastMessage();
|
|
8
|
+
// TODO: load from backend
|
|
9
|
+
const [alerts, setAlerts] = useState([]);
|
|
10
|
+
const hasAlerts = alerts.length > 0;
|
|
11
|
+
// TODO: load from backend
|
|
12
|
+
const destinations = [
|
|
13
|
+
{ id: "email", title: "Email" },
|
|
14
|
+
{ id: "webhook", title: "Webhook" },
|
|
15
|
+
];
|
|
16
|
+
// TODO: load from backend
|
|
17
|
+
const widgetFilters = [];
|
|
18
|
+
// const widgetFilters = useWidgetFilters(widget, insight);
|
|
19
|
+
const insight = useDashboardSelector(selectInsightByWidgetRef(widget.ref));
|
|
20
|
+
const supportedMeasures = getSupportedInsightMeasuresByInsight(insight);
|
|
21
|
+
const defaultMeasure = supportedMeasures[0];
|
|
22
|
+
const defaultNotificationChannelId = destinations[0].id;
|
|
23
|
+
const defaultAlert = createDefaultAlert(widgetFilters, defaultMeasure, defaultNotificationChannelId);
|
|
24
|
+
const [viewMode, setViewMode] = useState(alerts.length > 0 ? "list" : "create");
|
|
25
|
+
const [editingAlert, setEditingAlert] = useState(null);
|
|
26
|
+
const [creatingAlert, setCreatingAlert] = useState(defaultAlert);
|
|
27
|
+
const initiateAlertCreation = () => {
|
|
28
|
+
setCreatingAlert(defaultAlert);
|
|
29
|
+
setViewMode("create");
|
|
30
|
+
};
|
|
31
|
+
const saveNewAlert = (alert) => {
|
|
32
|
+
const id = uuidv4();
|
|
33
|
+
setAlerts((alertsToUpdate) => {
|
|
34
|
+
const updatedAlerts = [
|
|
35
|
+
...alertsToUpdate,
|
|
36
|
+
{
|
|
37
|
+
...alert,
|
|
38
|
+
id,
|
|
39
|
+
ref: { identifier: id, type: "automation" },
|
|
40
|
+
uri: id,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
addSuccess({ id: "Success. The alert has been added." });
|
|
44
|
+
return updatedAlerts;
|
|
45
|
+
});
|
|
46
|
+
setCreatingAlert(defaultAlert);
|
|
47
|
+
setViewMode("list");
|
|
48
|
+
};
|
|
49
|
+
const cancelAlertCreation = () => {
|
|
50
|
+
setCreatingAlert(defaultAlert);
|
|
51
|
+
if (hasAlerts) {
|
|
52
|
+
setViewMode("list");
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
closeInsightWidgetMenu();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const initiateAlertEditing = (alert) => {
|
|
59
|
+
setEditingAlert(alert);
|
|
60
|
+
setViewMode("edit");
|
|
61
|
+
};
|
|
62
|
+
const updateExistingAlert = (alert) => {
|
|
63
|
+
setAlerts((alertsToUpdate) => {
|
|
64
|
+
const updatedAlerts = alertsToUpdate.map((a) => (a.id === alert.id ? alert : a));
|
|
65
|
+
addSuccess({ id: "Success. The alert has been updated." });
|
|
66
|
+
return updatedAlerts;
|
|
67
|
+
});
|
|
68
|
+
cancelAlertEditing();
|
|
69
|
+
};
|
|
70
|
+
const cancelAlertEditing = () => {
|
|
71
|
+
setEditingAlert(null);
|
|
72
|
+
setViewMode("list");
|
|
73
|
+
};
|
|
74
|
+
const pauseExistingAlert = (alert) => {
|
|
75
|
+
setAlerts((alertsToUpdate) => {
|
|
76
|
+
const updatedAlerts = alertsToUpdate.map((a) => a.id === alert.id
|
|
77
|
+
? {
|
|
78
|
+
...a,
|
|
79
|
+
alert: { ...a.alert, trigger: { ...a.alert?.trigger, state: "PAUSED" } },
|
|
80
|
+
}
|
|
81
|
+
: a);
|
|
82
|
+
addSuccess({ id: "Success. The alert has been paused." });
|
|
83
|
+
return updatedAlerts;
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const resumeExistingAlert = (alert) => {
|
|
87
|
+
setAlerts((alertsToUpdate) => {
|
|
88
|
+
const updatedAlerts = alertsToUpdate.map((a) => a.id === alert.id
|
|
89
|
+
? {
|
|
90
|
+
...a,
|
|
91
|
+
alert: { ...a.alert, trigger: { ...a.alert?.trigger, state: "ACTIVE" } },
|
|
92
|
+
}
|
|
93
|
+
: a);
|
|
94
|
+
addSuccess({ id: "Success. The alert has been resumed." });
|
|
95
|
+
return updatedAlerts;
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
const deleteExistingAlert = (alert) => {
|
|
99
|
+
setAlerts((alertsToUpdate) => {
|
|
100
|
+
const updatedAlerts = alertsToUpdate.filter((a) => a.id !== alert.id);
|
|
101
|
+
if (updatedAlerts.length === 0) {
|
|
102
|
+
closeInsightWidgetMenu();
|
|
103
|
+
}
|
|
104
|
+
addSuccess({ id: "Success. The alert has been deleted." });
|
|
105
|
+
return updatedAlerts;
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
destinations,
|
|
110
|
+
alerts,
|
|
111
|
+
viewMode,
|
|
112
|
+
editingAlert,
|
|
113
|
+
creatingAlert,
|
|
114
|
+
initiateAlertCreation,
|
|
115
|
+
initiateAlertEditing,
|
|
116
|
+
updateExistingAlert,
|
|
117
|
+
saveNewAlert,
|
|
118
|
+
pauseExistingAlert,
|
|
119
|
+
resumeExistingAlert,
|
|
120
|
+
deleteExistingAlert,
|
|
121
|
+
cancelAlertEditing,
|
|
122
|
+
cancelAlertCreation,
|
|
123
|
+
hasAlerts,
|
|
124
|
+
supportedMeasures,
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=useInsightAlerting.js.map
|
package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInsightAlerting.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;AAWtF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAA+B,EAAE,EAAE;IACxG,MAAM,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,CAAC;IAEzC,0BAA0B;IAC1B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA8B,EAAE,CAAC,CAAC;IACtE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAEpC,0BAA0B;IAC1B,MAAM,YAAY,GAA2B;QACzC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAC/B,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;KACtC,CAAC;IAEF,0BAA0B;IAC1B,MAAM,aAAa,GAAc,EAAE,CAAC;IACpC,2DAA2D;IAE3D,MAAM,OAAO,GAAG,oBAAoB,CAAC,wBAAwB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAE,CAAC;IAC5E,MAAM,iBAAiB,GAAG,oCAAo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AC3D,OAAO,aAAa,CAAC;QACzB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO;QACH,YAAY;QACZ,MAAM;QACN,QAAQ;QACR,YAAY;QACZ,aAAa;QACb,qBAAqB;QACrB,oBAAoB;QACpB,mBAAmB;QACnB,YAAY;QACZ,kBAAkB;QAClB,mBAAmB;QACnB,mBAAmB;QACnB,kBAAkB;QAClB,mBAAmB;QACnB,SAAS;QACT,iBAAiB;KACpB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IAlertComparisonOperator, IAutomationMetadataObjectDefinition, IFilter, IInsight, IMeasure } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const getMeasureTitle: (measure: IMeasure) => string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const getComparisonOperatorTitle: (operator: IAlertComparisonOperator) => string;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const createDefaultAlert: (filters: IFilter[], measure: IMeasure, notificationChannelId: string, comparisonOperator?: IAlertComparisonOperator) => IAutomationMetadataObjectDefinition;
|
|
14
|
+
export declare const getSupportedInsightMeasuresByInsight: (insight: IInsight) => IMeasure<import("@gooddata/sdk-model").IMeasureDefinitionType>[];
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,wBAAwB,EACxB,mCAAmC,EAEnC,OAAO,EACP,QAAQ,EACR,QAAQ,EAIX,MAAM,qBAAqB,CAAC;AAI7B;;GAEG;AACH,eAAO,MAAM,eAAe,YAAa,QAAQ,uBAEhD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,aAAc,wBAAwB,KAAG,MAS/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAClB,OAAO,EAAE,WACT,QAAQ,yBACM,MAAM,uBACT,wBAAwB,KAC7C,mCAuBF,CAAC;AAyBF,eAAO,MAAM,oCAAoC,YAAa,QAAQ,qEAmCrE,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// (C) 2024 GoodData Corporation
|
|
2
|
+
import { bucketMeasures, insightBucket, measureAlias, measureTitle, } from "@gooddata/sdk-model";
|
|
3
|
+
import { COMPARISON_OPERATORS } from "./constants.js";
|
|
4
|
+
import { BucketNames } from "@gooddata/sdk-ui";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export const getMeasureTitle = (measure) => {
|
|
9
|
+
return measure ? measureTitle(measure) ?? measureAlias(measure) : undefined;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export const getComparisonOperatorTitle = (operator) => {
|
|
15
|
+
const titleByOperator = {
|
|
16
|
+
[COMPARISON_OPERATORS.COMPARISON_OPERATOR_LESS_THAN]: "Is less than",
|
|
17
|
+
[COMPARISON_OPERATORS.COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS]: "Is less than or equal to",
|
|
18
|
+
[COMPARISON_OPERATORS.COMPARISON_OPERATOR_GREATER_THAN]: "Is greater than",
|
|
19
|
+
[COMPARISON_OPERATORS.COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS]: "Is greater than or equal to",
|
|
20
|
+
};
|
|
21
|
+
return titleByOperator[operator];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export const createDefaultAlert = (filters, measure, notificationChannelId, comparisonOperator = "GREATER_THAN") => {
|
|
27
|
+
return {
|
|
28
|
+
type: "automation",
|
|
29
|
+
title: getMeasureTitle(measure),
|
|
30
|
+
description: "",
|
|
31
|
+
webhook: notificationChannelId,
|
|
32
|
+
alert: {
|
|
33
|
+
condition: {
|
|
34
|
+
type: "comparison",
|
|
35
|
+
left: measure,
|
|
36
|
+
operator: comparisonOperator,
|
|
37
|
+
right: undefined,
|
|
38
|
+
},
|
|
39
|
+
execution: {
|
|
40
|
+
attributes: [],
|
|
41
|
+
measures: [measure],
|
|
42
|
+
filters,
|
|
43
|
+
},
|
|
44
|
+
trigger: {
|
|
45
|
+
state: "ACTIVE",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export const getSupportedInsightMeasuresByInsight = (insight) => {
|
|
51
|
+
const visualizationUrl = insight?.insight.visualizationUrl;
|
|
52
|
+
const insightType = visualizationUrl?.split(":")[1];
|
|
53
|
+
switch (insightType) {
|
|
54
|
+
case "headline": {
|
|
55
|
+
const insightMeasuresBucket = insight
|
|
56
|
+
? insightBucket(insight, BucketNames.MEASURES)
|
|
57
|
+
: undefined;
|
|
58
|
+
return insightMeasuresBucket ? bucketMeasures(insightMeasuresBucket) : [];
|
|
59
|
+
}
|
|
60
|
+
case "scatter":
|
|
61
|
+
case "donut":
|
|
62
|
+
case "treemap":
|
|
63
|
+
case "combo2":
|
|
64
|
+
case "heatmap":
|
|
65
|
+
case "bubble":
|
|
66
|
+
case "bullet":
|
|
67
|
+
case "bar":
|
|
68
|
+
case "table":
|
|
69
|
+
case "area":
|
|
70
|
+
case "column":
|
|
71
|
+
case "line":
|
|
72
|
+
case "pushpin":
|
|
73
|
+
case "pie":
|
|
74
|
+
case "sankey":
|
|
75
|
+
case "dependencywheel":
|
|
76
|
+
case "funnel":
|
|
77
|
+
case "pyramid":
|
|
78
|
+
case "waterfall":
|
|
79
|
+
case "repeater":
|
|
80
|
+
default: {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/utils.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EACH,cAAc,EAOd,aAAa,EACb,YAAY,EACZ,YAAY,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAiB,EAAE,EAAE;IACjD,OAAO,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,QAAkC,EAAU,EAAE;IACrF,MAAM,eAAe,GAA6C;QAC9D,CAAC,oBAAoB,CAAC,6BAA6B,CAAC,EAAE,cAAc;QACpE,CAAC,oBAAoB,CAAC,uCAAuC,CAAC,EAAE,0BAA0B;QAC1F,CAAC,oBAAoB,CAAC,gCAAgC,CAAC,EAAE,iBAAiB;QAC1E,CAAC,oBAAoB,CAAC,0CAA0C,CAAC,EAAE,6BAA6B;KACnG,CAAC;IAEF,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAC9B,OAAkB,EAClB,OAAiB,EACjB,qBAA6B,EAC7B,qBAA+C,cAAc,EAC1B,EAAE;IACrC,OAAO;QACH,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC;QAC/B,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,qBAAqB;QAC9B,KAAK,EAAE;YACH,SA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d,KAAK,SAAS,CAAC;QACf,KAAK,WAAW,CAAC;QACjB,KAAK,UAAU,CAAC;QAChB,OAAO,CAAC,CAAC,CAAC;YACN,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightAlerts.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/widget/insight/configuration/InsightAlerts.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAS/E,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,iCAAiC,CAgFrE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// (C) 2022-2024 GoodData Corporation
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { isInsightWidget, objRefToString } from "@gooddata/sdk-model";
|
|
4
|
+
import { ScrollablePanel, OverlayControllerProvider, OverlayController } from "@gooddata/sdk-ui-kit";
|
|
5
|
+
import { stringUtils } from "@gooddata/util";
|
|
6
|
+
import cx from "classnames";
|
|
7
|
+
import { DASHBOARD_HEADER_OVERLAYS_Z_INDEX } from "../../../constants/index.js";
|
|
8
|
+
import { AlertsList } from "./InsightAlertConfig/AlertsList.js";
|
|
9
|
+
import { EditAlert } from "./InsightAlertConfig/EditAlert.js";
|
|
10
|
+
import { useInsightWidgetAlerting } from "./InsightAlertConfig/useInsightAlerting.js";
|
|
11
|
+
import { CreateAlert } from "./InsightAlertConfig/CreateAlert.js";
|
|
12
|
+
const overlayController = OverlayController.getInstance(DASHBOARD_HEADER_OVERLAYS_Z_INDEX);
|
|
13
|
+
export const InsightAlerts = ({ widget, onClose, onGoBack }) => {
|
|
14
|
+
const widgetRefSuffix = isInsightWidget(widget)
|
|
15
|
+
? stringUtils.simplifyText(objRefToString(widget.ref))
|
|
16
|
+
: "";
|
|
17
|
+
const classes = cx("configuration-scrollable-panel", "s-configuration-scrollable-panel", `s-visualization-${widgetRefSuffix}`);
|
|
18
|
+
const { alerts, hasAlerts, destinations, viewMode, supportedMeasures,
|
|
19
|
+
//
|
|
20
|
+
creatingAlert, initiateAlertCreation, cancelAlertCreation,
|
|
21
|
+
//
|
|
22
|
+
editingAlert, initiateAlertEditing, cancelAlertEditing,
|
|
23
|
+
//
|
|
24
|
+
saveNewAlert, updateExistingAlert, pauseExistingAlert, resumeExistingAlert, deleteExistingAlert, } = useInsightWidgetAlerting({ closeInsightWidgetMenu: onClose, widget });
|
|
25
|
+
let content = null;
|
|
26
|
+
if (viewMode === "list") {
|
|
27
|
+
content = (React.createElement(AlertsList, { alerts: alerts, onCreateAlert: initiateAlertCreation, onEditAlert: initiateAlertEditing, onPauseAlert: pauseExistingAlert, onResumeAlert: resumeExistingAlert, onDeleteAlert: deleteExistingAlert, onClose: onClose, onGoBack: onGoBack }));
|
|
28
|
+
}
|
|
29
|
+
else if (viewMode === "edit" && editingAlert) {
|
|
30
|
+
content = (React.createElement(EditAlert, { alert: editingAlert, hasAlerts: hasAlerts, destinations: destinations, measures: supportedMeasures, onUpdate: updateExistingAlert, onCancel: cancelAlertEditing, onClose: onClose }));
|
|
31
|
+
}
|
|
32
|
+
else if (viewMode === "create") {
|
|
33
|
+
content = (React.createElement(CreateAlert, { alert: creatingAlert, measures: supportedMeasures, hasAlerts: hasAlerts, destinations: destinations, onCreate: saveNewAlert, onCancel: cancelAlertCreation, onClose: onClose }));
|
|
34
|
+
}
|
|
35
|
+
return (React.createElement(ScrollablePanel, { className: classes },
|
|
36
|
+
React.createElement(OverlayControllerProvider, { overlayController: overlayController }, content)));
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=InsightAlerts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightAlerts.js","sourceRoot":"","sources":["../../../../../src/presentation/widget/insight/configuration/InsightAlerts.tsx"],"names":[],"mappings":"AAAA,qCAA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
children: React.ReactNode;
|
|
4
4
|
title: string;
|
|
5
5
|
onClose: () => void;
|
|
6
|
-
onBack
|
|
6
|
+
onBack?: () => void;
|
|
7
7
|
}
|
|
8
8
|
export declare const DashboardInsightSubmenuContainer: React.FC<IDashboardInsightSubmenuContainerProps>;
|
|
9
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardInsightSubmenuContainer.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,sCAAsC;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardInsightSubmenuContainer.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,sCAAsC;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAID,eAAO,MAAM,gCAAgC,EAAE,KAAK,CAAC,EAAE,CAAC,sCAAsC,CAe7F,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
interface IDashboardInsightSubmenuHeaderProps {
|
|
3
3
|
title: string;
|
|
4
|
-
onHeaderClick
|
|
4
|
+
onHeaderClick?: () => void;
|
|
5
5
|
}
|
|
6
6
|
export declare const DashboardInsightSubmenuHeader: React.FC<IDashboardInsightSubmenuHeaderProps>;
|
|
7
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardInsightSubmenuHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardInsightSubmenuHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,mCAAmC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,EAAE,CAAC,mCAAmC,CAcvF,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
// (C) 2022 GoodData Corporation
|
|
1
|
+
// (C) 2022-2024 GoodData Corporation
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Typography } from "@gooddata/sdk-ui-kit";
|
|
4
|
+
import cx from "classnames";
|
|
4
5
|
export const DashboardInsightSubmenuHeader = ({ title, onHeaderClick, }) => {
|
|
5
|
-
return (React.createElement(Typography, { tagName: "h3", className: "configuration-panel-header-title clickable
|
|
6
|
-
React.createElement("i", { className: "gd-icon-navigateleft" }),
|
|
6
|
+
return (React.createElement(Typography, { tagName: "h3", className: cx("configuration-panel-header-title", { clickable: onHeaderClick }), onClick: onHeaderClick },
|
|
7
|
+
onHeaderClick ? React.createElement("i", { className: "gd-icon-navigateleft" }) : null,
|
|
7
8
|
title));
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=DashboardInsightSubmenuHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardInsightSubmenuHeader.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"DashboardInsightSubmenuHeader.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,YAAY,CAAC;AAO5B,MAAM,CAAC,MAAM,6BAA6B,GAAkD,CAAC,EACzF,KAAK,EACL,aAAa,GAChB,EAAE,EAAE;IACD,OAAO,CACH,oBAAC,UAAU,IACP,OAAO,EAAC,IAAI,EACZ,SAAS,EAAE,EAAE,CAAC,kCAAkC,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,EAC/E,OAAO,EAAE,aAAa;QAErB,aAAa,CAAC,CAAC,CAAC,2BAAG,SAAS,EAAC,sBAAsB,GAAG,CAAC,CAAC,CAAC,IAAI;QAC7D,KAAK,CACG,CAChB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,0BAA0B,EAAyC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,0BAA0B,EAAyC,MAAM,gBAAgB,CAAC;AA8CnG,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAwBrE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// (C) 2021-
|
|
1
|
+
// (C) 2021-2024 GoodData Corporation
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { Separator } from "@gooddata/sdk-ui-kit";
|
|
4
4
|
import { DashboardInsightMenuContainer } from "./DashboardInsightMenuContainer.js";
|
|
@@ -9,8 +9,8 @@ import { DashboardInsightMenuBubble } from "./DashboardInsightMenuBubble.js";
|
|
|
9
9
|
import { DashboardInsightEditMenuBubble } from "./DashboardInsightEditMenuBubble.js";
|
|
10
10
|
const DashboardInsightMenuBody = (props) => {
|
|
11
11
|
const { items, widget, insight, submenu, setSubmenu, onClose, renderMode } = props;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const renderSubmenuComponent = submenu ? (React.createElement(submenu.SubmenuComponent, { widget: widget, onClose: onClose, onGoBack: () => setSubmenu(null) })) : null;
|
|
13
|
+
return submenu ? (submenu.renderSubmenuComponentOnly ? (renderSubmenuComponent) : (React.createElement(DashboardInsightSubmenuContainer, { onClose: onClose, title: submenu.itemName, onBack: () => setSubmenu(null) }, renderSubmenuComponent))) : (React.createElement(DashboardInsightMenuContainer, { onClose: onClose, widget: widget, insight: insight, renderMode: renderMode },
|
|
14
14
|
React.createElement(DashboardInsightMenuRoot, { items: items, setSubmenu: setSubmenu })));
|
|
15
15
|
};
|
|
16
16
|
export const DashboardInsightMenu = (props) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAGrF,MAAM,wBAAwB,GAM1B,CAAC,KAAK,EAAE,EAAE;IACV,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAEnF,OAAO,OAAO,CAAC,CAAC,CAAC,CACb,oBAAC,gCAAgC,IAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,CAAC,QAAQ,EACvB,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CA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AAC,EACD,OAAO,EAAE,IAAI,GACf,CACL,CAAC;QACN,CAAC;QACD,OAAO,oBAAC,8BAA8B,IAAC,GAAG,EAAE,IAAI,CAAC,MAAM,KAAM,IAAI,GAAI,CAAC;IAC1E,CAAC,CAAC,CACH,CACN,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -16,5 +16,6 @@ export declare function getDefaultInsightMenuItems(intl: IntlShape, config: {
|
|
|
16
16
|
isScheduleExportVisible: boolean;
|
|
17
17
|
isScheduleExportManagementVisible: boolean;
|
|
18
18
|
isDataError: boolean;
|
|
19
|
+
isAlertingVisible: boolean;
|
|
19
20
|
}): IInsightMenuItem[];
|
|
20
21
|
//# sourceMappingURL=getDefaultInsightMenuItems.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultInsightMenuItems.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"getDefaultInsightMenuItems.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C;;GAEG;AACH,wBAAgB,0BAA0B,CACtC,IAAI,EAAE,SAAS,EACf,MAAM,EAAE;IACJ,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sBAAsB,EAAE,OAAO,CAAC;IAChC,4BAA4B,EAAE,oBAAoB,GAAG,WAAW,GAAG,SAAS,CAAC;IAC7E,gCAAgC,EAAE,OAAO,CAAC;IAC1C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,0BAA0B,EAAE,MAAM,IAAI,CAAC;IACvC,uBAAuB,EAAE,OAAO,CAAC;IACjC,iCAAiC,EAAE,OAAO,CAAC;IAC3C,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;CAC9B,GACF,gBAAgB,EAAE,CAiGpB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import compact from "lodash/compact.js";
|
|
2
|
+
import { InsightAlerts } from "../../insight/configuration/InsightAlerts.js";
|
|
2
3
|
/**
|
|
3
4
|
* @internal
|
|
4
5
|
*/
|
|
5
6
|
export function getDefaultInsightMenuItems(intl, config) {
|
|
6
|
-
const { exportCSVDisabled, exportXLSXDisabled, scheduleExportDisabled, scheduleExportDisabledReason, scheduleExportManagementDisabled, onExportCSV, onExportXLSX, onScheduleExport, onScheduleManagementExport, isScheduleExportVisible, isScheduleExportManagementVisible, isDataError, } = config;
|
|
7
|
+
const { exportCSVDisabled, exportXLSXDisabled, scheduleExportDisabled, scheduleExportDisabledReason, scheduleExportManagementDisabled, onExportCSV, onExportXLSX, onScheduleExport, onScheduleManagementExport, isScheduleExportVisible, isScheduleExportManagementVisible, isDataError, isAlertingVisible, } = config;
|
|
7
8
|
const defaultWidgetTooltip = isDataError
|
|
8
9
|
? intl.formatMessage({ id: "options.menu.unsupported.error" })
|
|
9
10
|
: intl.formatMessage({ id: "options.menu.unsupported.loading" });
|
|
@@ -13,10 +14,9 @@ export function getDefaultInsightMenuItems(intl, config) {
|
|
|
13
14
|
const incompatibleWidgetTooltip = intl.formatMessage({
|
|
14
15
|
id: "options.menu.unsupported.incompatibleWidget",
|
|
15
16
|
});
|
|
16
|
-
const isSomeExportVisible = !exportXLSXDisabled || !exportCSVDisabled;
|
|
17
17
|
const isSomeScheduleVisible = (isScheduleExportVisible && !scheduleExportDisabled) ||
|
|
18
18
|
(isScheduleExportManagementVisible && !scheduleExportManagementDisabled);
|
|
19
|
-
|
|
19
|
+
const menuItems = [
|
|
20
20
|
{
|
|
21
21
|
type: "button",
|
|
22
22
|
itemId: "ExportXLSXBubble",
|
|
@@ -37,9 +37,21 @@ export function getDefaultInsightMenuItems(intl, config) {
|
|
|
37
37
|
icon: "gd-icon-download",
|
|
38
38
|
className: "s-options-menu-export-csv",
|
|
39
39
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
isAlertingVisible && {
|
|
41
|
+
itemId: "AlertingSeparator",
|
|
42
|
+
type: "separator",
|
|
43
|
+
},
|
|
44
|
+
isAlertingVisible && {
|
|
45
|
+
type: "submenu",
|
|
46
|
+
itemId: "Alerts",
|
|
47
|
+
itemName: intl.formatMessage({ id: "widget.options.menu.alerts" }),
|
|
48
|
+
icon: "gd-icon-bell",
|
|
49
|
+
className: "s-options-menu-alerting",
|
|
50
|
+
SubmenuComponent: InsightAlerts,
|
|
51
|
+
renderSubmenuComponentOnly: true,
|
|
52
|
+
},
|
|
53
|
+
isSomeScheduleVisible && {
|
|
54
|
+
itemId: "SchedulingSeparator",
|
|
43
55
|
type: "separator",
|
|
44
56
|
},
|
|
45
57
|
isScheduleExportVisible && {
|
|
@@ -66,6 +78,7 @@ export function getDefaultInsightMenuItems(intl, config) {
|
|
|
66
78
|
icon: "gd-icon-list",
|
|
67
79
|
className: "s-options-menu-schedule-export-edit",
|
|
68
80
|
},
|
|
69
|
-
]
|
|
81
|
+
];
|
|
82
|
+
return compact(menuItems);
|
|
70
83
|
}
|
|
71
84
|
//# sourceMappingURL=getDefaultInsightMenuItems.js.map
|