@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.cjs
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name2 in all)
|
|
10
13
|
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
@@ -27,6 +30,358 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
30
|
));
|
|
28
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
32
|
|
|
33
|
+
// ../../node_modules/pluralize/pluralize.js
|
|
34
|
+
var require_pluralize = __commonJS({
|
|
35
|
+
"../../node_modules/pluralize/pluralize.js"(exports2, module2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
(function(root, pluralize2) {
|
|
38
|
+
if (typeof require === "function" && typeof exports2 === "object" && typeof module2 === "object") {
|
|
39
|
+
module2.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
|
+
})(exports2, 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
|
+
|
|
30
385
|
// src/index.ts
|
|
31
386
|
var index_exports = {};
|
|
32
387
|
__export(index_exports, {
|
|
@@ -70,6 +425,7 @@ __export(index_exports, {
|
|
|
70
425
|
useQuill: () => useQuill,
|
|
71
426
|
useReportBuilder: () => useReportBuilder,
|
|
72
427
|
useReports: () => useReports,
|
|
428
|
+
useTenants: () => useTenants,
|
|
73
429
|
useVirtualTables: () => useVirtualTables
|
|
74
430
|
});
|
|
75
431
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1379,6 +1735,7 @@ var DashboardFilterType = /* @__PURE__ */ ((DashboardFilterType4) => {
|
|
|
1379
1735
|
DashboardFilterType4["Select"] = "select";
|
|
1380
1736
|
DashboardFilterType4["MultiSelect"] = "multiselect";
|
|
1381
1737
|
DashboardFilterType4["Date"] = "date";
|
|
1738
|
+
DashboardFilterType4["Tenant"] = "tenant";
|
|
1382
1739
|
return DashboardFilterType4;
|
|
1383
1740
|
})(DashboardFilterType || {});
|
|
1384
1741
|
var convertCustomFilter = (filter) => {
|
|
@@ -1632,6 +1989,16 @@ var convertInternalDashboardFilterToDashboardFilter = (filter) => {
|
|
|
1632
1989
|
},
|
|
1633
1990
|
options
|
|
1634
1991
|
};
|
|
1992
|
+
} else if (filter.filterType === "tenant" /* Tenant */) {
|
|
1993
|
+
return {
|
|
1994
|
+
label: filter.label,
|
|
1995
|
+
type: "tenant" /* Tenant */,
|
|
1996
|
+
value: filter.multiSelect ? filter.values ?? [] : filter.values?.[0] ?? null,
|
|
1997
|
+
options: (filter.options ?? []).map((opt) => ({
|
|
1998
|
+
label: opt.label,
|
|
1999
|
+
value: opt.value
|
|
2000
|
+
}))
|
|
2001
|
+
};
|
|
1635
2002
|
}
|
|
1636
2003
|
throw new Error(
|
|
1637
2004
|
"Unknown InternalDashboardFilterType: " + filter.filterType
|
|
@@ -17496,7 +17863,7 @@ async function generatePivotWithSQL({
|
|
|
17496
17863
|
if (!itemQuery) {
|
|
17497
17864
|
throw Error("No item query found in report");
|
|
17498
17865
|
}
|
|
17499
|
-
sqlQuery =
|
|
17866
|
+
sqlQuery = generatePivotQuery(
|
|
17500
17867
|
pivot,
|
|
17501
17868
|
itemQuery,
|
|
17502
17869
|
databaseType,
|
|
@@ -18814,10 +19181,15 @@ async function getPivotTable(report, dashboardFilters, dashboardName, getToken,
|
|
|
18814
19181
|
});
|
|
18815
19182
|
}
|
|
18816
19183
|
}
|
|
19184
|
+
const pivotQuery = generatePivotQuery(
|
|
19185
|
+
pivot,
|
|
19186
|
+
report.itemQuery?.[0],
|
|
19187
|
+
client.databaseType
|
|
19188
|
+
);
|
|
18817
19189
|
return {
|
|
18818
19190
|
rows: [],
|
|
18819
19191
|
rowCount: 0,
|
|
18820
|
-
pivotQuery: "",
|
|
19192
|
+
pivotQuery: pivotQuery ?? "",
|
|
18821
19193
|
columns
|
|
18822
19194
|
};
|
|
18823
19195
|
}
|
|
@@ -20129,6 +20501,8 @@ function extractAllReportValuesFromQuillInternalReport(reportInternal) {
|
|
|
20129
20501
|
name: reportInternal.name,
|
|
20130
20502
|
dashboardName: reportInternal.dashboardName,
|
|
20131
20503
|
// section: reportInternal.section,
|
|
20504
|
+
pagination: reportInternal.pagination,
|
|
20505
|
+
sort: reportInternal.sort,
|
|
20132
20506
|
rows: reportInternal.rows,
|
|
20133
20507
|
columns: reportInternal.columns,
|
|
20134
20508
|
chartType: reportInternal.chartType,
|
|
@@ -21298,7 +21672,19 @@ var DashboardFiltersContext = (0, import_react.createContext)({
|
|
|
21298
21672
|
loadFiltersForDashboard: async () => {
|
|
21299
21673
|
}
|
|
21300
21674
|
});
|
|
21301
|
-
var TenantContext = (0, import_react.createContext)({
|
|
21675
|
+
var TenantContext = (0, import_react.createContext)({
|
|
21676
|
+
childTenantMappings: {},
|
|
21677
|
+
viewerTenants: {},
|
|
21678
|
+
viewerTenantsByOwner: {},
|
|
21679
|
+
isLoadingMappedTenants: false,
|
|
21680
|
+
isLoadingViewerTenants: false,
|
|
21681
|
+
fetchViewerTenantsForDashboard: async () => {
|
|
21682
|
+
},
|
|
21683
|
+
fetchMappedTenantsForDashboard: async () => {
|
|
21684
|
+
},
|
|
21685
|
+
getMappedTenantsForDashboard: async () => void 0,
|
|
21686
|
+
getViewerTenantsByOwner: async () => []
|
|
21687
|
+
});
|
|
21302
21688
|
var FetchContext = (0, import_react.createContext)({
|
|
21303
21689
|
getToken: async () => "",
|
|
21304
21690
|
quillFetchWithToken: async () => ({ data: null })
|
|
@@ -21388,6 +21774,15 @@ var ContextProvider = ({
|
|
|
21388
21774
|
const fetchSchemaProcessId = (0, import_react.useRef)(0);
|
|
21389
21775
|
const currentTenant = (0, import_react.useRef)(null);
|
|
21390
21776
|
const currentPublicKey = (0, import_react.useRef)(null);
|
|
21777
|
+
const [childTenantMappings, setChildTenantMappings] = (0, import_react.useState)({});
|
|
21778
|
+
const [viewerTenants, setViewerTenants] = (0, import_react.useState)({});
|
|
21779
|
+
const [viewerTenantsByOwner, setViewerTenantsByOwner] = (0, import_react.useState)({});
|
|
21780
|
+
const [isLoadingMappedTenants, setIsLoadingMappedTenants] = (0, import_react.useState)(false);
|
|
21781
|
+
const [isLoadingViewerTenants, setIsLoadingViewerTenants] = (0, import_react.useState)(false);
|
|
21782
|
+
const prevTenants = (0, import_react.useRef)(null);
|
|
21783
|
+
const viewerTenantsRequests = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
21784
|
+
const viewerTenantsByOwnerRequests = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
21785
|
+
const mappedTenantsRequests = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
21391
21786
|
const loadDashboardProcessId = (0, import_react.useRef)({});
|
|
21392
21787
|
(0, import_react.useEffect)(() => {
|
|
21393
21788
|
if (!theme) {
|
|
@@ -21736,7 +22131,7 @@ var ContextProvider = ({
|
|
|
21736
22131
|
});
|
|
21737
22132
|
await Promise.allSettled(
|
|
21738
22133
|
filters.map(async (filter) => {
|
|
21739
|
-
if (filter.filterType
|
|
22134
|
+
if (filter.filterType === "date_range") {
|
|
21740
22135
|
dashboardFiltersDispatch({
|
|
21741
22136
|
type: "UPDATE_DASHBOARD_FILTER",
|
|
21742
22137
|
dashboardName,
|
|
@@ -21760,6 +22155,10 @@ var ContextProvider = ({
|
|
|
21760
22155
|
});
|
|
21761
22156
|
return null;
|
|
21762
22157
|
}
|
|
22158
|
+
if (filter.filterType === "tenant") {
|
|
22159
|
+
await fetchTenantFilterOptions(dashboardName, filter);
|
|
22160
|
+
return null;
|
|
22161
|
+
}
|
|
21763
22162
|
const filterOptionsAbortController = new AbortController();
|
|
21764
22163
|
filterOptionsAbortControllers.current.add(filterOptionsAbortController);
|
|
21765
22164
|
try {
|
|
@@ -22121,7 +22520,8 @@ var ContextProvider = ({
|
|
|
22121
22520
|
},
|
|
22122
22521
|
task: "dashboards",
|
|
22123
22522
|
metadata: {
|
|
22124
|
-
clientId: publicKey2
|
|
22523
|
+
clientId: publicKey2,
|
|
22524
|
+
tenants
|
|
22125
22525
|
// getSections: true, // skip fetching reports since 'dashboard' always does anyway
|
|
22126
22526
|
},
|
|
22127
22527
|
abortSignal: fetchDashboardsAbortController.current.signal,
|
|
@@ -22210,6 +22610,14 @@ var ContextProvider = ({
|
|
|
22210
22610
|
loading: true
|
|
22211
22611
|
};
|
|
22212
22612
|
});
|
|
22613
|
+
dashboard2.tenantFilters?.forEach(
|
|
22614
|
+
(filter) => {
|
|
22615
|
+
acc[dashboard2.name][filter.label] = {
|
|
22616
|
+
filter: { ...filter, options: void 0 },
|
|
22617
|
+
loading: true
|
|
22618
|
+
};
|
|
22619
|
+
}
|
|
22620
|
+
);
|
|
22213
22621
|
return acc;
|
|
22214
22622
|
}, {})
|
|
22215
22623
|
});
|
|
@@ -22285,6 +22693,180 @@ var ContextProvider = ({
|
|
|
22285
22693
|
return { error: "Failed to fetch data" };
|
|
22286
22694
|
}
|
|
22287
22695
|
}
|
|
22696
|
+
const getDashboardViewerTenants = async (dashboardName) => {
|
|
22697
|
+
if (!populatedClient) {
|
|
22698
|
+
return [];
|
|
22699
|
+
}
|
|
22700
|
+
const { data } = await quillFetchWithToken({
|
|
22701
|
+
client: populatedClient,
|
|
22702
|
+
task: "viewer-tenants",
|
|
22703
|
+
metadata: {
|
|
22704
|
+
dashboardName
|
|
22705
|
+
}
|
|
22706
|
+
});
|
|
22707
|
+
return data?.viewerTenants || [];
|
|
22708
|
+
};
|
|
22709
|
+
const getOwnerViewerTenants = async (ownerTenant) => {
|
|
22710
|
+
if (!populatedClient) {
|
|
22711
|
+
return [];
|
|
22712
|
+
}
|
|
22713
|
+
const { data } = await quillFetchWithToken({
|
|
22714
|
+
client: populatedClient,
|
|
22715
|
+
task: "viewer-tenants-by-owner",
|
|
22716
|
+
metadata: {
|
|
22717
|
+
tenantField: ownerTenant
|
|
22718
|
+
}
|
|
22719
|
+
});
|
|
22720
|
+
return data?.viewerTenants || [];
|
|
22721
|
+
};
|
|
22722
|
+
const getMappedTenants = async (tenantsParam, dashboardName) => {
|
|
22723
|
+
if (!populatedClient) {
|
|
22724
|
+
return {};
|
|
22725
|
+
}
|
|
22726
|
+
const { data, queries } = await quillFetchWithToken({
|
|
22727
|
+
client: populatedClient,
|
|
22728
|
+
task: "mapped-tenants",
|
|
22729
|
+
metadata: {
|
|
22730
|
+
tenants: tenantsParam,
|
|
22731
|
+
dashboardName
|
|
22732
|
+
}
|
|
22733
|
+
});
|
|
22734
|
+
const childTenants = data.queryOrder;
|
|
22735
|
+
const queryResults = queries.queryResults.map((result) => {
|
|
22736
|
+
return result?.rows?.map((row) => ({
|
|
22737
|
+
value: row["flag"],
|
|
22738
|
+
label: row["label"]
|
|
22739
|
+
})) ?? null;
|
|
22740
|
+
});
|
|
22741
|
+
const mappedTenants = {};
|
|
22742
|
+
await Promise.all(
|
|
22743
|
+
childTenants.map(
|
|
22744
|
+
async (tenant, index) => {
|
|
22745
|
+
mappedTenants[tenant.tenantField] = queryResults[index];
|
|
22746
|
+
}
|
|
22747
|
+
)
|
|
22748
|
+
);
|
|
22749
|
+
return mappedTenants;
|
|
22750
|
+
};
|
|
22751
|
+
const fetchViewerTenantsForDashboard = (0, import_react.useCallback)(
|
|
22752
|
+
async (dashboardName) => {
|
|
22753
|
+
if (!populatedClient) return;
|
|
22754
|
+
if (viewerTenantsRequests.current.has(dashboardName)) {
|
|
22755
|
+
return;
|
|
22756
|
+
}
|
|
22757
|
+
if (viewerTenants[dashboardName]) {
|
|
22758
|
+
return;
|
|
22759
|
+
}
|
|
22760
|
+
viewerTenantsRequests.current.add(dashboardName);
|
|
22761
|
+
setIsLoadingViewerTenants(true);
|
|
22762
|
+
try {
|
|
22763
|
+
const viewerTenantsData = await getDashboardViewerTenants(dashboardName);
|
|
22764
|
+
setViewerTenants((prev) => ({
|
|
22765
|
+
...prev,
|
|
22766
|
+
[dashboardName]: viewerTenantsData
|
|
22767
|
+
}));
|
|
22768
|
+
} catch (error) {
|
|
22769
|
+
console.error("Error fetching viewer tenants:", error);
|
|
22770
|
+
} finally {
|
|
22771
|
+
viewerTenantsRequests.current.delete(dashboardName);
|
|
22772
|
+
setIsLoadingViewerTenants(false);
|
|
22773
|
+
}
|
|
22774
|
+
},
|
|
22775
|
+
[populatedClient]
|
|
22776
|
+
);
|
|
22777
|
+
const fetchMappedTenantsForDashboard = async (dashboardName) => {
|
|
22778
|
+
await getMappedTenantsForDashboard(dashboardName);
|
|
22779
|
+
return;
|
|
22780
|
+
};
|
|
22781
|
+
const getMappedTenantsForDashboard = (0, import_react.useCallback)(
|
|
22782
|
+
async (dashboardName) => {
|
|
22783
|
+
if (!populatedClient || !tenants) return void 0;
|
|
22784
|
+
const tenantsChanged = !(0, import_fast_deep_equal.default)(prevTenants.current, tenants);
|
|
22785
|
+
if (childTenantMappings[dashboardName] && !tenantsChanged) {
|
|
22786
|
+
return childTenantMappings[dashboardName];
|
|
22787
|
+
}
|
|
22788
|
+
if (mappedTenantsRequests.current.has(dashboardName) && !tenantsChanged) {
|
|
22789
|
+
return new Promise((resolve) => {
|
|
22790
|
+
const checkInterval = setInterval(() => {
|
|
22791
|
+
if (!mappedTenantsRequests.current.has(dashboardName)) {
|
|
22792
|
+
clearInterval(checkInterval);
|
|
22793
|
+
resolve(childTenantMappings[dashboardName]);
|
|
22794
|
+
}
|
|
22795
|
+
}, 100);
|
|
22796
|
+
});
|
|
22797
|
+
}
|
|
22798
|
+
prevTenants.current = tenants;
|
|
22799
|
+
mappedTenantsRequests.current.add(dashboardName);
|
|
22800
|
+
setIsLoadingMappedTenants(true);
|
|
22801
|
+
try {
|
|
22802
|
+
const mappedTenants = await getMappedTenants(tenants, dashboardName);
|
|
22803
|
+
setChildTenantMappings((prev) => ({
|
|
22804
|
+
...prev,
|
|
22805
|
+
[dashboardName]: mappedTenants
|
|
22806
|
+
}));
|
|
22807
|
+
return mappedTenants;
|
|
22808
|
+
} catch (error) {
|
|
22809
|
+
console.error("Error fetching mapped tenants:", error);
|
|
22810
|
+
setChildTenantMappings((prev) => ({
|
|
22811
|
+
...prev,
|
|
22812
|
+
[dashboardName]: {}
|
|
22813
|
+
}));
|
|
22814
|
+
return void 0;
|
|
22815
|
+
} finally {
|
|
22816
|
+
mappedTenantsRequests.current.delete(dashboardName);
|
|
22817
|
+
setIsLoadingMappedTenants(false);
|
|
22818
|
+
}
|
|
22819
|
+
},
|
|
22820
|
+
[populatedClient, tenants, childTenantMappings]
|
|
22821
|
+
);
|
|
22822
|
+
const getViewerTenantsByOwner = (0, import_react.useCallback)(
|
|
22823
|
+
async (ownerTenant) => {
|
|
22824
|
+
if (!populatedClient) return [];
|
|
22825
|
+
if (viewerTenantsByOwner[ownerTenant]) {
|
|
22826
|
+
return viewerTenantsByOwner[ownerTenant];
|
|
22827
|
+
}
|
|
22828
|
+
if (viewerTenantsByOwnerRequests.current.has(ownerTenant)) {
|
|
22829
|
+
return new Promise((resolve) => {
|
|
22830
|
+
const checkInterval = setInterval(() => {
|
|
22831
|
+
if (!viewerTenantsByOwnerRequests.current.has(ownerTenant)) {
|
|
22832
|
+
clearInterval(checkInterval);
|
|
22833
|
+
resolve(viewerTenantsByOwner[ownerTenant] || []);
|
|
22834
|
+
}
|
|
22835
|
+
}, 100);
|
|
22836
|
+
});
|
|
22837
|
+
}
|
|
22838
|
+
viewerTenantsByOwnerRequests.current.add(ownerTenant);
|
|
22839
|
+
setIsLoadingViewerTenants(true);
|
|
22840
|
+
try {
|
|
22841
|
+
const viewerTenantsData = await getOwnerViewerTenants(ownerTenant);
|
|
22842
|
+
setViewerTenantsByOwner((prev) => ({
|
|
22843
|
+
...prev,
|
|
22844
|
+
[ownerTenant]: viewerTenantsData
|
|
22845
|
+
}));
|
|
22846
|
+
return viewerTenantsData;
|
|
22847
|
+
} catch (error) {
|
|
22848
|
+
console.error("Error fetching viewer tenants by owner:", error);
|
|
22849
|
+
return [];
|
|
22850
|
+
} finally {
|
|
22851
|
+
viewerTenantsByOwnerRequests.current.delete(ownerTenant);
|
|
22852
|
+
setIsLoadingViewerTenants(false);
|
|
22853
|
+
}
|
|
22854
|
+
},
|
|
22855
|
+
[populatedClient, viewerTenantsByOwner]
|
|
22856
|
+
);
|
|
22857
|
+
const fetchTenantFilterOptions = async (dashboardName, filter) => {
|
|
22858
|
+
const mappings = await getMappedTenantsForDashboard(dashboardName);
|
|
22859
|
+
const options = mappings?.[filter.field] ?? [];
|
|
22860
|
+
dashboardFiltersDispatch({
|
|
22861
|
+
type: "UPDATE_DASHBOARD_FILTER",
|
|
22862
|
+
dashboardName,
|
|
22863
|
+
filterName: filter.label,
|
|
22864
|
+
data: {
|
|
22865
|
+
filter: { ...filter, options },
|
|
22866
|
+
loading: false
|
|
22867
|
+
}
|
|
22868
|
+
});
|
|
22869
|
+
};
|
|
22288
22870
|
(0, import_react.useEffect)(() => {
|
|
22289
22871
|
async function updateClientAndSchema(publicKey2) {
|
|
22290
22872
|
if (!publicKey2 || populatedClient?.clientId === publicKey2 && populatedClient?.allTenantTypes?.length)
|
|
@@ -22443,7 +23025,17 @@ var ContextProvider = ({
|
|
|
22443
23025
|
{
|
|
22444
23026
|
value: {
|
|
22445
23027
|
tenants: populatedClient?.currentTenants ?? tenants,
|
|
22446
|
-
flags: populatedClient?.currentFlags ?? flags
|
|
23028
|
+
flags: populatedClient?.currentFlags ?? flags,
|
|
23029
|
+
childTenantMappings,
|
|
23030
|
+
viewerTenants,
|
|
23031
|
+
viewerTenantsByOwner,
|
|
23032
|
+
isLoadingMappedTenants,
|
|
23033
|
+
isLoadingViewerTenants,
|
|
23034
|
+
fetchViewerTenantsForDashboard,
|
|
23035
|
+
// fetchViewerTenantsByOwner,
|
|
23036
|
+
fetchMappedTenantsForDashboard,
|
|
23037
|
+
getMappedTenantsForDashboard,
|
|
23038
|
+
getViewerTenantsByOwner
|
|
22447
23039
|
},
|
|
22448
23040
|
children
|
|
22449
23041
|
}
|
|
@@ -22531,7 +23123,7 @@ var useDashboardInternal = (dashboardName, customFilters) => {
|
|
|
22531
23123
|
);
|
|
22532
23124
|
if (!fetchFromServer && Object.keys(dashboardFilters[dashboardName] ?? {}).length && // there exists no non date filter that has undefined options
|
|
22533
23125
|
Object.values(dashboardFilters[dashboardName] ?? {}).every(
|
|
22534
|
-
(filter) => filter.filter.filterType === "date_range" /* Date */ || filter.filter.options
|
|
23126
|
+
(filter) => filter.filter.filterType === "date_range" /* Date */ || filter.filter.filterType === "tenant" /* Tenant */ || filter.filter.options
|
|
22535
23127
|
)) {
|
|
22536
23128
|
return;
|
|
22537
23129
|
}
|
|
@@ -22548,6 +23140,9 @@ var useDashboardInternal = (dashboardName, customFilters) => {
|
|
|
22548
23140
|
...updatedDashboard?.filters?.map((filter) => ({
|
|
22549
23141
|
...filter,
|
|
22550
23142
|
query: void 0
|
|
23143
|
+
})) ?? [],
|
|
23144
|
+
...updatedDashboard?.tenantFilters?.map((filter) => ({
|
|
23145
|
+
...filter
|
|
22551
23146
|
})) ?? []
|
|
22552
23147
|
],
|
|
22553
23148
|
void 0,
|
|
@@ -22738,8 +23333,10 @@ var useDashboards = () => {
|
|
|
22738
23333
|
(a, b) => (a.createdAt?.getTime() ?? 0) - (b.createdAt?.getTime() ?? 0)
|
|
22739
23334
|
);
|
|
22740
23335
|
}, [dashboardConfig]);
|
|
23336
|
+
const { getMappedTenantsForDashboard } = (0, import_react2.useContext)(TenantContext);
|
|
22741
23337
|
const createDashboard = async ({
|
|
22742
23338
|
name: name2,
|
|
23339
|
+
tenantFilters,
|
|
22743
23340
|
filters,
|
|
22744
23341
|
dateFilter,
|
|
22745
23342
|
dashboardOwners
|
|
@@ -22756,6 +23353,7 @@ var useDashboards = () => {
|
|
|
22756
23353
|
tenantKeys: dashboardOwners,
|
|
22757
23354
|
dashboardId: name2,
|
|
22758
23355
|
name: name2,
|
|
23356
|
+
allTenantFilters: tenantFilters ?? [],
|
|
22759
23357
|
filters,
|
|
22760
23358
|
dateFilter
|
|
22761
23359
|
},
|
|
@@ -22764,6 +23362,7 @@ var useDashboards = () => {
|
|
|
22764
23362
|
});
|
|
22765
23363
|
const body = {
|
|
22766
23364
|
newDashboardName: name2.trim(),
|
|
23365
|
+
tenantFilters,
|
|
22767
23366
|
filters,
|
|
22768
23367
|
dateFilter,
|
|
22769
23368
|
name: name2.trim(),
|
|
@@ -22816,6 +23415,7 @@ var useDashboards = () => {
|
|
|
22816
23415
|
const updateDashboard = async (name2, {
|
|
22817
23416
|
newName,
|
|
22818
23417
|
filters,
|
|
23418
|
+
tenantFilters,
|
|
22819
23419
|
dateFilter,
|
|
22820
23420
|
customFilters,
|
|
22821
23421
|
tenantKeys
|
|
@@ -22837,6 +23437,7 @@ var useDashboards = () => {
|
|
|
22837
23437
|
const body = {
|
|
22838
23438
|
newDashboardName: newName.trim(),
|
|
22839
23439
|
filters,
|
|
23440
|
+
tenantFilters,
|
|
22840
23441
|
dateFilter: dateFilter ?? null,
|
|
22841
23442
|
name: name2.trim(),
|
|
22842
23443
|
task: "edit-dashboard",
|
|
@@ -22866,6 +23467,7 @@ var useDashboards = () => {
|
|
|
22866
23467
|
config: {
|
|
22867
23468
|
...dashboard,
|
|
22868
23469
|
...updated.data.dashboard,
|
|
23470
|
+
allTenantFilters: tenantFilters ?? [],
|
|
22869
23471
|
dateFilter: updated.data.dashboard.dateFilter ? {
|
|
22870
23472
|
...updated.data.dashboard.dateFilter,
|
|
22871
23473
|
presetOptions: updated.data.dashboard.dateFilter.presetOptions?.map(
|
|
@@ -22960,6 +23562,8 @@ var useDashboards = () => {
|
|
|
22960
23562
|
endDate: !range.endDate || range.endDate instanceof Date ? range.endDate : new Date(range.endDate)
|
|
22961
23563
|
// when range.endDate is a string
|
|
22962
23564
|
} : void 0;
|
|
23565
|
+
const mappedTenants = await getMappedTenantsForDashboard(newName);
|
|
23566
|
+
const mappedTenantKeys = Object.keys(mappedTenants ?? {});
|
|
22963
23567
|
const newFilters = [
|
|
22964
23568
|
...updatedDateFilter ? [updatedDateFilter] : [],
|
|
22965
23569
|
...updated.data.dashboard.filters.map(
|
|
@@ -22969,14 +23573,22 @@ var useDashboards = () => {
|
|
|
22969
23573
|
values: oldFilters?.[f.label]?.filter?.values,
|
|
22970
23574
|
operator: oldFilters?.[f.label]?.filter?.operator
|
|
22971
23575
|
})
|
|
22972
|
-
) ?? []
|
|
23576
|
+
) ?? [],
|
|
23577
|
+
...(updated.data.dashboard.tenantFilters?.map(
|
|
23578
|
+
(f) => ({
|
|
23579
|
+
...f,
|
|
23580
|
+
values: oldFilters?.[f.label]?.filter?.values
|
|
23581
|
+
})
|
|
23582
|
+
) ?? []).filter((filter) => {
|
|
23583
|
+
return mappedTenantKeys.includes(filter.field);
|
|
23584
|
+
})
|
|
22973
23585
|
].map((f) => {
|
|
22974
23586
|
if (f.filterType === "date_range" /* Date */) {
|
|
22975
23587
|
return {
|
|
22976
23588
|
...f,
|
|
22977
|
-
startDate: dashboardFilters[name2]?.[f.label]?.filter?.startDate,
|
|
22978
|
-
endDate: dashboardFilters[name2]?.[f.label]?.filter?.endDate,
|
|
22979
|
-
preset: dashboardFilters[name2]?.[f.label]?.filter?.preset
|
|
23589
|
+
startDate: dashboardFilters[name2]?.[f.label]?.filter?.startDate ?? f.startDate,
|
|
23590
|
+
endDate: dashboardFilters[name2]?.[f.label]?.filter?.endDate ?? f.endDate,
|
|
23591
|
+
preset: dashboardFilters[name2]?.[f.label]?.filter?.preset ?? f.preset
|
|
22980
23592
|
};
|
|
22981
23593
|
} else {
|
|
22982
23594
|
return {
|
|
@@ -23035,7 +23647,7 @@ var useDashboards = () => {
|
|
|
23035
23647
|
deleteDashboard
|
|
23036
23648
|
};
|
|
23037
23649
|
};
|
|
23038
|
-
var useDashboard = (dashboardName) => {
|
|
23650
|
+
var useDashboard = (dashboardName, config) => {
|
|
23039
23651
|
const { data, dashboardFilters, reload, isLoading } = useDashboardInternal(dashboardName);
|
|
23040
23652
|
const { customFilterDispatch } = (0, import_react2.useContext)(DashboardFiltersContext);
|
|
23041
23653
|
const { reportsDispatch, reportsLoadingStateDispatch } = (0, import_react2.useContext)(ReportsContext);
|
|
@@ -23076,7 +23688,7 @@ var useDashboard = (dashboardName) => {
|
|
|
23076
23688
|
(0, import_react2.useEffect)(() => {
|
|
23077
23689
|
if (!fetchedInitialReports.current && data) {
|
|
23078
23690
|
fetchedInitialReports.current = true;
|
|
23079
|
-
fetchReports([], dashboardFilters ?? []);
|
|
23691
|
+
fetchReports([], dashboardFilters ?? [], config?.pageSize);
|
|
23080
23692
|
}
|
|
23081
23693
|
}, [fetchedInitialReports, data, dashboardFilters]);
|
|
23082
23694
|
const applyDashboardFilters = (filtersToUpdate) => {
|
|
@@ -23118,6 +23730,20 @@ var useDashboard = (dashboardName) => {
|
|
|
23118
23730
|
endDate: value.endDate
|
|
23119
23731
|
};
|
|
23120
23732
|
}
|
|
23733
|
+
} else if (f.filterType === "tenant" /* Tenant */) {
|
|
23734
|
+
const value = update.value;
|
|
23735
|
+
let values;
|
|
23736
|
+
if (Array.isArray(value)) {
|
|
23737
|
+
values = value;
|
|
23738
|
+
} else if (typeof value === "string") {
|
|
23739
|
+
values = [value];
|
|
23740
|
+
} else {
|
|
23741
|
+
values = [];
|
|
23742
|
+
}
|
|
23743
|
+
return {
|
|
23744
|
+
...f,
|
|
23745
|
+
values
|
|
23746
|
+
};
|
|
23121
23747
|
}
|
|
23122
23748
|
return f;
|
|
23123
23749
|
});
|
|
@@ -23169,24 +23795,39 @@ var useDashboard = (dashboardName) => {
|
|
|
23169
23795
|
}
|
|
23170
23796
|
return [];
|
|
23171
23797
|
};
|
|
23172
|
-
const fetchReports = async (customFilters, dashboardFilters2) => {
|
|
23798
|
+
const fetchReports = async (customFilters, dashboardFilters2, pageSize) => {
|
|
23173
23799
|
if (!client || !sections) return;
|
|
23174
|
-
const
|
|
23175
|
-
(reports) => reports.map((report) => report.id)
|
|
23176
|
-
);
|
|
23800
|
+
const allReports = Object.values(sections).flat();
|
|
23177
23801
|
await Promise.all(
|
|
23178
|
-
|
|
23802
|
+
allReports.map(async (reportInfo) => {
|
|
23803
|
+
const reportId = reportInfo.id;
|
|
23179
23804
|
reportsLoadingStateDispatch({
|
|
23180
23805
|
type: "SET_REPORT_LOADING",
|
|
23181
23806
|
id: reportId,
|
|
23182
23807
|
data: true
|
|
23183
23808
|
});
|
|
23184
23809
|
const customReportFiltersArray = await waitForCustomFilters(reportId);
|
|
23810
|
+
let rowsPerRequest = pageSize || 600;
|
|
23811
|
+
if (!pageSize) {
|
|
23812
|
+
if (reportInfo.chartType === "table") {
|
|
23813
|
+
rowsPerRequest = 10;
|
|
23814
|
+
} else if (reportInfo.chartType === "metric") {
|
|
23815
|
+
rowsPerRequest = 1;
|
|
23816
|
+
}
|
|
23817
|
+
}
|
|
23818
|
+
const pagination = {
|
|
23819
|
+
rowsPerRequest,
|
|
23820
|
+
rowsPerPage: rowsPerRequest
|
|
23821
|
+
};
|
|
23822
|
+
const additionalProcessing = rowsPerRequest ? {
|
|
23823
|
+
page: pagination
|
|
23824
|
+
} : void 0;
|
|
23185
23825
|
const { report, error } = await fetchReport({
|
|
23186
23826
|
reportId,
|
|
23187
23827
|
client,
|
|
23188
23828
|
tenants,
|
|
23189
23829
|
flags,
|
|
23830
|
+
additionalProcessing,
|
|
23190
23831
|
filters: dashboardFilters2.concat(customFilters).concat(customReportFiltersArray),
|
|
23191
23832
|
getToken,
|
|
23192
23833
|
eventTracking
|
|
@@ -23198,7 +23839,10 @@ var useDashboard = (dashboardName) => {
|
|
|
23198
23839
|
reportsDispatch({
|
|
23199
23840
|
type: "UPDATE_REPORT",
|
|
23200
23841
|
id: reportId,
|
|
23201
|
-
data:
|
|
23842
|
+
data: {
|
|
23843
|
+
...report,
|
|
23844
|
+
pagination
|
|
23845
|
+
}
|
|
23202
23846
|
});
|
|
23203
23847
|
reportsLoadingStateDispatch({
|
|
23204
23848
|
type: "SET_REPORT_LOADING",
|
|
@@ -23216,7 +23860,7 @@ var useDashboard = (dashboardName) => {
|
|
|
23216
23860
|
applyFilters
|
|
23217
23861
|
};
|
|
23218
23862
|
};
|
|
23219
|
-
var
|
|
23863
|
+
var useDashboardReportInternal = (reportId, config) => {
|
|
23220
23864
|
const {
|
|
23221
23865
|
reports,
|
|
23222
23866
|
reportsLoadingState,
|
|
@@ -23228,13 +23872,15 @@ var useDashboardReport = (reportId, config) => {
|
|
|
23228
23872
|
const [client] = (0, import_react2.useContext)(ClientContext);
|
|
23229
23873
|
const { getToken } = (0, import_react2.useContext)(FetchContext);
|
|
23230
23874
|
const { eventTracking } = (0, import_react2.useContext)(EventTrackingContext);
|
|
23231
|
-
const { customReportFiltersDispatch } = (0, import_react2.useContext)(ReportFiltersContext);
|
|
23875
|
+
const { customReportFilters, customReportFiltersDispatch } = (0, import_react2.useContext)(ReportFiltersContext);
|
|
23232
23876
|
const { dashboardCustomFilters } = (0, import_react2.useContext)(DashboardFiltersContext);
|
|
23233
23877
|
const {
|
|
23234
23878
|
data: dashboardData,
|
|
23235
23879
|
dashboardFilters: dashboardFiltersInternal,
|
|
23236
23880
|
reload: reloadDashboard
|
|
23237
23881
|
} = useDashboardInternal(reports[reportId]?.dashboardName ?? null);
|
|
23882
|
+
const [pageLoading, setPageLoading] = (0, import_react2.useState)(false);
|
|
23883
|
+
const [maxPage, setMaxPage] = (0, import_react2.useState)(0);
|
|
23238
23884
|
(0, import_react2.useEffect)(() => {
|
|
23239
23885
|
if (config?.initialFilters) {
|
|
23240
23886
|
customReportFiltersDispatch({
|
|
@@ -23272,11 +23918,16 @@ var useDashboardReport = (reportId, config) => {
|
|
|
23272
23918
|
const dashboardFiltersArray = dashboardFiltersInternal ?? [];
|
|
23273
23919
|
const dashboardCustomFiltersArray = dashboardCustomFilters[processedReport?.dashboardName ?? ""] ?? [];
|
|
23274
23920
|
const requestFilters = filters.map(convertCustomFilter).concat(dashboardCustomFiltersArray).concat(dashboardFiltersArray);
|
|
23921
|
+
const pagination = processedReport?.pagination;
|
|
23922
|
+
const additionalProcessing = {
|
|
23923
|
+
page: pagination
|
|
23924
|
+
};
|
|
23275
23925
|
const { report, error } = await fetchReport({
|
|
23276
23926
|
reportId,
|
|
23277
23927
|
client,
|
|
23278
23928
|
tenants,
|
|
23279
23929
|
flags,
|
|
23930
|
+
additionalProcessing,
|
|
23280
23931
|
filters: requestFilters,
|
|
23281
23932
|
getToken,
|
|
23282
23933
|
eventTracking
|
|
@@ -23332,11 +23983,138 @@ var useDashboardReport = (reportId, config) => {
|
|
|
23332
23983
|
});
|
|
23333
23984
|
}
|
|
23334
23985
|
};
|
|
23986
|
+
const updateReportTableRows = async (processing, appendRows) => {
|
|
23987
|
+
if (!client) {
|
|
23988
|
+
return;
|
|
23989
|
+
}
|
|
23990
|
+
setPageLoading(true);
|
|
23991
|
+
const dashboardFiltersArray = dashboardFiltersInternal ?? [];
|
|
23992
|
+
const dashboardCustomFiltersArray = dashboardCustomFilters[processedReport?.dashboardName ?? ""] ?? [];
|
|
23993
|
+
const reportCustomFiltersArray = customReportFilters[reportId] ?? [];
|
|
23994
|
+
const filters = reportCustomFiltersArray.concat(dashboardFiltersArray).concat(dashboardCustomFiltersArray);
|
|
23995
|
+
const pivot = processedReport?.pivot;
|
|
23996
|
+
const pivotQuery = reports[reportId]?.pivotQuery;
|
|
23997
|
+
const { rows } = await fetchResultsByReport({
|
|
23998
|
+
reportId,
|
|
23999
|
+
client,
|
|
24000
|
+
tenants,
|
|
24001
|
+
processing,
|
|
24002
|
+
filters,
|
|
24003
|
+
getToken,
|
|
24004
|
+
eventTracking,
|
|
24005
|
+
pivot,
|
|
24006
|
+
pivotQuery
|
|
24007
|
+
});
|
|
24008
|
+
if (pivot && pivotQuery) {
|
|
24009
|
+
const currRows = reports[reportId]?.pivotRows || [];
|
|
24010
|
+
const updatedRows = appendRows ? [...currRows, ...rows] : rows;
|
|
24011
|
+
reportsDispatch({
|
|
24012
|
+
type: "UPDATE_REPORT",
|
|
24013
|
+
id: reportId,
|
|
24014
|
+
data: {
|
|
24015
|
+
pivotRows: updatedRows,
|
|
24016
|
+
pagination: processing.page,
|
|
24017
|
+
sort: processing.sort
|
|
24018
|
+
}
|
|
24019
|
+
});
|
|
24020
|
+
} else {
|
|
24021
|
+
const currRows = reports[reportId]?.rows || [];
|
|
24022
|
+
const updatedRows = appendRows ? [...currRows, ...rows] : rows;
|
|
24023
|
+
reportsDispatch({
|
|
24024
|
+
type: "UPDATE_REPORT",
|
|
24025
|
+
id: reportId,
|
|
24026
|
+
data: {
|
|
24027
|
+
rows: updatedRows,
|
|
24028
|
+
pagination: processing.page,
|
|
24029
|
+
sort: processing.sort
|
|
24030
|
+
}
|
|
24031
|
+
});
|
|
24032
|
+
}
|
|
24033
|
+
setMaxPage(processing.page?.page || 0);
|
|
24034
|
+
setPageLoading(false);
|
|
24035
|
+
};
|
|
24036
|
+
const handleNextPage = async () => {
|
|
24037
|
+
if (!processedReport?.pagination) {
|
|
24038
|
+
return;
|
|
24039
|
+
}
|
|
24040
|
+
const currPage = processedReport.pagination.page || 0;
|
|
24041
|
+
const updatedPage = {
|
|
24042
|
+
...processedReport.pagination,
|
|
24043
|
+
page: currPage + 1
|
|
24044
|
+
};
|
|
24045
|
+
if (shouldFetchMore(updatedPage, currPage + 1, maxPage)) {
|
|
24046
|
+
const sort = processedReport?.sort;
|
|
24047
|
+
updateReportTableRows({ page: updatedPage, sort }, true);
|
|
24048
|
+
} else {
|
|
24049
|
+
reportsDispatch({
|
|
24050
|
+
type: "UPDATE_REPORT",
|
|
24051
|
+
id: reportId,
|
|
24052
|
+
data: {
|
|
24053
|
+
pagination: updatedPage
|
|
24054
|
+
}
|
|
24055
|
+
});
|
|
24056
|
+
}
|
|
24057
|
+
};
|
|
24058
|
+
const handlePrevPage = async () => {
|
|
24059
|
+
if (!processedReport?.pagination) {
|
|
24060
|
+
return;
|
|
24061
|
+
}
|
|
24062
|
+
const currPage = processedReport.pagination.page || 0;
|
|
24063
|
+
const updatedPage = {
|
|
24064
|
+
...processedReport.pagination,
|
|
24065
|
+
page: currPage - 1
|
|
24066
|
+
};
|
|
24067
|
+
reportsDispatch({
|
|
24068
|
+
type: "UPDATE_REPORT",
|
|
24069
|
+
id: reportId,
|
|
24070
|
+
data: {
|
|
24071
|
+
pagination: updatedPage
|
|
24072
|
+
}
|
|
24073
|
+
});
|
|
24074
|
+
};
|
|
24075
|
+
const handleSort = async (sort) => {
|
|
24076
|
+
const currSort = processedReport?.sort;
|
|
24077
|
+
const currPagination = processedReport?.pagination;
|
|
24078
|
+
const newPagination = currPagination ? { ...currPagination, page: 0 } : void 0;
|
|
24079
|
+
if (currSort?.field !== sort.field || currSort?.direction?.toLowerCase() !== sort?.direction?.toLowerCase()) {
|
|
24080
|
+
updateReportTableRows({ page: newPagination, sort }, false);
|
|
24081
|
+
}
|
|
24082
|
+
};
|
|
23335
24083
|
return {
|
|
23336
24084
|
report: reportsLoadingState[reportId] ? null : processedReport,
|
|
23337
24085
|
loading: !!reportsLoadingState[reportId],
|
|
23338
24086
|
applyFilters: setReportFilters,
|
|
23339
|
-
deleteReport
|
|
24087
|
+
deleteReport,
|
|
24088
|
+
pageNumber: processedReport?.pagination?.page || 0,
|
|
24089
|
+
pageLoading,
|
|
24090
|
+
nextPage: handleNextPage,
|
|
24091
|
+
prevPage: handlePrevPage,
|
|
24092
|
+
sortRows: handleSort
|
|
24093
|
+
};
|
|
24094
|
+
};
|
|
24095
|
+
var useDashboardReport = (reportId, config) => {
|
|
24096
|
+
const { report, loading, applyFilters, deleteReport, nextPage } = useDashboardReportInternal(reportId, config);
|
|
24097
|
+
const fetchingRef = (0, import_react2.useRef)(false);
|
|
24098
|
+
const fetchNextPage = async () => {
|
|
24099
|
+
if (fetchingRef.current) {
|
|
24100
|
+
return;
|
|
24101
|
+
}
|
|
24102
|
+
try {
|
|
24103
|
+
fetchingRef.current = true;
|
|
24104
|
+
await nextPage();
|
|
24105
|
+
} catch (error) {
|
|
24106
|
+
console.error("Error fetching page:", error.message);
|
|
24107
|
+
} finally {
|
|
24108
|
+
fetchingRef.current = false;
|
|
24109
|
+
}
|
|
24110
|
+
};
|
|
24111
|
+
return {
|
|
24112
|
+
report,
|
|
24113
|
+
isLoading: loading || fetchingRef.current,
|
|
24114
|
+
loading: loading || fetchingRef.current,
|
|
24115
|
+
applyFilters,
|
|
24116
|
+
deleteReport,
|
|
24117
|
+
fetchNextPage
|
|
23340
24118
|
};
|
|
23341
24119
|
};
|
|
23342
24120
|
|
|
@@ -23577,7 +24355,7 @@ var useExport = (reportId, {
|
|
|
23577
24355
|
} else {
|
|
23578
24356
|
const rows = report.rows;
|
|
23579
24357
|
for (let i = 0; i < rows.length; i += maximumRowsPerPage) {
|
|
23580
|
-
const remainingRows =
|
|
24358
|
+
const remainingRows = rows.length - i;
|
|
23581
24359
|
const availableSpace = maximumRowsPerPage - currentCount;
|
|
23582
24360
|
const rowsToAdd = Math.min(remainingRows, availableSpace);
|
|
23583
24361
|
currentCount += rowsToAdd;
|
|
@@ -25139,7 +25917,7 @@ var MemoizedButton = ({
|
|
|
25139
25917
|
}) => {
|
|
25140
25918
|
const [theme] = (0, import_react11.useContext)(ThemeContext);
|
|
25141
25919
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
25142
|
-
|
|
25920
|
+
QuillToolTipPortal,
|
|
25143
25921
|
{
|
|
25144
25922
|
enabled: !!tooltipText && tooltipText !== "",
|
|
25145
25923
|
text: tooltipText ?? "",
|
|
@@ -26376,6 +27154,140 @@ var QuillToolTip = ({
|
|
|
26376
27154
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "tooltip-text", style: { ...textStyle }, children: text })
|
|
26377
27155
|
] }) : children;
|
|
26378
27156
|
};
|
|
27157
|
+
var QuillToolTipPortal = ({
|
|
27158
|
+
children,
|
|
27159
|
+
text,
|
|
27160
|
+
enabled = true,
|
|
27161
|
+
containerStyle = {},
|
|
27162
|
+
textStyle = {},
|
|
27163
|
+
mirror = false
|
|
27164
|
+
}) => {
|
|
27165
|
+
const [theme] = (0, import_react11.useContext)(ThemeContext);
|
|
27166
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
27167
|
+
const tooltipRef = (0, import_react11.useRef)(null);
|
|
27168
|
+
const triggerRef = (0, import_react11.useRef)(null);
|
|
27169
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react11.useState)(void 0);
|
|
27170
|
+
const updatePosition = () => {
|
|
27171
|
+
if (triggerRef.current && tooltipRef.current) {
|
|
27172
|
+
const rect = triggerRef.current.getBoundingClientRect();
|
|
27173
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
27174
|
+
const viewportWidth = window.innerWidth;
|
|
27175
|
+
let top = rect.top + window.scrollY - tooltipRect.height - 8;
|
|
27176
|
+
let left = rect.left + window.scrollX;
|
|
27177
|
+
if (!mirror) {
|
|
27178
|
+
left = rect.left + rect.width / 2 - tooltipRect.width / 2 + window.scrollX;
|
|
27179
|
+
} else {
|
|
27180
|
+
left = rect.right - tooltipRect.width + window.scrollX;
|
|
27181
|
+
}
|
|
27182
|
+
if (left + tooltipRect.width > viewportWidth) {
|
|
27183
|
+
left = viewportWidth - tooltipRect.width - 16;
|
|
27184
|
+
}
|
|
27185
|
+
if (left < 16) {
|
|
27186
|
+
left = 16;
|
|
27187
|
+
}
|
|
27188
|
+
if (top < window.scrollY + 16) {
|
|
27189
|
+
top = rect.bottom + window.scrollY + 8;
|
|
27190
|
+
}
|
|
27191
|
+
setTooltipPosition({ top, left });
|
|
27192
|
+
}
|
|
27193
|
+
};
|
|
27194
|
+
(0, import_react11.useEffect)(() => {
|
|
27195
|
+
if (isOpen) {
|
|
27196
|
+
const timer2 = setTimeout(() => {
|
|
27197
|
+
updatePosition();
|
|
27198
|
+
}, 0);
|
|
27199
|
+
window.addEventListener("resize", updatePosition, { passive: true });
|
|
27200
|
+
window.addEventListener("scroll", updatePosition, { passive: true });
|
|
27201
|
+
return () => {
|
|
27202
|
+
clearTimeout(timer2);
|
|
27203
|
+
window.removeEventListener("resize", updatePosition);
|
|
27204
|
+
window.removeEventListener("scroll", updatePosition);
|
|
27205
|
+
};
|
|
27206
|
+
}
|
|
27207
|
+
}, [isOpen]);
|
|
27208
|
+
if (!enabled) {
|
|
27209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
|
|
27210
|
+
}
|
|
27211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
27212
|
+
"div",
|
|
27213
|
+
{
|
|
27214
|
+
ref: triggerRef,
|
|
27215
|
+
style: {
|
|
27216
|
+
display: "inline-block",
|
|
27217
|
+
position: "relative",
|
|
27218
|
+
...containerStyle
|
|
27219
|
+
},
|
|
27220
|
+
onMouseEnter: () => setIsOpen(true),
|
|
27221
|
+
onMouseLeave: () => setIsOpen(false),
|
|
27222
|
+
children: [
|
|
27223
|
+
children,
|
|
27224
|
+
isOpen && (0, import_react_dom2.createPortal)(
|
|
27225
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
27226
|
+
"div",
|
|
27227
|
+
{
|
|
27228
|
+
ref: tooltipRef,
|
|
27229
|
+
style: {
|
|
27230
|
+
visibility: tooltipPosition ? "visible" : "hidden",
|
|
27231
|
+
position: "absolute",
|
|
27232
|
+
top: `${tooltipPosition?.top ?? 0}px`,
|
|
27233
|
+
left: `${tooltipPosition?.left ?? 0}px`,
|
|
27234
|
+
backgroundColor: "#ffffff",
|
|
27235
|
+
color: "#212121",
|
|
27236
|
+
textAlign: "center",
|
|
27237
|
+
borderRadius: 5,
|
|
27238
|
+
zIndex: 100,
|
|
27239
|
+
padding: 10,
|
|
27240
|
+
fontFamily: theme?.fontFamily,
|
|
27241
|
+
fontWeight: 600,
|
|
27242
|
+
fontSize: "small",
|
|
27243
|
+
whiteSpace: "nowrap",
|
|
27244
|
+
borderWidth: 1,
|
|
27245
|
+
borderStyle: "solid",
|
|
27246
|
+
borderColor: "#e7e7e7",
|
|
27247
|
+
boxShadow: "0px 1px 8px rgba(0, 0, 0, 0.07)",
|
|
27248
|
+
...textStyle
|
|
27249
|
+
},
|
|
27250
|
+
children: [
|
|
27251
|
+
text,
|
|
27252
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
27253
|
+
"div",
|
|
27254
|
+
{
|
|
27255
|
+
style: {
|
|
27256
|
+
position: "absolute",
|
|
27257
|
+
top: "100%",
|
|
27258
|
+
left: "50%",
|
|
27259
|
+
marginLeft: -6,
|
|
27260
|
+
borderWidth: 6,
|
|
27261
|
+
borderStyle: "solid",
|
|
27262
|
+
borderColor: "transparent",
|
|
27263
|
+
borderTopColor: "#e7e7e7"
|
|
27264
|
+
}
|
|
27265
|
+
}
|
|
27266
|
+
),
|
|
27267
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
27268
|
+
"div",
|
|
27269
|
+
{
|
|
27270
|
+
style: {
|
|
27271
|
+
position: "absolute",
|
|
27272
|
+
top: "100%",
|
|
27273
|
+
left: "50%",
|
|
27274
|
+
marginLeft: -5,
|
|
27275
|
+
borderWidth: 5,
|
|
27276
|
+
borderStyle: "solid",
|
|
27277
|
+
borderColor: "transparent",
|
|
27278
|
+
borderTopColor: "#ffffff"
|
|
27279
|
+
}
|
|
27280
|
+
}
|
|
27281
|
+
)
|
|
27282
|
+
]
|
|
27283
|
+
}
|
|
27284
|
+
),
|
|
27285
|
+
document.body
|
|
27286
|
+
)
|
|
27287
|
+
]
|
|
27288
|
+
}
|
|
27289
|
+
);
|
|
27290
|
+
};
|
|
26379
27291
|
var QuillChartBuilderCheckboxComponent = ({
|
|
26380
27292
|
isChecked,
|
|
26381
27293
|
label,
|
|
@@ -29428,7 +30340,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
29428
30340
|
);
|
|
29429
30341
|
const potentialOptions = (0, import_react20.useMemo)(() => {
|
|
29430
30342
|
return value.filter((opt) => !optionValues.has(opt ?? "")).map((opt) => ({
|
|
29431
|
-
label: opt === "" ? "-" : opt ?? "-",
|
|
30343
|
+
label: opt === "" ? "-" : opt?.toString() ?? "-",
|
|
29432
30344
|
value: opt ?? ""
|
|
29433
30345
|
})).concat(options);
|
|
29434
30346
|
}, [value, options]);
|
|
@@ -29445,7 +30357,9 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
29445
30357
|
if (matchingOptions.length === options.length && allSelectedLabel) {
|
|
29446
30358
|
return allSelectedLabel;
|
|
29447
30359
|
}
|
|
29448
|
-
return matchingOptions.map(
|
|
30360
|
+
return matchingOptions.map(
|
|
30361
|
+
(elem) => elem.label ?? "-"
|
|
30362
|
+
).join(", ");
|
|
29449
30363
|
}, [options, value]);
|
|
29450
30364
|
const [selectAllCheckboxState, setSelectAllCheckboxState] = (0, import_react20.useState)(
|
|
29451
30365
|
(() => {
|
|
@@ -30171,7 +31085,7 @@ function QuillSelectComponentWithCombo({
|
|
|
30171
31085
|
textOverflow: "ellipsis",
|
|
30172
31086
|
whiteSpace: "nowrap",
|
|
30173
31087
|
overflow: "hidden",
|
|
30174
|
-
fontWeight: value?.length || isLoading ? void 0 : 300
|
|
31088
|
+
fontWeight: value?.toString()?.length || isLoading ? void 0 : 300
|
|
30175
31089
|
},
|
|
30176
31090
|
children: selectedLabel
|
|
30177
31091
|
}
|
|
@@ -30513,6 +31427,51 @@ function DashboardFilter2({
|
|
|
30513
31427
|
]
|
|
30514
31428
|
}
|
|
30515
31429
|
) });
|
|
31430
|
+
} else if (filter.filterType === "tenant") {
|
|
31431
|
+
if (filter.multiSelect) {
|
|
31432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
31433
|
+
QuillMultiSelectComponentWithCombo,
|
|
31434
|
+
{
|
|
31435
|
+
label: filter.label,
|
|
31436
|
+
value: filter.values ?? [],
|
|
31437
|
+
onChange: (e) => {
|
|
31438
|
+
if (Array.isArray(e.target.value) && e.target.value.length === 0) {
|
|
31439
|
+
onChangeFilter(filter, void 0);
|
|
31440
|
+
return;
|
|
31441
|
+
}
|
|
31442
|
+
onChangeFilter(filter, e.target.value);
|
|
31443
|
+
},
|
|
31444
|
+
options: [
|
|
31445
|
+
...filter.options ? filter.options.map((elem) => ({
|
|
31446
|
+
label: elem.label,
|
|
31447
|
+
value: elem.value
|
|
31448
|
+
})) : []
|
|
31449
|
+
],
|
|
31450
|
+
width: 200,
|
|
31451
|
+
isLoading,
|
|
31452
|
+
disabled
|
|
31453
|
+
}
|
|
31454
|
+
) });
|
|
31455
|
+
}
|
|
31456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
31457
|
+
QuillSelectComponentWithCombo,
|
|
31458
|
+
{
|
|
31459
|
+
label: filter.label,
|
|
31460
|
+
value: filter.values?.[0] ?? "",
|
|
31461
|
+
onChange: (e) => {
|
|
31462
|
+
onChangeFilter(filter, e.target.value);
|
|
31463
|
+
},
|
|
31464
|
+
options: [
|
|
31465
|
+
...filter.options ? filter.options.map((elem) => ({
|
|
31466
|
+
label: elem.label,
|
|
31467
|
+
value: elem.value
|
|
31468
|
+
})) : []
|
|
31469
|
+
],
|
|
31470
|
+
width: 200,
|
|
31471
|
+
isLoading,
|
|
31472
|
+
disabled
|
|
31473
|
+
}
|
|
31474
|
+
) });
|
|
30516
31475
|
}
|
|
30517
31476
|
return null;
|
|
30518
31477
|
}
|
|
@@ -33997,11 +34956,13 @@ function Chart({
|
|
|
33997
34956
|
(0, import_react29.useEffect)(() => {
|
|
33998
34957
|
setFilterValues(
|
|
33999
34958
|
Object.values(reportFilters[reportId] ?? {}).reduce((acc, f) => {
|
|
34000
|
-
acc[f.filter.label] = f.filter.filterType === "string" ? f.filter.stringFilterType === "multiselect" ? { values: f.filter.values, operator: "IN" } : { selectedValue: f.filter.selectedValue } : {
|
|
34959
|
+
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" ? {
|
|
34001
34960
|
startDate: f.filter.startDate,
|
|
34002
34961
|
endDate: f.filter.endDate,
|
|
34003
34962
|
preset: f.filter.preset,
|
|
34004
34963
|
comparisonRange: f.filter.comparisonRange
|
|
34964
|
+
} : {
|
|
34965
|
+
values: f.filter.values
|
|
34005
34966
|
};
|
|
34006
34967
|
return acc;
|
|
34007
34968
|
}, {})
|
|
@@ -34125,6 +35086,10 @@ function Chart({
|
|
|
34125
35086
|
}
|
|
34126
35087
|
};
|
|
34127
35088
|
}
|
|
35089
|
+
} else if (filter.filterType === "tenant" /* Tenant */) {
|
|
35090
|
+
filterValue = {
|
|
35091
|
+
values: value ? Array.isArray(value) ? value : [value] : []
|
|
35092
|
+
};
|
|
34128
35093
|
}
|
|
34129
35094
|
setFilterValues((filterValues2) => ({
|
|
34130
35095
|
...filterValues2,
|
|
@@ -34355,7 +35320,8 @@ var ChartDisplay = ({
|
|
|
34355
35320
|
onClickChartElement,
|
|
34356
35321
|
overrideTheme,
|
|
34357
35322
|
referenceLines,
|
|
34358
|
-
showLegend = false
|
|
35323
|
+
showLegend = false,
|
|
35324
|
+
tableRowsLoading = false
|
|
34359
35325
|
}) => {
|
|
34360
35326
|
const { downloadCSV: downloadCSV2 } = useExport(reportId);
|
|
34361
35327
|
const [theme] = (0, import_react29.useContext)(ThemeContext);
|
|
@@ -34450,7 +35416,8 @@ var ChartDisplay = ({
|
|
|
34450
35416
|
},
|
|
34451
35417
|
onSortChange: (sort) => {
|
|
34452
35418
|
onSortChange && onSortChange(sort);
|
|
34453
|
-
}
|
|
35419
|
+
},
|
|
35420
|
+
isLoading: tableRowsLoading
|
|
34454
35421
|
}
|
|
34455
35422
|
);
|
|
34456
35423
|
}
|
|
@@ -36771,11 +37738,13 @@ function Dashboard({
|
|
|
36771
37738
|
(0, import_react37.useEffect)(() => {
|
|
36772
37739
|
setFilterValues(
|
|
36773
37740
|
Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
|
|
36774
|
-
acc[f.label] = f.filterType === "string" ? f.stringFilterType === "multiselect" ? { values: f.values, operator: "IN" } : { selectedValue: f.selectedValue } : {
|
|
37741
|
+
acc[f.label] = f.filterType === "string" ? f.stringFilterType === "multiselect" ? { values: f.values, operator: "IN" } : { selectedValue: f.selectedValue } : f.filterType === "date_range" ? {
|
|
36775
37742
|
startDate: f.startDate,
|
|
36776
37743
|
endDate: f.endDate,
|
|
36777
37744
|
preset: f.preset,
|
|
36778
37745
|
comparisonRange: f.comparisonRange
|
|
37746
|
+
} : {
|
|
37747
|
+
values: f.values
|
|
36779
37748
|
};
|
|
36780
37749
|
return acc;
|
|
36781
37750
|
}, {})
|
|
@@ -36920,6 +37889,10 @@ function Dashboard({
|
|
|
36920
37889
|
}
|
|
36921
37890
|
};
|
|
36922
37891
|
}
|
|
37892
|
+
} else if (filter.filterType === "tenant" /* Tenant */) {
|
|
37893
|
+
filterValue = {
|
|
37894
|
+
values: value ? Array.isArray(value) ? value : [value] : []
|
|
37895
|
+
};
|
|
36923
37896
|
}
|
|
36924
37897
|
setFilterValues((filterValues2) => ({
|
|
36925
37898
|
...filterValues2,
|
|
@@ -40291,6 +41264,10 @@ function InternalChart({
|
|
|
40291
41264
|
}
|
|
40292
41265
|
};
|
|
40293
41266
|
}
|
|
41267
|
+
} else if (filter.filterType === "tenant" /* Tenant */) {
|
|
41268
|
+
filterValue = {
|
|
41269
|
+
values: value ? Array.isArray(value) ? value : [value] : []
|
|
41270
|
+
};
|
|
40294
41271
|
}
|
|
40295
41272
|
setFilterValues((filterValues2) => ({
|
|
40296
41273
|
...filterValues2,
|
|
@@ -41112,6 +42089,7 @@ var ListboxTextInput2 = ({
|
|
|
41112
42089
|
};
|
|
41113
42090
|
|
|
41114
42091
|
// src/ChartBuilder.tsx
|
|
42092
|
+
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
41115
42093
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
41116
42094
|
var CHART_TYPES = [
|
|
41117
42095
|
"column",
|
|
@@ -41558,7 +42536,7 @@ function ChartBuilder({
|
|
|
41558
42536
|
const validFilter = (0, import_react43.useMemo)(() => {
|
|
41559
42537
|
return specificDashboardFilters.reduce(
|
|
41560
42538
|
(acc, filter) => {
|
|
41561
|
-
if (filter.filterType === "date_range") {
|
|
42539
|
+
if (filter.filterType === "date_range" || filter.filterType === "tenant") {
|
|
41562
42540
|
acc[filter.label] = true;
|
|
41563
42541
|
return acc;
|
|
41564
42542
|
}
|
|
@@ -42701,6 +43679,30 @@ function ChartBuilder({
|
|
|
42701
43679
|
setIsSubmitting(false);
|
|
42702
43680
|
setTriggeredEditChart(false);
|
|
42703
43681
|
};
|
|
43682
|
+
const memoizedTooltipText = (0, import_react43.useMemo)(() => {
|
|
43683
|
+
const getTooltipText = () => {
|
|
43684
|
+
if (formData.name === "") {
|
|
43685
|
+
return "Please enter a name for the chart";
|
|
43686
|
+
}
|
|
43687
|
+
if (formData.dashboardName === "") {
|
|
43688
|
+
return "Please select a dashboard";
|
|
43689
|
+
}
|
|
43690
|
+
if (formData.chartType === "") {
|
|
43691
|
+
return "Please select a chart type";
|
|
43692
|
+
}
|
|
43693
|
+
if (filterIssues.length !== 0) {
|
|
43694
|
+
return "Please fix the filter issues";
|
|
43695
|
+
}
|
|
43696
|
+
if (Object.values(validFilter).includes(false)) {
|
|
43697
|
+
return "Please fix the filter issues";
|
|
43698
|
+
}
|
|
43699
|
+
if (currentDashboard?.tenantKeys && customTenantAccess && Object.values(formFlags ?? {}).every((value) => !value.length)) {
|
|
43700
|
+
return "Please fix the tenant issues";
|
|
43701
|
+
}
|
|
43702
|
+
return "";
|
|
43703
|
+
};
|
|
43704
|
+
return getTooltipText();
|
|
43705
|
+
}, [formData, filterIssues, validFilter, formFlags, currentDashboard]);
|
|
42704
43706
|
isHorizontalView = windowWidth < 1200 ? false : isHorizontalView;
|
|
42705
43707
|
if (!schemaData.schema) {
|
|
42706
43708
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: "No schema" });
|
|
@@ -43790,7 +44792,7 @@ function ChartBuilder({
|
|
|
43790
44792
|
})) ?? [],
|
|
43791
44793
|
width: 200,
|
|
43792
44794
|
emptyLabel: dashboardOwner.scope === "database" ? "No tags supplied" : void 0,
|
|
43793
|
-
allSelectedLabel: "All " + dashboardOwner.name
|
|
44795
|
+
allSelectedLabel: "All " + (0, import_pluralize.default)(dashboardOwner.name),
|
|
43794
44796
|
style: {
|
|
43795
44797
|
display: customTenantAccess || containsCustomFields ? "inline" : "none",
|
|
43796
44798
|
marginTop: -1,
|
|
@@ -43815,7 +44817,7 @@ function ChartBuilder({
|
|
|
43815
44817
|
{}
|
|
43816
44818
|
) ?? {},
|
|
43817
44819
|
width: 200,
|
|
43818
|
-
allSelectedLabel: "All " + dashboardOwner.name
|
|
44820
|
+
allSelectedLabel: "All " + (0, import_pluralize.default)(dashboardOwner.name),
|
|
43819
44821
|
style: {
|
|
43820
44822
|
display: customTenantAccess || containsCustomFields ? "inline" : "none",
|
|
43821
44823
|
marginTop: -1,
|
|
@@ -43920,7 +44922,7 @@ function ChartBuilder({
|
|
|
43920
44922
|
gap: 6
|
|
43921
44923
|
},
|
|
43922
44924
|
children: specificDashboardFilters.filter((f) => {
|
|
43923
|
-
return f.filterType
|
|
44925
|
+
return f.filterType === "string";
|
|
43924
44926
|
}).map((filter, index) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(ChartBuilderInputRowContainer, { children: [
|
|
43925
44927
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
43926
44928
|
TextInputComponent,
|
|
@@ -44098,6 +45100,7 @@ function ChartBuilder({
|
|
|
44098
45100
|
disabled: formData.name === "" || formData.dashboardName === "" || formData.chartType === "" || filterIssues.length !== 0 || Object.values(validFilter).includes(false) || currentDashboard?.tenantKeys && customTenantAccess && Object.values(formFlags ?? {}).every(
|
|
44099
45101
|
(value) => !value.length
|
|
44100
45102
|
),
|
|
45103
|
+
tooltipText: memoizedTooltipText,
|
|
44101
45104
|
label: buttonLabel ? buttonLabel : report ? "Save changes" : "Add to dashboard"
|
|
44102
45105
|
}
|
|
44103
45106
|
)
|
|
@@ -50066,7 +51069,8 @@ var SaveReport = ({
|
|
|
50066
51069
|
reportBuilder,
|
|
50067
51070
|
setIsOpen
|
|
50068
51071
|
}
|
|
50069
|
-
)
|
|
51072
|
+
),
|
|
51073
|
+
submitButtonLabel
|
|
50070
51074
|
}) => {
|
|
50071
51075
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { children: [
|
|
50072
51076
|
SaveTrigger,
|
|
@@ -50109,7 +51113,7 @@ var SaveReport = ({
|
|
|
50109
51113
|
FormContainer: ChartBuilderFormContainer,
|
|
50110
51114
|
hideDateRangeFilter: true,
|
|
50111
51115
|
hideDeleteButton: true,
|
|
50112
|
-
buttonLabel: !!reportBuilder.reportId ? "Save changes" : "Add to dashboard",
|
|
51116
|
+
buttonLabel: submitButtonLabel ?? (!!reportBuilder.reportId ? "Save changes" : "Add to dashboard"),
|
|
50113
51117
|
onClickChartElement,
|
|
50114
51118
|
isEditingMode: true
|
|
50115
51119
|
}
|
|
@@ -50208,7 +51212,8 @@ function ReportBuilder({
|
|
|
50208
51212
|
hideCopySQL = true,
|
|
50209
51213
|
isChartBuilderHorizontalView = true,
|
|
50210
51214
|
onClickChartElement,
|
|
50211
|
-
onRequestAddVirtualTable
|
|
51215
|
+
onRequestAddVirtualTable,
|
|
51216
|
+
submitButtonLabel
|
|
50212
51217
|
}) {
|
|
50213
51218
|
const [theme] = (0, import_react53.useContext)(ThemeContext);
|
|
50214
51219
|
const parentRef = (0, import_react53.useRef)(null);
|
|
@@ -50596,7 +51601,7 @@ function ReportBuilder({
|
|
|
50596
51601
|
setIsChartBuilderOpen(true);
|
|
50597
51602
|
},
|
|
50598
51603
|
disabled: !!errorMessage || !!pivotError || tableLoading || loading || !!unresolvedReportMessage,
|
|
50599
|
-
label: reportId ? "Save changes" : "Add to dashboard",
|
|
51604
|
+
label: submitButtonLabel ?? (reportId ? "Save changes" : "Add to dashboard"),
|
|
50600
51605
|
tooltipText: unresolvedReportMessage
|
|
50601
51606
|
}
|
|
50602
51607
|
)
|
|
@@ -50642,7 +51647,8 @@ function ReportBuilder({
|
|
|
50642
51647
|
ErrorMessageComponent,
|
|
50643
51648
|
PivotRowContainer,
|
|
50644
51649
|
PivotColumnContainer,
|
|
50645
|
-
onClickChartElement
|
|
51650
|
+
onClickChartElement,
|
|
51651
|
+
submitButtonLabel
|
|
50646
51652
|
}
|
|
50647
51653
|
),
|
|
50648
51654
|
isSaveQueryModalOpen && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -50898,11 +51904,32 @@ function StaticChart({
|
|
|
50898
51904
|
containerStyle,
|
|
50899
51905
|
showLegend = false
|
|
50900
51906
|
}) {
|
|
50901
|
-
const {
|
|
51907
|
+
const {
|
|
51908
|
+
report,
|
|
51909
|
+
loading,
|
|
51910
|
+
pageNumber,
|
|
51911
|
+
pageLoading,
|
|
51912
|
+
nextPage,
|
|
51913
|
+
prevPage,
|
|
51914
|
+
sortRows
|
|
51915
|
+
} = useDashboardReportInternal(reportId);
|
|
50902
51916
|
const mergedStyle = {
|
|
50903
51917
|
...report?.chartType ? CHART_TYPE_STYLES[report.chartType] || DEFAULT_STYLE : DEFAULT_STYLE,
|
|
50904
51918
|
...containerStyle
|
|
50905
51919
|
};
|
|
51920
|
+
const onPageChange = (page) => {
|
|
51921
|
+
if (page == pageNumber - 1) {
|
|
51922
|
+
prevPage();
|
|
51923
|
+
} else if (page == pageNumber + 1) {
|
|
51924
|
+
nextPage();
|
|
51925
|
+
}
|
|
51926
|
+
};
|
|
51927
|
+
const onSortChange = (sort) => {
|
|
51928
|
+
sortRows({
|
|
51929
|
+
field: sort.field,
|
|
51930
|
+
direction: sort.direction
|
|
51931
|
+
});
|
|
51932
|
+
};
|
|
50906
51933
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
50907
51934
|
ChartDisplay,
|
|
50908
51935
|
{
|
|
@@ -50914,36 +51941,77 @@ function StaticChart({
|
|
|
50914
51941
|
onClickChartElement,
|
|
50915
51942
|
loading,
|
|
50916
51943
|
containerStyle: mergedStyle,
|
|
50917
|
-
showLegend
|
|
51944
|
+
showLegend,
|
|
51945
|
+
onPageChange,
|
|
51946
|
+
tableRowsLoading: pageLoading,
|
|
51947
|
+
onSortChange
|
|
50918
51948
|
}
|
|
50919
51949
|
);
|
|
50920
51950
|
}
|
|
50921
51951
|
|
|
50922
|
-
// src/hooks/
|
|
51952
|
+
// src/hooks/useTenants.ts
|
|
50923
51953
|
var import_react55 = require("react");
|
|
51954
|
+
var useTenants = (dashboardName) => {
|
|
51955
|
+
const {
|
|
51956
|
+
tenants,
|
|
51957
|
+
flags,
|
|
51958
|
+
childTenantMappings,
|
|
51959
|
+
viewerTenants,
|
|
51960
|
+
isLoadingMappedTenants,
|
|
51961
|
+
isLoadingViewerTenants,
|
|
51962
|
+
fetchViewerTenantsForDashboard,
|
|
51963
|
+
fetchMappedTenantsForDashboard,
|
|
51964
|
+
getMappedTenantsForDashboard,
|
|
51965
|
+
getViewerTenantsByOwner
|
|
51966
|
+
} = (0, import_react55.useContext)(TenantContext);
|
|
51967
|
+
(0, import_react55.useEffect)(() => {
|
|
51968
|
+
if (dashboardName) {
|
|
51969
|
+
fetchViewerTenantsForDashboard(dashboardName);
|
|
51970
|
+
}
|
|
51971
|
+
}, [dashboardName, fetchViewerTenantsForDashboard]);
|
|
51972
|
+
(0, import_react55.useEffect)(() => {
|
|
51973
|
+
if (dashboardName) {
|
|
51974
|
+
fetchMappedTenantsForDashboard(dashboardName);
|
|
51975
|
+
}
|
|
51976
|
+
}, [dashboardName, fetchMappedTenantsForDashboard]);
|
|
51977
|
+
return {
|
|
51978
|
+
tenants,
|
|
51979
|
+
flags,
|
|
51980
|
+
childTenantMappings: dashboardName ? childTenantMappings[dashboardName] || {} : {},
|
|
51981
|
+
mappedTenants: dashboardName ? childTenantMappings[dashboardName] || {} : {},
|
|
51982
|
+
viewerTenants: dashboardName ? viewerTenants[dashboardName] || [] : [],
|
|
51983
|
+
isLoadingMappedTenants,
|
|
51984
|
+
isLoadingViewerTenants,
|
|
51985
|
+
getMappedTenantsForDashboard,
|
|
51986
|
+
getViewerTenantsByOwner
|
|
51987
|
+
};
|
|
51988
|
+
};
|
|
51989
|
+
|
|
51990
|
+
// src/hooks/useQuill.ts
|
|
51991
|
+
var import_react56 = require("react");
|
|
50924
51992
|
var useQuill = (reportId, pagination) => {
|
|
50925
|
-
const { reports, reportsDispatch, fetchIndividualReport } = (0,
|
|
51993
|
+
const { reports, reportsDispatch, fetchIndividualReport } = (0, import_react56.useContext)(ReportsContext);
|
|
50926
51994
|
const { allReportsById } = useAllReports();
|
|
50927
|
-
const { getToken } = (0,
|
|
50928
|
-
const dashboardReport = (0,
|
|
51995
|
+
const { getToken } = (0, import_react56.useContext)(FetchContext);
|
|
51996
|
+
const dashboardReport = (0, import_react56.useMemo)(() => {
|
|
50929
51997
|
return allReportsById[reportId ?? ""];
|
|
50930
51998
|
}, [allReportsById[reportId ?? ""]]);
|
|
50931
|
-
const { dashboardFilters, dashboardCustomFilters } = (0,
|
|
51999
|
+
const { dashboardFilters, dashboardCustomFilters } = (0, import_react56.useContext)(
|
|
50932
52000
|
DashboardFiltersContext
|
|
50933
52001
|
);
|
|
50934
|
-
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0,
|
|
50935
|
-
const specificReportFilters = (0,
|
|
52002
|
+
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0, import_react56.useContext)(ReportFiltersContext);
|
|
52003
|
+
const specificReportFilters = (0, import_react56.useMemo)(() => {
|
|
50936
52004
|
if (!reportId) return null;
|
|
50937
52005
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
50938
52006
|
}, [reportFilters, reportId]);
|
|
50939
|
-
const [schemaData] = (0,
|
|
50940
|
-
const [client, isClientLoading] = (0,
|
|
50941
|
-
const { tenants } = (0,
|
|
50942
|
-
const { eventTracking } = (0,
|
|
50943
|
-
const [loading, setLoading] = (0,
|
|
50944
|
-
const [error, setError] = (0,
|
|
50945
|
-
const [previousPage, setPreviousPage] = (0,
|
|
50946
|
-
const processedReport = (0,
|
|
52007
|
+
const [schemaData] = (0, import_react56.useContext)(SchemaDataContext);
|
|
52008
|
+
const [client, isClientLoading] = (0, import_react56.useContext)(ClientContext);
|
|
52009
|
+
const { tenants } = (0, import_react56.useContext)(TenantContext);
|
|
52010
|
+
const { eventTracking } = (0, import_react56.useContext)(EventTrackingContext);
|
|
52011
|
+
const [loading, setLoading] = (0, import_react56.useState)(true);
|
|
52012
|
+
const [error, setError] = (0, import_react56.useState)(void 0);
|
|
52013
|
+
const [previousPage, setPreviousPage] = (0, import_react56.useState)(0);
|
|
52014
|
+
const processedReport = (0, import_react56.useMemo)(() => {
|
|
50947
52015
|
return reportId && allReportsById[reportId] ? convertInternalReportToReport(
|
|
50948
52016
|
mergeComparisonRange(allReportsById[reportId]),
|
|
50949
52017
|
specificReportFilters ?? [],
|
|
@@ -50951,7 +52019,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
50951
52019
|
"useQuill"
|
|
50952
52020
|
) : void 0;
|
|
50953
52021
|
}, [reportId, reportId && allReportsById[reportId], specificReportFilters]);
|
|
50954
|
-
const [additionalProcessing, setAdditionProcessing] = (0,
|
|
52022
|
+
const [additionalProcessing, setAdditionProcessing] = (0, import_react56.useState)(
|
|
50955
52023
|
pagination ? {
|
|
50956
52024
|
page: pagination
|
|
50957
52025
|
} : void 0
|
|
@@ -51100,7 +52168,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
51100
52168
|
setLoading(false);
|
|
51101
52169
|
}
|
|
51102
52170
|
};
|
|
51103
|
-
(0,
|
|
52171
|
+
(0, import_react56.useEffect)(() => {
|
|
51104
52172
|
if (isClientLoading) return;
|
|
51105
52173
|
if (reportId && specificReportFilters) {
|
|
51106
52174
|
fetchReportHelper(reportId, {
|
|
@@ -51139,10 +52207,10 @@ var useQuill = (reportId, pagination) => {
|
|
|
51139
52207
|
};
|
|
51140
52208
|
|
|
51141
52209
|
// src/hooks/useFormat.ts
|
|
51142
|
-
var
|
|
52210
|
+
var import_react57 = require("react");
|
|
51143
52211
|
var useMemoizedRows = (reportId) => {
|
|
51144
52212
|
const { data } = useQuill(reportId);
|
|
51145
|
-
const formattedRows = (0,
|
|
52213
|
+
const formattedRows = (0, import_react57.useMemo)(() => {
|
|
51146
52214
|
if (!data || !data.rows || !data.columns)
|
|
51147
52215
|
return { rows: [], loading: true };
|
|
51148
52216
|
return {
|
|
@@ -51166,7 +52234,7 @@ var useMemoizedRows = (reportId) => {
|
|
|
51166
52234
|
};
|
|
51167
52235
|
|
|
51168
52236
|
// src/hooks/useAskQuill.tsx
|
|
51169
|
-
var
|
|
52237
|
+
var import_react58 = require("react");
|
|
51170
52238
|
function convertColumnInternalToAskQuillColumn(columns) {
|
|
51171
52239
|
return columns.map((column) => {
|
|
51172
52240
|
let convertedFieldType = FieldType.String;
|
|
@@ -51190,13 +52258,13 @@ function convertColumnInternalToAskQuillColumn(columns) {
|
|
|
51190
52258
|
});
|
|
51191
52259
|
}
|
|
51192
52260
|
var useAskQuill = (dashboardName) => {
|
|
51193
|
-
const [client] = (0,
|
|
51194
|
-
const [schemaData] = (0,
|
|
51195
|
-
const { tenants } = (0,
|
|
51196
|
-
const { getToken } = (0,
|
|
51197
|
-
const { eventTracking } = (0,
|
|
51198
|
-
const [astInfo, setAstInfo] = (0,
|
|
51199
|
-
const [data, setData] = (0,
|
|
52261
|
+
const [client] = (0, import_react58.useContext)(ClientContext);
|
|
52262
|
+
const [schemaData] = (0, import_react58.useContext)(SchemaDataContext);
|
|
52263
|
+
const { tenants } = (0, import_react58.useContext)(TenantContext);
|
|
52264
|
+
const { getToken } = (0, import_react58.useContext)(FetchContext);
|
|
52265
|
+
const { eventTracking } = (0, import_react58.useContext)(EventTrackingContext);
|
|
52266
|
+
const [astInfo, setAstInfo] = (0, import_react58.useState)(void 0);
|
|
52267
|
+
const [data, setData] = (0, import_react58.useState)({
|
|
51200
52268
|
rows: [],
|
|
51201
52269
|
columns: [],
|
|
51202
52270
|
pivot: null,
|
|
@@ -51206,9 +52274,9 @@ var useAskQuill = (dashboardName) => {
|
|
|
51206
52274
|
pivotColumnFields: [],
|
|
51207
52275
|
pivotValueFields: []
|
|
51208
52276
|
});
|
|
51209
|
-
const [loading, setLoading] = (0,
|
|
51210
|
-
const [error, setError] = (0,
|
|
51211
|
-
const [ask, setAsk] = (0,
|
|
52277
|
+
const [loading, setLoading] = (0, import_react58.useState)(false);
|
|
52278
|
+
const [error, setError] = (0, import_react58.useState)(void 0);
|
|
52279
|
+
const [ask, setAsk] = (0, import_react58.useState)(
|
|
51212
52280
|
async () => void 0
|
|
51213
52281
|
);
|
|
51214
52282
|
const askHelper = async (query) => {
|
|
@@ -51408,7 +52476,7 @@ var useAskQuill = (dashboardName) => {
|
|
|
51408
52476
|
});
|
|
51409
52477
|
setLoading(false);
|
|
51410
52478
|
};
|
|
51411
|
-
(0,
|
|
52479
|
+
(0, import_react58.useEffect)(() => {
|
|
51412
52480
|
setAsk(() => askHelper);
|
|
51413
52481
|
}, [schemaData.schema]);
|
|
51414
52482
|
return {
|
|
@@ -51422,13 +52490,13 @@ var useAskQuill = (dashboardName) => {
|
|
|
51422
52490
|
};
|
|
51423
52491
|
|
|
51424
52492
|
// src/hooks/useVirtualTables.tsx
|
|
51425
|
-
var
|
|
52493
|
+
var import_react59 = require("react");
|
|
51426
52494
|
var useVirtualTables = () => {
|
|
51427
|
-
const [schemaData, setSchemaData] = (0,
|
|
51428
|
-
const { tenants } = (0,
|
|
51429
|
-
const { getToken, quillFetchWithToken } = (0,
|
|
51430
|
-
const { eventTracking } = (0,
|
|
51431
|
-
const [loadingTables, setLoadingTables] = (0,
|
|
52495
|
+
const [schemaData, setSchemaData] = (0, import_react59.useContext)(SchemaDataContext);
|
|
52496
|
+
const { tenants } = (0, import_react59.useContext)(TenantContext);
|
|
52497
|
+
const { getToken, quillFetchWithToken } = (0, import_react59.useContext)(FetchContext);
|
|
52498
|
+
const { eventTracking } = (0, import_react59.useContext)(EventTrackingContext);
|
|
52499
|
+
const [loadingTables, setLoadingTables] = (0, import_react59.useState)({});
|
|
51432
52500
|
const handleReload = async (client, caller) => {
|
|
51433
52501
|
setSchemaData({ ...schemaData, isSchemaLoading: true });
|
|
51434
52502
|
setLoadingTables(
|
|
@@ -51597,5 +52665,6 @@ var useVirtualTables = () => {
|
|
|
51597
52665
|
useQuill,
|
|
51598
52666
|
useReportBuilder,
|
|
51599
52667
|
useReports,
|
|
52668
|
+
useTenants,
|
|
51600
52669
|
useVirtualTables
|
|
51601
52670
|
});
|