@quillsql/react 2.15.5 → 2.15.7
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/index.cjs +1148 -79
- package/dist/index.d.cts +82 -20
- package/dist/index.d.ts +82 -20
- package/dist/index.js +1484 -386
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,399 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
// ../../node_modules/pluralize/pluralize.js
|
|
34
|
+
var require_pluralize = __commonJS({
|
|
35
|
+
"../../node_modules/pluralize/pluralize.js"(exports, module) {
|
|
36
|
+
"use strict";
|
|
37
|
+
(function(root, pluralize2) {
|
|
38
|
+
if (typeof __require === "function" && typeof exports === "object" && typeof module === "object") {
|
|
39
|
+
module.exports = pluralize2();
|
|
40
|
+
} else if (typeof define === "function" && define.amd) {
|
|
41
|
+
define(function() {
|
|
42
|
+
return pluralize2();
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
root.pluralize = pluralize2();
|
|
46
|
+
}
|
|
47
|
+
})(exports, function() {
|
|
48
|
+
var pluralRules = [];
|
|
49
|
+
var singularRules = [];
|
|
50
|
+
var uncountables = {};
|
|
51
|
+
var irregularPlurals = {};
|
|
52
|
+
var irregularSingles = {};
|
|
53
|
+
function sanitizeRule(rule) {
|
|
54
|
+
if (typeof rule === "string") {
|
|
55
|
+
return new RegExp("^" + rule + "$", "i");
|
|
56
|
+
}
|
|
57
|
+
return rule;
|
|
58
|
+
}
|
|
59
|
+
function restoreCase(word, token) {
|
|
60
|
+
if (word === token) return token;
|
|
61
|
+
if (word === word.toLowerCase()) return token.toLowerCase();
|
|
62
|
+
if (word === word.toUpperCase()) return token.toUpperCase();
|
|
63
|
+
if (word[0] === word[0].toUpperCase()) {
|
|
64
|
+
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
|
|
65
|
+
}
|
|
66
|
+
return token.toLowerCase();
|
|
67
|
+
}
|
|
68
|
+
function interpolate(str, args) {
|
|
69
|
+
return str.replace(/\$(\d{1,2})/g, function(match, index) {
|
|
70
|
+
return args[index] || "";
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function replace(word, rule) {
|
|
74
|
+
return word.replace(rule[0], function(match, index) {
|
|
75
|
+
var result = interpolate(rule[1], arguments);
|
|
76
|
+
if (match === "") {
|
|
77
|
+
return restoreCase(word[index - 1], result);
|
|
78
|
+
}
|
|
79
|
+
return restoreCase(match, result);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function sanitizeWord(token, word, rules) {
|
|
83
|
+
if (!token.length || uncountables.hasOwnProperty(token)) {
|
|
84
|
+
return word;
|
|
85
|
+
}
|
|
86
|
+
var len = rules.length;
|
|
87
|
+
while (len--) {
|
|
88
|
+
var rule = rules[len];
|
|
89
|
+
if (rule[0].test(word)) return replace(word, rule);
|
|
90
|
+
}
|
|
91
|
+
return word;
|
|
92
|
+
}
|
|
93
|
+
function replaceWord(replaceMap, keepMap, rules) {
|
|
94
|
+
return function(word) {
|
|
95
|
+
var token = word.toLowerCase();
|
|
96
|
+
if (keepMap.hasOwnProperty(token)) {
|
|
97
|
+
return restoreCase(word, token);
|
|
98
|
+
}
|
|
99
|
+
if (replaceMap.hasOwnProperty(token)) {
|
|
100
|
+
return restoreCase(word, replaceMap[token]);
|
|
101
|
+
}
|
|
102
|
+
return sanitizeWord(token, word, rules);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function checkWord(replaceMap, keepMap, rules, bool) {
|
|
106
|
+
return function(word) {
|
|
107
|
+
var token = word.toLowerCase();
|
|
108
|
+
if (keepMap.hasOwnProperty(token)) return true;
|
|
109
|
+
if (replaceMap.hasOwnProperty(token)) return false;
|
|
110
|
+
return sanitizeWord(token, token, rules) === token;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function pluralize2(word, count, inclusive) {
|
|
114
|
+
var pluralized = count === 1 ? pluralize2.singular(word) : pluralize2.plural(word);
|
|
115
|
+
return (inclusive ? count + " " : "") + pluralized;
|
|
116
|
+
}
|
|
117
|
+
pluralize2.plural = replaceWord(
|
|
118
|
+
irregularSingles,
|
|
119
|
+
irregularPlurals,
|
|
120
|
+
pluralRules
|
|
121
|
+
);
|
|
122
|
+
pluralize2.isPlural = checkWord(
|
|
123
|
+
irregularSingles,
|
|
124
|
+
irregularPlurals,
|
|
125
|
+
pluralRules
|
|
126
|
+
);
|
|
127
|
+
pluralize2.singular = replaceWord(
|
|
128
|
+
irregularPlurals,
|
|
129
|
+
irregularSingles,
|
|
130
|
+
singularRules
|
|
131
|
+
);
|
|
132
|
+
pluralize2.isSingular = checkWord(
|
|
133
|
+
irregularPlurals,
|
|
134
|
+
irregularSingles,
|
|
135
|
+
singularRules
|
|
136
|
+
);
|
|
137
|
+
pluralize2.addPluralRule = function(rule, replacement) {
|
|
138
|
+
pluralRules.push([sanitizeRule(rule), replacement]);
|
|
139
|
+
};
|
|
140
|
+
pluralize2.addSingularRule = function(rule, replacement) {
|
|
141
|
+
singularRules.push([sanitizeRule(rule), replacement]);
|
|
142
|
+
};
|
|
143
|
+
pluralize2.addUncountableRule = function(word) {
|
|
144
|
+
if (typeof word === "string") {
|
|
145
|
+
uncountables[word.toLowerCase()] = true;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
pluralize2.addPluralRule(word, "$0");
|
|
149
|
+
pluralize2.addSingularRule(word, "$0");
|
|
150
|
+
};
|
|
151
|
+
pluralize2.addIrregularRule = function(single, plural) {
|
|
152
|
+
plural = plural.toLowerCase();
|
|
153
|
+
single = single.toLowerCase();
|
|
154
|
+
irregularSingles[single] = plural;
|
|
155
|
+
irregularPlurals[plural] = single;
|
|
156
|
+
};
|
|
157
|
+
[
|
|
158
|
+
// Pronouns.
|
|
159
|
+
["I", "we"],
|
|
160
|
+
["me", "us"],
|
|
161
|
+
["he", "they"],
|
|
162
|
+
["she", "they"],
|
|
163
|
+
["them", "them"],
|
|
164
|
+
["myself", "ourselves"],
|
|
165
|
+
["yourself", "yourselves"],
|
|
166
|
+
["itself", "themselves"],
|
|
167
|
+
["herself", "themselves"],
|
|
168
|
+
["himself", "themselves"],
|
|
169
|
+
["themself", "themselves"],
|
|
170
|
+
["is", "are"],
|
|
171
|
+
["was", "were"],
|
|
172
|
+
["has", "have"],
|
|
173
|
+
["this", "these"],
|
|
174
|
+
["that", "those"],
|
|
175
|
+
// Words ending in with a consonant and `o`.
|
|
176
|
+
["echo", "echoes"],
|
|
177
|
+
["dingo", "dingoes"],
|
|
178
|
+
["volcano", "volcanoes"],
|
|
179
|
+
["tornado", "tornadoes"],
|
|
180
|
+
["torpedo", "torpedoes"],
|
|
181
|
+
// Ends with `us`.
|
|
182
|
+
["genus", "genera"],
|
|
183
|
+
["viscus", "viscera"],
|
|
184
|
+
// Ends with `ma`.
|
|
185
|
+
["stigma", "stigmata"],
|
|
186
|
+
["stoma", "stomata"],
|
|
187
|
+
["dogma", "dogmata"],
|
|
188
|
+
["lemma", "lemmata"],
|
|
189
|
+
["schema", "schemata"],
|
|
190
|
+
["anathema", "anathemata"],
|
|
191
|
+
// Other irregular rules.
|
|
192
|
+
["ox", "oxen"],
|
|
193
|
+
["axe", "axes"],
|
|
194
|
+
["die", "dice"],
|
|
195
|
+
["yes", "yeses"],
|
|
196
|
+
["foot", "feet"],
|
|
197
|
+
["eave", "eaves"],
|
|
198
|
+
["goose", "geese"],
|
|
199
|
+
["tooth", "teeth"],
|
|
200
|
+
["quiz", "quizzes"],
|
|
201
|
+
["human", "humans"],
|
|
202
|
+
["proof", "proofs"],
|
|
203
|
+
["carve", "carves"],
|
|
204
|
+
["valve", "valves"],
|
|
205
|
+
["looey", "looies"],
|
|
206
|
+
["thief", "thieves"],
|
|
207
|
+
["groove", "grooves"],
|
|
208
|
+
["pickaxe", "pickaxes"],
|
|
209
|
+
["passerby", "passersby"]
|
|
210
|
+
].forEach(function(rule) {
|
|
211
|
+
return pluralize2.addIrregularRule(rule[0], rule[1]);
|
|
212
|
+
});
|
|
213
|
+
[
|
|
214
|
+
[/s?$/i, "s"],
|
|
215
|
+
[/[^\u0000-\u007F]$/i, "$0"],
|
|
216
|
+
[/([^aeiou]ese)$/i, "$1"],
|
|
217
|
+
[/(ax|test)is$/i, "$1es"],
|
|
218
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
|
|
219
|
+
[/(e[mn]u)s?$/i, "$1s"],
|
|
220
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
|
|
221
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
|
|
222
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
|
|
223
|
+
[/(seraph|cherub)(?:im)?$/i, "$1im"],
|
|
224
|
+
[/(her|at|gr)o$/i, "$1oes"],
|
|
225
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
|
|
226
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
|
|
227
|
+
[/sis$/i, "ses"],
|
|
228
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
|
|
229
|
+
[/([^aeiouy]|qu)y$/i, "$1ies"],
|
|
230
|
+
[/([^ch][ieo][ln])ey$/i, "$1ies"],
|
|
231
|
+
[/(x|ch|ss|sh|zz)$/i, "$1es"],
|
|
232
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
|
|
233
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
|
|
234
|
+
[/(pe)(?:rson|ople)$/i, "$1ople"],
|
|
235
|
+
[/(child)(?:ren)?$/i, "$1ren"],
|
|
236
|
+
[/eaux$/i, "$0"],
|
|
237
|
+
[/m[ae]n$/i, "men"],
|
|
238
|
+
["thou", "you"]
|
|
239
|
+
].forEach(function(rule) {
|
|
240
|
+
return pluralize2.addPluralRule(rule[0], rule[1]);
|
|
241
|
+
});
|
|
242
|
+
[
|
|
243
|
+
[/s$/i, ""],
|
|
244
|
+
[/(ss)$/i, "$1"],
|
|
245
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
|
|
246
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
|
|
247
|
+
[/ies$/i, "y"],
|
|
248
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
|
|
249
|
+
[/\b(mon|smil)ies$/i, "$1ey"],
|
|
250
|
+
[/\b((?:tit)?m|l)ice$/i, "$1ouse"],
|
|
251
|
+
[/(seraph|cherub)im$/i, "$1"],
|
|
252
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
|
|
253
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
|
|
254
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
|
|
255
|
+
[/(test)(?:is|es)$/i, "$1is"],
|
|
256
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
|
|
257
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
|
|
258
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
|
|
259
|
+
[/(alumn|alg|vertebr)ae$/i, "$1a"],
|
|
260
|
+
[/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
|
|
261
|
+
[/(matr|append)ices$/i, "$1ix"],
|
|
262
|
+
[/(pe)(rson|ople)$/i, "$1rson"],
|
|
263
|
+
[/(child)ren$/i, "$1"],
|
|
264
|
+
[/(eau)x?$/i, "$1"],
|
|
265
|
+
[/men$/i, "man"]
|
|
266
|
+
].forEach(function(rule) {
|
|
267
|
+
return pluralize2.addSingularRule(rule[0], rule[1]);
|
|
268
|
+
});
|
|
269
|
+
[
|
|
270
|
+
// Singular words with no plurals.
|
|
271
|
+
"adulthood",
|
|
272
|
+
"advice",
|
|
273
|
+
"agenda",
|
|
274
|
+
"aid",
|
|
275
|
+
"aircraft",
|
|
276
|
+
"alcohol",
|
|
277
|
+
"ammo",
|
|
278
|
+
"analytics",
|
|
279
|
+
"anime",
|
|
280
|
+
"athletics",
|
|
281
|
+
"audio",
|
|
282
|
+
"bison",
|
|
283
|
+
"blood",
|
|
284
|
+
"bream",
|
|
285
|
+
"buffalo",
|
|
286
|
+
"butter",
|
|
287
|
+
"carp",
|
|
288
|
+
"cash",
|
|
289
|
+
"chassis",
|
|
290
|
+
"chess",
|
|
291
|
+
"clothing",
|
|
292
|
+
"cod",
|
|
293
|
+
"commerce",
|
|
294
|
+
"cooperation",
|
|
295
|
+
"corps",
|
|
296
|
+
"debris",
|
|
297
|
+
"diabetes",
|
|
298
|
+
"digestion",
|
|
299
|
+
"elk",
|
|
300
|
+
"energy",
|
|
301
|
+
"equipment",
|
|
302
|
+
"excretion",
|
|
303
|
+
"expertise",
|
|
304
|
+
"firmware",
|
|
305
|
+
"flounder",
|
|
306
|
+
"fun",
|
|
307
|
+
"gallows",
|
|
308
|
+
"garbage",
|
|
309
|
+
"graffiti",
|
|
310
|
+
"hardware",
|
|
311
|
+
"headquarters",
|
|
312
|
+
"health",
|
|
313
|
+
"herpes",
|
|
314
|
+
"highjinks",
|
|
315
|
+
"homework",
|
|
316
|
+
"housework",
|
|
317
|
+
"information",
|
|
318
|
+
"jeans",
|
|
319
|
+
"justice",
|
|
320
|
+
"kudos",
|
|
321
|
+
"labour",
|
|
322
|
+
"literature",
|
|
323
|
+
"machinery",
|
|
324
|
+
"mackerel",
|
|
325
|
+
"mail",
|
|
326
|
+
"media",
|
|
327
|
+
"mews",
|
|
328
|
+
"moose",
|
|
329
|
+
"music",
|
|
330
|
+
"mud",
|
|
331
|
+
"manga",
|
|
332
|
+
"news",
|
|
333
|
+
"only",
|
|
334
|
+
"personnel",
|
|
335
|
+
"pike",
|
|
336
|
+
"plankton",
|
|
337
|
+
"pliers",
|
|
338
|
+
"police",
|
|
339
|
+
"pollution",
|
|
340
|
+
"premises",
|
|
341
|
+
"rain",
|
|
342
|
+
"research",
|
|
343
|
+
"rice",
|
|
344
|
+
"salmon",
|
|
345
|
+
"scissors",
|
|
346
|
+
"series",
|
|
347
|
+
"sewage",
|
|
348
|
+
"shambles",
|
|
349
|
+
"shrimp",
|
|
350
|
+
"software",
|
|
351
|
+
"species",
|
|
352
|
+
"staff",
|
|
353
|
+
"swine",
|
|
354
|
+
"tennis",
|
|
355
|
+
"traffic",
|
|
356
|
+
"transportation",
|
|
357
|
+
"trout",
|
|
358
|
+
"tuna",
|
|
359
|
+
"wealth",
|
|
360
|
+
"welfare",
|
|
361
|
+
"whiting",
|
|
362
|
+
"wildebeest",
|
|
363
|
+
"wildlife",
|
|
364
|
+
"you",
|
|
365
|
+
/pok[eé]mon$/i,
|
|
366
|
+
// Regexes.
|
|
367
|
+
/[^aeiou]ese$/i,
|
|
368
|
+
// "chinese", "japanese"
|
|
369
|
+
/deer$/i,
|
|
370
|
+
// "deer", "reindeer"
|
|
371
|
+
/fish$/i,
|
|
372
|
+
// "fish", "blowfish", "angelfish"
|
|
373
|
+
/measles$/i,
|
|
374
|
+
/o[iu]s$/i,
|
|
375
|
+
// "carnivorous"
|
|
376
|
+
/pox$/i,
|
|
377
|
+
// "chickpox", "smallpox"
|
|
378
|
+
/sheep$/i
|
|
379
|
+
].forEach(pluralize2.addUncountableRule);
|
|
380
|
+
return pluralize2;
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
|
|
1
385
|
// src/Dashboard.tsx
|
|
2
386
|
import {
|
|
3
387
|
useContext as useContext20,
|
|
4
388
|
useEffect as useEffect18,
|
|
5
|
-
useState as
|
|
389
|
+
useState as useState23,
|
|
6
390
|
useMemo as useMemo16,
|
|
7
391
|
useRef as useRef13
|
|
8
392
|
} from "react";
|
|
9
393
|
|
|
10
394
|
// src/Chart.tsx
|
|
11
395
|
import {
|
|
12
|
-
useState as
|
|
396
|
+
useState as useState17,
|
|
13
397
|
useEffect as useEffect15,
|
|
14
398
|
useContext as useContext16,
|
|
15
399
|
useMemo as useMemo13,
|
|
@@ -428,7 +812,7 @@ var downloadCSV = (data) => {
|
|
|
428
812
|
};
|
|
429
813
|
|
|
430
814
|
// src/hooks/useExport.tsx
|
|
431
|
-
import { useContext as useContext2, useMemo as useMemo3, useState as
|
|
815
|
+
import { useContext as useContext2, useMemo as useMemo3, useState as useState3 } from "react";
|
|
432
816
|
|
|
433
817
|
// src/utils/constants.ts
|
|
434
818
|
var MAX_PIVOT_UNIQUE_VALUES = 250;
|
|
@@ -632,6 +1016,7 @@ async function fetchSqlQuery(ast, client, getToken, formData) {
|
|
|
632
1016
|
import equal from "fast-deep-equal";
|
|
633
1017
|
import {
|
|
634
1018
|
createContext,
|
|
1019
|
+
useCallback,
|
|
635
1020
|
useEffect,
|
|
636
1021
|
useMemo,
|
|
637
1022
|
useReducer,
|
|
@@ -1347,6 +1732,7 @@ var DashboardFilterType = /* @__PURE__ */ ((DashboardFilterType4) => {
|
|
|
1347
1732
|
DashboardFilterType4["Select"] = "select";
|
|
1348
1733
|
DashboardFilterType4["MultiSelect"] = "multiselect";
|
|
1349
1734
|
DashboardFilterType4["Date"] = "date";
|
|
1735
|
+
DashboardFilterType4["Tenant"] = "tenant";
|
|
1350
1736
|
return DashboardFilterType4;
|
|
1351
1737
|
})(DashboardFilterType || {});
|
|
1352
1738
|
var convertCustomFilter = (filter) => {
|
|
@@ -1600,6 +1986,16 @@ var convertInternalDashboardFilterToDashboardFilter = (filter) => {
|
|
|
1600
1986
|
},
|
|
1601
1987
|
options
|
|
1602
1988
|
};
|
|
1989
|
+
} else if (filter.filterType === "tenant" /* Tenant */) {
|
|
1990
|
+
return {
|
|
1991
|
+
label: filter.label,
|
|
1992
|
+
type: "tenant" /* Tenant */,
|
|
1993
|
+
value: filter.multiSelect ? filter.values ?? [] : filter.values?.[0] ?? null,
|
|
1994
|
+
options: (filter.options ?? []).map((opt) => ({
|
|
1995
|
+
label: opt.label,
|
|
1996
|
+
value: opt.value
|
|
1997
|
+
}))
|
|
1998
|
+
};
|
|
1603
1999
|
}
|
|
1604
2000
|
throw new Error(
|
|
1605
2001
|
"Unknown InternalDashboardFilterType: " + filter.filterType
|
|
@@ -17479,7 +17875,7 @@ async function generatePivotWithSQL({
|
|
|
17479
17875
|
if (!itemQuery) {
|
|
17480
17876
|
throw Error("No item query found in report");
|
|
17481
17877
|
}
|
|
17482
|
-
sqlQuery =
|
|
17878
|
+
sqlQuery = generatePivotQuery(
|
|
17483
17879
|
pivot,
|
|
17484
17880
|
itemQuery,
|
|
17485
17881
|
databaseType,
|
|
@@ -18797,10 +19193,15 @@ async function getPivotTable(report, dashboardFilters, dashboardName, getToken,
|
|
|
18797
19193
|
});
|
|
18798
19194
|
}
|
|
18799
19195
|
}
|
|
19196
|
+
const pivotQuery = generatePivotQuery(
|
|
19197
|
+
pivot,
|
|
19198
|
+
report.itemQuery?.[0],
|
|
19199
|
+
client.databaseType
|
|
19200
|
+
);
|
|
18800
19201
|
return {
|
|
18801
19202
|
rows: [],
|
|
18802
19203
|
rowCount: 0,
|
|
18803
|
-
pivotQuery: "",
|
|
19204
|
+
pivotQuery: pivotQuery ?? "",
|
|
18804
19205
|
columns
|
|
18805
19206
|
};
|
|
18806
19207
|
}
|
|
@@ -20112,6 +20513,8 @@ function extractAllReportValuesFromQuillInternalReport(reportInternal) {
|
|
|
20112
20513
|
name: reportInternal.name,
|
|
20113
20514
|
dashboardName: reportInternal.dashboardName,
|
|
20114
20515
|
// section: reportInternal.section,
|
|
20516
|
+
pagination: reportInternal.pagination,
|
|
20517
|
+
sort: reportInternal.sort,
|
|
20115
20518
|
rows: reportInternal.rows,
|
|
20116
20519
|
columns: reportInternal.columns,
|
|
20117
20520
|
chartType: reportInternal.chartType,
|
|
@@ -21281,7 +21684,19 @@ var DashboardFiltersContext = createContext({
|
|
|
21281
21684
|
loadFiltersForDashboard: async () => {
|
|
21282
21685
|
}
|
|
21283
21686
|
});
|
|
21284
|
-
var TenantContext = createContext({
|
|
21687
|
+
var TenantContext = createContext({
|
|
21688
|
+
childTenantMappings: {},
|
|
21689
|
+
viewerTenants: {},
|
|
21690
|
+
viewerTenantsByOwner: {},
|
|
21691
|
+
isLoadingMappedTenants: false,
|
|
21692
|
+
isLoadingViewerTenants: false,
|
|
21693
|
+
fetchViewerTenantsForDashboard: async () => {
|
|
21694
|
+
},
|
|
21695
|
+
fetchMappedTenantsForDashboard: async () => {
|
|
21696
|
+
},
|
|
21697
|
+
getMappedTenantsForDashboard: async () => void 0,
|
|
21698
|
+
getViewerTenantsByOwner: async () => []
|
|
21699
|
+
});
|
|
21285
21700
|
var FetchContext = createContext({
|
|
21286
21701
|
getToken: async () => "",
|
|
21287
21702
|
quillFetchWithToken: async () => ({ data: null })
|
|
@@ -21371,6 +21786,15 @@ var ContextProvider = ({
|
|
|
21371
21786
|
const fetchSchemaProcessId = useRef(0);
|
|
21372
21787
|
const currentTenant = useRef(null);
|
|
21373
21788
|
const currentPublicKey = useRef(null);
|
|
21789
|
+
const [childTenantMappings, setChildTenantMappings] = useState({});
|
|
21790
|
+
const [viewerTenants, setViewerTenants] = useState({});
|
|
21791
|
+
const [viewerTenantsByOwner, setViewerTenantsByOwner] = useState({});
|
|
21792
|
+
const [isLoadingMappedTenants, setIsLoadingMappedTenants] = useState(false);
|
|
21793
|
+
const [isLoadingViewerTenants, setIsLoadingViewerTenants] = useState(false);
|
|
21794
|
+
const prevTenants = useRef(null);
|
|
21795
|
+
const viewerTenantsRequests = useRef(/* @__PURE__ */ new Set());
|
|
21796
|
+
const viewerTenantsByOwnerRequests = useRef(/* @__PURE__ */ new Set());
|
|
21797
|
+
const mappedTenantsRequests = useRef(/* @__PURE__ */ new Set());
|
|
21374
21798
|
const loadDashboardProcessId = useRef({});
|
|
21375
21799
|
useEffect(() => {
|
|
21376
21800
|
if (!theme) {
|
|
@@ -21719,7 +22143,7 @@ var ContextProvider = ({
|
|
|
21719
22143
|
});
|
|
21720
22144
|
await Promise.allSettled(
|
|
21721
22145
|
filters.map(async (filter) => {
|
|
21722
|
-
if (filter.filterType
|
|
22146
|
+
if (filter.filterType === "date_range") {
|
|
21723
22147
|
dashboardFiltersDispatch({
|
|
21724
22148
|
type: "UPDATE_DASHBOARD_FILTER",
|
|
21725
22149
|
dashboardName,
|
|
@@ -21743,6 +22167,10 @@ var ContextProvider = ({
|
|
|
21743
22167
|
});
|
|
21744
22168
|
return null;
|
|
21745
22169
|
}
|
|
22170
|
+
if (filter.filterType === "tenant") {
|
|
22171
|
+
await fetchTenantFilterOptions(dashboardName, filter);
|
|
22172
|
+
return null;
|
|
22173
|
+
}
|
|
21746
22174
|
const filterOptionsAbortController = new AbortController();
|
|
21747
22175
|
filterOptionsAbortControllers.current.add(filterOptionsAbortController);
|
|
21748
22176
|
try {
|
|
@@ -22104,7 +22532,8 @@ var ContextProvider = ({
|
|
|
22104
22532
|
},
|
|
22105
22533
|
task: "dashboards",
|
|
22106
22534
|
metadata: {
|
|
22107
|
-
clientId: publicKey2
|
|
22535
|
+
clientId: publicKey2,
|
|
22536
|
+
tenants
|
|
22108
22537
|
// getSections: true, // skip fetching reports since 'dashboard' always does anyway
|
|
22109
22538
|
},
|
|
22110
22539
|
abortSignal: fetchDashboardsAbortController.current.signal,
|
|
@@ -22193,6 +22622,14 @@ var ContextProvider = ({
|
|
|
22193
22622
|
loading: true
|
|
22194
22623
|
};
|
|
22195
22624
|
});
|
|
22625
|
+
dashboard2.tenantFilters?.forEach(
|
|
22626
|
+
(filter) => {
|
|
22627
|
+
acc[dashboard2.name][filter.label] = {
|
|
22628
|
+
filter: { ...filter, options: void 0 },
|
|
22629
|
+
loading: true
|
|
22630
|
+
};
|
|
22631
|
+
}
|
|
22632
|
+
);
|
|
22196
22633
|
return acc;
|
|
22197
22634
|
}, {})
|
|
22198
22635
|
});
|
|
@@ -22268,6 +22705,180 @@ var ContextProvider = ({
|
|
|
22268
22705
|
return { error: "Failed to fetch data" };
|
|
22269
22706
|
}
|
|
22270
22707
|
}
|
|
22708
|
+
const getDashboardViewerTenants = async (dashboardName) => {
|
|
22709
|
+
if (!populatedClient) {
|
|
22710
|
+
return [];
|
|
22711
|
+
}
|
|
22712
|
+
const { data } = await quillFetchWithToken({
|
|
22713
|
+
client: populatedClient,
|
|
22714
|
+
task: "viewer-tenants",
|
|
22715
|
+
metadata: {
|
|
22716
|
+
dashboardName
|
|
22717
|
+
}
|
|
22718
|
+
});
|
|
22719
|
+
return data?.viewerTenants || [];
|
|
22720
|
+
};
|
|
22721
|
+
const getOwnerViewerTenants = async (ownerTenant) => {
|
|
22722
|
+
if (!populatedClient) {
|
|
22723
|
+
return [];
|
|
22724
|
+
}
|
|
22725
|
+
const { data } = await quillFetchWithToken({
|
|
22726
|
+
client: populatedClient,
|
|
22727
|
+
task: "viewer-tenants-by-owner",
|
|
22728
|
+
metadata: {
|
|
22729
|
+
tenantField: ownerTenant
|
|
22730
|
+
}
|
|
22731
|
+
});
|
|
22732
|
+
return data?.viewerTenants || [];
|
|
22733
|
+
};
|
|
22734
|
+
const getMappedTenants = async (tenantsParam, dashboardName) => {
|
|
22735
|
+
if (!populatedClient) {
|
|
22736
|
+
return {};
|
|
22737
|
+
}
|
|
22738
|
+
const { data, queries } = await quillFetchWithToken({
|
|
22739
|
+
client: populatedClient,
|
|
22740
|
+
task: "mapped-tenants",
|
|
22741
|
+
metadata: {
|
|
22742
|
+
tenants: tenantsParam,
|
|
22743
|
+
dashboardName
|
|
22744
|
+
}
|
|
22745
|
+
});
|
|
22746
|
+
const childTenants = data.queryOrder;
|
|
22747
|
+
const queryResults = queries.queryResults.map((result) => {
|
|
22748
|
+
return result?.rows?.map((row) => ({
|
|
22749
|
+
value: row["flag"],
|
|
22750
|
+
label: row["label"]
|
|
22751
|
+
})) ?? null;
|
|
22752
|
+
});
|
|
22753
|
+
const mappedTenants = {};
|
|
22754
|
+
await Promise.all(
|
|
22755
|
+
childTenants.map(
|
|
22756
|
+
async (tenant, index) => {
|
|
22757
|
+
mappedTenants[tenant.tenantField] = queryResults[index];
|
|
22758
|
+
}
|
|
22759
|
+
)
|
|
22760
|
+
);
|
|
22761
|
+
return mappedTenants;
|
|
22762
|
+
};
|
|
22763
|
+
const fetchViewerTenantsForDashboard = useCallback(
|
|
22764
|
+
async (dashboardName) => {
|
|
22765
|
+
if (!populatedClient) return;
|
|
22766
|
+
if (viewerTenantsRequests.current.has(dashboardName)) {
|
|
22767
|
+
return;
|
|
22768
|
+
}
|
|
22769
|
+
if (viewerTenants[dashboardName]) {
|
|
22770
|
+
return;
|
|
22771
|
+
}
|
|
22772
|
+
viewerTenantsRequests.current.add(dashboardName);
|
|
22773
|
+
setIsLoadingViewerTenants(true);
|
|
22774
|
+
try {
|
|
22775
|
+
const viewerTenantsData = await getDashboardViewerTenants(dashboardName);
|
|
22776
|
+
setViewerTenants((prev) => ({
|
|
22777
|
+
...prev,
|
|
22778
|
+
[dashboardName]: viewerTenantsData
|
|
22779
|
+
}));
|
|
22780
|
+
} catch (error) {
|
|
22781
|
+
console.error("Error fetching viewer tenants:", error);
|
|
22782
|
+
} finally {
|
|
22783
|
+
viewerTenantsRequests.current.delete(dashboardName);
|
|
22784
|
+
setIsLoadingViewerTenants(false);
|
|
22785
|
+
}
|
|
22786
|
+
},
|
|
22787
|
+
[populatedClient]
|
|
22788
|
+
);
|
|
22789
|
+
const fetchMappedTenantsForDashboard = async (dashboardName) => {
|
|
22790
|
+
await getMappedTenantsForDashboard(dashboardName);
|
|
22791
|
+
return;
|
|
22792
|
+
};
|
|
22793
|
+
const getMappedTenantsForDashboard = useCallback(
|
|
22794
|
+
async (dashboardName) => {
|
|
22795
|
+
if (!populatedClient || !tenants) return void 0;
|
|
22796
|
+
const tenantsChanged = !equal(prevTenants.current, tenants);
|
|
22797
|
+
if (childTenantMappings[dashboardName] && !tenantsChanged) {
|
|
22798
|
+
return childTenantMappings[dashboardName];
|
|
22799
|
+
}
|
|
22800
|
+
if (mappedTenantsRequests.current.has(dashboardName) && !tenantsChanged) {
|
|
22801
|
+
return new Promise((resolve) => {
|
|
22802
|
+
const checkInterval = setInterval(() => {
|
|
22803
|
+
if (!mappedTenantsRequests.current.has(dashboardName)) {
|
|
22804
|
+
clearInterval(checkInterval);
|
|
22805
|
+
resolve(childTenantMappings[dashboardName]);
|
|
22806
|
+
}
|
|
22807
|
+
}, 100);
|
|
22808
|
+
});
|
|
22809
|
+
}
|
|
22810
|
+
prevTenants.current = tenants;
|
|
22811
|
+
mappedTenantsRequests.current.add(dashboardName);
|
|
22812
|
+
setIsLoadingMappedTenants(true);
|
|
22813
|
+
try {
|
|
22814
|
+
const mappedTenants = await getMappedTenants(tenants, dashboardName);
|
|
22815
|
+
setChildTenantMappings((prev) => ({
|
|
22816
|
+
...prev,
|
|
22817
|
+
[dashboardName]: mappedTenants
|
|
22818
|
+
}));
|
|
22819
|
+
return mappedTenants;
|
|
22820
|
+
} catch (error) {
|
|
22821
|
+
console.error("Error fetching mapped tenants:", error);
|
|
22822
|
+
setChildTenantMappings((prev) => ({
|
|
22823
|
+
...prev,
|
|
22824
|
+
[dashboardName]: {}
|
|
22825
|
+
}));
|
|
22826
|
+
return void 0;
|
|
22827
|
+
} finally {
|
|
22828
|
+
mappedTenantsRequests.current.delete(dashboardName);
|
|
22829
|
+
setIsLoadingMappedTenants(false);
|
|
22830
|
+
}
|
|
22831
|
+
},
|
|
22832
|
+
[populatedClient, tenants, childTenantMappings]
|
|
22833
|
+
);
|
|
22834
|
+
const getViewerTenantsByOwner = useCallback(
|
|
22835
|
+
async (ownerTenant) => {
|
|
22836
|
+
if (!populatedClient) return [];
|
|
22837
|
+
if (viewerTenantsByOwner[ownerTenant]) {
|
|
22838
|
+
return viewerTenantsByOwner[ownerTenant];
|
|
22839
|
+
}
|
|
22840
|
+
if (viewerTenantsByOwnerRequests.current.has(ownerTenant)) {
|
|
22841
|
+
return new Promise((resolve) => {
|
|
22842
|
+
const checkInterval = setInterval(() => {
|
|
22843
|
+
if (!viewerTenantsByOwnerRequests.current.has(ownerTenant)) {
|
|
22844
|
+
clearInterval(checkInterval);
|
|
22845
|
+
resolve(viewerTenantsByOwner[ownerTenant] || []);
|
|
22846
|
+
}
|
|
22847
|
+
}, 100);
|
|
22848
|
+
});
|
|
22849
|
+
}
|
|
22850
|
+
viewerTenantsByOwnerRequests.current.add(ownerTenant);
|
|
22851
|
+
setIsLoadingViewerTenants(true);
|
|
22852
|
+
try {
|
|
22853
|
+
const viewerTenantsData = await getOwnerViewerTenants(ownerTenant);
|
|
22854
|
+
setViewerTenantsByOwner((prev) => ({
|
|
22855
|
+
...prev,
|
|
22856
|
+
[ownerTenant]: viewerTenantsData
|
|
22857
|
+
}));
|
|
22858
|
+
return viewerTenantsData;
|
|
22859
|
+
} catch (error) {
|
|
22860
|
+
console.error("Error fetching viewer tenants by owner:", error);
|
|
22861
|
+
return [];
|
|
22862
|
+
} finally {
|
|
22863
|
+
viewerTenantsByOwnerRequests.current.delete(ownerTenant);
|
|
22864
|
+
setIsLoadingViewerTenants(false);
|
|
22865
|
+
}
|
|
22866
|
+
},
|
|
22867
|
+
[populatedClient, viewerTenantsByOwner]
|
|
22868
|
+
);
|
|
22869
|
+
const fetchTenantFilterOptions = async (dashboardName, filter) => {
|
|
22870
|
+
const mappings = await getMappedTenantsForDashboard(dashboardName);
|
|
22871
|
+
const options = mappings?.[filter.field] ?? [];
|
|
22872
|
+
dashboardFiltersDispatch({
|
|
22873
|
+
type: "UPDATE_DASHBOARD_FILTER",
|
|
22874
|
+
dashboardName,
|
|
22875
|
+
filterName: filter.label,
|
|
22876
|
+
data: {
|
|
22877
|
+
filter: { ...filter, options },
|
|
22878
|
+
loading: false
|
|
22879
|
+
}
|
|
22880
|
+
});
|
|
22881
|
+
};
|
|
22271
22882
|
useEffect(() => {
|
|
22272
22883
|
async function updateClientAndSchema(publicKey2) {
|
|
22273
22884
|
if (!publicKey2 || populatedClient?.clientId === publicKey2 && populatedClient?.allTenantTypes?.length)
|
|
@@ -22426,7 +23037,17 @@ var ContextProvider = ({
|
|
|
22426
23037
|
{
|
|
22427
23038
|
value: {
|
|
22428
23039
|
tenants: populatedClient?.currentTenants ?? tenants,
|
|
22429
|
-
flags: populatedClient?.currentFlags ?? flags
|
|
23040
|
+
flags: populatedClient?.currentFlags ?? flags,
|
|
23041
|
+
childTenantMappings,
|
|
23042
|
+
viewerTenants,
|
|
23043
|
+
viewerTenantsByOwner,
|
|
23044
|
+
isLoadingMappedTenants,
|
|
23045
|
+
isLoadingViewerTenants,
|
|
23046
|
+
fetchViewerTenantsForDashboard,
|
|
23047
|
+
// fetchViewerTenantsByOwner,
|
|
23048
|
+
fetchMappedTenantsForDashboard,
|
|
23049
|
+
getMappedTenantsForDashboard,
|
|
23050
|
+
getViewerTenantsByOwner
|
|
22430
23051
|
},
|
|
22431
23052
|
children
|
|
22432
23053
|
}
|
|
@@ -22451,7 +23072,7 @@ import { flushSync } from "react-dom";
|
|
|
22451
23072
|
import jsPDF from "jspdf";
|
|
22452
23073
|
|
|
22453
23074
|
// src/hooks/useDashboard.ts
|
|
22454
|
-
import { useContext, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
23075
|
+
import { useContext, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
|
|
22455
23076
|
var useDashboardInternal = (dashboardName, customFilters) => {
|
|
22456
23077
|
const [dashboard] = useContext(DashboardContext);
|
|
22457
23078
|
const {
|
|
@@ -22514,7 +23135,7 @@ var useDashboardInternal = (dashboardName, customFilters) => {
|
|
|
22514
23135
|
);
|
|
22515
23136
|
if (!fetchFromServer && Object.keys(dashboardFilters[dashboardName] ?? {}).length && // there exists no non date filter that has undefined options
|
|
22516
23137
|
Object.values(dashboardFilters[dashboardName] ?? {}).every(
|
|
22517
|
-
(filter) => filter.filter.filterType === "date_range" /* Date */ || filter.filter.options
|
|
23138
|
+
(filter) => filter.filter.filterType === "date_range" /* Date */ || filter.filter.filterType === "tenant" /* Tenant */ || filter.filter.options
|
|
22518
23139
|
)) {
|
|
22519
23140
|
return;
|
|
22520
23141
|
}
|
|
@@ -22531,6 +23152,9 @@ var useDashboardInternal = (dashboardName, customFilters) => {
|
|
|
22531
23152
|
...updatedDashboard?.filters?.map((filter) => ({
|
|
22532
23153
|
...filter,
|
|
22533
23154
|
query: void 0
|
|
23155
|
+
})) ?? [],
|
|
23156
|
+
...updatedDashboard?.tenantFilters?.map((filter) => ({
|
|
23157
|
+
...filter
|
|
22534
23158
|
})) ?? []
|
|
22535
23159
|
],
|
|
22536
23160
|
void 0,
|
|
@@ -22721,8 +23345,10 @@ var useDashboards = () => {
|
|
|
22721
23345
|
(a, b) => (a.createdAt?.getTime() ?? 0) - (b.createdAt?.getTime() ?? 0)
|
|
22722
23346
|
);
|
|
22723
23347
|
}, [dashboardConfig]);
|
|
23348
|
+
const { getMappedTenantsForDashboard } = useContext(TenantContext);
|
|
22724
23349
|
const createDashboard = async ({
|
|
22725
23350
|
name: name2,
|
|
23351
|
+
tenantFilters,
|
|
22726
23352
|
filters,
|
|
22727
23353
|
dateFilter,
|
|
22728
23354
|
dashboardOwners
|
|
@@ -22739,6 +23365,7 @@ var useDashboards = () => {
|
|
|
22739
23365
|
tenantKeys: dashboardOwners,
|
|
22740
23366
|
dashboardId: name2,
|
|
22741
23367
|
name: name2,
|
|
23368
|
+
allTenantFilters: tenantFilters ?? [],
|
|
22742
23369
|
filters,
|
|
22743
23370
|
dateFilter
|
|
22744
23371
|
},
|
|
@@ -22747,6 +23374,7 @@ var useDashboards = () => {
|
|
|
22747
23374
|
});
|
|
22748
23375
|
const body = {
|
|
22749
23376
|
newDashboardName: name2.trim(),
|
|
23377
|
+
tenantFilters,
|
|
22750
23378
|
filters,
|
|
22751
23379
|
dateFilter,
|
|
22752
23380
|
name: name2.trim(),
|
|
@@ -22799,6 +23427,7 @@ var useDashboards = () => {
|
|
|
22799
23427
|
const updateDashboard = async (name2, {
|
|
22800
23428
|
newName,
|
|
22801
23429
|
filters,
|
|
23430
|
+
tenantFilters,
|
|
22802
23431
|
dateFilter,
|
|
22803
23432
|
customFilters,
|
|
22804
23433
|
tenantKeys
|
|
@@ -22820,6 +23449,7 @@ var useDashboards = () => {
|
|
|
22820
23449
|
const body = {
|
|
22821
23450
|
newDashboardName: newName.trim(),
|
|
22822
23451
|
filters,
|
|
23452
|
+
tenantFilters,
|
|
22823
23453
|
dateFilter: dateFilter ?? null,
|
|
22824
23454
|
name: name2.trim(),
|
|
22825
23455
|
task: "edit-dashboard",
|
|
@@ -22849,6 +23479,7 @@ var useDashboards = () => {
|
|
|
22849
23479
|
config: {
|
|
22850
23480
|
...dashboard,
|
|
22851
23481
|
...updated.data.dashboard,
|
|
23482
|
+
allTenantFilters: tenantFilters ?? [],
|
|
22852
23483
|
dateFilter: updated.data.dashboard.dateFilter ? {
|
|
22853
23484
|
...updated.data.dashboard.dateFilter,
|
|
22854
23485
|
presetOptions: updated.data.dashboard.dateFilter.presetOptions?.map(
|
|
@@ -22943,6 +23574,8 @@ var useDashboards = () => {
|
|
|
22943
23574
|
endDate: !range.endDate || range.endDate instanceof Date ? range.endDate : new Date(range.endDate)
|
|
22944
23575
|
// when range.endDate is a string
|
|
22945
23576
|
} : void 0;
|
|
23577
|
+
const mappedTenants = await getMappedTenantsForDashboard(newName);
|
|
23578
|
+
const mappedTenantKeys = Object.keys(mappedTenants ?? {});
|
|
22946
23579
|
const newFilters = [
|
|
22947
23580
|
...updatedDateFilter ? [updatedDateFilter] : [],
|
|
22948
23581
|
...updated.data.dashboard.filters.map(
|
|
@@ -22952,14 +23585,22 @@ var useDashboards = () => {
|
|
|
22952
23585
|
values: oldFilters?.[f.label]?.filter?.values,
|
|
22953
23586
|
operator: oldFilters?.[f.label]?.filter?.operator
|
|
22954
23587
|
})
|
|
22955
|
-
) ?? []
|
|
23588
|
+
) ?? [],
|
|
23589
|
+
...(updated.data.dashboard.tenantFilters?.map(
|
|
23590
|
+
(f) => ({
|
|
23591
|
+
...f,
|
|
23592
|
+
values: oldFilters?.[f.label]?.filter?.values
|
|
23593
|
+
})
|
|
23594
|
+
) ?? []).filter((filter) => {
|
|
23595
|
+
return mappedTenantKeys.includes(filter.field);
|
|
23596
|
+
})
|
|
22956
23597
|
].map((f) => {
|
|
22957
23598
|
if (f.filterType === "date_range" /* Date */) {
|
|
22958
23599
|
return {
|
|
22959
23600
|
...f,
|
|
22960
|
-
startDate: dashboardFilters[name2]?.[f.label]?.filter?.startDate,
|
|
22961
|
-
endDate: dashboardFilters[name2]?.[f.label]?.filter?.endDate,
|
|
22962
|
-
preset: dashboardFilters[name2]?.[f.label]?.filter?.preset
|
|
23601
|
+
startDate: dashboardFilters[name2]?.[f.label]?.filter?.startDate ?? f.startDate,
|
|
23602
|
+
endDate: dashboardFilters[name2]?.[f.label]?.filter?.endDate ?? f.endDate,
|
|
23603
|
+
preset: dashboardFilters[name2]?.[f.label]?.filter?.preset ?? f.preset
|
|
22963
23604
|
};
|
|
22964
23605
|
} else {
|
|
22965
23606
|
return {
|
|
@@ -23018,7 +23659,7 @@ var useDashboards = () => {
|
|
|
23018
23659
|
deleteDashboard
|
|
23019
23660
|
};
|
|
23020
23661
|
};
|
|
23021
|
-
var useDashboard = (dashboardName) => {
|
|
23662
|
+
var useDashboard = (dashboardName, config) => {
|
|
23022
23663
|
const { data, dashboardFilters, reload, isLoading } = useDashboardInternal(dashboardName);
|
|
23023
23664
|
const { customFilterDispatch } = useContext(DashboardFiltersContext);
|
|
23024
23665
|
const { reportsDispatch, reportsLoadingStateDispatch } = useContext(ReportsContext);
|
|
@@ -23059,7 +23700,7 @@ var useDashboard = (dashboardName) => {
|
|
|
23059
23700
|
useEffect2(() => {
|
|
23060
23701
|
if (!fetchedInitialReports.current && data) {
|
|
23061
23702
|
fetchedInitialReports.current = true;
|
|
23062
|
-
fetchReports([], dashboardFilters ?? []);
|
|
23703
|
+
fetchReports([], dashboardFilters ?? [], config?.pageSize);
|
|
23063
23704
|
}
|
|
23064
23705
|
}, [fetchedInitialReports, data, dashboardFilters]);
|
|
23065
23706
|
const applyDashboardFilters = (filtersToUpdate) => {
|
|
@@ -23101,6 +23742,20 @@ var useDashboard = (dashboardName) => {
|
|
|
23101
23742
|
endDate: value.endDate
|
|
23102
23743
|
};
|
|
23103
23744
|
}
|
|
23745
|
+
} else if (f.filterType === "tenant" /* Tenant */) {
|
|
23746
|
+
const value = update.value;
|
|
23747
|
+
let values;
|
|
23748
|
+
if (Array.isArray(value)) {
|
|
23749
|
+
values = value;
|
|
23750
|
+
} else if (typeof value === "string") {
|
|
23751
|
+
values = [value];
|
|
23752
|
+
} else {
|
|
23753
|
+
values = [];
|
|
23754
|
+
}
|
|
23755
|
+
return {
|
|
23756
|
+
...f,
|
|
23757
|
+
values
|
|
23758
|
+
};
|
|
23104
23759
|
}
|
|
23105
23760
|
return f;
|
|
23106
23761
|
});
|
|
@@ -23152,24 +23807,39 @@ var useDashboard = (dashboardName) => {
|
|
|
23152
23807
|
}
|
|
23153
23808
|
return [];
|
|
23154
23809
|
};
|
|
23155
|
-
const fetchReports = async (customFilters, dashboardFilters2) => {
|
|
23810
|
+
const fetchReports = async (customFilters, dashboardFilters2, pageSize) => {
|
|
23156
23811
|
if (!client || !sections) return;
|
|
23157
|
-
const
|
|
23158
|
-
(reports) => reports.map((report) => report.id)
|
|
23159
|
-
);
|
|
23812
|
+
const allReports = Object.values(sections).flat();
|
|
23160
23813
|
await Promise.all(
|
|
23161
|
-
|
|
23814
|
+
allReports.map(async (reportInfo) => {
|
|
23815
|
+
const reportId = reportInfo.id;
|
|
23162
23816
|
reportsLoadingStateDispatch({
|
|
23163
23817
|
type: "SET_REPORT_LOADING",
|
|
23164
23818
|
id: reportId,
|
|
23165
23819
|
data: true
|
|
23166
23820
|
});
|
|
23167
23821
|
const customReportFiltersArray = await waitForCustomFilters(reportId);
|
|
23822
|
+
let rowsPerRequest = pageSize || 600;
|
|
23823
|
+
if (!pageSize) {
|
|
23824
|
+
if (reportInfo.chartType === "table") {
|
|
23825
|
+
rowsPerRequest = 10;
|
|
23826
|
+
} else if (reportInfo.chartType === "metric") {
|
|
23827
|
+
rowsPerRequest = 1;
|
|
23828
|
+
}
|
|
23829
|
+
}
|
|
23830
|
+
const pagination = {
|
|
23831
|
+
rowsPerRequest,
|
|
23832
|
+
rowsPerPage: rowsPerRequest
|
|
23833
|
+
};
|
|
23834
|
+
const additionalProcessing = rowsPerRequest ? {
|
|
23835
|
+
page: pagination
|
|
23836
|
+
} : void 0;
|
|
23168
23837
|
const { report, error } = await fetchReport({
|
|
23169
23838
|
reportId,
|
|
23170
23839
|
client,
|
|
23171
23840
|
tenants,
|
|
23172
23841
|
flags,
|
|
23842
|
+
additionalProcessing,
|
|
23173
23843
|
filters: dashboardFilters2.concat(customFilters).concat(customReportFiltersArray),
|
|
23174
23844
|
getToken,
|
|
23175
23845
|
eventTracking
|
|
@@ -23181,7 +23851,10 @@ var useDashboard = (dashboardName) => {
|
|
|
23181
23851
|
reportsDispatch({
|
|
23182
23852
|
type: "UPDATE_REPORT",
|
|
23183
23853
|
id: reportId,
|
|
23184
|
-
data:
|
|
23854
|
+
data: {
|
|
23855
|
+
...report,
|
|
23856
|
+
pagination
|
|
23857
|
+
}
|
|
23185
23858
|
});
|
|
23186
23859
|
reportsLoadingStateDispatch({
|
|
23187
23860
|
type: "SET_REPORT_LOADING",
|
|
@@ -23199,7 +23872,7 @@ var useDashboard = (dashboardName) => {
|
|
|
23199
23872
|
applyFilters
|
|
23200
23873
|
};
|
|
23201
23874
|
};
|
|
23202
|
-
var
|
|
23875
|
+
var useDashboardReportInternal = (reportId, config) => {
|
|
23203
23876
|
const {
|
|
23204
23877
|
reports,
|
|
23205
23878
|
reportsLoadingState,
|
|
@@ -23211,13 +23884,15 @@ var useDashboardReport = (reportId, config) => {
|
|
|
23211
23884
|
const [client] = useContext(ClientContext);
|
|
23212
23885
|
const { getToken } = useContext(FetchContext);
|
|
23213
23886
|
const { eventTracking } = useContext(EventTrackingContext);
|
|
23214
|
-
const { customReportFiltersDispatch } = useContext(ReportFiltersContext);
|
|
23887
|
+
const { customReportFilters, customReportFiltersDispatch } = useContext(ReportFiltersContext);
|
|
23215
23888
|
const { dashboardCustomFilters } = useContext(DashboardFiltersContext);
|
|
23216
23889
|
const {
|
|
23217
23890
|
data: dashboardData,
|
|
23218
23891
|
dashboardFilters: dashboardFiltersInternal,
|
|
23219
23892
|
reload: reloadDashboard
|
|
23220
23893
|
} = useDashboardInternal(reports[reportId]?.dashboardName ?? null);
|
|
23894
|
+
const [pageLoading, setPageLoading] = useState2(false);
|
|
23895
|
+
const [maxPage, setMaxPage] = useState2(0);
|
|
23221
23896
|
useEffect2(() => {
|
|
23222
23897
|
if (config?.initialFilters) {
|
|
23223
23898
|
customReportFiltersDispatch({
|
|
@@ -23255,11 +23930,16 @@ var useDashboardReport = (reportId, config) => {
|
|
|
23255
23930
|
const dashboardFiltersArray = dashboardFiltersInternal ?? [];
|
|
23256
23931
|
const dashboardCustomFiltersArray = dashboardCustomFilters[processedReport?.dashboardName ?? ""] ?? [];
|
|
23257
23932
|
const requestFilters = filters.map(convertCustomFilter).concat(dashboardCustomFiltersArray).concat(dashboardFiltersArray);
|
|
23933
|
+
const pagination = processedReport?.pagination;
|
|
23934
|
+
const additionalProcessing = {
|
|
23935
|
+
page: pagination
|
|
23936
|
+
};
|
|
23258
23937
|
const { report, error } = await fetchReport({
|
|
23259
23938
|
reportId,
|
|
23260
23939
|
client,
|
|
23261
23940
|
tenants,
|
|
23262
23941
|
flags,
|
|
23942
|
+
additionalProcessing,
|
|
23263
23943
|
filters: requestFilters,
|
|
23264
23944
|
getToken,
|
|
23265
23945
|
eventTracking
|
|
@@ -23315,11 +23995,138 @@ var useDashboardReport = (reportId, config) => {
|
|
|
23315
23995
|
});
|
|
23316
23996
|
}
|
|
23317
23997
|
};
|
|
23998
|
+
const updateReportTableRows = async (processing, appendRows) => {
|
|
23999
|
+
if (!client) {
|
|
24000
|
+
return;
|
|
24001
|
+
}
|
|
24002
|
+
setPageLoading(true);
|
|
24003
|
+
const dashboardFiltersArray = dashboardFiltersInternal ?? [];
|
|
24004
|
+
const dashboardCustomFiltersArray = dashboardCustomFilters[processedReport?.dashboardName ?? ""] ?? [];
|
|
24005
|
+
const reportCustomFiltersArray = customReportFilters[reportId] ?? [];
|
|
24006
|
+
const filters = reportCustomFiltersArray.concat(dashboardFiltersArray).concat(dashboardCustomFiltersArray);
|
|
24007
|
+
const pivot = processedReport?.pivot;
|
|
24008
|
+
const pivotQuery = reports[reportId]?.pivotQuery;
|
|
24009
|
+
const { rows } = await fetchResultsByReport({
|
|
24010
|
+
reportId,
|
|
24011
|
+
client,
|
|
24012
|
+
tenants,
|
|
24013
|
+
processing,
|
|
24014
|
+
filters,
|
|
24015
|
+
getToken,
|
|
24016
|
+
eventTracking,
|
|
24017
|
+
pivot,
|
|
24018
|
+
pivotQuery
|
|
24019
|
+
});
|
|
24020
|
+
if (pivot && pivotQuery) {
|
|
24021
|
+
const currRows = reports[reportId]?.pivotRows || [];
|
|
24022
|
+
const updatedRows = appendRows ? [...currRows, ...rows] : rows;
|
|
24023
|
+
reportsDispatch({
|
|
24024
|
+
type: "UPDATE_REPORT",
|
|
24025
|
+
id: reportId,
|
|
24026
|
+
data: {
|
|
24027
|
+
pivotRows: updatedRows,
|
|
24028
|
+
pagination: processing.page,
|
|
24029
|
+
sort: processing.sort
|
|
24030
|
+
}
|
|
24031
|
+
});
|
|
24032
|
+
} else {
|
|
24033
|
+
const currRows = reports[reportId]?.rows || [];
|
|
24034
|
+
const updatedRows = appendRows ? [...currRows, ...rows] : rows;
|
|
24035
|
+
reportsDispatch({
|
|
24036
|
+
type: "UPDATE_REPORT",
|
|
24037
|
+
id: reportId,
|
|
24038
|
+
data: {
|
|
24039
|
+
rows: updatedRows,
|
|
24040
|
+
pagination: processing.page,
|
|
24041
|
+
sort: processing.sort
|
|
24042
|
+
}
|
|
24043
|
+
});
|
|
24044
|
+
}
|
|
24045
|
+
setMaxPage(processing.page?.page || 0);
|
|
24046
|
+
setPageLoading(false);
|
|
24047
|
+
};
|
|
24048
|
+
const handleNextPage = async () => {
|
|
24049
|
+
if (!processedReport?.pagination) {
|
|
24050
|
+
return;
|
|
24051
|
+
}
|
|
24052
|
+
const currPage = processedReport.pagination.page || 0;
|
|
24053
|
+
const updatedPage = {
|
|
24054
|
+
...processedReport.pagination,
|
|
24055
|
+
page: currPage + 1
|
|
24056
|
+
};
|
|
24057
|
+
if (shouldFetchMore(updatedPage, currPage + 1, maxPage)) {
|
|
24058
|
+
const sort = processedReport?.sort;
|
|
24059
|
+
updateReportTableRows({ page: updatedPage, sort }, true);
|
|
24060
|
+
} else {
|
|
24061
|
+
reportsDispatch({
|
|
24062
|
+
type: "UPDATE_REPORT",
|
|
24063
|
+
id: reportId,
|
|
24064
|
+
data: {
|
|
24065
|
+
pagination: updatedPage
|
|
24066
|
+
}
|
|
24067
|
+
});
|
|
24068
|
+
}
|
|
24069
|
+
};
|
|
24070
|
+
const handlePrevPage = async () => {
|
|
24071
|
+
if (!processedReport?.pagination) {
|
|
24072
|
+
return;
|
|
24073
|
+
}
|
|
24074
|
+
const currPage = processedReport.pagination.page || 0;
|
|
24075
|
+
const updatedPage = {
|
|
24076
|
+
...processedReport.pagination,
|
|
24077
|
+
page: currPage - 1
|
|
24078
|
+
};
|
|
24079
|
+
reportsDispatch({
|
|
24080
|
+
type: "UPDATE_REPORT",
|
|
24081
|
+
id: reportId,
|
|
24082
|
+
data: {
|
|
24083
|
+
pagination: updatedPage
|
|
24084
|
+
}
|
|
24085
|
+
});
|
|
24086
|
+
};
|
|
24087
|
+
const handleSort = async (sort) => {
|
|
24088
|
+
const currSort = processedReport?.sort;
|
|
24089
|
+
const currPagination = processedReport?.pagination;
|
|
24090
|
+
const newPagination = currPagination ? { ...currPagination, page: 0 } : void 0;
|
|
24091
|
+
if (currSort?.field !== sort.field || currSort?.direction?.toLowerCase() !== sort?.direction?.toLowerCase()) {
|
|
24092
|
+
updateReportTableRows({ page: newPagination, sort }, false);
|
|
24093
|
+
}
|
|
24094
|
+
};
|
|
23318
24095
|
return {
|
|
23319
24096
|
report: reportsLoadingState[reportId] ? null : processedReport,
|
|
23320
24097
|
loading: !!reportsLoadingState[reportId],
|
|
23321
24098
|
applyFilters: setReportFilters,
|
|
23322
|
-
deleteReport
|
|
24099
|
+
deleteReport,
|
|
24100
|
+
pageNumber: processedReport?.pagination?.page || 0,
|
|
24101
|
+
pageLoading,
|
|
24102
|
+
nextPage: handleNextPage,
|
|
24103
|
+
prevPage: handlePrevPage,
|
|
24104
|
+
sortRows: handleSort
|
|
24105
|
+
};
|
|
24106
|
+
};
|
|
24107
|
+
var useDashboardReport = (reportId, config) => {
|
|
24108
|
+
const { report, loading, applyFilters, deleteReport, nextPage } = useDashboardReportInternal(reportId, config);
|
|
24109
|
+
const fetchingRef = useRef2(false);
|
|
24110
|
+
const fetchNextPage = async () => {
|
|
24111
|
+
if (fetchingRef.current) {
|
|
24112
|
+
return;
|
|
24113
|
+
}
|
|
24114
|
+
try {
|
|
24115
|
+
fetchingRef.current = true;
|
|
24116
|
+
await nextPage();
|
|
24117
|
+
} catch (error) {
|
|
24118
|
+
console.error("Error fetching page:", error.message);
|
|
24119
|
+
} finally {
|
|
24120
|
+
fetchingRef.current = false;
|
|
24121
|
+
}
|
|
24122
|
+
};
|
|
24123
|
+
return {
|
|
24124
|
+
report,
|
|
24125
|
+
isLoading: loading || fetchingRef.current,
|
|
24126
|
+
loading: loading || fetchingRef.current,
|
|
24127
|
+
applyFilters,
|
|
24128
|
+
deleteReport,
|
|
24129
|
+
fetchNextPage
|
|
23323
24130
|
};
|
|
23324
24131
|
};
|
|
23325
24132
|
|
|
@@ -23401,8 +24208,8 @@ var useExport = (reportId, {
|
|
|
23401
24208
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
23402
24209
|
}, [reportFilters, reportId]);
|
|
23403
24210
|
const [client] = useContext2(ClientContext);
|
|
23404
|
-
const [isCSVLoading, setIsCSVLoading] =
|
|
23405
|
-
const [isPDFLoading, setIsPDFLoading] =
|
|
24211
|
+
const [isCSVLoading, setIsCSVLoading] = useState3(false);
|
|
24212
|
+
const [isPDFLoading, setIsPDFLoading] = useState3(false);
|
|
23406
24213
|
if (!reportId || !client) {
|
|
23407
24214
|
return {
|
|
23408
24215
|
downloadCSV: async () => {
|
|
@@ -23560,7 +24367,7 @@ var useExport = (reportId, {
|
|
|
23560
24367
|
} else {
|
|
23561
24368
|
const rows = report.rows;
|
|
23562
24369
|
for (let i = 0; i < rows.length; i += maximumRowsPerPage) {
|
|
23563
|
-
const remainingRows =
|
|
24370
|
+
const remainingRows = rows.length - i;
|
|
23564
24371
|
const availableSpace = maximumRowsPerPage - currentCount;
|
|
23565
24372
|
const rowsToAdd = Math.min(remainingRows, availableSpace);
|
|
23566
24373
|
currentCount += rowsToAdd;
|
|
@@ -24772,7 +25579,7 @@ var PieChartWrapper = React3.forwardRef(
|
|
|
24772
25579
|
var PieChart_default = PieChartWrapper;
|
|
24773
25580
|
|
|
24774
25581
|
// src/components/QuillTable.tsx
|
|
24775
|
-
import { useContext as useContext5, useEffect as useEffect7, useState as
|
|
25582
|
+
import { useContext as useContext5, useEffect as useEffect7, useState as useState8 } from "react";
|
|
24776
25583
|
|
|
24777
25584
|
// src/components/UiComponents.tsx
|
|
24778
25585
|
import {
|
|
@@ -24780,7 +25587,7 @@ import {
|
|
|
24780
25587
|
useContext as useContext4,
|
|
24781
25588
|
useEffect as useEffect6,
|
|
24782
25589
|
useRef as useRef3,
|
|
24783
|
-
useState as
|
|
25590
|
+
useState as useState7
|
|
24784
25591
|
} from "react";
|
|
24785
25592
|
|
|
24786
25593
|
// src/assets/ArrowDownHeadIcon.tsx
|
|
@@ -24981,7 +25788,7 @@ function ChartSkeleton({
|
|
|
24981
25788
|
}
|
|
24982
25789
|
|
|
24983
25790
|
// src/hooks/useInternalState.tsx
|
|
24984
|
-
import { useState as
|
|
25791
|
+
import { useState as useState4 } from "react";
|
|
24985
25792
|
|
|
24986
25793
|
// src/hooks/useOnClickOutside.tsx
|
|
24987
25794
|
import { useEffect as useEffect3 } from "react";
|
|
@@ -25027,10 +25834,10 @@ var createsStackingContext = (computedStyle) => {
|
|
|
25027
25834
|
var useOnClickOutside_default = useOnClickOutside;
|
|
25028
25835
|
|
|
25029
25836
|
// src/hooks/useOnWindowResize.tsx
|
|
25030
|
-
import { useEffect as useEffect4, useState as
|
|
25837
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
25031
25838
|
|
|
25032
25839
|
// src/hooks/useSelectOnKeyDown.tsx
|
|
25033
|
-
import { useEffect as useEffect5, useState as
|
|
25840
|
+
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
25034
25841
|
|
|
25035
25842
|
// src/components/UiComponents.tsx
|
|
25036
25843
|
import { createPortal } from "react-dom";
|
|
@@ -25128,7 +25935,7 @@ var MemoizedButton = ({
|
|
|
25128
25935
|
}) => {
|
|
25129
25936
|
const [theme] = useContext4(ThemeContext);
|
|
25130
25937
|
return /* @__PURE__ */ jsx26(
|
|
25131
|
-
|
|
25938
|
+
QuillToolTipPortal,
|
|
25132
25939
|
{
|
|
25133
25940
|
enabled: !!tooltipText && tooltipText !== "",
|
|
25134
25941
|
text: tooltipText ?? "",
|
|
@@ -25474,7 +26281,7 @@ var MemoizedPopover = ({
|
|
|
25474
26281
|
titlePaddingLeft = 0
|
|
25475
26282
|
}) => {
|
|
25476
26283
|
const [theme] = useContext4(ThemeContext);
|
|
25477
|
-
const [rightAlignment, setRightAlignment] =
|
|
26284
|
+
const [rightAlignment, setRightAlignment] = useState7("auto");
|
|
25478
26285
|
const modalRef = useRef3(null);
|
|
25479
26286
|
const popoverRef = useRef3(null);
|
|
25480
26287
|
useEffect6(() => {
|
|
@@ -25892,7 +26699,7 @@ var QuillModalComponent = ({
|
|
|
25892
26699
|
title
|
|
25893
26700
|
}) => {
|
|
25894
26701
|
const [theme] = useContext4(ThemeContext);
|
|
25895
|
-
const [rightAlignment, setRightAlignment] =
|
|
26702
|
+
const [rightAlignment, setRightAlignment] = useState7("auto");
|
|
25896
26703
|
const modalRef = useRef3(null);
|
|
25897
26704
|
const popoverRef = useRef3(null);
|
|
25898
26705
|
useEffect6(() => {
|
|
@@ -26208,8 +27015,8 @@ var OverflowContainer = ({
|
|
|
26208
27015
|
style: style2
|
|
26209
27016
|
}) => {
|
|
26210
27017
|
const containerRef = useRef3(null);
|
|
26211
|
-
const [showTopShadow, setShowTopShadow] =
|
|
26212
|
-
const [showBottomShadow, setShowBottomShadow] =
|
|
27018
|
+
const [showTopShadow, setShowTopShadow] = useState7(false);
|
|
27019
|
+
const [showBottomShadow, setShowBottomShadow] = useState7(false);
|
|
26213
27020
|
const checkOverflow = () => {
|
|
26214
27021
|
const container = containerRef.current;
|
|
26215
27022
|
if (container) {
|
|
@@ -26365,6 +27172,140 @@ var QuillToolTip = ({
|
|
|
26365
27172
|
/* @__PURE__ */ jsx26("div", { className: "tooltip-text", style: { ...textStyle }, children: text })
|
|
26366
27173
|
] }) : children;
|
|
26367
27174
|
};
|
|
27175
|
+
var QuillToolTipPortal = ({
|
|
27176
|
+
children,
|
|
27177
|
+
text,
|
|
27178
|
+
enabled = true,
|
|
27179
|
+
containerStyle = {},
|
|
27180
|
+
textStyle = {},
|
|
27181
|
+
mirror = false
|
|
27182
|
+
}) => {
|
|
27183
|
+
const [theme] = useContext4(ThemeContext);
|
|
27184
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
27185
|
+
const tooltipRef = useRef3(null);
|
|
27186
|
+
const triggerRef = useRef3(null);
|
|
27187
|
+
const [tooltipPosition, setTooltipPosition] = useState7(void 0);
|
|
27188
|
+
const updatePosition = () => {
|
|
27189
|
+
if (triggerRef.current && tooltipRef.current) {
|
|
27190
|
+
const rect = triggerRef.current.getBoundingClientRect();
|
|
27191
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
27192
|
+
const viewportWidth = window.innerWidth;
|
|
27193
|
+
let top = rect.top + window.scrollY - tooltipRect.height - 8;
|
|
27194
|
+
let left = rect.left + window.scrollX;
|
|
27195
|
+
if (!mirror) {
|
|
27196
|
+
left = rect.left + rect.width / 2 - tooltipRect.width / 2 + window.scrollX;
|
|
27197
|
+
} else {
|
|
27198
|
+
left = rect.right - tooltipRect.width + window.scrollX;
|
|
27199
|
+
}
|
|
27200
|
+
if (left + tooltipRect.width > viewportWidth) {
|
|
27201
|
+
left = viewportWidth - tooltipRect.width - 16;
|
|
27202
|
+
}
|
|
27203
|
+
if (left < 16) {
|
|
27204
|
+
left = 16;
|
|
27205
|
+
}
|
|
27206
|
+
if (top < window.scrollY + 16) {
|
|
27207
|
+
top = rect.bottom + window.scrollY + 8;
|
|
27208
|
+
}
|
|
27209
|
+
setTooltipPosition({ top, left });
|
|
27210
|
+
}
|
|
27211
|
+
};
|
|
27212
|
+
useEffect6(() => {
|
|
27213
|
+
if (isOpen) {
|
|
27214
|
+
const timer2 = setTimeout(() => {
|
|
27215
|
+
updatePosition();
|
|
27216
|
+
}, 0);
|
|
27217
|
+
window.addEventListener("resize", updatePosition, { passive: true });
|
|
27218
|
+
window.addEventListener("scroll", updatePosition, { passive: true });
|
|
27219
|
+
return () => {
|
|
27220
|
+
clearTimeout(timer2);
|
|
27221
|
+
window.removeEventListener("resize", updatePosition);
|
|
27222
|
+
window.removeEventListener("scroll", updatePosition);
|
|
27223
|
+
};
|
|
27224
|
+
}
|
|
27225
|
+
}, [isOpen]);
|
|
27226
|
+
if (!enabled) {
|
|
27227
|
+
return /* @__PURE__ */ jsx26(Fragment2, { children });
|
|
27228
|
+
}
|
|
27229
|
+
return /* @__PURE__ */ jsxs18(
|
|
27230
|
+
"div",
|
|
27231
|
+
{
|
|
27232
|
+
ref: triggerRef,
|
|
27233
|
+
style: {
|
|
27234
|
+
display: "inline-block",
|
|
27235
|
+
position: "relative",
|
|
27236
|
+
...containerStyle
|
|
27237
|
+
},
|
|
27238
|
+
onMouseEnter: () => setIsOpen(true),
|
|
27239
|
+
onMouseLeave: () => setIsOpen(false),
|
|
27240
|
+
children: [
|
|
27241
|
+
children,
|
|
27242
|
+
isOpen && createPortal(
|
|
27243
|
+
/* @__PURE__ */ jsxs18(
|
|
27244
|
+
"div",
|
|
27245
|
+
{
|
|
27246
|
+
ref: tooltipRef,
|
|
27247
|
+
style: {
|
|
27248
|
+
visibility: tooltipPosition ? "visible" : "hidden",
|
|
27249
|
+
position: "absolute",
|
|
27250
|
+
top: `${tooltipPosition?.top ?? 0}px`,
|
|
27251
|
+
left: `${tooltipPosition?.left ?? 0}px`,
|
|
27252
|
+
backgroundColor: "#ffffff",
|
|
27253
|
+
color: "#212121",
|
|
27254
|
+
textAlign: "center",
|
|
27255
|
+
borderRadius: 5,
|
|
27256
|
+
zIndex: 100,
|
|
27257
|
+
padding: 10,
|
|
27258
|
+
fontFamily: theme?.fontFamily,
|
|
27259
|
+
fontWeight: 600,
|
|
27260
|
+
fontSize: "small",
|
|
27261
|
+
whiteSpace: "nowrap",
|
|
27262
|
+
borderWidth: 1,
|
|
27263
|
+
borderStyle: "solid",
|
|
27264
|
+
borderColor: "#e7e7e7",
|
|
27265
|
+
boxShadow: "0px 1px 8px rgba(0, 0, 0, 0.07)",
|
|
27266
|
+
...textStyle
|
|
27267
|
+
},
|
|
27268
|
+
children: [
|
|
27269
|
+
text,
|
|
27270
|
+
/* @__PURE__ */ jsx26(
|
|
27271
|
+
"div",
|
|
27272
|
+
{
|
|
27273
|
+
style: {
|
|
27274
|
+
position: "absolute",
|
|
27275
|
+
top: "100%",
|
|
27276
|
+
left: "50%",
|
|
27277
|
+
marginLeft: -6,
|
|
27278
|
+
borderWidth: 6,
|
|
27279
|
+
borderStyle: "solid",
|
|
27280
|
+
borderColor: "transparent",
|
|
27281
|
+
borderTopColor: "#e7e7e7"
|
|
27282
|
+
}
|
|
27283
|
+
}
|
|
27284
|
+
),
|
|
27285
|
+
/* @__PURE__ */ jsx26(
|
|
27286
|
+
"div",
|
|
27287
|
+
{
|
|
27288
|
+
style: {
|
|
27289
|
+
position: "absolute",
|
|
27290
|
+
top: "100%",
|
|
27291
|
+
left: "50%",
|
|
27292
|
+
marginLeft: -5,
|
|
27293
|
+
borderWidth: 5,
|
|
27294
|
+
borderStyle: "solid",
|
|
27295
|
+
borderColor: "transparent",
|
|
27296
|
+
borderTopColor: "#ffffff"
|
|
27297
|
+
}
|
|
27298
|
+
}
|
|
27299
|
+
)
|
|
27300
|
+
]
|
|
27301
|
+
}
|
|
27302
|
+
),
|
|
27303
|
+
document.body
|
|
27304
|
+
)
|
|
27305
|
+
]
|
|
27306
|
+
}
|
|
27307
|
+
);
|
|
27308
|
+
};
|
|
26368
27309
|
var QuillChartBuilderCheckboxComponent = ({
|
|
26369
27310
|
isChecked,
|
|
26370
27311
|
label,
|
|
@@ -26412,8 +27353,8 @@ var QuillPortal = ({
|
|
|
26412
27353
|
setShowModal
|
|
26413
27354
|
}) => {
|
|
26414
27355
|
const modalRef = useRef3(null);
|
|
26415
|
-
const [popoverPosition, setPopoverPosition] =
|
|
26416
|
-
const [z, setZ] =
|
|
27356
|
+
const [popoverPosition, setPopoverPosition] = useState7(void 0);
|
|
27357
|
+
const [z, setZ] = useState7(10);
|
|
26417
27358
|
const scrollableParentRef = useRef3(document.body);
|
|
26418
27359
|
const updatePosition = () => {
|
|
26419
27360
|
if (anchorRef.current) {
|
|
@@ -26529,13 +27470,13 @@ function QuillTable({
|
|
|
26529
27470
|
hideLabels,
|
|
26530
27471
|
disableSort
|
|
26531
27472
|
}) {
|
|
26532
|
-
const [activeRows, setActiveRows] =
|
|
26533
|
-
const [maxPage, setMaxPage] =
|
|
26534
|
-
const [sortColumn, setSortColumn] =
|
|
26535
|
-
const [sortDirection, setSortDirection] =
|
|
27473
|
+
const [activeRows, setActiveRows] = useState8([]);
|
|
27474
|
+
const [maxPage, setMaxPage] = useState8(1);
|
|
27475
|
+
const [sortColumn, setSortColumn] = useState8(sort?.field || "");
|
|
27476
|
+
const [sortDirection, setSortDirection] = useState8(sort?.direction || "desc");
|
|
26536
27477
|
const [theme] = useContext5(ThemeContext);
|
|
26537
|
-
const [isPaginating, setIsPaginating] =
|
|
26538
|
-
const [initialLoad, setInitialLoad] =
|
|
27478
|
+
const [isPaginating, setIsPaginating] = useState8(true);
|
|
27479
|
+
const [initialLoad, setInitialLoad] = useState8(true);
|
|
26539
27480
|
useEffect7(() => {
|
|
26540
27481
|
setSortColumn(sort?.field || "");
|
|
26541
27482
|
setSortDirection(sort?.direction || "desc");
|
|
@@ -28531,7 +29472,7 @@ import {
|
|
|
28531
29472
|
useContext as useContext9,
|
|
28532
29473
|
useEffect as useEffect9,
|
|
28533
29474
|
useRef as useRef5,
|
|
28534
|
-
useState as
|
|
29475
|
+
useState as useState10
|
|
28535
29476
|
} from "react";
|
|
28536
29477
|
import {
|
|
28537
29478
|
startOfMonth as startOfMonth2,
|
|
@@ -28553,7 +29494,7 @@ import {
|
|
|
28553
29494
|
useContext as useContext8,
|
|
28554
29495
|
useMemo as useMemo7,
|
|
28555
29496
|
useRef as useRef4,
|
|
28556
|
-
useState as
|
|
29497
|
+
useState as useState9,
|
|
28557
29498
|
useEffect as useEffect8
|
|
28558
29499
|
} from "react";
|
|
28559
29500
|
import { createPortal as createPortal2 } from "react-dom";
|
|
@@ -28569,7 +29510,7 @@ function QuillSelectComponent({
|
|
|
28569
29510
|
hideEmptyOption
|
|
28570
29511
|
}) {
|
|
28571
29512
|
const [theme] = useContext8(ThemeContext);
|
|
28572
|
-
const [showModal, setShowModal] =
|
|
29513
|
+
const [showModal, setShowModal] = useState9(false);
|
|
28573
29514
|
const modalRef = useRef4(null);
|
|
28574
29515
|
const buttonRef = useRef4(null);
|
|
28575
29516
|
useOnClickOutside_default(
|
|
@@ -28594,8 +29535,8 @@ function QuillSelectComponent({
|
|
|
28594
29535
|
const nullLabel = useMemo7(() => {
|
|
28595
29536
|
return sortedItems.some((item) => item.value === "-") ? "None" : "-";
|
|
28596
29537
|
}, [sortedItems]);
|
|
28597
|
-
const [popoverPosition, setPopoverPosition] =
|
|
28598
|
-
const [z, setZ] =
|
|
29538
|
+
const [popoverPosition, setPopoverPosition] = useState9(void 0);
|
|
29539
|
+
const [z, setZ] = useState9(10);
|
|
28599
29540
|
const scrollableParentRef = useRef4(document.body);
|
|
28600
29541
|
const updatePosition = () => {
|
|
28601
29542
|
if (buttonRef.current) {
|
|
@@ -28895,20 +29836,20 @@ function QuillDateRangePicker({
|
|
|
28895
29836
|
}) {
|
|
28896
29837
|
const [theme] = useContext9(ThemeContext);
|
|
28897
29838
|
const [client] = useContext9(ClientContext);
|
|
28898
|
-
const [anchorStartDate, setAnchorStartDate] =
|
|
29839
|
+
const [anchorStartDate, setAnchorStartDate] = useState10(
|
|
28899
29840
|
getAnchorStartDate(dateRange.startDate, dateRange.endDate)
|
|
28900
29841
|
);
|
|
28901
|
-
const [anchorEndDate, setAnchorEndDate] =
|
|
29842
|
+
const [anchorEndDate, setAnchorEndDate] = useState10(
|
|
28902
29843
|
getAnchorEndDate(dateRange.startDate, dateRange.endDate)
|
|
28903
29844
|
);
|
|
28904
|
-
const [localStartDate, setLocalStartDate] =
|
|
29845
|
+
const [localStartDate, setLocalStartDate] = useState10(
|
|
28905
29846
|
dateRange.startDate
|
|
28906
29847
|
);
|
|
28907
|
-
const [localEndDate, setLocalEndDate] =
|
|
29848
|
+
const [localEndDate, setLocalEndDate] = useState10(
|
|
28908
29849
|
dateRange.endDate
|
|
28909
29850
|
);
|
|
28910
|
-
const [localPreset, setLocalPreset] =
|
|
28911
|
-
const [showModal, setShowModal] =
|
|
29851
|
+
const [localPreset, setLocalPreset] = useState10(preset);
|
|
29852
|
+
const [showModal, setShowModal] = useState10(false);
|
|
28912
29853
|
const buttonRef = useRef5(null);
|
|
28913
29854
|
const modalRef = useRef5(null);
|
|
28914
29855
|
useEffect9(() => {
|
|
@@ -29427,7 +30368,7 @@ import React7, {
|
|
|
29427
30368
|
useEffect as useEffect10,
|
|
29428
30369
|
useMemo as useMemo8,
|
|
29429
30370
|
useRef as useRef6,
|
|
29430
|
-
useState as
|
|
30371
|
+
useState as useState11
|
|
29431
30372
|
} from "react";
|
|
29432
30373
|
import { createPortal as createPortal3 } from "react-dom";
|
|
29433
30374
|
import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
@@ -29444,15 +30385,15 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
29444
30385
|
style: style2
|
|
29445
30386
|
}) {
|
|
29446
30387
|
const [theme] = useContext10(ThemeContext);
|
|
29447
|
-
const [selectedOptions, setSelectedOptions] =
|
|
29448
|
-
const [showModal, setShowModal] =
|
|
30388
|
+
const [selectedOptions, setSelectedOptions] = useState11([]);
|
|
30389
|
+
const [showModal, setShowModal] = useState11(false);
|
|
29449
30390
|
const modalRef = useRef6(null);
|
|
29450
30391
|
const buttonRef = useRef6(null);
|
|
29451
30392
|
const debounceTimeoutId = useRef6(null);
|
|
29452
30393
|
const [searchQuery, setSearchQuery] = React7.useState("");
|
|
29453
|
-
const [exceedsLimit, setExceedsLimit] =
|
|
29454
|
-
const [popoverPosition, setPopoverPosition] =
|
|
29455
|
-
const [z, setZ] =
|
|
30394
|
+
const [exceedsLimit, setExceedsLimit] = useState11(false);
|
|
30395
|
+
const [popoverPosition, setPopoverPosition] = useState11(void 0);
|
|
30396
|
+
const [z, setZ] = useState11(10);
|
|
29456
30397
|
const scrollableParentRef = useRef6(document.body);
|
|
29457
30398
|
const selectAllRef = useRef6(null);
|
|
29458
30399
|
let CheckboxState;
|
|
@@ -29467,7 +30408,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
29467
30408
|
);
|
|
29468
30409
|
const potentialOptions = useMemo8(() => {
|
|
29469
30410
|
return value.filter((opt) => !optionValues.has(opt ?? "")).map((opt) => ({
|
|
29470
|
-
label: opt === "" ? "-" : opt ?? "-",
|
|
30411
|
+
label: opt === "" ? "-" : opt?.toString() ?? "-",
|
|
29471
30412
|
value: opt ?? ""
|
|
29472
30413
|
})).concat(options);
|
|
29473
30414
|
}, [value, options]);
|
|
@@ -29484,9 +30425,11 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
29484
30425
|
if (matchingOptions.length === options.length && allSelectedLabel) {
|
|
29485
30426
|
return allSelectedLabel;
|
|
29486
30427
|
}
|
|
29487
|
-
return matchingOptions.map(
|
|
30428
|
+
return matchingOptions.map(
|
|
30429
|
+
(elem) => elem.label ?? "-"
|
|
30430
|
+
).join(", ");
|
|
29488
30431
|
}, [options, value]);
|
|
29489
|
-
const [selectAllCheckboxState, setSelectAllCheckboxState] =
|
|
30432
|
+
const [selectAllCheckboxState, setSelectAllCheckboxState] = useState11(
|
|
29490
30433
|
(() => {
|
|
29491
30434
|
if (value.length === 0) {
|
|
29492
30435
|
return 1 /* UNSELECTED */;
|
|
@@ -30090,7 +31033,7 @@ import React8, {
|
|
|
30090
31033
|
useContext as useContext11,
|
|
30091
31034
|
useMemo as useMemo9,
|
|
30092
31035
|
useRef as useRef7,
|
|
30093
|
-
useState as
|
|
31036
|
+
useState as useState12
|
|
30094
31037
|
} from "react";
|
|
30095
31038
|
import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
30096
31039
|
function QuillSelectComponentWithCombo({
|
|
@@ -30104,7 +31047,7 @@ function QuillSelectComponentWithCombo({
|
|
|
30104
31047
|
disabled
|
|
30105
31048
|
}) {
|
|
30106
31049
|
const [theme] = useContext11(ThemeContext);
|
|
30107
|
-
const [showModal, setShowModal] =
|
|
31050
|
+
const [showModal, setShowModal] = useState12(false);
|
|
30108
31051
|
const modalRef = useRef7(null);
|
|
30109
31052
|
const buttonRef = useRef7(null);
|
|
30110
31053
|
const [searchQuery, setSearchQuery] = React8.useState("");
|
|
@@ -30215,7 +31158,7 @@ function QuillSelectComponentWithCombo({
|
|
|
30215
31158
|
textOverflow: "ellipsis",
|
|
30216
31159
|
whiteSpace: "nowrap",
|
|
30217
31160
|
overflow: "hidden",
|
|
30218
|
-
fontWeight: value?.length || isLoading ? void 0 : 300
|
|
31161
|
+
fontWeight: value?.toString()?.length || isLoading ? void 0 : 300
|
|
30219
31162
|
},
|
|
30220
31163
|
children: selectedLabel
|
|
30221
31164
|
}
|
|
@@ -30557,6 +31500,51 @@ function DashboardFilter2({
|
|
|
30557
31500
|
]
|
|
30558
31501
|
}
|
|
30559
31502
|
) });
|
|
31503
|
+
} else if (filter.filterType === "tenant") {
|
|
31504
|
+
if (filter.multiSelect) {
|
|
31505
|
+
return /* @__PURE__ */ jsx42("div", { style: containerStyle, children: /* @__PURE__ */ jsx42(
|
|
31506
|
+
QuillMultiSelectComponentWithCombo,
|
|
31507
|
+
{
|
|
31508
|
+
label: filter.label,
|
|
31509
|
+
value: filter.values ?? [],
|
|
31510
|
+
onChange: (e) => {
|
|
31511
|
+
if (Array.isArray(e.target.value) && e.target.value.length === 0) {
|
|
31512
|
+
onChangeFilter(filter, void 0);
|
|
31513
|
+
return;
|
|
31514
|
+
}
|
|
31515
|
+
onChangeFilter(filter, e.target.value);
|
|
31516
|
+
},
|
|
31517
|
+
options: [
|
|
31518
|
+
...filter.options ? filter.options.map((elem) => ({
|
|
31519
|
+
label: elem.label,
|
|
31520
|
+
value: elem.value
|
|
31521
|
+
})) : []
|
|
31522
|
+
],
|
|
31523
|
+
width: 200,
|
|
31524
|
+
isLoading,
|
|
31525
|
+
disabled
|
|
31526
|
+
}
|
|
31527
|
+
) });
|
|
31528
|
+
}
|
|
31529
|
+
return /* @__PURE__ */ jsx42("div", { style: containerStyle, children: /* @__PURE__ */ jsx42(
|
|
31530
|
+
QuillSelectComponentWithCombo,
|
|
31531
|
+
{
|
|
31532
|
+
label: filter.label,
|
|
31533
|
+
value: filter.values?.[0] ?? "",
|
|
31534
|
+
onChange: (e) => {
|
|
31535
|
+
onChangeFilter(filter, e.target.value);
|
|
31536
|
+
},
|
|
31537
|
+
options: [
|
|
31538
|
+
...filter.options ? filter.options.map((elem) => ({
|
|
31539
|
+
label: elem.label,
|
|
31540
|
+
value: elem.value
|
|
31541
|
+
})) : []
|
|
31542
|
+
],
|
|
31543
|
+
width: 200,
|
|
31544
|
+
isLoading,
|
|
31545
|
+
disabled
|
|
31546
|
+
}
|
|
31547
|
+
) });
|
|
30560
31548
|
}
|
|
30561
31549
|
return null;
|
|
30562
31550
|
}
|
|
@@ -30815,7 +31803,7 @@ var MetricDisplay = ({
|
|
|
30815
31803
|
};
|
|
30816
31804
|
|
|
30817
31805
|
// src/components/Dashboard/DataLoader.tsx
|
|
30818
|
-
import { useContext as useContext13, useEffect as useEffect11, useMemo as useMemo11, useRef as useRef8, useState as
|
|
31806
|
+
import { useContext as useContext13, useEffect as useEffect11, useMemo as useMemo11, useRef as useRef8, useState as useState13 } from "react";
|
|
30819
31807
|
import equal2 from "fast-deep-equal";
|
|
30820
31808
|
import { Fragment as Fragment5, jsx as jsx44 } from "react/jsx-runtime";
|
|
30821
31809
|
var constructReportFromItem = (item) => {
|
|
@@ -30932,10 +31920,10 @@ function DataLoader({
|
|
|
30932
31920
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
30933
31921
|
}, [dashboardFilters, reportFilters, dashboardName, item.id]);
|
|
30934
31922
|
const [schemaData] = useContext13(SchemaDataContext);
|
|
30935
|
-
const [loading, setLoading] =
|
|
30936
|
-
const [error, setError] =
|
|
30937
|
-
const [previousPage, setPreviousPage] =
|
|
30938
|
-
const [additionalProcessing, setAdditionalProcessing] =
|
|
31923
|
+
const [loading, setLoading] = useState13(true);
|
|
31924
|
+
const [error, setError] = useState13(void 0);
|
|
31925
|
+
const [previousPage, setPreviousPage] = useState13(0);
|
|
31926
|
+
const [additionalProcessing, setAdditionalProcessing] = useState13(defaultAdditionalProcessing);
|
|
30939
31927
|
const chartReport = useMemo11(() => {
|
|
30940
31928
|
const report = (dashboardName ? dashboard : reports)[item.id];
|
|
30941
31929
|
if (report) {
|
|
@@ -30956,7 +31944,7 @@ function DataLoader({
|
|
|
30956
31944
|
const previousUserFilters = useRef8(userFilters);
|
|
30957
31945
|
const previousTenants = useRef8(tenants);
|
|
30958
31946
|
const previousCustomFields = useRef8(schemaData.customFields);
|
|
30959
|
-
const [rowCountIsLoading, setRowCountIsLoading] =
|
|
31947
|
+
const [rowCountIsLoading, setRowCountIsLoading] = useState13(false);
|
|
30960
31948
|
const rowsRequestId = useRef8(0);
|
|
30961
31949
|
const rowsAbortController = useRef8(null);
|
|
30962
31950
|
const rowCountRequestId = useRef8(0);
|
|
@@ -31302,8 +32290,8 @@ var ChartDataLoader = ({
|
|
|
31302
32290
|
(f) => f.filter
|
|
31303
32291
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
31304
32292
|
}, [dashboardFilters, reportFilters, dashboardName, item.id]);
|
|
31305
|
-
const [loading, setLoading] =
|
|
31306
|
-
const [error, setError] =
|
|
32293
|
+
const [loading, setLoading] = useState13(true);
|
|
32294
|
+
const [error, setError] = useState13(void 0);
|
|
31307
32295
|
const [client] = useContext13(ClientContext);
|
|
31308
32296
|
const [schemaData] = useContext13(SchemaDataContext);
|
|
31309
32297
|
const previousFilters = useRef8(filters);
|
|
@@ -31539,7 +32527,7 @@ import {
|
|
|
31539
32527
|
Geography,
|
|
31540
32528
|
useMapContext
|
|
31541
32529
|
} from "react-simple-maps";
|
|
31542
|
-
import { useEffect as useEffect12, useMemo as useMemo12, useRef as useRef9, useState as
|
|
32530
|
+
import { useEffect as useEffect12, useMemo as useMemo12, useRef as useRef9, useState as useState14 } from "react";
|
|
31543
32531
|
import { jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
31544
32532
|
var statesUrl = "https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json";
|
|
31545
32533
|
var countriesUrl = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-50m.json";
|
|
@@ -31866,16 +32854,16 @@ function USMap({
|
|
|
31866
32854
|
containerStyle
|
|
31867
32855
|
}) {
|
|
31868
32856
|
const containerRef = useRef9(null);
|
|
31869
|
-
const [hoveredState, setHoveredState] =
|
|
32857
|
+
const [hoveredState, setHoveredState] = useState14(
|
|
31870
32858
|
void 0
|
|
31871
32859
|
);
|
|
31872
|
-
const [hoveredCoords, setHoveredCoords] =
|
|
32860
|
+
const [hoveredCoords, setHoveredCoords] = useState14(void 0);
|
|
31873
32861
|
const mappedData = data.reduce((acc, curr) => {
|
|
31874
32862
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
31875
32863
|
return acc;
|
|
31876
32864
|
}, {});
|
|
31877
32865
|
const measureField = yAxisFields[0].field;
|
|
31878
|
-
const [scaleLog, setScaleLog] =
|
|
32866
|
+
const [scaleLog, setScaleLog] = useState14(null);
|
|
31879
32867
|
useEffect12(() => {
|
|
31880
32868
|
import("d3-scale").then((scale) => {
|
|
31881
32869
|
setScaleLog(() => scale.scaleLog);
|
|
@@ -32034,16 +33022,16 @@ function WorldMap({
|
|
|
32034
33022
|
containerStyle
|
|
32035
33023
|
}) {
|
|
32036
33024
|
const containerRef = useRef9(null);
|
|
32037
|
-
const [hoveredCountry, setHoveredCountry] =
|
|
33025
|
+
const [hoveredCountry, setHoveredCountry] = useState14(
|
|
32038
33026
|
void 0
|
|
32039
33027
|
);
|
|
32040
|
-
const [hoveredCoords, setHoveredCoords] =
|
|
33028
|
+
const [hoveredCoords, setHoveredCoords] = useState14(void 0);
|
|
32041
33029
|
const mappedData = data.reduce((acc, curr) => {
|
|
32042
33030
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
32043
33031
|
return acc;
|
|
32044
33032
|
}, {});
|
|
32045
33033
|
const measureField = yAxisFields[0].field;
|
|
32046
|
-
const [scaleLog, setScaleLog] =
|
|
33034
|
+
const [scaleLog, setScaleLog] = useState14(null);
|
|
32047
33035
|
useEffect12(() => {
|
|
32048
33036
|
import("d3-scale").then((scale) => {
|
|
32049
33037
|
setScaleLog(() => scale.scaleLog);
|
|
@@ -32203,7 +33191,7 @@ function MapLayout({
|
|
|
32203
33191
|
regionNames
|
|
32204
33192
|
}) {
|
|
32205
33193
|
const { projection } = useMapContext();
|
|
32206
|
-
const [geoCentroid, setGeoCentroid] =
|
|
33194
|
+
const [geoCentroid, setGeoCentroid] = useState14(null);
|
|
32207
33195
|
useEffect12(() => {
|
|
32208
33196
|
import("d3-geo").then((geo) => {
|
|
32209
33197
|
setGeoCentroid(() => geo.geoCentroid);
|
|
@@ -32256,7 +33244,7 @@ function MapLayout({
|
|
|
32256
33244
|
}
|
|
32257
33245
|
|
|
32258
33246
|
// src/components/Chart/GaugeChart.tsx
|
|
32259
|
-
import { useEffect as useEffect13, useRef as useRef10, useState as
|
|
33247
|
+
import { useEffect as useEffect13, useRef as useRef10, useState as useState15 } from "react";
|
|
32260
33248
|
|
|
32261
33249
|
// ../../node_modules/d3-transition/src/selection/index.js
|
|
32262
33250
|
import { selection as selection3 } from "d3-selection";
|
|
@@ -33540,9 +34528,9 @@ function D3Gauge({
|
|
|
33540
34528
|
const firstMountRef = useRef10(true);
|
|
33541
34529
|
const startAngle = -(3 * Math.PI) / 4;
|
|
33542
34530
|
const totalAngle = 3 * Math.PI / 2;
|
|
33543
|
-
const [arc, setArc] =
|
|
33544
|
-
const [interpolate, setInterpolate] =
|
|
33545
|
-
const [select, setSelect] =
|
|
34531
|
+
const [arc, setArc] = useState15(null);
|
|
34532
|
+
const [interpolate, setInterpolate] = useState15(null);
|
|
34533
|
+
const [select, setSelect] = useState15(null);
|
|
33546
34534
|
useEffect13(() => {
|
|
33547
34535
|
import("d3-shape").then(({ arc: arc2 }) => {
|
|
33548
34536
|
setArc(() => arc2);
|
|
@@ -33689,7 +34677,7 @@ function D3Gauge({
|
|
|
33689
34677
|
}
|
|
33690
34678
|
|
|
33691
34679
|
// src/components/QuillComponentTables.tsx
|
|
33692
|
-
import { useState as
|
|
34680
|
+
import { useState as useState16, useEffect as useEffect14, useContext as useContext15 } from "react";
|
|
33693
34681
|
import { jsx as jsx47, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
33694
34682
|
var QuillTableSQLEditorComponent = ({
|
|
33695
34683
|
rows,
|
|
@@ -33705,8 +34693,8 @@ var QuillTableSQLEditorComponent = ({
|
|
|
33705
34693
|
setCurrentPage,
|
|
33706
34694
|
hideLabels
|
|
33707
34695
|
}) => {
|
|
33708
|
-
const [sort, setSort] =
|
|
33709
|
-
const [page, setPage] =
|
|
34696
|
+
const [sort, setSort] = useState16({ field: "", direction: "" });
|
|
34697
|
+
const [page, setPage] = useState16(0);
|
|
33710
34698
|
return /* @__PURE__ */ jsx47(
|
|
33711
34699
|
QuillTable,
|
|
33712
34700
|
{
|
|
@@ -33748,8 +34736,8 @@ var QuillTableReportBuilderComponent = ({
|
|
|
33748
34736
|
setCurrentPage,
|
|
33749
34737
|
disableSort
|
|
33750
34738
|
}) => {
|
|
33751
|
-
const [sort, setSort] =
|
|
33752
|
-
const [page, setPage] =
|
|
34739
|
+
const [sort, setSort] = useState16({ field: "", direction: "" });
|
|
34740
|
+
const [page, setPage] = useState16(0);
|
|
33753
34741
|
useEffect14(() => {
|
|
33754
34742
|
if (disableSort) {
|
|
33755
34743
|
setSort({ field: "", direction: "" });
|
|
@@ -33794,9 +34782,9 @@ var QuillTableComponent = ({
|
|
|
33794
34782
|
currentPage,
|
|
33795
34783
|
hideLabels
|
|
33796
34784
|
}) => {
|
|
33797
|
-
const [sort, setSort] =
|
|
33798
|
-
const [page, setPage] =
|
|
33799
|
-
const [initialLoad, setInitialLoad] =
|
|
34785
|
+
const [sort, setSort] = useState16({ field: "", direction: "" });
|
|
34786
|
+
const [page, setPage] = useState16(0);
|
|
34787
|
+
const [initialLoad, setInitialLoad] = useState16(true);
|
|
33800
34788
|
useEffect14(() => {
|
|
33801
34789
|
if (initialLoad && !isLoading) {
|
|
33802
34790
|
setInitialLoad(false);
|
|
@@ -33856,9 +34844,9 @@ function QuillTableDashboardComponent({
|
|
|
33856
34844
|
hideName
|
|
33857
34845
|
}) {
|
|
33858
34846
|
const [theme] = useContext15(ThemeContext);
|
|
33859
|
-
const [initialLoad, setInitialLoad] =
|
|
34847
|
+
const [initialLoad, setInitialLoad] = useState16(true);
|
|
33860
34848
|
const { downloadCSV: downloadCSV2 } = useExport(report?.id);
|
|
33861
|
-
const [page, setPage] =
|
|
34849
|
+
const [page, setPage] = useState16(0);
|
|
33862
34850
|
useEffect14(() => {
|
|
33863
34851
|
if (!isLoading) {
|
|
33864
34852
|
setInitialLoad(false);
|
|
@@ -34042,15 +35030,17 @@ function Chart({
|
|
|
34042
35030
|
if (!equal3(previousFilters.current, filters)) {
|
|
34043
35031
|
previousFilters.current = filters;
|
|
34044
35032
|
}
|
|
34045
|
-
const [filterValues, setFilterValues] =
|
|
35033
|
+
const [filterValues, setFilterValues] = useState17({});
|
|
34046
35034
|
useEffect15(() => {
|
|
34047
35035
|
setFilterValues(
|
|
34048
35036
|
Object.values(reportFilters[reportId] ?? {}).reduce((acc, f) => {
|
|
34049
|
-
acc[f.filter.label] = f.filter.filterType === "string" ? f.filter.stringFilterType === "multiselect" ? { values: f.filter.values, operator: "IN" } : { selectedValue: f.filter.selectedValue } : {
|
|
35037
|
+
acc[f.filter.label] = f.filter.filterType === "string" ? f.filter.stringFilterType === "multiselect" ? { values: f.filter.values, operator: "IN" } : { selectedValue: f.filter.selectedValue } : f.filter.filterType === "date_range" ? {
|
|
34050
35038
|
startDate: f.filter.startDate,
|
|
34051
35039
|
endDate: f.filter.endDate,
|
|
34052
35040
|
preset: f.filter.preset,
|
|
34053
35041
|
comparisonRange: f.filter.comparisonRange
|
|
35042
|
+
} : {
|
|
35043
|
+
values: f.filter.values
|
|
34054
35044
|
};
|
|
34055
35045
|
return acc;
|
|
34056
35046
|
}, {})
|
|
@@ -34110,7 +35100,7 @@ function Chart({
|
|
|
34110
35100
|
[reportId, allReportsById]
|
|
34111
35101
|
);
|
|
34112
35102
|
const report = useMemo13(() => reports[reportId], [reports, reportId]);
|
|
34113
|
-
const [loading, setLoading] =
|
|
35103
|
+
const [loading, setLoading] = useState17(true);
|
|
34114
35104
|
const [theme] = useContext16(ThemeContext);
|
|
34115
35105
|
const colorMap = useMemo13(() => {
|
|
34116
35106
|
if (mapColorsToFields && report && theme) {
|
|
@@ -34118,7 +35108,7 @@ function Chart({
|
|
|
34118
35108
|
}
|
|
34119
35109
|
}, [report, theme]);
|
|
34120
35110
|
const [client, clientLoading] = useContext16(ClientContext);
|
|
34121
|
-
const [error, setError] =
|
|
35111
|
+
const [error, setError] = useState17(void 0);
|
|
34122
35112
|
const updateFilter = (filter, value, comparison) => {
|
|
34123
35113
|
let filterValue = {};
|
|
34124
35114
|
if (filter.filterType === "string" /* String */) {
|
|
@@ -34174,6 +35164,10 @@ function Chart({
|
|
|
34174
35164
|
}
|
|
34175
35165
|
};
|
|
34176
35166
|
}
|
|
35167
|
+
} else if (filter.filterType === "tenant" /* Tenant */) {
|
|
35168
|
+
filterValue = {
|
|
35169
|
+
values: value ? Array.isArray(value) ? value : [value] : []
|
|
35170
|
+
};
|
|
34177
35171
|
}
|
|
34178
35172
|
setFilterValues((filterValues2) => ({
|
|
34179
35173
|
...filterValues2,
|
|
@@ -34404,7 +35398,8 @@ var ChartDisplay = ({
|
|
|
34404
35398
|
onClickChartElement,
|
|
34405
35399
|
overrideTheme,
|
|
34406
35400
|
referenceLines,
|
|
34407
|
-
showLegend = false
|
|
35401
|
+
showLegend = false,
|
|
35402
|
+
tableRowsLoading = false
|
|
34408
35403
|
}) => {
|
|
34409
35404
|
const { downloadCSV: downloadCSV2 } = useExport(reportId);
|
|
34410
35405
|
const [theme] = useContext16(ThemeContext);
|
|
@@ -34436,7 +35431,7 @@ var ChartDisplay = ({
|
|
|
34436
35431
|
}
|
|
34437
35432
|
return void 0;
|
|
34438
35433
|
}, [config, specificReportFilters, specificDashboardFilters]);
|
|
34439
|
-
const [page, setPage] =
|
|
35434
|
+
const [page, setPage] = useState17(0);
|
|
34440
35435
|
if (loading) {
|
|
34441
35436
|
return /* @__PURE__ */ jsx48("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx48(LoadingComponent, {}) });
|
|
34442
35437
|
} else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
|
|
@@ -34499,7 +35494,8 @@ var ChartDisplay = ({
|
|
|
34499
35494
|
},
|
|
34500
35495
|
onSortChange: (sort) => {
|
|
34501
35496
|
onSortChange && onSortChange(sort);
|
|
34502
|
-
}
|
|
35497
|
+
},
|
|
35498
|
+
isLoading: tableRowsLoading
|
|
34503
35499
|
}
|
|
34504
35500
|
);
|
|
34505
35501
|
}
|
|
@@ -34862,7 +35858,7 @@ function QuillChartComponent({
|
|
|
34862
35858
|
}
|
|
34863
35859
|
|
|
34864
35860
|
// src/components/Dashboard/TemplateChartComponent.tsx
|
|
34865
|
-
import { useState as
|
|
35861
|
+
import { useState as useState18 } from "react";
|
|
34866
35862
|
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
34867
35863
|
function QuillTemplateChartComponent({
|
|
34868
35864
|
report,
|
|
@@ -34870,7 +35866,7 @@ function QuillTemplateChartComponent({
|
|
|
34870
35866
|
children,
|
|
34871
35867
|
isLoading
|
|
34872
35868
|
}) {
|
|
34873
|
-
const [isSelected, setIsSelected] =
|
|
35869
|
+
const [isSelected, setIsSelected] = useState18(false);
|
|
34874
35870
|
return /* @__PURE__ */ jsx51(
|
|
34875
35871
|
"div",
|
|
34876
35872
|
{
|
|
@@ -34955,7 +35951,7 @@ import {
|
|
|
34955
35951
|
useEffect as useEffect16,
|
|
34956
35952
|
useMemo as useMemo14,
|
|
34957
35953
|
useRef as useRef12,
|
|
34958
|
-
useState as
|
|
35954
|
+
useState as useState19
|
|
34959
35955
|
} from "react";
|
|
34960
35956
|
import { Fragment as Fragment8, jsx as jsx53, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
34961
35957
|
var QuillSecondaryButton = ({ children, ...props }) => {
|
|
@@ -35448,9 +36444,9 @@ var FilterPopoverWrapper = ({
|
|
|
35448
36444
|
}) => {
|
|
35449
36445
|
const { tenants } = useContext19(TenantContext);
|
|
35450
36446
|
const { eventTracking } = useContext19(EventTrackingContext);
|
|
35451
|
-
const [isOpen, setIsOpen] =
|
|
35452
|
-
const [uniqueValues, setUniqueValues] =
|
|
35453
|
-
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] =
|
|
36447
|
+
const [isOpen, setIsOpen] = useState19(false);
|
|
36448
|
+
const [uniqueValues, setUniqueValues] = useState19(void 0);
|
|
36449
|
+
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState19(false);
|
|
35454
36450
|
const prevFiltersRef = useRef12("");
|
|
35455
36451
|
const columnInternals = useMemo14(() => {
|
|
35456
36452
|
if (!tables) {
|
|
@@ -35545,7 +36541,7 @@ var FilterPopoverWrapper = ({
|
|
|
35545
36541
|
};
|
|
35546
36542
|
|
|
35547
36543
|
// src/components/ReportBuilder/FilterModal.tsx
|
|
35548
|
-
import { useState as
|
|
36544
|
+
import { useState as useState20, useEffect as useEffect17, useMemo as useMemo15 } from "react";
|
|
35549
36545
|
import { format as format8, isValid as isValid5, parse as parse4, startOfToday as startOfToday2 } from "date-fns";
|
|
35550
36546
|
import { Fragment as Fragment9, jsx as jsx54, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
35551
36547
|
function FilterModal({
|
|
@@ -35565,26 +36561,26 @@ function FilterModal({
|
|
|
35565
36561
|
MultiSelectComponent,
|
|
35566
36562
|
reportBuilderColumns
|
|
35567
36563
|
}) {
|
|
35568
|
-
const [field, setField] =
|
|
35569
|
-
const [fieldOptions, setFieldOptions] =
|
|
35570
|
-
const [fieldValues, setFieldValues] =
|
|
35571
|
-
const [type, setType] =
|
|
35572
|
-
const [value, setValue] =
|
|
35573
|
-
const [selectedOptions, setSelectedOptions] =
|
|
35574
|
-
const [operator, setOperator] =
|
|
36564
|
+
const [field, setField] = useState20("");
|
|
36565
|
+
const [fieldOptions, setFieldOptions] = useState20([]);
|
|
36566
|
+
const [fieldValues, setFieldValues] = useState20([]);
|
|
36567
|
+
const [type, setType] = useState20(null);
|
|
36568
|
+
const [value, setValue] = useState20(void 0);
|
|
36569
|
+
const [selectedOptions, setSelectedOptions] = useState20([]);
|
|
36570
|
+
const [operator, setOperator] = useState20(
|
|
35575
36571
|
void 0
|
|
35576
36572
|
);
|
|
35577
|
-
const [operatorOptions, setOperatorOptions] =
|
|
35578
|
-
const [unit, setUnit] =
|
|
35579
|
-
const [unitOptions, setUnitOptions] =
|
|
35580
|
-
const [startDate, setStartDate] =
|
|
36573
|
+
const [operatorOptions, setOperatorOptions] = useState20([]);
|
|
36574
|
+
const [unit, setUnit] = useState20("");
|
|
36575
|
+
const [unitOptions, setUnitOptions] = useState20([]);
|
|
36576
|
+
const [startDate, setStartDate] = useState20(
|
|
35581
36577
|
startOfToday2().toISOString().substring(0, 10)
|
|
35582
36578
|
);
|
|
35583
|
-
const [endDate, setEndDate] =
|
|
36579
|
+
const [endDate, setEndDate] = useState20(
|
|
35584
36580
|
startOfToday2().toISOString().substring(0, 10)
|
|
35585
36581
|
);
|
|
35586
|
-
const [filterInitialized, setFilterInitialized] =
|
|
35587
|
-
const [table, setTable] =
|
|
36582
|
+
const [filterInitialized, setFilterInitialized] = useState20(false);
|
|
36583
|
+
const [table, setTable] = useState20(void 0);
|
|
35588
36584
|
const memoizedFieldValuesMap = useMemo15(
|
|
35589
36585
|
() => fieldValuesMap,
|
|
35590
36586
|
[JSON.stringify(fieldValuesMap)]
|
|
@@ -36345,7 +37341,7 @@ function FilterModal({
|
|
|
36345
37341
|
}
|
|
36346
37342
|
|
|
36347
37343
|
// src/components/Dashboard/TemplateMetricComponent.tsx
|
|
36348
|
-
import { useState as
|
|
37344
|
+
import { useState as useState21 } from "react";
|
|
36349
37345
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
36350
37346
|
function QuillTemplateMetricComponent({
|
|
36351
37347
|
report,
|
|
@@ -36353,7 +37349,7 @@ function QuillTemplateMetricComponent({
|
|
|
36353
37349
|
children,
|
|
36354
37350
|
isLoading
|
|
36355
37351
|
}) {
|
|
36356
|
-
const [isSelected, setIsSelected] =
|
|
37352
|
+
const [isSelected, setIsSelected] = useState21(false);
|
|
36357
37353
|
return /* @__PURE__ */ jsx55(
|
|
36358
37354
|
"div",
|
|
36359
37355
|
{
|
|
@@ -36382,7 +37378,7 @@ function QuillTemplateMetricComponent({
|
|
|
36382
37378
|
}
|
|
36383
37379
|
|
|
36384
37380
|
// src/components/Dashboard/TemplateTableComponent.tsx
|
|
36385
|
-
import { useState as
|
|
37381
|
+
import { useState as useState22 } from "react";
|
|
36386
37382
|
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
36387
37383
|
function QuillTemplateTableComponent({
|
|
36388
37384
|
report,
|
|
@@ -36393,7 +37389,7 @@ function QuillTemplateTableComponent({
|
|
|
36393
37389
|
onPageChange,
|
|
36394
37390
|
onSortChange
|
|
36395
37391
|
}) {
|
|
36396
|
-
const [isSelected, setIsSelected] =
|
|
37392
|
+
const [isSelected, setIsSelected] = useState22(false);
|
|
36397
37393
|
return /* @__PURE__ */ jsx56(
|
|
36398
37394
|
"div",
|
|
36399
37395
|
{
|
|
@@ -36605,8 +37601,8 @@ function Dashboard({
|
|
|
36605
37601
|
templateDashboardName,
|
|
36606
37602
|
pagination = { rowsPerPage: 10, rowsPerRequest: 50 }
|
|
36607
37603
|
}) {
|
|
36608
|
-
const [userFilters, setUserFilters] =
|
|
36609
|
-
const [selectedSection, setSelectedSection] =
|
|
37604
|
+
const [userFilters, setUserFilters] = useState23({});
|
|
37605
|
+
const [selectedSection, setSelectedSection] = useState23("");
|
|
36610
37606
|
const dataLoaderUserFilters = useMemo16(() => {
|
|
36611
37607
|
return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
|
|
36612
37608
|
Object.values(userFilters)
|
|
@@ -36737,21 +37733,21 @@ function Dashboard({
|
|
|
36737
37733
|
const { dispatch: dashboardFiltersDispatch } = useContext20(
|
|
36738
37734
|
DashboardFiltersContext
|
|
36739
37735
|
);
|
|
36740
|
-
const [fieldValuesMap, setFieldValuesMap] =
|
|
36741
|
-
const [fieldValuesIsLoaded, setFieldValuesIsLoaded] =
|
|
36742
|
-
const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] =
|
|
36743
|
-
const [filterListIsOpen, setFilterListIsOpen] =
|
|
37736
|
+
const [fieldValuesMap, setFieldValuesMap] = useState23({});
|
|
37737
|
+
const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = useState23(false);
|
|
37738
|
+
const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = useState23(false);
|
|
37739
|
+
const [filterListIsOpen, setFilterListIsOpen] = useState23(false);
|
|
36744
37740
|
const [
|
|
36745
37741
|
filterListAddFilterPopoverIsOpen,
|
|
36746
37742
|
setFilterListAddFilterPopoverIsOpen
|
|
36747
|
-
] =
|
|
37743
|
+
] = useState23(false);
|
|
36748
37744
|
const presetOptions = useMemo16(() => {
|
|
36749
37745
|
return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
|
|
36750
37746
|
populatedDashboardFilters[0].presetOptions ?? [],
|
|
36751
37747
|
populatedDashboardFilters[0].defaultPresetRanges ?? []
|
|
36752
37748
|
) : defaultOptionsV2;
|
|
36753
37749
|
}, [populatedDashboardFilters]);
|
|
36754
|
-
const [filterValues, setFilterValues] =
|
|
37750
|
+
const [filterValues, setFilterValues] = useState23({});
|
|
36755
37751
|
const prevNameRef = useRef13(name2);
|
|
36756
37752
|
const prevFlagsRef = useRef13(flags);
|
|
36757
37753
|
const prevClientRef = useRef13(client?.publicKey ?? "");
|
|
@@ -36827,11 +37823,13 @@ function Dashboard({
|
|
|
36827
37823
|
useEffect18(() => {
|
|
36828
37824
|
setFilterValues(
|
|
36829
37825
|
Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
|
|
36830
|
-
acc[f.label] = f.filterType === "string" ? f.stringFilterType === "multiselect" ? { values: f.values, operator: "IN" } : { selectedValue: f.selectedValue } : {
|
|
37826
|
+
acc[f.label] = f.filterType === "string" ? f.stringFilterType === "multiselect" ? { values: f.values, operator: "IN" } : { selectedValue: f.selectedValue } : f.filterType === "date_range" ? {
|
|
36831
37827
|
startDate: f.startDate,
|
|
36832
37828
|
endDate: f.endDate,
|
|
36833
37829
|
preset: f.preset,
|
|
36834
37830
|
comparisonRange: f.comparisonRange
|
|
37831
|
+
} : {
|
|
37832
|
+
values: f.values
|
|
36835
37833
|
};
|
|
36836
37834
|
return acc;
|
|
36837
37835
|
}, {})
|
|
@@ -36976,6 +37974,10 @@ function Dashboard({
|
|
|
36976
37974
|
}
|
|
36977
37975
|
};
|
|
36978
37976
|
}
|
|
37977
|
+
} else if (filter.filterType === "tenant" /* Tenant */) {
|
|
37978
|
+
filterValue = {
|
|
37979
|
+
values: value ? Array.isArray(value) ? value : [value] : []
|
|
37980
|
+
};
|
|
36979
37981
|
}
|
|
36980
37982
|
setFilterValues((filterValues2) => ({
|
|
36981
37983
|
...filterValues2,
|
|
@@ -37644,10 +38646,10 @@ function QuillDashboardTemplate({
|
|
|
37644
38646
|
const { dashboardConfig, dashboardConfigDispatch } = useContext20(
|
|
37645
38647
|
DashboardConfigContext
|
|
37646
38648
|
);
|
|
37647
|
-
const [addItemModalIsOpen, setAddItemModalIsOpen] =
|
|
37648
|
-
const [selectedTemplates, setSelectedTemplates] =
|
|
37649
|
-
const [selectingTemplate, setSelectingTemplate] =
|
|
37650
|
-
const [submittingTemplate, setSubmittingTemplate] =
|
|
38649
|
+
const [addItemModalIsOpen, setAddItemModalIsOpen] = useState23(false);
|
|
38650
|
+
const [selectedTemplates, setSelectedTemplates] = useState23([]);
|
|
38651
|
+
const [selectingTemplate, setSelectingTemplate] = useState23(false);
|
|
38652
|
+
const [submittingTemplate, setSubmittingTemplate] = useState23(false);
|
|
37651
38653
|
const templateSections = data?.sections;
|
|
37652
38654
|
const onSubmitTemplates = async () => {
|
|
37653
38655
|
setSubmittingTemplate(true);
|
|
@@ -37793,7 +38795,7 @@ import {
|
|
|
37793
38795
|
useContext as useContext21,
|
|
37794
38796
|
useEffect as useEffect19,
|
|
37795
38797
|
useMemo as useMemo17,
|
|
37796
|
-
useState as
|
|
38798
|
+
useState as useState24
|
|
37797
38799
|
} from "react";
|
|
37798
38800
|
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
37799
38801
|
var Table = ({
|
|
@@ -37809,7 +38811,7 @@ var Table = ({
|
|
|
37809
38811
|
const [schemaData] = useContext21(SchemaDataContext);
|
|
37810
38812
|
const { eventTracking } = useContext21(EventTrackingContext);
|
|
37811
38813
|
const { allReportsById } = useAllReports();
|
|
37812
|
-
const [loading, setLoading] =
|
|
38814
|
+
const [loading, setLoading] = useState24(false);
|
|
37813
38815
|
const report = useMemo17(() => {
|
|
37814
38816
|
return props.reportId ? allReportsById[props.reportId] : null;
|
|
37815
38817
|
}, [allReportsById[props.reportId ?? ""]]);
|
|
@@ -37896,7 +38898,7 @@ var Table = ({
|
|
|
37896
38898
|
clientLoading,
|
|
37897
38899
|
!reports[props.reportId ?? ""]
|
|
37898
38900
|
]);
|
|
37899
|
-
const [page, setPage] =
|
|
38901
|
+
const [page, setPage] = useState24(0);
|
|
37900
38902
|
if ("rows" in data && "columns" in data) {
|
|
37901
38903
|
return /* @__PURE__ */ jsx59(
|
|
37902
38904
|
QuillTable,
|
|
@@ -37957,12 +38959,12 @@ var Table_default = Table;
|
|
|
37957
38959
|
|
|
37958
38960
|
// src/SQLEditor.tsx
|
|
37959
38961
|
import {
|
|
37960
|
-
useState as
|
|
38962
|
+
useState as useState30,
|
|
37961
38963
|
useContext as useContext28,
|
|
37962
38964
|
useEffect as useEffect24,
|
|
37963
38965
|
useRef as useRef18,
|
|
37964
38966
|
useMemo as useMemo22,
|
|
37965
|
-
useCallback as
|
|
38967
|
+
useCallback as useCallback3
|
|
37966
38968
|
} from "react";
|
|
37967
38969
|
import MonacoEditor from "@monaco-editor/react";
|
|
37968
38970
|
|
|
@@ -37970,17 +38972,17 @@ import MonacoEditor from "@monaco-editor/react";
|
|
|
37970
38972
|
import {
|
|
37971
38973
|
useEffect as useEffect22,
|
|
37972
38974
|
useRef as useRef17,
|
|
37973
|
-
useState as
|
|
38975
|
+
useState as useState28,
|
|
37974
38976
|
useContext as useContext26,
|
|
37975
38977
|
useMemo as useMemo21
|
|
37976
38978
|
} from "react";
|
|
37977
38979
|
|
|
37978
38980
|
// src/internals/ReportBuilder/PivotModal.tsx
|
|
37979
38981
|
import {
|
|
37980
|
-
useCallback,
|
|
38982
|
+
useCallback as useCallback2,
|
|
37981
38983
|
useContext as useContext23,
|
|
37982
38984
|
useMemo as useMemo18,
|
|
37983
|
-
useState as
|
|
38985
|
+
useState as useState25,
|
|
37984
38986
|
useEffect as useEffect20,
|
|
37985
38987
|
useRef as useRef14
|
|
37986
38988
|
} from "react";
|
|
@@ -38434,41 +39436,41 @@ var PivotModal = ({
|
|
|
38434
39436
|
heightAdjustment = 0
|
|
38435
39437
|
}) => {
|
|
38436
39438
|
const { getToken, quillFetchWithToken } = useContext23(FetchContext);
|
|
38437
|
-
const [isLoading, setIsLoading] =
|
|
38438
|
-
const [previewLoading, setPreviewLoading] =
|
|
38439
|
-
const [selectedPivotType, setSelectedPivotType] =
|
|
38440
|
-
const [errors, setErrors] =
|
|
39439
|
+
const [isLoading, setIsLoading] = useState25(false);
|
|
39440
|
+
const [previewLoading, setPreviewLoading] = useState25(false);
|
|
39441
|
+
const [selectedPivotType, setSelectedPivotType] = useState25("recommended");
|
|
39442
|
+
const [errors, setErrors] = useState25([]);
|
|
38441
39443
|
const [client] = useContext23(ClientContext);
|
|
38442
39444
|
const [schemaData] = useContext23(SchemaDataContext);
|
|
38443
39445
|
const { tenants } = useContext23(TenantContext);
|
|
38444
39446
|
const { eventTracking } = useContext23(EventTrackingContext);
|
|
38445
39447
|
const rowFieldRef = useRef14(null);
|
|
38446
39448
|
const colFieldRef = useRef14(null);
|
|
38447
|
-
const [pivotCardWidth, setPivotCardWidth] =
|
|
38448
|
-
const [samplePivotTable, setSamplePivotTable] =
|
|
38449
|
-
const [hasNoRecommendedPivots, sethasNoRecommendedPivots] =
|
|
38450
|
-
const [isFetchingPivots, setIsFetchingPivots] =
|
|
38451
|
-
const [allowedColumnFields, setAllowedColumnFields] =
|
|
38452
|
-
const [allowedRowFields, setAllowedRowFields] =
|
|
38453
|
-
const [allowedValueFields, setAllowedValueFields] =
|
|
38454
|
-
const [uniqueValues, setUniqueValues] =
|
|
39449
|
+
const [pivotCardWidth, setPivotCardWidth] = useState25(420);
|
|
39450
|
+
const [samplePivotTable, setSamplePivotTable] = useState25(null);
|
|
39451
|
+
const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = useState25(false);
|
|
39452
|
+
const [isFetchingPivots, setIsFetchingPivots] = useState25(false);
|
|
39453
|
+
const [allowedColumnFields, setAllowedColumnFields] = useState25([]);
|
|
39454
|
+
const [allowedRowFields, setAllowedRowFields] = useState25([]);
|
|
39455
|
+
const [allowedValueFields, setAllowedValueFields] = useState25([]);
|
|
39456
|
+
const [uniqueValues, setUniqueValues] = useState25(initialUniqueValues);
|
|
38455
39457
|
const buttonRef = useRef14(null);
|
|
38456
|
-
const [dateRanges, setDateRanges] =
|
|
38457
|
-
const [pivotError, setPivotError] =
|
|
38458
|
-
const [limitInput, setLimitInput] =
|
|
39458
|
+
const [dateRanges, setDateRanges] = useState25({});
|
|
39459
|
+
const [pivotError, setPivotError] = useState25("");
|
|
39460
|
+
const [limitInput, setLimitInput] = useState25(
|
|
38459
39461
|
pivotLimit?.toString() ?? "100"
|
|
38460
39462
|
);
|
|
38461
|
-
const [sortFieldInput, setSortFieldInput] =
|
|
39463
|
+
const [sortFieldInput, setSortFieldInput] = useState25(
|
|
38462
39464
|
pivotSort?.sortField ?? ""
|
|
38463
39465
|
);
|
|
38464
|
-
const [sortDirectionInput, setSortDirectionInput] =
|
|
39466
|
+
const [sortDirectionInput, setSortDirectionInput] = useState25(
|
|
38465
39467
|
pivotSort?.sortDirection ?? "ASC"
|
|
38466
39468
|
);
|
|
38467
|
-
const [showLimitInput, setShowLimitInput] =
|
|
38468
|
-
const [showSortInput, setShowSortInput] =
|
|
38469
|
-
const [availableHeight, setAvailableHeight] =
|
|
38470
|
-
const [pivotModalTopHeight, setPivotModalTopHeight] =
|
|
38471
|
-
const [popoverPosition, setPopoverPosition] =
|
|
39469
|
+
const [showLimitInput, setShowLimitInput] = useState25(!!pivotLimit);
|
|
39470
|
+
const [showSortInput, setShowSortInput] = useState25(!!pivotSort);
|
|
39471
|
+
const [availableHeight, setAvailableHeight] = useState25(0);
|
|
39472
|
+
const [pivotModalTopHeight, setPivotModalTopHeight] = useState25(450);
|
|
39473
|
+
const [popoverPosition, setPopoverPosition] = useState25(
|
|
38472
39474
|
"bottom"
|
|
38473
39475
|
);
|
|
38474
39476
|
const popoverRef = useRef14(null);
|
|
@@ -38746,7 +39748,7 @@ var PivotModal = ({
|
|
|
38746
39748
|
return map;
|
|
38747
39749
|
}, {});
|
|
38748
39750
|
}, [columns]);
|
|
38749
|
-
const [selectedPivotTable, setSelectedPivotTable] =
|
|
39751
|
+
const [selectedPivotTable, setSelectedPivotTable] = useState25(null);
|
|
38750
39752
|
useEffect20(() => {
|
|
38751
39753
|
const fetchPivotTables = async () => {
|
|
38752
39754
|
if (selectedPivotIndex === -1) {
|
|
@@ -38833,7 +39835,7 @@ var PivotModal = ({
|
|
|
38833
39835
|
setIsOpen(false);
|
|
38834
39836
|
setPopUpTitle("Add pivot");
|
|
38835
39837
|
};
|
|
38836
|
-
const onCommitPivot =
|
|
39838
|
+
const onCommitPivot = useCallback2(() => {
|
|
38837
39839
|
const errors2 = [];
|
|
38838
39840
|
if ((pivotAggregations?.length ?? 0) === 0) {
|
|
38839
39841
|
errors2.push("You must have at least one aggregation");
|
|
@@ -38971,7 +39973,7 @@ var PivotModal = ({
|
|
|
38971
39973
|
const onEditRecommendedPivot = (pivot) => {
|
|
38972
39974
|
onEditPivot(pivot, null);
|
|
38973
39975
|
};
|
|
38974
|
-
const refreshPivots =
|
|
39976
|
+
const refreshPivots = useCallback2(async () => {
|
|
38975
39977
|
if (!client) {
|
|
38976
39978
|
return;
|
|
38977
39979
|
}
|
|
@@ -39254,10 +40256,10 @@ var PivotModal = ({
|
|
|
39254
40256
|
}
|
|
39255
40257
|
}, 500);
|
|
39256
40258
|
};
|
|
39257
|
-
const [recommendedPivotTables, setRecommendedPivotTables] =
|
|
40259
|
+
const [recommendedPivotTables, setRecommendedPivotTables] = useState25(
|
|
39258
40260
|
[]
|
|
39259
40261
|
);
|
|
39260
|
-
const [createdPivotTables, setCreatedPivotTables] =
|
|
40262
|
+
const [createdPivotTables, setCreatedPivotTables] = useState25([]);
|
|
39261
40263
|
useEffect20(() => {
|
|
39262
40264
|
const fetchPivotTables = async () => {
|
|
39263
40265
|
const pts = await Promise.all(
|
|
@@ -40142,7 +41144,7 @@ var validateReport = (formData, dashboardData, defaultDateFilter, allTables) =>
|
|
|
40142
41144
|
|
|
40143
41145
|
// src/components/Chart/InternalChart.tsx
|
|
40144
41146
|
import {
|
|
40145
|
-
useState as
|
|
41147
|
+
useState as useState26,
|
|
40146
41148
|
useEffect as useEffect21,
|
|
40147
41149
|
useContext as useContext24,
|
|
40148
41150
|
useMemo as useMemo19,
|
|
@@ -40289,7 +41291,7 @@ function InternalChart({
|
|
|
40289
41291
|
reportDateFilter.defaultPresetRanges ?? []
|
|
40290
41292
|
) : defaultOptionsV2;
|
|
40291
41293
|
}, [reportDateFilter]);
|
|
40292
|
-
const [filterValues, setFilterValues] =
|
|
41294
|
+
const [filterValues, setFilterValues] = useState26({});
|
|
40293
41295
|
useEffect21(() => {
|
|
40294
41296
|
if (reportDateFilter) {
|
|
40295
41297
|
const customDateFilter = filters?.find(
|
|
@@ -40387,6 +41389,10 @@ function InternalChart({
|
|
|
40387
41389
|
}
|
|
40388
41390
|
};
|
|
40389
41391
|
}
|
|
41392
|
+
} else if (filter.filterType === "tenant" /* Tenant */) {
|
|
41393
|
+
filterValue = {
|
|
41394
|
+
values: value ? Array.isArray(value) ? value : [value] : []
|
|
41395
|
+
};
|
|
40390
41396
|
}
|
|
40391
41397
|
setFilterValues((filterValues2) => ({
|
|
40392
41398
|
...filterValues2,
|
|
@@ -40394,9 +41400,9 @@ function InternalChart({
|
|
|
40394
41400
|
}));
|
|
40395
41401
|
onDashboardFilterChange(filter.label, filterValue);
|
|
40396
41402
|
};
|
|
40397
|
-
const [filtersExpanded, setFiltersExpanded] =
|
|
41403
|
+
const [filtersExpanded, setFiltersExpanded] = useState26(false);
|
|
40398
41404
|
const filtersContainerRef = useRef15(null);
|
|
40399
|
-
const [visibleFilters, setVisibleFilters] =
|
|
41405
|
+
const [visibleFilters, setVisibleFilters] = useState26([]);
|
|
40400
41406
|
const filtersOverflowing = useMemo19(() => {
|
|
40401
41407
|
return visibleFilters.some((visible) => visible);
|
|
40402
41408
|
}, [visibleFilters]);
|
|
@@ -40689,7 +41695,7 @@ import React13, {
|
|
|
40689
41695
|
useContext as useContext25,
|
|
40690
41696
|
useMemo as useMemo20,
|
|
40691
41697
|
useRef as useRef16,
|
|
40692
|
-
useState as
|
|
41698
|
+
useState as useState27
|
|
40693
41699
|
} from "react";
|
|
40694
41700
|
import { Fragment as Fragment12, jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
40695
41701
|
function QuillMultiSelectSectionList({
|
|
@@ -40707,7 +41713,7 @@ function QuillMultiSelectSectionList({
|
|
|
40707
41713
|
owner
|
|
40708
41714
|
}) {
|
|
40709
41715
|
const [theme] = useContext25(ThemeContext);
|
|
40710
|
-
const [showModal, setShowModal] =
|
|
41716
|
+
const [showModal, setShowModal] = useState27(false);
|
|
40711
41717
|
const modalRef = useRef16(null);
|
|
40712
41718
|
const buttonRef = useRef16(null);
|
|
40713
41719
|
const debounceTimeoutId = useRef16(null);
|
|
@@ -41213,6 +42219,7 @@ var ListboxTextInput2 = ({
|
|
|
41213
42219
|
};
|
|
41214
42220
|
|
|
41215
42221
|
// src/ChartBuilder.tsx
|
|
42222
|
+
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
41216
42223
|
import { Fragment as Fragment13, jsx as jsx65, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
41217
42224
|
var CHART_TYPES = [
|
|
41218
42225
|
"column",
|
|
@@ -41322,14 +42329,14 @@ function createReportFromForm(formData, report, eventTracking, selectedPivotTabl
|
|
|
41322
42329
|
}
|
|
41323
42330
|
function ChartBuilderWithModal(props) {
|
|
41324
42331
|
const parentRef = useRef17(null);
|
|
41325
|
-
const [modalWidth, setModalWidth] =
|
|
41326
|
-
const [modalHeight, setModalHeight] =
|
|
42332
|
+
const [modalWidth, setModalWidth] = useState28(200);
|
|
42333
|
+
const [modalHeight, setModalHeight] = useState28(200);
|
|
41327
42334
|
const { isOpen, setIsOpen, title, isHorizontalView } = props;
|
|
41328
42335
|
const Modal = props.ModalComponent ?? MemoizedModal;
|
|
41329
42336
|
const { dashboardReports: dashboard } = useDashboardReports(
|
|
41330
42337
|
props.destinationDashboard
|
|
41331
42338
|
);
|
|
41332
|
-
const [filtersEnabledState, setFiltersEnabledState] =
|
|
42339
|
+
const [filtersEnabledState, setFiltersEnabledState] = useState28(
|
|
41333
42340
|
!!props.reportId
|
|
41334
42341
|
);
|
|
41335
42342
|
useEffect22(() => {
|
|
@@ -41444,16 +42451,16 @@ function ChartBuilder({
|
|
|
41444
42451
|
const report = useMemo21(() => {
|
|
41445
42452
|
return reportId && !tempReport ? allReportsById[reportId] : tempReport;
|
|
41446
42453
|
}, [reportId]);
|
|
41447
|
-
const [windowWidth, setWindowWidth] =
|
|
41448
|
-
const [rows, setRows] =
|
|
41449
|
-
const [itemQuery, setItemQuery] =
|
|
41450
|
-
const [rowCount, setRowCount] =
|
|
41451
|
-
const [maxPage, setMaxPage] =
|
|
41452
|
-
const [isLoading, setIsLoading] =
|
|
41453
|
-
const [rowCountIsLoading, setRowCountIsLoading] =
|
|
41454
|
-
const [isSubmitting, setIsSubmitting] =
|
|
41455
|
-
const [pivotCardWidth, setPivotCardWidth] =
|
|
41456
|
-
const [formWidth, setFormWidth] =
|
|
42454
|
+
const [windowWidth, setWindowWidth] = useState28(1200);
|
|
42455
|
+
const [rows, setRows] = useState28(report?.rows ?? []);
|
|
42456
|
+
const [itemQuery, setItemQuery] = useState28(report?.itemQuery);
|
|
42457
|
+
const [rowCount, setRowCount] = useState28(report?.rowCount ?? 0);
|
|
42458
|
+
const [maxPage, setMaxPage] = useState28(0);
|
|
42459
|
+
const [isLoading, setIsLoading] = useState28(false);
|
|
42460
|
+
const [rowCountIsLoading, setRowCountIsLoading] = useState28(false);
|
|
42461
|
+
const [isSubmitting, setIsSubmitting] = useState28(false);
|
|
42462
|
+
const [pivotCardWidth, setPivotCardWidth] = useState28(665);
|
|
42463
|
+
const [formWidth, setFormWidth] = useState28(665);
|
|
41457
42464
|
const inputRef = useRef17(null);
|
|
41458
42465
|
const selectRef = useRef17(null);
|
|
41459
42466
|
const processColumns = (columns2) => {
|
|
@@ -41485,10 +42492,10 @@ function ChartBuilder({
|
|
|
41485
42492
|
}
|
|
41486
42493
|
return columns2;
|
|
41487
42494
|
};
|
|
41488
|
-
const [processedColumns, setProcessedColumns] =
|
|
42495
|
+
const [processedColumns, setProcessedColumns] = useState28(
|
|
41489
42496
|
processColumns(report?.columnInternal ?? [])
|
|
41490
42497
|
);
|
|
41491
|
-
const [currentPage, setCurrentPage] =
|
|
42498
|
+
const [currentPage, setCurrentPage] = useState28(0);
|
|
41492
42499
|
const parentRef = useRef17(null);
|
|
41493
42500
|
const deleteRef = useRef17(null);
|
|
41494
42501
|
const modalPadding = 20;
|
|
@@ -41535,7 +42542,7 @@ function ChartBuilder({
|
|
|
41535
42542
|
window.removeEventListener("resize", handleResize);
|
|
41536
42543
|
};
|
|
41537
42544
|
}, [isOpen]);
|
|
41538
|
-
const [dashboardOptions, setDashboardOptions] =
|
|
42545
|
+
const [dashboardOptions, setDashboardOptions] = useState28([]);
|
|
41539
42546
|
const {
|
|
41540
42547
|
reportFilters,
|
|
41541
42548
|
loadFiltersForReport,
|
|
@@ -41544,7 +42551,7 @@ function ChartBuilder({
|
|
|
41544
42551
|
} = useContext26(ReportFiltersContext);
|
|
41545
42552
|
const { reportsDispatch } = useContext26(ReportsContext);
|
|
41546
42553
|
const initialFilters = useRef17(reportFilters[report?.id ?? TEMP_REPORT_ID]);
|
|
41547
|
-
const [reportFiltersLoaded, setReportFiltersLoaded] =
|
|
42554
|
+
const [reportFiltersLoaded, setReportFiltersLoaded] = useState28(!filtersEnabled);
|
|
41548
42555
|
useEffect22(() => {
|
|
41549
42556
|
if (!reportFilters[report?.id ?? TEMP_REPORT_ID]) {
|
|
41550
42557
|
loadFiltersForReport(
|
|
@@ -41578,20 +42585,20 @@ function ChartBuilder({
|
|
|
41578
42585
|
(f) => f.filter
|
|
41579
42586
|
);
|
|
41580
42587
|
}, [reportFilters, report?.id]);
|
|
41581
|
-
const [showFilterModal, setShowFilterModal] =
|
|
41582
|
-
const [filterIssues, setFilterIssues] =
|
|
41583
|
-
const [showPivotPopover, setShowPivotPopover] =
|
|
41584
|
-
const [isEdittingPivot, setIsEdittingPivot] =
|
|
41585
|
-
const [selectedPivotIndex, setSelectedPivotIndex] =
|
|
41586
|
-
const [tableName, setTableName] =
|
|
41587
|
-
const [includeCustomFields, setIncludeCustomFields] =
|
|
42588
|
+
const [showFilterModal, setShowFilterModal] = useState28(false);
|
|
42589
|
+
const [filterIssues, setFilterIssues] = useState28([]);
|
|
42590
|
+
const [showPivotPopover, setShowPivotPopover] = useState28(false);
|
|
42591
|
+
const [isEdittingPivot, setIsEdittingPivot] = useState28(false);
|
|
42592
|
+
const [selectedPivotIndex, setSelectedPivotIndex] = useState28(-1);
|
|
42593
|
+
const [tableName, setTableName] = useState28(void 0);
|
|
42594
|
+
const [includeCustomFields, setIncludeCustomFields] = useState28(
|
|
41588
42595
|
report ? !!report.includeCustomFields : !!client?.featureFlags?.customFieldsEnabled
|
|
41589
42596
|
);
|
|
41590
42597
|
const selectedTable = schemaData.schema?.find(
|
|
41591
42598
|
(t) => t.displayName === tableName
|
|
41592
42599
|
);
|
|
41593
|
-
const [pivotPopUpTitle, setPivotPopUpTitle] =
|
|
41594
|
-
const [pivotError, setPivotError] =
|
|
42600
|
+
const [pivotPopUpTitle, setPivotPopUpTitle] = useState28("Add pivot");
|
|
42601
|
+
const [pivotError, setPivotError] = useState28(void 0);
|
|
41595
42602
|
const pivotData = report?.pivotRows && report?.pivotColumns ? {
|
|
41596
42603
|
rows: report.pivotRows,
|
|
41597
42604
|
columns: report.pivotColumns,
|
|
@@ -41602,19 +42609,19 @@ function ChartBuilder({
|
|
|
41602
42609
|
const columns = report?.columnInternal ?? [];
|
|
41603
42610
|
const destinationDashboardName = report?.dashboardName || destinationDashboard;
|
|
41604
42611
|
const query = report?.queryString;
|
|
41605
|
-
const [loadingFormData, setLoadingFormData] =
|
|
41606
|
-
const [triggeredEditChart, setTriggeredEditChart] =
|
|
41607
|
-
const [createdPivots, setCreatedPivots] =
|
|
42612
|
+
const [loadingFormData, setLoadingFormData] = useState28(false);
|
|
42613
|
+
const [triggeredEditChart, setTriggeredEditChart] = useState28(false);
|
|
42614
|
+
const [createdPivots, setCreatedPivots] = useState28(
|
|
41608
42615
|
report?.pivot ? [report.pivot] : cp
|
|
41609
42616
|
);
|
|
41610
|
-
const [recommendedPivots, setRecommendedPivots] =
|
|
41611
|
-
const [pivotRowField, setPivotRowField] =
|
|
42617
|
+
const [recommendedPivots, setRecommendedPivots] = useState28(rp);
|
|
42618
|
+
const [pivotRowField, setPivotRowField] = useState28(
|
|
41612
42619
|
report?.pivot?.rowField
|
|
41613
42620
|
);
|
|
41614
|
-
const [pivotColumnField, setPivotColumnField] =
|
|
42621
|
+
const [pivotColumnField, setPivotColumnField] = useState28(
|
|
41615
42622
|
report?.pivot?.columnField
|
|
41616
42623
|
);
|
|
41617
|
-
const [pivotAggregations, setPivotAggregations] =
|
|
42624
|
+
const [pivotAggregations, setPivotAggregations] = useState28(
|
|
41618
42625
|
report?.pivot?.aggregations ?? [
|
|
41619
42626
|
{
|
|
41620
42627
|
valueField: report?.pivot?.valueField,
|
|
@@ -41623,10 +42630,10 @@ function ChartBuilder({
|
|
|
41623
42630
|
}
|
|
41624
42631
|
]
|
|
41625
42632
|
);
|
|
41626
|
-
const [pivotLimit, setPivotLimit] =
|
|
42633
|
+
const [pivotLimit, setPivotLimit] = useState28(
|
|
41627
42634
|
report?.pivot?.rowLimit
|
|
41628
42635
|
);
|
|
41629
|
-
const [pivotSort, setPivotSort] =
|
|
42636
|
+
const [pivotSort, setPivotSort] = useState28(
|
|
41630
42637
|
report?.pivot?.sort && report?.pivot?.sortDirection && report?.pivot?.sortField ? {
|
|
41631
42638
|
sortField: report.pivot.sortField,
|
|
41632
42639
|
sortDirection: report.pivot.sortDirection
|
|
@@ -41639,16 +42646,16 @@ function ChartBuilder({
|
|
|
41639
42646
|
rowsPerRequest: report?.chartType === "table" ? 50 : 500
|
|
41640
42647
|
}
|
|
41641
42648
|
};
|
|
41642
|
-
const [currentProcessing, setCurrentProcessing] =
|
|
41643
|
-
const [customTenantAccess, setCustomTenantAccess] =
|
|
42649
|
+
const [currentProcessing, setCurrentProcessing] = useState28(baseProcessing);
|
|
42650
|
+
const [customTenantAccess, setCustomTenantAccess] = useState28(
|
|
41644
42651
|
!!Object.values(report?.flags ?? {}).length
|
|
41645
42652
|
);
|
|
41646
|
-
const [dateFieldOptions, setDateFieldOptions] =
|
|
41647
|
-
const [allTables, setAllTables] =
|
|
41648
|
-
const [customFieldTableRef, setCustomFieldTableRef] =
|
|
41649
|
-
const [referencedColumns, setReferencedColumns] =
|
|
41650
|
-
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] =
|
|
41651
|
-
const [filterMap, setFilterMap] =
|
|
42653
|
+
const [dateFieldOptions, setDateFieldOptions] = useState28([]);
|
|
42654
|
+
const [allTables, setAllTables] = useState28([]);
|
|
42655
|
+
const [customFieldTableRef, setCustomFieldTableRef] = useState28(false);
|
|
42656
|
+
const [referencedColumns, setReferencedColumns] = useState28({});
|
|
42657
|
+
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = useState28({});
|
|
42658
|
+
const [filterMap, setFilterMap] = useState28(report?.filterMap ?? {});
|
|
41652
42659
|
const canonicalFilterMap = useMemo21(() => {
|
|
41653
42660
|
return Object.fromEntries(
|
|
41654
42661
|
Object.entries(filterMap).filter(
|
|
@@ -41659,7 +42666,7 @@ function ChartBuilder({
|
|
|
41659
42666
|
const validFilter = useMemo21(() => {
|
|
41660
42667
|
return specificDashboardFilters.reduce(
|
|
41661
42668
|
(acc, filter) => {
|
|
41662
|
-
if (filter.filterType === "date_range") {
|
|
42669
|
+
if (filter.filterType === "date_range" || filter.filterType === "tenant") {
|
|
41663
42670
|
acc[filter.label] = true;
|
|
41664
42671
|
return acc;
|
|
41665
42672
|
}
|
|
@@ -41675,7 +42682,7 @@ function ChartBuilder({
|
|
|
41675
42682
|
{}
|
|
41676
42683
|
);
|
|
41677
42684
|
}, [specificDashboardFilters, filterMap, allTables]);
|
|
41678
|
-
const [formFlags, setFormFlags] =
|
|
42685
|
+
const [formFlags, setFormFlags] = useState28(
|
|
41679
42686
|
report?.flags ? Object.fromEntries(
|
|
41680
42687
|
Object.entries(report.flags).map(([key, value]) => {
|
|
41681
42688
|
if (value === ALL_TENANTS) {
|
|
@@ -41692,7 +42699,7 @@ function ChartBuilder({
|
|
|
41692
42699
|
})
|
|
41693
42700
|
) : void 0
|
|
41694
42701
|
);
|
|
41695
|
-
const [defaultDateField, setDefaultDateField] =
|
|
42702
|
+
const [defaultDateField, setDefaultDateField] = useState28({
|
|
41696
42703
|
table: dateFieldOptions[0]?.name || "",
|
|
41697
42704
|
field: dateFieldOptions[0]?.columns[0]?.field || ""
|
|
41698
42705
|
});
|
|
@@ -41850,7 +42857,7 @@ function ChartBuilder({
|
|
|
41850
42857
|
}
|
|
41851
42858
|
return chartBuilderData;
|
|
41852
42859
|
};
|
|
41853
|
-
const [formData, setFormData] =
|
|
42860
|
+
const [formData, setFormData] = useState28(
|
|
41854
42861
|
formFormDataFromReport(report, destinationSection ?? getCurrentSection())
|
|
41855
42862
|
);
|
|
41856
42863
|
const reportCustomFields = useMemo21(() => {
|
|
@@ -41904,7 +42911,7 @@ function ChartBuilder({
|
|
|
41904
42911
|
const columnsObservedInRows = rows[0] ? Object.keys(rows[0]) : [];
|
|
41905
42912
|
return columns.filter((col) => !columnsObservedInRows.includes(col.field));
|
|
41906
42913
|
}, [rows]);
|
|
41907
|
-
const [chartTypes, setChartTypes] =
|
|
42914
|
+
const [chartTypes, setChartTypes] = useState28(
|
|
41908
42915
|
(() => {
|
|
41909
42916
|
const data = formFormDataFromReport(
|
|
41910
42917
|
report,
|
|
@@ -42120,7 +43127,7 @@ function ChartBuilder({
|
|
|
42120
43127
|
{}
|
|
42121
43128
|
) ?? {};
|
|
42122
43129
|
}, [client?.allTenantTypes]);
|
|
42123
|
-
const [selectedPivotTable, setSelectedPivotTable] =
|
|
43130
|
+
const [selectedPivotTable, setSelectedPivotTable] = useState28(pivotData);
|
|
42124
43131
|
const pivotCardTable = useMemo21(() => {
|
|
42125
43132
|
return {
|
|
42126
43133
|
pivot: formData.pivot,
|
|
@@ -42802,6 +43809,30 @@ function ChartBuilder({
|
|
|
42802
43809
|
setIsSubmitting(false);
|
|
42803
43810
|
setTriggeredEditChart(false);
|
|
42804
43811
|
};
|
|
43812
|
+
const memoizedTooltipText = useMemo21(() => {
|
|
43813
|
+
const getTooltipText = () => {
|
|
43814
|
+
if (formData.name === "") {
|
|
43815
|
+
return "Please enter a name for the chart";
|
|
43816
|
+
}
|
|
43817
|
+
if (formData.dashboardName === "") {
|
|
43818
|
+
return "Please select a dashboard";
|
|
43819
|
+
}
|
|
43820
|
+
if (formData.chartType === "") {
|
|
43821
|
+
return "Please select a chart type";
|
|
43822
|
+
}
|
|
43823
|
+
if (filterIssues.length !== 0) {
|
|
43824
|
+
return "Please fix the filter issues";
|
|
43825
|
+
}
|
|
43826
|
+
if (Object.values(validFilter).includes(false)) {
|
|
43827
|
+
return "Please fix the filter issues";
|
|
43828
|
+
}
|
|
43829
|
+
if (currentDashboard?.tenantKeys && customTenantAccess && Object.values(formFlags ?? {}).every((value) => !value.length)) {
|
|
43830
|
+
return "Please fix the tenant issues";
|
|
43831
|
+
}
|
|
43832
|
+
return "";
|
|
43833
|
+
};
|
|
43834
|
+
return getTooltipText();
|
|
43835
|
+
}, [formData, filterIssues, validFilter, formFlags, currentDashboard]);
|
|
42805
43836
|
isHorizontalView = windowWidth < 1200 ? false : isHorizontalView;
|
|
42806
43837
|
if (!schemaData.schema) {
|
|
42807
43838
|
return /* @__PURE__ */ jsx65("div", { children: "No schema" });
|
|
@@ -43891,7 +44922,7 @@ function ChartBuilder({
|
|
|
43891
44922
|
})) ?? [],
|
|
43892
44923
|
width: 200,
|
|
43893
44924
|
emptyLabel: dashboardOwner.scope === "database" ? "No tags supplied" : void 0,
|
|
43894
|
-
allSelectedLabel: "All " + dashboardOwner.name
|
|
44925
|
+
allSelectedLabel: "All " + (0, import_pluralize.default)(dashboardOwner.name),
|
|
43895
44926
|
style: {
|
|
43896
44927
|
display: customTenantAccess || containsCustomFields ? "inline" : "none",
|
|
43897
44928
|
marginTop: -1,
|
|
@@ -43916,7 +44947,7 @@ function ChartBuilder({
|
|
|
43916
44947
|
{}
|
|
43917
44948
|
) ?? {},
|
|
43918
44949
|
width: 200,
|
|
43919
|
-
allSelectedLabel: "All " + dashboardOwner.name
|
|
44950
|
+
allSelectedLabel: "All " + (0, import_pluralize.default)(dashboardOwner.name),
|
|
43920
44951
|
style: {
|
|
43921
44952
|
display: customTenantAccess || containsCustomFields ? "inline" : "none",
|
|
43922
44953
|
marginTop: -1,
|
|
@@ -44021,7 +45052,7 @@ function ChartBuilder({
|
|
|
44021
45052
|
gap: 6
|
|
44022
45053
|
},
|
|
44023
45054
|
children: specificDashboardFilters.filter((f) => {
|
|
44024
|
-
return f.filterType
|
|
45055
|
+
return f.filterType === "string";
|
|
44025
45056
|
}).map((filter, index) => /* @__PURE__ */ jsxs47(ChartBuilderInputRowContainer, { children: [
|
|
44026
45057
|
/* @__PURE__ */ jsx65(
|
|
44027
45058
|
TextInputComponent,
|
|
@@ -44199,6 +45230,7 @@ function ChartBuilder({
|
|
|
44199
45230
|
disabled: formData.name === "" || formData.dashboardName === "" || formData.chartType === "" || filterIssues.length !== 0 || Object.values(validFilter).includes(false) || currentDashboard?.tenantKeys && customTenantAccess && Object.values(formFlags ?? {}).every(
|
|
44200
45231
|
(value) => !value.length
|
|
44201
45232
|
),
|
|
45233
|
+
tooltipText: memoizedTooltipText,
|
|
44202
45234
|
label: buttonLabel ? buttonLabel : report ? "Save changes" : "Add to dashboard"
|
|
44203
45235
|
}
|
|
44204
45236
|
)
|
|
@@ -44717,7 +45749,7 @@ var createDebounce = (func, delay) => {
|
|
|
44717
45749
|
};
|
|
44718
45750
|
|
|
44719
45751
|
// src/hooks/useLongLoading.tsx
|
|
44720
|
-
import { useContext as useContext27, useEffect as useEffect23, useState as
|
|
45752
|
+
import { useContext as useContext27, useEffect as useEffect23, useState as useState29 } from "react";
|
|
44721
45753
|
function useLongLoading(isLoading, meta) {
|
|
44722
45754
|
const {
|
|
44723
45755
|
origin,
|
|
@@ -44725,8 +45757,8 @@ function useLongLoading(isLoading, meta) {
|
|
|
44725
45757
|
abnormalLoadTime = 15e3,
|
|
44726
45758
|
loadDescription
|
|
44727
45759
|
} = meta;
|
|
44728
|
-
const [isLongLoading, setIsLongLoading] =
|
|
44729
|
-
const [isAbnormalLoading, setIsAbnormalLoading] =
|
|
45760
|
+
const [isLongLoading, setIsLongLoading] = useState29(false);
|
|
45761
|
+
const [isAbnormalLoading, setIsAbnormalLoading] = useState29(false);
|
|
44730
45762
|
const { eventTracking } = useContext27(EventTrackingContext);
|
|
44731
45763
|
useEffect23(() => {
|
|
44732
45764
|
let longTimer = null;
|
|
@@ -44904,7 +45936,7 @@ function SQLEditor({
|
|
|
44904
45936
|
onClickChartElement,
|
|
44905
45937
|
onRequestAddVirtualTable
|
|
44906
45938
|
}) {
|
|
44907
|
-
const [sqlPrompt, setSqlPrompt] =
|
|
45939
|
+
const [sqlPrompt, setSqlPrompt] = useState30("");
|
|
44908
45940
|
const [client] = useContext28(ClientContext);
|
|
44909
45941
|
const [theme] = useContext28(ThemeContext);
|
|
44910
45942
|
const { tenants } = useContext28(TenantContext);
|
|
@@ -44919,9 +45951,9 @@ function SQLEditor({
|
|
|
44919
45951
|
const destinationDashboardConfig = useMemo22(() => {
|
|
44920
45952
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
44921
45953
|
}, [dashboards, destinationDashboard]);
|
|
44922
|
-
const [query, setQuery] =
|
|
44923
|
-
const [rows, setRows] =
|
|
44924
|
-
const [columns, setColumns] =
|
|
45954
|
+
const [query, setQuery] = useState30(defaultQuery);
|
|
45955
|
+
const [rows, setRows] = useState30([]);
|
|
45956
|
+
const [columns, setColumns] = useState30([]);
|
|
44925
45957
|
const [schemaData] = useContext28(SchemaDataContext);
|
|
44926
45958
|
const { dashboardFilters } = useContext28(DashboardFiltersContext);
|
|
44927
45959
|
const specificDashboardFilters = useMemo22(() => {
|
|
@@ -44929,37 +45961,37 @@ function SQLEditor({
|
|
|
44929
45961
|
dashboardFilters[report?.dashboardName ?? destinationDashboard ?? ""] ?? {}
|
|
44930
45962
|
).map((f) => f.filter);
|
|
44931
45963
|
}, [dashboardFilters, destinationDashboard]);
|
|
44932
|
-
const [errorMessage, setErrorMessage] =
|
|
44933
|
-
const [sqlResponseLoading, setSqlResponseLoading] =
|
|
45964
|
+
const [errorMessage, setErrorMessage] = useState30("");
|
|
45965
|
+
const [sqlResponseLoading, setSqlResponseLoading] = useState30(false);
|
|
44934
45966
|
useLongLoading(sqlResponseLoading, {
|
|
44935
45967
|
origin: "SQLEditor",
|
|
44936
45968
|
loadDescription: "Loading SQL response"
|
|
44937
45969
|
});
|
|
44938
|
-
const [sqlQueryLoading, setSqlQueryLoading] =
|
|
45970
|
+
const [sqlQueryLoading, setSqlQueryLoading] = useState30(false);
|
|
44939
45971
|
useLongLoading(sqlQueryLoading, {
|
|
44940
45972
|
origin: "SQLEditor",
|
|
44941
45973
|
loadDescription: "Loading SQL query"
|
|
44942
45974
|
});
|
|
44943
|
-
const [isChartBuilderOpen, setIsChartBuilderOpen] =
|
|
44944
|
-
const [displayTable, setDisplayTable] =
|
|
44945
|
-
const [formattedRows, setFormattedRows] =
|
|
45975
|
+
const [isChartBuilderOpen, setIsChartBuilderOpen] = useState30(false);
|
|
45976
|
+
const [displayTable, setDisplayTable] = useState30(false);
|
|
45977
|
+
const [formattedRows, setFormattedRows] = useState30([]);
|
|
44946
45978
|
const formRef = useRef18(null);
|
|
44947
45979
|
const sidebarRef = useRef18(null);
|
|
44948
|
-
const [searchBarWidth, setSearchBarWidth] =
|
|
44949
|
-
const [showSearchBar, setShowSearchBar] =
|
|
44950
|
-
const [filterBarWidth, setFilterBarWidth] =
|
|
44951
|
-
const [rowCount, setRowCount] =
|
|
44952
|
-
const [rowCountIsLoading, setRowCountIsLoading] =
|
|
44953
|
-
const [maxPage, setMaxPage] =
|
|
44954
|
-
const [tableSearchQuery, setTableSearchQuery] =
|
|
44955
|
-
const [lastSuccessfulQuery, setLastSuccessfulQuery] =
|
|
44956
|
-
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] =
|
|
44957
|
-
const [tempReport, setTempReport] =
|
|
45980
|
+
const [searchBarWidth, setSearchBarWidth] = useState30(200);
|
|
45981
|
+
const [showSearchBar, setShowSearchBar] = useState30(false);
|
|
45982
|
+
const [filterBarWidth, setFilterBarWidth] = useState30(200);
|
|
45983
|
+
const [rowCount, setRowCount] = useState30(void 0);
|
|
45984
|
+
const [rowCountIsLoading, setRowCountIsLoading] = useState30(false);
|
|
45985
|
+
const [maxPage, setMaxPage] = useState30(1);
|
|
45986
|
+
const [tableSearchQuery, setTableSearchQuery] = useState30("");
|
|
45987
|
+
const [lastSuccessfulQuery, setLastSuccessfulQuery] = useState30("");
|
|
45988
|
+
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState30(false);
|
|
45989
|
+
const [tempReport, setTempReport] = useState30({
|
|
44958
45990
|
...EMPTY_INTERNAL_REPORT,
|
|
44959
45991
|
...report
|
|
44960
45992
|
});
|
|
44961
45993
|
const tableRef = useRef18(null);
|
|
44962
|
-
const [cachedHeight, setCachedHeight] =
|
|
45994
|
+
const [cachedHeight, setCachedHeight] = useState30(0);
|
|
44963
45995
|
const DEFAULT_ROWS_PER_PAGE = 5;
|
|
44964
45996
|
const ROW_HEIGHT = 37;
|
|
44965
45997
|
const TABLE_TAB_HEIGHT = 75;
|
|
@@ -44996,8 +46028,8 @@ function SQLEditor({
|
|
|
44996
46028
|
rowsPerPage * 10
|
|
44997
46029
|
)
|
|
44998
46030
|
};
|
|
44999
|
-
const [currentPage, setCurrentPage] =
|
|
45000
|
-
const [currentSort, setCurrentSort] =
|
|
46031
|
+
const [currentPage, setCurrentPage] = useState30(0);
|
|
46032
|
+
const [currentSort, setCurrentSort] = useState30(void 0);
|
|
45001
46033
|
const currentProcessing = useMemo22(() => {
|
|
45002
46034
|
return {
|
|
45003
46035
|
page: {
|
|
@@ -45045,7 +46077,7 @@ function SQLEditor({
|
|
|
45045
46077
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
45046
46078
|
}
|
|
45047
46079
|
}, [isChartBuilderOpen]);
|
|
45048
|
-
const handleRunSqlPrompt =
|
|
46080
|
+
const handleRunSqlPrompt = useCallback3(async () => {
|
|
45049
46081
|
if (!client || sqlResponseLoading) {
|
|
45050
46082
|
return;
|
|
45051
46083
|
}
|
|
@@ -45063,7 +46095,7 @@ function SQLEditor({
|
|
|
45063
46095
|
setQuery(resp.message);
|
|
45064
46096
|
setSqlResponseLoading(false);
|
|
45065
46097
|
}, [sqlPrompt, sqlResponseLoading]);
|
|
45066
|
-
const debounceRunSqlPrompt =
|
|
46098
|
+
const debounceRunSqlPrompt = useCallback3(
|
|
45067
46099
|
createDebounce(handleRunSqlPrompt, 500),
|
|
45068
46100
|
[handleRunSqlPrompt]
|
|
45069
46101
|
);
|
|
@@ -45901,7 +46933,7 @@ var SQLEditorComponent = ({
|
|
|
45901
46933
|
loading,
|
|
45902
46934
|
LoadingComponent = QuillLoadingComponent
|
|
45903
46935
|
}) => {
|
|
45904
|
-
const [editorKey, setEditorKey] =
|
|
46936
|
+
const [editorKey, setEditorKey] = useState30(0);
|
|
45905
46937
|
const { eventTracking } = useContext28(EventTrackingContext);
|
|
45906
46938
|
const currentProvider = useRef18(null);
|
|
45907
46939
|
useEffect24(() => {
|
|
@@ -46145,7 +47177,7 @@ function SchemaItem({
|
|
|
46145
47177
|
index,
|
|
46146
47178
|
onClick
|
|
46147
47179
|
}) {
|
|
46148
|
-
const [isOpen, setIsOpen] =
|
|
47180
|
+
const [isOpen, setIsOpen] = useState30(index === 0);
|
|
46149
47181
|
const schemaContainerStyle = {
|
|
46150
47182
|
display: "flex",
|
|
46151
47183
|
flexDirection: "column"
|
|
@@ -46376,11 +47408,11 @@ import {
|
|
|
46376
47408
|
useContext as useContext32,
|
|
46377
47409
|
useEffect as useEffect28,
|
|
46378
47410
|
useRef as useRef20,
|
|
46379
|
-
useState as
|
|
47411
|
+
useState as useState36
|
|
46380
47412
|
} from "react";
|
|
46381
47413
|
|
|
46382
47414
|
// src/hooks/useReportBuilder.tsx
|
|
46383
|
-
import { useContext as useContext29, useEffect as useEffect25, useMemo as useMemo23, useState as
|
|
47415
|
+
import { useContext as useContext29, useEffect as useEffect25, useMemo as useMemo23, useState as useState31 } from "react";
|
|
46384
47416
|
var useReportBuilderInternal = ({
|
|
46385
47417
|
reportId,
|
|
46386
47418
|
initialTableName,
|
|
@@ -46422,18 +47454,18 @@ var useReportBuilderInternal = ({
|
|
|
46422
47454
|
rowsPerPage: _rowsPerPage,
|
|
46423
47455
|
rowsPerRequest: _rowsPerRequest
|
|
46424
47456
|
};
|
|
46425
|
-
const [openPopover, setOpenPopover] =
|
|
46426
|
-
const [aiPrompt, setAiPrompt] =
|
|
46427
|
-
const [reportBuilderLoading, setReportBuilderLoading] =
|
|
46428
|
-
const [tableLoading, setTableLoading] =
|
|
46429
|
-
const [errorMessage, setErrorMessage] =
|
|
46430
|
-
const [unresolvedReportMessage, setUnresolvedReportMessage] =
|
|
46431
|
-
const [tables, setTables] =
|
|
46432
|
-
const [columns, setColumns] =
|
|
46433
|
-
const [filterStack, setFilterStack] =
|
|
46434
|
-
const [pivot, setPivot] =
|
|
46435
|
-
const [sort, setSort] =
|
|
46436
|
-
const [limit, setLimit] =
|
|
47457
|
+
const [openPopover, setOpenPopover] = useState31(null);
|
|
47458
|
+
const [aiPrompt, setAiPrompt] = useState31("");
|
|
47459
|
+
const [reportBuilderLoading, setReportBuilderLoading] = useState31(false);
|
|
47460
|
+
const [tableLoading, setTableLoading] = useState31(false);
|
|
47461
|
+
const [errorMessage, setErrorMessage] = useState31("");
|
|
47462
|
+
const [unresolvedReportMessage, setUnresolvedReportMessage] = useState31("");
|
|
47463
|
+
const [tables, setTables] = useState31([]);
|
|
47464
|
+
const [columns, setColumns] = useState31([]);
|
|
47465
|
+
const [filterStack, setFilterStack] = useState31([]);
|
|
47466
|
+
const [pivot, setPivot] = useState31(null);
|
|
47467
|
+
const [sort, setSort] = useState31([]);
|
|
47468
|
+
const [limit, setLimit] = useState31(null);
|
|
46437
47469
|
const reportBuilderState = useMemo23(() => {
|
|
46438
47470
|
return {
|
|
46439
47471
|
tables,
|
|
@@ -46444,30 +47476,30 @@ var useReportBuilderInternal = ({
|
|
|
46444
47476
|
limit
|
|
46445
47477
|
};
|
|
46446
47478
|
}, [columns, filterStack, limit, pivot, sort, tables]);
|
|
46447
|
-
const [stateStack, setStateStack] =
|
|
46448
|
-
const [poppedStateStack, setPoppedStateStack] =
|
|
46449
|
-
const [activeQuery, setActiveQuery] =
|
|
46450
|
-
const [queryOutOfSync, setQueryOutOfSync] =
|
|
46451
|
-
const [unfilteredUniqueValues, setUnfilteredUniqueValues] =
|
|
46452
|
-
const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] =
|
|
46453
|
-
const [filteredUniqueValues, setFilteredUniqueValues] =
|
|
46454
|
-
const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] =
|
|
46455
|
-
const [columnUniqueValues, setColumnUniqueValues] =
|
|
46456
|
-
const [dateRanges, setDateRanges] =
|
|
46457
|
-
const [tempReport, setTempReport] =
|
|
47479
|
+
const [stateStack, setStateStack] = useState31([]);
|
|
47480
|
+
const [poppedStateStack, setPoppedStateStack] = useState31([]);
|
|
47481
|
+
const [activeQuery, setActiveQuery] = useState31("");
|
|
47482
|
+
const [queryOutOfSync, setQueryOutOfSync] = useState31(false);
|
|
47483
|
+
const [unfilteredUniqueValues, setUnfilteredUniqueValues] = useState31({});
|
|
47484
|
+
const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = useState31(false);
|
|
47485
|
+
const [filteredUniqueValues, setFilteredUniqueValues] = useState31(null);
|
|
47486
|
+
const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = useState31(false);
|
|
47487
|
+
const [columnUniqueValues, setColumnUniqueValues] = useState31({});
|
|
47488
|
+
const [dateRanges, setDateRanges] = useState31(null);
|
|
47489
|
+
const [tempReport, setTempReport] = useState31({
|
|
46458
47490
|
...EMPTY_INTERNAL_REPORT,
|
|
46459
47491
|
pagination: REPORT_BUILDER_PAGINATION
|
|
46460
47492
|
});
|
|
46461
|
-
const [currentProcessing, setCurrentProcessing] =
|
|
47493
|
+
const [currentProcessing, setCurrentProcessing] = useState31({
|
|
46462
47494
|
page: REPORT_BUILDER_PAGINATION
|
|
46463
47495
|
});
|
|
46464
|
-
const [previousPage, setPreviousPage] =
|
|
46465
|
-
const [reportColumns, setReportColumns] =
|
|
46466
|
-
const [reportRows, setReportRows] =
|
|
46467
|
-
const [formattedRows, setFormattedRows] =
|
|
46468
|
-
const [pivotData, setPivotData] =
|
|
46469
|
-
const [numberOfRows, setNumberOfRows] =
|
|
46470
|
-
const [rowCountIsLoading, setRowCountIsLoading] =
|
|
47496
|
+
const [previousPage, setPreviousPage] = useState31(0);
|
|
47497
|
+
const [reportColumns, setReportColumns] = useState31([]);
|
|
47498
|
+
const [reportRows, setReportRows] = useState31([]);
|
|
47499
|
+
const [formattedRows, setFormattedRows] = useState31([]);
|
|
47500
|
+
const [pivotData, setPivotData] = useState31(null);
|
|
47501
|
+
const [numberOfRows, setNumberOfRows] = useState31(0);
|
|
47502
|
+
const [rowCountIsLoading, setRowCountIsLoading] = useState31(false);
|
|
46471
47503
|
const reportColumnsToStateColumns = useMemo23(() => {
|
|
46472
47504
|
const positionMap = {};
|
|
46473
47505
|
columns.forEach((column, index) => {
|
|
@@ -46486,28 +47518,28 @@ var useReportBuilderInternal = ({
|
|
|
46486
47518
|
}
|
|
46487
47519
|
});
|
|
46488
47520
|
}, [columns, reportColumns]);
|
|
46489
|
-
const [pivotRowField, setPivotRowField] =
|
|
47521
|
+
const [pivotRowField, setPivotRowField] = useState31(
|
|
46490
47522
|
void 0
|
|
46491
47523
|
);
|
|
46492
|
-
const [pivotColumnField, setPivotColumnField] =
|
|
47524
|
+
const [pivotColumnField, setPivotColumnField] = useState31(
|
|
46493
47525
|
void 0
|
|
46494
47526
|
);
|
|
46495
|
-
const [pivotAggregations, setPivotAggregations] =
|
|
46496
|
-
const [pivotLimit, setPivotLimit] =
|
|
46497
|
-
const [pivotSort, setPivotSort] =
|
|
46498
|
-
const [pivotHint, setPivotHint] =
|
|
46499
|
-
const [pivotError, setPivotError] =
|
|
46500
|
-
const [createdPivots, setCreatedPivots] =
|
|
46501
|
-
const [recommendedPivots, setRecommendedPivots] =
|
|
46502
|
-
const [pivotPopUpTitle, setPivotPopUpTitle] =
|
|
46503
|
-
const [showPivotPopover, setShowPivotPopover] =
|
|
46504
|
-
const [isEditingPivot, setIsEditingPivot] =
|
|
46505
|
-
const [selectedPivotIndex, setSelectedPivotIndex] =
|
|
47527
|
+
const [pivotAggregations, setPivotAggregations] = useState31([]);
|
|
47528
|
+
const [pivotLimit, setPivotLimit] = useState31(void 0);
|
|
47529
|
+
const [pivotSort, setPivotSort] = useState31(void 0);
|
|
47530
|
+
const [pivotHint, setPivotHint] = useState31("");
|
|
47531
|
+
const [pivotError, setPivotError] = useState31("");
|
|
47532
|
+
const [createdPivots, setCreatedPivots] = useState31([]);
|
|
47533
|
+
const [recommendedPivots, setRecommendedPivots] = useState31([]);
|
|
47534
|
+
const [pivotPopUpTitle, setPivotPopUpTitle] = useState31("Add pivot");
|
|
47535
|
+
const [showPivotPopover, setShowPivotPopover] = useState31(false);
|
|
47536
|
+
const [isEditingPivot, setIsEditingPivot] = useState31(false);
|
|
47537
|
+
const [selectedPivotIndex, setSelectedPivotIndex] = useState31(-1);
|
|
46506
47538
|
const [
|
|
46507
47539
|
pivotRecommendationsEnabledState,
|
|
46508
47540
|
setPivotRecommendationsEnabledState
|
|
46509
|
-
] =
|
|
46510
|
-
const [askAILoading, setAskAILoading] =
|
|
47541
|
+
] = useState31(pivotRecommendationsEnabled);
|
|
47542
|
+
const [askAILoading, setAskAILoading] = useState31(false);
|
|
46511
47543
|
const loading = reportBuilderLoading || tableLoading;
|
|
46512
47544
|
useLongLoading(reportBuilderLoading, {
|
|
46513
47545
|
origin: "ReportBuilder",
|
|
@@ -47890,7 +48922,7 @@ var useReportBuilder = ({
|
|
|
47890
48922
|
};
|
|
47891
48923
|
|
|
47892
48924
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
47893
|
-
import { useState as
|
|
48925
|
+
import { useState as useState32, useRef as useRef19, useMemo as useMemo24, useEffect as useEffect26, useContext as useContext30 } from "react";
|
|
47894
48926
|
import {
|
|
47895
48927
|
DndContext,
|
|
47896
48928
|
closestCenter,
|
|
@@ -47923,14 +48955,14 @@ function AddColumnModal({
|
|
|
47923
48955
|
LoadingComponent = QuillLoadingComponent,
|
|
47924
48956
|
onRequestAddVirtualTable
|
|
47925
48957
|
}) {
|
|
47926
|
-
const [primaryTable, setPrimaryTable] =
|
|
48958
|
+
const [primaryTable, setPrimaryTable] = useState32(
|
|
47927
48959
|
selectedTables[0]?.name
|
|
47928
48960
|
);
|
|
47929
48961
|
const [theme] = useContext30(ThemeContext);
|
|
47930
|
-
const [search, setSearch] =
|
|
47931
|
-
const [initialLoad, setInitialLoad] =
|
|
48962
|
+
const [search, setSearch] = useState32("");
|
|
48963
|
+
const [initialLoad, setInitialLoad] = useState32(true);
|
|
47932
48964
|
const textInputContainerRef = useRef19(null);
|
|
47933
|
-
const [modalSelectedColumns, setModalSelectedColumns] =
|
|
48965
|
+
const [modalSelectedColumns, setModalSelectedColumns] = useState32(
|
|
47934
48966
|
selectedColumns.map((col) => `${col.table}.${col.field}`)
|
|
47935
48967
|
);
|
|
47936
48968
|
const columnOptions = useMemo24(() => {
|
|
@@ -47957,7 +48989,7 @@ function AddColumnModal({
|
|
|
47957
48989
|
})
|
|
47958
48990
|
);
|
|
47959
48991
|
}, [schema, primaryTable]);
|
|
47960
|
-
const [orderedColumnNames, setOrderedColumnNames] =
|
|
48992
|
+
const [orderedColumnNames, setOrderedColumnNames] = useState32([]);
|
|
47961
48993
|
const isSelectedAllColumns = columnOptions.length === modalSelectedColumns.length;
|
|
47962
48994
|
const searchResults = useMemo24(() => {
|
|
47963
48995
|
return orderedColumnNames.filter((column) => {
|
|
@@ -48849,7 +49881,7 @@ var AddFilters = ({
|
|
|
48849
49881
|
};
|
|
48850
49882
|
|
|
48851
49883
|
// src/internals/ReportBuilder/PivotForm.tsx
|
|
48852
|
-
import { useContext as useContext31, useEffect as useEffect27, useState as
|
|
49884
|
+
import { useContext as useContext31, useEffect as useEffect27, useState as useState33 } from "react";
|
|
48853
49885
|
import { jsx as jsx73, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
48854
49886
|
function PivotForm({
|
|
48855
49887
|
pivotRowField,
|
|
@@ -48876,21 +49908,21 @@ function PivotForm({
|
|
|
48876
49908
|
isLoading,
|
|
48877
49909
|
pivotHint
|
|
48878
49910
|
}) {
|
|
48879
|
-
const [allowedColumnFields, setAllowedColumnFields] =
|
|
48880
|
-
const [allowedRowFields, setAllowedRowFields] =
|
|
48881
|
-
const [allowedValueFields, setAllowedValueFields] =
|
|
49911
|
+
const [allowedColumnFields, setAllowedColumnFields] = useState33([]);
|
|
49912
|
+
const [allowedRowFields, setAllowedRowFields] = useState33([]);
|
|
49913
|
+
const [allowedValueFields, setAllowedValueFields] = useState33([]);
|
|
48882
49914
|
const [theme] = useContext31(ThemeContext);
|
|
48883
|
-
const [limitInput, setLimitInput] =
|
|
49915
|
+
const [limitInput, setLimitInput] = useState33(
|
|
48884
49916
|
pivotLimit?.toString() ?? ""
|
|
48885
49917
|
);
|
|
48886
|
-
const [sortFieldInput, setSortFieldInput] =
|
|
49918
|
+
const [sortFieldInput, setSortFieldInput] = useState33(
|
|
48887
49919
|
pivotSort?.sortField ?? ""
|
|
48888
49920
|
);
|
|
48889
|
-
const [sortDirectionInput, setSortDirectionInput] =
|
|
49921
|
+
const [sortDirectionInput, setSortDirectionInput] = useState33(
|
|
48890
49922
|
pivotSort?.sortDirection ?? ""
|
|
48891
49923
|
);
|
|
48892
|
-
const [showLimitInput, setShowLimitInput] =
|
|
48893
|
-
const [showSortInput, setShowSortInput] =
|
|
49924
|
+
const [showLimitInput, setShowLimitInput] = useState33(!!pivotLimit);
|
|
49925
|
+
const [showSortInput, setShowSortInput] = useState33(!!pivotSort);
|
|
48894
49926
|
useEffect27(() => {
|
|
48895
49927
|
if (uniqueValues) {
|
|
48896
49928
|
const possibleColumns = getPossiblePivotFieldOptions(
|
|
@@ -49519,7 +50551,7 @@ var AddPivot = ({
|
|
|
49519
50551
|
};
|
|
49520
50552
|
|
|
49521
50553
|
// src/components/ReportBuilder/AddLimitPopover.tsx
|
|
49522
|
-
import { useState as
|
|
50554
|
+
import { useState as useState34 } from "react";
|
|
49523
50555
|
import { Fragment as Fragment14, jsx as jsx75, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
49524
50556
|
var LimitSentence = ({
|
|
49525
50557
|
limit,
|
|
@@ -49534,7 +50566,7 @@ var LimitSentence = ({
|
|
|
49534
50566
|
SecondaryButton = MemoizedSecondaryButton,
|
|
49535
50567
|
disabled = false
|
|
49536
50568
|
}) => {
|
|
49537
|
-
const [isOpen, setIsOpen] =
|
|
50569
|
+
const [isOpen, setIsOpen] = useState34(false);
|
|
49538
50570
|
const handleClickDelete = () => {
|
|
49539
50571
|
setOpenPopover(null);
|
|
49540
50572
|
handleDelete();
|
|
@@ -49576,7 +50608,7 @@ var AddLimitPopover = ({
|
|
|
49576
50608
|
Button = MemoizedButton,
|
|
49577
50609
|
SecondaryButton = MemoizedSecondaryButton
|
|
49578
50610
|
}) => {
|
|
49579
|
-
const [limit, setLimit] =
|
|
50611
|
+
const [limit, setLimit] = useState34(initialLimit.toString());
|
|
49580
50612
|
const MAX_LIMIT = 2147483647;
|
|
49581
50613
|
return /* @__PURE__ */ jsxs55("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
49582
50614
|
/* @__PURE__ */ jsx75(
|
|
@@ -49817,7 +50849,7 @@ var AddLimit = ({
|
|
|
49817
50849
|
};
|
|
49818
50850
|
|
|
49819
50851
|
// src/components/ReportBuilder/AddSortPopover.tsx
|
|
49820
|
-
import { useState as
|
|
50852
|
+
import { useState as useState35 } from "react";
|
|
49821
50853
|
import { Fragment as Fragment15, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
49822
50854
|
var SORT_VALUE_TO_LABEL = {
|
|
49823
50855
|
ASC: "ascending",
|
|
@@ -49840,7 +50872,7 @@ var SortSentence = ({
|
|
|
49840
50872
|
SecondaryButton = MemoizedSecondaryButton,
|
|
49841
50873
|
disabled = false
|
|
49842
50874
|
}) => {
|
|
49843
|
-
const [isOpen, setIsOpen] =
|
|
50875
|
+
const [isOpen, setIsOpen] = useState35(false);
|
|
49844
50876
|
const handleSetIsOpen = (isOpen2) => {
|
|
49845
50877
|
setIsOpen(isOpen2);
|
|
49846
50878
|
};
|
|
@@ -49892,8 +50924,8 @@ var AddSortPopover = ({
|
|
|
49892
50924
|
Button = MemoizedButton,
|
|
49893
50925
|
SecondaryButton = MemoizedSecondaryButton
|
|
49894
50926
|
}) => {
|
|
49895
|
-
const [sortColumn, setSortColumn] =
|
|
49896
|
-
const [sortDirection, setSortDirection] =
|
|
50927
|
+
const [sortColumn, setSortColumn] = useState35(column || "");
|
|
50928
|
+
const [sortDirection, setSortDirection] = useState35(
|
|
49897
50929
|
direction || "ASC"
|
|
49898
50930
|
);
|
|
49899
50931
|
return /* @__PURE__ */ jsxs57("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
@@ -50197,7 +51229,8 @@ var SaveReport = ({
|
|
|
50197
51229
|
reportBuilder,
|
|
50198
51230
|
setIsOpen
|
|
50199
51231
|
}
|
|
50200
|
-
)
|
|
51232
|
+
),
|
|
51233
|
+
submitButtonLabel
|
|
50201
51234
|
}) => {
|
|
50202
51235
|
return /* @__PURE__ */ jsxs59("div", { children: [
|
|
50203
51236
|
SaveTrigger,
|
|
@@ -50240,7 +51273,7 @@ var SaveReport = ({
|
|
|
50240
51273
|
FormContainer: ChartBuilderFormContainer,
|
|
50241
51274
|
hideDateRangeFilter: true,
|
|
50242
51275
|
hideDeleteButton: true,
|
|
50243
|
-
buttonLabel: !!reportBuilder.reportId ? "Save changes" : "Add to dashboard",
|
|
51276
|
+
buttonLabel: submitButtonLabel ?? (!!reportBuilder.reportId ? "Save changes" : "Add to dashboard"),
|
|
50244
51277
|
onClickChartElement,
|
|
50245
51278
|
isEditingMode: true
|
|
50246
51279
|
}
|
|
@@ -50339,15 +51372,16 @@ function ReportBuilder({
|
|
|
50339
51372
|
hideCopySQL = true,
|
|
50340
51373
|
isChartBuilderHorizontalView = true,
|
|
50341
51374
|
onClickChartElement,
|
|
50342
|
-
onRequestAddVirtualTable
|
|
51375
|
+
onRequestAddVirtualTable,
|
|
51376
|
+
submitButtonLabel
|
|
50343
51377
|
}) {
|
|
50344
51378
|
const [theme] = useContext32(ThemeContext);
|
|
50345
51379
|
const parentRef = useRef20(null);
|
|
50346
51380
|
const askAIContainerRef = useRef20(null);
|
|
50347
|
-
const [askAIInputWidth, setAskAIInputWidth] =
|
|
50348
|
-
const [isCopying, setIsCopying] =
|
|
50349
|
-
const [isChartBuilderOpen, setIsChartBuilderOpen] =
|
|
50350
|
-
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] =
|
|
51381
|
+
const [askAIInputWidth, setAskAIInputWidth] = useState36(-1);
|
|
51382
|
+
const [isCopying, setIsCopying] = useState36(false);
|
|
51383
|
+
const [isChartBuilderOpen, setIsChartBuilderOpen] = useState36(false);
|
|
51384
|
+
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState36(false);
|
|
50351
51385
|
const reportBuilder = useReportBuilderInternal({
|
|
50352
51386
|
reportId,
|
|
50353
51387
|
initialTableName,
|
|
@@ -50727,7 +51761,7 @@ function ReportBuilder({
|
|
|
50727
51761
|
setIsChartBuilderOpen(true);
|
|
50728
51762
|
},
|
|
50729
51763
|
disabled: !!errorMessage || !!pivotError || tableLoading || loading || !!unresolvedReportMessage,
|
|
50730
|
-
label: reportId ? "Save changes" : "Add to dashboard",
|
|
51764
|
+
label: submitButtonLabel ?? (reportId ? "Save changes" : "Add to dashboard"),
|
|
50731
51765
|
tooltipText: unresolvedReportMessage
|
|
50732
51766
|
}
|
|
50733
51767
|
)
|
|
@@ -50773,7 +51807,8 @@ function ReportBuilder({
|
|
|
50773
51807
|
ErrorMessageComponent,
|
|
50774
51808
|
PivotRowContainer,
|
|
50775
51809
|
PivotColumnContainer,
|
|
50776
|
-
onClickChartElement
|
|
51810
|
+
onClickChartElement,
|
|
51811
|
+
submitButtonLabel
|
|
50777
51812
|
}
|
|
50778
51813
|
),
|
|
50779
51814
|
isSaveQueryModalOpen && /* @__PURE__ */ jsx81(
|
|
@@ -50835,7 +51870,7 @@ import {
|
|
|
50835
51870
|
useEffect as useEffect29,
|
|
50836
51871
|
useMemo as useMemo26,
|
|
50837
51872
|
useRef as useRef21,
|
|
50838
|
-
useState as
|
|
51873
|
+
useState as useState37
|
|
50839
51874
|
} from "react";
|
|
50840
51875
|
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
50841
51876
|
function ChartEditor({
|
|
@@ -50878,8 +51913,8 @@ function ChartEditor({
|
|
|
50878
51913
|
onClickChartError
|
|
50879
51914
|
}) {
|
|
50880
51915
|
const parentRef = useRef21(null);
|
|
50881
|
-
const [modalWidth, setModalWidth] =
|
|
50882
|
-
const [modalHeight, setModalHeight] =
|
|
51916
|
+
const [modalWidth, setModalWidth] = useState37(200);
|
|
51917
|
+
const [modalHeight, setModalHeight] = useState37(200);
|
|
50883
51918
|
const { addReport } = useDashboardReports(destinationDashboard);
|
|
50884
51919
|
const { allReportsById } = useAllReports();
|
|
50885
51920
|
const { tenants, flags } = useContext33(TenantContext);
|
|
@@ -50897,8 +51932,8 @@ function ChartEditor({
|
|
|
50897
51932
|
(f) => f.filter
|
|
50898
51933
|
);
|
|
50899
51934
|
}, [dashboardFilters]);
|
|
50900
|
-
const [filtersEnabled, setFiltersEnabled] =
|
|
50901
|
-
const [chartBuilderKey, setChartBuilderKey] =
|
|
51935
|
+
const [filtersEnabled, setFiltersEnabled] = useState37(true);
|
|
51936
|
+
const [chartBuilderKey, setChartBuilderKey] = useState37(0);
|
|
50902
51937
|
const dateFilter = Object.values(specificDashboardFilters).find(
|
|
50903
51938
|
(filter) => filter.filterType === "date_range"
|
|
50904
51939
|
);
|
|
@@ -51035,11 +52070,32 @@ function StaticChart({
|
|
|
51035
52070
|
containerStyle,
|
|
51036
52071
|
showLegend = false
|
|
51037
52072
|
}) {
|
|
51038
|
-
const {
|
|
52073
|
+
const {
|
|
52074
|
+
report,
|
|
52075
|
+
loading,
|
|
52076
|
+
pageNumber,
|
|
52077
|
+
pageLoading,
|
|
52078
|
+
nextPage,
|
|
52079
|
+
prevPage,
|
|
52080
|
+
sortRows
|
|
52081
|
+
} = useDashboardReportInternal(reportId);
|
|
51039
52082
|
const mergedStyle = {
|
|
51040
52083
|
...report?.chartType ? CHART_TYPE_STYLES[report.chartType] || DEFAULT_STYLE : DEFAULT_STYLE,
|
|
51041
52084
|
...containerStyle
|
|
51042
52085
|
};
|
|
52086
|
+
const onPageChange = (page) => {
|
|
52087
|
+
if (page == pageNumber - 1) {
|
|
52088
|
+
prevPage();
|
|
52089
|
+
} else if (page == pageNumber + 1) {
|
|
52090
|
+
nextPage();
|
|
52091
|
+
}
|
|
52092
|
+
};
|
|
52093
|
+
const onSortChange = (sort) => {
|
|
52094
|
+
sortRows({
|
|
52095
|
+
field: sort.field,
|
|
52096
|
+
direction: sort.direction
|
|
52097
|
+
});
|
|
52098
|
+
};
|
|
51043
52099
|
return /* @__PURE__ */ jsx83(
|
|
51044
52100
|
ChartDisplay,
|
|
51045
52101
|
{
|
|
@@ -51051,35 +52107,76 @@ function StaticChart({
|
|
|
51051
52107
|
onClickChartElement,
|
|
51052
52108
|
loading,
|
|
51053
52109
|
containerStyle: mergedStyle,
|
|
51054
|
-
showLegend
|
|
52110
|
+
showLegend,
|
|
52111
|
+
onPageChange,
|
|
52112
|
+
tableRowsLoading: pageLoading,
|
|
52113
|
+
onSortChange
|
|
51055
52114
|
}
|
|
51056
52115
|
);
|
|
51057
52116
|
}
|
|
51058
52117
|
|
|
52118
|
+
// src/hooks/useTenants.ts
|
|
52119
|
+
import { useContext as useContext34, useEffect as useEffect30 } from "react";
|
|
52120
|
+
var useTenants = (dashboardName) => {
|
|
52121
|
+
const {
|
|
52122
|
+
tenants,
|
|
52123
|
+
flags,
|
|
52124
|
+
childTenantMappings,
|
|
52125
|
+
viewerTenants,
|
|
52126
|
+
isLoadingMappedTenants,
|
|
52127
|
+
isLoadingViewerTenants,
|
|
52128
|
+
fetchViewerTenantsForDashboard,
|
|
52129
|
+
fetchMappedTenantsForDashboard,
|
|
52130
|
+
getMappedTenantsForDashboard,
|
|
52131
|
+
getViewerTenantsByOwner
|
|
52132
|
+
} = useContext34(TenantContext);
|
|
52133
|
+
useEffect30(() => {
|
|
52134
|
+
if (dashboardName) {
|
|
52135
|
+
fetchViewerTenantsForDashboard(dashboardName);
|
|
52136
|
+
}
|
|
52137
|
+
}, [dashboardName, fetchViewerTenantsForDashboard]);
|
|
52138
|
+
useEffect30(() => {
|
|
52139
|
+
if (dashboardName) {
|
|
52140
|
+
fetchMappedTenantsForDashboard(dashboardName);
|
|
52141
|
+
}
|
|
52142
|
+
}, [dashboardName, fetchMappedTenantsForDashboard]);
|
|
52143
|
+
return {
|
|
52144
|
+
tenants,
|
|
52145
|
+
flags,
|
|
52146
|
+
childTenantMappings: dashboardName ? childTenantMappings[dashboardName] || {} : {},
|
|
52147
|
+
mappedTenants: dashboardName ? childTenantMappings[dashboardName] || {} : {},
|
|
52148
|
+
viewerTenants: dashboardName ? viewerTenants[dashboardName] || [] : [],
|
|
52149
|
+
isLoadingMappedTenants,
|
|
52150
|
+
isLoadingViewerTenants,
|
|
52151
|
+
getMappedTenantsForDashboard,
|
|
52152
|
+
getViewerTenantsByOwner
|
|
52153
|
+
};
|
|
52154
|
+
};
|
|
52155
|
+
|
|
51059
52156
|
// src/hooks/useQuill.ts
|
|
51060
|
-
import { useContext as
|
|
52157
|
+
import { useContext as useContext35, useEffect as useEffect31, useMemo as useMemo27, useState as useState38 } from "react";
|
|
51061
52158
|
var useQuill = (reportId, pagination) => {
|
|
51062
|
-
const { reports, reportsDispatch, fetchIndividualReport } =
|
|
52159
|
+
const { reports, reportsDispatch, fetchIndividualReport } = useContext35(ReportsContext);
|
|
51063
52160
|
const { allReportsById } = useAllReports();
|
|
51064
|
-
const { getToken } =
|
|
52161
|
+
const { getToken } = useContext35(FetchContext);
|
|
51065
52162
|
const dashboardReport = useMemo27(() => {
|
|
51066
52163
|
return allReportsById[reportId ?? ""];
|
|
51067
52164
|
}, [allReportsById[reportId ?? ""]]);
|
|
51068
|
-
const { dashboardFilters, dashboardCustomFilters } =
|
|
52165
|
+
const { dashboardFilters, dashboardCustomFilters } = useContext35(
|
|
51069
52166
|
DashboardFiltersContext
|
|
51070
52167
|
);
|
|
51071
|
-
const { reportFilters, customReportFilters, reportFiltersDispatch } =
|
|
52168
|
+
const { reportFilters, customReportFilters, reportFiltersDispatch } = useContext35(ReportFiltersContext);
|
|
51072
52169
|
const specificReportFilters = useMemo27(() => {
|
|
51073
52170
|
if (!reportId) return null;
|
|
51074
52171
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
51075
52172
|
}, [reportFilters, reportId]);
|
|
51076
|
-
const [schemaData] =
|
|
51077
|
-
const [client, isClientLoading] =
|
|
51078
|
-
const { tenants } =
|
|
51079
|
-
const { eventTracking } =
|
|
51080
|
-
const [loading, setLoading] =
|
|
51081
|
-
const [error, setError] =
|
|
51082
|
-
const [previousPage, setPreviousPage] =
|
|
52173
|
+
const [schemaData] = useContext35(SchemaDataContext);
|
|
52174
|
+
const [client, isClientLoading] = useContext35(ClientContext);
|
|
52175
|
+
const { tenants } = useContext35(TenantContext);
|
|
52176
|
+
const { eventTracking } = useContext35(EventTrackingContext);
|
|
52177
|
+
const [loading, setLoading] = useState38(true);
|
|
52178
|
+
const [error, setError] = useState38(void 0);
|
|
52179
|
+
const [previousPage, setPreviousPage] = useState38(0);
|
|
51083
52180
|
const processedReport = useMemo27(() => {
|
|
51084
52181
|
return reportId && allReportsById[reportId] ? convertInternalReportToReport(
|
|
51085
52182
|
mergeComparisonRange(allReportsById[reportId]),
|
|
@@ -51088,7 +52185,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
51088
52185
|
"useQuill"
|
|
51089
52186
|
) : void 0;
|
|
51090
52187
|
}, [reportId, reportId && allReportsById[reportId], specificReportFilters]);
|
|
51091
|
-
const [additionalProcessing, setAdditionProcessing] =
|
|
52188
|
+
const [additionalProcessing, setAdditionProcessing] = useState38(
|
|
51092
52189
|
pagination ? {
|
|
51093
52190
|
page: pagination
|
|
51094
52191
|
} : void 0
|
|
@@ -51237,7 +52334,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
51237
52334
|
setLoading(false);
|
|
51238
52335
|
}
|
|
51239
52336
|
};
|
|
51240
|
-
|
|
52337
|
+
useEffect31(() => {
|
|
51241
52338
|
if (isClientLoading) return;
|
|
51242
52339
|
if (reportId && specificReportFilters) {
|
|
51243
52340
|
fetchReportHelper(reportId, {
|
|
@@ -51303,7 +52400,7 @@ var useMemoizedRows = (reportId) => {
|
|
|
51303
52400
|
};
|
|
51304
52401
|
|
|
51305
52402
|
// src/hooks/useAskQuill.tsx
|
|
51306
|
-
import { useContext as
|
|
52403
|
+
import { useContext as useContext36, useEffect as useEffect32, useState as useState39 } from "react";
|
|
51307
52404
|
function convertColumnInternalToAskQuillColumn(columns) {
|
|
51308
52405
|
return columns.map((column) => {
|
|
51309
52406
|
let convertedFieldType = FieldType.String;
|
|
@@ -51327,13 +52424,13 @@ function convertColumnInternalToAskQuillColumn(columns) {
|
|
|
51327
52424
|
});
|
|
51328
52425
|
}
|
|
51329
52426
|
var useAskQuill = (dashboardName) => {
|
|
51330
|
-
const [client] =
|
|
51331
|
-
const [schemaData] =
|
|
51332
|
-
const { tenants } =
|
|
51333
|
-
const { getToken } =
|
|
51334
|
-
const { eventTracking } =
|
|
51335
|
-
const [astInfo, setAstInfo] =
|
|
51336
|
-
const [data, setData] =
|
|
52427
|
+
const [client] = useContext36(ClientContext);
|
|
52428
|
+
const [schemaData] = useContext36(SchemaDataContext);
|
|
52429
|
+
const { tenants } = useContext36(TenantContext);
|
|
52430
|
+
const { getToken } = useContext36(FetchContext);
|
|
52431
|
+
const { eventTracking } = useContext36(EventTrackingContext);
|
|
52432
|
+
const [astInfo, setAstInfo] = useState39(void 0);
|
|
52433
|
+
const [data, setData] = useState39({
|
|
51337
52434
|
rows: [],
|
|
51338
52435
|
columns: [],
|
|
51339
52436
|
pivot: null,
|
|
@@ -51343,9 +52440,9 @@ var useAskQuill = (dashboardName) => {
|
|
|
51343
52440
|
pivotColumnFields: [],
|
|
51344
52441
|
pivotValueFields: []
|
|
51345
52442
|
});
|
|
51346
|
-
const [loading, setLoading] =
|
|
51347
|
-
const [error, setError] =
|
|
51348
|
-
const [ask, setAsk] =
|
|
52443
|
+
const [loading, setLoading] = useState39(false);
|
|
52444
|
+
const [error, setError] = useState39(void 0);
|
|
52445
|
+
const [ask, setAsk] = useState39(
|
|
51349
52446
|
async () => void 0
|
|
51350
52447
|
);
|
|
51351
52448
|
const askHelper = async (query) => {
|
|
@@ -51545,7 +52642,7 @@ var useAskQuill = (dashboardName) => {
|
|
|
51545
52642
|
});
|
|
51546
52643
|
setLoading(false);
|
|
51547
52644
|
};
|
|
51548
|
-
|
|
52645
|
+
useEffect32(() => {
|
|
51549
52646
|
setAsk(() => askHelper);
|
|
51550
52647
|
}, [schemaData.schema]);
|
|
51551
52648
|
return {
|
|
@@ -51559,13 +52656,13 @@ var useAskQuill = (dashboardName) => {
|
|
|
51559
52656
|
};
|
|
51560
52657
|
|
|
51561
52658
|
// src/hooks/useVirtualTables.tsx
|
|
51562
|
-
import { useContext as
|
|
52659
|
+
import { useContext as useContext37, useState as useState40 } from "react";
|
|
51563
52660
|
var useVirtualTables = () => {
|
|
51564
|
-
const [schemaData, setSchemaData] =
|
|
51565
|
-
const { tenants } =
|
|
51566
|
-
const { getToken, quillFetchWithToken } =
|
|
51567
|
-
const { eventTracking } =
|
|
51568
|
-
const [loadingTables, setLoadingTables] =
|
|
52661
|
+
const [schemaData, setSchemaData] = useContext37(SchemaDataContext);
|
|
52662
|
+
const { tenants } = useContext37(TenantContext);
|
|
52663
|
+
const { getToken, quillFetchWithToken } = useContext37(FetchContext);
|
|
52664
|
+
const { eventTracking } = useContext37(EventTrackingContext);
|
|
52665
|
+
const [loadingTables, setLoadingTables] = useState40({});
|
|
51569
52666
|
const handleReload = async (client, caller) => {
|
|
51570
52667
|
setSchemaData({ ...schemaData, isSchemaLoading: true });
|
|
51571
52668
|
setLoadingTables(
|
|
@@ -51733,5 +52830,6 @@ export {
|
|
|
51733
52830
|
useQuill,
|
|
51734
52831
|
useReportBuilder,
|
|
51735
52832
|
useReports,
|
|
52833
|
+
useTenants,
|
|
51736
52834
|
useVirtualTables
|
|
51737
52835
|
};
|