@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.28.8 → 4.29.1
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/dpr/all.js +6 -8
- package/dpr/all.js.map +3 -3
- package/dpr/all.scss +296 -414
- package/dpr/all.ts +6 -11
- package/dpr/components/_catalogue/catalogue-list/utils.test.ts +1 -1
- package/dpr/components/_charts/chart/ChartTimeseries.js +3 -2
- package/dpr/components/_charts/chart/ChartTimeseries.js.map +2 -2
- package/dpr/components/_charts/chart/ChartTimeseries.ts +4 -2
- package/dpr/components/_charts/chart/clientClass.js +1 -0
- package/dpr/components/_charts/chart/clientClass.js.map +2 -2
- package/dpr/components/_charts/chart/clientClass.ts +1 -0
- package/dpr/components/_reports/{report-actions → report-heading/report-actions}/actionsTemplate.js.map +1 -1
- package/dpr/components/_reports/{report-actions → report-heading/report-actions}/clientClass.js +1 -1
- package/dpr/components/_reports/report-heading/report-actions/clientClass.js.map +7 -0
- package/dpr/components/_reports/{report-actions → report-heading/report-actions}/clientClass.ts +1 -1
- package/dpr/components/_reports/report-heading/report-actions/types.d.js.map +7 -0
- package/dpr/components/_reports/{report-actions → report-heading/report-actions}/types.d.ts +1 -1
- package/dpr/components/_reports/{report-actions → report-heading/report-actions}/utils.js.map +1 -1
- package/dpr/components/_reports/{report-actions → report-heading/report-actions}/utils.test.ts +2 -2
- package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/clientClass.js +1 -3
- package/dpr/components/_reports/report-heading/report-columns/report-columns-form/clientClass.js.map +7 -0
- package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/clientClass.ts +1 -3
- package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/types.d.js.map +1 -1
- package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/utils.js +1 -1
- package/dpr/components/_reports/report-heading/report-columns/report-columns-form/utils.js.map +7 -0
- package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/utils.ts +2 -2
- package/dpr/components/_reports/{report-columns → report-heading/report-columns}/view.njk +1 -1
- package/dpr/components/_reports/{report-download-message → report-heading/report-download-message}/clientClass.js +1 -1
- package/dpr/components/_reports/report-heading/report-download-message/clientClass.js.map +7 -0
- package/dpr/components/_reports/{report-download-message → report-heading/report-download-message}/clientClass.ts +1 -1
- package/dpr/components/_reports/{report-filters → report-heading/report-filters}/view.njk +1 -1
- package/dpr/components/_reports/report-heading/view.njk +4 -4
- package/dpr/components/_reports/report-page/report-print-message/view.njk +10 -0
- package/dpr/components/_reports/report-page/report-template/report-no-data-message/styles.scss +8 -0
- package/dpr/components/_reports/report-page/report-template/report-no-data-message/view.njk +11 -0
- package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/clientClass.js +1 -1
- package/dpr/components/_reports/report-page/report-template/report-pagination/clientClass.js.map +7 -0
- package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/clientClass.ts +1 -1
- package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/types.d.js.map +1 -1
- package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/utils.js.map +1 -1
- package/dpr/components/_reports/report-page/report-template/report-section/parent-child-template/styles.scss +88 -0
- package/dpr/components/_reports/report-page/report-template/report-section/parent-child-template/view.njk +29 -0
- package/dpr/components/_reports/{report-data-table → report-page/report-template/report-section/report-data-table}/clientClass.js +17 -10
- package/dpr/components/_reports/report-page/report-template/report-section/report-data-table/clientClass.js.map +7 -0
- package/dpr/components/_reports/{report-data-table → report-page/report-template/report-section/report-data-table}/clientClass.ts +20 -10
- package/dpr/components/_reports/{report-data-table → report-page/report-template/report-section/report-data-table}/style.scss +35 -185
- package/dpr/components/_reports/report-page/report-template/report-section/report-data-table/types.d.js.map +7 -0
- package/dpr/components/_reports/{report-data-table → report-page/report-template/report-section/report-data-table}/types.d.ts +2 -2
- package/dpr/components/_reports/report-page/report-template/report-section/report-data-table/view.njk +27 -0
- package/dpr/components/_reports/report-page/report-template/report-section/styles.scss +33 -0
- package/dpr/components/_reports/report-page/report-template/report-section/view.njk +58 -0
- package/dpr/components/_reports/{report-summary-table → report-page/report-template/report-summary-table}/styles.scss +21 -4
- package/dpr/components/_reports/{report-totals → report-page/report-template/report-totals}/utils.js.map +1 -1
- package/dpr/components/_reports/report-page/report-template/styles.scss +5 -0
- package/dpr/components/_reports/report-page/report-template/template-config.js +66 -0
- package/dpr/components/_reports/report-page/report-template/template-config.js.map +7 -0
- package/dpr/components/_reports/report-page/report-template/template-config.ts +45 -0
- package/dpr/components/_reports/report-page/report-template/utils.js +82 -0
- package/dpr/components/_reports/report-page/report-template/utils.js.map +7 -0
- package/dpr/components/_reports/report-page/report-template/utils.ts +100 -0
- package/dpr/components/_reports/report-page/report-template/view.njk +61 -0
- package/dpr/components/_reports/{report-wrapper → report-page}/styles.scss +7 -5
- package/dpr/components/_reports/report-page/view.njk +26 -0
- package/dpr/components/card-group/view.njk +0 -4
- package/dpr/components/report-list/utils.js +11 -3
- package/dpr/components/report-list/utils.js.map +2 -2
- package/dpr/components/report-list/utils.ts +11 -1
- package/dpr/components/report-list/view.njk +2 -2
- package/dpr/components/show-more/style.scss +3 -4
- package/dpr/data/reportingClient.js.map +2 -2
- package/dpr/data/reportingClient.ts +4 -4
- package/dpr/routes/journeys/view-report/async/dashboard/utils.js +1 -1
- package/dpr/routes/journeys/view-report/async/dashboard/utils.js.map +1 -1
- package/dpr/routes/journeys/view-report/async/dashboard/utils.ts +1 -1
- package/dpr/routes/journeys/view-report/async/report/controller.js.map +2 -2
- package/dpr/routes/journeys/view-report/async/report/controller.ts +0 -1
- package/dpr/routes/journeys/view-report/async/report/report-variants.cy.js +207 -56
- package/dpr/routes/journeys/view-report/async/report/report-variants.cy.js.map +2 -2
- package/dpr/routes/journeys/view-report/async/report/report-variants.cy.ts +333 -64
- package/dpr/routes/journeys/view-report/async/report/utils.js +9 -17
- package/dpr/routes/journeys/view-report/async/report/utils.js.map +3 -3
- package/dpr/routes/journeys/view-report/async/report/utils.ts +12 -22
- package/dpr/routes/journeys/view-report/report.njk +2 -2
- package/dpr/routes/journeys/view-report/sync/dashboard/utils.js +1 -1
- package/dpr/routes/journeys/view-report/sync/dashboard/utils.js.map +1 -1
- package/dpr/routes/journeys/view-report/sync/dashboard/utils.ts +1 -1
- package/dpr/routes/journeys/view-report/sync/report/utils.js +38 -11
- package/dpr/routes/journeys/view-report/sync/report/utils.js.map +3 -3
- package/dpr/routes/journeys/view-report/sync/report/utils.ts +39 -14
- package/dpr/routes/journeys/view-report/utils.js +1 -1
- package/dpr/routes/journeys/view-report/utils.js.map +1 -1
- package/dpr/routes/journeys/view-report/utils.ts +1 -1
- package/dpr/services/reportingService.js.map +2 -2
- package/dpr/services/reportingService.ts +2 -2
- package/dpr/types/ReportQuery.js +1 -1
- package/dpr/types/ReportQuery.js.map +1 -1
- package/dpr/types/ReportQuery.ts +1 -1
- package/dpr/types/UserReports.js.map +1 -1
- package/dpr/types/UserReports.ts +3 -3
- package/dpr/utils/TemplateBuilder/ParentChildDataBuilder/ParentChildDataBuilder.js +193 -0
- package/dpr/utils/TemplateBuilder/ParentChildDataBuilder/ParentChildDataBuilder.js.map +7 -0
- package/dpr/utils/TemplateBuilder/ParentChildDataBuilder/ParentChildDataBuilder.ts +203 -0
- package/dpr/utils/TemplateBuilder/ParentChildDataBuilder/types.d.js.map +7 -0
- package/dpr/utils/TemplateBuilder/ParentChildDataBuilder/types.d.ts +36 -0
- package/dpr/utils/TemplateBuilder/ReportBuilder/ReportBuilder.js +114 -0
- package/dpr/utils/TemplateBuilder/ReportBuilder/ReportBuilder.js.map +7 -0
- package/dpr/utils/TemplateBuilder/ReportBuilder/ReportBuilder.ts +117 -0
- package/dpr/utils/TemplateBuilder/ReportBuilder/types.d.js.map +7 -0
- package/dpr/utils/TemplateBuilder/ReportBuilder/types.d.ts +6 -0
- package/dpr/utils/TemplateBuilder/SectionedDataHelper/SectionedDataHelper.js +202 -0
- package/dpr/utils/TemplateBuilder/SectionedDataHelper/SectionedDataHelper.js.map +7 -0
- package/dpr/utils/TemplateBuilder/SectionedDataHelper/SectionedDataHelper.ts +246 -0
- package/dpr/utils/TemplateBuilder/SectionedDataHelper/types.js +17 -0
- package/dpr/utils/TemplateBuilder/SectionedDataHelper/types.js.map +7 -0
- package/dpr/utils/TemplateBuilder/SectionedDataHelper/types.ts +41 -0
- package/dpr/utils/{CollatedSummaryBuilder/CollatedSummaryBuilder.js → TemplateBuilder/SummaryDataHelper/SummaryDataHelper.js} +6 -8
- package/dpr/utils/TemplateBuilder/SummaryDataHelper/SummaryDataHelper.js.map +7 -0
- package/dpr/utils/{CollatedSummaryBuilder/CollatedSummaryBuilder.test.ts → TemplateBuilder/SummaryDataHelper/SummaryDataHelper.test.ts} +4 -4
- package/dpr/utils/{CollatedSummaryBuilder/CollatedSummaryBuilder.ts → TemplateBuilder/SummaryDataHelper/SummaryDataHelper.ts} +6 -9
- package/dpr/utils/TemplateBuilder/TemplateBuilder.js +74 -0
- package/dpr/utils/TemplateBuilder/TemplateBuilder.js.map +7 -0
- package/dpr/utils/TemplateBuilder/TemplateBuilder.ts +68 -0
- package/dpr/utils/definitionUtils.js +22 -2
- package/dpr/utils/definitionUtils.js.map +2 -2
- package/dpr/utils/definitionUtils.ts +26 -1
- package/package.json +1 -1
- package/dpr/DprLoadingHelper.js +0 -51
- package/dpr/DprLoadingHelper.js.map +0 -7
- package/dpr/DprLoadingHelper.ts +0 -27
- package/dpr/components/_reports/report/view.njk +0 -40
- package/dpr/components/_reports/report-actions/clientClass.js.map +0 -7
- package/dpr/components/_reports/report-actions/types.d.js.map +0 -7
- package/dpr/components/_reports/report-columns-form/clientClass.js.map +0 -7
- package/dpr/components/_reports/report-columns-form/utils.js.map +0 -7
- package/dpr/components/_reports/report-data-table/clientClass.js.map +0 -7
- package/dpr/components/_reports/report-data-table/types.d.js.map +0 -7
- package/dpr/components/_reports/report-data-table/utils.js +0 -123
- package/dpr/components/_reports/report-data-table/utils.js.map +0 -7
- package/dpr/components/_reports/report-data-table/utils.test.ts +0 -604
- package/dpr/components/_reports/report-data-table/utils.ts +0 -150
- package/dpr/components/_reports/report-data-table/view.njk +0 -24
- package/dpr/components/_reports/report-data-table-wrapper/view.njk +0 -27
- package/dpr/components/_reports/report-download-message/clientClass.js.map +0 -7
- package/dpr/components/_reports/report-no-data-message/styles.scss +0 -4
- package/dpr/components/_reports/report-no-data-message/view.njk +0 -13
- package/dpr/components/_reports/report-pagination/clientClass.js.map +0 -7
- package/dpr/components/_reports/report-print-message/view.njk +0 -8
- package/dpr/components/_reports/report-template/view.njk +0 -44
- package/dpr/components/_reports/report-wrapper/view.njk +0 -19
- package/dpr/components/loading-anim/styles.scss +0 -117
- package/dpr/components/loading-anim/view.njk +0 -18
- package/dpr/utils/CollatedSummaryBuilder/CollatedSummaryBuilder.js.map +0 -7
- package/dpr/utils/ParentChildDataTableBuilder/ParentChildDataTableBuilder.js +0 -202
- package/dpr/utils/ParentChildDataTableBuilder/ParentChildDataTableBuilder.js.map +0 -7
- package/dpr/utils/ParentChildDataTableBuilder/ParentChildDataTableBuilder.test.ts +0 -503
- package/dpr/utils/ParentChildDataTableBuilder/ParentChildDataTableBuilder.ts +0 -224
- package/dpr/utils/ParentChildDataTableBuilder/types.d.js.map +0 -7
- package/dpr/utils/ParentChildDataTableBuilder/types.d.ts +0 -11
- package/dpr/utils/SectionedDataTableBuilder/SectionedDataTableBuilder.js +0 -311
- package/dpr/utils/SectionedDataTableBuilder/SectionedDataTableBuilder.js.map +0 -7
- package/dpr/utils/SectionedDataTableBuilder/SectionedDataTableBuilder.test.ts +0 -492
- package/dpr/utils/SectionedDataTableBuilder/SectionedDataTableBuilder.ts +0 -342
- package/dpr/utils/SectionedDataTableBuilder/types.d.js.map +0 -7
- package/dpr/utils/SectionedDataTableBuilder/types.d.ts +0 -5
- package/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.js +0 -146
- package/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.js.map +0 -7
- package/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.test.ts +0 -140
- package/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.ts +0 -150
- /package/dpr/components/_reports/{report-actions → report-heading/report-actions}/actionsTemplate.js +0 -0
- /package/dpr/components/_reports/{report-actions → report-heading/report-actions}/actionsTemplate.ts +0 -0
- /package/dpr/components/_reports/{report-actions → report-heading/report-actions}/style.scss +0 -0
- /package/dpr/components/_reports/{report-actions → report-heading/report-actions}/types.d.js +0 -0
- /package/dpr/components/_reports/{report-actions → report-heading/report-actions}/utils.js +0 -0
- /package/dpr/components/_reports/{report-actions → report-heading/report-actions}/utils.ts +0 -0
- /package/dpr/components/_reports/{report-actions → report-heading/report-actions}/view.njk +0 -0
- /package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/style.scss +0 -0
- /package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/types.d.js +0 -0
- /package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/types.d.ts +0 -0
- /package/dpr/components/_reports/{report-columns-form → report-heading/report-columns/report-columns-form}/view.njk +0 -0
- /package/dpr/components/_reports/{report-columns → report-heading/report-columns}/styles.scss +0 -0
- /package/dpr/components/_reports/{report-download-message → report-heading/report-download-message}/style.scss +0 -0
- /package/dpr/components/_reports/{report-download-message → report-heading/report-download-message}/view.njk +0 -0
- /package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/style.scss +0 -0
- /package/dpr/components/_reports/{report-data-table → report-page/report-template/report-pagination}/types.d.js +0 -0
- /package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/types.d.ts +0 -0
- /package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/utils.js +0 -0
- /package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/utils.test.ts +0 -0
- /package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/utils.ts +0 -0
- /package/dpr/components/_reports/{report-pagination → report-page/report-template/report-pagination}/view.njk +0 -0
- /package/dpr/components/_reports/{report-pagination → report-page/report-template/report-section/report-data-table}/types.d.js +0 -0
- /package/dpr/components/_reports/{report-summary-table → report-page/report-template/report-summary-table}/view.njk +0 -0
- /package/dpr/components/_reports/{report-totals → report-page/report-template/report-totals}/style.scss +0 -0
- /package/dpr/components/_reports/{report-totals → report-page/report-template/report-totals}/utils.js +0 -0
- /package/dpr/components/_reports/{report-totals → report-page/report-template/report-totals}/utils.ts +0 -0
- /package/dpr/components/_reports/{report-totals → report-page/report-template/report-totals}/view.njk +0 -0
- /package/dpr/utils/{ParentChildDataTableBuilder → TemplateBuilder/ParentChildDataBuilder}/types.d.js +0 -0
- /package/dpr/utils/{SectionedDataTableBuilder → TemplateBuilder/ReportBuilder}/types.d.js +0 -0
|
@@ -3,33 +3,32 @@ import { Url } from 'url'
|
|
|
3
3
|
import { Request, Response } from 'express'
|
|
4
4
|
|
|
5
5
|
// Types
|
|
6
|
-
import
|
|
6
|
+
import { ReportTemplateData } from '../../../../../utils/TemplateBuilder/SectionedDataHelper/types'
|
|
7
|
+
import { ChildData } from '../../../../../utils/TemplateBuilder/ParentChildDataBuilder/types'
|
|
8
|
+
import type { Columns } from '../../../../../components/_reports/report-heading/report-columns/report-columns-form/types'
|
|
7
9
|
import type { AsyncReportUtilsParams } from '../../../../../types/AsyncReportUtils'
|
|
8
10
|
import type { DataTable } from '../../../../../utils/DataTableBuilder/types'
|
|
9
11
|
import type { components } from '../../../../../types/api'
|
|
10
12
|
import type { AsyncSummary, RequestedReport } from '../../../../../types/UserReports'
|
|
11
13
|
import { LoadType, ReportType } from '../../../../../types/UserReports'
|
|
12
14
|
import ReportQuery from '../../../../../types/ReportQuery'
|
|
13
|
-
import type { ChildData } from '../../../../../utils/ParentChildDataTableBuilder/types'
|
|
14
15
|
import type { ExtractedDefinitionData, ExtractedRequestData, ReportUrls } from './types'
|
|
15
|
-
import type { DownloadActionParams } from '../../../../../components/_reports/report-actions/types'
|
|
16
|
+
import type { DownloadActionParams } from '../../../../../components/_reports/report-heading/report-actions/types'
|
|
16
17
|
import { FiltersType } from '../../../../../components/_filters/filtersTypeEnum'
|
|
17
18
|
import type { Services } from '../../../../../types/Services'
|
|
18
19
|
|
|
19
20
|
// Utils
|
|
20
21
|
import definitionUtils from '../../../../../utils/definitionUtils'
|
|
21
|
-
import PaginationUtils from '../../../../../components/_reports/report-pagination/utils'
|
|
22
|
-
import TotalsUtils from '../../../../../components/_reports/report-totals/utils'
|
|
22
|
+
import PaginationUtils from '../../../../../components/_reports/report-page/report-template/report-pagination/utils'
|
|
23
|
+
import TotalsUtils from '../../../../../components/_reports/report-page/report-template/report-totals/utils'
|
|
23
24
|
import ReportFiltersUtils from '../../../../../components/_filters/utils'
|
|
24
|
-
import ColumnUtils from '../../../../../components/_reports/report-columns-form/utils'
|
|
25
|
-
import ReportActionsUtils from '../../../../../components/_reports/report-actions/utils'
|
|
25
|
+
import ColumnUtils from '../../../../../components/_reports/report-heading/report-columns/report-columns-form/utils'
|
|
26
|
+
import ReportActionsUtils from '../../../../../components/_reports/report-heading/report-actions/utils'
|
|
26
27
|
import UserReportsUtils from '../../../../../components/user-reports/utils'
|
|
27
28
|
import LocalsHelper from '../../../../../utils/localsHelper'
|
|
28
|
-
import
|
|
29
|
+
import ReportTemplateUtils from '../../../../../components/_reports/report-page/report-template/utils'
|
|
29
30
|
import RequestedReportService from '../../../my-reports/requested-reports/service'
|
|
30
31
|
|
|
31
|
-
import CollatedSummaryBuilder from '../../../../../utils/CollatedSummaryBuilder/CollatedSummaryBuilder'
|
|
32
|
-
|
|
33
32
|
export const getData = async ({
|
|
34
33
|
res,
|
|
35
34
|
req,
|
|
@@ -256,7 +255,7 @@ export const renderReport = async ({ req, res, services }: AsyncReportUtilsParam
|
|
|
256
255
|
})
|
|
257
256
|
|
|
258
257
|
// Get the data table
|
|
259
|
-
const dataTable: DataTable
|
|
258
|
+
const dataTable: DataTable | ReportTemplateData = ReportTemplateUtils.createReportTemplateData(
|
|
260
259
|
definition,
|
|
261
260
|
columns,
|
|
262
261
|
reportData,
|
|
@@ -271,7 +270,6 @@ export const renderReport = async ({ req, res, services }: AsyncReportUtilsParam
|
|
|
271
270
|
res,
|
|
272
271
|
services,
|
|
273
272
|
definition,
|
|
274
|
-
summariesData,
|
|
275
273
|
dataTable,
|
|
276
274
|
columns,
|
|
277
275
|
reportQuery,
|
|
@@ -301,8 +299,7 @@ const getTemplateData = async (
|
|
|
301
299
|
res: Response,
|
|
302
300
|
services: Services,
|
|
303
301
|
definition: components['schemas']['SingleVariantReportDefinition'],
|
|
304
|
-
|
|
305
|
-
dataTable: DataTable[],
|
|
302
|
+
dataTable: DataTable | ReportTemplateData,
|
|
306
303
|
columns: Columns,
|
|
307
304
|
reportQuery: ReportQuery,
|
|
308
305
|
requestData?: RequestedReport,
|
|
@@ -342,18 +339,12 @@ const getTemplateData = async (
|
|
|
342
339
|
// Set the extra meta data
|
|
343
340
|
const meta = setMetaData(res, req)
|
|
344
341
|
|
|
345
|
-
let reportSummaries
|
|
346
|
-
if (summariesData.length) {
|
|
347
|
-
const collatedSummaryBuilder = new CollatedSummaryBuilder(specification, summariesData)
|
|
348
|
-
reportSummaries = collatedSummaryBuilder.collatePageSummaries()
|
|
349
|
-
}
|
|
350
|
-
|
|
351
342
|
let pagination
|
|
352
343
|
let totals
|
|
353
344
|
if (definitionData.template === 'list') {
|
|
354
345
|
pagination = PaginationUtils.getPaginationData(url, count, req)
|
|
355
346
|
const { pageSize, currentPage, totalRows } = pagination
|
|
356
|
-
totals = TotalsUtils.getTotals(pageSize, currentPage, totalRows, dataTable
|
|
347
|
+
totals = TotalsUtils.getTotals(pageSize, currentPage, totalRows, dataTable.rowCount)
|
|
357
348
|
}
|
|
358
349
|
|
|
359
350
|
return {
|
|
@@ -368,7 +359,6 @@ const getTemplateData = async (
|
|
|
368
359
|
...urls,
|
|
369
360
|
...(pagination && { pagination }),
|
|
370
361
|
...(totals && { totals }),
|
|
371
|
-
...(reportSummaries && { reportSummaries }),
|
|
372
362
|
}
|
|
373
363
|
}
|
|
374
364
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{% from "../../../components/_reports/report-
|
|
1
|
+
{% from "../../../components/_reports/report-page/view.njk" import dprReportPage %}
|
|
2
2
|
|
|
3
3
|
{% extends layoutPath %}
|
|
4
4
|
|
|
5
5
|
{% block content %}
|
|
6
|
-
{{
|
|
6
|
+
{{ dprReportPage(renderData) }}
|
|
7
7
|
{% endblock %}
|
|
@@ -38,7 +38,7 @@ var import_utils = __toESM(require("../../../../../components/_filters/filters-s
|
|
|
38
38
|
var import_localsHelper = __toESM(require("../../../../../utils/localsHelper"));
|
|
39
39
|
var import_UserStoreItemBuilder = __toESM(require("../../../../../utils/UserStoreItemBuilder"));
|
|
40
40
|
var import_utils2 = __toESM(require("../../async/dashboard/utils"));
|
|
41
|
-
var import_utils3 = __toESM(require("../../../../../components/_reports/report-actions/utils"));
|
|
41
|
+
var import_utils3 = __toESM(require("../../../../../components/_reports/report-heading/report-actions/utils"));
|
|
42
42
|
const setAsRecentlyViewed = async ({
|
|
43
43
|
req,
|
|
44
44
|
services,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../dpr/routes/journeys/view-report/sync/dashboard/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Request, Response } from 'express'\nimport Dict = NodeJS.Dict\n\nimport type { Services } from '../../../../../types/Services'\nimport { ReportType, RequestStatus } from '../../../../../types/UserReports'\nimport { FilterValue } from '../../../../../components/_filters/types'\nimport SelectedFiltersUtils from '../../../../../components/_filters/filters-selected/utils'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport UserStoreItemBuilder from '../../../../../utils/UserStoreItemBuilder'\nimport { DashboardDataResponse } from '../../../../../types/Metrics'\nimport AsyncDashboardUtils from '../../async/dashboard/utils'\nimport { DashboardSection } from '../../../../../components/_dashboards/dashboard-visualisation/types'\nimport { components } from '../../../../../types/api'\nimport ReportActionsUtils from '../../../../../components/_reports/report-actions/utils'\n\nconst setAsRecentlyViewed = async ({\n req,\n services,\n reportName,\n name,\n description,\n reportId,\n id,\n userId,\n filters,\n}: {\n req: Request\n services: Services\n reportName: string\n name: string\n description: string\n reportId: string\n id: string\n userId: string\n filters: FilterValue[]\n}) => {\n const stateData = {\n type: ReportType.DASHBOARD,\n reportId,\n id,\n reportName,\n description,\n name,\n }\n\n const interactiveQueryData: { query: Dict<string>; querySummary: Array<Dict<string>> } = {\n query: <Dict<string>>req.query,\n querySummary: SelectedFiltersUtils.getQuerySummary(<Dict<string>>req.query, filters),\n }\n\n const recentlyViewedData = new UserStoreItemBuilder(stateData)\n .addInteractiveQuery(interactiveQueryData)\n .addStatus(RequestStatus.READY)\n .addTimestamp()\n .addReportUrls(req)\n .build()\n\n await services.recentlyViewedService.setRecentlyViewed(recentlyViewedData, userId)\n}\n\nexport const renderSyncDashboard = async ({\n req,\n res,\n services,\n}: {\n req: Request\n res: Response\n services: Services\n}) => {\n const { token, csrfToken, dprUser, nestedBaseUrl } = LocalsHelper.getValues(res)\n const { reportId, id } = req.params\n const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`\n\n const {\n query,\n filters: filterData,\n reportDefinition,\n dashboardDefinition,\n } = await AsyncDashboardUtils.getDefinitionData({\n req,\n res,\n services,\n })\n\n const dashboardData: DashboardDataResponse[][] = await services.dashboardService.getSyncDashboard(\n token,\n id,\n reportId,\n query,\n )\n const flattenedData: DashboardDataResponse[] = dashboardData.flat()\n\n // Get the dashboard parts\n const sections: DashboardSection[] = AsyncDashboardUtils.getSections(dashboardDefinition, flattenedData, query)\n\n await setAsRecentlyViewed({\n req,\n services,\n reportName: reportDefinition.name,\n name: dashboardDefinition.name,\n description: dashboardDefinition.description || reportDefinition.description || '',\n reportId,\n id,\n userId: dprUser.id,\n filters: filterData.filters,\n })\n\n return {\n dashboardData: {\n token,\n id,\n reportId,\n name: dashboardDefinition.name,\n description: dashboardDefinition.description,\n reportName: reportDefinition.name,\n bookmarked: await services.bookmarkService.isBookmarked(id, reportId, dprUser.id),\n nestedBaseUrl,\n csrfToken,\n sections,\n filters: filterData,\n type: ReportType.DASHBOARD,\n actions: setActions(dashboardDefinition, reportDefinition, fullUrl),\n },\n }\n}\n\nexport const setActions = (\n definition: components['schemas']['DashboardDefinition'],\n summaryDefinition: components['schemas']['ReportDefinitionSummary'],\n url: string,\n) => {\n const { name: reportName } = summaryDefinition\n const { name } = definition\n\n return ReportActionsUtils.getActions({\n share: {\n reportName,\n name,\n url,\n },\n copy: {\n url,\n },\n })\n}\n\nexport default {\n renderSyncDashboard,\n}\n"],
|
|
4
|
+
"sourcesContent": ["import type { Request, Response } from 'express'\nimport Dict = NodeJS.Dict\n\nimport type { Services } from '../../../../../types/Services'\nimport { ReportType, RequestStatus } from '../../../../../types/UserReports'\nimport { FilterValue } from '../../../../../components/_filters/types'\nimport SelectedFiltersUtils from '../../../../../components/_filters/filters-selected/utils'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport UserStoreItemBuilder from '../../../../../utils/UserStoreItemBuilder'\nimport { DashboardDataResponse } from '../../../../../types/Metrics'\nimport AsyncDashboardUtils from '../../async/dashboard/utils'\nimport { DashboardSection } from '../../../../../components/_dashboards/dashboard-visualisation/types'\nimport { components } from '../../../../../types/api'\nimport ReportActionsUtils from '../../../../../components/_reports/report-heading/report-actions/utils'\n\nconst setAsRecentlyViewed = async ({\n req,\n services,\n reportName,\n name,\n description,\n reportId,\n id,\n userId,\n filters,\n}: {\n req: Request\n services: Services\n reportName: string\n name: string\n description: string\n reportId: string\n id: string\n userId: string\n filters: FilterValue[]\n}) => {\n const stateData = {\n type: ReportType.DASHBOARD,\n reportId,\n id,\n reportName,\n description,\n name,\n }\n\n const interactiveQueryData: { query: Dict<string>; querySummary: Array<Dict<string>> } = {\n query: <Dict<string>>req.query,\n querySummary: SelectedFiltersUtils.getQuerySummary(<Dict<string>>req.query, filters),\n }\n\n const recentlyViewedData = new UserStoreItemBuilder(stateData)\n .addInteractiveQuery(interactiveQueryData)\n .addStatus(RequestStatus.READY)\n .addTimestamp()\n .addReportUrls(req)\n .build()\n\n await services.recentlyViewedService.setRecentlyViewed(recentlyViewedData, userId)\n}\n\nexport const renderSyncDashboard = async ({\n req,\n res,\n services,\n}: {\n req: Request\n res: Response\n services: Services\n}) => {\n const { token, csrfToken, dprUser, nestedBaseUrl } = LocalsHelper.getValues(res)\n const { reportId, id } = req.params\n const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`\n\n const {\n query,\n filters: filterData,\n reportDefinition,\n dashboardDefinition,\n } = await AsyncDashboardUtils.getDefinitionData({\n req,\n res,\n services,\n })\n\n const dashboardData: DashboardDataResponse[][] = await services.dashboardService.getSyncDashboard(\n token,\n id,\n reportId,\n query,\n )\n const flattenedData: DashboardDataResponse[] = dashboardData.flat()\n\n // Get the dashboard parts\n const sections: DashboardSection[] = AsyncDashboardUtils.getSections(dashboardDefinition, flattenedData, query)\n\n await setAsRecentlyViewed({\n req,\n services,\n reportName: reportDefinition.name,\n name: dashboardDefinition.name,\n description: dashboardDefinition.description || reportDefinition.description || '',\n reportId,\n id,\n userId: dprUser.id,\n filters: filterData.filters,\n })\n\n return {\n dashboardData: {\n token,\n id,\n reportId,\n name: dashboardDefinition.name,\n description: dashboardDefinition.description,\n reportName: reportDefinition.name,\n bookmarked: await services.bookmarkService.isBookmarked(id, reportId, dprUser.id),\n nestedBaseUrl,\n csrfToken,\n sections,\n filters: filterData,\n type: ReportType.DASHBOARD,\n actions: setActions(dashboardDefinition, reportDefinition, fullUrl),\n },\n }\n}\n\nexport const setActions = (\n definition: components['schemas']['DashboardDefinition'],\n summaryDefinition: components['schemas']['ReportDefinitionSummary'],\n url: string,\n) => {\n const { name: reportName } = summaryDefinition\n const { name } = definition\n\n return ReportActionsUtils.getActions({\n share: {\n reportName,\n name,\n url,\n },\n copy: {\n url,\n },\n })\n}\n\nexport default {\n renderSyncDashboard,\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,yBAA0C;AAE1C,mBAAiC;AACjC,0BAAyB;AACzB,kCAAiC;AAEjC,IAAAA,gBAAgC;AAGhC,IAAAA,gBAA+B;AAE/B,MAAM,sBAAsB,OAAO;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAUM;AACJ,QAAM,YAAY;AAAA,IAChB,MAAM,8BAAW;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,uBAAmF;AAAA,IACvF,OAAqB,IAAI;AAAA,IACzB,cAAc,aAAAC,QAAqB,gBAA8B,IAAI,OAAO,OAAO;AAAA,EACrF;AAEA,QAAM,qBAAqB,IAAI,4BAAAC,QAAqB,SAAS,EAC1D,oBAAoB,oBAAoB,EACxC,UAAU,iCAAc,KAAK,EAC7B,aAAa,EACb,cAAc,GAAG,EACjB,MAAM;AAET,QAAM,SAAS,sBAAsB,kBAAkB,oBAAoB,MAAM;AACnF;AAEO,MAAM,sBAAsB,OAAO;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AACF,MAIM;AACJ,QAAM,EAAE,OAAO,WAAW,SAAS,cAAc,IAAI,oBAAAC,QAAa,UAAU,GAAG;AAC/E,QAAM,EAAE,UAAU,GAAG,IAAI,IAAI;AAC7B,QAAM,UAAU,GAAG,IAAI,QAAQ,MAAM,IAAI,IAAI,MAAM,CAAC,GAAG,IAAI,WAAW;AAEtE,QAAM;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF,IAAI,MAAM,cAAAC,QAA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ReportActionsUtils"]
|
|
7
7
|
}
|
|
@@ -11,7 +11,7 @@ import { DashboardDataResponse } from '../../../../../types/Metrics'
|
|
|
11
11
|
import AsyncDashboardUtils from '../../async/dashboard/utils'
|
|
12
12
|
import { DashboardSection } from '../../../../../components/_dashboards/dashboard-visualisation/types'
|
|
13
13
|
import { components } from '../../../../../types/api'
|
|
14
|
-
import ReportActionsUtils from '../../../../../components/_reports/report-actions/utils'
|
|
14
|
+
import ReportActionsUtils from '../../../../../components/_reports/report-heading/report-actions/utils'
|
|
15
15
|
|
|
16
16
|
const setAsRecentlyViewed = async ({
|
|
17
17
|
req,
|
|
@@ -39,16 +39,16 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
39
39
|
var import_parseurl = __toESM(require("parseurl"));
|
|
40
40
|
var import_UserReports = require("../../../../../types/UserReports");
|
|
41
41
|
var import_ReportQuery = __toESM(require("../../../../../types/ReportQuery"));
|
|
42
|
-
var import_utils = __toESM(require("../../../../../components/_reports/report-pagination/utils"));
|
|
43
|
-
var import_utils2 = __toESM(require("../../../../../components/_reports/report-totals/utils"));
|
|
44
|
-
var import_utils3 = __toESM(require("../../../../../components/_reports/report-columns-form/utils"));
|
|
45
|
-
var import_utils4 = __toESM(require("../../../../../components/_reports/report-actions/utils"));
|
|
42
|
+
var import_utils = __toESM(require("../../../../../components/_reports/report-page/report-template/report-pagination/utils"));
|
|
43
|
+
var import_utils2 = __toESM(require("../../../../../components/_reports/report-page/report-template/report-totals/utils"));
|
|
44
|
+
var import_utils3 = __toESM(require("../../../../../components/_reports/report-heading/report-columns/report-columns-form/utils"));
|
|
45
|
+
var import_utils4 = __toESM(require("../../../../../components/_reports/report-heading/report-actions/utils"));
|
|
46
46
|
var import_utils5 = __toESM(require("../../../../../components/_filters/utils"));
|
|
47
47
|
var import_utils6 = __toESM(require("../../../../../components/_filters/filters-selected/utils"));
|
|
48
48
|
var import_localsHelper = __toESM(require("../../../../../utils/localsHelper"));
|
|
49
49
|
var import_UserStoreItemBuilder = __toESM(require("../../../../../utils/UserStoreItemBuilder"));
|
|
50
|
-
var import_DataTableBuilder = __toESM(require("../../../../../utils/DataTableBuilder/DataTableBuilder"));
|
|
51
50
|
var import_filtersTypeEnum = require("../../../../../components/_filters/filtersTypeEnum");
|
|
51
|
+
var import_utils7 = __toESM(require("../../../../../components/_reports/report-page/report-template/utils"));
|
|
52
52
|
const setActions = (csrfToken, reportDefinition, columns, url, canDownload, count, dataProductDefinitionsPath, currentUrl, currentQueryParams, nestedBaseUrl) => {
|
|
53
53
|
const { name: reportName, variant, id: reportId } = reportDefinition;
|
|
54
54
|
const { name, id, printable } = variant;
|
|
@@ -197,12 +197,30 @@ const getReportRenderData = async ({
|
|
|
197
197
|
specification,
|
|
198
198
|
reportQuery,
|
|
199
199
|
data,
|
|
200
|
-
filtersType
|
|
200
|
+
filtersType,
|
|
201
|
+
definition
|
|
201
202
|
}) => {
|
|
202
203
|
const url = (0, import_parseurl.default)(req);
|
|
203
204
|
const fullUrl = `${req.protocol}://${req.get("host")}${req.originalUrl}`;
|
|
204
205
|
const pathname = url?.search ? req.originalUrl.split(url.search)[0] : req.originalUrl;
|
|
205
|
-
const
|
|
206
|
+
const columns = import_utils3.default.getColumns(specification, req);
|
|
207
|
+
const reportDefinition = {
|
|
208
|
+
...definition,
|
|
209
|
+
variant: {
|
|
210
|
+
...definition.variant,
|
|
211
|
+
interactive: true
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const dataTable = import_utils7.default.createReportTemplateData(
|
|
215
|
+
reportDefinition,
|
|
216
|
+
columns,
|
|
217
|
+
data,
|
|
218
|
+
[],
|
|
219
|
+
// child data - N/A for sync reports
|
|
220
|
+
[],
|
|
221
|
+
// summaries data - N/A for sync reports
|
|
222
|
+
reportQuery
|
|
223
|
+
);
|
|
206
224
|
let pagination;
|
|
207
225
|
let totals;
|
|
208
226
|
if (url) {
|
|
@@ -221,9 +239,8 @@ const getReportRenderData = async ({
|
|
|
221
239
|
services,
|
|
222
240
|
filtersType: filtersType || import_filtersTypeEnum.FiltersType.INTERACTIVE
|
|
223
241
|
});
|
|
224
|
-
const columns = import_utils3.default.getColumns(specification, req);
|
|
225
242
|
return {
|
|
226
|
-
dataTable
|
|
243
|
+
dataTable,
|
|
227
244
|
totals,
|
|
228
245
|
filterData,
|
|
229
246
|
columns,
|
|
@@ -231,7 +248,8 @@ const getReportRenderData = async ({
|
|
|
231
248
|
reportUrl: pathname.replace("/download-disabled", "").replace("/download-disabled?", ""),
|
|
232
249
|
reportSearch: url?.search,
|
|
233
250
|
encodedSearch: url?.search ? encodeURIComponent(url.search) : void 0,
|
|
234
|
-
fullUrl
|
|
251
|
+
fullUrl,
|
|
252
|
+
template: specification.template
|
|
235
253
|
};
|
|
236
254
|
};
|
|
237
255
|
const getRenderData = async ({
|
|
@@ -253,7 +271,16 @@ const getRenderData = async ({
|
|
|
253
271
|
if (!specification) {
|
|
254
272
|
throw new Error("No specicication found in definition");
|
|
255
273
|
}
|
|
256
|
-
const reportRenderData = await getReportRenderData({
|
|
274
|
+
const reportRenderData = await getReportRenderData({
|
|
275
|
+
req,
|
|
276
|
+
res,
|
|
277
|
+
services,
|
|
278
|
+
count,
|
|
279
|
+
specification,
|
|
280
|
+
reportQuery,
|
|
281
|
+
data,
|
|
282
|
+
definition: reportDefinition
|
|
283
|
+
});
|
|
257
284
|
const actions = setActions(
|
|
258
285
|
csrfToken,
|
|
259
286
|
reportDefinition,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../dpr/routes/journeys/view-report/sync/report/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import parseUrl from 'parseurl'\nimport type { Request, Response } from 'express'\nimport Dict = NodeJS.Dict\nimport type { components } from '../../../../../types/api'\nimport type { DataTable } from '../../../../../utils/DataTableBuilder/types'\nimport type { ListWithWarnings } from '../../../../../data/types'\nimport type { Columns } from '../../../../../components/_reports/report-columns-form/types'\nimport type { Services } from '../../../../../types/Services'\nimport type { DownloadActionParams } from '../../../../../components/_reports/report-actions/types'\nimport { LoadType, ReportType, RequestStatus } from '../../../../../types/UserReports'\nimport ReportQuery from '../../../../../types/ReportQuery'\nimport { Template } from '../../../../../types/Templates'\nimport { FilterValue } from '../../../../../components/_filters/types'\n\nimport PaginationUtils from '../../../../../components/_reports/report-pagination/utils'\nimport TotalsUtils from '../../../../../components/_reports/report-totals/utils'\nimport ColumnUtils from '../../../../../components/_reports/report-columns-form/utils'\nimport ReportActionsUtils from '../../../../../components/_reports/report-actions/utils'\nimport FiltersUtils from '../../../../../components/_filters/utils'\nimport SelectedFiltersUtils from '../../../../../components/_filters/filters-selected/utils'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport UserStoreItemBuilder from '../../../../../utils/UserStoreItemBuilder'\n\nimport DataTableBuilder from '../../../../../utils/DataTableBuilder/DataTableBuilder'\nimport { FiltersType } from '../../../../../components/_filters/filtersTypeEnum'\n\nexport const setActions = (\n csrfToken: string,\n reportDefinition: components['schemas']['SingleVariantReportDefinition'],\n columns: Columns,\n url: string,\n canDownload: boolean,\n count: number,\n dataProductDefinitionsPath: string,\n currentUrl: string,\n currentQueryParams: string,\n nestedBaseUrl: string,\n) => {\n const { name: reportName, variant, id: reportId } = reportDefinition\n const { name, id, printable } = variant\n\n const downloadConfig: DownloadActionParams = {\n enabled: count > 0,\n name,\n reportName,\n csrfToken,\n reportId,\n id,\n columns: columns.value,\n loadType: LoadType.SYNC,\n definitionPath: dataProductDefinitionsPath,\n canDownload,\n currentUrl,\n currentQueryParams,\n nestedBaseUrl,\n }\n\n return ReportActionsUtils.getActions({\n download: downloadConfig,\n print: {\n enabled: Boolean(printable),\n },\n share: {\n reportName,\n name,\n url,\n },\n copy: {\n url,\n },\n })\n}\n\nconst setAsRecentlyViewed = async ({\n req,\n services,\n reportName,\n name,\n description,\n reportId,\n id,\n userId,\n filters,\n}: {\n req: Request\n services: Services\n reportName: string\n name: string\n description: string\n reportId: string\n id: string\n userId: string\n filters: FilterValue[]\n}) => {\n const stateData = {\n type: ReportType.REPORT,\n reportId,\n id,\n reportName,\n description,\n name,\n }\n\n const interactiveQueryData: { query: Dict<string>; querySummary: Array<Dict<string>> } = {\n query: <Dict<string>>req.query,\n querySummary: SelectedFiltersUtils.getQuerySummary(<Dict<string>>req.query, filters),\n }\n\n const recentlyViewedData = new UserStoreItemBuilder(stateData)\n .addInteractiveQuery(interactiveQueryData)\n .addStatus(RequestStatus.READY)\n .addTimestamp()\n .addReportUrls(req)\n .build()\n\n await services.recentlyViewedService?.setRecentlyViewed(recentlyViewedData, userId)\n}\n\nexport const getReportData = async ({\n services,\n req,\n token,\n reportId,\n id,\n dataProductDefinitionsPath,\n}: {\n services: Services\n req: Request\n token: string\n reportId: string\n id: string\n dataProductDefinitionsPath?: string\n}) => {\n const reportDefinition = await services.reportingService.getDefinition(\n token,\n reportId,\n id,\n dataProductDefinitionsPath,\n )\n const { variant } = reportDefinition\n const { resourceName, specification } = variant\n\n const reportQuery = new ReportQuery({\n fields: specification?.fields || [],\n template: (specification?.template as Template) || 'list',\n queryParams: req.query,\n definitionsPath: <string>dataProductDefinitionsPath,\n })\n\n return {\n reportData: await services.reportingService.getListWithWarnings(resourceName, token, reportQuery),\n reportDefinition,\n reportQuery,\n }\n}\n\nexport const getReport = async ({ req, res, services }: { req: Request; res: Response; services: Services }) => {\n const { token, csrfToken, dprUser } = LocalsHelper.getValues(res)\n const { reportId, id } = req.params\n const dataProductDefinitionsPath = <string>req.query['dataProductDefinitionsPath']\n\n const { reportData, reportDefinition, reportQuery } = await getReportData({\n services,\n req,\n token,\n reportId,\n id,\n dataProductDefinitionsPath,\n })\n const count = await services.reportingService.getCount(reportDefinition.variant.resourceName, token, reportQuery)\n const canDownload = Boolean(\n await services.downloadPermissionService?.downloadEnabledForReport(dprUser.id, reportId, id),\n )\n const bookmarked = Boolean(await services.bookmarkService?.isBookmarked(id, reportId, dprUser.id))\n\n const renderData = await getRenderData({\n req,\n res,\n services,\n reportDefinition,\n reportQuery,\n reportData,\n count,\n csrfToken,\n canDownload,\n })\n\n if (Object.keys(renderData).length) {\n await setAsRecentlyViewed({\n req,\n services,\n reportName: renderData.reportName,\n name: renderData.name,\n description: renderData.description || '',\n reportId,\n id,\n userId: dprUser.id,\n filters: renderData.filterData.filters,\n })\n }\n\n return {\n renderData: {\n ...renderData,\n csrfToken,\n loadType: LoadType.SYNC,\n reportId,\n id,\n bookmarked,\n dataProductDefinitionsPath,\n },\n }\n}\n\nexport const getReportRenderData = async ({\n req,\n res,\n services,\n count,\n specification,\n reportQuery,\n data,\n filtersType,\n}: {\n req: Request\n res?: Response\n services?: Services\n count: number\n specification: components['schemas']['Specification']\n reportQuery: ReportQuery\n data: Dict<string>[]\n filtersType?: FiltersType\n}) => {\n const url = parseUrl(req)\n const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`\n const pathname = url?.search ? req.originalUrl.split(url.search)[0] : req.originalUrl\n\n const dataTable: DataTable = new DataTableBuilder(specification.fields)\n .withHeaderSortOptions(reportQuery)\n .buildTable(data)\n\n let pagination\n let totals\n if (url) {\n pagination = PaginationUtils.getPaginationData(url, count, req)\n totals = TotalsUtils.getTotals(\n pagination.pageSize,\n pagination.currentPage,\n pagination.totalRows,\n dataTable.rowCount,\n )\n }\n\n const filterData = await FiltersUtils.getFilters({\n fields: specification.fields,\n req,\n res,\n services,\n filtersType: filtersType || FiltersType.INTERACTIVE,\n })\n\n const columns = ColumnUtils.getColumns(specification, req)\n\n return {\n dataTable: [dataTable],\n totals,\n filterData,\n columns,\n pagination,\n reportUrl: pathname.replace('/download-disabled', '').replace('/download-disabled?', ''),\n reportSearch: url?.search,\n encodedSearch: url?.search ? encodeURIComponent(url.search) : undefined,\n fullUrl,\n }\n}\n\nexport const getRenderData = async ({\n req,\n res,\n services,\n reportDefinition,\n reportQuery,\n reportData,\n count,\n csrfToken,\n canDownload,\n}: {\n req: Request\n res: Response\n services: Services\n reportDefinition: components['schemas']['SingleVariantReportDefinition']\n reportQuery: ReportQuery\n reportData: ListWithWarnings\n csrfToken: string\n count: number\n canDownload: boolean\n}) => {\n const { dataProductDefinitionsPath } = req.query\n const { nestedBaseUrl } = LocalsHelper.getValues(res)\n const { name: reportName, description: reportDescription } = reportDefinition\n const { specification, name, description, classification, printable } = reportDefinition.variant\n const { data } = reportData\n\n if (!specification) {\n throw new Error('No specicication found in definition')\n }\n\n const reportRenderData = await getReportRenderData({ req, res, services, count, specification, reportQuery, data })\n\n const actions = setActions(\n csrfToken,\n reportDefinition,\n reportRenderData.columns,\n `${req.protocol}://${req.get('host')}${req.originalUrl}`,\n canDownload,\n count,\n <string>dataProductDefinitionsPath,\n reportRenderData.reportUrl,\n reportRenderData.reportSearch || '',\n nestedBaseUrl,\n )\n\n return {\n ...reportRenderData,\n reportName,\n name,\n description: description || reportDescription,\n count,\n type: ReportType.REPORT,\n classification,\n printable,\n actions,\n warnings: reportData.warnings,\n canDownload,\n nestedBaseUrl,\n }\n}\n\nexport default {\n getRenderData,\n getReport,\n getReportData,\n getReportRenderData,\n setActions,\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AASrB,yBAAoD;AACpD,yBAAwB;AAIxB,mBAA4B;AAC5B,IAAAA,gBAAwB;AACxB,IAAAA,gBAAwB;AACxB,IAAAA,gBAA+B;AAC/B,IAAAA,gBAAyB;AACzB,IAAAA,gBAAiC;AACjC,0BAAyB;AACzB,kCAAiC;AAEjC,
|
|
6
|
-
"names": ["import_utils", "ReportActionsUtils", "SelectedFiltersUtils", "UserStoreItemBuilder", "ReportQuery", "LocalsHelper", "parseUrl", "
|
|
4
|
+
"sourcesContent": ["import parseUrl from 'parseurl'\nimport type { Request, Response } from 'express'\nimport Dict = NodeJS.Dict\nimport type { components } from '../../../../../types/api'\nimport type { DataTable } from '../../../../../utils/DataTableBuilder/types'\nimport type { ListWithWarnings } from '../../../../../data/types'\nimport type { Columns } from '../../../../../components/_reports/report-heading/report-columns/report-columns-form/types'\nimport type { Services } from '../../../../../types/Services'\nimport type { DownloadActionParams } from '../../../../../components/_reports/report-heading/report-actions/types'\nimport { LoadType, ReportType, RequestStatus } from '../../../../../types/UserReports'\nimport ReportQuery from '../../../../../types/ReportQuery'\nimport { Template } from '../../../../../types/Templates'\nimport { FilterValue } from '../../../../../components/_filters/types'\n\nimport PaginationUtils from '../../../../../components/_reports/report-page/report-template/report-pagination/utils'\nimport TotalsUtils from '../../../../../components/_reports/report-page/report-template/report-totals/utils'\nimport ColumnUtils from '../../../../../components/_reports/report-heading/report-columns/report-columns-form/utils'\nimport ReportActionsUtils from '../../../../../components/_reports/report-heading/report-actions/utils'\nimport FiltersUtils from '../../../../../components/_filters/utils'\nimport SelectedFiltersUtils from '../../../../../components/_filters/filters-selected/utils'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport UserStoreItemBuilder from '../../../../../utils/UserStoreItemBuilder'\n\nimport { FiltersType } from '../../../../../components/_filters/filtersTypeEnum'\nimport { ReportTemplateData } from '../../../../../utils/TemplateBuilder/SectionedDataHelper/types'\nimport ReportTemplateUtils from '../../../../../components/_reports/report-page/report-template/utils'\n\nexport const setActions = (\n csrfToken: string,\n reportDefinition: components['schemas']['SingleVariantReportDefinition'],\n columns: Columns,\n url: string,\n canDownload: boolean,\n count: number,\n dataProductDefinitionsPath: string,\n currentUrl: string,\n currentQueryParams: string,\n nestedBaseUrl: string,\n) => {\n const { name: reportName, variant, id: reportId } = reportDefinition\n const { name, id, printable } = variant\n\n const downloadConfig: DownloadActionParams = {\n enabled: count > 0,\n name,\n reportName,\n csrfToken,\n reportId,\n id,\n columns: columns.value,\n loadType: LoadType.SYNC,\n definitionPath: dataProductDefinitionsPath,\n canDownload,\n currentUrl,\n currentQueryParams,\n nestedBaseUrl,\n }\n\n return ReportActionsUtils.getActions({\n download: downloadConfig,\n print: {\n enabled: Boolean(printable),\n },\n share: {\n reportName,\n name,\n url,\n },\n copy: {\n url,\n },\n })\n}\n\nconst setAsRecentlyViewed = async ({\n req,\n services,\n reportName,\n name,\n description,\n reportId,\n id,\n userId,\n filters,\n}: {\n req: Request\n services: Services\n reportName: string\n name: string\n description: string\n reportId: string\n id: string\n userId: string\n filters: FilterValue[]\n}) => {\n const stateData = {\n type: ReportType.REPORT,\n reportId,\n id,\n reportName,\n description,\n name,\n }\n\n const interactiveQueryData: { query: Dict<string>; querySummary: Array<Dict<string>> } = {\n query: <Dict<string>>req.query,\n querySummary: SelectedFiltersUtils.getQuerySummary(<Dict<string>>req.query, filters),\n }\n\n const recentlyViewedData = new UserStoreItemBuilder(stateData)\n .addInteractiveQuery(interactiveQueryData)\n .addStatus(RequestStatus.READY)\n .addTimestamp()\n .addReportUrls(req)\n .build()\n\n await services.recentlyViewedService?.setRecentlyViewed(recentlyViewedData, userId)\n}\n\nexport const getReportData = async ({\n services,\n req,\n token,\n reportId,\n id,\n dataProductDefinitionsPath,\n}: {\n services: Services\n req: Request\n token: string\n reportId: string\n id: string\n dataProductDefinitionsPath?: string\n}) => {\n const reportDefinition = await services.reportingService.getDefinition(\n token,\n reportId,\n id,\n dataProductDefinitionsPath,\n )\n const { variant } = reportDefinition\n const { resourceName, specification } = variant\n\n const reportQuery = new ReportQuery({\n fields: specification?.fields || [],\n template: (specification?.template as Template) || 'list',\n queryParams: req.query,\n definitionsPath: <string>dataProductDefinitionsPath,\n })\n\n return {\n reportData: await services.reportingService.getListWithWarnings(resourceName, token, reportQuery),\n reportDefinition,\n reportQuery,\n }\n}\n\nexport const getReport = async ({ req, res, services }: { req: Request; res: Response; services: Services }) => {\n const { token, csrfToken, dprUser } = LocalsHelper.getValues(res)\n const { reportId, id } = req.params\n const dataProductDefinitionsPath = <string>req.query['dataProductDefinitionsPath']\n\n const { reportData, reportDefinition, reportQuery } = await getReportData({\n services,\n req,\n token,\n reportId,\n id,\n dataProductDefinitionsPath,\n })\n const count = await services.reportingService.getCount(reportDefinition.variant.resourceName, token, reportQuery)\n const canDownload = Boolean(\n await services.downloadPermissionService?.downloadEnabledForReport(dprUser.id, reportId, id),\n )\n const bookmarked = Boolean(await services.bookmarkService?.isBookmarked(id, reportId, dprUser.id))\n\n const renderData = await getRenderData({\n req,\n res,\n services,\n reportDefinition,\n reportQuery,\n reportData,\n count,\n csrfToken,\n canDownload,\n })\n\n if (Object.keys(renderData).length) {\n await setAsRecentlyViewed({\n req,\n services,\n reportName: renderData.reportName,\n name: renderData.name,\n description: renderData.description || '',\n reportId,\n id,\n userId: dprUser.id,\n filters: renderData.filterData.filters,\n })\n }\n\n return {\n renderData: {\n ...renderData,\n csrfToken,\n loadType: LoadType.SYNC,\n reportId,\n id,\n bookmarked,\n dataProductDefinitionsPath,\n },\n }\n}\n\nexport const getReportRenderData = async ({\n req,\n res,\n services,\n count,\n specification,\n reportQuery,\n data,\n filtersType,\n definition,\n}: {\n req: Request\n res?: Response\n services?: Services\n count: number\n specification: components['schemas']['Specification']\n reportQuery: ReportQuery\n data: Dict<string>[]\n filtersType?: FiltersType\n definition: components['schemas']['SingleVariantReportDefinition']\n}) => {\n const url = parseUrl(req)\n const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`\n const pathname = url?.search ? req.originalUrl.split(url.search)[0] : req.originalUrl\n const columns = ColumnUtils.getColumns(specification, req)\n const reportDefinition = {\n ...definition,\n variant: {\n ...definition.variant,\n interactive: true,\n },\n }\n\n // Get the data table\n const dataTable: DataTable | ReportTemplateData = ReportTemplateUtils.createReportTemplateData(\n reportDefinition,\n columns,\n data,\n [], // child data - N/A for sync reports\n [], // summaries data - N/A for sync reports\n reportQuery,\n )\n\n let pagination\n let totals\n if (url) {\n pagination = PaginationUtils.getPaginationData(url, count, req)\n totals = TotalsUtils.getTotals(\n pagination.pageSize,\n pagination.currentPage,\n pagination.totalRows,\n dataTable.rowCount,\n )\n }\n\n const filterData = await FiltersUtils.getFilters({\n fields: specification.fields,\n req,\n res,\n services,\n filtersType: filtersType || FiltersType.INTERACTIVE,\n })\n\n return {\n dataTable,\n totals,\n filterData,\n columns,\n pagination,\n reportUrl: pathname.replace('/download-disabled', '').replace('/download-disabled?', ''),\n reportSearch: url?.search,\n encodedSearch: url?.search ? encodeURIComponent(url.search) : undefined,\n fullUrl,\n template: specification.template,\n }\n}\n\nexport const getRenderData = async ({\n req,\n res,\n services,\n reportDefinition,\n reportQuery,\n reportData,\n count,\n csrfToken,\n canDownload,\n}: {\n req: Request\n res: Response\n services: Services\n reportDefinition: components['schemas']['SingleVariantReportDefinition']\n reportQuery: ReportQuery\n reportData: ListWithWarnings\n csrfToken: string\n count: number\n canDownload: boolean\n}) => {\n const { dataProductDefinitionsPath } = req.query\n const { nestedBaseUrl } = LocalsHelper.getValues(res)\n const { name: reportName, description: reportDescription } = reportDefinition\n const { specification, name, description, classification, printable } = reportDefinition.variant\n const { data } = reportData\n\n if (!specification) {\n throw new Error('No specicication found in definition')\n }\n\n const reportRenderData = await getReportRenderData({\n req,\n res,\n services,\n count,\n specification,\n reportQuery,\n data,\n definition: reportDefinition,\n })\n\n const actions = setActions(\n csrfToken,\n reportDefinition,\n reportRenderData.columns,\n `${req.protocol}://${req.get('host')}${req.originalUrl}`,\n canDownload,\n count,\n <string>dataProductDefinitionsPath,\n reportRenderData.reportUrl,\n reportRenderData.reportSearch || '',\n nestedBaseUrl,\n )\n\n return {\n ...reportRenderData,\n reportName,\n name,\n description: description || reportDescription,\n count,\n type: ReportType.REPORT,\n classification,\n printable,\n actions,\n warnings: reportData.warnings,\n canDownload,\n nestedBaseUrl,\n }\n}\n\nexport default {\n getRenderData,\n getReport,\n getReportData,\n getReportRenderData,\n setActions,\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AASrB,yBAAoD;AACpD,yBAAwB;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IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EACd,CAAC;AAED,QAAM,UAAU;AAAA,IACd;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB,GAAG,IAAI,QAAQ,MAAM,IAAI,IAAI,MAAM,CAAC,GAAG,IAAI,WAAW;AAAA,IACtD;AAAA,IACA;AAAA,IACQ;AAAA,IACR,iBAAiB;AAAA,IACjB,iBAAiB,gBAAgB;AAAA,IACjC;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,aAAa,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,8BAAW;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,WAAW;AAAA,IACrB;AAAA,IACA;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": ["import_utils", "ReportActionsUtils", "SelectedFiltersUtils", "UserStoreItemBuilder", "ReportQuery", "LocalsHelper", "parseUrl", "ColumnUtils", "ReportTemplateUtils", "PaginationUtils", "TotalsUtils", "FiltersUtils"]
|
|
7
7
|
}
|
|
@@ -4,25 +4,26 @@ import Dict = NodeJS.Dict
|
|
|
4
4
|
import type { components } from '../../../../../types/api'
|
|
5
5
|
import type { DataTable } from '../../../../../utils/DataTableBuilder/types'
|
|
6
6
|
import type { ListWithWarnings } from '../../../../../data/types'
|
|
7
|
-
import type { Columns } from '../../../../../components/_reports/report-columns-form/types'
|
|
7
|
+
import type { Columns } from '../../../../../components/_reports/report-heading/report-columns/report-columns-form/types'
|
|
8
8
|
import type { Services } from '../../../../../types/Services'
|
|
9
|
-
import type { DownloadActionParams } from '../../../../../components/_reports/report-actions/types'
|
|
9
|
+
import type { DownloadActionParams } from '../../../../../components/_reports/report-heading/report-actions/types'
|
|
10
10
|
import { LoadType, ReportType, RequestStatus } from '../../../../../types/UserReports'
|
|
11
11
|
import ReportQuery from '../../../../../types/ReportQuery'
|
|
12
12
|
import { Template } from '../../../../../types/Templates'
|
|
13
13
|
import { FilterValue } from '../../../../../components/_filters/types'
|
|
14
14
|
|
|
15
|
-
import PaginationUtils from '../../../../../components/_reports/report-pagination/utils'
|
|
16
|
-
import TotalsUtils from '../../../../../components/_reports/report-totals/utils'
|
|
17
|
-
import ColumnUtils from '../../../../../components/_reports/report-columns-form/utils'
|
|
18
|
-
import ReportActionsUtils from '../../../../../components/_reports/report-actions/utils'
|
|
15
|
+
import PaginationUtils from '../../../../../components/_reports/report-page/report-template/report-pagination/utils'
|
|
16
|
+
import TotalsUtils from '../../../../../components/_reports/report-page/report-template/report-totals/utils'
|
|
17
|
+
import ColumnUtils from '../../../../../components/_reports/report-heading/report-columns/report-columns-form/utils'
|
|
18
|
+
import ReportActionsUtils from '../../../../../components/_reports/report-heading/report-actions/utils'
|
|
19
19
|
import FiltersUtils from '../../../../../components/_filters/utils'
|
|
20
20
|
import SelectedFiltersUtils from '../../../../../components/_filters/filters-selected/utils'
|
|
21
21
|
import LocalsHelper from '../../../../../utils/localsHelper'
|
|
22
22
|
import UserStoreItemBuilder from '../../../../../utils/UserStoreItemBuilder'
|
|
23
23
|
|
|
24
|
-
import DataTableBuilder from '../../../../../utils/DataTableBuilder/DataTableBuilder'
|
|
25
24
|
import { FiltersType } from '../../../../../components/_filters/filtersTypeEnum'
|
|
25
|
+
import { ReportTemplateData } from '../../../../../utils/TemplateBuilder/SectionedDataHelper/types'
|
|
26
|
+
import ReportTemplateUtils from '../../../../../components/_reports/report-page/report-template/utils'
|
|
26
27
|
|
|
27
28
|
export const setActions = (
|
|
28
29
|
csrfToken: string,
|
|
@@ -221,6 +222,7 @@ export const getReportRenderData = async ({
|
|
|
221
222
|
reportQuery,
|
|
222
223
|
data,
|
|
223
224
|
filtersType,
|
|
225
|
+
definition,
|
|
224
226
|
}: {
|
|
225
227
|
req: Request
|
|
226
228
|
res?: Response
|
|
@@ -230,14 +232,29 @@ export const getReportRenderData = async ({
|
|
|
230
232
|
reportQuery: ReportQuery
|
|
231
233
|
data: Dict<string>[]
|
|
232
234
|
filtersType?: FiltersType
|
|
235
|
+
definition: components['schemas']['SingleVariantReportDefinition']
|
|
233
236
|
}) => {
|
|
234
237
|
const url = parseUrl(req)
|
|
235
238
|
const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`
|
|
236
239
|
const pathname = url?.search ? req.originalUrl.split(url.search)[0] : req.originalUrl
|
|
240
|
+
const columns = ColumnUtils.getColumns(specification, req)
|
|
241
|
+
const reportDefinition = {
|
|
242
|
+
...definition,
|
|
243
|
+
variant: {
|
|
244
|
+
...definition.variant,
|
|
245
|
+
interactive: true,
|
|
246
|
+
},
|
|
247
|
+
}
|
|
237
248
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
249
|
+
// Get the data table
|
|
250
|
+
const dataTable: DataTable | ReportTemplateData = ReportTemplateUtils.createReportTemplateData(
|
|
251
|
+
reportDefinition,
|
|
252
|
+
columns,
|
|
253
|
+
data,
|
|
254
|
+
[], // child data - N/A for sync reports
|
|
255
|
+
[], // summaries data - N/A for sync reports
|
|
256
|
+
reportQuery,
|
|
257
|
+
)
|
|
241
258
|
|
|
242
259
|
let pagination
|
|
243
260
|
let totals
|
|
@@ -259,10 +276,8 @@ export const getReportRenderData = async ({
|
|
|
259
276
|
filtersType: filtersType || FiltersType.INTERACTIVE,
|
|
260
277
|
})
|
|
261
278
|
|
|
262
|
-
const columns = ColumnUtils.getColumns(specification, req)
|
|
263
|
-
|
|
264
279
|
return {
|
|
265
|
-
dataTable
|
|
280
|
+
dataTable,
|
|
266
281
|
totals,
|
|
267
282
|
filterData,
|
|
268
283
|
columns,
|
|
@@ -271,6 +286,7 @@ export const getReportRenderData = async ({
|
|
|
271
286
|
reportSearch: url?.search,
|
|
272
287
|
encodedSearch: url?.search ? encodeURIComponent(url.search) : undefined,
|
|
273
288
|
fullUrl,
|
|
289
|
+
template: specification.template,
|
|
274
290
|
}
|
|
275
291
|
}
|
|
276
292
|
|
|
@@ -305,7 +321,16 @@ export const getRenderData = async ({
|
|
|
305
321
|
throw new Error('No specicication found in definition')
|
|
306
322
|
}
|
|
307
323
|
|
|
308
|
-
const reportRenderData = await getReportRenderData({
|
|
324
|
+
const reportRenderData = await getReportRenderData({
|
|
325
|
+
req,
|
|
326
|
+
res,
|
|
327
|
+
services,
|
|
328
|
+
count,
|
|
329
|
+
specification,
|
|
330
|
+
reportQuery,
|
|
331
|
+
data,
|
|
332
|
+
definition: reportDefinition,
|
|
333
|
+
})
|
|
309
334
|
|
|
310
335
|
const actions = setActions(
|
|
311
336
|
csrfToken,
|
|
@@ -37,7 +37,7 @@ var import_enum = require("../../../components/_filters/filter-input/enum");
|
|
|
37
37
|
var import_localsHelper = __toESM(require("../../../utils/localsHelper"));
|
|
38
38
|
var import_definitionUtils = __toESM(require("../../../utils/definitionUtils"));
|
|
39
39
|
var import_DateMapper = __toESM(require("../../../utils/DateMapper/DateMapper"));
|
|
40
|
-
var import_utils = __toESM(require("../../../components/_reports/report-columns-form/utils"));
|
|
40
|
+
var import_utils = __toESM(require("../../../components/_reports/report-heading/report-columns/report-columns-form/utils"));
|
|
41
41
|
const applyReportInteractiveQuery = async (req, res, services, applyType) => {
|
|
42
42
|
const { reportId, id } = req.params;
|
|
43
43
|
const { token, definitionsPath } = import_localsHelper.default.getValues(res);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../dpr/routes/journeys/view-report/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { Request, Response } from 'express'\nimport { FilterType } from '../../../components/_filters/filter-input/enum'\nimport { components } from '../../../types/api'\nimport { StoredReportData } from '../../../types/UserReports'\nimport { Services } from '../../../types/Services'\nimport LocalsHelper from '../../../utils/localsHelper'\nimport definitionUtils from '../../../utils/definitionUtils'\nimport DateMapper from '../../../utils/DateMapper/DateMapper'\nimport ColumnsUtils from '../../../components/_reports/report-columns-form/utils'\n\nexport const applyReportInteractiveQuery = async (\n req: Request,\n res: Response,\n services: Services,\n applyType: 'columns' | 'filters',\n) => {\n const { reportId, id } = req.params\n const { token, definitionsPath } = LocalsHelper.getValues(res)\n\n // Get the definition\n const definition: components['schemas']['SingleVariantReportDefinition'] =\n await services.reportingService.getDefinition(token, reportId, id, definitionsPath)\n const fields = definition.variant.specification?.fields || []\n\n return applyInteractiveQuery(req, res, services, applyType, fields)\n}\n\nexport const applyDashboardInteractiveQuery = async (\n req: Request,\n res: Response,\n services: Services,\n applyType: 'columns' | 'filters',\n) => {\n const { reportId, id } = req.params\n const { token, definitionsPath } = LocalsHelper.getValues(res)\n\n // Get the definition\n const definition: components['schemas']['DashboardDefinition'] = await services.dashboardService.getDefinition(\n token,\n reportId,\n id,\n definitionsPath,\n )\n const fields = definition.filterFields || []\n\n return applyInteractiveQuery(req, res, services, applyType, fields)\n}\n\nconst applyInteractiveQuery = async (\n req: Request,\n res: Response,\n services: Services,\n applyType: 'columns' | 'filters',\n fields: components['schemas']['FieldDefinition'][],\n) => {\n const { tableId, id } = req.params\n const { dprUser } = LocalsHelper.getValues(res)\n\n // get the report state\n let reportStateData: StoredReportData | undefined\n if (tableId) {\n // means its an async report\n reportStateData = await services.recentlyViewedService?.getReportByTableId(tableId, dprUser.id)\n } else {\n // its a sync report and can be indentified by ID as will always only be 1\n reportStateData = await services.recentlyViewedService?.getReportById(id, dprUser.id)\n }\n\n // Get the stored interactive query data\n const interactiveQueryData = reportStateData?.interactiveQuery?.data\n\n const preventDefault = interactiveQueryData?.['preventDefault']\n const pageSize = interactiveQueryData?.['pageSize']\n const selectedPage = applyType === 'columns' ? interactiveQueryData?.['selectedPage'] : 1\n const sortColumn = interactiveQueryData?.['sortColumn']\n const sortedAsc = interactiveQueryData?.['sortedAsc']\n\n let filters = {}\n if (interactiveQueryData) {\n filters = Object.keys(interactiveQueryData)\n .filter((key) => key.includes('filters.'))\n .reduce((acc, key) => ({ ...acc, [key]: interactiveQueryData[key] }), {})\n }\n\n // Create merged form data\n let formData: Record<string, string | string[]> = {\n ...(preventDefault && { preventDefault }),\n ...(selectedPage && { selectedPage }),\n ...(pageSize && { pageSize }),\n ...(sortColumn && { sortColumn }),\n ...(sortedAsc && { sortedAsc }),\n ...req.body,\n }\n\n if (applyType === 'columns') {\n const { columns } = req.body\n const mandatoryCols = ColumnsUtils.mandatoryColumns(fields)\n\n let bodyColumns = []\n if (columns) {\n bodyColumns = Array.isArray(columns) ? columns : [columns]\n }\n const columnsData = [...mandatoryCols, ...bodyColumns]\n formData = { ...formData, columns: columnsData, ...filters }\n } else {\n const columns = interactiveQueryData?.['columns'] || []\n formData = { ...formData, columns }\n }\n\n // Create query string\n const filtersString = createQueryParamsFromFormData({\n formData,\n fields,\n })\n\n // Redirect back to report\n res.redirect(`${req.baseUrl}?${filtersString}`)\n}\n\nconst createQueryParamsFromFormData = ({\n formData,\n fields,\n}: {\n fields: components['schemas']['FieldDefinition'][]\n formData: Record<string, string | string[]>\n}) => {\n // create the query string\n const params = new URLSearchParams()\n Object.keys(formData).forEach((key) => {\n const value = formData[key]\n\n if (value && key !== '_csrf') {\n const fieldId = key.split('.')[1] // filters are prefixed with 'filters.'\n if (fieldId) {\n const filter = definitionUtils.getFilter(fields, fieldId)\n if (filter) {\n const { type: filterType } = filter\n switch (filterType.toLocaleLowerCase()) {\n // DATE RANGE TYPES\n case FilterType.date.toLocaleLowerCase():\n case FilterType.dateRange.toLocaleLowerCase():\n case FilterType.granularDateRange.toLocaleLowerCase():\n {\n let dateValue: string = <string>value\n const dateMapper = new DateMapper()\n const currentDateFormat = dateMapper.getDateType(dateValue)\n if (currentDateFormat !== 'none') {\n dateValue = dateMapper.toDateString(dateValue, 'iso') || ''\n }\n if (dateValue) {\n params.append(key, dateValue)\n }\n }\n break\n\n // MULTIVALUE TYPES: string[] || string if only one value selected\n case FilterType.multiselect.toLocaleLowerCase():\n if (Array.isArray(value)) {\n const multiselectValue = <string[]>value\n multiselectValue.forEach((v: string) => {\n params.append(key, v)\n })\n } else {\n params.append(key, <string>value)\n }\n break\n\n // OTHER TYPES - always a string\n default:\n params.append(key, <string>value)\n break\n }\n }\n } else if (Array.isArray(value)) {\n value.forEach((v: string) => {\n params.append(key, v)\n })\n } else {\n params.append(key, value)\n }\n }\n })\n\n const encodedFilters = params.toString()\n return decodeURIComponent(encodedFilters)\n}\n\nexport default {\n applyDashboardInteractiveQuery,\n applyReportInteractiveQuery,\n}\n"],
|
|
4
|
+
"sourcesContent": ["import { Request, Response } from 'express'\nimport { FilterType } from '../../../components/_filters/filter-input/enum'\nimport { components } from '../../../types/api'\nimport { StoredReportData } from '../../../types/UserReports'\nimport { Services } from '../../../types/Services'\nimport LocalsHelper from '../../../utils/localsHelper'\nimport definitionUtils from '../../../utils/definitionUtils'\nimport DateMapper from '../../../utils/DateMapper/DateMapper'\nimport ColumnsUtils from '../../../components/_reports/report-heading/report-columns/report-columns-form/utils'\n\nexport const applyReportInteractiveQuery = async (\n req: Request,\n res: Response,\n services: Services,\n applyType: 'columns' | 'filters',\n) => {\n const { reportId, id } = req.params\n const { token, definitionsPath } = LocalsHelper.getValues(res)\n\n // Get the definition\n const definition: components['schemas']['SingleVariantReportDefinition'] =\n await services.reportingService.getDefinition(token, reportId, id, definitionsPath)\n const fields = definition.variant.specification?.fields || []\n\n return applyInteractiveQuery(req, res, services, applyType, fields)\n}\n\nexport const applyDashboardInteractiveQuery = async (\n req: Request,\n res: Response,\n services: Services,\n applyType: 'columns' | 'filters',\n) => {\n const { reportId, id } = req.params\n const { token, definitionsPath } = LocalsHelper.getValues(res)\n\n // Get the definition\n const definition: components['schemas']['DashboardDefinition'] = await services.dashboardService.getDefinition(\n token,\n reportId,\n id,\n definitionsPath,\n )\n const fields = definition.filterFields || []\n\n return applyInteractiveQuery(req, res, services, applyType, fields)\n}\n\nconst applyInteractiveQuery = async (\n req: Request,\n res: Response,\n services: Services,\n applyType: 'columns' | 'filters',\n fields: components['schemas']['FieldDefinition'][],\n) => {\n const { tableId, id } = req.params\n const { dprUser } = LocalsHelper.getValues(res)\n\n // get the report state\n let reportStateData: StoredReportData | undefined\n if (tableId) {\n // means its an async report\n reportStateData = await services.recentlyViewedService?.getReportByTableId(tableId, dprUser.id)\n } else {\n // its a sync report and can be indentified by ID as will always only be 1\n reportStateData = await services.recentlyViewedService?.getReportById(id, dprUser.id)\n }\n\n // Get the stored interactive query data\n const interactiveQueryData = reportStateData?.interactiveQuery?.data\n\n const preventDefault = interactiveQueryData?.['preventDefault']\n const pageSize = interactiveQueryData?.['pageSize']\n const selectedPage = applyType === 'columns' ? interactiveQueryData?.['selectedPage'] : 1\n const sortColumn = interactiveQueryData?.['sortColumn']\n const sortedAsc = interactiveQueryData?.['sortedAsc']\n\n let filters = {}\n if (interactiveQueryData) {\n filters = Object.keys(interactiveQueryData)\n .filter((key) => key.includes('filters.'))\n .reduce((acc, key) => ({ ...acc, [key]: interactiveQueryData[key] }), {})\n }\n\n // Create merged form data\n let formData: Record<string, string | string[]> = {\n ...(preventDefault && { preventDefault }),\n ...(selectedPage && { selectedPage }),\n ...(pageSize && { pageSize }),\n ...(sortColumn && { sortColumn }),\n ...(sortedAsc && { sortedAsc }),\n ...req.body,\n }\n\n if (applyType === 'columns') {\n const { columns } = req.body\n const mandatoryCols = ColumnsUtils.mandatoryColumns(fields)\n\n let bodyColumns = []\n if (columns) {\n bodyColumns = Array.isArray(columns) ? columns : [columns]\n }\n const columnsData = [...mandatoryCols, ...bodyColumns]\n formData = { ...formData, columns: columnsData, ...filters }\n } else {\n const columns = interactiveQueryData?.['columns'] || []\n formData = { ...formData, columns }\n }\n\n // Create query string\n const filtersString = createQueryParamsFromFormData({\n formData,\n fields,\n })\n\n // Redirect back to report\n res.redirect(`${req.baseUrl}?${filtersString}`)\n}\n\nconst createQueryParamsFromFormData = ({\n formData,\n fields,\n}: {\n fields: components['schemas']['FieldDefinition'][]\n formData: Record<string, string | string[]>\n}) => {\n // create the query string\n const params = new URLSearchParams()\n Object.keys(formData).forEach((key) => {\n const value = formData[key]\n\n if (value && key !== '_csrf') {\n const fieldId = key.split('.')[1] // filters are prefixed with 'filters.'\n if (fieldId) {\n const filter = definitionUtils.getFilter(fields, fieldId)\n if (filter) {\n const { type: filterType } = filter\n switch (filterType.toLocaleLowerCase()) {\n // DATE RANGE TYPES\n case FilterType.date.toLocaleLowerCase():\n case FilterType.dateRange.toLocaleLowerCase():\n case FilterType.granularDateRange.toLocaleLowerCase():\n {\n let dateValue: string = <string>value\n const dateMapper = new DateMapper()\n const currentDateFormat = dateMapper.getDateType(dateValue)\n if (currentDateFormat !== 'none') {\n dateValue = dateMapper.toDateString(dateValue, 'iso') || ''\n }\n if (dateValue) {\n params.append(key, dateValue)\n }\n }\n break\n\n // MULTIVALUE TYPES: string[] || string if only one value selected\n case FilterType.multiselect.toLocaleLowerCase():\n if (Array.isArray(value)) {\n const multiselectValue = <string[]>value\n multiselectValue.forEach((v: string) => {\n params.append(key, v)\n })\n } else {\n params.append(key, <string>value)\n }\n break\n\n // OTHER TYPES - always a string\n default:\n params.append(key, <string>value)\n break\n }\n }\n } else if (Array.isArray(value)) {\n value.forEach((v: string) => {\n params.append(key, v)\n })\n } else {\n params.append(key, value)\n }\n }\n })\n\n const encodedFilters = params.toString()\n return decodeURIComponent(encodedFilters)\n}\n\nexport default {\n applyDashboardInteractiveQuery,\n applyReportInteractiveQuery,\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA2B;AAI3B,0BAAyB;AACzB,6BAA4B;AAC5B,wBAAuB;AACvB,mBAAyB;AAElB,MAAM,8BAA8B,OACzC,KACA,KACA,UACA,cACG;AACH,QAAM,EAAE,UAAU,GAAG,IAAI,IAAI;AAC7B,QAAM,EAAE,OAAO,gBAAgB,IAAI,oBAAAA,QAAa,UAAU,GAAG;AAG7D,QAAM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7 @@ import { Services } from '../../../types/Services'
|
|
|
6
6
|
import LocalsHelper from '../../../utils/localsHelper'
|
|
7
7
|
import definitionUtils from '../../../utils/definitionUtils'
|
|
8
8
|
import DateMapper from '../../../utils/DateMapper/DateMapper'
|
|
9
|
-
import ColumnsUtils from '../../../components/_reports/report-columns-form/utils'
|
|
9
|
+
import ColumnsUtils from '../../../components/_reports/report-heading/report-columns/report-columns-form/utils'
|
|
10
10
|
|
|
11
11
|
export const applyReportInteractiveQuery = async (
|
|
12
12
|
req: Request,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../dpr/services/reportingService.ts"],
|
|
4
|
-
"sourcesContent": ["import { Response } from 'express'\nimport { components } from '../types/api'\nimport type ReportingClient from '../data/reportingClient'\nimport ReportQuery from '../types/ReportQuery'\nimport Dict = NodeJS.Dict\nimport { ListWithWarnings } from '../data/types'\n\nclass ReportingService {\n constructor(private readonly reportingClient: ReportingClient) {\n this.reportingClient = reportingClient\n }\n\n async getCount(resourceName: string, token: string, listRequest: ReportQuery): Promise<number> {\n return this.reportingClient.getCount(resourceName, token, listRequest)\n }\n\n async getList(resourceName: string, token: string, listRequest: ReportQuery): Promise<Array<NodeJS.Dict<string>>> {\n return this.reportingClient.getList(resourceName, token, listRequest)\n }\n\n async getListWithWarnings(resourceName: string, token: string, listRequest: ReportQuery): Promise<ListWithWarnings> {\n return this.reportingClient.getListWithWarnings(resourceName, token, listRequest)\n }\n\n async getDefinitionSummary(\n token: string,\n reportId: string,\n dataProductDefinitionsPath?: string,\n ): Promise<components['schemas']['ReportDefinitionSummary']> {\n return this.reportingClient.getDefinitionSummary(token, reportId, dataProductDefinitionsPath)\n }\n\n async getDefinitions(\n token: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Array<components['schemas']['ReportDefinitionSummary']>> {\n return this.reportingClient.getDefinitions(token, dataProductDefinitionsPath)\n }\n\n async getDefinition(\n token: string,\n reportId: string,\n variantId: string,\n dataProductDefinitionsPath?: string,\n query?: Dict<string | string[]>,\n ): Promise<components['schemas']['SingleVariantReportDefinition']> {\n return this.reportingClient.getDefinition(token, reportId, variantId, dataProductDefinitionsPath, query)\n }\n\n async requestAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n query: Record<string, string | boolean | number>,\n ): Promise<Dict<string>> {\n return this.reportingClient.requestAsyncReport(token, reportId, variantId, query)\n }\n\n async cancelAsyncRequest(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Dict<string>> {\n return this.reportingClient.cancelAsyncRequest(token, reportId, variantId, executionId, dataProductDefinitionsPath)\n }\n\n async downloadAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n query: Record<string, string | string[]>,\n res: Response,\n ): Promise<void> {\n return this.reportingClient.downloadAsyncReport(token, reportId, variantId, tableId, query, res)\n }\n\n async getAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n query: Record<string, string | string[]>,\n ): Promise<Array<
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,MAAM,iBAAiB;AAAA,EACrB,YAA6B,iBAAkC;AAAlC;AAC3B,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,MAAM,SAAS,cAAsB,OAAe,aAA2C;AAC7F,WAAO,KAAK,gBAAgB,SAAS,cAAc,OAAO,WAAW;AAAA,EACvE;AAAA,EAEA,MAAM,QAAQ,cAAsB,OAAe,aAA+D;AAChH,WAAO,KAAK,gBAAgB,QAAQ,cAAc,OAAO,WAAW;AAAA,EACtE;AAAA,EAEA,MAAM,oBAAoB,cAAsB,OAAe,aAAqD;AAClH,WAAO,KAAK,gBAAgB,oBAAoB,cAAc,OAAO,WAAW;AAAA,EAClF;AAAA,EAEA,MAAM,qBACJ,OACA,UACA,4BAC2D;AAC3D,WAAO,KAAK,gBAAgB,qBAAqB,OAAO,UAAU,0BAA0B;AAAA,EAC9F;AAAA,EAEA,MAAM,eACJ,OACA,4BACkE;AAClE,WAAO,KAAK,gBAAgB,eAAe,OAAO,0BAA0B;AAAA,EAC9E;AAAA,EAEA,MAAM,cACJ,OACA,UACA,WACA,4BACA,OACiE;AACjE,WAAO,KAAK,gBAAgB,cAAc,OAAO,UAAU,WAAW,4BAA4B,KAAK;AAAA,EACzG;AAAA,EAEA,MAAM,mBACJ,OACA,UACA,WACA,OACuB;AACvB,WAAO,KAAK,gBAAgB,mBAAmB,OAAO,UAAU,WAAW,KAAK;AAAA,EAClF;AAAA,EAEA,MAAM,mBACJ,OACA,UACA,WACA,aACA,4BACuB;AACvB,WAAO,KAAK,gBAAgB,mBAAmB,OAAO,UAAU,WAAW,aAAa,0BAA0B;AAAA,EACpH;AAAA,EAEA,MAAM,oBACJ,OACA,UACA,WACA,SACA,OACA,KACe;AACf,WAAO,KAAK,gBAAgB,oBAAoB,OAAO,UAAU,WAAW,SAAS,OAAO,GAAG;AAAA,EACjG;AAAA,EAEA,MAAM,eACJ,OACA,UACA,WACA,SACA,
|
|
4
|
+
"sourcesContent": ["import { Response } from 'express'\nimport { components } from '../types/api'\nimport type ReportingClient from '../data/reportingClient'\nimport ReportQuery from '../types/ReportQuery'\nimport Dict = NodeJS.Dict\nimport { ListWithWarnings } from '../data/types'\n\nclass ReportingService {\n constructor(private readonly reportingClient: ReportingClient) {\n this.reportingClient = reportingClient\n }\n\n async getCount(resourceName: string, token: string, listRequest: ReportQuery): Promise<number> {\n return this.reportingClient.getCount(resourceName, token, listRequest)\n }\n\n async getList(resourceName: string, token: string, listRequest: ReportQuery): Promise<Array<NodeJS.Dict<string>>> {\n return this.reportingClient.getList(resourceName, token, listRequest)\n }\n\n async getListWithWarnings(resourceName: string, token: string, listRequest: ReportQuery): Promise<ListWithWarnings> {\n return this.reportingClient.getListWithWarnings(resourceName, token, listRequest)\n }\n\n async getDefinitionSummary(\n token: string,\n reportId: string,\n dataProductDefinitionsPath?: string,\n ): Promise<components['schemas']['ReportDefinitionSummary']> {\n return this.reportingClient.getDefinitionSummary(token, reportId, dataProductDefinitionsPath)\n }\n\n async getDefinitions(\n token: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Array<components['schemas']['ReportDefinitionSummary']>> {\n return this.reportingClient.getDefinitions(token, dataProductDefinitionsPath)\n }\n\n async getDefinition(\n token: string,\n reportId: string,\n variantId: string,\n dataProductDefinitionsPath?: string,\n query?: Dict<string | string[]>,\n ): Promise<components['schemas']['SingleVariantReportDefinition']> {\n return this.reportingClient.getDefinition(token, reportId, variantId, dataProductDefinitionsPath, query)\n }\n\n async requestAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n query: Record<string, string | boolean | number>,\n ): Promise<Dict<string>> {\n return this.reportingClient.requestAsyncReport(token, reportId, variantId, query)\n }\n\n async cancelAsyncRequest(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Dict<string>> {\n return this.reportingClient.cancelAsyncRequest(token, reportId, variantId, executionId, dataProductDefinitionsPath)\n }\n\n async downloadAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n query: Record<string, string | string[]>,\n res: Response,\n ): Promise<void> {\n return this.reportingClient.downloadAsyncReport(token, reportId, variantId, tableId, query, res)\n }\n\n async getAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n query: Record<string, string | string[]>,\n ): Promise<Array<Record<string, string>>> {\n return this.reportingClient.getAsyncReport(token, reportId, variantId, tableId, query)\n }\n\n async getAsyncSummaryReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n summaryId: string,\n query: Dict<string | number>,\n ): Promise<Array<Record<string, string>>> {\n return this.reportingClient.getAsyncSummaryReport(token, reportId, variantId, tableId, summaryId, query)\n }\n\n async getAsyncReportStatus(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath: string,\n tableId: string,\n ): Promise<components['schemas']['StatementExecutionStatus']> {\n return this.reportingClient.getAsyncReportStatus(\n token,\n reportId,\n variantId,\n executionId,\n dataProductDefinitionsPath,\n tableId,\n )\n }\n\n async getAsyncCount(token: string, tableId: string, dataProductDefinitionsPath?: string): Promise<number> {\n return this.reportingClient.getAsyncCount(token, tableId, dataProductDefinitionsPath)\n }\n\n async getAsyncInteractiveCount(\n token: string,\n tableId: string,\n reportId: string,\n id: string,\n filters: ReportQuery,\n ): Promise<number> {\n return this.reportingClient.getAsyncInteractiveCount(token, tableId, reportId, id, filters)\n }\n}\n\nexport { ReportingService }\nexport default ReportingService\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,MAAM,iBAAiB;AAAA,EACrB,YAA6B,iBAAkC;AAAlC;AAC3B,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,MAAM,SAAS,cAAsB,OAAe,aAA2C;AAC7F,WAAO,KAAK,gBAAgB,SAAS,cAAc,OAAO,WAAW;AAAA,EACvE;AAAA,EAEA,MAAM,QAAQ,cAAsB,OAAe,aAA+D;AAChH,WAAO,KAAK,gBAAgB,QAAQ,cAAc,OAAO,WAAW;AAAA,EACtE;AAAA,EAEA,MAAM,oBAAoB,cAAsB,OAAe,aAAqD;AAClH,WAAO,KAAK,gBAAgB,oBAAoB,cAAc,OAAO,WAAW;AAAA,EAClF;AAAA,EAEA,MAAM,qBACJ,OACA,UACA,4BAC2D;AAC3D,WAAO,KAAK,gBAAgB,qBAAqB,OAAO,UAAU,0BAA0B;AAAA,EAC9F;AAAA,EAEA,MAAM,eACJ,OACA,4BACkE;AAClE,WAAO,KAAK,gBAAgB,eAAe,OAAO,0BAA0B;AAAA,EAC9E;AAAA,EAEA,MAAM,cACJ,OACA,UACA,WACA,4BACA,OACiE;AACjE,WAAO,KAAK,gBAAgB,cAAc,OAAO,UAAU,WAAW,4BAA4B,KAAK;AAAA,EACzG;AAAA,EAEA,MAAM,mBACJ,OACA,UACA,WACA,OACuB;AACvB,WAAO,KAAK,gBAAgB,mBAAmB,OAAO,UAAU,WAAW,KAAK;AAAA,EAClF;AAAA,EAEA,MAAM,mBACJ,OACA,UACA,WACA,aACA,4BACuB;AACvB,WAAO,KAAK,gBAAgB,mBAAmB,OAAO,UAAU,WAAW,aAAa,0BAA0B;AAAA,EACpH;AAAA,EAEA,MAAM,oBACJ,OACA,UACA,WACA,SACA,OACA,KACe;AACf,WAAO,KAAK,gBAAgB,oBAAoB,OAAO,UAAU,WAAW,SAAS,OAAO,GAAG;AAAA,EACjG;AAAA,EAEA,MAAM,eACJ,OACA,UACA,WACA,SACA,OACwC;AACxC,WAAO,KAAK,gBAAgB,eAAe,OAAO,UAAU,WAAW,SAAS,KAAK;AAAA,EACvF;AAAA,EAEA,MAAM,sBACJ,OACA,UACA,WACA,SACA,WACA,OACwC;AACxC,WAAO,KAAK,gBAAgB,sBAAsB,OAAO,UAAU,WAAW,SAAS,WAAW,KAAK;AAAA,EACzG;AAAA,EAEA,MAAM,qBACJ,OACA,UACA,WACA,aACA,4BACA,SAC4D;AAC5D,WAAO,KAAK,gBAAgB;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,cAAc,OAAe,SAAiB,4BAAsD;AACxG,WAAO,KAAK,gBAAgB,cAAc,OAAO,SAAS,0BAA0B;AAAA,EACtF;AAAA,EAEA,MAAM,yBACJ,OACA,SACA,UACA,IACA,SACiB;AACjB,WAAO,KAAK,gBAAgB,yBAAyB,OAAO,SAAS,UAAU,IAAI,OAAO;AAAA,EAC5F;AACF;AAGA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -83,7 +83,7 @@ class ReportingService {
|
|
|
83
83
|
variantId: string,
|
|
84
84
|
tableId: string,
|
|
85
85
|
query: Record<string, string | string[]>,
|
|
86
|
-
): Promise<Array<
|
|
86
|
+
): Promise<Array<Record<string, string>>> {
|
|
87
87
|
return this.reportingClient.getAsyncReport(token, reportId, variantId, tableId, query)
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -94,7 +94,7 @@ class ReportingService {
|
|
|
94
94
|
tableId: string,
|
|
95
95
|
summaryId: string,
|
|
96
96
|
query: Dict<string | number>,
|
|
97
|
-
): Promise<Array<
|
|
97
|
+
): Promise<Array<Record<string, string>>> {
|
|
98
98
|
return this.reportingClient.getAsyncSummaryReport(token, reportId, variantId, tableId, summaryId, query)
|
|
99
99
|
}
|
|
100
100
|
|
package/dpr/types/ReportQuery.js
CHANGED
|
@@ -34,7 +34,7 @@ __export(ReportQuery_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(ReportQuery_exports);
|
|
36
36
|
var import_urlHelper = require("../utils/urlHelper");
|
|
37
|
-
var import_utils = __toESM(require("../components/_reports/report-columns-form/utils"));
|
|
37
|
+
var import_utils = __toESM(require("../components/_reports/report-heading/report-columns/report-columns-form/utils"));
|
|
38
38
|
var import_UserReports = require("./UserReports");
|
|
39
39
|
const DEFAULT_FILTERS_PREFIX = "filters.";
|
|
40
40
|
class ReportQuery {
|