@datarailsshared/dr_renderer 1.4.10 → 1.4.12
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/.github/workflows/release.yml +44 -0
- package/.whitesource +3 -0
- package/CODEOWNERS +1 -1
- package/README.md +46 -4
- package/package.json +5 -6
- package/src/charts/dr_donut_chart.js +3 -3
- package/src/charts/dr_gauge_categories_summary_chart.js +17 -17
- package/src/charts/dr_gauge_chart.js +226 -64
- package/src/dr-renderer-helpers.js +30 -13
- package/src/dr_pivottable.js +21 -29
- package/src/errors.js +174 -0
- package/src/highcharts_renderer.js +530 -343
- package/src/index.d.ts +63 -0
- package/src/index.js +14 -1
- package/src/pivot.css +0 -11
- package/src/pivottable.js +469 -508
- package/src/seriesPointStyles-helper.js +1 -1
- package/src/smart_queries_helper.js +62 -14
- package/src/types/errors.d.ts +120 -0
- package/src/types/index.d.ts +2 -0
- package/src/value.formatter.js +41 -0
- package/tests/dr-renderer-helpers.test.js +33 -0
- package/tests/dr_gauge_chart.test.js +88 -0
- package/tests/errors.test.js +157 -0
- package/tests/highcharts_renderer.test.js +1029 -67
- package/tests/mock/widgets.json +1 -3
- package/tests/ptCreateDrillDownSeriesToDrilldownChart.test.js +511 -0
- package/tests/value.formatter.test.js +143 -0
- package/tsconfig.json +2 -2
- package/tsconfig.tsbuildinfo +7 -0
- package/.github/workflows/build-deploy.yml +0 -30
- package/types/index.d.ts +0 -1
- /package/{types → src/types}/graph-table-renderer.d.ts +0 -0
package/src/errors.js
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
/**
|
2
|
+
* Enum for dr renderer error codes.
|
3
|
+
* @readonly
|
4
|
+
* @enum {number}
|
5
|
+
*/
|
6
|
+
const RendererErrorCodes = {
|
7
|
+
NoDataError: 1,
|
8
|
+
TooMuchDataError: 3,
|
9
|
+
DataConflictError: 5,
|
10
|
+
GaugeConfigurationError: 6,
|
11
|
+
GenericRenderingError: 7,
|
12
|
+
GenericComputationalError: 8
|
13
|
+
};
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Base error class for all renderer-related errors.
|
17
|
+
* @class BaseRendererError
|
18
|
+
* @extends Error
|
19
|
+
*/
|
20
|
+
class BaseRendererError extends Error {
|
21
|
+
/**
|
22
|
+
* Error code for identification purposes
|
23
|
+
* @type {number}
|
24
|
+
*/
|
25
|
+
code = 0;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Human-readable error title
|
29
|
+
* @type {string}
|
30
|
+
*/
|
31
|
+
title = '';
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Additional options or context for the error
|
35
|
+
* @type {Object}
|
36
|
+
*/
|
37
|
+
options = {};
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Creates a new BaseRendererError instance.
|
41
|
+
* @param {Object} config - Error configuration object
|
42
|
+
* @param {number} config.code - Unique error code
|
43
|
+
* @param {string} config.title - Error title/message
|
44
|
+
* @param {Object} [config.options={}] - Additional error options or context
|
45
|
+
*/
|
46
|
+
constructor({ code, title, options }) {
|
47
|
+
super();
|
48
|
+
this.code = code;
|
49
|
+
this.title = title;
|
50
|
+
this.options = options || {};
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Error thrown when no data is available.
|
56
|
+
* @class NoDataError
|
57
|
+
* @extends BaseRendererError
|
58
|
+
*/
|
59
|
+
class NoDataError extends BaseRendererError {
|
60
|
+
/**
|
61
|
+
* Creates a new NoDataError instance.
|
62
|
+
* This error is thrown when a widget or component has no available data.
|
63
|
+
*/
|
64
|
+
constructor() {
|
65
|
+
super({
|
66
|
+
code: RendererErrorCodes.NoDataError,
|
67
|
+
title: 'No Data Available',
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Error thrown when there is too much data to render efficiently.
|
74
|
+
* @class TooMuchDataError
|
75
|
+
* @extends BaseRendererError
|
76
|
+
*/
|
77
|
+
class TooMuchDataError extends BaseRendererError {
|
78
|
+
/**
|
79
|
+
* Creates a new TooMuchDataError instance.
|
80
|
+
* This error is thrown when the dataset exceeds the renderer's capacity
|
81
|
+
* and requires the user to edit the widget.
|
82
|
+
*/
|
83
|
+
constructor() {
|
84
|
+
super({
|
85
|
+
code: RendererErrorCodes.TooMuchDataError,
|
86
|
+
title: 'There is too much data. Please edit this widget',
|
87
|
+
});
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Error thrown when there are conflicts in the data being processed.
|
93
|
+
* @class DataConflictError
|
94
|
+
* @extends BaseRendererError
|
95
|
+
*/
|
96
|
+
class DataConflictError extends BaseRendererError {
|
97
|
+
/**
|
98
|
+
* Creates a new DataConflictError instance.
|
99
|
+
* @param {Object} [options] - Additional context about the data conflict.
|
100
|
+
*/
|
101
|
+
constructor(options) {
|
102
|
+
super({
|
103
|
+
code: RendererErrorCodes.DataConflictError,
|
104
|
+
title: 'Data Conflict',
|
105
|
+
options
|
106
|
+
});
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Error thrown when a gauge chart is missing required info.
|
112
|
+
* @class GaugeConfigurationError
|
113
|
+
* @extends BaseRendererError
|
114
|
+
*/
|
115
|
+
class GaugeConfigurationError extends BaseRendererError {
|
116
|
+
/**
|
117
|
+
* Creates a new GaugeConfigurationError instance.
|
118
|
+
*/
|
119
|
+
constructor() {
|
120
|
+
super({
|
121
|
+
code: RendererErrorCodes.GaugeConfigurationError,
|
122
|
+
title: 'Please configure goal and needle',
|
123
|
+
});
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Generic error for rendering failures in PivotTable components.
|
129
|
+
* @class GenericRenderingError
|
130
|
+
* @extends BaseRendererError
|
131
|
+
*/
|
132
|
+
class GenericRenderingError extends BaseRendererError {
|
133
|
+
/**
|
134
|
+
* Creates a new GenericRenderingError instance.
|
135
|
+
* This error is thrown when an unexpected error occurs during
|
136
|
+
* the rendering process of PivotTable results.
|
137
|
+
*/
|
138
|
+
constructor() {
|
139
|
+
super({
|
140
|
+
code: RendererErrorCodes.GenericRenderingError,
|
141
|
+
title: 'An error occurred rendering the PivotTable results.',
|
142
|
+
});
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Generic error for computational failures in PivotTable components.
|
148
|
+
* @class GenericComputationalError
|
149
|
+
* @extends BaseRendererError
|
150
|
+
*/
|
151
|
+
class GenericComputationalError extends BaseRendererError {
|
152
|
+
/**
|
153
|
+
* Creates a new GenericComputationalError instance.
|
154
|
+
* This error is thrown when an unexpected error occurs during
|
155
|
+
* the computation process of PivotTable results.
|
156
|
+
*/
|
157
|
+
constructor() {
|
158
|
+
super({
|
159
|
+
code: RendererErrorCodes.GenericComputationalError,
|
160
|
+
title: 'An error occurred computing the PivotTable results.',
|
161
|
+
});
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
module.exports = {
|
166
|
+
RendererErrorCodes,
|
167
|
+
BaseRendererError,
|
168
|
+
TooMuchDataError,
|
169
|
+
NoDataError,
|
170
|
+
DataConflictError,
|
171
|
+
GaugeConfigurationError,
|
172
|
+
GenericRenderingError,
|
173
|
+
GenericComputationalError
|
174
|
+
};
|