@ministryofjustice/hmpps-digital-prison-reporting-frontend 3.3.6 → 3.5.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/all.scss CHANGED
File without changes
File without changes
@@ -9,21 +9,21 @@
9
9
  {{ dprLoadingAnim() }}
10
10
 
11
11
  {{ govukCheckboxes({
12
- id: 'columns.' + columns.name,
13
- name: 'columns.' + columns.name,
14
- classes: "govuk-checkboxes--small",
15
- formGroup: {
16
- classes: "govuk-!-margin-bottom-3"
17
- },
18
- fieldset: {
19
- legend: {
20
- text: columns.text,
21
- classes: "govuk-label govuk-!-font-weight-bold"
22
- }
23
- },
24
- items: columns.options,
25
- values: columns.value
26
- }) }}
12
+ id: 'columns.' + columns.name,
13
+ name: 'columns.' + columns.name,
14
+ classes: "govuk-checkboxes--small",
15
+ formGroup: {
16
+ classes: "govuk-!-margin-bottom-3"
17
+ },
18
+ fieldset: {
19
+ legend: {
20
+ text: columns.text,
21
+ classes: "govuk-label govuk-!-font-weight-bold"
22
+ }
23
+ },
24
+ items: columns.options,
25
+ values: columns.value
26
+ }) }}
27
27
  </div>
28
28
 
29
29
  <div class="filter-actions">
@@ -38,7 +38,7 @@
38
38
  }) }}
39
39
  {% endset %}
40
40
 
41
- {% set subject = title | urlencode %}
41
+ {% set subject = reportName + ' - ' + title | urlencode %}
42
42
  {% set body = (dataTableOptions.url) | urlencode %}
