@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.24.0 → 4.25.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
@@ -714,11 +714,11 @@ ul.dpr-card-group__item__filters-list {
714
714
  }
715
715
  }
716
716
  .dpr-summary-container-group {
717
- column-gap: 15px;
718
717
  display: flex;
719
718
  position: relative;
720
719
  row-gap: 15px;
721
720
  flex-flow: column wrap;
721
+ padding-bottom: 40px;
722
722
 
723
723
  .dpr-summary-container {
724
724
  min-width: 200px;
@@ -4,7 +4,7 @@
4
4
  {% from "../report-no-data-message/view.njk" import dprReportNoDataMessage %}
5
5
  {% from "../../code-block/view.njk" import dprCodeBlock %}
6
6
 
7
- {% macro dprReport(options, count) %}
7
+ {% macro dprReport(options, count, template) %}
8
8
  {% set reportSummaries = options.reportSummaries %}
9
9
  {% set dataTable = options.dataTable %}
10
10
  {% set pagination = options.pagination %}
@@ -17,9 +17,16 @@
17
17
 
18
18
  {{ dprReportSummary(reportSummaries, 'page-header') }}
19
19
  {{ dprReportTotals(options.totals) }}
20
-
21
20
  <div class='dpr-table-container dpr-table-container--{{ template }}'>
22
- {{ dprDataTableWrapper(dataTable, classification) }}
21
+ {% if template === 'summary-section' %}
22
+ {% for datatable in dataTable[0].rows %}
23
+ {% if datatable[0].html %}
24
+ {{ datatable[0].html | safe }}
25
+ {% endif %}
26
+ {% endfor %}
27
+ {% else %}
28
+ {{ dprDataTableWrapper(dataTable, classification) }}
29
+ {% endif %}
23
30
  </div>
24
31
 
25
32
  <div class='govuk-!-margin-bottom-6'>
@@ -1,9 +1,9 @@
1
1
  .dpr-summary-container-group {
2
- column-gap: 15px;
3
2
  display: flex;
4
3
  position: relative;
5
4
  row-gap: 15px;
6
5
  flex-flow: column wrap;
6
+ padding-bottom: 40px;
7
7
 
8
8
  .dpr-summary-container {
9
9
  min-width: 200px;
@@ -19,7 +19,7 @@
19
19
 
20
20
  {% elif template === 'list-section' or template === 'summary-section' or template === 'parent-child' or template === 'parent-child-section' or template === 'row-section' or template === 'row-section-child' %}
21
21
 
22
- {{ dprReport(renderData, count) }}
22
+ {{ dprReport(renderData, count, template) }}
23
23
 
24
24
  {% elif template === 'summary' %}
25
25
 
@@ -32,7 +32,7 @@
32
32
 
33
33
  {% else %}
34
34
 
35
- {{ dprReport(renderData, count) }}
35
+ {{ dprReport(renderData, count, template) }}
36
36
 
37
37
  {% if count and count > 0 %}
38
38
  {{ dprReportPagination(pagination) }}
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.create;var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var r=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var h=(e,i,s,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of y(i))!b.call(e,c)&&c!==s&&n(e,c,{get:()=>i[c],enumerable:!(t=a(i,c))||t.enumerable});return e};var R=(e,i,s)=>(s=e!=null?d(r(e)):{},h(i||!e||!e.__esModule?n(s,"default",{value:e,enumerable:!0}):s,e));var o=require("cypress-tests/cypressUtils"),u=R(require("dayjs")),l=require("test-app/routes/integrationTests/appStateUtils");context("Request status",()=>{const e="/embedded/platform/";beforeEach(()=>{(0,o.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20WithDelay")}),describe("post request",()=>{const i="";it("should show the status pages",()=>{cy.visit(e),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,t)=>!!t.textContent?.includes("Successful Report")&&!!t.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),(0,o.checkA11y)(),cy.task("stubReportsPickedStatus"),cy.findByText(/picked/i).should("be.visible"),(0,o.checkA11y)(),cy.task("stubReportsStartedStatus"),cy.findByText(/started/i).should("be.visible"),(0,o.checkA11y)(),cy.task("stubReportsFinishedStatus"),cy.findAllByRole("heading",{name:/successful report/i}).should("be.visible")}),it("should timeout",()=>{cy.visit(e),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,t)=>!!t.textContent?.includes("Successful Report")&&!!t.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),(0,o.checkA11y)(),cy.task("stubReportsPickedStatus"),cy.findByText("PICKED").should("be.visible"),(0,l.getRedisState)().then(s=>{const t={...s.body};t.requestedReports[0].timestamp.requested=(0,u.default)(s.body.requestedReports[0].timestamp.requested).add(-1,"days").toDate(),(0,l.setRedisState)(t)}),cy.findAllByText(/Request taking too long/).eq(0).should("be.visible"),(0,o.checkA11y)()}),describe("failure status pages",()=>{beforeEach(()=>{cy.task("resetRedis"),cy.task("stubReportsPickedStatus"),cy.visit(e),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,t)=>!!t.textContent?.includes("Successful Report")&&!!t.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByText(/submitted/i).should("be.visible"),cy.findByText(/picked/i).should("be.visible")}),it("should show the aborted status page",()=>{cy.task("stubReportsAbortedStatus"),cy.findByText(/aborted/i).should("be.visible"),cy.injectAxe(),cy.checkA11y()}),it("should show the expired status page",()=>{cy.task("stubReportsExpiredStatus"),cy.findByText(/expired/i).should("be.visible"),cy.injectAxe(),cy.checkA11y()}),it("should show the failed status page",()=>{cy.task("stubReportsFailedStatus"),cy.findByText(/your report has failed to generate/i).should("be.visible"),cy.findByRole("group").contains("Show full error").should("be.visible"),cy.findByText(/Show full error/).click(),cy.findByText(/a developer message goes here/).should("be.visible"),cy.findAllByRole("list").contains("Report ID: request-examples").should("be.visible"),cy.findAllByRole("list").contains(`Execution ID: ${i}`).should("be.visible"),cy.findAllByRole("list").contains("Table ID: tblId_").should("be.visible"),cy.injectAxe(),cy.checkA11y()})})})});
1
+ "use strict";var d=Object.create;var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var r=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var h=(e,i,s,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of y(i))!b.call(e,c)&&c!==s&&n(e,c,{get:()=>i[c],enumerable:!(t=a(i,c))||t.enumerable});return e};var R=(e,i,s)=>(s=e!=null?d(r(e)):{},h(i||!e||!e.__esModule?n(s,"default",{value:e,enumerable:!0}):s,e));var o=require("cypress-tests/cypressUtils"),u=R(require("dayjs")),l=require("test-app/routes/integrationTests/appStateUtils");context("Request status",()=>{const e="/embedded/platform/";beforeEach(()=>{(0,o.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20WithDelay")}),describe("post request",()=>{it("should show the status pages",()=>{cy.visit(e),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,t)=>!!t.textContent?.includes("Successful Report")&&!!t.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),(0,o.checkA11y)(),cy.task("stubReportsPickedStatus"),cy.findByText(/picked/i).should("be.visible"),(0,o.checkA11y)(),cy.task("stubReportsStartedStatus"),cy.findByText(/started/i).should("be.visible"),(0,o.checkA11y)(),cy.task("stubReportsFinishedStatus"),cy.findAllByRole("heading",{name:/successful report/i}).should("be.visible")}),it("should timeout",()=>{cy.visit(e),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,t)=>!!t.textContent?.includes("Successful Report")&&!!t.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),(0,o.checkA11y)(),cy.task("stubReportsPickedStatus"),cy.findByText("PICKED").should("be.visible"),(0,l.getRedisState)().then(s=>{const t={...s.body};t.requestedReports[0].timestamp.requested=(0,u.default)(s.body.requestedReports[0].timestamp.requested).add(-1,"days").toDate(),(0,l.setRedisState)(t)}),cy.findAllByText(/Request taking too long/).eq(0).should("be.visible"),(0,o.checkA11y)()}),describe("failure status pages",()=>{beforeEach(()=>{cy.task("resetRedis"),cy.task("stubReportsPickedStatus"),cy.visit(e),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,t)=>!!t.textContent?.includes("Successful Report")&&!!t.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByText(/submitted/i).should("be.visible"),cy.findByText(/picked/i).should("be.visible")}),it("should show the aborted status page",()=>{cy.task("stubReportsAbortedStatus"),cy.findByText(/aborted/i).should("be.visible"),cy.injectAxe(),cy.checkA11y()}),it("should show the expired status page",()=>{cy.task("stubReportsExpiredStatus"),cy.findByText(/expired/i).should("be.visible"),cy.injectAxe(),cy.checkA11y()}),it("should show the failed status page",()=>{cy.task("stubReportsFailedStatus"),cy.findByText(/your report has failed to generate/i).should("be.visible"),cy.findByRole("group").contains("Show full error").should("be.visible"),cy.findByText(/Show full error/).click(),cy.findByText(/a developer message goes here/).should("be.visible"),cy.findAllByRole("list").contains("Report ID: request-examples").should("be.visible"),cy.findAllByRole("list").contains("Execution ID: ").should("be.visible"),cy.findAllByRole("list").contains("Table ID: tblId_").should("be.visible"),cy.injectAxe(),cy.checkA11y()})})})});
2
2
  //# sourceMappingURL=tests.cy.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/dpr/routes/journeys/request-report/status/tests.cy.ts"],
4
4
  "sourcesContent": ["import { checkA11y, executeReportStubs } from 'cypress-tests/cypressUtils'\nimport dayjs from 'dayjs'\nimport { getRedisState, setRedisState } from 'test-app/routes/integrationTests/appStateUtils'\n\ncontext('Request status', () => {\n const path = '/embedded/platform/'\n\n beforeEach(() => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20WithDelay')\n })\n\n describe('post request', () => {\n const executionId = ''\n\n it('should show the status pages', () => {\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element.textContent?.includes('Successful Report')) &&\n Boolean(element.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n checkA11y()\n cy.task('stubReportsPickedStatus')\n cy.findByText(/picked/i).should('be.visible')\n checkA11y()\n cy.task('stubReportsStartedStatus')\n cy.findByText(/started/i).should('be.visible')\n checkA11y()\n cy.task('stubReportsFinishedStatus')\n cy.findAllByRole('heading', { name: /successful report/i }).should('be.visible')\n })\n\n it('should timeout', () => {\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element.textContent?.includes('Successful Report')) &&\n Boolean(element.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n checkA11y()\n cy.task('stubReportsPickedStatus')\n cy.findByText('PICKED').should('be.visible')\n getRedisState().then((state) => {\n const newState = {\n ...state.body,\n }\n newState.requestedReports[0].timestamp.requested = dayjs(state.body.requestedReports[0].timestamp.requested)\n .add(-1, 'days')\n .toDate()\n setRedisState(newState)\n })\n cy.findAllByText(/Request taking too long/)\n .eq(0)\n .should('be.visible')\n checkA11y()\n })\n\n describe('failure status pages', () => {\n beforeEach(() => {\n cy.task('resetRedis')\n cy.task('stubReportsPickedStatus')\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element.textContent?.includes('Successful Report')) &&\n Boolean(element.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n cy.findByText(/submitted/i).should('be.visible')\n cy.findByText(/picked/i).should('be.visible')\n })\n\n it('should show the aborted status page', () => {\n cy.task('stubReportsAbortedStatus')\n cy.findByText(/aborted/i).should('be.visible')\n cy.injectAxe()\n cy.checkA11y()\n })\n it('should show the expired status page', () => {\n cy.task('stubReportsExpiredStatus')\n cy.findByText(/expired/i).should('be.visible')\n cy.injectAxe()\n cy.checkA11y()\n })\n it('should show the failed status page', () => {\n cy.task('stubReportsFailedStatus')\n cy.findByText(/your report has failed to generate/i).should('be.visible')\n cy.findByRole('group').contains('Show full error').should('be.visible')\n cy.findByText(/Show full error/).click()\n cy.findByText(/a developer message goes here/).should('be.visible')\n cy.findAllByRole('list').contains('Report ID: request-examples').should('be.visible')\n cy.findAllByRole('list').contains(`Execution ID: ${executionId}`).should('be.visible')\n cy.findAllByRole('list').contains('Table ID: tblId_').should('be.visible')\n cy.injectAxe()\n cy.checkA11y()\n })\n })\n })\n})\n"],
5
- "mappings": "wdAAA,IAAAA,EAA8C,sCAC9CC,EAAkB,oBAClBC,EAA6C,0DAE7C,QAAQ,iBAAkB,IAAM,CAC9B,MAAMC,EAAO,sBAEb,WAAW,IAAM,IACf,sBAAmB,EACnB,GAAG,KAAK,sCAAsC,EAC9C,GAAG,KAAK,qCAAqC,CAC/C,CAAC,EAED,SAAS,eAAgB,IAAM,CAC7B,MAAMC,EAAc,GAEpB,GAAG,+BAAgC,IAAM,CACvC,GAAG,MAAMD,CAAI,EACb,GAAG,gBAAgB,sBAAsB,EAAE,OAAO,IAAM,CACtD,GAAG,WAAW,MAAO,CACnB,KAAM,CAACE,EAAGC,IAEN,EAAQA,EAAQ,aAAa,SAAS,mBAAmB,GACzD,EAAQA,EAAQ,aAAa,SAAS,mBAAmB,CAG/D,CAAC,EAAE,OAAO,IAAM,CACd,GAAG,W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,EACrF,GAAG,cAAc,MAAM,EAAE,SAAS,kBAAkB,EAAE,OAAO,YAAY,EACzE,GAAG,UAAU,EACb,GAAG,UAAU,CACf,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_cypressUtils", "import_dayjs", "import_appStateUtils", "path", "executionId", "_", "element", "state", "newState", "dayjs"]
5
+ "mappings": "wdAAA,IAAAA,EAA8C,sCAC9CC,EAAkB,oBAClBC,EAA6C,0DAE7C,QAAQ,iBAAkB,IAAM,CAC9B,MAAMC,EAAO,sBAEb,WAAW,IAAM,IACf,sBAAmB,EACnB,GAAG,KAAK,sCAAsC,EAC9C,GAAG,KAAK,qCAAqC,CAC/C,CAAC,EAED,SAAS,eAAgB,IAAM,CAG7B,GAAG,+BAAgC,IAAM,CACvC,GAAG,MAAMA,CAAI,EACb,GAAG,gBAAgB,sBAAsB,EAAE,OAAO,IAAM,CACtD,GAAG,WAAW,MAAO,CACnB,KAAM,CAACC,EAAGC,IAEN,EAAQA,EAAQ,aAAa,SAAS,mBAAmB,GACzD,EAAQA,EAAQ,aAAa,SAAS,mBAAmB,CAG/D,CAAC,EAAE,OAAO,IAAM,CACd,GAAG,WAAW,OAAQ,CAAE,KAAM,gBAAiB,CAAC,EAAE,MAAM,CAC1D,CAAC,CACH,CAAC,EACD,GAAG,WAAW,SAAU,CAAE,KAAM,SAAU,CAAC,EAAE,MAAM,KACnD,aAAU,EACV,GAAG,KAAK,yBAAyB,EACjC,GAAG,WAAW,SAAS,EAAE,OAAO,YAAY,KAC5C,aAAU,EACV,GAAG,KAAK,0BAA0B,EAClC,GAAG,WAAW,UAAU,EAAE,OAAO,YAAY,KAC7C,aAAU,EACV,GAAG,KAAK,2BAA2B,EACnC,GAAG,cAAc,UAAW,CAAE,KAAM,oBAAqB,CAAC,EAAE,OAAO,YAAY,CACjF,CAAC,EAED,GAAG,iBAAkB,IAAM,CACzB,GAAG,MAAMF,CAAI,EACb,GAAG,gBAAgB,sBAAsB,EAAE,O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AE,OAAO,YAAY,EAC/C,GAAG,WAAW,SAAS,EAAE,OAAO,YAAY,CAC9C,CAAC,EAED,GAAG,sCAAuC,IAAM,CAC9C,GAAG,KAAK,0BAA0B,EAClC,GAAG,WAAW,UAAU,EAAE,OAAO,YAAY,EAC7C,GAAG,UAAU,EACb,GAAG,UAAU,CACf,CAAC,EACD,GAAG,sCAAuC,IAAM,CAC9C,GAAG,KAAK,0BAA0B,EAClC,GAAG,WAAW,UAAU,EAAE,OAAO,YAAY,EAC7C,GAAG,UAAU,EACb,GAAG,UAAU,CACf,CAAC,EACD,GAAG,qCAAsC,IAAM,CAC7C,GAAG,KAAK,yBAAyB,EACjC,GAAG,WAAW,qCAAqC,EAAE,OAAO,YAAY,EACxE,GAAG,WAAW,OAAO,EAAE,SAAS,iBAAiB,EAAE,OAAO,YAAY,EACtE,GAAG,WAAW,iBAAiB,EAAE,MAAM,EACvC,GAAG,WAAW,+BAA+B,EAAE,OAAO,YAAY,EAClE,GAAG,cAAc,MAAM,EAAE,SAAS,6BAA6B,EAAE,OAAO,YAAY,EACpF,GAAG,cAAc,MAAM,EAAE,SAAS,gBAA8B,EAAE,OAAO,YAAY,EACrF,GAAG,cAAc,MAAM,EAAE,SAAS,kBAAkB,EAAE,OAAO,YAAY,EACzE,GAAG,UAAU,EACb,GAAG,UAAU,CACf,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_cypressUtils", "import_dayjs", "import_appStateUtils", "path", "_", "element", "state", "newState", "dayjs"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("cypress-tests/cypressUtils");context("Viewing a report",()=>{const l="/embedded/platform/";describe("report variants",()=>{before(()=>{(0,e.stubBaseTasks)(),(0,e.executeReportStubs)()}),it("should display a list-section variant",()=>{cy.task("stubListSectionDefinitionRequest"),cy.task("stubResultSuccessResult"),cy.visit(l),(0,e.requestReportByNameAndDescription)({name:"Successful Report",description:"this will succeed"}),cy.findByRole("heading",{level:1,name:/Sectioned/}).should("be.visible"),cy.findAllByRole("heading",{name:/First.*Second/}).should("have.length",4),cy.findByRole("heading",{name:/First: One, Second: A 4 results/}).should("be.visible"),cy.findByRole("heading",{name:/First: One, Second: B 6 results/}).should("be.visible"),cy.findByRole("heading",{name:/First: Two, Second: A 3 results/}).should("be.visible"),cy.findByRole("heading",{name:/First: Two, Second: B 7 results/}).should("be.visible")}),it("should display a parent-child variant",()=>{cy.task("stubParentChildDefinitionRequest"),cy.task("stubResultSuccessResultDifferentValues"),cy.visit(l),(0,e.requestReportByNameAndDescription)({name:"Successful Report",description:"this will succeed"}),cy.findByRole("heading",{level:1,name:/Parent Child Template/}).should("be.visible"),cy.contains("table","val40").within(()=>{cy.findAllByRole("row").should("have.length",8),[40,41,42,43,44,45,46].forEach(i=>{cy.findByRole("row",{name:new RegExp(`val${i}$`)}).should("be.visible")})}),cy.contains("table","val30").within(()=>{cy.findAllByRole("row").should("have.length",14),[...Array(10).keys()].map(i=>i+30).forEach(i=>{cy.findByRole("row",{name:new RegExp(`val${i}$`)}).should("be.visible")}),cy.findByRole("row",{name:/val330/}).should("be.visible"),cy.findByRole("row",{name:/val331/}).should("be.visible"),cy.findByRole("row",{name:/val332/}).should("be.visible")})}),it("should display a summary section variant",()=>{cy.task("stubSummarySectionDefinitionRequest"),cy.task("stubAsyncSummaryReport"),cy.task("stubResultSuccessResultDifferentValues"),cy.visit(l),(0,e.requestReportByNameAndDescription)({name:"Successful Report",description:"this will succeed"}),cy.findByRole("heading",{level:1,name:/Sectioned Summaries template/}).should("be.visible"),cy.findAllByRole("columnheader").should("have.length",32),cy.get(".report-template-container").within(()=>{cy.findAllByRole("row").should("have.length",48)})}),it("should display a parent child section variant",()=>{cy.task("stubParentChildSectionDefinitionRequest"),cy.task("stubResultSuccessResultDifferentValues"),cy.visit(l),(0,e.requestReportByNameAndDescription)({name:"Successful Report",description:"this will succeed"}),cy.findByRole("heading",{level:1,name:/Parent Child Section Template/}).should("be.visible"),cy.contains("table","val30").within(()=>{cy.findAllByRole("row").should("have.length",21)}),cy.findByRole("heading",{name:/Section 1: One, Section 2: A 5 results/}).should("be.visible"),cy.findByRole("heading",{name:/Section 1: One, Section 2: B 2 results/}).should("be.visible"),cy.findByRole("heading",{name:/Section 1: Two, Section 2: A 8 results/}).should("be.visible"),cy.findByRole("heading",{name:/Section 1: Two, Section 2: B 5 results/}).should("be.visible"),cy.findAllByRole("row",{name:i=>i.includes("val")}).filter((i,s)=>[...s.querySelectorAll("td")].length===2).should("have.length",100)})})});
2
+ //# sourceMappingURL=report-variants.cy.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/dpr/routes/journeys/view-report/async/report/report-variants.cy.ts"],
4
+ "sourcesContent": ["import { executeReportStubs, requestReportByNameAndDescription, stubBaseTasks } from 'cypress-tests/cypressUtils'\n\ncontext('Viewing a report', () => {\n const path = '/embedded/platform/'\n\n describe('report variants', () => {\n before(() => {\n stubBaseTasks()\n executeReportStubs()\n })\n\n it('should display a list-section variant', () => {\n cy.task('stubListSectionDefinitionRequest')\n cy.task('stubResultSuccessResult')\n\n cy.visit(path)\n requestReportByNameAndDescription({ name: 'Successful Report', description: 'this will succeed' })\n cy.findByRole('heading', { level: 1, name: /Sectioned/ }).should('be.visible')\n\n cy.findAllByRole('heading', { name: /First.*Second/ }).should('have.length', 4)\n cy.findByRole('heading', { name: /First: One, Second: A 4 results/ }).should('be.visible')\n cy.findByRole('heading', { name: /First: One, Second: B 6 results/ }).should('be.visible')\n cy.findByRole('heading', { name: /First: Two, Second: A 3 results/ }).should('be.visible')\n cy.findByRole('heading', { name: /First: Two, Second: B 7 results/ }).should('be.visible')\n })\n\n it('should display a parent-child variant', () => {\n cy.task('stubParentChildDefinitionRequest')\n cy.task('stubResultSuccessResultDifferentValues')\n\n cy.visit(path)\n requestReportByNameAndDescription({ name: 'Successful Report', description: 'this will succeed' })\n cy.findByRole('heading', { level: 1, name: /Parent Child Template/ }).should('be.visible')\n\n cy.contains('table', 'val40').within(() => {\n cy.findAllByRole('row').should('have.length', 8)\n ;[40, 41, 42, 43, 44, 45, 46].forEach((num) => {\n cy.findByRole('row', { name: new RegExp(`val${num}$`) }).should('be.visible')\n })\n })\n\n cy.contains('table', 'val30').within(() => {\n cy.findAllByRole('row').should('have.length', 14)\n ;[...Array(10).keys()]\n .map((i) => i + 30)\n .forEach((num) => {\n cy.findByRole('row', { name: new RegExp(`val${num}$`) }).should('be.visible')\n })\n cy.findByRole('row', { name: /val330/ }).should('be.visible')\n cy.findByRole('row', { name: /val331/ }).should('be.visible')\n cy.findByRole('row', { name: /val332/ }).should('be.visible')\n })\n })\n\n it('should display a summary section variant', () => {\n cy.task('stubSummarySectionDefinitionRequest')\n cy.task('stubAsyncSummaryReport')\n cy.task('stubResultSuccessResultDifferentValues')\n\n cy.visit(path)\n requestReportByNameAndDescription({ name: 'Successful Report', description: 'this will succeed' })\n cy.findByRole('heading', { level: 1, name: /Sectioned Summaries template/ }).should('be.visible')\n\n cy.findAllByRole('columnheader').should('have.length', 8 * 4)\n cy.get('.report-template-container').within(() => {\n cy.findAllByRole('row').should('have.length', 48)\n })\n })\n\n it('should display a parent child section variant', () => {\n cy.task('stubParentChildSectionDefinitionRequest')\n cy.task('stubResultSuccessResultDifferentValues')\n\n cy.visit(path)\n requestReportByNameAndDescription({ name: 'Successful Report', description: 'this will succeed' })\n cy.findByRole('heading', { level: 1, name: /Parent Child Section Template/ }).should('be.visible')\n\n // First child table\n cy.contains('table', 'val30').within(() => {\n cy.findAllByRole('row').should('have.length', 21)\n })\n cy.findByRole('heading', { name: /Section 1: One, Section 2: A 5 results/ }).should('be.visible')\n cy.findByRole('heading', { name: /Section 1: One, Section 2: B 2 results/ }).should('be.visible')\n cy.findByRole('heading', { name: /Section 1: Two, Section 2: A 8 results/ }).should('be.visible')\n cy.findByRole('heading', { name: /Section 1: Two, Section 2: B 5 results/ }).should('be.visible')\n // This is the best we can do for now until this report type gets refactored\n cy.findAllByRole('row', {\n name: (textContent) => {\n return textContent.includes('val')\n },\n })\n .filter((_idx, el) => [...el.querySelectorAll('td')].length === 2)\n .should('have.length', 100)\n })\n })\n})\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqF,sCAErF,QAAQ,mBAAoB,IAAM,CAChC,MAAMC,EAAO,sBAEb,SAAS,kBAAmB,IAAM,CAChC,OAAO,IAAM,IACX,iBAAc,KACd,sBAAmB,CACrB,CAAC,EAED,GAAG,wCAAyC,IAAM,CAChD,GAAG,KAAK,kCAAkC,EAC1C,GAAG,KAAK,yBAAyB,EAEjC,GAAG,MAAMA,CAAI,KACb,qCAAkC,CAAE,KAAM,oBAAqB,YAAa,mBAAoB,CAAC,EACjG,GAAG,WAAW,UAAW,CAAE,MAAO,EAAG,KAAM,WAAY,CAAC,EAAE,OAAO,YAAY,EAE7E,GAAG,cAAc,UAAW,CAAE,KAAM,eAAgB,CAAC,EAAE,OAAO,cAAe,CAAC,EAC9E,GAAG,WAAW,UAAW,CAAE,KAAM,iCAAkC,CAAC,EAAE,OAAO,YAAY,EACzF,GAAG,WAAW,UAAW,CAAE,KAAM,iCAAkC,CAAC,EAAE,OAAO,YAAY,EACzF,GAAG,WAAW,UAAW,CAAE,KAAM,iCAAkC,CAAC,EAAE,OAAO,YAAY,EACzF,GAAG,WAAW,UAAW,CAAE,KAAM,iCAAkC,CAAC,EAAE,OAAO,YAAY,CAC3F,CAAC,EAED,GAAG,wCAAyC,IAAM,CAChD,GAAG,KAAK,kCAAkC,EAC1C,GAAG,KAAK,wCAAwC,EAEhD,GAAG,MAAMA,CAAI,KACb,qCAAkC,CAAE,KAAM,oBAAqB,YAAa,mBAAoB,CAAC,EACjG,GAAG,WAAW,UAAW,CAAE,MAAO,EAAG,KAAM,uBAAwB,CAAC,EAAE,OAAO,YAAY,EAEzF,GAAG,SAAS,QAAS,OAAO,EAAE,OAAO,IAAM,CACzC,GAAG,cAAc,KAAK,EAAE,OAAO,cAAe,CAAC,EAC9C,CAAC,GAA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,MAAMA,CAAI,KACb,qCAAkC,CAAE,KAAM,oBAAqB,YAAa,mBAAoB,CAAC,EACjG,GAAG,WAAW,UAAW,CAAE,MAAO,EAAG,KAAM,+BAAgC,CAAC,EAAE,OAAO,YAAY,EAGjG,GAAG,SAAS,QAAS,OAAO,EAAE,OAAO,IAAM,CACzC,GAAG,cAAc,KAAK,EAAE,OAAO,cAAe,EAAE,CAClD,CAAC,EACD,GAAG,WAAW,UAAW,CAAE,KAAM,wCAAyC,CAAC,EAAE,OAAO,YAAY,EAChG,GAAG,WAAW,UAAW,CAAE,KAAM,wCAAyC,CAAC,EAAE,OAAO,YAAY,EAChG,GAAG,WAAW,UAAW,CAAE,KAAM,wCAAyC,CAAC,EAAE,OAAO,YAAY,EAChG,GAAG,WAAW,UAAW,CAAE,KAAM,wCAAyC,CAAC,EAAE,OAAO,YAAY,EAEhG,GAAG,cAAc,MAAO,CACtB,KAAOE,GACEA,EAAY,SAAS,KAAK,CAErC,CAAC,EACE,OAAO,CAACC,EAAMC,IAAO,CAAC,GAAGA,EAAG,iBAAiB,IAAI,CAAC,EAAE,SAAW,CAAC,EAChE,OAAO,cAAe,GAAG,CAC9B,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_cypressUtils", "path", "num", "textContent", "_idx", "el"]
7
+ }
@@ -0,0 +1,96 @@
1
+ import { executeReportStubs, requestReportByNameAndDescription, stubBaseTasks } from 'cypress-tests/cypressUtils'
2
+
3
+ context('Viewing a report', () => {
4
+ const path = '/embedded/platform/'
5
+
6
+ describe('report variants', () => {
7
+ before(() => {
8
+ stubBaseTasks()
9
+ executeReportStubs()
10
+ })
11
+
12
+ it('should display a list-section variant', () => {
13
+ cy.task('stubListSectionDefinitionRequest')
14
+ cy.task('stubResultSuccessResult')
15
+
16
+ cy.visit(path)
17
+ requestReportByNameAndDescription({ name: 'Successful Report', description: 'this will succeed' })
18
+ cy.findByRole('heading', { level: 1, name: /Sectioned/ }).should('be.visible')
19
+
20
+ cy.findAllByRole('heading', { name: /First.*Second/ }).should('have.length', 4)
21
+ cy.findByRole('heading', { name: /First: One, Second: A 4 results/ }).should('be.visible')
22
+ cy.findByRole('heading', { name: /First: One, Second: B 6 results/ }).should('be.visible')
23
+ cy.findByRole('heading', { name: /First: Two, Second: A 3 results/ }).should('be.visible')
24
+ cy.findByRole('heading', { name: /First: Two, Second: B 7 results/ }).should('be.visible')
25
+ })
26
+
27
+ it('should display a parent-child variant', () => {
28
+ cy.task('stubParentChildDefinitionRequest')
29
+ cy.task('stubResultSuccessResultDifferentValues')
30
+
31
+ cy.visit(path)
32
+ requestReportByNameAndDescription({ name: 'Successful Report', description: 'this will succeed' })
33
+ cy.findByRole('heading', { level: 1, name: /Parent Child Template/ }).should('be.visible')
34
+
35
+ cy.contains('table', 'val40').within(() => {
36
+ cy.findAllByRole('row').should('have.length', 8)
37
+ ;[40, 41, 42, 43, 44, 45, 46].forEach((num) => {
38
+ cy.findByRole('row', { name: new RegExp(`val${num}$`) }).should('be.visible')
39
+ })
40
+ })
41
+
42
+ cy.contains('table', 'val30').within(() => {
43
+ cy.findAllByRole('row').should('have.length', 14)
44
+ ;[...Array(10).keys()]
45
+ .map((i) => i + 30)
46
+ .forEach((num) => {
47
+ cy.findByRole('row', { name: new RegExp(`val${num}$`) }).should('be.visible')
48
+ })
49
+ cy.findByRole('row', { name: /val330/ }).should('be.visible')
50
+ cy.findByRole('row', { name: /val331/ }).should('be.visible')
51
+ cy.findByRole('row', { name: /val332/ }).should('be.visible')
52
+ })
53
+ })
54
+
55
+ it('should display a summary section variant', () => {
56
+ cy.task('stubSummarySectionDefinitionRequest')
57
+ cy.task('stubAsyncSummaryReport')
58
+ cy.task('stubResultSuccessResultDifferentValues')
59
+
60
+ cy.visit(path)
61
+ requestReportByNameAndDescription({ name: 'Successful Report', description: 'this will succeed' })
62
+ cy.findByRole('heading', { level: 1, name: /Sectioned Summaries template/ }).should('be.visible')
63
+
64
+ cy.findAllByRole('columnheader').should('have.length', 8 * 4)
65
+ cy.get('.report-template-container').within(() => {
66
+ cy.findAllByRole('row').should('have.length', 48)
67
+ })
68
+ })
69
+
70
+ it('should display a parent child section variant', () => {
71
+ cy.task('stubParentChildSectionDefinitionRequest')
72
+ cy.task('stubResultSuccessResultDifferentValues')
73
+
74
+ cy.visit(path)
75
+ requestReportByNameAndDescription({ name: 'Successful Report', description: 'this will succeed' })
76
+ cy.findByRole('heading', { level: 1, name: /Parent Child Section Template/ }).should('be.visible')
77
+
78
+ // First child table
79
+ cy.contains('table', 'val30').within(() => {
80
+ cy.findAllByRole('row').should('have.length', 21)
81
+ })
82
+ cy.findByRole('heading', { name: /Section 1: One, Section 2: A 5 results/ }).should('be.visible')
83
+ cy.findByRole('heading', { name: /Section 1: One, Section 2: B 2 results/ }).should('be.visible')
84
+ cy.findByRole('heading', { name: /Section 1: Two, Section 2: A 8 results/ }).should('be.visible')
85
+ cy.findByRole('heading', { name: /Section 1: Two, Section 2: B 5 results/ }).should('be.visible')
86
+ // This is the best we can do for now until this report type gets refactored
87
+ cy.findAllByRole('row', {
88
+ name: (textContent) => {
89
+ return textContent.includes('val')
90
+ },
91
+ })
92
+ .filter((_idx, el) => [...el.querySelectorAll('td')].length === 2)
93
+ .should('have.length', 100)
94
+ })
95
+ })
96
+ })
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var g=(a,i)=>{for(var t in i)o(a,t,{get:i[t],enumerable:!0})},h=(a,i,t,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of u(i))!F.call(a,e)&&e!==t&&o(a,e,{get:()=>i[e],enumerable:!(d=f(i,e))||d.enumerable});return a};var y=(a,i,t)=>(t=a!=null?p(D(a)):{},h(i||!a||!a.__esModule?o(t,"default",{value:a,enumerable:!0}):t,a)),C=a=>h(o({},"__esModule",{value:!0}),a);var T={};g(T,{SectionedFieldsDataTableBuilder:()=>c,default:()=>S});module.exports=C(T);var m=y(require("../ParentChildDataTableBuilder/ParentChildDataTableBuilder"));class c extends m.default{constructor(i){const{sectionedFields:t,template:d}=i.specification;super(i),this.sectionedFields=t,this.sections=this.sectionedFields.map(e=>e.name),this.template=d,this.childVariants=this.variant.childVariants||[]}getChildFields(i){const t=this.childVariants.find(e=>e.id===i);let d=[];if(t){const{specification:e}=t;d=e?e.fields:d}return d}getJoinKey(){return this.childVariants[0].joinFields[0]}initSectionedData(i){return i.flatMap(t=>this.sectionedFields.map(e=>{const s=this.mapNamesToFields([e.name])[0];let n=[];const{child:r}=e;return e.fields?n=this.mapNamesToFields(e.fields):e.child&&(n=this.getChildFields(e.child)),{header:s,fields:n,child:r}}).map(e=>{if(e.child){const s=this.getChildData(e.child),n=e.fields.filter(l=>l.visible),r=this.getJoinKey();return{header:e.header.display,fields:s?s.data.filter(l=>l[r]===t[r]).map(l=>({heading:l[n[0]?.name]||"Not found",data:l[n[1]?.name]||"Not found"})):[]}}return{header:e.header.display,fields:e.fields.filter(s=>s.visible).map(s=>({heading:s.display,data:t[s.name]}))}}))}getChildData(i){return this.childData.find(t=>t.id===i)}createRows(i){return this.initSectionedData(i).flatMap((e,s)=>{let n=[];e.header&&(n=this.createSectionHeader(e.header,s));const r=e.fields.map(l=>[{text:l.heading,classes:"dpr-row-heading"},{text:l.data,classes:"dpr-row-heading-data"}]);return[...n,...r]})}buildTable(i){return{head:[],rows:this.createRows(i),rowCount:i.length,colCount:this.columns.length}}}var S=c;0&&(module.exports={SectionedFieldsDataTableBuilder});
1
+ "use strict";var m=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var g=(a,i)=>{for(var t in i)o(a,t,{get:i[t],enumerable:!0})},h=(a,i,t,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of u(i))!F.call(a,e)&&e!==t&&o(a,e,{get:()=>i[e],enumerable:!(d=f(i,e))||d.enumerable});return a};var y=(a,i,t)=>(t=a!=null?m(D(a)):{},h(i||!a||!a.__esModule?o(t,"default",{value:a,enumerable:!0}):t,a)),C=a=>h(o({},"__esModule",{value:!0}),a);var T={};g(T,{SectionedFieldsDataTableBuilder:()=>c,default:()=>S});module.exports=C(T);var p=y(require("../ParentChildDataTableBuilder/ParentChildDataTableBuilder"));class c extends p.default{constructor(i){const{sectionedFields:t,template:d}=i.specification;super(i),this.sectionedFields=t,this.sections=this.sectionedFields.map(e=>e.name),this.template=d,this.childVariants=this.variant.childVariants||[]}getChildFields(i){const t=this.childVariants.find(e=>e.id===i);let d=[];if(t){const{specification:e}=t;d=e?e.fields:d}return d}getJoinKey(){return this.childVariants[0].joinFields[0]}initSectionedData(i){return i.flatMap(t=>this.sectionedFields.map(e=>{const s=this.mapNamesToFields([e.name])[0];let n=[];const{child:l}=e;return e.fields?n=this.mapNamesToFields(e.fields):e.child&&(n=this.getChildFields(e.child)),{header:s,fields:n,child:l}}).map(e=>{if(e.child){const s=this.getChildData(e.child),n=e.fields.filter(r=>r.visible),l=this.getJoinKey();return{header:e.header.display,fields:s?s.data.filter(r=>r[l]===t[l]).map(r=>({heading:r[n[0]?.name]||"Not found",data:r[n[1]?.name]||"Not found"})):[]}}return{header:e.header.display,fields:e.fields.filter(s=>s.visible).map(s=>({heading:s.display,data:t[s.name]}))}}))}getChildData(i){return this.childData.find(t=>t.id===i)}createRows(i){return this.initSectionedData(i).flatMap((e,s)=>{let n=[];e.header&&(n=this.createSectionHeader(e.header,s));const l=e.fields.map(r=>[{text:r.heading,classes:"dpr-row-heading"},{text:r.data,classes:"dpr-row-heading-data"}]);return[...n,...l]})}buildTable(i){return{head:[],rows:this.createRows(i),rowCount:i.length,colCount:this.columns.length}}}var S=c;0&&(module.exports={SectionedFieldsDataTableBuilder});
2
2
  //# sourceMappingURL=SectionedFieldsTableBuilder.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.ts"],
4
- "sourcesContent": ["import Dict = NodeJS.Dict\nimport { components } from '../../types/api'\nimport { Cell, DataTable, FieldDefinition } from '../DataTableBuilder/types'\nimport type { Template } from '../../types/Templates'\nimport ParentChildDataTableBuilder from '../ParentChildDataTableBuilder/ParentChildDataTableBuilder'\n\ninterface SectionedField {\n name: string\n fields?: string[]\n child?: string\n}\n\nclass SectionedFieldsDataTableBuilder extends ParentChildDataTableBuilder {\n // TODO: change this to use schema type if ever implemented in the backend\n sectionedFields: SectionedField[]\n\n override template: Template\n\n override childVariants: components['schemas']['ChildVariantDefinition'][]\n\n constructor(variant: components['schemas']['VariantDefinition']) {\n // TODO: removed the union if sectionedFields changed to use schema type\n const { sectionedFields, template } = variant.specification as components['schemas']['Specification'] & {\n sectionedFields: SectionedField[]\n }\n super(variant)\n\n this.sectionedFields = sectionedFields\n this.sections = this.sectionedFields.map((f) => f.name)\n this.template = template\n this.childVariants = this.variant.childVariants || []\n }\n\n getChildFields(childId: string): FieldDefinition[] {\n const childVariant = this.childVariants.find((child) => child.id === childId)\n let fields: FieldDefinition[] = []\n if (childVariant) {\n const { specification } = childVariant\n fields = specification ? specification.fields : fields\n }\n return fields\n }\n\n getJoinKey() {\n return this.childVariants[0].joinFields[0]\n }\n\n initSectionedData(data: Array<Dict<string>>) {\n return data.flatMap((row) => {\n const initialisedSectionsWithFields = this.sectionedFields.map((section) => {\n const sectionHeader = this.mapNamesToFields([section.name])[0]\n\n let fields: FieldDefinition[] = []\n const { child } = section\n\n if (section.fields) {\n fields = this.mapNamesToFields(section.fields)\n } else if (section.child) {\n fields = this.getChildFields(section.child)\n }\n\n return {\n header: sectionHeader,\n fields,\n child,\n }\n })\n\n return initialisedSectionsWithFields.map((section) => {\n if (section.child) {\n const childData = this.getChildData(section.child)\n const displayFields = section.fields.filter((f) => f.visible)\n const joinKey = this.getJoinKey()\n\n return {\n header: section.header.display,\n fields: childData\n ? childData.data\n .filter((cd) => cd[joinKey] === row[joinKey])\n .map((cd) => {\n return {\n heading: cd[displayFields[0]?.name] || 'Not found',\n data: cd[displayFields[1]?.name] || 'Not found',\n }\n })\n : [],\n }\n }\n return {\n header: section.header.display,\n fields: section.fields\n .filter((f) => f.visible)\n .map((f) => {\n return {\n heading: f.display,\n data: row[f.name],\n }\n }),\n }\n })\n })\n }\n\n getChildData(childId: string) {\n return this.childData.find((d) => d.id === childId)\n }\n\n createRows(data: Array<Dict<string>>): Cell[][] {\n const sectionedData = this.initSectionedData(data)\n\n const rows = sectionedData.flatMap((section, index) => {\n let sectionHeaderRow: Cell[][] = []\n if (section.header) {\n sectionHeaderRow = this.createSectionHeader(section.header, index)\n }\n\n const sectionRows = section.fields.map((field) => {\n return [\n {\n text: field.heading,\n classes: 'dpr-row-heading',\n },\n {\n text: field.data,\n classes: 'dpr-row-heading-data',\n },\n ]\n })\n\n return [...sectionHeaderRow, ...sectionRows]\n })\n\n return rows\n }\n\n override buildTable(data: Array<Dict<string>>): DataTable {\n return {\n head: [\n // { text: '', classes: 'dpr-row-section-header' },\n // { text: '', classes: 'dpr-row-section-header-value' },\n ],\n rows: this.createRows(data),\n rowCount: data.length,\n colCount: this.columns.length,\n }\n }\n}\n\nexport { SectionedFieldsDataTableBuilder }\nexport default SectionedFieldsDataTableBuilder\n"],
4
+ "sourcesContent": ["import Dict = NodeJS.Dict\nimport { components } from '../../types/api'\nimport { Cell, DataTable, FieldDefinition } from '../DataTableBuilder/types'\nimport type { Template } from '../../types/Templates'\nimport ParentChildDataTableBuilder from '../ParentChildDataTableBuilder/ParentChildDataTableBuilder'\n\nexport interface SectionedField {\n name: string\n fields?: string[]\n child?: string\n}\n\nclass SectionedFieldsDataTableBuilder extends ParentChildDataTableBuilder {\n // TODO: change this to use schema type if ever implemented in the backend\n sectionedFields: SectionedField[]\n\n override template: Template\n\n override childVariants: components['schemas']['ChildVariantDefinition'][]\n\n constructor(variant: components['schemas']['VariantDefinition']) {\n // TODO: removed the union if sectionedFields changed to use schema type\n const { sectionedFields, template } = variant.specification as components['schemas']['Specification'] & {\n sectionedFields: SectionedField[]\n }\n super(variant)\n\n this.sectionedFields = sectionedFields\n this.sections = this.sectionedFields.map((f) => f.name)\n this.template = template\n this.childVariants = this.variant.childVariants || []\n }\n\n getChildFields(childId: string): FieldDefinition[] {\n const childVariant = this.childVariants.find((child) => child.id === childId)\n let fields: FieldDefinition[] = []\n if (childVariant) {\n const { specification } = childVariant\n fields = specification ? specification.fields : fields\n }\n return fields\n }\n\n getJoinKey() {\n return this.childVariants[0].joinFields[0]\n }\n\n initSectionedData(data: Array<Dict<string>>) {\n return data.flatMap((row) => {\n const initialisedSectionsWithFields = this.sectionedFields.map((section) => {\n const sectionHeader = this.mapNamesToFields([section.name])[0]\n\n let fields: FieldDefinition[] = []\n const { child } = section\n\n if (section.fields) {\n fields = this.mapNamesToFields(section.fields)\n } else if (section.child) {\n fields = this.getChildFields(section.child)\n }\n\n return {\n header: sectionHeader,\n fields,\n child,\n }\n })\n\n return initialisedSectionsWithFields.map((section) => {\n if (section.child) {\n const childData = this.getChildData(section.child)\n const displayFields = section.fields.filter((f) => f.visible)\n const joinKey = this.getJoinKey()\n\n return {\n header: section.header.display,\n fields: childData\n ? childData.data\n .filter((cd) => cd[joinKey] === row[joinKey])\n .map((cd) => {\n return {\n heading: cd[displayFields[0]?.name] || 'Not found',\n data: cd[displayFields[1]?.name] || 'Not found',\n }\n })\n : [],\n }\n }\n return {\n header: section.header.display,\n fields: section.fields\n .filter((f) => f.visible)\n .map((f) => {\n return {\n heading: f.display,\n data: row[f.name],\n }\n }),\n }\n })\n })\n }\n\n getChildData(childId: string) {\n return this.childData.find((d) => d.id === childId)\n }\n\n createRows(data: Array<Dict<string>>): Cell[][] {\n const sectionedData = this.initSectionedData(data)\n\n const rows = sectionedData.flatMap((section, index) => {\n let sectionHeaderRow: Cell[][] = []\n if (section.header) {\n sectionHeaderRow = this.createSectionHeader(section.header, index)\n }\n\n const sectionRows = section.fields.map((field) => {\n return [\n {\n text: field.heading,\n classes: 'dpr-row-heading',\n },\n {\n text: field.data,\n classes: 'dpr-row-heading-data',\n },\n ]\n })\n\n return [...sectionHeaderRow, ...sectionRows]\n })\n\n return rows\n }\n\n override buildTable(data: Array<Dict<string>>): DataTable {\n return {\n head: [\n // { text: '', classes: 'dpr-row-section-header' },\n // { text: '', classes: 'dpr-row-section-header-value' },\n ],\n rows: this.createRows(data),\n rowCount: data.length,\n colCount: this.columns.length,\n }\n }\n}\n\nexport { SectionedFieldsDataTableBuilder }\nexport default SectionedFieldsDataTableBuilder\n"],
5
5
  "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAIA,IAAAK,EAAwC,yEAQxC,MAAMH,UAAwC,EAAAI,OAA4B,CAQxE,YAAYC,EAAqD,CAE/D,KAAM,CAAE,gBAAAC,EAAiB,SAAAC,CAAS,EAAIF,EAAQ,cAG9C,MAAMA,CAAO,EAEb,KAAK,gBAAkBC,EACvB,KAAK,SAAW,KAAK,gBAAgB,IAAKE,GAAMA,EAAE,IAAI,EACtD,KAAK,SAAWD,EAChB,KAAK,cAAgB,KAAK,QAAQ,eAAiB,CAAC,CACtD,CAEA,eAAeE,EAAoC,CACjD,MAAMC,EAAe,KAAK,cAAc,KAAMC,GAAUA,EAAM,KAAOF,CAAO,EAC5E,IAAIG,EAA4B,CAAC,EACjC,GAAIF,EAAc,CAChB,KAAM,CAAE,cAAAG,CAAc,EAAIH,EAC1BE,EAASC,EAAgBA,EAAc,OAASD,CAClD,CACA,OAAOA,CACT,CAEA,YAAa,CACX,OAAO,KAAK,cAAc,CAAC,EAAE,WAAW,CAAC,CAC3C,CAEA,kBAAkBE,EAA2B,CAC3C,OAAOA,EAAK,QAASC,GACmB,KAAK,gBAAgB,IAAKC,GAAY,CAC1E,MAAMC,EAAgB,KAAK,iBAAiB,CAACD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,CACE,KAAMA,EAAM,QACZ,QAAS,iBACX,EACA,CACE,KAAMA,EAAM,KACZ,QAAS,sBACX,CACF,CACD,EAED,MAAO,CAAC,GAAGF,EAAkB,GAAGC,CAAW,CAC7C,CAAC,CAGH,CAES,WAAWX,EAAsC,CACxD,MAAO,CACL,KAAM,CAGN,EACA,KAAM,KAAK,WAAWA,CAAI,EAC1B,SAAUA,EAAK,OACf,SAAU,KAAK,QAAQ,MACzB,CACF,CACF,CAGA,IAAOb,EAAQD",
6
6
  "names": ["SectionedFieldsTableBuilder_exports", "__export", "SectionedFieldsDataTableBuilder", "SectionedFieldsTableBuilder_default", "__toCommonJS", "import_ParentChildDataTableBuilder", "ParentChildDataTableBuilder", "variant", "sectionedFields", "template", "f", "childId", "childVariant", "child", "fields", "specification", "data", "row", "section", "sectionHeader", "childData", "displayFields", "joinKey", "cd", "d", "index", "sectionHeaderRow", "sectionRows", "field"]
7
7
  }
@@ -4,7 +4,7 @@ import { Cell, DataTable, FieldDefinition } from '../DataTableBuilder/types'
4
4
  import type { Template } from '../../types/Templates'
5
5
  import ParentChildDataTableBuilder from '../ParentChildDataTableBuilder/ParentChildDataTableBuilder'
6
6
 
7
- interface SectionedField {
7
+ export interface SectionedField {
8
8
  name: string
9
9
  fields?: string[]
10
10
  child?: string
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": "4.24.0",
4
+ "version": "4.25.0",
5
5
  "main": "dpr/all.mjs",
6
6
  "sass": "dpr/all.scss",
7
7
  "engines": {
@@ -155,7 +155,7 @@
155
155
  "dayjs": "^1.11.12",
156
156
  "express": "^5.1.0",
157
157
  "express-session": "^1.18.2",
158
- "govuk-frontend": "^5.11.0",
158
+ "govuk-frontend": "^5.13.0",
159
159
  "jquery": "^3.7.1",
160
160
  "json-2-csv": "^5.5.6",
161
161
  "nocache": "^4.0.0",
@@ -169,8 +169,6 @@
169
169
  },
170
170
  "devDependencies": {
171
171
  "@11ty/eleventy": "^2.0.1",
172
- "@badeball/cypress-cucumber-preprocessor": "^22.2.0",
173
- "@bahmutov/cypress-esbuild-preprocessor": "^2.2.5",
174
172
  "@jest/globals": "^30.2.0",
175
173
  "@ministryofjustice/hmpps-npm-script-allowlist": "0.0.3",
176
174
  "@testing-library/cypress": "^10.0.3",
@@ -199,7 +197,7 @@
199
197
  "cypress-multi-reporters": "^1.6.3",
200
198
  "cypress-xpath": "^2.0.1",
201
199
  "del": "^7.1.0",
202
- "esbuild": "^0.25.5",
200
+ "esbuild": "^0.27.2",
203
201
  "esbuild-plugin-clean": "^1.0.1",
204
202
  "esbuild-plugin-copy": "^2.1.1",
205
203
  "esbuild-plugin-manifest": "^1.0.5",