logitude-dashboard-library 3.1.121 → 3.1.125
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/dist/Utils/WidgetLoadLogger.d.ts +2 -1
- package/dist/features/Dashboard/ChartsComponents/FusionCharts/FusionChartObjectHelper.d.ts +1 -0
- package/dist/index.js +84 -11
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +84 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/types/WidgetLoadLog.d.ts +3 -0
- package/package.json +1 -1
|
@@ -3,7 +3,8 @@ import { AxiosResponse } from "axios";
|
|
|
3
3
|
export declare class WidgetLoadLogger {
|
|
4
4
|
private StartTime;
|
|
5
5
|
private Widget;
|
|
6
|
-
|
|
6
|
+
private RequestName;
|
|
7
|
+
constructor(widget: ReactWidgetPM, isPreviewMode: boolean | null | undefined, requestName: string | null | undefined);
|
|
7
8
|
log(loadDataResponse: AxiosResponse<any, any>): void;
|
|
8
9
|
private canCreateLog;
|
|
9
10
|
private getLoadTime;
|
package/dist/index.js
CHANGED
|
@@ -967,13 +967,15 @@ var WidgetLoadLogService = /*#__PURE__*/function () {
|
|
|
967
967
|
}();
|
|
968
968
|
|
|
969
969
|
var WidgetLoadLogger = /*#__PURE__*/function () {
|
|
970
|
-
function WidgetLoadLogger(widget, isPreviewMode) {
|
|
970
|
+
function WidgetLoadLogger(widget, isPreviewMode, requestName) {
|
|
971
971
|
this.StartTime = null;
|
|
972
972
|
this.Widget = null;
|
|
973
|
+
this.RequestName = null;
|
|
973
974
|
|
|
974
975
|
if (!isPreviewMode) {
|
|
975
976
|
this.StartTime = new Date().getTime();
|
|
976
977
|
this.Widget = widget;
|
|
978
|
+
this.RequestName = requestName;
|
|
977
979
|
}
|
|
978
980
|
}
|
|
979
981
|
|
|
@@ -989,7 +991,10 @@ var WidgetLoadLogger = /*#__PURE__*/function () {
|
|
|
989
991
|
DashboardId: this.Widget.DashboardId,
|
|
990
992
|
LoadTime: this.getLoadTime(loadDataResponse),
|
|
991
993
|
TotalExecutionTime: totalExecutionTime,
|
|
992
|
-
IsClickHouse: this.isClickHouse(loadDataResponse)
|
|
994
|
+
IsClickHouse: this.isClickHouse(loadDataResponse),
|
|
995
|
+
RequestName: this.RequestName,
|
|
996
|
+
WidgetType: this.Widget.TypeCode,
|
|
997
|
+
IsDrillDown: false
|
|
993
998
|
};
|
|
994
999
|
widgetLoadLogService.create(widgetLoadLog).then(function (_response) {}, function (_error) {});
|
|
995
1000
|
}
|
|
@@ -1107,7 +1112,7 @@ var KpiChart = function KpiChart(props) {
|
|
|
1107
1112
|
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
1108
1113
|
var postWidget = calculateWidgetKPISettingsDates();
|
|
1109
1114
|
postWidget.onChange = undefined;
|
|
1110
|
-
var widgetLoadLogger = new WidgetLoadLogger(postWidget, props.customChartProps.isPreviewModeActive);
|
|
1115
|
+
var widgetLoadLogger = new WidgetLoadLogger(postWidget, props.customChartProps.isPreviewModeActive, "PostGetKpiData");
|
|
1111
1116
|
dashboardAnalyticsService.getKpiData(postWidget).then(function (result) {
|
|
1112
1117
|
setData(result.data);
|
|
1113
1118
|
handleResponseErrors(result);
|
|
@@ -1504,7 +1509,7 @@ var TableChart = function TableChart(props) {
|
|
|
1504
1509
|
widget.onChange = undefined;
|
|
1505
1510
|
widget.PageIndex = 0;
|
|
1506
1511
|
widget.PageSize = 100;
|
|
1507
|
-
var widgetLoadLogger = new WidgetLoadLogger(widget, props.customChartProps.isPreviewModeActive);
|
|
1512
|
+
var widgetLoadLogger = new WidgetLoadLogger(widget, props.customChartProps.isPreviewModeActive, "PostGetTableData");
|
|
1508
1513
|
dashboardAnalyticsService.getTableData(widget).then(function (res) {
|
|
1509
1514
|
if (res && res.data) {
|
|
1510
1515
|
fillTableData(res.data);
|
|
@@ -2084,7 +2089,7 @@ var PivotTable = React.forwardRef(function (props, comRef) {
|
|
|
2084
2089
|
}
|
|
2085
2090
|
|
|
2086
2091
|
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
2087
|
-
var widgetLoadLogger = new WidgetLoadLogger(props.customChartProps.widget, props.customChartProps.isPreviewModeActive);
|
|
2092
|
+
var widgetLoadLogger = new WidgetLoadLogger(props.customChartProps.widget, props.customChartProps.isPreviewModeActive, "PostGetPivotData");
|
|
2088
2093
|
dashboardAnalyticsService.getPivotData(props.customChartProps.widget).then(function (res) {
|
|
2089
2094
|
tabledata.current = res.data;
|
|
2090
2095
|
setPivotDataSourceFields();
|
|
@@ -2537,6 +2542,7 @@ var quarters = ["Q", "Q1", "Q2", "Q3", "Q4"];
|
|
|
2537
2542
|
function getCategoriesBasedDataSource(chartInfo, seriesMeasures, widget) {
|
|
2538
2543
|
if (seriesMeasuresIsEmpty(seriesMeasures)) return null;
|
|
2539
2544
|
handelNullLabels(seriesMeasures);
|
|
2545
|
+
setSafeYAxisMaxValue(chartInfo, seriesMeasures, widget);
|
|
2540
2546
|
return {
|
|
2541
2547
|
chart: chartInfo,
|
|
2542
2548
|
categories: buildCategories(seriesMeasures, widget),
|
|
@@ -2546,6 +2552,7 @@ function getCategoriesBasedDataSource(chartInfo, seriesMeasures, widget) {
|
|
|
2546
2552
|
function getStackedDataSource(chartInfo, seriesMeasures, widget) {
|
|
2547
2553
|
if (seriesMeasuresIsEmpty(seriesMeasures)) return null;
|
|
2548
2554
|
handelNullLabels(seriesMeasures);
|
|
2555
|
+
setSafeYAxisMaxValue(chartInfo, seriesMeasures, widget);
|
|
2549
2556
|
return {
|
|
2550
2557
|
chart: chartInfo,
|
|
2551
2558
|
categories: buildStackedCategories(seriesMeasures, widget),
|
|
@@ -2578,6 +2585,68 @@ function seriesMeasuresIsEmpty(seriesMeasures) {
|
|
|
2578
2585
|
return !hasValue;
|
|
2579
2586
|
}
|
|
2580
2587
|
|
|
2588
|
+
function setSafeYAxisMaxValue(chartInfo, seriesMeasures, widget) {
|
|
2589
|
+
if (!isColumnOrBarChart(widget)) return;
|
|
2590
|
+
var maxMeasureValue = getMaxMeasureValue(seriesMeasures, widget);
|
|
2591
|
+
if (maxMeasureValue === null) return;
|
|
2592
|
+
var safeYAxisMaxValue = Math.max(1, Math.ceil(maxMeasureValue * 1.2));
|
|
2593
|
+
chartInfo.yAxisMaxValue = safeYAxisMaxValue.toString();
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
function getMaxMeasureValue(seriesMeasures, widget) {
|
|
2597
|
+
if (!seriesMeasures || seriesMeasures.length === 0) return null;
|
|
2598
|
+
|
|
2599
|
+
if (widget !== null && widget !== void 0 && widget.IsStacked) {
|
|
2600
|
+
var stackedTotalsByGroupId = new Map();
|
|
2601
|
+
seriesMeasures.forEach(function (seriesMeasure) {
|
|
2602
|
+
var _seriesMeasure$Values;
|
|
2603
|
+
|
|
2604
|
+
seriesMeasure === null || seriesMeasure === void 0 ? void 0 : (_seriesMeasure$Values = seriesMeasure.Values) === null || _seriesMeasure$Values === void 0 ? void 0 : _seriesMeasure$Values.forEach(function (valueItem) {
|
|
2605
|
+
var _stackedTotalsByGroup;
|
|
2606
|
+
|
|
2607
|
+
var numericValue = toNumericValue(valueItem === null || valueItem === void 0 ? void 0 : valueItem.Value);
|
|
2608
|
+
if (numericValue === null) return;
|
|
2609
|
+
var groupId = valueItem === null || valueItem === void 0 ? void 0 : valueItem.GroupById;
|
|
2610
|
+
var currentTotal = (_stackedTotalsByGroup = stackedTotalsByGroupId.get(groupId)) != null ? _stackedTotalsByGroup : 0;
|
|
2611
|
+
stackedTotalsByGroupId.set(groupId, currentTotal + numericValue);
|
|
2612
|
+
});
|
|
2613
|
+
});
|
|
2614
|
+
var maxStackedTotal = null;
|
|
2615
|
+
stackedTotalsByGroupId.forEach(function (total) {
|
|
2616
|
+
if (maxStackedTotal === null || total > maxStackedTotal) {
|
|
2617
|
+
maxStackedTotal = total;
|
|
2618
|
+
}
|
|
2619
|
+
});
|
|
2620
|
+
return maxStackedTotal;
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
var maxValue = null;
|
|
2624
|
+
seriesMeasures.forEach(function (seriesMeasure) {
|
|
2625
|
+
var _seriesMeasure$Values2;
|
|
2626
|
+
|
|
2627
|
+
seriesMeasure === null || seriesMeasure === void 0 ? void 0 : (_seriesMeasure$Values2 = seriesMeasure.Values) === null || _seriesMeasure$Values2 === void 0 ? void 0 : _seriesMeasure$Values2.forEach(function (valueItem) {
|
|
2628
|
+
var numericValue = toNumericValue(valueItem === null || valueItem === void 0 ? void 0 : valueItem.Value);
|
|
2629
|
+
if (numericValue === null) return;
|
|
2630
|
+
|
|
2631
|
+
if (maxValue === null || numericValue > maxValue) {
|
|
2632
|
+
maxValue = numericValue;
|
|
2633
|
+
}
|
|
2634
|
+
});
|
|
2635
|
+
});
|
|
2636
|
+
return maxValue;
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
function toNumericValue(value) {
|
|
2640
|
+
if (value === null || value === undefined || value === "") return null;
|
|
2641
|
+
var numericValue = typeof value === "number" ? value : Number(value);
|
|
2642
|
+
if (!Number.isFinite(numericValue)) return null;
|
|
2643
|
+
return numericValue;
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
function isColumnOrBarChart(widget) {
|
|
2647
|
+
return (widget === null || widget === void 0 ? void 0 : widget.TypeCode) === "column" || (widget === null || widget === void 0 ? void 0 : widget.TypeCode) === "bar";
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2581
2650
|
function buildDataSource(values, widget) {
|
|
2582
2651
|
var data = [];
|
|
2583
2652
|
if (!values || !values[0]) return data;
|
|
@@ -3047,11 +3116,15 @@ function getDefaultChartInfo(widget) {
|
|
|
3047
3116
|
chart.valuePosition = widget.ShowValue && widget.ValuePosition ? widget.ValuePosition : 'Outside';
|
|
3048
3117
|
var isValuePositionInside = widget.ShowValue && widget.ValuePosition && widget.ValuePosition.toLowerCase() == 'inside';
|
|
3049
3118
|
|
|
3050
|
-
if (
|
|
3119
|
+
if (isColumnOrBarChart$1(widget)) {
|
|
3120
|
+
chart.canvasTopPadding = "40";
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
if (widget.ShowValue && widget.ValuePosition && isColumnOrBarChart$1(widget)) {
|
|
3051
3124
|
chart.placeValuesInside = widget.ValuePosition.toLowerCase() == 'inside' ? "1" : "0";
|
|
3052
3125
|
}
|
|
3053
3126
|
|
|
3054
|
-
if (widget.IsStacked && isValuePositionInside && isColumnOrBarChart(widget)) {
|
|
3127
|
+
if (widget.IsStacked && isValuePositionInside && isColumnOrBarChart$1(widget)) {
|
|
3055
3128
|
chart.minPlotHeightForValue = "15";
|
|
3056
3129
|
}
|
|
3057
3130
|
|
|
@@ -3119,7 +3192,7 @@ function getWidgetLegendPosition(widget) {
|
|
|
3119
3192
|
return widget.TypeCode == 'pie' || widget.TypeCode == 'donut' ? "right" : "bottom";
|
|
3120
3193
|
}
|
|
3121
3194
|
|
|
3122
|
-
function isColumnOrBarChart(widget) {
|
|
3195
|
+
function isColumnOrBarChart$1(widget) {
|
|
3123
3196
|
if (!widget) return false;
|
|
3124
3197
|
return widget.TypeCode == 'column' || widget.TypeCode == 'bar';
|
|
3125
3198
|
}
|
|
@@ -3487,7 +3560,7 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
3487
3560
|
var isTargetUsed = isTargetWidget(postWidget) && postWidget.WidgetMeasures && postWidget.WidgetMeasures[1] && postWidget.WidgetMeasures[1].MeasureCode == 'Target';
|
|
3488
3561
|
|
|
3489
3562
|
if (isTargetUsed) {
|
|
3490
|
-
var widgetLoadLogger = new WidgetLoadLogger(postWidget, props.isPreviewModeActive);
|
|
3563
|
+
var widgetLoadLogger = new WidgetLoadLogger(postWidget, props.isPreviewModeActive, "PostGetTargetDataAnalytic");
|
|
3491
3564
|
dashboardAnalyticsService.getTargetAnalyticsData(postWidget, signal).then(function (result) {
|
|
3492
3565
|
var _result$data, _result$data4, _result$data5;
|
|
3493
3566
|
|
|
@@ -3516,7 +3589,7 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
3516
3589
|
setDataLoaded(true);
|
|
3517
3590
|
});
|
|
3518
3591
|
} else {
|
|
3519
|
-
var _widgetLoadLogger = new WidgetLoadLogger(postWidget, props.isPreviewModeActive);
|
|
3592
|
+
var _widgetLoadLogger = new WidgetLoadLogger(postWidget, props.isPreviewModeActive, "PostGetDataAnalytic");
|
|
3520
3593
|
|
|
3521
3594
|
dashboardAnalyticsService.getData(postWidget, signal).then(function (result) {
|
|
3522
3595
|
handleData(result === null || result === void 0 ? void 0 : result.data);
|
|
@@ -3895,7 +3968,7 @@ var FusionChart$1 = React.forwardRef(function (props, comRef) {
|
|
|
3895
3968
|
signal = updatedAxiosController === null || updatedAxiosController === void 0 ? void 0 : updatedAxiosController.signal;
|
|
3896
3969
|
}
|
|
3897
3970
|
|
|
3898
|
-
var widgetLoadLogger = new WidgetLoadLogger(postWidget, props.isPreviewModeActive);
|
|
3971
|
+
var widgetLoadLogger = new WidgetLoadLogger(postWidget, props.isPreviewModeActive, "PostGetGaugeData");
|
|
3899
3972
|
dashboardAnalyticsService.getGaugeData(postWidget, signal).then(function (result) {
|
|
3900
3973
|
handleData(result === null || result === void 0 ? void 0 : result.data);
|
|
3901
3974
|
chartData.current = result === null || result === void 0 ? void 0 : result.data;
|