@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.16.1 → 4.17.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.
Files changed (211) hide show
  1. package/dpr/components/_catalogue/catalogue/utils.js +1 -1
  2. package/dpr/components/_catalogue/catalogue/utils.js.map +3 -3
  3. package/dpr/components/_catalogue/catalogue/utils.test.ts +15 -1
  4. package/dpr/components/_catalogue/catalogue/utils.ts +22 -4
  5. package/dpr/components/_catalogue/catalogue/view.njk +2 -1
  6. package/dpr/components/_catalogue/catalogue-filters/view.njk +2 -2
  7. package/dpr/components/_catalogue/catalogue-list/utils.js +1 -1
  8. package/dpr/components/_catalogue/catalogue-list/utils.js.map +3 -3
  9. package/dpr/components/_catalogue/catalogue-list/utils.ts +4 -5
  10. package/dpr/components/_catalogue/catalogue-search/clientClass.mjs +14 -0
  11. package/dpr/components/_catalogue/catalogue-search/view.njk +24 -1
  12. package/dpr/components/_charts/chart/Buckets.js +1 -1
  13. package/dpr/components/_charts/chart/Buckets.js.map +3 -3
  14. package/dpr/components/_charts/chart/Buckets.ts +44 -36
  15. package/dpr/components/_charts/chart/heatmap/HeatmapChart.js +1 -1
  16. package/dpr/components/_charts/chart/heatmap/HeatmapChart.js.map +2 -2
  17. package/dpr/components/_charts/chart/heatmap/HeatmapChart.ts +22 -14
  18. package/dpr/components/_charts/chart/heatmap/types.js +2 -0
  19. package/dpr/components/_charts/chart/heatmap/types.js.map +7 -0
  20. package/dpr/components/_charts/chart/heatmap/types.ts +6 -0
  21. package/dpr/components/_charts/utils.js +1 -1
  22. package/dpr/components/_charts/utils.js.map +3 -3
  23. package/dpr/components/_charts/utils.test.ts +10 -7
  24. package/dpr/components/_charts/utils.ts +57 -50
  25. package/dpr/components/_dashboards/dashboard/view.njk +1 -1
  26. package/dpr/components/_dashboards/dashboard-list/utils.js +1 -1
  27. package/dpr/components/_dashboards/dashboard-list/utils.js.map +2 -2
  28. package/dpr/components/_dashboards/dashboard-list/utils.test.ts +3 -3
  29. package/dpr/components/_dashboards/dashboard-list/utils.ts +16 -12
  30. package/dpr/components/_dashboards/dashboard-section/view.njk +1 -1
  31. package/dpr/components/_dashboards/dashboard-visualisation/DashboardVisualisation.js +2 -0
  32. package/dpr/components/_dashboards/dashboard-visualisation/DashboardVisualisation.js.map +7 -0
  33. package/dpr/components/_dashboards/dashboard-visualisation/DashboardVisualisation.ts +40 -0
  34. package/dpr/components/_dashboards/dashboard-visualisation/types.js +2 -0
  35. package/dpr/components/_dashboards/dashboard-visualisation/types.js.map +7 -0
  36. package/dpr/components/_dashboards/dashboard-visualisation/types.ts +102 -0
  37. package/dpr/components/_dashboards/dashboard-visualisation/view.njk +1 -1
  38. package/dpr/components/_dashboards/scorecard/Scorecard.js +1 -1
  39. package/dpr/components/_dashboards/scorecard/Scorecard.js.map +2 -2
  40. package/dpr/components/_dashboards/scorecard/Scorecard.ts +37 -29
  41. package/dpr/components/_dashboards/scorecard/types.js.map +1 -1
  42. package/dpr/components/_dashboards/scorecard/types.ts +1 -0
  43. package/dpr/components/_dashboards/scorecard/utils.js +1 -1
  44. package/dpr/components/_dashboards/scorecard/utils.js.map +2 -2
  45. package/dpr/components/_dashboards/scorecard/utils.test.ts +13 -4
  46. package/dpr/components/_dashboards/scorecard/utils.ts +6 -5
  47. package/dpr/components/_dashboards/scorecard/view.njk +6 -5
  48. package/dpr/components/_dashboards/scorecard-group/view.njk +4 -4
  49. package/dpr/components/_reports/report-actions/types.d.js.map +1 -1
  50. package/dpr/components/_reports/report-actions/types.d.ts +1 -1
  51. package/dpr/components/_reports/report-heading/view.njk +1 -1
  52. package/dpr/data/dashboardClient.js +1 -1
  53. package/dpr/data/dashboardClient.js.map +2 -2
  54. package/dpr/data/dashboardClient.ts +8 -7
  55. package/dpr/data/dprReportingClient.js +1 -1
  56. package/dpr/data/dprReportingClient.js.map +3 -3
  57. package/dpr/data/dprReportingClient.ts +2 -0
  58. package/dpr/data/reportingClient.js +1 -1
  59. package/dpr/data/reportingClient.js.map +1 -1
  60. package/dpr/data/reportingClient.ts +1 -1
  61. package/dpr/middleware/reportAuthoriser.js +1 -1
  62. package/dpr/middleware/reportAuthoriser.js.map +3 -3
  63. package/dpr/middleware/reportAuthoriser.ts +9 -20
  64. package/dpr/middleware/setUpDprResources.js +1 -1
  65. package/dpr/middleware/setUpDprResources.js.map +3 -3
  66. package/dpr/middleware/setUpDprResources.test.ts +7 -0
  67. package/dpr/middleware/setUpDprResources.ts +17 -2
  68. package/dpr/routes/journeys/download-report/controller.js +1 -1
  69. package/dpr/routes/journeys/download-report/controller.js.map +3 -3
  70. package/dpr/routes/journeys/download-report/controller.ts +4 -1
  71. package/dpr/routes/journeys/download-report/request-download/form/submitted/tests.cy.js +1 -1
  72. package/dpr/routes/journeys/download-report/request-download/form/submitted/tests.cy.js.map +2 -2
  73. package/dpr/routes/journeys/download-report/request-download/form/submitted/tests.cy.ts +1 -0
  74. package/dpr/routes/journeys/download-report/request-download/form/tests.cy.js +1 -1
  75. package/dpr/routes/journeys/download-report/request-download/form/tests.cy.js.map +2 -2
  76. package/dpr/routes/journeys/download-report/request-download/form/tests.cy.ts +1 -0
  77. package/dpr/routes/journeys/download-report/tests.cy.js +1 -1
  78. package/dpr/routes/journeys/download-report/tests.cy.js.map +2 -2
  79. package/dpr/routes/journeys/download-report/tests.cy.ts +2 -7
  80. package/dpr/routes/journeys/download-report/utils.js +1 -1
  81. package/dpr/routes/journeys/download-report/utils.js.map +3 -3
  82. package/dpr/routes/journeys/download-report/utils.ts +10 -7
  83. package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.js +1 -1
  84. package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.js.map +2 -2
  85. package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.ts +1 -0
  86. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.js +1 -1
  87. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.js.map +3 -3
  88. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.ts +5 -12
  89. package/dpr/routes/journeys/my-reports/bookmarks/utils.js +1 -1
  90. package/dpr/routes/journeys/my-reports/bookmarks/utils.js.map +3 -3
  91. package/dpr/routes/journeys/my-reports/bookmarks/utils.ts +11 -5
  92. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.js +1 -1
  93. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.js.map +3 -3
  94. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.ts +4 -6
  95. package/dpr/routes/journeys/my-reports/requested-reports/list/tests.cy.js +1 -1
  96. package/dpr/routes/journeys/my-reports/requested-reports/list/tests.cy.js.map +2 -2
  97. package/dpr/routes/journeys/my-reports/requested-reports/list/tests.cy.ts +1 -0
  98. package/dpr/routes/journeys/product-collection/routes.js +2 -0
  99. package/dpr/routes/journeys/product-collection/routes.js.map +7 -0
  100. package/dpr/routes/journeys/product-collection/routes.ts +28 -0
  101. package/dpr/routes/journeys/product-collection/selected/controller.js +2 -0
  102. package/dpr/routes/journeys/product-collection/selected/controller.js.map +7 -0
  103. package/dpr/routes/journeys/product-collection/selected/controller.ts +29 -0
  104. package/dpr/routes/journeys/product-collection/selected/routes.js +2 -0
  105. package/dpr/routes/journeys/product-collection/selected/routes.js.map +7 -0
  106. package/dpr/routes/journeys/product-collection/selected/routes.ts +15 -0
  107. package/dpr/routes/journeys/product-collection/selected/tests.cy.js +2 -0
  108. package/dpr/routes/journeys/product-collection/selected/tests.cy.js.map +7 -0
  109. package/dpr/routes/journeys/product-collection/selected/tests.cy.ts +54 -0
  110. package/dpr/routes/journeys/product-collection/selected/validation.js +2 -0
  111. package/dpr/routes/journeys/product-collection/selected/validation.js.map +7 -0
  112. package/dpr/routes/journeys/product-collection/selected/validation.ts +5 -0
  113. package/dpr/routes/journeys/request-missing-report/form/tests.cy.js +1 -1
  114. package/dpr/routes/journeys/request-missing-report/form/tests.cy.js.map +2 -2
  115. package/dpr/routes/journeys/request-missing-report/form/tests.cy.ts +1 -0
  116. package/dpr/routes/journeys/request-missing-report/tests.cy.js +1 -1
  117. package/dpr/routes/journeys/request-missing-report/tests.cy.js.map +2 -2
  118. package/dpr/routes/journeys/request-missing-report/tests.cy.ts +3 -4
  119. package/dpr/routes/journeys/request-report/filters/tests.cy.js +1 -1
  120. package/dpr/routes/journeys/request-report/filters/tests.cy.js.map +3 -3
  121. package/dpr/routes/journeys/request-report/filters/tests.cy.ts +3 -6
  122. package/dpr/routes/journeys/request-report/filters/utils.js +1 -1
  123. package/dpr/routes/journeys/request-report/filters/utils.js.map +2 -2
  124. package/dpr/routes/journeys/request-report/filters/utils.ts +2 -3
  125. package/dpr/routes/journeys/request-report/status/tests.cy.js +1 -1
  126. package/dpr/routes/journeys/request-report/status/tests.cy.js.map +2 -2
  127. package/dpr/routes/journeys/request-report/status/tests.cy.ts +2 -6
  128. package/dpr/routes/journeys/request-report/tests.cy.js +1 -1
  129. package/dpr/routes/journeys/request-report/tests.cy.js.map +3 -3
  130. package/dpr/routes/journeys/request-report/tests.cy.ts +5 -32
  131. package/dpr/routes/journeys/routes.js +1 -1
  132. package/dpr/routes/journeys/routes.js.map +2 -2
  133. package/dpr/routes/journeys/routes.ts +2 -0
  134. package/dpr/routes/journeys/view-report/async/controller.js.map +2 -2
  135. package/dpr/routes/journeys/view-report/async/controller.ts +2 -2
  136. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.js +1 -1
  137. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.js.map +2 -2
  138. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.ts +2 -9
  139. package/dpr/routes/journeys/view-report/async/dashboard/utils.js +1 -1
  140. package/dpr/routes/journeys/view-report/async/dashboard/utils.js.map +3 -3
  141. package/dpr/routes/journeys/view-report/async/dashboard/utils.ts +100 -95
  142. package/dpr/routes/journeys/view-report/async/report/controller.js +1 -1
  143. package/dpr/routes/journeys/view-report/async/report/controller.js.map +3 -3
  144. package/dpr/routes/journeys/view-report/async/report/controller.ts +4 -6
  145. package/dpr/routes/journeys/view-report/async/report/tests.cy.js +1 -1
  146. package/dpr/routes/journeys/view-report/async/report/tests.cy.js.map +2 -2
  147. package/dpr/routes/journeys/view-report/async/report/tests.cy.ts +8 -17
  148. package/dpr/routes/journeys/view-report/async/report/types.js +2 -0
  149. package/dpr/routes/journeys/view-report/async/report/types.js.map +7 -0
  150. package/dpr/routes/journeys/view-report/async/report/types.ts +31 -0
  151. package/dpr/routes/journeys/view-report/async/report/utils.js +1 -1
  152. package/dpr/routes/journeys/view-report/async/report/utils.js.map +3 -3
  153. package/dpr/routes/journeys/view-report/async/report/utils.ts +173 -136
  154. package/dpr/routes/journeys/view-report/sync/tests.cy.js +1 -1
  155. package/dpr/routes/journeys/view-report/sync/tests.cy.js.map +3 -3
  156. package/dpr/routes/journeys/view-report/sync/tests.cy.ts +3 -4
  157. package/dpr/services/dashboardService.js +1 -1
  158. package/dpr/services/dashboardService.js.map +2 -2
  159. package/dpr/services/dashboardService.ts +7 -5
  160. package/dpr/services/productCollection/productCollectionService.js +2 -0
  161. package/dpr/services/productCollection/productCollectionService.js.map +7 -0
  162. package/dpr/services/productCollection/productCollectionService.ts +25 -0
  163. package/dpr/services/productCollection/productCollectionStoreService.js +2 -0
  164. package/dpr/services/productCollection/productCollectionStoreService.js.map +7 -0
  165. package/dpr/services/productCollection/productCollectionStoreService.ts +26 -0
  166. package/dpr/services/reportingService.js +1 -1
  167. package/dpr/services/reportingService.js.map +1 -1
  168. package/dpr/services/reportingService.ts +1 -1
  169. package/dpr/types/AsyncReportUtils.js.map +1 -1
  170. package/dpr/types/AsyncReportUtils.ts +3 -4
  171. package/dpr/types/Charts.js +1 -1
  172. package/dpr/types/Charts.js.map +3 -3
  173. package/dpr/types/Charts.ts +0 -82
  174. package/dpr/types/Metrics.js +1 -1
  175. package/dpr/types/Metrics.js.map +1 -1
  176. package/dpr/types/Metrics.ts +7 -0
  177. package/dpr/types/ReportQuery.js +1 -1
  178. package/dpr/types/ReportQuery.js.map +3 -3
  179. package/dpr/types/ReportQuery.ts +24 -15
  180. package/dpr/types/ReportStore.js +1 -1
  181. package/dpr/types/ReportStore.js.map +1 -1
  182. package/dpr/types/ReportStore.ts +1 -0
  183. package/dpr/types/Services.d.js +1 -1
  184. package/dpr/types/Services.d.js.map +1 -1
  185. package/dpr/types/Services.d.ts +15 -0
  186. package/dpr/types/api.d.js +1 -1
  187. package/dpr/types/api.d.js.map +1 -1
  188. package/dpr/types/api.d.ts +197 -6
  189. package/dpr/utils/Personalisation/personalisationUtils.js +1 -1
  190. package/dpr/utils/Personalisation/personalisationUtils.js.map +3 -3
  191. package/dpr/utils/Personalisation/personalisationUtils.ts +15 -6
  192. package/dpr/utils/ReportStoreServiceUtils.js +1 -1
  193. package/dpr/utils/ReportStoreServiceUtils.js.map +3 -3
  194. package/dpr/utils/ReportStoreServiceUtils.ts +7 -0
  195. package/dpr/utils/UserStoreItemBuilder.js +1 -1
  196. package/dpr/utils/UserStoreItemBuilder.js.map +1 -1
  197. package/dpr/utils/UserStoreItemBuilder.ts +2 -2
  198. package/dpr/utils/datasetHelper.js +1 -1
  199. package/dpr/utils/datasetHelper.js.map +3 -3
  200. package/dpr/utils/datasetHelper.test.ts +11 -11
  201. package/dpr/utils/datasetHelper.ts +23 -8
  202. package/dpr/utils/logger.js +1 -1
  203. package/dpr/utils/logger.js.map +3 -3
  204. package/dpr/utils/logger.ts +6 -1
  205. package/package.json +2 -1
  206. package/dpr/components/_charts/chart/DashboardVisualisation.js +0 -2
  207. package/dpr/components/_charts/chart/DashboardVisualisation.js.map +0 -7
  208. package/dpr/components/_charts/chart/DashboardVisualisation.ts +0 -43
  209. package/dpr/components/_dashboards/dashboard/types.js +0 -2
  210. package/dpr/components/_dashboards/dashboard/types.js.map +0 -7
  211. package/dpr/components/_dashboards/dashboard/types.ts +0 -120
