@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.26.1 → 4.26.3
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/DprQueryParamClass.mjs +2 -0
- package/dpr/all.scss +29 -7
- package/dpr/components/_catalogue/catalogue-list/styles.scss +1 -1
- package/dpr/components/_charts/chart/styles.scss +1 -1
- package/dpr/components/_filters/filters-selected/clientClass.mjs +1 -0
- package/dpr/components/_reports/report/view.njk +2 -2
- package/dpr/components/_reports/report-data-table/style.scss +27 -4
- package/dpr/components/_reports/report-data-table/view.njk +12 -10
- package/dpr/components/_reports/report-data-table-wrapper/view.njk +3 -3
- package/dpr/components/_reports/report-summary-table/styles.scss +0 -1
- package/dpr/routes/journeys/request-report/controller.js +1 -1
- package/dpr/routes/journeys/request-report/controller.js.map +2 -2
- package/dpr/routes/journeys/request-report/controller.ts +5 -4
- package/dpr/routes/journeys/request-report/filters/controller.js +1 -1
- package/dpr/routes/journeys/request-report/filters/controller.js.map +2 -2
- package/dpr/routes/journeys/request-report/filters/controller.ts +4 -3
- package/dpr/routes/journeys/request-report/status/controller.js +1 -1
- package/dpr/routes/journeys/request-report/status/controller.js.map +2 -2
- package/dpr/routes/journeys/request-report/status/controller.ts +1 -0
- package/dpr/routes/journeys/view-report/async/controller.js +1 -1
- package/dpr/routes/journeys/view-report/async/controller.js.map +2 -2
- package/dpr/routes/journeys/view-report/async/controller.ts +2 -2
- package/dpr/routes/journeys/view-report/async/dashboard/controller.js +1 -1
- package/dpr/routes/journeys/view-report/async/dashboard/controller.js.map +2 -2
- package/dpr/routes/journeys/view-report/async/dashboard/controller.ts +1 -0
- package/dpr/routes/journeys/view-report/async/report/controller.js +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 +1 -0
- package/dpr/routes/journeys/view-report/async/report/tests.cy.js +1 -1
- package/dpr/routes/journeys/view-report/async/report/tests.cy.js.map +3 -3
- package/dpr/routes/journeys/view-report/async/report/tests.cy.ts +841 -841
- package/dpr/routes/journeys/view-report/controller.js +1 -1
- package/dpr/routes/journeys/view-report/controller.js.map +2 -2
- package/dpr/routes/journeys/view-report/controller.ts +2 -2
- package/dpr/routes/journeys/view-report/sync/dashboard/controller.js +1 -1
- package/dpr/routes/journeys/view-report/sync/dashboard/controller.js.map +2 -2
- package/dpr/routes/journeys/view-report/sync/dashboard/controller.ts +1 -0
- package/dpr/routes/journeys/view-report/sync/report/controller.js +1 -1
- package/dpr/routes/journeys/view-report/sync/report/controller.js.map +2 -2
- package/dpr/routes/journeys/view-report/sync/report/controller.ts +3 -2
- package/dpr/routes/journeys/view-report/utils.js +1 -1
- package/dpr/routes/journeys/view-report/utils.js.map +2 -2
- package/dpr/routes/journeys/view-report/utils.ts +1 -1
- package/dpr/utils/DataTableBuilder/DataTableBuilder.js +1 -1
- package/dpr/utils/DataTableBuilder/DataTableBuilder.js.map +3 -3
- package/dpr/utils/DataTableBuilder/DataTableBuilder.ts +10 -2
- package/package.json +3 -4
package/dpr/all.scss
CHANGED
|
@@ -718,7 +718,6 @@ ul.dpr-card-group__item__filters-list {
|
|
|
718
718
|
position: relative;
|
|
719
719
|
row-gap: 15px;
|
|
720
720
|
flex-flow: column wrap;
|
|
721
|
-
padding-bottom: 40px;
|
|
722
721
|
|
|
723
722
|
.dpr-summary-container {
|
|
724
723
|
min-width: 200px;
|
|
@@ -861,10 +860,22 @@ ul.dpr-card-group__item__filters-list {
|
|
|
861
860
|
|
|
862
861
|
.dpr-table-container {
|
|
863
862
|
position: relative;
|
|
864
|
-
|
|
863
|
+
|
|
864
|
+
#dpr-data-table-list {
|
|
865
|
+
.govuk-table__header {
|
|
866
|
+
padding-right: govuk-spacing(4);
|
|
867
|
+
white-space: nowrap;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
.govuk-table__cell {
|
|
871
|
+
padding-right: govuk-spacing(4);
|
|
872
|
+
}
|
|
865
873
|
|
|
866
|
-
|
|
867
|
-
|
|
874
|
+
.govuk-table__body {
|
|
875
|
+
tr.govuk-table__row:nth-child(odd) {
|
|
876
|
+
background-color: govuk-colour("light-grey");
|
|
877
|
+
}
|
|
878
|
+
}
|
|
868
879
|
}
|
|
869
880
|
|
|
870
881
|
.dpr-section-header {
|
|
@@ -902,6 +913,7 @@ ul.dpr-card-group__item__filters-list {
|
|
|
902
913
|
padding-left: govuk-spacing(2);
|
|
903
914
|
padding-right: govuk-spacing(2);
|
|
904
915
|
padding-top: govuk-spacing(1);
|
|
916
|
+
background-color: white;
|
|
905
917
|
}
|
|
906
918
|
|
|
907
919
|
.govuk-table__cell {
|
|
@@ -946,6 +958,7 @@ ul.dpr-card-group__item__filters-list {
|
|
|
946
958
|
-webkit-mask-size: 100% 100%;
|
|
947
959
|
-webkit-mask-repeat: no-repeat;
|
|
948
960
|
-webkit-mask-position: left top, left bottom;
|
|
961
|
+
z-index: 100;
|
|
949
962
|
}
|
|
950
963
|
|
|
951
964
|
.data-table-header-button {
|
|
@@ -1013,6 +1026,10 @@ ul.dpr-card-group__item__filters-list {
|
|
|
1013
1026
|
word-break: break-all;
|
|
1014
1027
|
}
|
|
1015
1028
|
|
|
1029
|
+
.data-table-cell-long-string {
|
|
1030
|
+
min-width: 300px;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1016
1033
|
#pageSize {
|
|
1017
1034
|
min-width: 5em;
|
|
1018
1035
|
}
|
|
@@ -1058,7 +1075,12 @@ ul.dpr-card-group__item__filters-list {
|
|
|
1058
1075
|
}
|
|
1059
1076
|
|
|
1060
1077
|
.dpr-table-wrapper {
|
|
1061
|
-
overflow: scroll;
|
|
1078
|
+
overflow-x: scroll;
|
|
1079
|
+
transform: rotateX(180deg);
|
|
1080
|
+
|
|
1081
|
+
.dpr-table-content {
|
|
1082
|
+
transform: rotateX(180deg);
|
|
1083
|
+
}
|
|
1062
1084
|
}
|
|
1063
1085
|
|
|
1064
1086
|
.table-row-count {
|
|
@@ -1855,7 +1877,7 @@ ul.dpr-card-group__item__filters-list {
|
|
|
1855
1877
|
background-color: govuk-colour("dark-blue")
|
|
1856
1878
|
}
|
|
1857
1879
|
|
|
1858
|
-
@for $i from 1 through
|
|
1880
|
+
@for $i from 1 through 200 {
|
|
1859
1881
|
.dpr-chart-height-#{$i} {
|
|
1860
1882
|
height: $i * 80px !important;
|
|
1861
1883
|
}
|
|
@@ -1946,7 +1968,7 @@ ul.dpr-card-group__item__filters-list {
|
|
|
1946
1968
|
}
|
|
1947
1969
|
td.govuk-table__cell {
|
|
1948
1970
|
font-size: 16px;
|
|
1949
|
-
padding: 20px
|
|
1971
|
+
padding: 20px 40px 20px 0
|
|
1950
1972
|
}
|
|
1951
1973
|
|
|
1952
1974
|
.govuk-table__cell:last-child {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
{% endif %}
|
|
26
26
|
{% endfor %}
|
|
27
27
|
{% else %}
|
|
28
|
-
{{ dprDataTableWrapper(dataTable, classification) }}
|
|
28
|
+
{{ dprDataTableWrapper(dataTable, classification, template) }}
|
|
29
29
|
{% endif %}
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
|
-
<div class='govuk-!-margin-bottom-6'>
|
|
32
|
+
<div class='govuk-!-margin-bottom-6 govuk-!-margin-top-6'>
|
|
33
33
|
{{ dprReportTotals(options.totals) }}
|
|
34
34
|
</div>
|
|
35
35
|
|
|
@@ -2,10 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
.dpr-table-container {
|
|
4
4
|
position: relative;
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
#dpr-data-table-list {
|
|
7
|
+
.govuk-table__header {
|
|
8
|
+
padding-right: govuk-spacing(4);
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.govuk-table__cell {
|
|
13
|
+
padding-right: govuk-spacing(4);
|
|
14
|
+
}
|
|
6
15
|
|
|
7
|
-
|
|
8
|
-
|
|
16
|
+
.govuk-table__body {
|
|
17
|
+
tr.govuk-table__row:nth-child(odd) {
|
|
18
|
+
background-color: govuk-colour("light-grey");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
9
21
|
}
|
|
10
22
|
|
|
11
23
|
.dpr-section-header {
|
|
@@ -43,6 +55,7 @@
|
|
|
43
55
|
padding-left: govuk-spacing(2);
|
|
44
56
|
padding-right: govuk-spacing(2);
|
|
45
57
|
padding-top: govuk-spacing(1);
|
|
58
|
+
background-color: white;
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
.govuk-table__cell {
|
|
@@ -87,6 +100,7 @@
|
|
|
87
100
|
-webkit-mask-size: 100% 100%;
|
|
88
101
|
-webkit-mask-repeat: no-repeat;
|
|
89
102
|
-webkit-mask-position: left top, left bottom;
|
|
103
|
+
z-index: 100;
|
|
90
104
|
}
|
|
91
105
|
|
|
92
106
|
.data-table-header-button {
|
|
@@ -154,6 +168,10 @@
|
|
|
154
168
|
word-break: break-all;
|
|
155
169
|
}
|
|
156
170
|
|
|
171
|
+
.data-table-cell-long-string {
|
|
172
|
+
min-width: 300px;
|
|
173
|
+
}
|
|
174
|
+
|
|
157
175
|
#pageSize {
|
|
158
176
|
min-width: 5em;
|
|
159
177
|
}
|
|
@@ -199,7 +217,12 @@
|
|
|
199
217
|
}
|
|
200
218
|
|
|
201
219
|
.dpr-table-wrapper {
|
|
202
|
-
overflow: scroll;
|
|
220
|
+
overflow-x: scroll;
|
|
221
|
+
transform: rotateX(180deg);
|
|
222
|
+
|
|
223
|
+
.dpr-table-content {
|
|
224
|
+
transform: rotateX(180deg);
|
|
225
|
+
}
|
|
203
226
|
}
|
|
204
227
|
|
|
205
228
|
.table-row-count {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% from "govuk/components/table/macro.njk" import govukTable %}
|
|
2
2
|
|
|
3
|
-
{% macro dprDataTable(dataTable, classification) %}
|
|
3
|
+
{% macro dprDataTable(dataTable, classification, template) %}
|
|
4
4
|
{% set rows = dataTable.rows %}
|
|
5
5
|
{% set head = dataTable.head %}
|
|
6
6
|
{% set colCount = dataTable.colCount %}
|
|
@@ -8,15 +8,17 @@
|
|
|
8
8
|
<div id="table-container" class='dpr-table-container' data-dpr-module="data-table" aria-labelledby="dpr-report-name">
|
|
9
9
|
<div class="dpr-overflow-gradient" id="dpr-overflow-gradient"></div>
|
|
10
10
|
<div class="dpr-table-wrapper" id="dpr-table-wrapper">
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
<div class="dpr-table-content">
|
|
12
|
+
{{ govukTable({
|
|
13
|
+
head: head,
|
|
14
|
+
rows: rows,
|
|
15
|
+
attributes: {
|
|
16
|
+
'id': 'dpr-data-table-' + template,
|
|
17
|
+
'data-classification': classification,
|
|
18
|
+
'data-col-length': colCount
|
|
19
|
+
}
|
|
20
|
+
}) }}
|
|
21
|
+
</div>
|
|
20
22
|
</div>
|
|
21
23
|
</div>
|
|
22
24
|
{% endmacro %}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{% from "../report-data-table/view.njk" import dprDataTable %}
|
|
2
2
|
{% from "govuk/components/tabs/macro.njk" import govukTabs %}
|
|
3
3
|
|
|
4
|
-
{% macro dprDataTableWrapper(dataTables, classification) %}
|
|
4
|
+
{% macro dprDataTableWrapper(dataTables, classification, template) %}
|
|
5
5
|
|
|
6
6
|
{% if dataTables.length > 1 %}
|
|
7
7
|
{% set tabItems = [] %}
|
|
8
8
|
{% for dataTable in dataTables %}
|
|
9
9
|
|
|
10
10
|
{% set dataTableHtml %}
|
|
11
|
-
{{ dprDataTable(dataTable, classification) }}
|
|
11
|
+
{{ dprDataTable(dataTable, classification, template) }}
|
|
12
12
|
{% endset -%}
|
|
13
13
|
|
|
14
14
|
{% set tabItems = (tabItems.push({
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
{{ govukTabs({ items: tabItems}) }}
|
|
24
24
|
{% else %}
|
|
25
|
-
{{ dprDataTable(dataTables[0], classification) }}
|
|
25
|
+
{{ dprDataTable(dataTables[0], classification, template) }}
|
|
26
26
|
{% endif %}
|
|
27
27
|
{% endmacro %}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.create;var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var h=(t,r)=>{for(var e in r)a(t,e,{get:r[e],enumerable:!0})},l=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of R(r))!f.call(t,o)&&o!==e&&a(t,o,{get:()=>r[o],enumerable:!(s=y(r,o))||s.enumerable});return t};var n=(t,r,e)=>(e=t!=null?u(p(t)):{},l(r||!t||!t.__esModule?a(e,"default",{value:t,enumerable:!0}):e,t)),m=t=>l(a({},"__esModule",{value:!0}),t);var g={};h(g,{RequestReportController:()=>i,default:()=>b});module.exports=m(g);var c=n(require("./filters/utils")),d=n(require("../../../utils/ErrorHandler"));class i{layoutPath;services;constructor(r,e){this.layoutPath=r,this.services=e}errorHandler=async(r,e,s,o)=>{s.render("dpr/routes/journeys/view-report/error",{layoutPath:this.layoutPath,...e.body&&{...e.body},...e.params,error:e.body?.error,params:e?.params})};CANCEL=async(r,e,s)=>{try{await c.default.cancelRequest({req:r,res:e,services:this.services})}catch(o){return r.body??={},r.body.title="Failed to abort request",r.body.errorDescription="We were unable to abort the report request for the following reason:",r.body.error=new d.default(o).formatError(),r.flash("ERROR_BODY",JSON.stringify(r.body)),r.flash("ERROR_PARAMS",JSON.stringify(r.params)),r.flash("ERROR",JSON.stringify(r.body?.error||{})),e.redirect(`${r.originalUrl}/failed`)}return e.redirect(r.originalUrl.replace("/cancel","/status"))}}var b=i;0&&(module.exports={RequestReportController});
|
|
2
2
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/dpr/routes/journeys/request-report/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { ErrorRequestHandler, RequestHandler } from 'express'\nimport { Services } from '../../../types/Services'\nimport AsyncRequestUtils from './filters/utils'\nimport ErrorHandler from '../../../utils/ErrorHandler'\n\nclass RequestReportController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n errorHandler: ErrorRequestHandler = async (_error, req, res, _next) => {\n res.render(`dpr/routes/journeys/view-report/error`, {\n layoutPath: this.layoutPath,\n ...req.body,\n ...req.params,\n error: req.body
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAA8B,8BAC9BC,EAAyB,0CAEzB,MAAMJ,CAAwB,CAC5B,WAEA,SAEA,YAAYK,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAEA,aAAoC,MAAOC,EAAQC,EAAKC,EAAKC,IAAU,CACrED,EAAI,OAAO,wCAAyC,CAClD,WAAY,KAAK,WACjB,
|
|
4
|
+
"sourcesContent": ["import { ErrorRequestHandler, RequestHandler } from 'express'\nimport { Services } from '../../../types/Services'\nimport AsyncRequestUtils from './filters/utils'\nimport ErrorHandler from '../../../utils/ErrorHandler'\n\nclass RequestReportController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n errorHandler: ErrorRequestHandler = async (_error, req, res, _next) => {\n res.render(`dpr/routes/journeys/view-report/error`, {\n layoutPath: this.layoutPath,\n ...(req.body && { ...req.body }),\n ...req.params,\n error: req.body?.error,\n params: req?.params,\n })\n }\n\n CANCEL: RequestHandler = async (req, res, _next) => {\n try {\n await AsyncRequestUtils.cancelRequest({\n req,\n res,\n services: this.services,\n })\n } catch (error) {\n req.body ??= {}\n req.body.title = 'Failed to abort request'\n req.body.errorDescription = 'We were unable to abort the report request for the following reason:'\n req.body.error = new ErrorHandler(error).formatError()\n\n req.flash('ERROR_BODY', JSON.stringify(req.body))\n req.flash('ERROR_PARAMS', JSON.stringify(req.params))\n req.flash('ERROR', JSON.stringify(req.body?.error || {}))\n\n return res.redirect(`${req.originalUrl}/failed`)\n }\n return res.redirect(req.originalUrl.replace('/cancel', '/status'))\n }\n}\n\nexport { RequestReportController }\nexport default RequestReportController\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAA8B,8BAC9BC,EAAyB,0CAEzB,MAAMJ,CAAwB,CAC5B,WAEA,SAEA,YAAYK,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAEA,aAAoC,MAAOC,EAAQC,EAAKC,EAAKC,IAAU,CACrED,EAAI,OAAO,wCAAyC,CAClD,WAAY,KAAK,WACjB,GAAID,EAAI,MAAQ,CAAE,GAAGA,EAAI,IAAK,EAC9B,GAAGA,EAAI,OACP,MAAOA,EAAI,MAAM,MACjB,OAAQA,GAAK,MACf,CAAC,CACH,EAEA,OAAyB,MAAOA,EAAKC,EAAKC,IAAU,CAClD,GAAI,CACF,MAAM,EAAAC,QAAkB,cAAc,CACpC,IAAAH,EACA,IAAAC,EACA,SAAU,KAAK,QACjB,CAAC,CACH,OAASG,EAAO,CACd,OAAAJ,EAAI,OAAS,CAAC,EACdA,EAAI,KAAK,MAAQ,0BACjBA,EAAI,KAAK,iBAAmB,uEAC5BA,EAAI,KAAK,MAAQ,IAAI,EAAAK,QAAaD,CAAK,EAAE,YAAY,EAErDJ,EAAI,MAAM,aAAc,KAAK,UAAUA,EAAI,IAAI,CAAC,EAChDA,EAAI,MAAM,eAAgB,KAAK,UAAUA,EAAI,MAAM,CAAC,EACpDA,EAAI,MAAM,QAAS,KAAK,UAAUA,EAAI,MAAM,OAAS,CAAC,CAAC,CAAC,EAEjDC,EAAI,SAAS,GAAGD,EAAI,WAAW,SAAS,CACjD,CACA,OAAOC,EAAI,SAASD,EAAI,YAAY,QAAQ,UAAW,SAAS,CAAC,CACnE,CACF,CAGA,IAAOP,EAAQD",
|
|
6
6
|
"names": ["controller_exports", "__export", "RequestReportController", "controller_default", "__toCommonJS", "import_utils", "import_ErrorHandler", "layoutPath", "services", "_error", "req", "res", "_next", "AsyncRequestUtils", "error", "ErrorHandler"]
|
|
7
7
|
}
|
|
@@ -16,10 +16,10 @@ class RequestReportController {
|
|
|
16
16
|
errorHandler: ErrorRequestHandler = async (_error, req, res, _next) => {
|
|
17
17
|
res.render(`dpr/routes/journeys/view-report/error`, {
|
|
18
18
|
layoutPath: this.layoutPath,
|
|
19
|
-
...req.body,
|
|
19
|
+
...(req.body && { ...req.body }),
|
|
20
20
|
...req.params,
|
|
21
|
-
error: req.body
|
|
22
|
-
params: req
|
|
21
|
+
error: req.body?.error,
|
|
22
|
+
params: req?.params,
|
|
23
23
|
})
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -31,13 +31,14 @@ class RequestReportController {
|
|
|
31
31
|
services: this.services,
|
|
32
32
|
})
|
|
33
33
|
} catch (error) {
|
|
34
|
+
req.body ??= {}
|
|
34
35
|
req.body.title = 'Failed to abort request'
|
|
35
36
|
req.body.errorDescription = 'We were unable to abort the report request for the following reason:'
|
|
36
37
|
req.body.error = new ErrorHandler(error).formatError()
|
|
37
38
|
|
|
38
39
|
req.flash('ERROR_BODY', JSON.stringify(req.body))
|
|
39
40
|
req.flash('ERROR_PARAMS', JSON.stringify(req.params))
|
|
40
|
-
req.flash('ERROR', JSON.stringify(req.body
|
|
41
|
+
req.flash('ERROR', JSON.stringify(req.body?.error || {}))
|
|
41
42
|
|
|
42
43
|
return res.redirect(`${req.originalUrl}/failed`)
|
|
43
44
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var p=Object.create;var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var p=Object.create;var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var E=(s,e)=>{for(var t in e)l(s,t,{get:e[t],enumerable:!0})},m=(s,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of R(e))!D.call(s,r)&&r!==t&&l(s,r,{get:()=>e[r],enumerable:!(o=v(e,r))||o.enumerable});return s};var u=(s,e,t)=>(t=s!=null?p(b(s)):{},m(e||!s||!s.__esModule?l(t,"default",{value:s,enumerable:!0}):t,s)),P=s=>m(l({},"__esModule",{value:!0}),s);var F={};E(F,{RequestReportController:()=>y,default:()=>w});module.exports=P(F);var d=u(require("./utils")),c=u(require("../../../../utils/Personalisation/personalisationUtils")),n=require("../../../../components/_filters/filtersTypeEnum"),i=u(require("../../../../utils/ErrorHandler"));class y{layoutPath;services;constructor(e,t){this.layoutPath=e,this.services=t}GET=async(e,t,o)=>{try{const r=await d.default.renderRequest({req:e,res:t,services:this.services,next:o});t.render("dpr/routes/journeys/request-report/filters/view",{layoutPath:this.layoutPath,...r})}catch(r){e.body??={},e.body.title="Request failed",e.body.errorDescription=`Your ${e.params.type} has failed to generate.`,e.body.error=new i.default(r).formatError(),o()}};POST=async(e,t,o)=>{try{const r=await d.default.request({req:e,res:t,services:this.services,next:o}),{executionId:a,dataProductDefinitionsPath:f}=r;if(a){const h=f?`${a}/status?dataProductDefinitionsPath=${f}`:`${a}/status`;t.redirect(h)}else t.end()}catch(r){const a=d.default.getFiltersFromReqBody(e);e.body={title:"Request Failed",errorDescription:`Your ${e.params.type} has failed to generate.`,error:new i.default(r).formatError(),retry:!0,filters:a,...e.body&&{...e.body}},o(r)}};saveDefaultFilterValues=async(e,t,o)=>{try{await c.default.saveDefaults(n.FiltersType.REQUEST,t,e,this.services),t.redirect(`${e.baseUrl}?defaultsSaved=true`)}catch(r){e.body={title:"Failed to save defaults",error:new i.default(r).formatError(),...e.body&&{...e.body}},o()}};removeDefaultFilterValues=async(e,t,o)=>{try{await c.default.removeDefaults(n.FiltersType.REQUEST,t,e,this.services),t.redirect(e.baseUrl)}catch(r){e.body={title:"Failed to remove defaults",error:new i.default(r).formatError(),...e.body&&{...e.body}},o()}}}var w=y;0&&(module.exports={RequestReportController});
|
|
2
2
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/request-report/filters/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../types/Services'\nimport { RequestDataResult } from '../../../../types/AsyncReportUtils'\nimport AysncRequestUtils from './utils'\nimport PersonalisationUtils from '../../../../utils/Personalisation/personalisationUtils'\nimport { FiltersType } from '../../../../components/_filters/filtersTypeEnum'\nimport ErrorHandler from '../../../../utils/ErrorHandler'\n\nclass RequestReportController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n // Render request page\n GET: RequestHandler = async (req, res, next) => {\n try {\n const requestRenderData = <RequestDataResult>await AysncRequestUtils.renderRequest({\n req,\n res,\n services: this.services,\n next,\n })\n\n res.render(`dpr/routes/journeys/request-report/filters/view`, {\n layoutPath: this.layoutPath,\n ...requestRenderData,\n })\n } catch (error) {\n req.body.title = 'Request failed'\n req.body.errorDescription = `Your ${req.params['type']} has failed to generate.`\n req.body.error = new ErrorHandler(error).formatError()\n next()\n }\n }\n\n // Request report\n POST: RequestHandler = async (req, res, next) => {\n try {\n const executionData = await AysncRequestUtils.request({\n req,\n res,\n services: this.services,\n next,\n })\n\n const { executionId, dataProductDefinitionsPath } = executionData\n\n if (executionId) {\n const redirect = dataProductDefinitionsPath\n ? `${executionId}/status?dataProductDefinitionsPath=${dataProductDefinitionsPath}`\n : `${executionId}/status`\n res.redirect(redirect)\n } else {\n res.end()\n }\n } catch (error) {\n const filters = AysncRequestUtils.getFiltersFromReqBody(req)\n\n req.body = {\n title: 'Request Failed',\n errorDescription: `Your ${req.params['type']} has failed to generate.`,\n error: new ErrorHandler(error).formatError(),\n retry: true,\n filters,\n ...req.body,\n }\n next(error)\n }\n }\n\n saveDefaultFilterValues: RequestHandler = async (req, res, next) => {\n try {\n await PersonalisationUtils.saveDefaults(FiltersType.REQUEST, res, req, this.services)\n res.redirect(`${req.baseUrl}?defaultsSaved=true`)\n } catch (error) {\n req.body = {\n title: 'Failed to save defaults',\n error: new ErrorHandler(error).formatError(),\n ...req.body,\n }\n next()\n }\n }\n\n removeDefaultFilterValues: RequestHandler = async (req, res, next) => {\n try {\n await PersonalisationUtils.removeDefaults(FiltersType.REQUEST, res, req, this.services)\n res.redirect(req.baseUrl)\n } catch (error) {\n req.body = {\n title: 'Failed to remove defaults',\n error: new ErrorHandler(error).formatError(),\n ...req.body,\n }\n next()\n }\n }\n}\n\nexport { RequestReportController }\nexport default RequestReportController\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAGA,IAAAK,EAA8B,sBAC9BC,EAAiC,qEACjCC,EAA4B,2DAC5BC,EAAyB,6CAEzB,MAAMN,CAAwB,CAC5B,WAEA,SAEA,YAAYO,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAGA,IAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,GAAI,CACF,MAAMC,EAAuC,MAAM,EAAAC,QAAkB,cAAc,CACjF,IAAAJ,EACA,IAAAC,EACA,SAAU,KAAK,SACf,KAAAC,CACF,CAAC,EAEDD,EAAI,OAAO,kDAAmD,CAC5D,WAAY,KAAK,WACjB,GAAGE,CACL,CAAC,CACH,OAASE,EAAO,CACdL,EAAI,KAAK,MAAQ,iBACjBA,EAAI,KAAK,iBAAmB,QAAQA,EAAI,OAAO,IAAO,2BACtDA,EAAI,KAAK,MAAQ,IAAI,EAAAM,QAAaD,CAAK,EAAE,YAAY,EACrDH,EAAK,CACP,CACF,EAGA,KAAuB,MAAOF,EAAKC,EAAKC,IAAS,CAC/C,GAAI,CACF,MAAMK,EAAgB,MAAM,EAAAH,QAAkB,QAAQ,CACpD,IAAAJ,EACA,IAAAC,EACA,SAAU,KAAK,SACf,KAAAC,CACF,CAAC,EAEK,CAAE,YAAAM,EAAa,2BAAAC,CAA2B,EAAIF,EAEpD,GAAIC,EAAa,CACf,MAAME,EAAWD,EACb,GAAGD,CAAW,sCAAsCC,CAA0B,GAC9E,GAAGD,CAAW,UAClBP,EAAI,SAASS,CAAQ,CACvB,MACET,EAAI,IAAI,CAEZ,OAASI,EAAO,CACd,MAAMM,EAAU,EAAAP,QAAkB,sBAAsBJ,CAAG,EAE3DA,EAAI,KAAO,CACT,MAAO,iBACP,iBAAkB,QAAQA,EAAI,OAAO,IAAO,2BAC5C,MAAO,IAAI,EAAAM,QAAaD,CAAK,EAAE,YAAY,EAC3C,MAAO,GACP,QAAAM,EACA,
|
|
4
|
+
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../types/Services'\nimport { RequestDataResult } from '../../../../types/AsyncReportUtils'\nimport AysncRequestUtils from './utils'\nimport PersonalisationUtils from '../../../../utils/Personalisation/personalisationUtils'\nimport { FiltersType } from '../../../../components/_filters/filtersTypeEnum'\nimport ErrorHandler from '../../../../utils/ErrorHandler'\n\nclass RequestReportController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n // Render request page\n GET: RequestHandler = async (req, res, next) => {\n try {\n const requestRenderData = <RequestDataResult>await AysncRequestUtils.renderRequest({\n req,\n res,\n services: this.services,\n next,\n })\n\n res.render(`dpr/routes/journeys/request-report/filters/view`, {\n layoutPath: this.layoutPath,\n ...requestRenderData,\n })\n } catch (error) {\n req.body ??= {}\n req.body.title = 'Request failed'\n req.body.errorDescription = `Your ${req.params['type']} has failed to generate.`\n req.body.error = new ErrorHandler(error).formatError()\n next()\n }\n }\n\n // Request report\n POST: RequestHandler = async (req, res, next) => {\n try {\n const executionData = await AysncRequestUtils.request({\n req,\n res,\n services: this.services,\n next,\n })\n\n const { executionId, dataProductDefinitionsPath } = executionData\n\n if (executionId) {\n const redirect = dataProductDefinitionsPath\n ? `${executionId}/status?dataProductDefinitionsPath=${dataProductDefinitionsPath}`\n : `${executionId}/status`\n res.redirect(redirect)\n } else {\n res.end()\n }\n } catch (error) {\n const filters = AysncRequestUtils.getFiltersFromReqBody(req)\n\n req.body = {\n title: 'Request Failed',\n errorDescription: `Your ${req.params['type']} has failed to generate.`,\n error: new ErrorHandler(error).formatError(),\n retry: true,\n filters,\n ...(req.body && { ...req.body }),\n }\n next(error)\n }\n }\n\n saveDefaultFilterValues: RequestHandler = async (req, res, next) => {\n try {\n await PersonalisationUtils.saveDefaults(FiltersType.REQUEST, res, req, this.services)\n res.redirect(`${req.baseUrl}?defaultsSaved=true`)\n } catch (error) {\n req.body = {\n title: 'Failed to save defaults',\n error: new ErrorHandler(error).formatError(),\n ...(req.body && { ...req.body }),\n }\n next()\n }\n }\n\n removeDefaultFilterValues: RequestHandler = async (req, res, next) => {\n try {\n await PersonalisationUtils.removeDefaults(FiltersType.REQUEST, res, req, this.services)\n res.redirect(req.baseUrl)\n } catch (error) {\n req.body = {\n title: 'Failed to remove defaults',\n error: new ErrorHandler(error).formatError(),\n ...(req.body && { ...req.body }),\n }\n next()\n }\n }\n}\n\nexport { RequestReportController }\nexport default RequestReportController\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAGA,IAAAK,EAA8B,sBAC9BC,EAAiC,qEACjCC,EAA4B,2DAC5BC,EAAyB,6CAEzB,MAAMN,CAAwB,CAC5B,WAEA,SAEA,YAAYO,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAGA,IAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,GAAI,CACF,MAAMC,EAAuC,MAAM,EAAAC,QAAkB,cAAc,CACjF,IAAAJ,EACA,IAAAC,EACA,SAAU,KAAK,SACf,KAAAC,CACF,CAAC,EAEDD,EAAI,OAAO,kDAAmD,CAC5D,WAAY,KAAK,WACjB,GAAGE,CACL,CAAC,CACH,OAASE,EAAO,CACdL,EAAI,OAAS,CAAC,EACdA,EAAI,KAAK,MAAQ,iBACjBA,EAAI,KAAK,iBAAmB,QAAQA,EAAI,OAAO,IAAO,2BACtDA,EAAI,KAAK,MAAQ,IAAI,EAAAM,QAAaD,CAAK,EAAE,YAAY,EACrDH,EAAK,CACP,CACF,EAGA,KAAuB,MAAOF,EAAKC,EAAKC,IAAS,CAC/C,GAAI,CACF,MAAMK,EAAgB,MAAM,EAAAH,QAAkB,QAAQ,CACpD,IAAAJ,EACA,IAAAC,EACA,SAAU,KAAK,SACf,KAAAC,CACF,CAAC,EAEK,CAAE,YAAAM,EAAa,2BAAAC,CAA2B,EAAIF,EAEpD,GAAIC,EAAa,CACf,MAAME,EAAWD,EACb,GAAGD,CAAW,sCAAsCC,CAA0B,GAC9E,GAAGD,CAAW,UAClBP,EAAI,SAASS,CAAQ,CACvB,MACET,EAAI,IAAI,CAEZ,OAASI,EAAO,CACd,MAAMM,EAAU,EAAAP,QAAkB,sBAAsBJ,CAAG,EAE3DA,EAAI,KAAO,CACT,MAAO,iBACP,iBAAkB,QAAQA,EAAI,OAAO,IAAO,2BAC5C,MAAO,IAAI,EAAAM,QAAaD,CAAK,EAAE,YAAY,EAC3C,MAAO,GACP,QAAAM,EACA,GAAIX,EAAI,MAAQ,CAAE,GAAGA,EAAI,IAAK,CAChC,EACAE,EAAKG,CAAK,CACZ,CACF,EAEA,wBAA0C,MAAOL,EAAKC,EAAKC,IAAS,CAClE,GAAI,CACF,MAAM,EAAAU,QAAqB,aAAa,cAAY,QAASX,EAAKD,EAAK,KAAK,QAAQ,EACpFC,EAAI,SAAS,GAAGD,EAAI,OAAO,qBAAqB,CAClD,OAASK,EAAO,CACdL,EAAI,KAAO,CACT,MAAO,0BACP,MAAO,IAAI,EAAAM,QAAaD,CAAK,EAAE,YAAY,EAC3C,GAAIL,EAAI,MAAQ,CAAE,GAAGA,EAAI,IAAK,CAChC,EACAE,EAAK,CACP,CACF,EAEA,0BAA4C,MAAOF,EAAKC,EAAKC,IAAS,CACpE,GAAI,CACF,MAAM,EAAAU,QAAqB,eAAe,cAAY,QAASX,EAAKD,EAAK,KAAK,QAAQ,EACtFC,EAAI,SAASD,EAAI,OAAO,CAC1B,OAASK,EAAO,CACdL,EAAI,KAAO,CACT,MAAO,4BACP,MAAO,IAAI,EAAAM,QAAaD,CAAK,EAAE,YAAY,EAC3C,GAAIL,EAAI,MAAQ,CAAE,GAAGA,EAAI,IAAK,CAChC,EACAE,EAAK,CACP,CACF,CACF,CAGA,IAAOV,EAAQD",
|
|
6
6
|
"names": ["controller_exports", "__export", "RequestReportController", "controller_default", "__toCommonJS", "import_utils", "import_personalisationUtils", "import_filtersTypeEnum", "import_ErrorHandler", "layoutPath", "services", "req", "res", "next", "requestRenderData", "AysncRequestUtils", "error", "ErrorHandler", "executionData", "executionId", "dataProductDefinitionsPath", "redirect", "filters", "PersonalisationUtils"]
|
|
7
7
|
}
|
|
@@ -31,6 +31,7 @@ class RequestReportController {
|
|
|
31
31
|
...requestRenderData,
|
|
32
32
|
})
|
|
33
33
|
} catch (error) {
|
|
34
|
+
req.body ??= {}
|
|
34
35
|
req.body.title = 'Request failed'
|
|
35
36
|
req.body.errorDescription = `Your ${req.params['type']} has failed to generate.`
|
|
36
37
|
req.body.error = new ErrorHandler(error).formatError()
|
|
@@ -67,7 +68,7 @@ class RequestReportController {
|
|
|
67
68
|
error: new ErrorHandler(error).formatError(),
|
|
68
69
|
retry: true,
|
|
69
70
|
filters,
|
|
70
|
-
...req.body,
|
|
71
|
+
...(req.body && { ...req.body }),
|
|
71
72
|
}
|
|
72
73
|
next(error)
|
|
73
74
|
}
|
|
@@ -81,7 +82,7 @@ class RequestReportController {
|
|
|
81
82
|
req.body = {
|
|
82
83
|
title: 'Failed to save defaults',
|
|
83
84
|
error: new ErrorHandler(error).formatError(),
|
|
84
|
-
...req.body,
|
|
85
|
+
...(req.body && { ...req.body }),
|
|
85
86
|
}
|
|
86
87
|
next()
|
|
87
88
|
}
|
|
@@ -95,7 +96,7 @@ class RequestReportController {
|
|
|
95
96
|
req.body = {
|
|
96
97
|
title: 'Failed to remove defaults',
|
|
97
98
|
error: new ErrorHandler(error).formatError(),
|
|
98
|
-
...req.body,
|
|
99
|
+
...(req.body && { ...req.body }),
|
|
99
100
|
}
|
|
100
101
|
next()
|
|
101
102
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var y=Object.create;var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var f=(r,t)=>{for(var e in t)i(r,e,{get:t[e],enumerable:!0})},u=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of h(t))!m.call(r,s)&&s!==e&&i(r,s,{get:()=>t[s],enumerable:!(o=p(t,s))||o.enumerable});return r};var a=(r,t,e)=>(e=r!=null?y(v(r)):{},u(t||!r||!r.__esModule?i(e,"default",{value:r,enumerable:!0}):e,r)),P=r=>u(i({},"__esModule",{value:!0}),r);var g={};f(g,{RequestStatusController:()=>n,default:()=>R});module.exports=P(g);var c=a(require("./utils")),l=a(require("../../../../components/user-reports/requested/utils")),d=a(require("../../../../utils/ErrorHandler"));class n{layoutPath;services;constructor(t,e){this.layoutPath=t,this.services=e}GET=async(t,e,o)=>{try{const s=await c.default.renderPolling({req:t,res:e,services:this.services,next:o});e.render("dpr/routes/journeys/request-report/status/view",{layoutPath:this.layoutPath,...s})}catch(s){t.body??={},t.body.title="Failed to retrieve report status",t.body.errorDescription="We were unable to retrieve the report status:",t.body.error=new d.default(s).formatError(),o()}};POST=async(t,e,o)=>{try{const s=await l.default.getRequestStatus({req:t,res:e,services:this.services});e.send({status:s.status})}catch{e.send({status:"FAILED"})}}}var R=n;0&&(module.exports={RequestStatusController});
|
|
2
2
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/request-report/status/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../types/Services'\nimport AsyncPollingUtils from './utils'\nimport AsyncRequestListUtils from '../../../../components/user-reports/requested/utils'\nimport ErrorHandler from '../../../../utils/ErrorHandler'\n\nclass RequestStatusController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n // Render status page\n GET: RequestHandler = async (req, res, next) => {\n try {\n const pollingRenderData = await AsyncPollingUtils.renderPolling({\n req,\n res,\n services: this.services,\n next,\n })\n res.render(`dpr/routes/journeys/request-report/status/view`, {\n layoutPath: this.layoutPath,\n ...pollingRenderData,\n })\n } catch (error) {\n req.body.title = 'Failed to retrieve report status'\n req.body.errorDescription = 'We were unable to retrieve the report status:'\n req.body.error = new ErrorHandler(error).formatError()\n next()\n }\n }\n\n // Poll request status\n POST: RequestHandler = async (req, res, _next) => {\n try {\n const response = await AsyncRequestListUtils.getRequestStatus({ req, res, services: this.services })\n res.send({ status: response.status })\n } catch (error) {\n res.send({ status: 'FAILED' })\n }\n }\n}\n\nexport { RequestStatusController }\nexport default RequestStatusController\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAA8B,sBAC9BA,EAAkC,kEAClCC,EAAyB,6CAEzB,MAAMJ,CAAwB,CAC5B,WAEA,SAEA,YAAYK,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAGA,IAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,GAAI,CACF,MAAMC,EAAoB,MAAM,EAAAC,QAAkB,cAAc,CAC9D,IAAAJ,EACA,IAAAC,EACA,SAAU,KAAK,SACf,KAAAC,CACF,CAAC,EACDD,EAAI,OAAO,iDAAkD,CAC3D,WAAY,KAAK,WACjB,GAAGE,CACL,CAAC,CACH,OAASE,EAAO,CACdL,EAAI,KAAK,MAAQ,mCACjBA,EAAI,KAAK,iBAAmB,gDAC5BA,EAAI,KAAK,MAAQ,IAAI,EAAAM,QAAaD,CAAK,EAAE,YAAY,EACrDH,EAAK,CACP,CACF,EAGA,KAAuB,MAAOF,EAAKC,EAAKM,IAAU,CAChD,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAsB,iBAAiB,CAAE,IAAAT,EAAK,IAAAC,EAAK,SAAU,KAAK,QAAS,CAAC,EACnGA,EAAI,KAAK,CAAE,OAAQO,EAAS,MAAO,CAAC,CACtC,MAAgB,CACdP,EAAI,KAAK,CAAE,OAAQ,QAAS,CAAC,CAC/B,CACF,CACF,CAGA,IAAOP,EAAQD",
|
|
4
|
+
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../types/Services'\nimport AsyncPollingUtils from './utils'\nimport AsyncRequestListUtils from '../../../../components/user-reports/requested/utils'\nimport ErrorHandler from '../../../../utils/ErrorHandler'\n\nclass RequestStatusController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n // Render status page\n GET: RequestHandler = async (req, res, next) => {\n try {\n const pollingRenderData = await AsyncPollingUtils.renderPolling({\n req,\n res,\n services: this.services,\n next,\n })\n res.render(`dpr/routes/journeys/request-report/status/view`, {\n layoutPath: this.layoutPath,\n ...pollingRenderData,\n })\n } catch (error) {\n req.body ??= {}\n req.body.title = 'Failed to retrieve report status'\n req.body.errorDescription = 'We were unable to retrieve the report status:'\n req.body.error = new ErrorHandler(error).formatError()\n next()\n }\n }\n\n // Poll request status\n POST: RequestHandler = async (req, res, _next) => {\n try {\n const response = await AsyncRequestListUtils.getRequestStatus({ req, res, services: this.services })\n res.send({ status: response.status })\n } catch (error) {\n res.send({ status: 'FAILED' })\n }\n }\n}\n\nexport { RequestStatusController }\nexport default RequestStatusController\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAA8B,sBAC9BA,EAAkC,kEAClCC,EAAyB,6CAEzB,MAAMJ,CAAwB,CAC5B,WAEA,SAEA,YAAYK,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAGA,IAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,GAAI,CACF,MAAMC,EAAoB,MAAM,EAAAC,QAAkB,cAAc,CAC9D,IAAAJ,EACA,IAAAC,EACA,SAAU,KAAK,SACf,KAAAC,CACF,CAAC,EACDD,EAAI,OAAO,iDAAkD,CAC3D,WAAY,KAAK,WACjB,GAAGE,CACL,CAAC,CACH,OAASE,EAAO,CACdL,EAAI,OAAS,CAAC,EACdA,EAAI,KAAK,MAAQ,mCACjBA,EAAI,KAAK,iBAAmB,gDAC5BA,EAAI,KAAK,MAAQ,IAAI,EAAAM,QAAaD,CAAK,EAAE,YAAY,EACrDH,EAAK,CACP,CACF,EAGA,KAAuB,MAAOF,EAAKC,EAAKM,IAAU,CAChD,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAsB,iBAAiB,CAAE,IAAAT,EAAK,IAAAC,EAAK,SAAU,KAAK,QAAS,CAAC,EACnGA,EAAI,KAAK,CAAE,OAAQO,EAAS,MAAO,CAAC,CACtC,MAAgB,CACdP,EAAI,KAAK,CAAE,OAAQ,QAAS,CAAC,CAC/B,CACF,CACF,CAGA,IAAOP,EAAQD",
|
|
6
6
|
"names": ["controller_exports", "__export", "RequestStatusController", "controller_default", "__toCommonJS", "import_utils", "import_ErrorHandler", "layoutPath", "services", "req", "res", "next", "pollingRenderData", "AsyncPollingUtils", "error", "ErrorHandler", "_next", "response", "AsyncRequestListUtils"]
|
|
7
7
|
}
|
|
@@ -28,6 +28,7 @@ class RequestStatusController {
|
|
|
28
28
|
...pollingRenderData,
|
|
29
29
|
})
|
|
30
30
|
} catch (error) {
|
|
31
|
+
req.body ??= {}
|
|
31
32
|
req.body.title = 'Failed to retrieve report status'
|
|
32
33
|
req.body.errorDescription = 'We were unable to retrieve the report status:'
|
|
33
34
|
req.body.error = new ErrorHandler(error).formatError()
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var f=Object.create;var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var f=Object.create;var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var E=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},u=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of y(e))!h.call(t,s)&&s!==r&&a(t,s,{get:()=>e[s],enumerable:!(o=v(e,s))||o.enumerable});return t};var i=(t,e,r)=>(r=t!=null?f(p(t)):{},u(e||!t||!t.__esModule?a(r,"default",{value:t,enumerable:!0}):r,t)),b=t=>u(a({},"__esModule",{value:!0}),t);var F={};E(F,{AsyncController:()=>n,default:()=>R});module.exports=b(F);var l=i(require("../../../../utils/ErrorHandler")),m=i(require("../../../../components/user-reports/utils")),c=require("../../../../components/_filters/filtersTypeEnum"),d=i(require("../../../../utils/Personalisation/personalisationUtils"));class n{layoutPath;services;constructor(e,r){this.layoutPath=e,this.services=r}POST=async(e,r,o)=>{try{const s=await m.default.updateExpiredStatus({req:e,res:r,services:this.services});r.send({isExpired:s})}catch{r.send({status:"FAILED"})}};saveDefaultFilterValues=async(e,r,o)=>{try{d.default.saveDefaults(c.FiltersType.INTERACTIVE,r,e,this.services),r.redirect(`${e.baseUrl}?defaultsSaved=true`)}catch(s){e.body={title:"Failed to save defaults",error:new l.default(s).formatError(),...e.body&&{...e.body}},o()}};removeDefaultFilterValues=async(e,r,o)=>{try{d.default.removeDefaults(c.FiltersType.INTERACTIVE,r,e,this.services),r.redirect(e.baseUrl)}catch(s){e.body={title:"Failed to remove defaults",error:new l.default(s).formatError(),...e.body&&{...e.body}},o()}}}var R=n;0&&(module.exports={AsyncController});
|
|
2
2
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/view-report/async/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { RequestHandler } from 'express'\nimport ErrorHandler from '../../../../utils/ErrorHandler'\nimport { Services } from '../../../../types/Services'\nimport UserReportsListUtils from '../../../../components/user-reports/utils'\nimport { FiltersType } from '../../../../components/_filters/filtersTypeEnum'\nimport PersonalisationUtils from '../../../../utils/Personalisation/personalisationUtils'\n\nclass AsyncController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n POST: RequestHandler = async (req, res, _next) => {\n try {\n const response = await UserReportsListUtils.updateExpiredStatus({\n req,\n res,\n services: this.services,\n })\n res.send({ isExpired: response })\n } catch (error) {\n res.send({ status: 'FAILED' })\n }\n }\n\n saveDefaultFilterValues: RequestHandler = async (req, res, next) => {\n try {\n PersonalisationUtils.saveDefaults(FiltersType.INTERACTIVE, res, req, this.services)\n res.redirect(`${req.baseUrl}?defaultsSaved=true`)\n } catch (error) {\n req.body = {\n title: 'Failed to save defaults',\n error: new ErrorHandler(error).formatError(),\n ...req.body,\n }\n next()\n }\n }\n\n removeDefaultFilterValues: RequestHandler = async (req, res, next) => {\n try {\n PersonalisationUtils.removeDefaults(FiltersType.INTERACTIVE, res, req, this.services)\n res.redirect(req.baseUrl)\n } catch (error) {\n req.body = {\n title: 'Failed to remove defaults',\n error: new ErrorHandler(error).formatError(),\n ...req.body,\n }\n next()\n }\n }\n}\n\nexport { AsyncController }\nexport default AsyncController\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAyB,6CAEzBC,EAAiC,wDACjCC,EAA4B,2DAC5BC,EAAiC,qEAEjC,MAAMN,CAAgB,CACpB,WAEA,SAEA,YAAYO,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAEA,KAAuB,MAAOC,EAAKC,EAAKC,IAAU,CAChD,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAqB,oBAAoB,CAC9D,IAAAJ,EACA,IAAAC,EACA,SAAU,KAAK,QACjB,CAAC,EACDA,EAAI,KAAK,CAAE,UAAWE,CAAS,CAAC,CAClC,MAAgB,CACdF,EAAI,KAAK,CAAE,OAAQ,QAAS,CAAC,CAC/B,CACF,EAEA,wBAA0C,MAAOD,EAAKC,EAAKI,IAAS,CAClE,GAAI,CACF,EAAAC,QAAqB,aAAa,cAAY,YAAaL,EAAKD,EAAK,KAAK,QAAQ,EAClFC,EAAI,SAAS,GAAGD,EAAI,OAAO,qBAAqB,CAClD,OAASO,EAAO,CACdP,EAAI,KAAO,CACT,MAAO,0BACP,MAAO,IAAI,EAAAQ,QAAaD,CAAK,EAAE,YAAY,EAC3C,
|
|
4
|
+
"sourcesContent": ["import { RequestHandler } from 'express'\nimport ErrorHandler from '../../../../utils/ErrorHandler'\nimport { Services } from '../../../../types/Services'\nimport UserReportsListUtils from '../../../../components/user-reports/utils'\nimport { FiltersType } from '../../../../components/_filters/filtersTypeEnum'\nimport PersonalisationUtils from '../../../../utils/Personalisation/personalisationUtils'\n\nclass AsyncController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n POST: RequestHandler = async (req, res, _next) => {\n try {\n const response = await UserReportsListUtils.updateExpiredStatus({\n req,\n res,\n services: this.services,\n })\n res.send({ isExpired: response })\n } catch (error) {\n res.send({ status: 'FAILED' })\n }\n }\n\n saveDefaultFilterValues: RequestHandler = async (req, res, next) => {\n try {\n PersonalisationUtils.saveDefaults(FiltersType.INTERACTIVE, res, req, this.services)\n res.redirect(`${req.baseUrl}?defaultsSaved=true`)\n } catch (error) {\n req.body = {\n title: 'Failed to save defaults',\n error: new ErrorHandler(error).formatError(),\n ...(req.body && { ...req.body }),\n }\n next()\n }\n }\n\n removeDefaultFilterValues: RequestHandler = async (req, res, next) => {\n try {\n PersonalisationUtils.removeDefaults(FiltersType.INTERACTIVE, res, req, this.services)\n res.redirect(req.baseUrl)\n } catch (error) {\n req.body = {\n title: 'Failed to remove defaults',\n error: new ErrorHandler(error).formatError(),\n ...(req.body && { ...req.body }),\n }\n next()\n }\n }\n}\n\nexport { AsyncController }\nexport default AsyncController\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAyB,6CAEzBC,EAAiC,wDACjCC,EAA4B,2DAC5BC,EAAiC,qEAEjC,MAAMN,CAAgB,CACpB,WAEA,SAEA,YAAYO,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAEA,KAAuB,MAAOC,EAAKC,EAAKC,IAAU,CAChD,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAqB,oBAAoB,CAC9D,IAAAJ,EACA,IAAAC,EACA,SAAU,KAAK,QACjB,CAAC,EACDA,EAAI,KAAK,CAAE,UAAWE,CAAS,CAAC,CAClC,MAAgB,CACdF,EAAI,KAAK,CAAE,OAAQ,QAAS,CAAC,CAC/B,CACF,EAEA,wBAA0C,MAAOD,EAAKC,EAAKI,IAAS,CAClE,GAAI,CACF,EAAAC,QAAqB,aAAa,cAAY,YAAaL,EAAKD,EAAK,KAAK,QAAQ,EAClFC,EAAI,SAAS,GAAGD,EAAI,OAAO,qBAAqB,CAClD,OAASO,EAAO,CACdP,EAAI,KAAO,CACT,MAAO,0BACP,MAAO,IAAI,EAAAQ,QAAaD,CAAK,EAAE,YAAY,EAC3C,GAAIP,EAAI,MAAQ,CAAE,GAAGA,EAAI,IAAK,CAChC,EACAK,EAAK,CACP,CACF,EAEA,0BAA4C,MAAOL,EAAKC,EAAKI,IAAS,CACpE,GAAI,CACF,EAAAC,QAAqB,eAAe,cAAY,YAAaL,EAAKD,EAAK,KAAK,QAAQ,EACpFC,EAAI,SAASD,EAAI,OAAO,CAC1B,OAASO,EAAO,CACdP,EAAI,KAAO,CACT,MAAO,4BACP,MAAO,IAAI,EAAAQ,QAAaD,CAAK,EAAE,YAAY,EAC3C,GAAIP,EAAI,MAAQ,CAAE,GAAGA,EAAI,IAAK,CAChC,EACAK,EAAK,CACP,CACF,CACF,CAGA,IAAOb,EAAQD",
|
|
6
6
|
"names": ["controller_exports", "__export", "AsyncController", "controller_default", "__toCommonJS", "import_ErrorHandler", "import_utils", "import_filtersTypeEnum", "import_personalisationUtils", "layoutPath", "services", "req", "res", "_next", "response", "UserReportsListUtils", "next", "PersonalisationUtils", "error", "ErrorHandler"]
|
|
7
7
|
}
|
|
@@ -36,7 +36,7 @@ class AsyncController {
|
|
|
36
36
|
req.body = {
|
|
37
37
|
title: 'Failed to save defaults',
|
|
38
38
|
error: new ErrorHandler(error).formatError(),
|
|
39
|
-
...req.body,
|
|
39
|
+
...(req.body && { ...req.body }),
|
|
40
40
|
}
|
|
41
41
|
next()
|
|
42
42
|
}
|
|
@@ -50,7 +50,7 @@ class AsyncController {
|
|
|
50
50
|
req.body = {
|
|
51
51
|
title: 'Failed to remove defaults',
|
|
52
52
|
error: new ErrorHandler(error).formatError(),
|
|
53
|
-
...req.body,
|
|
53
|
+
...(req.body && { ...req.body }),
|
|
54
54
|
}
|
|
55
55
|
next()
|
|
56
56
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var v=Object.create;var i=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var H=(t,r)=>{for(var e in r)i(t,e,{get:r[e],enumerable:!0})},p=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of w(r))!D.call(t,s)&&s!==e&&i(t,s,{get:()=>r[s],enumerable:!(a=b(r,s))||a.enumerable});return t};var c=(t,r,e)=>(e=t!=null?v(E(t)):{},p(r||!t||!t.__esModule?i(e,"default",{value:t,enumerable:!0}):e,t)),P=t=>p(i({},"__esModule",{value:!0}),t);var S={};H(S,{ViewAsyncDashboardController:()=>
|
|
1
|
+
"use strict";var v=Object.create;var i=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var H=(t,r)=>{for(var e in r)i(t,e,{get:r[e],enumerable:!0})},p=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of w(r))!D.call(t,s)&&s!==e&&i(t,s,{get:()=>r[s],enumerable:!(a=b(r,s))||a.enumerable});return t};var c=(t,r,e)=>(e=t!=null?v(E(t)):{},p(r||!t||!t.__esModule?i(e,"default",{value:t,enumerable:!0}):e,t)),P=t=>p(i({},"__esModule",{value:!0}),t);var S={};H(S,{ViewAsyncDashboardController:()=>n,default:()=>R});module.exports=P(S);var y=c(require("../../../../../utils/ErrorHandler")),h=c(require("../../../../../utils/localsHelper")),m=c(require("./utils")),u=c(require("../../utils"));class n{layoutPath;services;constructor(r,e){this.layoutPath=r,this.services=e}GET=async(r,e,a)=>{const{type:s}=r.params;try{const d={req:r,res:e,services:this.services,next:a},o=await m.default.renderAsyncDashboard(d);e.render("dpr/routes/journeys/view-report/dashboard",{layoutPath:this.layoutPath,...o})}catch(d){const o=new y.default(d).formatError();let l;if(o.status==="EXPIRED"){const{dprUser:f}=h.default.getValues(e);l=await this.services.recentlyViewedService.asyncSetToExpiredByTableId(r.params.tableId,f.id)}r.body??={},r.body.title=`Failed to retrieve ${s}`,r.body.error=o,l&&(r.body.refreshLink=l),a()}};applyFilters=async(r,e,a)=>{await u.default.applyDashboardInteractiveQuery(r,e,this.services,"filters")}}var R=n;0&&(module.exports={ViewAsyncDashboardController});
|
|
2
2
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/dpr/routes/journeys/view-report/async/dashboard/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { RequestHandler } from 'express'\nimport ErrorHandler from '../../../../../utils/ErrorHandler'\nimport { Services } from '../../../../../types/Services'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport DashboardUtils from './utils'\nimport ViewReportUtils from '../../utils'\n\nclass ViewAsyncDashboardController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n GET: RequestHandler = async (req, res, next) => {\n const { type } = req.params\n try {\n const params = { req, res, services: this.services, next }\n\n const renderData = await DashboardUtils.renderAsyncDashboard(params)\n\n res.render(`dpr/routes/journeys/view-report/dashboard`, {\n layoutPath: this.layoutPath,\n ...renderData,\n })\n } catch (error) {\n const dprError = new ErrorHandler(error).formatError()\n let refreshLink\n if (dprError.status === 'EXPIRED') {\n const { dprUser } = LocalsHelper.getValues(res)\n refreshLink = await this.services.recentlyViewedService.asyncSetToExpiredByTableId(\n req.params['tableId'],\n dprUser.id,\n )\n }\n req.body.title = `Failed to retrieve ${type}`\n req.body.error = dprError\n if (refreshLink) {\n req.body.refreshLink = refreshLink\n }\n next()\n }\n }\n\n applyFilters: RequestHandler = async (req, res, _next) => {\n await ViewReportUtils.applyDashboardInteractiveQuery(req, res, this.services, 'filters')\n }\n}\n\nexport { ViewAsyncDashboardController }\nexport default ViewAsyncDashboardController\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAyB,gDAEzBC,EAAyB,gDACzBC,EAA2B,sBAC3BA,EAA4B,0BAE5B,MAAML,CAA6B,CACjC,WAEA,SAEA,YAAYM,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAEA,IAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,KAAM,CAAE,KAAAC,CAAK,EAAIH,EAAI,OACrB,GAAI,CACF,MAAMI,EAAS,CAAE,IAAAJ,EAAK,IAAAC,EAAK,SAAU,KAAK,SAAU,KAAAC,CAAK,EAEnDG,EAAa,MAAM,EAAAC,QAAe,qBAAqBF,CAAM,EAEnEH,EAAI,OAAO,4CAA6C,CACtD,WAAY,KAAK,WACjB,GAAGI,CACL,CAAC,CACH,OAASE,EAAO,CACd,MAAMC,EAAW,IAAI,EAAAC,QAAaF,CAAK,EAAE,YAAY,EACrD,IAAIG,EACJ,GAAIF,EAAS,SAAW,UAAW,CACjC,KAAM,CAAE,QAAAG,CAAQ,EAAI,EAAAC,QAAa,UAAUX,CAAG,EAC9CS,EAAc,MAAM,KAAK,SAAS,sBAAsB,2BACtDV,EAAI,OAAO,QACXW,EAAQ,EACV,CACF,CACAX,EAAI,KAAK,MAAQ,sBAAsBG,CAAI,GAC3CH,EAAI,KAAK,MAAQQ,EACbE,IACFV,EAAI,KAAK,YAAcU,GAEzBR,EAAK,CACP,CACF,EAEA,aAA+B,MAAOF,EAAKC,EAAKY,IAAU,CACxD,MAAM,EAAAC,QAAgB,+BAA+Bd,EAAKC,EAAK,KAAK,SAAU,SAAS,CACzF,CACF,CAGA,IAAOR,EAAQD",
|
|
4
|
+
"sourcesContent": ["import { RequestHandler } from 'express'\nimport ErrorHandler from '../../../../../utils/ErrorHandler'\nimport { Services } from '../../../../../types/Services'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport DashboardUtils from './utils'\nimport ViewReportUtils from '../../utils'\n\nclass ViewAsyncDashboardController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n GET: RequestHandler = async (req, res, next) => {\n const { type } = req.params\n try {\n const params = { req, res, services: this.services, next }\n\n const renderData = await DashboardUtils.renderAsyncDashboard(params)\n\n res.render(`dpr/routes/journeys/view-report/dashboard`, {\n layoutPath: this.layoutPath,\n ...renderData,\n })\n } catch (error) {\n const dprError = new ErrorHandler(error).formatError()\n let refreshLink\n if (dprError.status === 'EXPIRED') {\n const { dprUser } = LocalsHelper.getValues(res)\n refreshLink = await this.services.recentlyViewedService.asyncSetToExpiredByTableId(\n req.params['tableId'],\n dprUser.id,\n )\n }\n req.body ??= {}\n req.body.title = `Failed to retrieve ${type}`\n req.body.error = dprError\n if (refreshLink) {\n req.body.refreshLink = refreshLink\n }\n next()\n }\n }\n\n applyFilters: RequestHandler = async (req, res, _next) => {\n await ViewReportUtils.applyDashboardInteractiveQuery(req, res, this.services, 'filters')\n }\n}\n\nexport { ViewAsyncDashboardController }\nexport default ViewAsyncDashboardController\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAyB,gDAEzBC,EAAyB,gDACzBC,EAA2B,sBAC3BA,EAA4B,0BAE5B,MAAML,CAA6B,CACjC,WAEA,SAEA,YAAYM,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAEA,IAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,KAAM,CAAE,KAAAC,CAAK,EAAIH,EAAI,OACrB,GAAI,CACF,MAAMI,EAAS,CAAE,IAAAJ,EAAK,IAAAC,EAAK,SAAU,KAAK,SAAU,KAAAC,CAAK,EAEnDG,EAAa,MAAM,EAAAC,QAAe,qBAAqBF,CAAM,EAEnEH,EAAI,OAAO,4CAA6C,CACtD,WAAY,KAAK,WACjB,GAAGI,CACL,CAAC,CACH,OAASE,EAAO,CACd,MAAMC,EAAW,IAAI,EAAAC,QAAaF,CAAK,EAAE,YAAY,EACrD,IAAIG,EACJ,GAAIF,EAAS,SAAW,UAAW,CACjC,KAAM,CAAE,QAAAG,CAAQ,EAAI,EAAAC,QAAa,UAAUX,CAAG,EAC9CS,EAAc,MAAM,KAAK,SAAS,sBAAsB,2BACtDV,EAAI,OAAO,QACXW,EAAQ,EACV,CACF,CACAX,EAAI,OAAS,CAAC,EACdA,EAAI,KAAK,MAAQ,sBAAsBG,CAAI,GAC3CH,EAAI,KAAK,MAAQQ,EACbE,IACFV,EAAI,KAAK,YAAcU,GAEzBR,EAAK,CACP,CACF,EAEA,aAA+B,MAAOF,EAAKC,EAAKY,IAAU,CACxD,MAAM,EAAAC,QAAgB,+BAA+Bd,EAAKC,EAAK,KAAK,SAAU,SAAS,CACzF,CACF,CAGA,IAAOR,EAAQD",
|
|
6
6
|
"names": ["controller_exports", "__export", "ViewAsyncDashboardController", "controller_default", "__toCommonJS", "import_ErrorHandler", "import_localsHelper", "import_utils", "layoutPath", "services", "req", "res", "next", "type", "params", "renderData", "DashboardUtils", "error", "dprError", "ErrorHandler", "refreshLink", "dprUser", "LocalsHelper", "_next", "ViewReportUtils"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var R=Object.create;var i=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var R=Object.create;var i=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var I=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E(e))!H.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(s=w(e,o))||s.enumerable});return t};var n=(t,e,r)=>(r=t!=null?R(b(t)):{},m(e||!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),P=t=>m(i({},"__esModule",{value:!0}),t);var x={};I(x,{ViewAyncReportController:()=>y,default:()=>S});module.exports=P(x);var u=n(require("../../../../../utils/localsHelper")),v=n(require("./utils")),l=n(require("../../utils")),h=n(require("../../../../../utils/ErrorHandler"));class y{layoutPath;services;constructor(e,r){this.layoutPath=e,this.services=r}GET=async(e,r,s)=>{const{type:o}=e.params;try{const c={req:e,res:r,services:this.services,next:s},a=await v.default.renderReport(c);r.render("dpr/routes/journeys/view-report/report",{layoutPath:this.layoutPath,...a})}catch(c){const a=new h.default(c).formatError();let p;const{recentlyViewedService:d}=this.services;if(a.status==="EXPIRED"&&d){const{dprUser:f}=u.default.getValues(r);p=await d.asyncSetToExpiredByTableId(e.params.tableId,f.id)}e.body??={},e.body.title=`Failed to retrieve ${o}`,e.body.error=a,p&&(e.body.refreshLink=p),s()}};applyFilters=async(e,r,s)=>{await l.default.applyReportInteractiveQuery(e,r,this.services,"filters")};applyColumns=async(e,r,s)=>{await l.default.applyReportInteractiveQuery(e,r,this.services,"columns")}}var S=y;0&&(module.exports={ViewAyncReportController});
|
|
2
2
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/dpr/routes/journeys/view-report/async/report/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../../types/Services'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport AsyncReportUtils from './utils'\nimport ViewReportUtils from '../../utils'\nimport ErrorHandler from '../../../../../utils/ErrorHandler'\n\nclass ViewAyncReportController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n GET: RequestHandler = async (req, res, next) => {\n const { type } = req.params\n try {\n const params = { req, res, services: this.services, next }\n\n const renderData = await AsyncReportUtils.renderReport(params)\n\n res.render(`dpr/routes/journeys/view-report/report`, {\n layoutPath: this.layoutPath,\n ...renderData,\n })\n } catch (error) {\n const dprError = new ErrorHandler(error).formatError()\n let refreshLink\n const { recentlyViewedService } = this.services\n if (dprError.status === 'EXPIRED' && recentlyViewedService) {\n const { dprUser } = LocalsHelper.getValues(res)\n refreshLink = await recentlyViewedService.asyncSetToExpiredByTableId(req.params['tableId'], dprUser.id)\n }\n req.body.title = `Failed to retrieve ${type}`\n req.body.error = dprError\n if (refreshLink) {\n req.body.refreshLink = refreshLink\n }\n next()\n }\n }\n\n applyFilters: RequestHandler = async (req, res, _next) => {\n await ViewReportUtils.applyReportInteractiveQuery(req, res, this.services, 'filters')\n }\n\n applyColumns: RequestHandler = async (req, res, _next) => {\n await ViewReportUtils.applyReportInteractiveQuery(req, res, this.services, 'columns')\n }\n}\n\nexport { ViewAyncReportController }\nexport default ViewAyncReportController\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAAyB,gDACzBC,EAA6B,sBAC7BA,EAA4B,0BAC5BC,EAAyB,gDAEzB,MAAML,CAAyB,CAC7B,WAEA,SAEA,YAAYM,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAEA,IAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,KAAM,CAAE,KAAAC,CAAK,EAAIH,EAAI,OACrB,GAAI,CACF,MAAMI,EAAS,CAAE,IAAAJ,EAAK,IAAAC,EAAK,SAAU,KAAK,SAAU,KAAAC,CAAK,EAEnDG,EAAa,MAAM,EAAAC,QAAiB,aAAaF,CAAM,EAE7DH,EAAI,OAAO,yCAA0C,CACnD,WAAY,KAAK,WACjB,GAAGI,CACL,CAAC,CACH,OAASE,EAAO,CACd,MAAMC,EAAW,IAAI,EAAAC,QAAaF,CAAK,EAAE,YAAY,EACrD,IAAIG,EACJ,KAAM,CAAE,sBAAAC,CAAsB,EAAI,KAAK,SACvC,GAAIH,EAAS,SAAW,WAAaG,EAAuB,CAC1D,KAAM,CAAE,QAAAC,CAAQ,EAAI,EAAAC,QAAa,UAAUZ,CAAG,EAC9CS,EAAc,MAAMC,EAAsB,2BAA2BX,EAAI,OAAO,QAAYY,EAAQ,EAAE,CACxG,CACAZ,EAAI,KAAK,MAAQ,sBAAsBG,CAAI,GAC3CH,EAAI,KAAK,MAAQQ,EACbE,IACFV,EAAI,KAAK,YAAcU,GAEzBR,EAAK,CACP,CACF,EAEA,aAA+B,MAAOF,EAAKC,EAAKa,IAAU,CACxD,MAAM,EAAAC,QAAgB,4BAA4Bf,EAAKC,EAAK,KAAK,SAAU,SAAS,CACtF,EAEA,aAA+B,MAAOD,EAAKC,EAAKa,IAAU,CACxD,MAAM,EAAAC,QAAgB,4BAA4Bf,EAAKC,EAAK,KAAK,SAAU,SAAS,CACtF,CACF,CAGA,IAAOR,EAAQD",
|
|
4
|
+
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../../types/Services'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport AsyncReportUtils from './utils'\nimport ViewReportUtils from '../../utils'\nimport ErrorHandler from '../../../../../utils/ErrorHandler'\n\nclass ViewAyncReportController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n GET: RequestHandler = async (req, res, next) => {\n const { type } = req.params\n try {\n const params = { req, res, services: this.services, next }\n\n const renderData = await AsyncReportUtils.renderReport(params)\n\n res.render(`dpr/routes/journeys/view-report/report`, {\n layoutPath: this.layoutPath,\n ...renderData,\n })\n } catch (error) {\n const dprError = new ErrorHandler(error).formatError()\n let refreshLink\n const { recentlyViewedService } = this.services\n if (dprError.status === 'EXPIRED' && recentlyViewedService) {\n const { dprUser } = LocalsHelper.getValues(res)\n refreshLink = await recentlyViewedService.asyncSetToExpiredByTableId(req.params['tableId'], dprUser.id)\n }\n req.body ??= {}\n req.body.title = `Failed to retrieve ${type}`\n req.body.error = dprError\n if (refreshLink) {\n req.body.refreshLink = refreshLink\n }\n next()\n }\n }\n\n applyFilters: RequestHandler = async (req, res, _next) => {\n await ViewReportUtils.applyReportInteractiveQuery(req, res, this.services, 'filters')\n }\n\n applyColumns: RequestHandler = async (req, res, _next) => {\n await ViewReportUtils.applyReportInteractiveQuery(req, res, this.services, 'columns')\n }\n}\n\nexport { ViewAyncReportController }\nexport default ViewAyncReportController\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAAyB,gDACzBC,EAA6B,sBAC7BA,EAA4B,0BAC5BC,EAAyB,gDAEzB,MAAML,CAAyB,CAC7B,WAEA,SAEA,YAAYM,EAAoBC,EAAoB,CAClD,KAAK,WAAaD,EAClB,KAAK,SAAWC,CAClB,CAEA,IAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,KAAM,CAAE,KAAAC,CAAK,EAAIH,EAAI,OACrB,GAAI,CACF,MAAMI,EAAS,CAAE,IAAAJ,EAAK,IAAAC,EAAK,SAAU,KAAK,SAAU,KAAAC,CAAK,EAEnDG,EAAa,MAAM,EAAAC,QAAiB,aAAaF,CAAM,EAE7DH,EAAI,OAAO,yCAA0C,CACnD,WAAY,KAAK,WACjB,GAAGI,CACL,CAAC,CACH,OAASE,EAAO,CACd,MAAMC,EAAW,IAAI,EAAAC,QAAaF,CAAK,EAAE,YAAY,EACrD,IAAIG,EACJ,KAAM,CAAE,sBAAAC,CAAsB,EAAI,KAAK,SACvC,GAAIH,EAAS,SAAW,WAAaG,EAAuB,CAC1D,KAAM,CAAE,QAAAC,CAAQ,EAAI,EAAAC,QAAa,UAAUZ,CAAG,EAC9CS,EAAc,MAAMC,EAAsB,2BAA2BX,EAAI,OAAO,QAAYY,EAAQ,EAAE,CACxG,CACAZ,EAAI,OAAS,CAAC,EACdA,EAAI,KAAK,MAAQ,sBAAsBG,CAAI,GAC3CH,EAAI,KAAK,MAAQQ,EACbE,IACFV,EAAI,KAAK,YAAcU,GAEzBR,EAAK,CACP,CACF,EAEA,aAA+B,MAAOF,EAAKC,EAAKa,IAAU,CACxD,MAAM,EAAAC,QAAgB,4BAA4Bf,EAAKC,EAAK,KAAK,SAAU,SAAS,CACtF,EAEA,aAA+B,MAAOD,EAAKC,EAAKa,IAAU,CACxD,MAAM,EAAAC,QAAgB,4BAA4Bf,EAAKC,EAAK,KAAK,SAAU,SAAS,CACtF,CACF,CAGA,IAAOR,EAAQD",
|
|
6
6
|
"names": ["controller_exports", "__export", "ViewAyncReportController", "controller_default", "__toCommonJS", "import_localsHelper", "import_utils", "import_ErrorHandler", "layoutPath", "services", "req", "res", "next", "type", "params", "renderData", "AsyncReportUtils", "error", "dprError", "ErrorHandler", "refreshLink", "recentlyViewedService", "dprUser", "LocalsHelper", "_next", "ViewReportUtils"]
|
|
7
7
|
}
|