@bygd/nc-report-ui 0.1.10 → 0.1.11

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.
@@ -11338,6 +11338,18 @@ const apiClient = axios.create({
11338
11338
  'Content-Type': 'application/json'
11339
11339
  }
11340
11340
  });
11341
+
11342
+ // Cache for dashboard metadata
11343
+ const dashboardMetaCache = {};
11344
+
11345
+ /**
11346
+ * Helper function to get the first available dashboard ID from cache
11347
+ * @returns {string|null} First dashboard ID or null if cache is empty
11348
+ */
11349
+ const getFirstCachedDashboardId = () => {
11350
+ const cachedIds = Object.keys(dashboardMetaCache);
11351
+ return cachedIds.length > 0 ? cachedIds[0] : null;
11352
+ };
11341
11353
  const Api = {
11342
11354
  setAuth(auth) {
11343
11355
  this.auth = auth;
@@ -11346,9 +11358,42 @@ const Api = {
11346
11358
  if (!accessToken) return;
11347
11359
  apiClient.defaults.headers.common['Authorization'] = `Bearer ${accessToken}`;
11348
11360
  },
11361
+ /**
11362
+ * Load and cache dashboard metadata
11363
+ * @param {Object} params - Parameters object
11364
+ * @param {string} params.dashboardId - Dashboard ID
11365
+ * @returns {Promise} Dashboard metadata object
11366
+ */
11367
+ loadDashboardMeta: async ({
11368
+ dashboardId
11369
+ }) => {
11370
+ const {
11371
+ data
11372
+ } = await apiClient.get(`/dashboard-meta/${dashboardId}`);
11373
+
11374
+ // Cache the metadata
11375
+ dashboardMetaCache[dashboardId] = {
11376
+ dashboards: data.dashboards || {},
11377
+ charts: data.charts || {},
11378
+ reports: data.reports || {},
11379
+ reportMetadata: data.reportMetadata || {},
11380
+ dateRanges: data.dateRanges || []
11381
+ };
11382
+ return dashboardMetaCache[dashboardId];
11383
+ },
11349
11384
  getDashboard: async ({
11350
- id
11385
+ id,
11386
+ dashboardId
11351
11387
  }) => {
11388
+ // Use provided dashboardId or fall back to first cached dashboard
11389
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
11390
+
11391
+ // Check cache first
11392
+ if (cacheKey && dashboardMetaCache[cacheKey]?.dashboards?.[id]) {
11393
+ return dashboardMetaCache[cacheKey].dashboards[id];
11394
+ }
11395
+
11396
+ // Fall back to HTTP request
11352
11397
  const {
11353
11398
  data
11354
11399
  } = await apiClient.get(`/entity/dashboards/${id}`);
@@ -11358,11 +11403,22 @@ const Api = {
11358
11403
  * Get chart by ID
11359
11404
  * @param {Object} params - Parameters object
11360
11405
  * @param {string} params.id - Chart ID
11406
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
11361
11407
  * @returns {Promise} Axios response promise
11362
11408
  */
11363
11409
  getChart: async ({
11364
- id
11410
+ id,
11411
+ dashboardId
11365
11412
  }) => {
11413
+ // Use provided dashboardId or fall back to first cached dashboard
11414
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
11415
+
11416
+ // Check cache first
11417
+ if (cacheKey && dashboardMetaCache[cacheKey]?.charts?.[id]) {
11418
+ return dashboardMetaCache[cacheKey].charts[id];
11419
+ }
11420
+
11421
+ // Fall back to HTTP request
11366
11422
  const {
11367
11423
  data
11368
11424
  } = await apiClient.get(`/entity/charts/${id}`);
@@ -11372,11 +11428,22 @@ const Api = {
11372
11428
  * Get report by ID
11373
11429
  * @param {Object} params - Parameters object
11374
11430
  * @param {string} params.id - Report ID
11431
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
11375
11432
  * @returns {Promise} Axios response promise
11376
11433
  */
11377
11434
  getReport: async ({
11378
- id
11435
+ id,
11436
+ dashboardId
11379
11437
  }) => {
11438
+ // Use provided dashboardId or fall back to first cached dashboard
11439
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
11440
+
11441
+ // Check cache first
11442
+ if (cacheKey && dashboardMetaCache[cacheKey]?.reports?.[id]) {
11443
+ return dashboardMetaCache[cacheKey].reports[id];
11444
+ }
11445
+
11446
+ // Fall back to HTTP request
11380
11447
  const {
11381
11448
  data
11382
11449
  } = await apiClient.get(`/entity/reports/${id}`);
@@ -11386,12 +11453,23 @@ const Api = {
11386
11453
  * Get report schema/metadata by ID
11387
11454
  * @param {Object} params - Parameters object
11388
11455
  * @param {string} params.id - Report ID
11456
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
11389
11457
  * @returns {Promise} Axios response promise
11390
11458
  */
11391
11459
  getReportSchema: async ({
11392
11460
  id,
11461
+ dashboardId,
11393
11462
  query = {}
11394
11463
  }) => {
11464
+ // Use provided dashboardId or fall back to first cached dashboard
11465
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
11466
+
11467
+ // Check cache first
11468
+ if (cacheKey && dashboardMetaCache[cacheKey]?.reportMetadata?.[id]) {
11469
+ return dashboardMetaCache[cacheKey].reportMetadata[id];
11470
+ }
11471
+
11472
+ // Fall back to HTTP request
11395
11473
  // console.log({getReportSchema:{id,query}});
11396
11474
  const {
11397
11475
  data
@@ -11416,7 +11494,18 @@ const Api = {
11416
11494
  } = await apiClient.post(`/reports/${id}/run`, query);
11417
11495
  return data;
11418
11496
  },
11419
- getDateRanges: async () => {
11497
+ getDateRanges: async ({
11498
+ dashboardId
11499
+ } = {}) => {
11500
+ // Use provided dashboardId or fall back to first cached dashboard
11501
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
11502
+
11503
+ // Check cache first
11504
+ if (cacheKey && dashboardMetaCache[cacheKey]?.dateRanges) {
11505
+ return dashboardMetaCache[cacheKey].dateRanges;
11506
+ }
11507
+
11508
+ // Fall back to HTTP request
11420
11509
  const {
11421
11510
  data
11422
11511
  } = await apiClient.get(`/globals/date-ranges`);
@@ -45034,6 +45123,9 @@ function Dashboard({
45034
45123
  useFilterManager(channel);
45035
45124
  const init = async () => {
45036
45125
  Api.setAuth(auth);
45126
+ await Api.loadDashboardMeta({
45127
+ dashboardId: id
45128
+ });
45037
45129
 
45038
45130
  // get dashboard entity
45039
45131
  const dashboardTemp = await Api.getDashboard({
@@ -142,6 +142,18 @@ const apiClient = axios__default.default.create({
142
142
  'Content-Type': 'application/json'
143
143
  }
144
144
  });
145
+
146
+ // Cache for dashboard metadata
147
+ const dashboardMetaCache = {};
148
+
149
+ /**
150
+ * Helper function to get the first available dashboard ID from cache
151
+ * @returns {string|null} First dashboard ID or null if cache is empty
152
+ */
153
+ const getFirstCachedDashboardId = () => {
154
+ const cachedIds = Object.keys(dashboardMetaCache);
155
+ return cachedIds.length > 0 ? cachedIds[0] : null;
156
+ };
145
157
  const Api = {
146
158
  setAuth(auth) {
147
159
  this.auth = auth;
@@ -150,9 +162,42 @@ const Api = {
150
162
  if (!accessToken) return;
151
163
  apiClient.defaults.headers.common['Authorization'] = `Bearer ${accessToken}`;
152
164
  },
165
+ /**
166
+ * Load and cache dashboard metadata
167
+ * @param {Object} params - Parameters object
168
+ * @param {string} params.dashboardId - Dashboard ID
169
+ * @returns {Promise} Dashboard metadata object
170
+ */
171
+ loadDashboardMeta: async ({
172
+ dashboardId
173
+ }) => {
174
+ const {
175
+ data
176
+ } = await apiClient.get(`/dashboard-meta/${dashboardId}`);
177
+
178
+ // Cache the metadata
179
+ dashboardMetaCache[dashboardId] = {
180
+ dashboards: data.dashboards || {},
181
+ charts: data.charts || {},
182
+ reports: data.reports || {},
183
+ reportMetadata: data.reportMetadata || {},
184
+ dateRanges: data.dateRanges || []
185
+ };
186
+ return dashboardMetaCache[dashboardId];
187
+ },
153
188
  getDashboard: async ({
154
- id
189
+ id,
190
+ dashboardId
155
191
  }) => {
192
+ // Use provided dashboardId or fall back to first cached dashboard
193
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
194
+
195
+ // Check cache first
196
+ if (cacheKey && dashboardMetaCache[cacheKey]?.dashboards?.[id]) {
197
+ return dashboardMetaCache[cacheKey].dashboards[id];
198
+ }
199
+
200
+ // Fall back to HTTP request
156
201
  const {
157
202
  data
158
203
  } = await apiClient.get(`/entity/dashboards/${id}`);
@@ -162,11 +207,22 @@ const Api = {
162
207
  * Get chart by ID
163
208
  * @param {Object} params - Parameters object
164
209
  * @param {string} params.id - Chart ID
210
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
165
211
  * @returns {Promise} Axios response promise
166
212
  */
167
213
  getChart: async ({
168
- id
214
+ id,
215
+ dashboardId
169
216
  }) => {
217
+ // Use provided dashboardId or fall back to first cached dashboard
218
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
219
+
220
+ // Check cache first
221
+ if (cacheKey && dashboardMetaCache[cacheKey]?.charts?.[id]) {
222
+ return dashboardMetaCache[cacheKey].charts[id];
223
+ }
224
+
225
+ // Fall back to HTTP request
170
226
  const {
171
227
  data
172
228
  } = await apiClient.get(`/entity/charts/${id}`);
@@ -176,11 +232,22 @@ const Api = {
176
232
  * Get report by ID
177
233
  * @param {Object} params - Parameters object
178
234
  * @param {string} params.id - Report ID
235
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
179
236
  * @returns {Promise} Axios response promise
180
237
  */
181
238
  getReport: async ({
182
- id
239
+ id,
240
+ dashboardId
183
241
  }) => {
242
+ // Use provided dashboardId or fall back to first cached dashboard
243
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
244
+
245
+ // Check cache first
246
+ if (cacheKey && dashboardMetaCache[cacheKey]?.reports?.[id]) {
247
+ return dashboardMetaCache[cacheKey].reports[id];
248
+ }
249
+
250
+ // Fall back to HTTP request
184
251
  const {
185
252
  data
186
253
  } = await apiClient.get(`/entity/reports/${id}`);
@@ -190,12 +257,23 @@ const Api = {
190
257
  * Get report schema/metadata by ID
191
258
  * @param {Object} params - Parameters object
192
259
  * @param {string} params.id - Report ID
260
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
193
261
  * @returns {Promise} Axios response promise
194
262
  */
195
263
  getReportSchema: async ({
196
264
  id,
265
+ dashboardId,
197
266
  query = {}
198
267
  }) => {
268
+ // Use provided dashboardId or fall back to first cached dashboard
269
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
270
+
271
+ // Check cache first
272
+ if (cacheKey && dashboardMetaCache[cacheKey]?.reportMetadata?.[id]) {
273
+ return dashboardMetaCache[cacheKey].reportMetadata[id];
274
+ }
275
+
276
+ // Fall back to HTTP request
199
277
  // console.log({getReportSchema:{id,query}});
200
278
  const {
201
279
  data
@@ -220,7 +298,18 @@ const Api = {
220
298
  } = await apiClient.post(`/reports/${id}/run`, query);
221
299
  return data;
222
300
  },
223
- getDateRanges: async () => {
301
+ getDateRanges: async ({
302
+ dashboardId
303
+ } = {}) => {
304
+ // Use provided dashboardId or fall back to first cached dashboard
305
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
306
+
307
+ // Check cache first
308
+ if (cacheKey && dashboardMetaCache[cacheKey]?.dateRanges) {
309
+ return dashboardMetaCache[cacheKey].dateRanges;
310
+ }
311
+
312
+ // Fall back to HTTP request
224
313
  const {
225
314
  data
226
315
  } = await apiClient.get(`/globals/date-ranges`);
@@ -997,6 +1086,9 @@ function Dashboard({
997
1086
  useFilterManager(channel);
998
1087
  const init = async () => {
999
1088
  Api.setAuth(auth);
1089
+ await Api.loadDashboardMeta({
1090
+ dashboardId: id
1091
+ });
1000
1092
 
1001
1093
  // get dashboard entity
1002
1094
  const dashboardTemp = await Api.getDashboard({
@@ -98,6 +98,18 @@ const apiClient = axios.create({
98
98
  'Content-Type': 'application/json'
99
99
  }
100
100
  });
101
+
102
+ // Cache for dashboard metadata
103
+ const dashboardMetaCache = {};
104
+
105
+ /**
106
+ * Helper function to get the first available dashboard ID from cache
107
+ * @returns {string|null} First dashboard ID or null if cache is empty
108
+ */
109
+ const getFirstCachedDashboardId = () => {
110
+ const cachedIds = Object.keys(dashboardMetaCache);
111
+ return cachedIds.length > 0 ? cachedIds[0] : null;
112
+ };
101
113
  const Api = {
102
114
  setAuth(auth) {
103
115
  this.auth = auth;
@@ -106,9 +118,42 @@ const Api = {
106
118
  if (!accessToken) return;
107
119
  apiClient.defaults.headers.common['Authorization'] = `Bearer ${accessToken}`;
108
120
  },
121
+ /**
122
+ * Load and cache dashboard metadata
123
+ * @param {Object} params - Parameters object
124
+ * @param {string} params.dashboardId - Dashboard ID
125
+ * @returns {Promise} Dashboard metadata object
126
+ */
127
+ loadDashboardMeta: async ({
128
+ dashboardId
129
+ }) => {
130
+ const {
131
+ data
132
+ } = await apiClient.get(`/dashboard-meta/${dashboardId}`);
133
+
134
+ // Cache the metadata
135
+ dashboardMetaCache[dashboardId] = {
136
+ dashboards: data.dashboards || {},
137
+ charts: data.charts || {},
138
+ reports: data.reports || {},
139
+ reportMetadata: data.reportMetadata || {},
140
+ dateRanges: data.dateRanges || []
141
+ };
142
+ return dashboardMetaCache[dashboardId];
143
+ },
109
144
  getDashboard: async ({
110
- id
145
+ id,
146
+ dashboardId
111
147
  }) => {
148
+ // Use provided dashboardId or fall back to first cached dashboard
149
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
150
+
151
+ // Check cache first
152
+ if (cacheKey && dashboardMetaCache[cacheKey]?.dashboards?.[id]) {
153
+ return dashboardMetaCache[cacheKey].dashboards[id];
154
+ }
155
+
156
+ // Fall back to HTTP request
112
157
  const {
113
158
  data
114
159
  } = await apiClient.get(`/entity/dashboards/${id}`);
@@ -118,11 +163,22 @@ const Api = {
118
163
  * Get chart by ID
119
164
  * @param {Object} params - Parameters object
120
165
  * @param {string} params.id - Chart ID
166
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
121
167
  * @returns {Promise} Axios response promise
122
168
  */
123
169
  getChart: async ({
124
- id
170
+ id,
171
+ dashboardId
125
172
  }) => {
173
+ // Use provided dashboardId or fall back to first cached dashboard
174
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
175
+
176
+ // Check cache first
177
+ if (cacheKey && dashboardMetaCache[cacheKey]?.charts?.[id]) {
178
+ return dashboardMetaCache[cacheKey].charts[id];
179
+ }
180
+
181
+ // Fall back to HTTP request
126
182
  const {
127
183
  data
128
184
  } = await apiClient.get(`/entity/charts/${id}`);
@@ -132,11 +188,22 @@ const Api = {
132
188
  * Get report by ID
133
189
  * @param {Object} params - Parameters object
134
190
  * @param {string} params.id - Report ID
191
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
135
192
  * @returns {Promise} Axios response promise
136
193
  */
137
194
  getReport: async ({
138
- id
195
+ id,
196
+ dashboardId
139
197
  }) => {
198
+ // Use provided dashboardId or fall back to first cached dashboard
199
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
200
+
201
+ // Check cache first
202
+ if (cacheKey && dashboardMetaCache[cacheKey]?.reports?.[id]) {
203
+ return dashboardMetaCache[cacheKey].reports[id];
204
+ }
205
+
206
+ // Fall back to HTTP request
140
207
  const {
141
208
  data
142
209
  } = await apiClient.get(`/entity/reports/${id}`);
@@ -146,12 +213,23 @@ const Api = {
146
213
  * Get report schema/metadata by ID
147
214
  * @param {Object} params - Parameters object
148
215
  * @param {string} params.id - Report ID
216
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
149
217
  * @returns {Promise} Axios response promise
150
218
  */
151
219
  getReportSchema: async ({
152
220
  id,
221
+ dashboardId,
153
222
  query = {}
154
223
  }) => {
224
+ // Use provided dashboardId or fall back to first cached dashboard
225
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
226
+
227
+ // Check cache first
228
+ if (cacheKey && dashboardMetaCache[cacheKey]?.reportMetadata?.[id]) {
229
+ return dashboardMetaCache[cacheKey].reportMetadata[id];
230
+ }
231
+
232
+ // Fall back to HTTP request
155
233
  // console.log({getReportSchema:{id,query}});
156
234
  const {
157
235
  data
@@ -176,7 +254,18 @@ const Api = {
176
254
  } = await apiClient.post(`/reports/${id}/run`, query);
177
255
  return data;
178
256
  },
179
- getDateRanges: async () => {
257
+ getDateRanges: async ({
258
+ dashboardId
259
+ } = {}) => {
260
+ // Use provided dashboardId or fall back to first cached dashboard
261
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
262
+
263
+ // Check cache first
264
+ if (cacheKey && dashboardMetaCache[cacheKey]?.dateRanges) {
265
+ return dashboardMetaCache[cacheKey].dateRanges;
266
+ }
267
+
268
+ // Fall back to HTTP request
180
269
  const {
181
270
  data
182
271
  } = await apiClient.get(`/globals/date-ranges`);
@@ -953,6 +1042,9 @@ function Dashboard({
953
1042
  useFilterManager(channel);
954
1043
  const init = async () => {
955
1044
  Api.setAuth(auth);
1045
+ await Api.loadDashboardMeta({
1046
+ dashboardId: id
1047
+ });
956
1048
 
957
1049
  // get dashboard entity
958
1050
  const dashboardTemp = await Api.getDashboard({
@@ -10913,6 +10913,18 @@ var _BYGD_NC_REPORT_UI = (function () {
10913
10913
  'Content-Type': 'application/json'
10914
10914
  }
10915
10915
  });
10916
+
10917
+ // Cache for dashboard metadata
10918
+ const dashboardMetaCache = {};
10919
+
10920
+ /**
10921
+ * Helper function to get the first available dashboard ID from cache
10922
+ * @returns {string|null} First dashboard ID or null if cache is empty
10923
+ */
10924
+ const getFirstCachedDashboardId = () => {
10925
+ const cachedIds = Object.keys(dashboardMetaCache);
10926
+ return cachedIds.length > 0 ? cachedIds[0] : null;
10927
+ };
10916
10928
  const Api = {
10917
10929
  setAuth(auth) {
10918
10930
  this.auth = auth;
@@ -10921,9 +10933,42 @@ var _BYGD_NC_REPORT_UI = (function () {
10921
10933
  if (!accessToken) return;
10922
10934
  apiClient.defaults.headers.common['Authorization'] = `Bearer ${accessToken}`;
10923
10935
  },
10936
+ /**
10937
+ * Load and cache dashboard metadata
10938
+ * @param {Object} params - Parameters object
10939
+ * @param {string} params.dashboardId - Dashboard ID
10940
+ * @returns {Promise} Dashboard metadata object
10941
+ */
10942
+ loadDashboardMeta: async ({
10943
+ dashboardId
10944
+ }) => {
10945
+ const {
10946
+ data
10947
+ } = await apiClient.get(`/dashboard-meta/${dashboardId}`);
10948
+
10949
+ // Cache the metadata
10950
+ dashboardMetaCache[dashboardId] = {
10951
+ dashboards: data.dashboards || {},
10952
+ charts: data.charts || {},
10953
+ reports: data.reports || {},
10954
+ reportMetadata: data.reportMetadata || {},
10955
+ dateRanges: data.dateRanges || []
10956
+ };
10957
+ return dashboardMetaCache[dashboardId];
10958
+ },
10924
10959
  getDashboard: async ({
10925
- id
10960
+ id,
10961
+ dashboardId
10926
10962
  }) => {
10963
+ // Use provided dashboardId or fall back to first cached dashboard
10964
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
10965
+
10966
+ // Check cache first
10967
+ if (cacheKey && dashboardMetaCache[cacheKey]?.dashboards?.[id]) {
10968
+ return dashboardMetaCache[cacheKey].dashboards[id];
10969
+ }
10970
+
10971
+ // Fall back to HTTP request
10927
10972
  const {
10928
10973
  data
10929
10974
  } = await apiClient.get(`/entity/dashboards/${id}`);
@@ -10933,11 +10978,22 @@ var _BYGD_NC_REPORT_UI = (function () {
10933
10978
  * Get chart by ID
10934
10979
  * @param {Object} params - Parameters object
10935
10980
  * @param {string} params.id - Chart ID
10981
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
10936
10982
  * @returns {Promise} Axios response promise
10937
10983
  */
10938
10984
  getChart: async ({
10939
- id
10985
+ id,
10986
+ dashboardId
10940
10987
  }) => {
10988
+ // Use provided dashboardId or fall back to first cached dashboard
10989
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
10990
+
10991
+ // Check cache first
10992
+ if (cacheKey && dashboardMetaCache[cacheKey]?.charts?.[id]) {
10993
+ return dashboardMetaCache[cacheKey].charts[id];
10994
+ }
10995
+
10996
+ // Fall back to HTTP request
10941
10997
  const {
10942
10998
  data
10943
10999
  } = await apiClient.get(`/entity/charts/${id}`);
@@ -10947,11 +11003,22 @@ var _BYGD_NC_REPORT_UI = (function () {
10947
11003
  * Get report by ID
10948
11004
  * @param {Object} params - Parameters object
10949
11005
  * @param {string} params.id - Report ID
11006
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
10950
11007
  * @returns {Promise} Axios response promise
10951
11008
  */
10952
11009
  getReport: async ({
10953
- id
11010
+ id,
11011
+ dashboardId
10954
11012
  }) => {
11013
+ // Use provided dashboardId or fall back to first cached dashboard
11014
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
11015
+
11016
+ // Check cache first
11017
+ if (cacheKey && dashboardMetaCache[cacheKey]?.reports?.[id]) {
11018
+ return dashboardMetaCache[cacheKey].reports[id];
11019
+ }
11020
+
11021
+ // Fall back to HTTP request
10955
11022
  const {
10956
11023
  data
10957
11024
  } = await apiClient.get(`/entity/reports/${id}`);
@@ -10961,12 +11028,23 @@ var _BYGD_NC_REPORT_UI = (function () {
10961
11028
  * Get report schema/metadata by ID
10962
11029
  * @param {Object} params - Parameters object
10963
11030
  * @param {string} params.id - Report ID
11031
+ * @param {string} [params.dashboardId] - Optional dashboard ID for cache lookup
10964
11032
  * @returns {Promise} Axios response promise
10965
11033
  */
10966
11034
  getReportSchema: async ({
10967
11035
  id,
11036
+ dashboardId,
10968
11037
  query = {}
10969
11038
  }) => {
11039
+ // Use provided dashboardId or fall back to first cached dashboard
11040
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
11041
+
11042
+ // Check cache first
11043
+ if (cacheKey && dashboardMetaCache[cacheKey]?.reportMetadata?.[id]) {
11044
+ return dashboardMetaCache[cacheKey].reportMetadata[id];
11045
+ }
11046
+
11047
+ // Fall back to HTTP request
10970
11048
  // console.log({getReportSchema:{id,query}});
10971
11049
  const {
10972
11050
  data
@@ -10991,7 +11069,18 @@ var _BYGD_NC_REPORT_UI = (function () {
10991
11069
  } = await apiClient.post(`/reports/${id}/run`, query);
10992
11070
  return data;
10993
11071
  },
10994
- getDateRanges: async () => {
11072
+ getDateRanges: async ({
11073
+ dashboardId
11074
+ } = {}) => {
11075
+ // Use provided dashboardId or fall back to first cached dashboard
11076
+ const cacheKey = dashboardId || getFirstCachedDashboardId();
11077
+
11078
+ // Check cache first
11079
+ if (cacheKey && dashboardMetaCache[cacheKey]?.dateRanges) {
11080
+ return dashboardMetaCache[cacheKey].dateRanges;
11081
+ }
11082
+
11083
+ // Fall back to HTTP request
10995
11084
  const {
10996
11085
  data
10997
11086
  } = await apiClient.get(`/globals/date-ranges`);
@@ -45019,6 +45108,9 @@ export default theme;`;
45019
45108
  useFilterManager(channel);
45020
45109
  const init = async () => {
45021
45110
  Api.setAuth(auth);
45111
+ await Api.loadDashboardMeta({
45112
+ dashboardId: id
45113
+ });
45022
45114
 
45023
45115
  // get dashboard entity
45024
45116
  const dashboardTemp = await Api.getDashboard({