@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.1.21 → 4.1.23
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/_charts/utils.js +2 -2
- package/dpr/components/_charts/utils.ts +3 -2
- package/dpr/components/_dashboards/dashboard/types.js +2 -1
- package/dpr/components/_dashboards/dashboard/types.ts +2 -1
- package/dpr/components/_dashboards/dashboard/utils.js +1 -0
- package/dpr/components/_dashboards/dashboard/utils.ts +1 -0
- package/dpr/components/_dashboards/dashboard-visualisation/view.njk +5 -5
- package/dpr/components/_sync/sync-report/utils.js +2 -0
- package/dpr/components/_sync/sync-report/utils.ts +2 -0
- package/dpr/components/report-list/utils.js +2 -2
- package/dpr/components/report-list/utils.ts +2 -2
- package/package.json +2 -2
- package/package.zip +0 -0
|
@@ -7,7 +7,7 @@ const types_1 = require("../_dashboards/dashboard/types");
|
|
|
7
7
|
const datasetHelper_1 = __importDefault(require("../../utils/datasetHelper"));
|
|
8
8
|
const utils_1 = __importDefault(require("../_dashboards/dashboard-list/utils"));
|
|
9
9
|
const createChart = (chartDefinition, rawData) => {
|
|
10
|
-
const timeseriesChartTypes = [types_1.DashboardVisualisationType.BAR_TIMESERIES, types_1.DashboardVisualisationType.
|
|
10
|
+
const timeseriesChartTypes = [types_1.DashboardVisualisationType.BAR_TIMESERIES, types_1.DashboardVisualisationType.LINE_TIMESERIES];
|
|
11
11
|
const { type } = chartDefinition;
|
|
12
12
|
let table;
|
|
13
13
|
let chart;
|
|
@@ -195,7 +195,7 @@ const createTimeseriesChart = (chartDefinition, timeseriesData) => {
|
|
|
195
195
|
const { columns } = chartDefinition;
|
|
196
196
|
const { keys, measures } = columns;
|
|
197
197
|
const unit = measures[0].unit ? measures[0].unit : undefined;
|
|
198
|
-
const type = chartDefinition.type === types_1.DashboardVisualisationType.BAR_TIMESERIES ? 'bar' :
|
|
198
|
+
const type = chartDefinition.type === types_1.DashboardVisualisationType.BAR_TIMESERIES ? 'bar' : 'line';
|
|
199
199
|
const groupKey = datasetHelper_1.default.getGroupKey(keys, timeseriesData);
|
|
200
200
|
const labelId = groupKey.id;
|
|
201
201
|
const timeBlockData = datasetHelper_1.default.groupRowsByTimestamp(timeseriesData);
|
|
@@ -18,7 +18,7 @@ import DatasetHelper from '../../utils/datasetHelper'
|
|
|
18
18
|
import DashboardListUtils from '../_dashboards/dashboard-list/utils'
|
|
19
19
|
|
|
20
20
|
const createChart = (chartDefinition: DashboardVisualisation, rawData: DashboardDataResponse[]): ChartCardData => {
|
|
21
|
-
const timeseriesChartTypes = [DashboardVisualisationType.BAR_TIMESERIES, DashboardVisualisationType.
|
|
21
|
+
const timeseriesChartTypes = [DashboardVisualisationType.BAR_TIMESERIES, DashboardVisualisationType.LINE_TIMESERIES]
|
|
22
22
|
const { type } = chartDefinition
|
|
23
23
|
|
|
24
24
|
let table: MoJTable
|
|
@@ -250,7 +250,8 @@ const createTimeseriesChart = (
|
|
|
250
250
|
const { keys, measures } = columns
|
|
251
251
|
|
|
252
252
|
const unit = measures[0].unit ? measures[0].unit : undefined
|
|
253
|
-
|
|
253
|
+
|
|
254
|
+
const type = chartDefinition.type === DashboardVisualisationType.BAR_TIMESERIES ? 'bar' : 'line'
|
|
254
255
|
|
|
255
256
|
const groupKey = DatasetHelper.getGroupKey(keys, timeseriesData)
|
|
256
257
|
const labelId = groupKey.id as keyof DashboardDataResponse
|
|
@@ -6,8 +6,9 @@ var DashboardVisualisationType;
|
|
|
6
6
|
DashboardVisualisationType["LIST"] = "list";
|
|
7
7
|
DashboardVisualisationType["DONUT"] = "doughnut";
|
|
8
8
|
DashboardVisualisationType["BAR"] = "bar";
|
|
9
|
-
DashboardVisualisationType["BAR_TIMESERIES"] = "bar-timeseries";
|
|
10
9
|
DashboardVisualisationType["LINE"] = "line";
|
|
10
|
+
DashboardVisualisationType["BAR_TIMESERIES"] = "bar-timeseries";
|
|
11
|
+
DashboardVisualisationType["LINE_TIMESERIES"] = "line-timeseries";
|
|
11
12
|
DashboardVisualisationType["SCORECARD"] = "scorecard";
|
|
12
13
|
DashboardVisualisationType["SCORECARD_GROUP"] = "scorecard-group";
|
|
13
14
|
})(DashboardVisualisationType || (exports.DashboardVisualisationType = DashboardVisualisationType = {}));
|
|
@@ -50,8 +50,9 @@ export enum DashboardVisualisationType {
|
|
|
50
50
|
LIST = 'list',
|
|
51
51
|
DONUT = 'doughnut',
|
|
52
52
|
BAR = 'bar',
|
|
53
|
-
BAR_TIMESERIES = 'bar-timeseries',
|
|
54
53
|
LINE = 'line',
|
|
54
|
+
BAR_TIMESERIES = 'bar-timeseries',
|
|
55
|
+
LINE_TIMESERIES = 'line-timeseries',
|
|
55
56
|
SCORECARD = 'scorecard',
|
|
56
57
|
SCORECARD_GROUP = 'scorecard-group',
|
|
57
58
|
}
|
|
@@ -83,6 +83,7 @@ const getSections = (dashboardDefinition, dashboardData) => {
|
|
|
83
83
|
case types_1.DashboardVisualisationType.BAR:
|
|
84
84
|
case types_1.DashboardVisualisationType.LINE:
|
|
85
85
|
case types_1.DashboardVisualisationType.BAR_TIMESERIES:
|
|
86
|
+
case types_1.DashboardVisualisationType.LINE_TIMESERIES:
|
|
86
87
|
case types_1.DashboardVisualisationType.DONUT: {
|
|
87
88
|
data = utils_1.default.createChart(visDefinition, dashboardData);
|
|
88
89
|
break;
|
|
@@ -126,6 +126,7 @@ const getSections = (
|
|
|
126
126
|
case DashboardVisualisationType.BAR:
|
|
127
127
|
case DashboardVisualisationType.LINE:
|
|
128
128
|
case DashboardVisualisationType.BAR_TIMESERIES:
|
|
129
|
+
case DashboardVisualisationType.LINE_TIMESERIES:
|
|
129
130
|
case DashboardVisualisationType.DONUT: {
|
|
130
131
|
data = ChartUtils.createChart(visDefinition, dashboardData)
|
|
131
132
|
break
|
|
@@ -18,11 +18,7 @@
|
|
|
18
18
|
<p class="govuk-body">{{ description }}</p>
|
|
19
19
|
{% endif %}
|
|
20
20
|
|
|
21
|
-
{% if type === '
|
|
22
|
-
|
|
23
|
-
{{ dprChartCard(id, data) }}
|
|
24
|
-
|
|
25
|
-
{% elif type === 'scorecard-group' %}
|
|
21
|
+
{% if type === 'scorecard-group' %}
|
|
26
22
|
|
|
27
23
|
{{ dprScoreCardGroup(id, data) }}
|
|
28
24
|
|
|
@@ -30,6 +26,10 @@
|
|
|
30
26
|
|
|
31
27
|
{{ dprDashboardList(id, data) }}
|
|
32
28
|
|
|
29
|
+
{% else %}
|
|
30
|
+
|
|
31
|
+
{{ dprChartCard(id, data) }}
|
|
32
|
+
|
|
33
33
|
{% endif %}
|
|
34
34
|
|
|
35
35
|
</div>
|
|
@@ -114,6 +114,7 @@ const getReport = async ({ req, res, services }) => {
|
|
|
114
114
|
};
|
|
115
115
|
const getReportRenderData = async (req, count, specification, reportQuery, data) => {
|
|
116
116
|
const url = (0, parseurl_1.default)(req);
|
|
117
|
+
const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`;
|
|
117
118
|
const pagination = utils_1.default.getPaginationData(url, count);
|
|
118
119
|
const dataTable = new DataTableBuilder_1.default(specification.fields)
|
|
119
120
|
.withHeaderSortOptions(reportQuery)
|
|
@@ -133,6 +134,7 @@ const getReportRenderData = async (req, count, specification, reportQuery, data)
|
|
|
133
134
|
reportUrl: url.pathname.replace('/download-disabled', '').replace('/download-disabled?', ''),
|
|
134
135
|
reportSearch: url.search,
|
|
135
136
|
encodedSearch: url.search ? encodeURIComponent(url.search) : undefined,
|
|
137
|
+
fullUrl,
|
|
136
138
|
};
|
|
137
139
|
};
|
|
138
140
|
const getRenderData = async ({ req, reportDefinition, reportQuery, reportData, count, csrfToken, canDownload, }) => {
|
|
@@ -185,6 +185,7 @@ const getReportRenderData = async (
|
|
|
185
185
|
data: Dict<string>[],
|
|
186
186
|
) => {
|
|
187
187
|
const url = parseUrl(req)
|
|
188
|
+
const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`
|
|
188
189
|
const pagination = PaginationUtils.getPaginationData(url, count)
|
|
189
190
|
|
|
190
191
|
const dataTable: DataTable = new DataTableBuilder(specification.fields)
|
|
@@ -214,6 +215,7 @@ const getReportRenderData = async (
|
|
|
214
215
|
reportUrl: url.pathname.replace('/download-disabled', '').replace('/download-disabled?', ''),
|
|
215
216
|
reportSearch: url.search,
|
|
216
217
|
encodedSearch: url.search ? encodeURIComponent(url.search) : undefined,
|
|
218
|
+
fullUrl,
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
|
|
@@ -39,10 +39,10 @@ async function renderList(listData, variantDefinition, reportQuery, request, res
|
|
|
39
39
|
share: {
|
|
40
40
|
reportName,
|
|
41
41
|
name: variantDefinition.name,
|
|
42
|
-
url: reportRenderData.
|
|
42
|
+
url: reportRenderData.fullUrl,
|
|
43
43
|
},
|
|
44
44
|
copy: {
|
|
45
|
-
url: reportRenderData.
|
|
45
|
+
url: reportRenderData.fullUrl,
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
const renderData = {
|
|
@@ -66,10 +66,10 @@ export async function renderList(
|
|
|
66
66
|
share: {
|
|
67
67
|
reportName,
|
|
68
68
|
name: variantDefinition.name,
|
|
69
|
-
url: reportRenderData.
|
|
69
|
+
url: reportRenderData.fullUrl,
|
|
70
70
|
},
|
|
71
71
|
copy: {
|
|
72
|
-
url: reportRenderData.
|
|
72
|
+
url: reportRenderData.fullUrl,
|
|
73
73
|
},
|
|
74
74
|
})
|
|
75
75
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ministryofjustice/hmpps-digital-prison-reporting-frontend",
|
|
3
3
|
"description": "The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.",
|
|
4
|
-
"version": "4.1.
|
|
5
|
-
"main": "dpr/
|
|
4
|
+
"version": "4.1.23",
|
|
5
|
+
"main": "dpr/all.mjs",
|
|
6
6
|
"sass": "dpr/all.scss",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": "^22",
|
package/package.zip
CHANGED
|
Binary file
|