@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.17.5 → 4.18.0
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/components/_reports/report-actions/view.njk +15 -13
- package/dpr/data/dashboardClient.js +1 -1
- package/dpr/data/dashboardClient.js.map +3 -3
- package/dpr/data/dashboardClient.ts +4 -1
- package/dpr/data/reportingClient.js +1 -1
- package/dpr/data/reportingClient.js.map +3 -3
- package/dpr/data/reportingClient.ts +4 -1
- package/dpr/routes/journeys/product-collection/selected/controller.js.map +1 -1
- package/dpr/routes/journeys/product-collection/selected/controller.ts +1 -1
- package/dpr/routes/journeys/view-report/async/dashboard/utils.js +1 -1
- package/dpr/routes/journeys/view-report/async/dashboard/utils.js.map +3 -3
- package/dpr/routes/journeys/view-report/async/dashboard/utils.ts +22 -9
- 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 +2 -2
- package/dpr/routes/journeys/view-report/async/report/tests.cy.ts +0 -3
- package/dpr/routes/journeys/view-report/async/report/utils.js +1 -1
- package/dpr/routes/journeys/view-report/async/report/utils.js.map +3 -3
- package/dpr/routes/journeys/view-report/async/report/utils.ts +6 -5
- package/dpr/services/dashboardService.js +1 -1
- package/dpr/services/dashboardService.js.map +3 -3
- package/dpr/services/dashboardService.ts +2 -1
- package/dpr/services/reportingService.js +1 -1
- package/dpr/services/reportingService.js.map +2 -2
- package/dpr/services/reportingService.ts +2 -1
- package/package.json +1 -1
|
@@ -76,19 +76,21 @@
|
|
|
76
76
|
{% set itemClassNames = itemClassNames + " " + item.classes %}
|
|
77
77
|
{% endif %}
|
|
78
78
|
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
{% if not item.attributes.disabled %}
|
|
80
|
+
{{ govukButton({
|
|
81
|
+
element: item.element,
|
|
82
|
+
classes: itemClassNames,
|
|
83
|
+
text: item.text,
|
|
84
|
+
html: item.html,
|
|
85
|
+
name: item.name,
|
|
86
|
+
type: item.type,
|
|
87
|
+
value: item.value,
|
|
88
|
+
href: item.href,
|
|
89
|
+
disabled: item.disabled,
|
|
90
|
+
attributes: item.attributes,
|
|
91
|
+
preventDoubleClick: items.preventDoubleClick
|
|
92
|
+
}) }}
|
|
93
|
+
{% endif %}
|
|
92
94
|
{% endfor -%}
|
|
93
95
|
</div>
|
|
94
96
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var D=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var $=(
|
|
1
|
+
"use strict";var D=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var $=(e,s)=>{for(var t in s)a(e,t,{get:s[t],enumerable:!0})},m=(e,s,t,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of p(s))!C.call(e,n)&&n!==t&&a(e,n,{get:()=>s[n],enumerable:!(i=u(s,n))||i.enumerable});return e};var l=(e,s,t)=>(t=e!=null?D(b(e)):{},m(s||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e)),y=e=>m(a({},"__esModule",{value:!0}),e);var R={};$(R,{DashboardClient:()=>c,default:()=>d});module.exports=y(R);var h=l(require("../utils/logger")),f=l(require("./restClient"));class c{constructor(s){this.restClient=new f.default("Dashboard API Client",s)}getDefinition(s,t,i,n,r){const o={...r,dataProductDefinitionsPath:n};return this.logInfo("Get definition:",{dpdId:i,dashboardId:t,...o}),this.restClient.get({path:`/definitions/${i}/dashboards/${t}`,query:o,token:s}).then(g=>g)}requestAsyncDashboard(s,t,i,n){return this.logInfo("Request dashboard:",{reportId:t,dashboardId:i}),this.restClient.get({path:`/async/dashboards/${t}/${i}`,token:s,query:n}).then(r=>r)}getAsyncDashboard(s,t,i,n,r){return this.logInfo("Get dashboard:",{reportId:t,dashboardId:i,tableId:n}),this.restClient.get({path:`/reports/${t}/dashboards/${i}/tables/${n}/result`,token:s,query:r}).then(o=>o)}getAsyncStatus(s,t,i,n,r,o){return this.logInfo("Get status:",{reportId:t,dashboardId:i,executionId:n,tableId:r}),this.restClient.get({path:`/reports/${t}/dashboards/${i}/statements/${n}/status`,token:s,query:{dataProductDefinitionsPath:o,tableId:r}}).then(g=>g)}cancelAsyncRequest(s,t,i,n,r){return this.logInfo("Cancel request:",{reportId:t,dashboardId:i,executionId:n}),this.restClient.delete({path:`/reports/${t}/dashboards/${i}/statements/${n}`,token:s,query:{dataProductDefinitionsPath:r}}).then(o=>o)}logInfo(s,t){h.default.info(`Dashboard client: ${s}:`),t&&Object.keys(t).length&&h.default.info(JSON.stringify(t,null,2))}}var d=c;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 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
|
|
5
|
-
"mappings": "0jBAAA,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,
|
|
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"]
|
|
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 queryData?: Dict<string | string[]> | undefined,\n ): Promise<components['schemas']['DashboardDefinition']> {\n const query = {\n ...queryData,\n dataProductDefinitionsPath: definitionsPath,\n }\n this.logInfo('Get definition:', { dpdId, dashboardId, ...query })\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<components['schemas']['StatementExecutionStatus']> {\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) => <components['schemas']['StatementExecutionStatus']>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": "0jBAAA,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,EACAC,EACuD,CACvD,MAAMC,EAAQ,CACZ,GAAGD,EACH,2BAA4BD,CAC9B,EACA,YA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CAAW,GAC9E,MAAAT,EACA,MAAO,CACL,2BAAAU,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,IAAOlB,EAAQD",
|
|
6
|
+
"names": ["dashboardClient_exports", "__export", "DashboardClient", "dashboardClient_default", "__toCommonJS", "import_logger", "import_restClient", "config", "RestClient", "token", "dashboardId", "dpdId", "definitionsPath", "queryData", "query", "response", "reportId", "tableId", "executionId", "dataProductDefinitionsPath", "title", "args", "logger"]
|
|
7
7
|
}
|
|
@@ -17,11 +17,14 @@ class DashboardClient {
|
|
|
17
17
|
dashboardId: string,
|
|
18
18
|
dpdId: string,
|
|
19
19
|
definitionsPath?: string,
|
|
20
|
+
queryData?: Dict<string | string[]> | undefined,
|
|
20
21
|
): Promise<components['schemas']['DashboardDefinition']> {
|
|
21
|
-
this.logInfo('Get definition:', { dpdId, dashboardId })
|
|
22
22
|
const query = {
|
|
23
|
+
...queryData,
|
|
23
24
|
dataProductDefinitionsPath: definitionsPath,
|
|
24
25
|
}
|
|
26
|
+
this.logInfo('Get definition:', { dpdId, dashboardId, ...query })
|
|
27
|
+
|
|
25
28
|
return this.restClient
|
|
26
29
|
.get({
|
|
27
30
|
path: `/definitions/${dpdId}/dashboards/${dashboardId}`,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var y=Object.create;var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var $=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},c=(s,e,t,
|
|
1
|
+
"use strict";var y=Object.create;var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var $=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},c=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of R(e))!D.call(s,i)&&i!==t&&u(s,i,{get:()=>e[i],enumerable:!(n=f(e,i))||n.enumerable});return s};var m=(s,e,t)=>(t=s!=null?y(C(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,n){return a.default.info(`Reporting client: Get count. { resourceName: ${e} }`),this.restClient.get({path:`/${e}/count`,query:n.toRecordWithFilterPrefix(!0),token:t}).then(i=>i.count)}getList(e,t,n){return this.getListWithWarnings(e,t,n).then(i=>i.data)}getListWithWarnings(e,t,n){return a.default.info(`Reporting client: Get list. { resourceName: ${e} }`),this.restClient.getWithHeaders({path:`/${e}`,query:n.toRecordWithFilterPrefix(!0),token:t}).then(i=>({data:i.data,warnings:{noDataAvailable:i.headers["x-no-data-warning"]}}))}getDefinitionSummary(e,t,n){this.logInfo("Get definition summary",{reportId:t});const i={...n&&{dataProductDefinitionsPath:n}};return this.restClient.get({path:`/definitions/${t}`,query:i,token:e}).then(r=>r)}getDefinitions(e,t){this.logInfo("Get definitions");const n={renderMethod:"HTML",...t&&{dataProductDefinitionsPath:t}};return this.restClient.get({path:"/definitions",query:n,token:e}).then(i=>i)}getDefinition(e,t,n,i,r){const o={...r,dataProductDefinitionsPath:i};return this.logInfo("Get definition",{reportId:t,variantId:n,...o}),this.restClient.get({path:`/definitions/${t}/${n}`,query:o,token:e}).then(g=>g)}getFieldValues({token:e,definitionName:t,variantName:n,fieldName:i,prefix:r,definitionsPath:o}){const g={dataProductDefinitionsPath:o,prefix:r};return this.logInfo("Get field values",{definitionName:t,variantName:n,fieldName:i,prefix:r}),this.restClient.get({path:`/reports/${t}/${n}/${i}`,token:e,query:g}).then(p=>p)}requestAsyncReport(e,t,n,i){return this.logInfo("Request report",{reportId:t,variantId:n}),this.restClient.get({path:`/async/reports/${t}/${n}`,token:e,query:i}).then(r=>r)}cancelAsyncRequest(e,t,n,i,r){return this.logInfo("Cancel Request",{reportId:t,variantId:n,executionId:i}),this.restClient.delete({path:`/reports/${t}/${n}/statements/${i}`,token:e,query:{dataProductDefinitionsPath:r}}).then(o=>o)}getAsyncReport(e,t,n,i,r){return this.logInfo("Get Data",{reportId:t,variantId:n,tableId:i}),this.restClient.get({path:`/reports/${t}/${n}/tables/${i}/result`,token:e,query:r}).then(o=>o)}getAsyncSummaryReport(e,t,n,i,r,o){return this.logInfo("Get summary data",{reportId:t,variantId:n,tableId:i,summaryId:r}),this.restClient.get({path:`/reports/${t}/${n}/tables/${i}/result/summary/${r}`,token:e,query:o}).then(g=>g)}getAsyncReportStatus(e,t,n,i,r,o){return this.logInfo("Get status",{reportId:t,variantId:n,tableId:o,executionId:i}),this.restClient.get({path:`/reports/${t}/${n}/statements/${i}/status`,token:e,query:{dataProductDefinitionsPath:r,tableId:o}}).then(g=>g)}getAsyncCount(e,t,n){return this.logInfo("Get count",{tableId:t}),this.restClient.get({path:`/report/tables/${t}/count`,token:e,query:{dataProductDefinitionsPath:n}}).then(i=>i.count)}getAsyncInteractiveCount(e,t,n,i,r){return this.logInfo("Get interactive count",{tableId:t,reportId:n,id:i}),this.restClient.get({path:`/reports/${n}/${i}/tables/${t}/count`,token:e,query:r.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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/data/reportingClient.ts"],
|
|
4
|
-
"sourcesContent": ["import ReportQuery from '../types/ReportQuery'\nimport logger from '../utils/logger'\nimport RestClient from './restClient'\nimport Dict = NodeJS.Dict\nimport { components, operations } from '../types/api'\nimport { ApiConfig, Count, FieldValuesRequest, ListWithWarnings } from './types'\nimport type { ResultWithHeaders } from './restClient'\n\nclass ReportingClient {\n restClient: RestClient\n\n constructor(config: ApiConfig) {\n this.restClient = new RestClient('Reporting API Client', config)\n }\n\n getCount(resourceName: string, token: string, countRequest: ReportQuery): Promise<number> {\n logger.info(`Reporting client: Get count. { resourceName: ${resourceName} }`)\n\n return this.restClient\n .get({\n path: `/${resourceName}/count`,\n query: countRequest.toRecordWithFilterPrefix(true),\n token,\n })\n .then((response) => (<Count>response).count)\n }\n\n getList(resourceName: string, token: string, listRequest: ReportQuery): Promise<Array<Dict<string>>> {\n return this.getListWithWarnings(resourceName, token, listRequest).then((response) => response.data)\n }\n\n getListWithWarnings(resourceName: string, token: string, listRequest: ReportQuery): Promise<ListWithWarnings> {\n logger.info(`Reporting client: Get list. { resourceName: ${resourceName} }`)\n\n return this.restClient\n .getWithHeaders<Array<Dict<string>>>({\n path: `/${resourceName}`,\n query: listRequest.toRecordWithFilterPrefix(true),\n token,\n })\n .then((response: ResultWithHeaders<Array<Dict<string>>>) => ({\n data: response.data,\n warnings: {\n noDataAvailable: response.headers['x-no-data-warning'],\n },\n }))\n }\n\n getDefinitionSummary(\n token: string,\n reportId: string,\n definitionsPath?: string,\n ): Promise<components['schemas']['ReportDefinitionSummary']> {\n this.logInfo('Get definition summary', { reportId })\n\n const queryParams: operations['definitionSummary']['parameters']['query'] = {\n ...(definitionsPath && { dataProductDefinitionsPath: definitionsPath }),\n }\n\n return this.restClient\n .get({\n path: `/definitions/${reportId}`,\n query: queryParams,\n token,\n })\n .then((response) => <components['schemas']['ReportDefinitionSummary']>response)\n }\n\n getDefinitions(\n token: string,\n definitionsPath?: string,\n ): Promise<Array<components['schemas']['ReportDefinitionSummary']>> {\n this.logInfo('Get definitions')\n\n const queryParams: operations['definitions_1']['parameters']['query'] = {\n renderMethod: 'HTML',\n ...(definitionsPath && { dataProductDefinitionsPath: definitionsPath }),\n }\n\n return this.restClient\n .get({\n path: '/definitions',\n query: queryParams,\n token,\n })\n .then((response) => <Array<components['schemas']['ReportDefinitionSummary']>>response)\n }\n\n getDefinition(\n token: string,\n reportId: string,\n variantId: string,\n definitionsPath?: string,\n ): Promise<components['schemas']['SingleVariantReportDefinition']> {\n const query = {\n dataProductDefinitionsPath: definitionsPath,\n }\n this.logInfo('Get definition', { reportId, variantId })\n\n return this.restClient\n .get({\n path: `/definitions/${reportId}/${variantId}`,\n query,\n token,\n })\n .then((response) => <components['schemas']['SingleVariantReportDefinition']>response)\n }\n\n getFieldValues({\n token,\n definitionName,\n variantName,\n fieldName,\n prefix,\n definitionsPath,\n }: FieldValuesRequest): Promise<Array<string>> {\n const query = {\n dataProductDefinitionsPath: definitionsPath,\n prefix,\n }\n this.logInfo('Get field values', { definitionName, variantName, fieldName, prefix })\n\n return this.restClient\n .get({\n path: `/reports/${definitionName}/${variantName}/${fieldName}`,\n token,\n query,\n })\n .then((response) => <Array<string>>response)\n }\n\n requestAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n query: Record<string, string | boolean | number>,\n ): Promise<Dict<string>> {\n this.logInfo('Request report', { reportId, variantId })\n\n return this.restClient\n .get({\n path: `/async/reports/${reportId}/${variantId}`,\n token,\n query,\n })\n .then((response) => <Dict<string>>response)\n }\n\n cancelAsyncRequest(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Dict<string>> {\n this.logInfo('Cancel Request', { reportId, variantId, executionId })\n\n return this.restClient\n .delete({\n path: `/reports/${reportId}/${variantId}/statements/${executionId}`,\n token,\n query: {\n dataProductDefinitionsPath,\n },\n })\n .then((response) => <Dict<string>>response)\n }\n\n getAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n query: Record<string, string | string[]>,\n ): Promise<Array<Dict<string>>> {\n this.logInfo('Get Data', { reportId, variantId, tableId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/tables/${tableId}/result`,\n token,\n query,\n })\n .then((response) => <Array<Dict<string>>>response)\n }\n\n getAsyncSummaryReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n summaryId: string,\n query: Dict<string | number>,\n ): Promise<Array<Dict<string>>> {\n this.logInfo('Get summary data', { reportId, variantId, tableId, summaryId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/tables/${tableId}/result/summary/${summaryId}`,\n token,\n query,\n })\n .then((response) => <Array<Dict<string>>>response)\n }\n\n getAsyncReportStatus(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n tableId?: string,\n ): Promise<components['schemas']['StatementExecutionStatus']> {\n this.logInfo('Get status', { reportId, variantId, tableId, executionId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/statements/${executionId}/status`,\n token,\n query: {\n dataProductDefinitionsPath,\n tableId,\n },\n })\n .then((response) => <components['schemas']['StatementExecutionStatus']>response)\n }\n\n getAsyncCount(token: string, tableId: string, dataProductDefinitionsPath?: string): Promise<number> {\n this.logInfo('Get count', { tableId })\n\n return this.restClient\n .get({\n path: `/report/tables/${tableId}/count`,\n token,\n query: {\n dataProductDefinitionsPath,\n },\n })\n .then((response) => (<Count>response).count)\n }\n\n getAsyncInteractiveCount(\n token: string,\n tableId: string,\n reportId: string,\n id: string,\n filters: ReportQuery,\n ): Promise<number> {\n this.logInfo('Get interactive count', { tableId, reportId, id })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${id}/tables/${tableId}/count`,\n token,\n query: filters.toRecordWithFilterPrefix(true),\n })\n .then((response) => (<Count>response).count)\n }\n\n logInfo(title: string, args?: Dict<string>) {\n logger.info(`Reporting Client: ${title}:`)\n if (args && Object.keys(args).length) logger.info(JSON.stringify(args, null, 2))\n }\n}\n\nexport { ReportingClient }\nexport default ReportingClient\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAmB,8BACnBC,EAAuB,2BAMvB,MAAMJ,CAAgB,CAGpB,YAAYK,EAAmB,CAC7B,KAAK,WAAa,IAAI,EAAAC,QAAW,uBAAwBD,CAAM,CACjE,CAEA,SAASE,EAAsBC,EAAeC,EAA4C,CACxF,SAAAC,QAAO,KAAK,gDAAgDH,CAAY,IAAI,EAErE,KAAK,WACT,IAAI,CACH,KAAM,IAAIA,CAAY,SACtB,MAAOE,EAAa,yBAAyB,EAAI,EACjD,MAAAD,CACF,CAAC,EACA,KAAMG,GAAqBA,EAAU,KAAK,CAC/C,CAEA,QAAQJ,EAAsBC,EAAeI,EAAwD,CACnG,OAAO,KAAK,oBAAoBL,EAAcC,EAAOI,CAAW,EAAE,KAAMD,GAAaA,EAAS,IAAI,CACpG,CAEA,oBAAoBJ,EAAsBC,EAAeI,EAAqD,CAC5G,SAAAF,QAAO,KAAK,+CAA+CH,CAAY,IAAI,EAEpE,KAAK,WACT,eAAoC,CACnC,KAAM,IAAIA,CAAY,GACtB,MAAOK,EAAY,yBAAyB,EAAI,EAChD,MAAAJ,CACF,CAAC,EACA,KAAMG,IAAsD,CAC3D,KAAMA,EAAS,KACf,SAAU,CACR,gBAAiBA,EAAS,QAAQ,mBAAmB,CACvD,CACF,EAAE,CACN,CAEA,qBACEH,EACAK,EACAC,EAC2D,CAC3D,KAAK,QAAQ,yBAA0B,CAAE,SAAAD,CAAS,CAAC,EAEnD,MAAME,EAAsE,CAC1E,GAAID,GAAmB,CAAE,2BAA4BA,CAAgB,CACvE,EAEA,OAAO,KAAK,WACT,IAAI,CACH,KAAM,gBAAgBD,CAAQ,GAC9B,MAAOE,EACP,MAAAP,CACF,CAAC,EACA,KAAMG,GAA+DA,CAAQ,CAClF,CAEA,eACEH,EACAM,EACkE,CAClE,KAAK,QAAQ,iBAAiB,EAE9B,MAAMC,EAAkE,CACtE,aAAc,OACd,GAAID,GAAmB,CAAE,2BAA4BA,CAAgB,CACvE,EAEA,OAAO,KAAK,WACT,IAAI,CACH,KAAM,eACN,MAAOC,EACP,MAAAP,CACF,CAAC,EACA,KAAMG,GAAsEA,CAAQ,CACzF,CAEA,cACEH,EACAK,EACAG,EACAF,EACiE,CACjE,
|
|
6
|
-
"names": ["reportingClient_exports", "__export", "ReportingClient", "reportingClient_default", "__toCommonJS", "import_logger", "import_restClient", "config", "RestClient", "resourceName", "token", "countRequest", "logger", "response", "listRequest", "reportId", "definitionsPath", "queryParams", "variantId", "query", "definitionName", "variantName", "fieldName", "prefix", "executionId", "dataProductDefinitionsPath", "tableId", "summaryId", "id", "filters", "title", "args"]
|
|
4
|
+
"sourcesContent": ["import ReportQuery from '../types/ReportQuery'\nimport logger from '../utils/logger'\nimport RestClient from './restClient'\nimport Dict = NodeJS.Dict\nimport { components, operations } from '../types/api'\nimport { ApiConfig, Count, FieldValuesRequest, ListWithWarnings } from './types'\nimport type { ResultWithHeaders } from './restClient'\n\nclass ReportingClient {\n restClient: RestClient\n\n constructor(config: ApiConfig) {\n this.restClient = new RestClient('Reporting API Client', config)\n }\n\n getCount(resourceName: string, token: string, countRequest: ReportQuery): Promise<number> {\n logger.info(`Reporting client: Get count. { resourceName: ${resourceName} }`)\n\n return this.restClient\n .get({\n path: `/${resourceName}/count`,\n query: countRequest.toRecordWithFilterPrefix(true),\n token,\n })\n .then((response) => (<Count>response).count)\n }\n\n getList(resourceName: string, token: string, listRequest: ReportQuery): Promise<Array<Dict<string>>> {\n return this.getListWithWarnings(resourceName, token, listRequest).then((response) => response.data)\n }\n\n getListWithWarnings(resourceName: string, token: string, listRequest: ReportQuery): Promise<ListWithWarnings> {\n logger.info(`Reporting client: Get list. { resourceName: ${resourceName} }`)\n\n return this.restClient\n .getWithHeaders<Array<Dict<string>>>({\n path: `/${resourceName}`,\n query: listRequest.toRecordWithFilterPrefix(true),\n token,\n })\n .then((response: ResultWithHeaders<Array<Dict<string>>>) => ({\n data: response.data,\n warnings: {\n noDataAvailable: response.headers['x-no-data-warning'],\n },\n }))\n }\n\n getDefinitionSummary(\n token: string,\n reportId: string,\n definitionsPath?: string,\n ): Promise<components['schemas']['ReportDefinitionSummary']> {\n this.logInfo('Get definition summary', { reportId })\n\n const queryParams: operations['definitionSummary']['parameters']['query'] = {\n ...(definitionsPath && { dataProductDefinitionsPath: definitionsPath }),\n }\n\n return this.restClient\n .get({\n path: `/definitions/${reportId}`,\n query: queryParams,\n token,\n })\n .then((response) => <components['schemas']['ReportDefinitionSummary']>response)\n }\n\n getDefinitions(\n token: string,\n definitionsPath?: string,\n ): Promise<Array<components['schemas']['ReportDefinitionSummary']>> {\n this.logInfo('Get definitions')\n\n const queryParams: operations['definitions_1']['parameters']['query'] = {\n renderMethod: 'HTML',\n ...(definitionsPath && { dataProductDefinitionsPath: definitionsPath }),\n }\n\n return this.restClient\n .get({\n path: '/definitions',\n query: queryParams,\n token,\n })\n .then((response) => <Array<components['schemas']['ReportDefinitionSummary']>>response)\n }\n\n getDefinition(\n token: string,\n reportId: string,\n variantId: string,\n definitionsPath?: string,\n queryData?: Dict<string | string[]>,\n ): Promise<components['schemas']['SingleVariantReportDefinition']> {\n const query = {\n ...queryData,\n dataProductDefinitionsPath: definitionsPath,\n }\n\n this.logInfo('Get definition', { reportId, variantId, ...query })\n\n return this.restClient\n .get({\n path: `/definitions/${reportId}/${variantId}`,\n query,\n token,\n })\n .then((response) => <components['schemas']['SingleVariantReportDefinition']>response)\n }\n\n getFieldValues({\n token,\n definitionName,\n variantName,\n fieldName,\n prefix,\n definitionsPath,\n }: FieldValuesRequest): Promise<Array<string>> {\n const query = {\n dataProductDefinitionsPath: definitionsPath,\n prefix,\n }\n this.logInfo('Get field values', { definitionName, variantName, fieldName, prefix })\n\n return this.restClient\n .get({\n path: `/reports/${definitionName}/${variantName}/${fieldName}`,\n token,\n query,\n })\n .then((response) => <Array<string>>response)\n }\n\n requestAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n query: Record<string, string | boolean | number>,\n ): Promise<Dict<string>> {\n this.logInfo('Request report', { reportId, variantId })\n\n return this.restClient\n .get({\n path: `/async/reports/${reportId}/${variantId}`,\n token,\n query,\n })\n .then((response) => <Dict<string>>response)\n }\n\n cancelAsyncRequest(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Dict<string>> {\n this.logInfo('Cancel Request', { reportId, variantId, executionId })\n\n return this.restClient\n .delete({\n path: `/reports/${reportId}/${variantId}/statements/${executionId}`,\n token,\n query: {\n dataProductDefinitionsPath,\n },\n })\n .then((response) => <Dict<string>>response)\n }\n\n getAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n query: Record<string, string | string[]>,\n ): Promise<Array<Dict<string>>> {\n this.logInfo('Get Data', { reportId, variantId, tableId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/tables/${tableId}/result`,\n token,\n query,\n })\n .then((response) => <Array<Dict<string>>>response)\n }\n\n getAsyncSummaryReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n summaryId: string,\n query: Dict<string | number>,\n ): Promise<Array<Dict<string>>> {\n this.logInfo('Get summary data', { reportId, variantId, tableId, summaryId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/tables/${tableId}/result/summary/${summaryId}`,\n token,\n query,\n })\n .then((response) => <Array<Dict<string>>>response)\n }\n\n getAsyncReportStatus(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n tableId?: string,\n ): Promise<components['schemas']['StatementExecutionStatus']> {\n this.logInfo('Get status', { reportId, variantId, tableId, executionId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/statements/${executionId}/status`,\n token,\n query: {\n dataProductDefinitionsPath,\n tableId,\n },\n })\n .then((response) => <components['schemas']['StatementExecutionStatus']>response)\n }\n\n getAsyncCount(token: string, tableId: string, dataProductDefinitionsPath?: string): Promise<number> {\n this.logInfo('Get count', { tableId })\n\n return this.restClient\n .get({\n path: `/report/tables/${tableId}/count`,\n token,\n query: {\n dataProductDefinitionsPath,\n },\n })\n .then((response) => (<Count>response).count)\n }\n\n getAsyncInteractiveCount(\n token: string,\n tableId: string,\n reportId: string,\n id: string,\n filters: ReportQuery,\n ): Promise<number> {\n this.logInfo('Get interactive count', { tableId, reportId, id })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${id}/tables/${tableId}/count`,\n token,\n query: filters.toRecordWithFilterPrefix(true),\n })\n .then((response) => (<Count>response).count)\n }\n\n logInfo(title: string, args?: Dict<string>) {\n logger.info(`Reporting Client: ${title}:`)\n if (args && Object.keys(args).length) logger.info(JSON.stringify(args, null, 2))\n }\n}\n\nexport { ReportingClient }\nexport default ReportingClient\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAmB,8BACnBC,EAAuB,2BAMvB,MAAMJ,CAAgB,CAGpB,YAAYK,EAAmB,CAC7B,KAAK,WAAa,IAAI,EAAAC,QAAW,uBAAwBD,CAAM,CACjE,CAEA,SAASE,EAAsBC,EAAeC,EAA4C,CACxF,SAAAC,QAAO,KAAK,gDAAgDH,CAAY,IAAI,EAErE,KAAK,WACT,IAAI,CACH,KAAM,IAAIA,CAAY,SACtB,MAAOE,EAAa,yBAAyB,EAAI,EACjD,MAAAD,CACF,CAAC,EACA,KAAMG,GAAqBA,EAAU,KAAK,CAC/C,CAEA,QAAQJ,EAAsBC,EAAeI,EAAwD,CACnG,OAAO,KAAK,oBAAoBL,EAAcC,EAAOI,CAAW,EAAE,KAA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AAM,CAAC,CAAC,CACjF,CACF,CAGA,IAAO7B,EAAQD",
|
|
6
|
+
"names": ["reportingClient_exports", "__export", "ReportingClient", "reportingClient_default", "__toCommonJS", "import_logger", "import_restClient", "config", "RestClient", "resourceName", "token", "countRequest", "logger", "response", "listRequest", "reportId", "definitionsPath", "queryParams", "variantId", "queryData", "query", "definitionName", "variantName", "fieldName", "prefix", "executionId", "dataProductDefinitionsPath", "tableId", "summaryId", "id", "filters", "title", "args"]
|
|
7
7
|
}
|
|
@@ -91,11 +91,14 @@ class ReportingClient {
|
|
|
91
91
|
reportId: string,
|
|
92
92
|
variantId: string,
|
|
93
93
|
definitionsPath?: string,
|
|
94
|
+
queryData?: Dict<string | string[]>,
|
|
94
95
|
): Promise<components['schemas']['SingleVariantReportDefinition']> {
|
|
95
96
|
const query = {
|
|
97
|
+
...queryData,
|
|
96
98
|
dataProductDefinitionsPath: definitionsPath,
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
|
|
101
|
+
this.logInfo('Get definition', { reportId, variantId, ...query })
|
|
99
102
|
|
|
100
103
|
return this.restClient
|
|
101
104
|
.get({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/product-collection/selected/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { ProductCollectionStoreService } from '
|
|
4
|
+
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { ProductCollectionStoreService } from '../../../../services/productCollection/productCollectionStoreService'\nimport LocalsHelper from '../../../../utils/localsHelper'\nimport { Services } from '../../../../types/Services'\n\nexport class SelectedProductCollectionController {\n layoutPath: string\n\n productCollectionStoreService: ProductCollectionStoreService\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.productCollectionStoreService = services.productCollectionStoreService\n }\n\n POST: RequestHandler = async (req, res, _next) => {\n const { productCollection } = req.body\n const { dprUser, nestedBaseUrl } = LocalsHelper.getValues(res)\n\n await this.productCollectionStoreService\n .setSelectedProductCollectionId(dprUser.id, productCollection === 'RESET' ? undefined : productCollection)\n .then(() => {\n res.redirect(`${nestedBaseUrl}/`)\n })\n .catch(() => {\n res.redirect(`${nestedBaseUrl}/`)\n })\n }\n}\n"],
|
|
5
5
|
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yCAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAyB,6CAGlB,MAAMF,CAAoC,CAK/C,YAAYG,EAAoBC,EAAoB,CAKpD,UAAuB,MAAOC,EAAKC,EAAKC,IAAU,CAChD,KAAM,CAAE,kBAAAC,CAAkB,EAAIH,EAAI,KAC5B,CAAE,QAAAI,EAAS,cAAAC,CAAc,EAAI,EAAAC,QAAa,UAAUL,CAAG,EAE7D,MAAM,KAAK,8BACR,+BAA+BG,EAAQ,GAAID,IAAsB,QAAU,OAAYA,CAAiB,EACxG,KAAK,IAAM,CACVF,EAAI,SAAS,GAAGI,CAAa,GAAG,CAClC,CAAC,EACA,MAAM,IAAM,CACXJ,EAAI,SAAS,GAAGI,CAAa,GAAG,CAClC,CAAC,CACL,EAhBE,KAAK,WAAaP,EAClB,KAAK,8BAAgCC,EAAS,6BAChD,CAeF",
|
|
6
6
|
"names": ["controller_exports", "__export", "SelectedProductCollectionController", "__toCommonJS", "import_localsHelper", "layoutPath", "services", "req", "res", "_next", "productCollection", "dprUser", "nestedBaseUrl", "LocalsHelper"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler } from 'express'
|
|
2
|
-
import { ProductCollectionStoreService } from '
|
|
2
|
+
import { ProductCollectionStoreService } from '../../../../services/productCollection/productCollectionStoreService'
|
|
3
3
|
import LocalsHelper from '../../../../utils/localsHelper'
|
|
4
4
|
import { Services } from '../../../../types/Services'
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var M=Object.create;var y=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var Q=(e,t)=>{for(var r in t)y(e,r,{get:t[r],enumerable:!0})},E=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _(t))!H.call(e,o)&&o!==r&&y(e,o,{get:()=>t[o],enumerable:!(a=O(t,o))||a.enumerable});return e};var d=(e,t,r)=>(r=e!=null?M(v(e)):{},E(t||!e||!e.__esModule?y(r,"default",{value:e,enumerable:!0}):r,e)),G=e=>E(y({},"__esModule",{value:!0}),e);var K={};Q(K,{default:()=>z,renderAsyncDashboard:()=>N});module.exports=G(K);var m=require("../../../../../components/_dashboards/dashboard-visualisation/types"),S=require("../../../../../types/UserReports"),b=d(require("../../../../../components/_charts/utils")),w=d(require("../../../../../utils/definitionUtils")),V=d(require("../../../../../components/user-reports/utils")),P=d(require("../../../../../components/_dashboards/dashboard-list/utils")),g=d(require("../../../../../components/_filters/utils")),F=d(require("../../../../../components/_dashboards/scorecard/utils")),I=d(require("../../../../../components/_dashboards/scorecard/Scorecard")),C=d(require("../../../../../components/_reports/report-actions/utils")),B=d(require("../../../../../types/ReportQuery")),A=d(require("../../../../../utils/localsHelper")),L=require("../../../../../components/_filters/filtersTypeEnum");const J=(e,t,r)=>{const a=t.name,{name:o}=e,i=r?.url?.request?.fullUrl,c=r?.executionId;let s={};return i&&(s={share:{reportName:a,name:o,url:i},copy:{url:i}},c&&(s={...s,refresh:{url:i,executionId:c}})),C.default.getActions(s)},W=async({req:e,res:t,services:r,queryData:a})=>{const{token:o}=A.default.getValues(t),{reportId:i,id:c}=e.params,s=e.query.dataProductDefinitionsPath,p=await r.dashboardService.getDefinition(o,i,c,s,a),n=await w.default.getReportSummary(i,r.reportingService,o,s),u=await g.default.getFilters({fields:p.filterFields||[],req:e,filtersType:L.FiltersType.INTERACTIVE}),f=g.default.setRequestQueryFromFilterValues(u.filters);return{query:new B.default({fields:p.filterFields||[],queryParams:f,definitionsPath:s,reportType:S.ReportType.DASHBOARD}).toRecordWithFilterPrefix(!0),filters:u,dashboardDefinition:p,reportDefinition:n}},X=(e,t,r)=>e.sections.map(a=>{const{id:o,display:i,description:c}=a;let s=!1;const p=a.visualisations.map(n=>{const{type:u,display:f,description:R,id:D}=n;let l;switch(u){case m.DashboardVisualisationType.LIST:l=P.default.createList(n,t);break;case m.DashboardVisualisationType.SCORECARD:s=!0,l=new I.default(t,n).build();break;case m.DashboardVisualisationType.SCORECARD_GROUP:l=new I.default(t,n,!0).build();break;case m.DashboardVisualisationType.BAR:case m.DashboardVisualisationType.LINE:case m.DashboardVisualisationType.DONUT:{l=b.default.createChart(n,t);break}case m.DashboardVisualisationType.MATRIX_TIMESERIES:{l=b.default.createMatrixChart(n,t,r);break}case m.DashboardVisualisationType.BAR_TIMESERIES:case m.DashboardVisualisationType.LINE_TIMESERIES:{l=b.default.createTimeseriesCharts(n,t);break}default:break}return{id:D,title:f||"",description:R||"",type:u,data:l}});return s&&F.default.mergeScorecardsIntoGroup(p),{id:o,title:i||"",description:c||"",visualisations:p}}),j=async(e,t,r,a,o,i)=>{const{requestedReportService:c}=e,s=await c.getReportByTableId(t,r);return a&&a.length&&s&&V.default.updateLastViewed({services:e,reportStateData:s,userId:r,req:o,filters:i}),s},N=async({req:e,res:t,services:r})=>{const{token:a,csrfToken:o,dprUser:i,nestedBaseUrl:c}=A.default.getValues(t),{reportId:s,id:p,tableId:n}=e.params,{bookmarkService:u,requestedReportService:f}=r,{id:R}=i;let D=await f.getReportByTableId(n,R);const l=D?.query?.data,{query:U,filters:q,reportDefinition:T,dashboardDefinition:h}=await W({req:e,res:t,services:r,queryData:l}),x=(await r.dashboardService.getAsyncDashboard(a,p,s,n,U)).flat(),k=X(h,x,U);return f&&(D=await j(r,n,i.id,k,e,q.filters)),{dashboardData:{token:a,id:p,reportId:s,name:h.name,description:h.description,reportName:T.name,bookmarked:u?await u.isBookmarked(p,s,i.id):!1,nestedBaseUrl:c,csrfToken:o,sections:k,filters:q,type:S.ReportType.DASHBOARD,actions:J(h,T,D)}}};var z={renderAsyncDashboard:N};0&&(module.exports={renderAsyncDashboard});
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/dpr/routes/journeys/view-report/async/dashboard/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { Request } from 'express'\nimport { Services } from '../../../../../types/Services'\nimport {\n DashboardSection,\n DashboardVisualisation,\n DashboardVisualisationType,\n} from '../../../../../components/_dashboards/dashboard-visualisation/types'\nimport type { AsyncReportUtilsParams } from '../../../../../types/AsyncReportUtils'\n\nimport type { DashboardDataResponse } from '../../../../../types/Metrics'\nimport type { RequestedReport } from '../../../../../types/UserReports'\nimport { ReportType } from '../../../../../types/UserReports'\nimport type { components } from '../../../../../types/api'\n\nimport ChartUtils from '../../../../../components/_charts/utils'\nimport DefinitionUtils from '../../../../../utils/definitionUtils'\nimport UserReportsUtils from '../../../../../components/user-reports/utils'\nimport DashboardListUtils from '../../../../../components/_dashboards/dashboard-list/utils'\nimport FilterUtils from '../../../../../components/_filters/utils'\nimport ScorecardsUtils from '../../../../../components/_dashboards/scorecard/utils'\nimport ScorecardVisualisation from '../../../../../components/_dashboards/scorecard/Scorecard'\nimport ReportActionsUtils from '../../../../../components/_reports/report-actions/utils'\nimport ReportQuery from '../../../../../types/ReportQuery'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport { FilterValue } from '../../../../../components/_filters/types'\nimport { FiltersType } from '../../../../../components/_filters/filtersTypeEnum'\n\nconst setDashboardActions = (\n dashboardDefinition: components['schemas']['DashboardDefinition'],\n reportDefinition: components['schemas']['ReportDefinitionSummary'],\n requestData?: RequestedReport,\n) => {\n const reportName = reportDefinition.name\n const { name } = dashboardDefinition\n const actionsUrl = requestData?.url?.request?.fullUrl\n const executionId = requestData?.executionId\n\n let actions = {}\n if (actionsUrl) {\n actions = {\n share: {\n reportName,\n name,\n url: actionsUrl,\n },\n copy: {\n url: actionsUrl,\n },\n }\n if (executionId) {\n actions = {\n ...actions,\n refresh: {\n url: actionsUrl,\n executionId,\n },\n }\n }\n }\n\n return ReportActionsUtils.getActions(actions)\n}\n\nconst getDefinitionData = async ({ req
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,
|
|
6
|
-
"names": ["utils_exports", "__export", "utils_default", "renderAsyncDashboard", "__toCommonJS", "import_types", "import_UserReports", "import_utils", "import_definitionUtils", "import_Scorecard", "import_ReportQuery", "import_localsHelper", "import_filtersTypeEnum", "setDashboardActions", "dashboardDefinition", "reportDefinition", "requestData", "reportName", "name", "actionsUrl", "executionId", "actions", "ReportActionsUtils", "getDefinitionData", "req", "res", "services", "token", "LocalsHelper", "reportId", "id", "dataProductDefinitionsPath", "DefinitionUtils", "filtersData", "FilterUtils", "filtersQuery", "ReportQuery", "getSections", "dashboardData", "query", "section", "title", "description", "hasScorecard", "visualisations", "visDefinition", "type", "display", "visDescription", "visId", "data", "DashboardListUtils", "ScorecardVisualisation", "ChartUtils", "ScorecardsUtils", "updateStore", "tableId", "userId", "sections", "filters", "requestedReportService", "dashboardRequestData", "UserReportsUtils", "csrfToken", "dprUser", "nestedBaseUrl", "bookmarkService", "flattenedData"]
|
|
4
|
+
"sourcesContent": ["import { Request, Response } from 'express'\nimport { Services } from '../../../../../types/Services'\nimport Dict = NodeJS.Dict\nimport {\n DashboardSection,\n DashboardVisualisation,\n DashboardVisualisationType,\n} from '../../../../../components/_dashboards/dashboard-visualisation/types'\nimport type { AsyncReportUtilsParams } from '../../../../../types/AsyncReportUtils'\n\nimport type { DashboardDataResponse } from '../../../../../types/Metrics'\nimport type { RequestedReport } from '../../../../../types/UserReports'\nimport { ReportType } from '../../../../../types/UserReports'\nimport type { components } from '../../../../../types/api'\n\nimport ChartUtils from '../../../../../components/_charts/utils'\nimport DefinitionUtils from '../../../../../utils/definitionUtils'\nimport UserReportsUtils from '../../../../../components/user-reports/utils'\nimport DashboardListUtils from '../../../../../components/_dashboards/dashboard-list/utils'\nimport FilterUtils from '../../../../../components/_filters/utils'\nimport ScorecardsUtils from '../../../../../components/_dashboards/scorecard/utils'\nimport ScorecardVisualisation from '../../../../../components/_dashboards/scorecard/Scorecard'\nimport ReportActionsUtils from '../../../../../components/_reports/report-actions/utils'\nimport ReportQuery from '../../../../../types/ReportQuery'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport { FilterValue } from '../../../../../components/_filters/types'\nimport { FiltersType } from '../../../../../components/_filters/filtersTypeEnum'\n\nconst setDashboardActions = (\n dashboardDefinition: components['schemas']['DashboardDefinition'],\n reportDefinition: components['schemas']['ReportDefinitionSummary'],\n requestData?: RequestedReport,\n) => {\n const reportName = reportDefinition.name\n const { name } = dashboardDefinition\n const actionsUrl = requestData?.url?.request?.fullUrl\n const executionId = requestData?.executionId\n\n let actions = {}\n if (actionsUrl) {\n actions = {\n share: {\n reportName,\n name,\n url: actionsUrl,\n },\n copy: {\n url: actionsUrl,\n },\n }\n if (executionId) {\n actions = {\n ...actions,\n refresh: {\n url: actionsUrl,\n executionId,\n },\n }\n }\n }\n\n return ReportActionsUtils.getActions(actions)\n}\n\nconst getDefinitionData = async ({\n req,\n res,\n services,\n queryData,\n}: {\n req: Request\n res: Response\n services: Services\n queryData: Dict<string | string[]> | undefined\n}) => {\n const { token } = LocalsHelper.getValues(res)\n const { reportId, id } = req.params\n const dataProductDefinitionsPath = <string>req.query['dataProductDefinitionsPath']\n\n // Dashboard Definition,\n const dashboardDefinition: components['schemas']['DashboardDefinition'] =\n await services.dashboardService.getDefinition(token, reportId, id, dataProductDefinitionsPath, queryData)\n\n // Report summary data\n const reportDefinition = await DefinitionUtils.getReportSummary(\n reportId,\n services.reportingService,\n token,\n <string>dataProductDefinitionsPath,\n )\n\n // Get the filters\n const filtersData = await FilterUtils.getFilters({\n fields: dashboardDefinition.filterFields || [],\n req,\n filtersType: FiltersType.INTERACTIVE,\n })\n\n const filtersQuery = FilterUtils.setRequestQueryFromFilterValues(filtersData.filters)\n\n // Create the query\n const query = new ReportQuery({\n fields: dashboardDefinition.filterFields || [],\n queryParams: filtersQuery,\n definitionsPath: <string>dataProductDefinitionsPath,\n reportType: ReportType.DASHBOARD,\n }).toRecordWithFilterPrefix(true)\n\n return {\n query,\n filters: filtersData,\n dashboardDefinition,\n reportDefinition,\n }\n}\n\nconst getSections = (\n dashboardDefinition: components['schemas']['DashboardDefinition'],\n dashboardData: DashboardDataResponse[],\n query: Record<string, string | string[]>,\n): DashboardSection[] => {\n return dashboardDefinition.sections.map((section: components['schemas']['DashboardSectionDefinition']) => {\n const { id, display: title, description } = section\n\n let hasScorecard = false\n const visualisations: DashboardVisualisation[] = section.visualisations.map(\n (visDefinition: components['schemas']['DashboardVisualisationDefinition']) => {\n const { type, display, description: visDescription, id: visId } = visDefinition\n\n let data: DashboardVisualisation['data'] | undefined\n\n switch (type) {\n case DashboardVisualisationType.LIST:\n data = DashboardListUtils.createList(visDefinition, dashboardData)\n break\n\n case DashboardVisualisationType.SCORECARD:\n hasScorecard = true\n data = new ScorecardVisualisation(dashboardData, visDefinition).build()\n break\n\n case DashboardVisualisationType.SCORECARD_GROUP:\n data = new ScorecardVisualisation(dashboardData, visDefinition, true).build()\n break\n\n case DashboardVisualisationType.BAR:\n case DashboardVisualisationType.LINE:\n case DashboardVisualisationType.DONUT: {\n data = ChartUtils.createChart(visDefinition, dashboardData)\n break\n }\n case DashboardVisualisationType.MATRIX_TIMESERIES: {\n data = ChartUtils.createMatrixChart(visDefinition, dashboardData, query)\n break\n }\n case DashboardVisualisationType.BAR_TIMESERIES:\n case DashboardVisualisationType.LINE_TIMESERIES: {\n data = ChartUtils.createTimeseriesCharts(visDefinition, dashboardData)\n break\n }\n default:\n break\n }\n\n return {\n id: visId,\n title: display || '',\n description: visDescription || '',\n type,\n data,\n }\n },\n )\n\n if (hasScorecard) ScorecardsUtils.mergeScorecardsIntoGroup(visualisations)\n\n return { id, title: title || '', description: description || '', visualisations }\n })\n}\n\nconst updateStore = async (\n services: Services,\n tableId: string,\n userId: string,\n sections: DashboardSection[],\n req: Request,\n filters: FilterValue[],\n): Promise<RequestedReport | undefined> => {\n const { requestedReportService } = services\n const dashboardRequestData = await requestedReportService.getReportByTableId(tableId, userId)\n\n // Add to recently viewed\n if (sections && sections.length && dashboardRequestData) {\n UserReportsUtils.updateLastViewed({\n services,\n reportStateData: dashboardRequestData,\n userId,\n req,\n filters,\n })\n }\n\n return dashboardRequestData\n}\n\nexport const renderAsyncDashboard = async ({ req, res, services }: AsyncReportUtilsParams) => {\n const { token, csrfToken, dprUser, nestedBaseUrl } = LocalsHelper.getValues(res)\n const { reportId, id, tableId } = req.params\n const { bookmarkService, requestedReportService } = services\n const { id: userId } = dprUser\n\n let requestData: RequestedReport | undefined = await requestedReportService.getReportByTableId(tableId, userId)\n const queryData = requestData?.query?.data\n\n // Get the definition Data\n const { query, filters, reportDefinition, dashboardDefinition } = await getDefinitionData({\n req,\n res,\n services,\n queryData,\n })\n\n // Get the results data\n const dashboardData: DashboardDataResponse[][] = await services.dashboardService.getAsyncDashboard(\n token,\n id,\n reportId,\n tableId,\n query,\n )\n\n const flattenedData: DashboardDataResponse[] = dashboardData.flat()\n\n // Get the dashboard parts\n const sections: DashboardSection[] = getSections(dashboardDefinition, flattenedData, query)\n\n // Update the store\n if (requestedReportService) {\n requestData = await updateStore(services, tableId, dprUser.id, sections, req, filters.filters)\n }\n\n return {\n dashboardData: {\n token,\n id,\n reportId,\n name: dashboardDefinition.name,\n description: dashboardDefinition.description,\n reportName: reportDefinition.name,\n bookmarked: bookmarkService ? await bookmarkService.isBookmarked(id, reportId, dprUser.id) : false,\n nestedBaseUrl,\n csrfToken,\n sections,\n filters,\n type: ReportType.DASHBOARD,\n actions: setDashboardActions(dashboardDefinition, reportDefinition, requestData),\n },\n }\n}\n\nexport default {\n renderAsyncDashboard,\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GAGA,IAAAK,EAIO,+EAKPC,EAA2B,4CAG3BC,EAAuB,sDACvBC,EAA4B,mDAC5BD,EAA6B,2DAC7BA,EAA+B,yEAC/BA,EAAwB,uDACxBA,EAA4B,oEAC5BE,EAAmC,wEACnCF,EAA+B,sEAC/BG,EAAwB,+CACxBC,EAAyB,gDAEzBC,EAA4B,8DAE5B,MAAMC,EAAsB,CAC1BC,EACAC,EACAC,IACG,CACH,MAAMC,EAAaF,EAAiB,KAC9B,CAAE,KAAAG,CAAK,EAAIJ,EACXK,EAAaH,GAAa,KAAK,SAAS,QACxCI,EAAcJ,GAAa,YAEjC,IAAIK,EAAU,CAAC,EACf,OAAIF,IACFE,EAAU,CACR,MAAO,CACL,WAAAJ,EACA,KAAAC,EACA,IAAKC,CACP,EACA,KAAM,CACJ,IAAKA,CACP,CACF,EACIC,IACFC,EAAU,CACR,GAAGA,EACH,QAAS,CACP,IAAKF,EACL,YAAAC,CACF,CACF,IAIG,EAAAE,QAAmB,WAAWD,CAAO,CAC9C,EAEME,EAAoB,MAAO,CAC/B,IAAAC,EACA,IAAAC,EACA,SAAAC,EACA,UAAAC,CACF,IAKM,CACJ,KAAM,CAAE,MAAAC,CAAM,EAAI,EAAAC,QAAa,UAAUJ,CAAG,EACtC,CAAE,SAAAK,EAAU,GAAAC,CAAG,EAAIP,EAAI,OACvBQ,EAAqCR,EAAI,MAAM,2BAG/CV,EACJ,MAAMY,EAAS,iBAAiB,cAAcE,EAAOE,EAAUC,EAAIC,EAA4BL,CAAS,EAGpGZ,EAAmB,MAAM,EAAAkB,QAAgB,iBAC7CH,EACAJ,EAAS,iBACTE,EACQI,CACV,EAGME,EAAc,MAAM,EAAAC,QAAY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BAAiB,kBAC/EE,EACAG,EACAD,EACA2B,EACAjB,CACF,GAE6D,KAAK,EAG5DmB,EAA+BrB,EAAYxB,EAAqBsD,EAAe5B,CAAK,EAG1F,OAAIqB,IACF7C,EAAc,MAAMwC,EAAY9B,EAAU+B,EAASQ,EAAQ,GAAIN,EAAUnC,EAAKoC,EAAQ,OAAO,GAGxF,CACL,cAAe,CACb,MAAAhC,EACA,GAAAG,EACA,SAAAD,EACA,KAAMhB,EAAoB,KAC1B,YAAaA,EAAoB,YACjC,WAAYC,EAAiB,KAC7B,WAAYoD,EAAkB,MAAMA,EAAgB,aAAapC,EAAID,EAAUmC,EAAQ,EAAE,EAAI,GAC7F,cAAAC,EACA,UAAAF,EACA,SAAAL,EACA,QAAAC,EACA,KAAM,aAAW,UACjB,QAAS/C,EAAoBC,EAAqBC,EAAkBC,CAAW,CACjF,CACF,CACF,EAEA,IAAOd,EAAQ,CACb,qBAAAC,CACF",
|
|
6
|
+
"names": ["utils_exports", "__export", "utils_default", "renderAsyncDashboard", "__toCommonJS", "import_types", "import_UserReports", "import_utils", "import_definitionUtils", "import_Scorecard", "import_ReportQuery", "import_localsHelper", "import_filtersTypeEnum", "setDashboardActions", "dashboardDefinition", "reportDefinition", "requestData", "reportName", "name", "actionsUrl", "executionId", "actions", "ReportActionsUtils", "getDefinitionData", "req", "res", "services", "queryData", "token", "LocalsHelper", "reportId", "id", "dataProductDefinitionsPath", "DefinitionUtils", "filtersData", "FilterUtils", "filtersQuery", "ReportQuery", "getSections", "dashboardData", "query", "section", "title", "description", "hasScorecard", "visualisations", "visDefinition", "type", "display", "visDescription", "visId", "data", "DashboardListUtils", "ScorecardVisualisation", "ChartUtils", "ScorecardsUtils", "updateStore", "tableId", "userId", "sections", "filters", "requestedReportService", "dashboardRequestData", "UserReportsUtils", "csrfToken", "dprUser", "nestedBaseUrl", "bookmarkService", "flattenedData"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Request } from 'express'
|
|
1
|
+
import { Request, Response } from 'express'
|
|
2
2
|
import { Services } from '../../../../../types/Services'
|
|
3
|
+
import Dict = NodeJS.Dict
|
|
3
4
|
import {
|
|
4
5
|
DashboardSection,
|
|
5
6
|
DashboardVisualisation,
|
|
@@ -61,14 +62,24 @@ const setDashboardActions = (
|
|
|
61
62
|
return ReportActionsUtils.getActions(actions)
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
const getDefinitionData = async ({
|
|
65
|
+
const getDefinitionData = async ({
|
|
66
|
+
req,
|
|
67
|
+
res,
|
|
68
|
+
services,
|
|
69
|
+
queryData,
|
|
70
|
+
}: {
|
|
71
|
+
req: Request
|
|
72
|
+
res: Response
|
|
73
|
+
services: Services
|
|
74
|
+
queryData: Dict<string | string[]> | undefined
|
|
75
|
+
}) => {
|
|
65
76
|
const { token } = LocalsHelper.getValues(res)
|
|
66
77
|
const { reportId, id } = req.params
|
|
67
78
|
const dataProductDefinitionsPath = <string>req.query['dataProductDefinitionsPath']
|
|
68
79
|
|
|
69
80
|
// Dashboard Definition,
|
|
70
81
|
const dashboardDefinition: components['schemas']['DashboardDefinition'] =
|
|
71
|
-
await services.dashboardService.getDefinition(token, reportId, id, dataProductDefinitionsPath)
|
|
82
|
+
await services.dashboardService.getDefinition(token, reportId, id, dataProductDefinitionsPath, queryData)
|
|
72
83
|
|
|
73
84
|
// Report summary data
|
|
74
85
|
const reportDefinition = await DefinitionUtils.getReportSummary(
|
|
@@ -176,9 +187,7 @@ const updateStore = async (
|
|
|
176
187
|
filters: FilterValue[],
|
|
177
188
|
): Promise<RequestedReport | undefined> => {
|
|
178
189
|
const { requestedReportService } = services
|
|
179
|
-
const dashboardRequestData = requestedReportService
|
|
180
|
-
? await requestedReportService.getReportByTableId(tableId, userId)
|
|
181
|
-
: undefined
|
|
190
|
+
const dashboardRequestData = await requestedReportService.getReportByTableId(tableId, userId)
|
|
182
191
|
|
|
183
192
|
// Add to recently viewed
|
|
184
193
|
if (sections && sections.length && dashboardRequestData) {
|
|
@@ -198,12 +207,17 @@ export const renderAsyncDashboard = async ({ req, res, services }: AsyncReportUt
|
|
|
198
207
|
const { token, csrfToken, dprUser, nestedBaseUrl } = LocalsHelper.getValues(res)
|
|
199
208
|
const { reportId, id, tableId } = req.params
|
|
200
209
|
const { bookmarkService, requestedReportService } = services
|
|
210
|
+
const { id: userId } = dprUser
|
|
211
|
+
|
|
212
|
+
let requestData: RequestedReport | undefined = await requestedReportService.getReportByTableId(tableId, userId)
|
|
213
|
+
const queryData = requestData?.query?.data
|
|
201
214
|
|
|
202
215
|
// Get the definition Data
|
|
203
216
|
const { query, filters, reportDefinition, dashboardDefinition } = await getDefinitionData({
|
|
204
217
|
req,
|
|
205
218
|
res,
|
|
206
219
|
services,
|
|
220
|
+
queryData,
|
|
207
221
|
})
|
|
208
222
|
|
|
209
223
|
// Get the results data
|
|
@@ -221,9 +235,8 @@ export const renderAsyncDashboard = async ({ req, res, services }: AsyncReportUt
|
|
|
221
235
|
const sections: DashboardSection[] = getSections(dashboardDefinition, flattenedData, query)
|
|
222
236
|
|
|
223
237
|
// Update the store
|
|
224
|
-
let dashboardRequestData
|
|
225
238
|
if (requestedReportService) {
|
|
226
|
-
|
|
239
|
+
requestData = await updateStore(services, tableId, dprUser.id, sections, req, filters.filters)
|
|
227
240
|
}
|
|
228
241
|
|
|
229
242
|
return {
|
|
@@ -240,7 +253,7 @@ export const renderAsyncDashboard = async ({ req, res, services }: AsyncReportUt
|
|
|
240
253
|
sections,
|
|
241
254
|
filters,
|
|
242
255
|
type: ReportType.DASHBOARD,
|
|
243
|
-
actions: setDashboardActions(dashboardDefinition, reportDefinition,
|
|
256
|
+
actions: setDashboardActions(dashboardDefinition, reportDefinition, requestData),
|
|
244
257
|
},
|
|
245
258
|
}
|
|
246
259
|
}
|