@@ -1,42 +1,42 @@
1
1
  /* eslint-disable prefer-destructuring */
2
2
  import { DashboardDataResponse } from '../../../types/Metrics'
3
- import DashboardVisualisationClass from '../../_charts/chart/DashboardVisualisation'
4
- import {
5
- DashboardVisualisation,
6
- DashboardVisualisationBucket,
7
- DashboardVisualisationColumnKey,
8
- DashboardVisualisationColumnMeasure,
9
- } from '../dashboard/types'
3
+ import DashboardVisualisationClass from '../dashboard-visualisation/DashboardVisualisation'
4
+ import { DashboardVisualisationBucket } from '../dashboard-visualisation/types'
10
5
  import DatasetHelper from '../../../utils/datasetHelper'
11
6
  import { CreateScorecardDataArgs, Scorecard, ScorecardDataset, ScorecardGroup, ScorecardTrend } from './types'
12
7
  import Buckets from '../../_charts/chart/Buckets'
8
+ import { components } from '../../../types/api'
13
9
 
14
10
  class ScorecardVisualisation extends DashboardVisualisationClass {
15
11
  private dataset: ScorecardDataset
16
12
 
17
- private groupKey: DashboardVisualisationColumnKey
13
+ private groupKey: components['schemas']['DashboardVisualisationColumnDefinition'] | undefined
18
14
 
19
- private groupKeyId: string
15
+ private groupKeyId: string | undefined
20
16
 
21
- private groupKeyDisplay: string
17
+ private groupKeyDisplay: string | undefined
22
18
 
23
- private bucketsHelper: Buckets
19
+ private bucketsHelper: Buckets | undefined
24
20
 
25
21
  private buckets: DashboardVisualisationBucket[] = []
26
22
 
27
- private valueColumn: DashboardVisualisationColumnMeasure
23
+ private valueColumn: components['schemas']['DashboardVisualisationColumnDefinition'] | undefined
28
24
 
29
- private valueKey: string
25
+ private valueKey = ''
30
26
 
31
- private titleColumn: DashboardVisualisationColumnMeasure
27
+ private titleColumn: components['schemas']['DashboardVisualisationColumnDefinition'] | undefined
32
28
 
33
- private titleKey: string
29
+ private titleKey = ''
34
30
 
35
31
  private group: boolean
36
32
 
37
33
  private ragColours: string[] = ['#cce2d8', '#fff7bf', '#f4cdc6']
38
34
 
39
- constructor(responseData: DashboardDataResponse[], definition: DashboardVisualisation, group = false) {
35
+ constructor(
36
+ responseData: DashboardDataResponse[],
37
+ definition: components['schemas']['DashboardVisualisationDefinition'],
38
+ group = false,
39
+ ) {
40
40
  super(responseData, definition)
41
41
  this.group = group
42
42
  this.dataset = this.getDataset(definition, responseData)
@@ -51,8 +51,10 @@ class ScorecardVisualisation extends DashboardVisualisationClass {
51
51
  }
52
52
 
53
53
  private initBuckets = (responseData: DashboardDataResponse[], valueKey: string) => {
54
- this.bucketsHelper = new Buckets(responseData, this.definition, valueKey, false, this.ragColours)
55
- this.buckets = new Buckets(responseData, this.definition, valueKey, false, this.ragColours).getBuckets()
54
+ if (this.definition.options?.buckets || this.definition.options?.useRagColour) {
55
+ this.bucketsHelper = new Buckets(responseData, this.definition, valueKey, false, this.ragColours)
56
+ this.buckets = new Buckets(responseData, this.definition, valueKey, false, this.ragColours).getBuckets()
57
+ }
56
58
  }
57
59
 
58
60
  private initGroupVars = () => {
@@ -66,11 +68,14 @@ class ScorecardVisualisation extends DashboardVisualisationClass {
66
68
  this.titleColumn = this.measures.find((col) => {
67
69
  return col.display || col.display === ''
68
70
  })
69
- this.titleKey = this.titleColumn?.id
71
+ this.titleKey = this.titleColumn?.id || ''
70
72
  }
71
73
  }
72
74
 
73
- private getDataset = (scorecardDefinition: DashboardVisualisation, rawData: DashboardDataResponse[]) => {
75
+ private getDataset = (
76
+ scorecardDefinition: components['schemas']['DashboardVisualisationDefinition'],
77
+ rawData: DashboardDataResponse[],
78
+ ) => {
74
79
  const latestData = DatasetHelper.getLastestDataset(rawData)
75
80
  const latestDataSetRows = DatasetHelper.getDatasetRows(scorecardDefinition, latestData)
76
81
  const latestTs = latestDataSetRows[0]?.ts?.raw
@@ -90,7 +95,7 @@ class ScorecardVisualisation extends DashboardVisualisationClass {
90
95
  }
91
96
 
92
97
  private setRagScore = (value: number, rag?: number) => {
93
- return this.bucketsHelper.getBucketForValue(value, rag)
98
+ return this.bucketsHelper?.getBucketForValue(value, rag)
94
99
  }
95
100
 
96
101
  private createScorecardData = ({
@@ -101,11 +106,14 @@ class ScorecardVisualisation extends DashboardVisualisationClass {
101
106
  valueFrom,
102
107
  prevVal,
103
108
  groupTitle,
104
- }: CreateScorecardDataArgs) => {
109
+ }: CreateScorecardDataArgs): Scorecard => {
105
110
  return {
111
+ id: this.definition.id,
106
112
  title,
107
113
  value,
108
- ...(!Number.isNaN(value) && this.buckets.length && { rag: this.setRagScore(<number>value, rag) }),
114
+ ...(!Number.isNaN(value) &&
115
+ this.buckets.length &&
116
+ this.bucketsHelper && { rag: this.setRagScore(<number>value, rag) }),
109
117
  valueFor,
110
118
  trend: this.createTrend(valueFor, valueFrom, value, prevVal),
111
119
  ...(groupTitle && {
@@ -212,8 +220,8 @@ class ScorecardVisualisation extends DashboardVisualisationClass {
212
220
  private createScorecardGroupFromListWithGroups = () => {
213
221
  const { latest, earliest } = this.dataset
214
222
 
215
- let earliestGroupedByKey = DatasetHelper.groupRowsByKey(earliest, this.groupKeyId)
216
- let latestGroupedByKey = DatasetHelper.groupRowsByKey(latest, this.groupKeyId)
223
+ let earliestGroupedByKey = DatasetHelper.groupRowsByKey(earliest, <string>this.groupKeyId)
224
+ let latestGroupedByKey = DatasetHelper.groupRowsByKey(latest, <string>this.groupKeyId)
217
225
  if (this.groupKeyId === this.titleKey) {
218
226
  latestGroupedByKey = [latestGroupedByKey.flat()]
219
227
  earliestGroupedByKey = [earliestGroupedByKey.flat()]
@@ -221,7 +229,7 @@ class ScorecardVisualisation extends DashboardVisualisationClass {
221
229
 
222
230
  const scorecardGroup = latestGroupedByKey.map((group, groupIndex) => {
223
231
  return {
224
- title: this.createGroupTitle(group[0]),
232
+ title: this.groupKeyDisplay ? `By ${this.groupKeyDisplay}` : '',
225
233
  scorecards: group.map((row, rowIndex) => {
226
234
  const values = this.getScorecardValues(row)
227
235
  const comparisonRow = earliestGroupedByKey[groupIndex][rowIndex]
@@ -240,7 +248,7 @@ class ScorecardVisualisation extends DashboardVisualisationClass {
240
248
 
241
249
  private getScorecardValues = (row: DashboardDataResponse) => {
242
250
  const { latestTs, earliestTs } = this.dataset
243
- const title = `${this.titleColumn.display} ${row[this.titleKey].raw}`
251
+ const title = `${this.titleColumn?.display} ${row[this.titleKey].raw}`
244
252
  const rowCol = row[this.valueKey]
245
253
  const { raw, rag: ragScore } = rowCol
246
254
  const value = Number(raw)
@@ -270,10 +278,10 @@ class ScorecardVisualisation extends DashboardVisualisationClass {
270
278
  const prevVal = earliest[index][this.valueKey].raw
271
279
  const valueFor = `${latestTs}`
272
280
  const valueFrom = `${earliestTs}`
273
- const title = this.titleColumn.display
281
+ const title = this.titleColumn?.display
274
282
 
275
283
  return this.createScorecardData({
276
- title,
284
+ title: title || '',
277
285
  value,
278
286
  rag,
279
287
  prevVal,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/dpr/components/_dashboards/scorecard/types.ts"],
4
- "sourcesContent": ["import { DashboardDataResponse } from '../../../types/Metrics'\n\nexport interface Scorecard {\n title: string\n group?: string\n value: number | string\n trend?: ScorecardTrend\n link?: {\n href: '#'\n displayName: 'View breakdown'\n }\n valueFor?: string\n rag?: ScorecardRag\n}\n\nexport interface ScorecardSubGroup {\n name: string\n scorecards: Scorecard[]\n}\n\nexport interface ScorecardGroup {\n title?: string\n description?: string\n scorecards: Scorecard[]\n}\n\nexport interface ScorecardTrend {\n direction: number\n value: number\n from: string\n}\n\nexport interface ScorecardRag {\n score: number\n colour: string\n}\n\nexport interface ScorecardDataset {\n earliest: DashboardDataResponse[]\n earliestTs: string | number\n latest: DashboardDataResponse[]\n latestTs: string | number\n}\n\nexport interface CreateScorecardDataArgs {\n title: string\n value: string | number\n rag?: number\n valueFor: string\n valueFrom: string\n prevVal: string | number\n groupTitle?: string\n}\n"],
4
+ "sourcesContent": ["import { DashboardDataResponse } from '../../../types/Metrics'\n\nexport interface Scorecard {\n id: string\n title: string\n group?: string\n value: number | string\n trend?: ScorecardTrend\n link?: {\n href: '#'\n displayName: 'View breakdown'\n }\n valueFor?: string\n rag?: ScorecardRag\n}\n\nexport interface ScorecardSubGroup {\n name: string\n scorecards: Scorecard[]\n}\n\nexport interface ScorecardGroup {\n title?: string\n description?: string\n scorecards: Scorecard[]\n}\n\nexport interface ScorecardTrend {\n direction: number\n value: number\n from: string\n}\n\nexport interface ScorecardRag {\n score: number\n colour: string\n}\n\nexport interface ScorecardDataset {\n earliest: DashboardDataResponse[]\n earliestTs: string | number\n latest: DashboardDataResponse[]\n latestTs: string | number\n}\n\nexport interface CreateScorecardDataArgs {\n title: string\n value: string | number\n rag?: number\n valueFor: string\n valueFrom: string\n prevVal: string | number\n groupTitle?: string\n}\n"],
5
5
  "mappings": "kWAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["types_exports", "__toCommonJS"]
7
7
  }
@@ -1,6 +1,7 @@
1
1
  import { DashboardDataResponse } from '../../../types/Metrics'
2
2
 
3
3
  export interface Scorecard {
4
+ id: string
4
5
  title: string
5
6
  group?: string
6
7
  value: number | string
@@ -1,2 +1,2 @@
1
- var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var l=(o,c)=>{for(var e in c)d(o,e,{get:c[e],enumerable:!0})},i=(o,c,e,t)=>{if(c&&typeof c=="object"||typeof c=="function")for(let r of u(c))!h.call(o,r)&&r!==e&&d(o,r,{get:()=>c[r],enumerable:!(t=p(c,r))||t.enumerable});return o};var m=o=>i(d({},"__esModule",{value:!0}),o);var S={};l(S,{default:()=>b,mergeScorecardsIntoGroup:()=>s});module.exports=m(S);var n=require("../dashboard/types");const s=o=>(o.reduce((e,t,r)=>(t.type===n.DashboardVisualisationType.SCORECARD&&e.push(r),e),[]).reduce((e,t)=>{const r=e[e.length-1];return(!r||r[r.length-1]!==t-1)&&e.push([]),e[e.length-1].push(t),e},[]).reverse().forEach(e=>{const t=e[0],r=e.map(a=>o[a].data).filter(a=>!!a);for(;e.length;)o.splice(e.pop(),1);r.length&&o.splice(t,0,{id:`${t}`,type:n.DashboardVisualisationType.SCORECARD_GROUP,data:[{scorecards:r}]})}),o);var b={mergeScorecardsIntoGroup:s};0&&(module.exports={mergeScorecardsIntoGroup});
1
+ var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var i=(o,c)=>{for(var e in c)d(o,e,{get:c[e],enumerable:!0})},l=(o,c,e,t)=>{if(c&&typeof c=="object"||typeof c=="function")for(let r of p(c))!h.call(o,r)&&r!==e&&d(o,r,{get:()=>c[r],enumerable:!(t=u(c,r))||t.enumerable});return o};var m=o=>l(d({},"__esModule",{value:!0}),o);var f={};i(f,{default:()=>b,mergeScorecardsIntoGroup:()=>s});module.exports=m(f);var n=require("../dashboard-visualisation/types");const s=o=>(o.reduce((e,t,r)=>(t.type===n.DashboardVisualisationType.SCORECARD&&e.push(r),e),[]).reduce((e,t)=>{const r=e[e.length-1];return(!r||r[r.length-1]!==t-1)&&e.push([]),e[e.length-1].push(t),e},[]).reverse().forEach(e=>{const t=e[0],r=e.map(a=>o[a].data).filter(a=>!!a);for(;e.length;){const a=e.pop();a!==void 0&&o.splice(a,1)}r.length&&o.splice(t,0,{id:`${t}`,type:n.DashboardVisualisationType.SCORECARD_GROUP,data:[{scorecards:r}]})}),o);var b={mergeScorecardsIntoGroup:s};0&&(module.exports={mergeScorecardsIntoGroup});
2
2
  //# sourceMappingURL=utils.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/dpr/components/_dashboards/scorecard/utils.ts"],
4
- "sourcesContent": ["import { DashboardUIVisualisation, DashboardVisualisationType } from '../dashboard/types'\nimport { Scorecard } from './types'\n\nexport const mergeScorecardsIntoGroup = (visualisations: DashboardUIVisualisation[]) => {\n const groupedScorecardIndexes: number[][] = visualisations\n // get scorecard indexes\n .reduce((acc: number[], vis: DashboardUIVisualisation, i: number) => {\n if (vis.type === DashboardVisualisationType.SCORECARD) acc.push(i)\n return acc\n }, [])\n // group adjacent indexes\n .reduce((r, n) => {\n const lastSubArray = r[r.length - 1]\n if (!lastSubArray || lastSubArray[lastSubArray.length - 1] !== n - 1) r.push([])\n r[r.length - 1].push(n)\n return r\n }, [])\n\n groupedScorecardIndexes.reverse().forEach((group: number[]) => {\n const spliceAtIndex = group[0]\n const scorecardGroup: Scorecard[] = group\n .map((scIndex: number) => {\n return visualisations[scIndex].data as Scorecard\n })\n .filter((scorecard: Scorecard) => !!scorecard)\n\n while (group.length) {\n visualisations.splice(group.pop(), 1)\n }\n\n if (scorecardGroup.length) {\n visualisations.splice(spliceAtIndex, 0, {\n id: `${spliceAtIndex}`,\n type: DashboardVisualisationType.SCORECARD_GROUP,\n data: [{ scorecards: scorecardGroup }],\n })\n }\n })\n\n return visualisations\n}\n\nexport default {\n mergeScorecardsIntoGroup,\n}\n"],
5
- "mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,6BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAqE,8BAG9D,MAAMF,EAA4BG,IACKA,EAEzC,OAAO,CAACC,EAAeC,EAA+BC,KACjDD,EAAI,OAAS,6BAA2B,WAAWD,EAAI,KAAKE,CAAC,EAC1DF,GACN,CAAC,CAAC,EAEJ,OAAO,CAACG,EAAGC,IAAM,CAChB,MAAMC,EAAeF,EAAEA,EAAE,OAAS,CAAC,EACnC,OAAI,CAACE,GAAgBA,EAAaA,EAAa,OAAS,CAAC,IAAMD,EAAI,IAAGD,EAAE,KAAK,CAAC,CAAC,EAC/EA,EAAEA,EAAE,OAAS,CAAC,EAAE,KAAKC,CAAC,EACfD,CACT,EAAG,CAAC,CAAC,EAEiB,QAAQ,EAAE,QAASG,GAAoB,CAC7D,MAAMC,EAAgBD,EAAM,CAAC,EACvBE,EAA8BF,EACjC,IAAKG,GACGV,EAAeU,CAAO,EAAE,IAChC,EACA,OAAQC,GAAyB,CAAC,CAACA,CAAS,EAE/C,KAAOJ,EAAM,QACXP,EAAe,OAAOO,EAAM,IAAI,EAAG,CAAC,EAGlCE,EAAe,QACjBT,EAAe,OAAOQ,EAAe,EAAG,CACtC,GAAI,GAAGA,CAAa,GACpB,KAAM,6BAA2B,gBACjC,KAAM,CAAC,CAAE,WAAYC,CAAe,CAAC,CACvC,CAAC,CAEL,CAAC,EAEMT,GAGT,IAAOJ,EAAQ,CACb,yBAAAC,CACF",
4
+ "sourcesContent": ["import { DashboardVisualisation, DashboardVisualisationType } from '../dashboard-visualisation/types'\nimport { Scorecard } from './types'\n\nexport const mergeScorecardsIntoGroup = (visualisations: DashboardVisualisation[]) => {\n const groupedScorecardIndexes: number[][] = visualisations\n // get scorecard indexes\n .reduce((acc: number[], vis: DashboardVisualisation, i: number) => {\n if (vis.type === DashboardVisualisationType.SCORECARD) acc.push(i)\n return acc\n }, [])\n // group adjacent indexes\n .reduce((r: number[][], n) => {\n const lastSubArray = r[r.length - 1]\n if (!lastSubArray || lastSubArray[lastSubArray.length - 1] !== n - 1) r.push([])\n r[r.length - 1].push(n)\n return r\n }, [])\n\n groupedScorecardIndexes.reverse().forEach((group: number[]) => {\n const spliceAtIndex = group[0]\n const scorecardGroup: Scorecard[] = group\n .map((scIndex: number) => {\n return visualisations[scIndex].data as Scorecard\n })\n .filter((scorecard: Scorecard) => !!scorecard)\n\n while (group.length) {\n const i = group.pop()\n if (i !== undefined) visualisations.splice(i, 1)\n }\n\n if (scorecardGroup.length) {\n visualisations.splice(spliceAtIndex, 0, {\n id: `${spliceAtIndex}`,\n type: DashboardVisualisationType.SCORECARD_GROUP,\n data: [{ scorecards: scorecardGroup }],\n })\n }\n })\n\n return visualisations\n}\n\nexport default {\n mergeScorecardsIntoGroup,\n}\n"],
5
+ "mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,6BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAmE,4CAG5D,MAAMF,EAA4BG,IACKA,EAEzC,OAAO,CAACC,EAAeC,EAA6BC,KAC/CD,EAAI,OAAS,6BAA2B,WAAWD,EAAI,KAAKE,CAAC,EAC1DF,GACN,CAAC,CAAC,EAEJ,OAAO,CAACG,EAAeC,IAAM,CAC5B,MAAMC,EAAeF,EAAEA,EAAE,OAAS,CAAC,EACnC,OAAI,CAACE,GAAgBA,EAAaA,EAAa,OAAS,CAAC,IAAMD,EAAI,IAAGD,EAAE,KAAK,CAAC,CAAC,EAC/EA,EAAEA,EAAE,OAAS,CAAC,EAAE,KAAKC,CAAC,EACfD,CACT,EAAG,CAAC,CAAC,EAEiB,QAAQ,EAAE,QAASG,GAAoB,CAC7D,MAAMC,EAAgBD,EAAM,CAAC,EACvBE,EAA8BF,EACjC,IAAKG,GACGV,EAAeU,CAAO,EAAE,IAChC,EACA,OAAQC,GAAyB,CAAC,CAACA,CAAS,EAE/C,KAAOJ,EAAM,QAAQ,CACnB,MAAMJ,EAAII,EAAM,IAAI,EAChBJ,IAAM,QAAWH,EAAe,OAAOG,EAAG,CAAC,CACjD,CAEIM,EAAe,QACjBT,EAAe,OAAOQ,EAAe,EAAG,CACtC,GAAI,GAAGA,CAAa,GACpB,KAAM,6BAA2B,gBACjC,KAAM,CAAC,CAAE,WAAYC,CAAe,CAAC,CACvC,CAAC,CAEL,CAAC,EAEMT,GAGT,IAAOJ,EAAQ,CACb,yBAAAC,CACF",
6
6
  "names": ["utils_exports", "__export", "utils_default", "mergeScorecardsIntoGroup", "__toCommonJS", "import_types", "visualisations", "acc", "vis", "i", "r", "n", "lastSubArray", "group", "spliceAtIndex", "scorecardGroup", "scIndex", "scorecard"]
7
7
  }
@@ -1,8 +1,11 @@
1
1
  import ScorecardUtils from './utils'
2
2
  import { Scorecard } from './types'
3
3
 
4
- import { DashboardUIVisualisation, DashboardVisualisationType } from '../dashboard/types'
5
- import { ChartCardData } from '../../../types/Charts'
4
+ import {
5
+ DashboardVisualisation,
6
+ DashboardVisualisationType,
7
+ DashboardVisualisatonCardData,
8
+ } from '../dashboard-visualisation/types'
6
9
 
7
10
  describe('ScorecardUtils', () => {
8
11
  let scorecardData1: Scorecard
@@ -10,6 +13,7 @@ describe('ScorecardUtils', () => {
10
13
 
11
14
  beforeEach(() => {
12
15
  scorecardData1 = {
16
+ id: '1',
13
17
  rag: {
14
18
  colour: 'red',
15
19
  score: 2,
@@ -25,6 +29,7 @@ describe('ScorecardUtils', () => {
25
29
  }
26
30
 
27
31
  scorecardData2 = {
32
+ id: '2',
28
33
  rag: {
29
34
  colour: 'red',
30
35
  score: 2,
@@ -42,7 +47,7 @@ describe('ScorecardUtils', () => {
42
47
 
43
48
  describe('mergeScorecards', () => {
44
49
  it('should merge individual scorecards into a scorecard group', () => {
45
- const visualistationData: DashboardUIVisualisation[] = [
50
+ const visualistationData: DashboardVisualisation[] = [
46
51
  {
47
52
  id: '1',
48
53
  type: DashboardVisualisationType.SCORECARD,
@@ -56,7 +61,7 @@ describe('ScorecardUtils', () => {
56
61
  {
57
62
  id: '3',
58
63
  type: DashboardVisualisationType.BAR,
59
- data: {} as unknown as ChartCardData,
64
+ data: {} as unknown as DashboardVisualisatonCardData,
60
65
  },
61
66
  {
62
67
  id: '4',
@@ -79,6 +84,7 @@ describe('ScorecardUtils', () => {
79
84
  {
80
85
  scorecards: [
81
86
  {
87
+ id: '1',
82
88
  rag: {
83
89
  colour: 'red',
84
90
  score: 2,
@@ -93,6 +99,7 @@ describe('ScorecardUtils', () => {
93
99
  valueFor: 'Jan 25',
94
100
  },
95
101
  {
102
+ id: '2',
96
103
  rag: {
97
104
  colour: 'red',
98
105
  score: 2,
@@ -122,6 +129,7 @@ describe('ScorecardUtils', () => {
122
129
  {
123
130
  scorecards: [
124
131
  {
132
+ id: '1',
125
133
  rag: {
126
134
  colour: 'red',
127
135
  score: 2,
@@ -136,6 +144,7 @@ describe('ScorecardUtils', () => {
136
144
  valueFor: 'Jan 25',
137
145
  },
138
146
  {
147
+ id: '2',
139
148
  rag: {
140
149
  colour: 'red',
141
150
  score: 2,
@@ -1,15 +1,15 @@
1
- import { DashboardUIVisualisation, DashboardVisualisationType } from '../dashboard/types'
1
+ import { DashboardVisualisation, DashboardVisualisationType } from '../dashboard-visualisation/types'
2
2
  import { Scorecard } from './types'
3
3
 
4
- export const mergeScorecardsIntoGroup = (visualisations: DashboardUIVisualisation[]) => {
4
+ export const mergeScorecardsIntoGroup = (visualisations: DashboardVisualisation[]) => {
5
5
  const groupedScorecardIndexes: number[][] = visualisations
6
6
  // get scorecard indexes
7
- .reduce((acc: number[], vis: DashboardUIVisualisation, i: number) => {
7
+ .reduce((acc: number[], vis: DashboardVisualisation, i: number) => {
8
8
  if (vis.type === DashboardVisualisationType.SCORECARD) acc.push(i)
9
9
  return acc
10
10
  }, [])
11
11
  // group adjacent indexes
12
- .reduce((r, n) => {
12
+ .reduce((r: number[][], n) => {
13
13
  const lastSubArray = r[r.length - 1]
14
14
  if (!lastSubArray || lastSubArray[lastSubArray.length - 1] !== n - 1) r.push([])
15
15
  r[r.length - 1].push(n)
@@ -25,7 +25,8 @@ export const mergeScorecardsIntoGroup = (visualisations: DashboardUIVisualisatio
25
25
  .filter((scorecard: Scorecard) => !!scorecard)
26
26
 
27
27
  while (group.length) {
28
- visualisations.splice(group.pop(), 1)
28
+ const i = group.pop()
29
+ if (i !== undefined) visualisations.splice(i, 1)
29
30
  }
30
31
 
31
32
  if (scorecardGroup.length) {
@@ -1,6 +1,7 @@
1
- {% macro dprScoreCard(scorecard) %}
1
+ {% macro dprScoreCard(scorecard, index) %}
2
2
  {% set classes = scorecard.classes %}
3
3
 
4
+ {% set id = scorecard.id %}
4
5
  {% set title = scorecard.title %}
5
6
  {% set value = scorecard.value %}
6
7
  {% set rag = scorecard.rag %}
@@ -20,13 +21,13 @@
20
21
  {% set directionIcon = '◼' %}
21
22
  {% set directionDisplay = '' %}
22
23
  {% endif %}
23
- <div class="dpr-scorecard" data-dpr-module="scorecard">
24
- <p class="govuk-heading-s govuk-!-margin-bottom-1">
24
+ <div class="dpr-scorecard" data-dpr-module="scorecard" aria-labelledby="{{ id }}_title_{{index }}">
25
+ <p id="{{ id }}_title_{{index}}" class="govuk-heading-s govuk-!-margin-bottom-1">
25
26
  {{ title }}
26
27
  </p>
27
28
 
28
- <p style="background-color: {{ rag.colour }}" class="govuk-body dpr-scorecard__value {% if rag %}govuk-tag--{{ rag.colour }}{% endif %}">{{ value }}</p>
29
- {% if rag.score %}
29
+ <p {% if rag %}style="background-color: {{ rag.colour }}"{% endif %} class="govuk-body dpr-scorecard__value {% if rag %}govuk-tag--{{ rag.colour }}{% endif %}">{{ value }}</p>
30
+ {% if rag.score !== 'undefined' %}
30
31
  <p class="govuk-body dpr-scorecard__value-description">Status: {{ rag.score }}</p>
31
32
  {% endif %}
32
33
 
@@ -6,13 +6,13 @@
6
6
  {% set title = group.title %}
7
7
  {% set scorecards = group.scorecards %}
8
8
 
9
- {% if scorecardGroup.length !== 1 %}
10
- <p class="govuk-heading-s"><strong>{{ title }}</strong></p>
9
+ {% if title %}
10
+ <h4 id="{{ id }}_scorecard_group_{{ loop.index }}" class="govuk-heading-s"><strong>{{ title }}</strong></h3>
11
11
  {% endif %}
12
12
 
13
- <div class="dpr-scorecard-group">
13
+ <div class="dpr-scorecard-group" {% if title %} aria-labelledby="{{ id }}_scorecard_group_{{ loop.index }}"{% endif %}>
14
14
  {% for scorecard in scorecards %}
15
- {{ dprScoreCard(scorecard) }}
15
+ {{ dprScoreCard(scorecard, loop.index) }}
16
16
  {% endfor %}
17
17
  </div> 
18
18
  {% endfor %}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/dpr/components/_reports/report-actions/types.d.ts"],
4
- "sourcesContent": ["import { LoadType } from '../../../types/UserReports'\n\nexport interface DownloadActionParams {\n enabled: boolean\n csrfToken: string\n reportId: string\n reportName: string\n name: string\n id: string\n tableId?: string\n columns: string[]\n definitionPath: string\n canDownload: boolean\n loadType: LoadType\n currentUrl: string\n currentQueryParams: string\n nestedBaseUrl: string\n sortColumn?: string\n sortedAsc?: string\n}\n\nexport interface ShareActionParams {\n reportName: string\n name: string\n url: string\n}\n\nexport interface RefreshActionParams {\n url: string\n executionId: string\n}\n\nexport interface PrintActionParams {\n enabled: boolean\n}\n\nexport interface CopyActionParams {\n url: string\n}\n\nexport interface GetActionsParams {\n refresh?: RefreshActionParams\n print?: PrintActionParams\n copy?: CopyActionParams\n share?: ShareActionParams\n download?: DownloadActionParams\n}\n\nexport interface ActionTemplate {\n id: string\n disabled: boolean\n text: string\n ariaLabelText: string\n}\n\nexport interface ActionTemplates {\n refresh: ActionTemplate\n printable: ActionTemplate\n sharable: ActionTemplate\n copy: ActionTemplate\n downloadable: ActionTemplate\n}\n\nexport interface ReportAction {\n id: string\n disabled: boolean\n text: string\n ariaLabelText: string\n href?: string\n attributes?: {\n reportId?: string\n id?: string\n csrfToken?: string\n tableId?: string\n type?: ReportType\n reportName?: string\n name?: string\n columns: string[]\n definitionPath: string\n }\n}\n"],
4
+ "sourcesContent": ["import { LoadType } from '../../../types/UserReports'\n\nexport interface DownloadActionParams {\n enabled: boolean\n csrfToken: string\n reportId: string\n reportName: string\n name: string\n id: string\n tableId?: string\n columns: string[]\n definitionPath: string\n canDownload: boolean\n loadType: LoadType\n currentUrl: string\n currentQueryParams?: string\n nestedBaseUrl: string\n sortColumn?: string\n sortedAsc?: string\n}\n\nexport interface ShareActionParams {\n reportName: string\n name: string\n url: string\n}\n\nexport interface RefreshActionParams {\n url: string\n executionId: string\n}\n\nexport interface PrintActionParams {\n enabled: boolean\n}\n\nexport interface CopyActionParams {\n url: string\n}\n\nexport interface GetActionsParams {\n refresh?: RefreshActionParams\n print?: PrintActionParams\n copy?: CopyActionParams\n share?: ShareActionParams\n download?: DownloadActionParams\n}\n\nexport interface ActionTemplate {\n id: string\n disabled: boolean\n text: string\n ariaLabelText: string\n}\n\nexport interface ActionTemplates {\n refresh: ActionTemplate\n printable: ActionTemplate\n sharable: ActionTemplate\n copy: ActionTemplate\n downloadable: ActionTemplate\n}\n\nexport interface ReportAction {\n id: string\n disabled: boolean\n text: string\n ariaLabelText: string\n href?: string\n attributes?: {\n reportId?: string\n id?: string\n csrfToken?: string\n tableId?: string\n type?: ReportType\n reportName?: string\n name?: string\n columns: string[]\n definitionPath: string\n }\n}\n"],
5
5
  "mappings": "kWAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["types_d_exports", "__toCommonJS"]
7
7
  }
@@ -13,7 +13,7 @@ export interface DownloadActionParams {
13
13
  canDownload: boolean
14
14
  loadType: LoadType
15
15
  currentUrl: string
16
- currentQueryParams: string
16
+ currentQueryParams?: string
17
17
  nestedBaseUrl: string
18
18
  sortColumn?: string
19
19
  sortedAsc?: string
@@ -40,7 +40,7 @@
40
40
  {% endif %}
41
41
  <div class="dpr-report-heading">
42
42
  <div class="dpr-report-heading__title">
43
- <h1 id="dpr-report-name" class="govuk-heading-l">
43
+ <h1 id="dpr-report-name" class="govuk-heading-xl">
44
44
  <span class="govuk-caption-l">{{ reportName }}</span>
45
45
  {{ name }}
46
46
  </h1>
@@ -1,2 +1,2 @@
1
- var u=Object.create;var g=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var p=(r,i)=>{for(var t in i)g(r,t,{get:i[t],enumerable:!0})},l=(r,i,t,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of C(i))!b.call(r,s)&&s!==t&&g(r,s,{get:()=>i[s],enumerable:!(n=m(i,s))||n.enumerable});return r};var c=(r,i,t)=>(t=r!=null?u($(r)):{},l(i||!r||!r.__esModule?g(t,"default",{value:r,enumerable:!0}):t,r)),y=r=>l(g({},"__esModule",{value:!0}),r);var P={};p(P,{DashboardClient:()=>h,default:()=>A});module.exports=y(P);var a=c(require("../utils/logger")),D=c(require("./restClient"));class h{constructor(i){this.restClient=new D.default("Dashboard API Client",i)}getDefinition(i,t,n,s){this.logInfo("Get definition:",{dpdId:n,dashboardId:t});const e={dataProductDefinitionsPath:s};return this.restClient.get({path:`/definitions/${n}/dashboards/${t}`,query:e,token:i}).then(o=>o)}requestAsyncDashboard(i,t,n,s){return this.logInfo("Request dashboard:",{reportId:t,dashboardId:n}),this.restClient.get({path:`/async/dashboards/${t}/${n}`,token:i,query:s}).then(e=>e)}getAsyncDashboard(i,t,n,s,e){return this.logInfo("Get dashboard:",{reportId:t,dashboardId:n,tableId:s}),this.restClient.get({path:`/reports/${t}/dashboards/${n}/tables/${s}/result`,token:i,query:e}).then(o=>o)}getAsyncStatus(i,t,n,s,e,o){return this.logInfo("Get status:",{reportId:t,dashboardId:n,executionId:s,tableId:e}),this.restClient.get({path:`/reports/${t}/dashboards/${n}/statements/${s}/status`,token:i,query:{dataProductDefinitionsPath:o,tableId:e}}).then(f=>f)}cancelAsyncRequest(i,t,n,s,e){return this.logInfo("Cancel request:",{reportId:t,dashboardId:n,executionId:s}),this.restClient.delete({path:`/reports/${t}/dashboards/${n}/statements/${s}`,token:i,query:{dataProductDefinitionsPath:e}}).then(o=>o)}logInfo(i,t){a.default.info(`Dashboard client: ${i}:`),t&&Object.keys(t).length&&a.default.info(JSON.stringify(t,null,2))}}var A=h;0&&(module.exports={DashboardClient});
1
+ var m=Object.create;var g=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var $=(r,s)=>{for(var t in s)g(r,t,{get:s[t],enumerable:!0})},c=(r,s,t,n)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of u(s))!C.call(r,i)&&i!==t&&g(r,i,{get:()=>s[i],enumerable:!(n=p(s,i))||n.enumerable});return r};var l=(r,s,t)=>(t=r!=null?m(b(r)):{},c(s||!r||!r.__esModule?g(t,"default",{value:r,enumerable:!0}):t,r)),y=r=>c(g({},"__esModule",{value:!0}),r);var P={};$(P,{DashboardClient:()=>h,default:()=>R});module.exports=y(P);var a=l(require("../utils/logger")),D=l(require("./restClient"));class h{constructor(s){this.restClient=new D.default("Dashboard API Client",s)}getDefinition(s,t,n,i){this.logInfo("Get definition:",{dpdId:n,dashboardId:t});const e={dataProductDefinitionsPath:i};return this.restClient.get({path:`/definitions/${n}/dashboards/${t}`,query:e,token:s}).then(o=>o)}requestAsyncDashboard(s,t,n,i){return this.logInfo("Request dashboard:",{reportId:t,dashboardId:n}),this.restClient.get({path:`/async/dashboards/${t}/${n}`,token:s,query:i}).then(e=>e)}getAsyncDashboard(s,t,n,i,e){return this.logInfo("Get dashboard:",{reportId:t,dashboardId:n,tableId:i}),this.restClient.get({path:`/reports/${t}/dashboards/${n}/tables/${i}/result`,token:s,query:e}).then(o=>o)}getAsyncStatus(s,t,n,i,e,o){return this.logInfo("Get status:",{reportId:t,dashboardId:n,executionId:i,tableId:e}),this.restClient.get({path:`/reports/${t}/dashboards/${n}/statements/${i}/status`,token:s,query:{dataProductDefinitionsPath:o,tableId:e}}).then(f=>f)}cancelAsyncRequest(s,t,n,i,e){return this.logInfo("Cancel request:",{reportId:t,dashboardId:n,executionId:i}),this.restClient.delete({path:`/reports/${t}/dashboards/${n}/statements/${i}`,token:s,query:{dataProductDefinitionsPath:e}}).then(o=>o)}logInfo(s,t){a.default.info(`Dashboard client: ${s}:`),t&&Object.keys(t).length&&a.default.info(JSON.stringify(t,null,2))}}var R=h;0&&(module.exports={DashboardClient});
2
2
  //# sourceMappingURL=dashboardClient.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/dpr/data/dashboardClient.ts"],
4
- "sourcesContent": ["import { DashboardDefinition } from '../components/_dashboards/dashboard/types'\nimport logger from '../utils/logger'\nimport RestClient from './restClient'\nimport Dict = NodeJS.Dict\nimport { ApiConfig } from './types'\n\nclass DashboardClient {\n restClient: RestClient\n\n constructor(config: ApiConfig) {\n this.restClient = new RestClient('Dashboard API Client', config)\n }\n\n getDefinition(\n token: string,\n dashboardId: string,\n dpdId: string,\n definitionsPath?: string,\n ): Promise<DashboardDefinition> {\n this.logInfo('Get definition:', { dpdId, dashboardId })\n const query = {\n dataProductDefinitionsPath: definitionsPath,\n }\n return this.restClient\n .get({\n path: `/definitions/${dpdId}/dashboards/${dashboardId}`,\n query,\n token,\n })\n .then((response) => <DashboardDefinition>response)\n }\n\n requestAsyncDashboard(\n token: string,\n reportId: string,\n dashboardId: string,\n query: Record<string, string | boolean | number>,\n ): Promise<Dict<string>> {\n this.logInfo('Request dashboard:', { reportId, dashboardId })\n\n return this.restClient\n .get({\n path: `/async/dashboards/${reportId}/${dashboardId}`,\n token,\n query,\n })\n .then((response) => <Dict<string>>response)\n }\n\n getAsyncDashboard(\n token: string,\n reportId: string,\n dashboardId: string,\n tableId: string,\n query: Dict<string | number>,\n ): Promise<Array<Dict<string>>> {\n this.logInfo('Get dashboard:', { reportId, dashboardId, tableId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/dashboards/${dashboardId}/tables/${tableId}/result`,\n token,\n query,\n })\n .then((response) => <Array<Dict<string>>>response)\n }\n\n getAsyncStatus(\n token: string,\n reportId: string,\n dashboardId: string,\n executionId: string,\n tableId?: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Dict<string>> {\n this.logInfo('Get status:', { reportId, dashboardId, executionId, tableId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/dashboards/${dashboardId}/statements/${executionId}/status`,\n token,\n query: {\n dataProductDefinitionsPath,\n tableId,\n },\n })\n .then((response) => <Dict<string>>response)\n }\n\n cancelAsyncRequest(\n token: string,\n reportId: string,\n dashboardId: string,\n executionId: string,\n dataProductDefinitionsPath: string,\n ): Promise<Dict<string>> {\n this.logInfo('Cancel request:', { reportId, dashboardId, executionId })\n\n return this.restClient\n .delete({\n path: `/reports/${reportId}/dashboards/${dashboardId}/statements/${executionId}`,\n token,\n query: {\n dataProductDefinitionsPath,\n },\n })\n .then((response) => <Dict<string>>response)\n }\n\n logInfo(title: string, args?: Dict<string>) {\n logger.info(`Dashboard client: ${title}:`)\n if (args && Object.keys(args).length) logger.info(JSON.stringify(args, null, 2))\n }\n}\n\nexport { DashboardClient }\nexport default DashboardClient\n"],
5
- "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAmB,8BACnBC,EAAuB,2BAIvB,MAAMJ,CAAgB,CAGpB,YAAYK,EAAmB,CAC7B,KAAK,WAAa,IAAI,EAAAC,QAAW,uBAAwBD,CAAM,CACjE,CAEA,cACEE,EACAC,EACAC,EACAC,EAC8B,CAC9B,KAAK,QAAQ,kBAAmB,CAAE,MAAAD,EAAO,YAAAD,CAAY,CAAC,EACtD,MAAMG,EAAQ,CACZ,2BAA4BD,CAC9B,EACA,OAAO,KAAK,WACT,IAAI,CACH,KAAM,gBAAgBD,CAAK,eAAeD,CAAW,GACrD,MAAAG,EACA,MAAAJ,CACF,CAAC,EACA,KAAMK,GAAkCA,CAAQ,CACrD,CAEA,sBACEL,EACAM,EACAL,EACAG,EACuB,CACvB,YAAK,QAAQ,qBAAsB,CAAE,SAAAE,EAAU,YAAAL,CAAY,CAAC,EAErD,KAAK,WACT,IAAI,CACH,KAAM,qBAAqBK,CAAQ,IAAIL,CAAW,GAClD,MAAAD,EACA,MAAAI,CACF,CAAC,EACA,KAAMC,GAA2BA,CAAQ,CAC9C,CAEA,kBACEL,EACAM,EACAL,EACAM,EACAH,EAC8B,CAC9B,YAAK,QAAQ,iBAAkB,CAAE,SAAAE,EAAU,YAAAL,EAAa,QAAAM,CAAQ,CAAC,EAE1D,KAAK,WACT,IAAI,CACH,KAAM,YAAYD,CAAQ,eAAeL,CAAW,WAAWM,CAAO,UACtE,MAAAP,EACA,MAAAI,CACF,CAAC,EACA,KAAMC,GAAkCA,CAAQ,CACrD,CAEA,eACEL,EACAM,EACAL,EACAO,EACAD,EACAE,EACuB,CACvB,YAAK,QAAQ,cAAe,CAAE,SAAAH,EAAU,YAAAL,EAAa,YAAAO,EAAa,QAAAD,CAAQ,CAAC,EAEpE,KAAK,WACT,IAAI,CACH,KAAM,YAAYD,CAAQ,eAAeL,CAAW,eAAeO,CAAW,UAC9E,MAAAR,EACA,MAAO,CACL,2BAAAS,EACA,QAAAF,CACF,CACF,CAAC,EACA,KAAMF,GAA2BA,CAAQ,CAC9C,CAEA,mBACEL,EACAM,EACAL,EACAO,EACAC,EACuB,CACvB,YAAK,QAAQ,kBAAmB,CAAE,SAAAH,EAAU,YAAAL,EAAa,YAAAO,CAAY,CAAC,EAE/D,KAAK,WACT,OAAO,CACN,KAAM,YAAYF,CAAQ,eAAeL,CAAW,eAAeO,CAAW,GAC9E,MAAAR,EACA,MAAO,CACL,2BAAAS,CACF,CACF,CAAC,EACA,KAAMJ,GAA2BA,CAAQ,CAC9C,CAEA,QAAQK,EAAeC,EAAqB,CAC1C,EAAAC,QAAO,KAAK,qBAAqBF,CAAK,GAAG,EACrCC,GAAQ,OAAO,KAAKA,CAAI,EAAE,QAAQ,EAAAC,QAAO,KAAK,KAAK,UAAUD,EAAM,KAAM,CAAC,CAAC,CACjF,CACF,CAGA,IAAOjB,EAAQD",
4
+ "sourcesContent": ["import logger from '../utils/logger'\nimport RestClient from './restClient'\nimport Dict = NodeJS.Dict\nimport { ApiConfig } from './types'\nimport { components } from '../types/api'\nimport { DashboardDataResponse } from '../types/Metrics'\n\nclass DashboardClient {\n restClient: RestClient\n\n constructor(config: ApiConfig) {\n this.restClient = new RestClient('Dashboard API Client', config)\n }\n\n getDefinition(\n token: string,\n dashboardId: string,\n dpdId: string,\n definitionsPath?: string,\n ): Promise<components['schemas']['DashboardDefinition']> {\n this.logInfo('Get definition:', { dpdId, dashboardId })\n const query = {\n dataProductDefinitionsPath: definitionsPath,\n }\n return this.restClient\n .get({\n path: `/definitions/${dpdId}/dashboards/${dashboardId}`,\n query,\n token,\n })\n .then((response) => <components['schemas']['DashboardDefinition']>response)\n }\n\n requestAsyncDashboard(\n token: string,\n reportId: string,\n dashboardId: string,\n query: Record<string, string | boolean | number>,\n ): Promise<Dict<string>> {\n this.logInfo('Request dashboard:', { reportId, dashboardId })\n\n return this.restClient\n .get({\n path: `/async/dashboards/${reportId}/${dashboardId}`,\n token,\n query,\n })\n .then((response) => <Dict<string>>response)\n }\n\n getAsyncDashboard(\n token: string,\n reportId: string,\n dashboardId: string,\n tableId: string,\n query: Record<string, string | string[]>,\n ): Promise<DashboardDataResponse[][]> {\n this.logInfo('Get dashboard:', { reportId, dashboardId, tableId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/dashboards/${dashboardId}/tables/${tableId}/result`,\n token,\n query,\n })\n .then((response) => <DashboardDataResponse[][]>response)\n }\n\n getAsyncStatus(\n token: string,\n reportId: string,\n dashboardId: string,\n executionId: string,\n tableId?: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Dict<string>> {\n this.logInfo('Get status:', { reportId, dashboardId, executionId, tableId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/dashboards/${dashboardId}/statements/${executionId}/status`,\n token,\n query: {\n dataProductDefinitionsPath,\n tableId,\n },\n })\n .then((response) => <Dict<string>>response)\n }\n\n cancelAsyncRequest(\n token: string,\n reportId: string,\n dashboardId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Dict<string>> {\n this.logInfo('Cancel request:', { reportId, dashboardId, executionId })\n\n return this.restClient\n .delete({\n path: `/reports/${reportId}/dashboards/${dashboardId}/statements/${executionId}`,\n token,\n query: {\n dataProductDefinitionsPath,\n },\n })\n .then((response) => <Dict<string>>response)\n }\n\n logInfo(title: string, args?: Dict<string>) {\n logger.info(`Dashboard client: ${title}:`)\n if (args && Object.keys(args).length) logger.info(JSON.stringify(args, null, 2))\n }\n}\n\nexport { DashboardClient }\nexport default DashboardClient\n"],
5
+ "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAmB,8BACnBC,EAAuB,2BAMvB,MAAMJ,CAAgB,CAGpB,YAAYK,EAAmB,CAC7B,KAAK,WAAa,IAAI,EAAAC,QAAW,uBAAwBD,CAAM,CACjE,CAEA,cACEE,EACAC,EACAC,EACAC,EACuD,CACvD,KAAK,QAAQ,kBAAmB,CAAE,MAAAD,EAAO,YAAAD,CAAY,CAAC,EACtD,MAAMG,EAAQ,CACZ,2BAA4BD,CAC9B,EACA,OAAO,KAAK,WACT,IAAI,CACH,KAAM,gBAAgBD,CAAK,eAAeD,CAAW,GACrD,MAAAG,EACA,MAAAJ,CACF,CAAC,EACA,KAAMK,GAA2DA,CAAQ,CAC9E,CAEA,sBACEL,EACAM,EACAL,EACAG,EACuB,CACvB,YAAK,QAAQ,qBAAsB,CAAE,SAAAE,EAAU,YAAAL,CAAY,CAAC,EAErD,KAAK,WACT,IAAI,CACH,KAAM,qBAAqBK,CAAQ,IAAIL,CAAW,GAClD,MAAAD,EACA,MAAAI,CACF,CAAC,EACA,KAAMC,GAA2BA,CAAQ,CAC9C,CAEA,kBACEL,EACAM,EACAL,EACAM,EACAH,EACoC,CACpC,YAAK,QAAQ,iBAAkB,CAAE,SAAAE,EAAU,YAAAL,EAAa,QAAAM,CAAQ,CAAC,EAE1D,KAAK,WACT,IAAI,CACH,KAAM,YAAYD,CAAQ,eAAeL,CAAW,WAAWM,CAAO,UACtE,MAAAP,EACA,MAAAI,CACF,CAAC,EACA,KAAMC,GAAwCA,CAAQ,CAC3D,CAEA,eACEL,EACAM,EACAL,EACAO,EACAD,EACAE,EACuB,CACvB,YAAK,QAAQ,cAAe,CAAE,SAAAH,EAAU,YAAAL,EAAa,YAAAO,EAAa,QAAAD,CAAQ,CAAC,EAEpE,KAAK,WACT,IAAI,CACH,KAAM,YAAYD,CAAQ,eAAeL,CAAW,eAAeO,CAAW,UAC9E,MAAAR,EACA,MAAO,CACL,2BAAAS,EACA,QAAAF,CACF,CACF,CAAC,EACA,KAAMF,GAA2BA,CAAQ,CAC9C,CAEA,mBACEL,EACAM,EACAL,EACAO,EACAC,EACuB,CACvB,YAAK,QAAQ,kBAAmB,CAAE,SAAAH,EAAU,YAAAL,EAAa,YAAAO,CAAY,CAAC,EAE/D,KAAK,WACT,OAAO,CACN,KAAM,YAAYF,CAAQ,eAAeL,CAAW,eAAeO,CAAW,GAC9E,MAAAR,EACA,MAAO,CACL,2BAAAS,CACF,CACF,CAAC,EACA,KAAMJ,GAA2BA,CAAQ,CAC9C,CAEA,QAAQK,EAAeC,EAAqB,CAC1C,EAAAC,QAAO,KAAK,qBAAqBF,CAAK,GAAG,EACrCC,GAAQ,OAAO,KAAKA,CAAI,EAAE,QAAQ,EAAAC,QAAO,KAAK,KAAK,UAAUD,EAAM,KAAM,CAAC,CAAC,CACjF,CACF,CAGA,IAAOjB,EAAQD",
6
6
  "names": ["dashboardClient_exports", "__export", "DashboardClient", "dashboardClient_default", "__toCommonJS", "import_logger", "import_restClient", "config", "RestClient", "token", "dashboardId", "dpdId", "definitionsPath", "query", "response", "reportId", "tableId", "executionId", "dataProductDefinitionsPath", "title", "args", "logger"]
7
7
  }
@@ -1,8 +1,9 @@
1
- import { DashboardDefinition } from '../components/_dashboards/dashboard/types'
2
1
  import logger from '../utils/logger'
3
2
  import RestClient from './restClient'
4
3
  import Dict = NodeJS.Dict
5
4
  import { ApiConfig } from './types'
5
+ import { components } from '../types/api'
6
+ import { DashboardDataResponse } from '../types/Metrics'
6
7
 
7
8
  class DashboardClient {
8
9
  restClient: RestClient
@@ -16,7 +17,7 @@ class DashboardClient {
16
17
  dashboardId: string,
17
18
  dpdId: string,
18
19
  definitionsPath?: string,
19
- ): Promise<DashboardDefinition> {
20
+ ): Promise<components['schemas']['DashboardDefinition']> {
20
21
  this.logInfo('Get definition:', { dpdId, dashboardId })
21
22
  const query = {
22
23
  dataProductDefinitionsPath: definitionsPath,
@@ -27,7 +28,7 @@ class DashboardClient {
27
28
  query,
28
29
  token,
29
30
  })
30
- .then((response) => <DashboardDefinition>response)
31
+ .then((response) => <components['schemas']['DashboardDefinition']>response)
31
32
  }
32
33
 
33
34
  requestAsyncDashboard(
@@ -52,8 +53,8 @@ class DashboardClient {
52
53
  reportId: string,
53
54
  dashboardId: string,
54
55
  tableId: string,
55
- query: Dict<string | number>,
56
- ): Promise<Array<Dict<string>>> {
56
+ query: Record<string, string | string[]>,
57
+ ): Promise<DashboardDataResponse[][]> {
57
58
  this.logInfo('Get dashboard:', { reportId, dashboardId, tableId })
58
59
 
59
60
  return this.restClient
@@ -62,7 +63,7 @@ class DashboardClient {
62
63
  token,
63
64
  query,
64
65
  })
65
- .then((response) => <Array<Dict<string>>>response)
66
+ .then((response) => <DashboardDataResponse[][]>response)
66
67
  }
67
68
 
68
69
  getAsyncStatus(
@@ -92,7 +93,7 @@ class DashboardClient {
92
93
  reportId: string,
93
94
  dashboardId: string,
94
95
  executionId: string,
95
- dataProductDefinitionsPath: string,
96
+ dataProductDefinitionsPath?: string,
96
97
  ): Promise<Dict<string>> {
97
98
  this.logInfo('Cancel request:', { reportId, dashboardId, executionId })
98
99
 
@@ -1,2 +1,2 @@
1
- var d=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of g(e))!D.call(t,i)&&i!==r&&o(t,i,{get:()=>e[i],enumerable:!(p=f(e,i))||p.enumerable});return t};var n=(t,e,r)=>(r=t!=null?d(w(t)):{},m(e||!t||!t.__esModule?o(r,"default",{value:t,enumerable:!0}):r,t)),h=t=>m(o({},"__esModule",{value:!0}),t);var x={};b(x,{default:()=>u,initDprReportingClients:()=>R});module.exports=h(x);var s=n(require("./reportingClient")),l=n(require("./dashboardClient")),a=n(require("./reportDataStore")),C=n(require("../services/missingReport/missingReportClient"));const R=(t,e,r)=>({reportingClient:new s.default(t),dashboardClient:new l.default(t),reportDataStore:new a.default(e,r),missingReportClient:new C.default(t)});var u=R;0&&(module.exports={initDprReportingClients});
1
+ var R=Object.create;var i=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of w(e))!D.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(l=f(e,o))||l.enumerable});return t};var n=(t,e,r)=>(r=t!=null?R(u(t)):{},m(e||!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),b=t=>m(i({},"__esModule",{value:!0}),t);var h={};S(h,{default:()=>g,initDprReportingClients:()=>c});module.exports=b(h);var p=n(require("./reportingClient")),s=n(require("./dashboardClient")),C=n(require("./reportDataStore")),a=n(require("../services/missingReport/missingReportClient")),d=require("../services/productCollection/productCollectionService");const c=(t,e,r)=>({reportingClient:new p.default(t),dashboardClient:new s.default(t),reportDataStore:new C.default(e,r),missingReportClient:new a.default(t),productCollectionService:new d.ProductCollectionService(t)});var g=c;0&&(module.exports={initDprReportingClients});
2
2
  //# sourceMappingURL=dprReportingClient.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/dpr/data/dprReportingClient.ts"],
4
- "sourcesContent": ["import ReportingClient from './reportingClient'\nimport DashboardClient from './dashboardClient'\nimport ReportDataStore, { RedisClient } from './reportDataStore'\nimport { ApiConfig } from './types'\nimport MissingReportClient from '../services/missingReport/missingReportClient'\n\nexport const initDprReportingClients = (\n reportingApiConfig: ApiConfig,\n redisClient: RedisClient,\n storePrefix?: string,\n) => {\n return {\n reportingClient: new ReportingClient(reportingApiConfig),\n dashboardClient: new DashboardClient(reportingApiConfig),\n reportDataStore: new ReportDataStore(redisClient, storePrefix),\n missingReportClient: new MissingReportClient(reportingApiConfig),\n }\n}\n\nexport default initDprReportingClients\n"],
5
- "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,4BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA4B,gCAC5BC,EAA4B,gCAC5BC,EAA6C,gCAE7CC,EAAgC,4DAEzB,MAAML,EAA0B,CACrCM,EACAC,EACAC,KAEO,CACL,gBAAiB,IAAI,EAAAC,QAAgBH,CAAkB,EACvD,gBAAiB,IAAI,EAAAI,QAAgBJ,CAAkB,EACvD,gBAAiB,IAAI,EAAAK,QAAgBJ,EAAaC,CAAW,EAC7D,oBAAqB,IAAI,EAAAI,QAAoBN,CAAkB,CACjE,GAGF,IAAOP,EAAQC",
6
- "names": ["dprReportingClient_exports", "__export", "dprReportingClient_default", "initDprReportingClients", "__toCommonJS", "import_reportingClient", "import_dashboardClient", "import_reportDataStore", "import_missingReportClient", "reportingApiConfig", "redisClient", "storePrefix", "ReportingClient", "DashboardClient", "ReportDataStore", "MissingReportClient"]
4
+ "sourcesContent": ["import ReportingClient from './reportingClient'\nimport DashboardClient from './dashboardClient'\nimport ReportDataStore, { RedisClient } from './reportDataStore'\nimport { ApiConfig } from './types'\nimport MissingReportClient from '../services/missingReport/missingReportClient'\nimport { ProductCollectionService } from '../services/productCollection/productCollectionService'\n\nexport const initDprReportingClients = (\n reportingApiConfig: ApiConfig,\n redisClient: RedisClient,\n storePrefix?: string,\n) => {\n return {\n reportingClient: new ReportingClient(reportingApiConfig),\n dashboardClient: new DashboardClient(reportingApiConfig),\n reportDataStore: new ReportDataStore(redisClient, storePrefix),\n missingReportClient: new MissingReportClient(reportingApiConfig),\n productCollectionService: new ProductCollectionService(reportingApiConfig),\n }\n}\n\nexport default initDprReportingClients\n"],
5
+ "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,4BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA4B,gCAC5BC,EAA4B,gCAC5BC,EAA6C,gCAE7CC,EAAgC,4DAChCC,EAAyC,kEAElC,MAAMN,EAA0B,CACrCO,EACAC,EACAC,KAEO,CACL,gBAAiB,IAAI,EAAAC,QAAgBH,CAAkB,EACvD,gBAAiB,IAAI,EAAAI,QAAgBJ,CAAkB,EACvD,gBAAiB,IAAI,EAAAK,QAAgBJ,EAAaC,CAAW,EAC7D,oBAAqB,IAAI,EAAAI,QAAoBN,CAAkB,EAC/D,yBAA0B,IAAI,2BAAyBA,CAAkB,CAC3E,GAGF,IAAOR,EAAQC",
6
+ "names": ["dprReportingClient_exports", "__export", "dprReportingClient_default", "initDprReportingClients", "__toCommonJS", "import_reportingClient", "import_dashboardClient", "import_reportDataStore", "import_missingReportClient", "import_productCollectionService", "reportingApiConfig", "redisClient", "storePrefix", "ReportingClient", "DashboardClient", "ReportDataStore", "MissingReportClient"]
7
7
  }
@@ -3,6 +3,7 @@ import DashboardClient from './dashboardClient'
3
3
  import ReportDataStore, { RedisClient } from './reportDataStore'
4
4
  import { ApiConfig } from './types'
5
5
  import MissingReportClient from '../services/missingReport/missingReportClient'
6
+ import { ProductCollectionService } from '../services/productCollection/productCollectionService'
6
7
 
7
8
  export const initDprReportingClients = (
8
9
  reportingApiConfig: ApiConfig,
@@ -14,6 +15,7 @@ export const initDprReportingClients = (
14
15
  dashboardClient: new DashboardClient(reportingApiConfig),
15
16
  reportDataStore: new ReportDataStore(redisClient, storePrefix),
16
17
  missingReportClient: new MissingReportClient(reportingApiConfig),
18
+ productCollectionService: new ProductCollectionService(reportingApiConfig),
17
19
  }
18
20
  }
19
21
 
@@ -1,2 +1,2 @@
1
- var y=Object.create;var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var $=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},c=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of D(e))!C.call(s,i)&&i!==t&&u(s,i,{get:()=>e[i],enumerable:!(r=f(e,i))||r.enumerable});return s};var m=(s,e,t)=>(t=s!=null?y(R(s)):{},c(e||!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),P=s=>c(u({},"__esModule",{value:!0}),s);var q={};$(q,{ReportingClient:()=>h,default:()=>A});module.exports=P(q);var a=m(require("../utils/logger")),l=m(require("./restClient"));class h{constructor(e){this.restClient=new l.default("Reporting API Client",e)}getCount(e,t,r){return a.default.info(`Reporting client: Get count. { resourceName: ${e} }`),this.restClient.get({path:`/${e}/count`,query:r.toRecordWithFilterPrefix(!0),token:t}).then(i=>i.count)}getList(e,t,r){return this.getListWithWarnings(e,t,r).then(i=>i.data)}getListWithWarnings(e,t,r){return a.default.info(`Reporting client: Get list. { resourceName: ${e} }`),this.restClient.getWithHeaders({path:`/${e}`,query:r.toRecordWithFilterPrefix(!0),token:t}).then(i=>({data:i.data,warnings:{noDataAvailable:i.headers["x-no-data-warning"]}}))}getDefinitionSummary(e,t,r){this.logInfo("Get definition summary",{reportId:t});const i={dataProductDefinitionsPath:r};return this.restClient.get({path:`/definitions/${t}`,query:i,token:e}).then(n=>n)}getDefinitions(e,t){this.logInfo("Get definitions");const r={query:{renderMethod:"HTML",dataProductDefinitionsPath:t}};return this.restClient.get({path:"/definitions",query:r.query,token:e}).then(i=>i)}getDefinition(e,t,r,i){const n={dataProductDefinitionsPath:i};return this.logInfo("Get definition",{reportId:t,variantId:r}),this.restClient.get({path:`/definitions/${t}/${r}`,query:n,token:e}).then(o=>o)}getFieldValues({token:e,definitionName:t,variantName:r,fieldName:i,prefix:n,definitionsPath:o}){const g={dataProductDefinitionsPath:o,prefix:n};return this.logInfo("Get field values",{definitionName:t,variantName:r,fieldName:i,prefix:n}),this.restClient.get({path:`/reports/${t}/${r}/${i}`,token:e,query:g}).then(p=>p)}requestAsyncReport(e,t,r,i){return this.logInfo("Request report",{reportId:t,variantId:r}),this.restClient.get({path:`/async/reports/${t}/${r}`,token:e,query:i}).then(n=>n)}cancelAsyncRequest(e,t,r,i,n){return this.logInfo("Cancel Request",{reportId:t,variantId:r,executionId:i}),this.restClient.delete({path:`/reports/${t}/${r}/statements/${i}`,token:e,query:{dataProductDefinitionsPath:n}}).then(o=>o)}getAsyncReport(e,t,r,i,n){return this.logInfo("Get Data",{reportId:t,variantId:r,tableId:i}),this.restClient.get({path:`/reports/${t}/${r}/tables/${i}/result`,token:e,query:n}).then(o=>o)}getAsyncSummaryReport(e,t,r,i,n,o){return this.logInfo("Get summary data",{reportId:t,variantId:r,tableId:i,summaryId:n}),this.restClient.get({path:`/reports/${t}/${r}/tables/${i}/result/summary/${n}`,token:e,query:o}).then(g=>g)}getAsyncReportStatus(e,t,r,i,n,o){return this.logInfo("Get status",{reportId:t,variantId:r,tableId:o,executionId:i}),this.restClient.get({path:`/reports/${t}/${r}/statements/${i}/status`,token:e,query:{dataProductDefinitionsPath:n,tableId:o}}).then(g=>g)}getAsyncCount(e,t,r){return this.logInfo("Get count",{tableId:t}),this.restClient.get({path:`/report/tables/${t}/count`,token:e,query:{dataProductDefinitionsPath:r}}).then(i=>i.count)}getAsyncInteractiveCount(e,t,r,i,n){return this.logInfo("Get interactive count",{tableId:t,reportId:r,id:i}),this.restClient.get({path:`/reports/${r}/${i}/tables/${t}/count`,token:e,query:n.toRecordWithFilterPrefix(!0)}).then(o=>o.count)}logInfo(e,t){a.default.info(`Reporting Client: ${e}:`),t&&Object.keys(t).length&&a.default.info(JSON.stringify(t,null,2))}}var A=h;0&&(module.exports={ReportingClient});
1
+ var y=Object.create;var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var $=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},c=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of R(e))!C.call(s,i)&&i!==t&&u(s,i,{get:()=>e[i],enumerable:!(r=f(e,i))||r.enumerable});return s};var m=(s,e,t)=>(t=s!=null?y(D(s)):{},c(e||!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),P=s=>c(u({},"__esModule",{value:!0}),s);var q={};$(q,{ReportingClient:()=>h,default:()=>A});module.exports=P(q);var a=m(require("../utils/logger")),l=m(require("./restClient"));class h{constructor(e){this.restClient=new l.default("Reporting API Client",e)}getCount(e,t,r){return a.default.info(`Reporting client: Get count. { resourceName: ${e} }`),this.restClient.get({path:`/${e}/count`,query:r.toRecordWithFilterPrefix(!0),token:t}).then(i=>i.count)}getList(e,t,r){return this.getListWithWarnings(e,t,r).then(i=>i.data)}getListWithWarnings(e,t,r){return a.default.info(`Reporting client: Get list. { resourceName: ${e} }`),this.restClient.getWithHeaders({path:`/${e}`,query:r.toRecordWithFilterPrefix(!0),token:t}).then(i=>({data:i.data,warnings:{noDataAvailable:i.headers["x-no-data-warning"]}}))}getDefinitionSummary(e,t,r){this.logInfo("Get definition summary",{reportId:t});const i={dataProductDefinitionsPath:r};return this.restClient.get({path:`/definitions/${t}`,query:i,token:e}).then(n=>n)}getDefinitions(e,t){this.logInfo("Get definitions");const r={query:{renderMethod:"HTML",dataProductDefinitionsPath:t}};return this.restClient.get({path:"/definitions",query:r.query,token:e}).then(i=>i)}getDefinition(e,t,r,i){const n={dataProductDefinitionsPath:i};return this.logInfo("Get definition",{reportId:t,variantId:r}),this.restClient.get({path:`/definitions/${t}/${r}`,query:n,token:e}).then(o=>o)}getFieldValues({token:e,definitionName:t,variantName:r,fieldName:i,prefix:n,definitionsPath:o}){const g={dataProductDefinitionsPath:o,prefix:n};return this.logInfo("Get field values",{definitionName:t,variantName:r,fieldName:i,prefix:n}),this.restClient.get({path:`/reports/${t}/${r}/${i}`,token:e,query:g}).then(p=>p)}requestAsyncReport(e,t,r,i){return this.logInfo("Request report",{reportId:t,variantId:r}),this.restClient.get({path:`/async/reports/${t}/${r}`,token:e,query:i}).then(n=>n)}cancelAsyncRequest(e,t,r,i,n){return this.logInfo("Cancel Request",{reportId:t,variantId:r,executionId:i}),this.restClient.delete({path:`/reports/${t}/${r}/statements/${i}`,token:e,query:{dataProductDefinitionsPath:n}}).then(o=>o)}getAsyncReport(e,t,r,i,n){return this.logInfo("Get Data",{reportId:t,variantId:r,tableId:i}),this.restClient.get({path:`/reports/${t}/${r}/tables/${i}/result`,token:e,query:n}).then(o=>o)}getAsyncSummaryReport(e,t,r,i,n,o){return this.logInfo("Get summary data",{reportId:t,variantId:r,tableId:i,summaryId:n}),this.restClient.get({path:`/reports/${t}/${r}/tables/${i}/result/summary/${n}`,token:e,query:o}).then(g=>g)}getAsyncReportStatus(e,t,r,i,n,o){return this.logInfo("Get status",{reportId:t,variantId:r,tableId:o,executionId:i}),this.restClient.get({path:`/reports/${t}/${r}/statements/${i}/status`,token:e,query:{dataProductDefinitionsPath:n,tableId:o}}).then(g=>g)}getAsyncCount(e,t,r){return this.logInfo("Get count",{tableId:t}),this.restClient.get({path:`/report/tables/${t}/count`,token:e,query:{dataProductDefinitionsPath:r}}).then(i=>i.count)}getAsyncInteractiveCount(e,t,r,i,n){return this.logInfo("Get interactive count",{tableId:t,reportId:r,id:i}),this.restClient.get({path:`/reports/${r}/${i}/tables/${t}/count`,token:e,query:n.toRecordWithFilterPrefix(!0)}).then(o=>o.count)}logInfo(e,t){a.default.info(`Reporting Client: ${e}:`),t&&Object.keys(t).length&&a.default.info(JSON.stringify(t,null,2))}}var A=h;0&&(module.exports={ReportingClient});
2
2
  //# sourceMappingURL=reportingClient.js.map