43
43
  {% set shareOptions = {
44
44
  title: "Share:",
@@ -109,7 +109,9 @@
109
109
  <div class="govuk-width-container {% if (dataTableOptions.printable == false) %}print-hide{% endif %} govuk-!-margin-top-3">
110
110
  <div class="govuk-grid-row">
111
111
  <div class="govuk-grid-column-two-thirds">
112
- <h1 class="govuk-heading-m">{{ title }}</h1>
112
+ <h1 class="govuk-heading-m">
113
+ {{ title }}
114
+ </h1>
113
115
  </div>
114
116
  <div class="govuk-grid-column-one-third">
115
117
  <div class="dpr-actions">
@@ -11,6 +11,7 @@ export interface ListDataSources {
11
11
 
12
12
  export interface RenderListWithDataInput {
13
13
  title: string
14
+ reportName?: string
14
15
  variantDefinition: components['schemas']['VariantDefinition']
15
16
  request: Request
16
17
  response: Response
@@ -47,7 +47,7 @@ function redirectWithDefaultFilters(reportQuery, variantDefinition, response, re
47
47
  }
48
48
  return false;
49
49
  }
50
- function renderList(listData, variantDefinition, reportQuery, request, response, next, title, layoutTemplate, dynamicAutocompleteEndpoint, otherOptions) {
50
+ function renderList(listData, variantDefinition, reportQuery, request, response, next, title, layoutTemplate, dynamicAutocompleteEndpoint, otherOptions, reportName) {
51
51
  if (!redirectWithDefaultFilters(reportQuery, variantDefinition, response, request)) {
52
52
  Promise.all([listData.data, listData.count])
53
53
  .then((resolvedData) => {
@@ -83,6 +83,7 @@ function renderList(listData, variantDefinition, reportQuery, request, response,
83
83
  };
84
84
  response.render('dpr/components/report-list/list', {
85
85
  title,
86
+ reportName,
86
87
  dataTableOptions,
87
88
  filterOptions,
88
89
  columnOptions,
@@ -111,7 +112,7 @@ const renderListWithDefinition = ({ title, definitionName, variantName, request,
111
112
  data: reportingClient.getListWithWarnings(variantDefinition.resourceName, token, reportQuery),
112
113
  count: reportingClient.getCount(variantDefinition.resourceName, token, reportQuery),
113
114
  };
114
- renderList(getListData, variantDefinition, reportQuery, request, response, next, title !== null && title !== void 0 ? title : `${reportName} - ${variantDefinition.name}`, layoutTemplate, dynamicAutocompleteEndpoint, otherOptions);
115
+ renderList(getListData, variantDefinition, reportQuery, request, response, next, title !== null && title !== void 0 ? title : `${reportName} - ${variantDefinition.name}`, layoutTemplate, dynamicAutocompleteEndpoint, otherOptions, reportName);
115
116
  })
116
117
  .catch((error) => {
117
118
  next(error);
@@ -119,11 +120,11 @@ const renderListWithDefinition = ({ title, definitionName, variantName, request,
119
120
  };
120
121
  exports.default = {
121
122
  filtersQueryParameterPrefix,
122
- renderListWithData: ({ title, variantDefinition, request, response, next, getListDataSources, otherOptions, layoutTemplate, dynamicAutocompleteEndpoint, }) => {
123
+ renderListWithData: ({ title, reportName, variantDefinition, request, response, next, getListDataSources, otherOptions, layoutTemplate, dynamicAutocompleteEndpoint, }) => {
123
124
  const { fields } = variantDefinition.specification;
124
125
  const reportQuery = new ReportQuery_1.default(fields, request.query, getDefaultSortColumn(fields), filtersQueryParameterPrefix);
125
126
  const listData = getListDataSources(reportQuery);
126
- renderList(listData, variantDefinition, reportQuery, request, response, next, title, layoutTemplate, dynamicAutocompleteEndpoint, otherOptions);
127
+ renderList(listData, variantDefinition, reportQuery, request, response, next, title, layoutTemplate, dynamicAutocompleteEndpoint, otherOptions, reportName);
127
128
  },
128
129
  createReportListRequestHandler: ({ title, definitionName, variantName, apiUrl, apiTimeout, otherOptions, layoutTemplate, tokenProvider, dynamicAutocompleteEndpoint, }) => {
129
130
  return (request, response, next) => {
@@ -80,6 +80,7 @@ function renderList(
80
80
  layoutTemplate: string,
81
81
  dynamicAutocompleteEndpoint?: string,
82
82
  otherOptions?: NodeJS.Dict<object>,
83
+ reportName?: string,
83
84
  ) {
84
85
  if (!redirectWithDefaultFilters(reportQuery, variantDefinition, response, request)) {
85
86
  Promise.all([listData.data, listData.count])
@@ -120,6 +121,7 @@ function renderList(
120
121
 
121
122
  response.render('dpr/components/report-list/list', {
122
123
  title,
124
+ reportName,
123
125
  dataTableOptions,
124
126
  filterOptions,
125
127
  columnOptions,
@@ -181,6 +183,7 @@ const renderListWithDefinition = ({
181
183
  layoutTemplate,
182
184
  dynamicAutocompleteEndpoint,
183
185
  otherOptions,
186
+ reportName,
184
187
  )
185
188
  })
186
189
  .catch((error) => {
@@ -193,6 +196,7 @@ export default {
193
196
 
194
197
  renderListWithData: ({
195
198
  title,
199
+ reportName,
196
200
  variantDefinition,
197
201
  request,
198
202
  response,
@@ -222,6 +226,7 @@ export default {
222
226
  layoutTemplate,
223
227
  dynamicAutocompleteEndpoint,
224
228
  otherOptions,
229
+ reportName,
225
230
  )
226
231
  },
227
232
 
@@ -20,7 +20,7 @@ class ReportQuery {
20
20
  this.columns = utils_1.default.getSelectedColumns(fields, columns);
21
21
  }
22
22
  else {
23
- this.columns = fields.map((f) => f.name);
23
+ this.columns = fields.filter((f) => f.visible).map((f) => f.name);
24
24
  }
25
25
  this.filters = {};
26
26
  Object.keys(queryParams)
@@ -42,7 +42,7 @@ export default class ReportQuery implements FilteredListRequest {
42
42
  typeof queryParams.columns === 'string' ? queryParams.columns.split(',') : (queryParams.columns as string[])
43
43
  this.columns = ColumnUtils.getSelectedColumns(fields, columns)
44
44
  } else {
45
- this.columns = fields.map((f) => f.name)
45
+ this.columns = fields.filter((f) => f.visible).map((f) => f.name)
46
46
  }
47
47
 
48
48
  this.filters = {}
@@ -76,6 +76,7 @@ export interface components {
76
76
  /** @enum {string} */
77
77
  type: 'string' | 'date' | 'long' | 'time' | 'HTML'
78
78
  mandatory: boolean
79
+ visible: boolean
79
80
  }
80
81
  FilterDefinition: {
81
82
  /** @enum {string} */
@@ -7,6 +7,7 @@ const createUrlForParameters = (currentQueryParams, updateQueryParams) => {
7
7
  if (updateQueryParams) {
8
8
  queryParams = {
9
9
  ...currentQueryParams,
10
+ selectedPage: '1',
10
11
  };
11
12
  Object.keys(updateQueryParams).forEach((q) => {
12
13
  if (updateQueryParams[q]) {
@@ -9,6 +9,7 @@ const createUrlForParameters = (
9
9
  if (updateQueryParams) {
10
10
  queryParams = {
11
11
  ...currentQueryParams,
12
+ selectedPage: '1',
12
13
  }
13
14
 
14
15
  Object.keys(updateQueryParams).forEach((q) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
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": "3.3.6",
4
+ "version": "3.5.0",
5
5
  "main": "dpr/assets/js/all.mjs",
6
6
  "sass": "dpr/all.scss",
7
7
  "engines": {
package/package.zip CHANGED
Binary file