logitude-dashboard-library 3.1.59 → 3.1.61

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.
@@ -9,6 +9,7 @@ export declare type CustomChartProps = {
9
9
  isPreviewModeActive?: boolean;
10
10
  isInEditMode?: boolean;
11
11
  onSelectDataPoint: (dataPointSelection: DataPointSelection) => void;
12
+ onShowError?: (errorMsg: string | null) => void;
12
13
  };
13
14
  declare const CustomChart: (props: CustomChartProps) => React.JSX.Element;
14
15
  export default CustomChart;
package/dist/index.js CHANGED
@@ -836,6 +836,7 @@ var KpiChart = function KpiChart(props) {
836
836
  postWidget.onChange = undefined;
837
837
  dashboardAnalyticsService.getKpiData(postWidget).then(function (result) {
838
838
  setData(result.data);
839
+ handleResponseErrors(result);
839
840
  setIsLoading(false);
840
841
  }, function (error) {
841
842
  var _error$response, _error$response$data, _error$response2, _error$response2$data;
@@ -846,6 +847,20 @@ var KpiChart = function KpiChart(props) {
846
847
  });
847
848
  };
848
849
 
850
+ var handleResponseErrors = function handleResponseErrors(result) {
851
+ if (props.customChartProps.onShowError) {
852
+ var _result$data, _result$data2;
853
+
854
+ if (result !== null && result !== void 0 && result.data && !isNullOrUndefined(result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.Errors) && (result === null || result === void 0 ? void 0 : (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.Errors.length) > 0) {
855
+ var _result$data3;
856
+
857
+ props.customChartProps.onShowError(result === null || result === void 0 ? void 0 : (_result$data3 = result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.Errors[0]);
858
+ } else {
859
+ props.customChartProps.onShowError(null);
860
+ }
861
+ }
862
+ };
863
+
849
864
  var kpiClick = function kpiClick() {
850
865
  var _widget$current2, _widget$current3, _widget$current4, _widget$current4$Widg;
851
866
 
@@ -2678,6 +2693,8 @@ var FusionChart = React.forwardRef(function (props, comRef) {
2678
2693
  var _result$data6;
2679
2694
 
2680
2695
  showTargetUsageTooltipMessageError(result === null || result === void 0 ? void 0 : (_result$data6 = result.data) === null || _result$data6 === void 0 ? void 0 : _result$data6.Errors[0]);
2696
+ } else {
2697
+ showTargetUsageTooltipMessageError(null);
2681
2698
  }
2682
2699
 
2683
2700
  setDataLoaded(true);
@@ -3203,7 +3220,18 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
3203
3220
  var _widget$current4, _widget$current5, _widget$current6, _widget$current7, _widget$current8;
3204
3221
 
3205
3222
  if (isLoading || !((_widget$current4 = widget.current) !== null && _widget$current4 !== void 0 && _widget$current4.TypeCode)) return "";
3206
- if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "kpi" || ((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.TypeCode) == "table" || ((_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.TypeCode) == "pivot") return React__default.createElement(CustomChart, {
3223
+ if (((_widget$current5 = widget.current) === null || _widget$current5 === void 0 ? void 0 : _widget$current5.TypeCode) == "kpi") return React__default.createElement(CustomChart, {
3224
+ isInEditMode: props.isInEditMode,
3225
+ isPreviewModeActive: props.isPreviewModeActive,
3226
+ dataBinding: props.dataBinding,
3227
+ widget: widget.current,
3228
+ widgetRef: props.widgetRef,
3229
+ onSelectDataPoint: props.onSelectDataPoint,
3230
+ onShowError: function onShowError(errorMsg) {
3231
+ return showErrorMsg(errorMsg);
3232
+ }
3233
+ });
3234
+ if (((_widget$current6 = widget.current) === null || _widget$current6 === void 0 ? void 0 : _widget$current6.TypeCode) == "table" || ((_widget$current7 = widget.current) === null || _widget$current7 === void 0 ? void 0 : _widget$current7.TypeCode) == "pivot") return React__default.createElement(CustomChart, {
3207
3235
  isInEditMode: props.isInEditMode,
3208
3236
  isPreviewModeActive: props.isPreviewModeActive,
3209
3237
  dataBinding: props.dataBinding,
@@ -3234,6 +3262,9 @@ var WidgetCard = React.forwardRef(function (props, comRef) {
3234
3262
  if (msg && msg.length > 0) {
3235
3263
  setHeaderErrorMessages(msg || "");
3236
3264
  setShowHeaderErrorMessages(true);
3265
+ } else {
3266
+ setHeaderErrorMessages("");
3267
+ setShowHeaderErrorMessages(false);
3237
3268
  }
3238
3269
  };
3239
3270