@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.16.1 → 4.17.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.
Files changed (79) hide show
  1. package/dpr/components/_catalogue/catalogue/utils.js +1 -1
  2. package/dpr/components/_catalogue/catalogue/utils.js.map +3 -3
  3. package/dpr/components/_catalogue/catalogue/utils.test.ts +15 -1
  4. package/dpr/components/_catalogue/catalogue/utils.ts +22 -4
  5. package/dpr/components/_catalogue/catalogue/view.njk +2 -1
  6. package/dpr/components/_catalogue/catalogue-filters/view.njk +2 -2
  7. package/dpr/components/_catalogue/catalogue-search/clientClass.mjs +14 -0
  8. package/dpr/components/_catalogue/catalogue-search/view.njk +24 -1
  9. package/dpr/data/dprReportingClient.js +1 -1
  10. package/dpr/data/dprReportingClient.js.map +3 -3
  11. package/dpr/data/dprReportingClient.ts +2 -0
  12. package/dpr/middleware/setUpDprResources.js +1 -1
  13. package/dpr/middleware/setUpDprResources.js.map +3 -3
  14. package/dpr/middleware/setUpDprResources.test.ts +7 -0
  15. package/dpr/middleware/setUpDprResources.ts +17 -2
  16. package/dpr/routes/journeys/download-report/tests.cy.js +1 -1
  17. package/dpr/routes/journeys/download-report/tests.cy.js.map +2 -2
  18. package/dpr/routes/journeys/download-report/tests.cy.ts +1 -0
  19. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.js +1 -1
  20. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.js.map +2 -2
  21. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.ts +2 -0
  22. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.js +1 -1
  23. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.js.map +2 -2
  24. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.ts +1 -0
  25. package/dpr/routes/journeys/product-collection/routes.js +2 -0
  26. package/dpr/routes/journeys/product-collection/routes.js.map +7 -0
  27. package/dpr/routes/journeys/product-collection/routes.ts +28 -0
  28. package/dpr/routes/journeys/product-collection/selected/controller.js +2 -0
  29. package/dpr/routes/journeys/product-collection/selected/controller.js.map +7 -0
  30. package/dpr/routes/journeys/product-collection/selected/controller.ts +29 -0
  31. package/dpr/routes/journeys/product-collection/selected/routes.js +2 -0
  32. package/dpr/routes/journeys/product-collection/selected/routes.js.map +7 -0
  33. package/dpr/routes/journeys/product-collection/selected/routes.ts +15 -0
  34. package/dpr/routes/journeys/product-collection/selected/tests.cy.js +2 -0
  35. package/dpr/routes/journeys/product-collection/selected/tests.cy.js.map +7 -0
  36. package/dpr/routes/journeys/product-collection/selected/tests.cy.ts +54 -0
  37. package/dpr/routes/journeys/product-collection/selected/validation.js +2 -0
  38. package/dpr/routes/journeys/product-collection/selected/validation.js.map +7 -0
  39. package/dpr/routes/journeys/product-collection/selected/validation.ts +5 -0
  40. package/dpr/routes/journeys/request-missing-report/tests.cy.js +1 -1
  41. package/dpr/routes/journeys/request-missing-report/tests.cy.js.map +2 -2
  42. package/dpr/routes/journeys/request-missing-report/tests.cy.ts +1 -0
  43. package/dpr/routes/journeys/request-report/status/tests.cy.js +1 -1
  44. package/dpr/routes/journeys/request-report/status/tests.cy.js.map +2 -2
  45. package/dpr/routes/journeys/request-report/status/tests.cy.ts +1 -0
  46. package/dpr/routes/journeys/request-report/tests.cy.js +1 -1
  47. package/dpr/routes/journeys/request-report/tests.cy.js.map +2 -2
  48. package/dpr/routes/journeys/request-report/tests.cy.ts +3 -14
  49. package/dpr/routes/journeys/routes.js +1 -1
  50. package/dpr/routes/journeys/routes.js.map +2 -2
  51. package/dpr/routes/journeys/routes.ts +2 -0
  52. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.js +1 -1
  53. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.js.map +2 -2
  54. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.ts +1 -0
  55. package/dpr/routes/journeys/view-report/async/report/tests.cy.js +1 -1
  56. package/dpr/routes/journeys/view-report/async/report/tests.cy.js.map +2 -2
  57. package/dpr/routes/journeys/view-report/async/report/tests.cy.ts +2 -0
  58. package/dpr/routes/journeys/view-report/sync/tests.cy.js +1 -1
  59. package/dpr/routes/journeys/view-report/sync/tests.cy.js.map +2 -2
  60. package/dpr/routes/journeys/view-report/sync/tests.cy.ts +1 -0
  61. package/dpr/services/productCollection/productCollectionService.js +2 -0
  62. package/dpr/services/productCollection/productCollectionService.js.map +7 -0
  63. package/dpr/services/productCollection/productCollectionService.ts +25 -0
  64. package/dpr/services/productCollection/productCollectionStoreService.js +2 -0
  65. package/dpr/services/productCollection/productCollectionStoreService.js.map +7 -0
  66. package/dpr/services/productCollection/productCollectionStoreService.ts +26 -0
  67. package/dpr/types/ReportStore.js +1 -1
  68. package/dpr/types/ReportStore.js.map +1 -1
  69. package/dpr/types/ReportStore.ts +1 -0
  70. package/dpr/types/Services.d.js +1 -1
  71. package/dpr/types/Services.d.js.map +1 -1
  72. package/dpr/types/Services.d.ts +13 -0
  73. package/dpr/types/api.d.js +1 -1
  74. package/dpr/types/api.d.js.map +1 -1
  75. package/dpr/types/api.d.ts +195 -2
  76. package/dpr/utils/ReportStoreServiceUtils.js +1 -1
  77. package/dpr/utils/ReportStoreServiceUtils.js.map +3 -3
  78. package/dpr/utils/ReportStoreServiceUtils.ts +7 -0
  79. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- var b=Object.create;var t=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var c=(o,e)=>{for(var n in e)t(o,n,{get:e[n],enumerable:!0})},r=(o,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of m(e))!p.call(o,a)&&a!==n&&t(o,a,{get:()=>e[a],enumerable:!(i=u(e,a))||i.enumerable});return o};var l=(o,e,n)=>(n=o!=null?b(E(o)):{},r(e||!o||!o.__esModule?t(n,"default",{value:o,enumerable:!0}):n,o)),k=o=>r(t({},"__esModule",{value:!0}),o);var T={};c(T,{default:()=>h,init:()=>g});module.exports=k(T);var d=l(require("../catalogue-list/utils")),s=l(require("../../../utils/localsHelper"));const g=async({features:o,res:e,services:n})=>({data:await d.default.getReportsList(e,n,o),features:f(e,o)}),f=(o,e)=>{const{bookmarkingEnabled:n}=s.default.getValues(o);return{filteringEnabled:e?.filteringEnabled===void 0||e.filteringEnabled,unauthorisedToggleEnabled:e?.unauthorisedToggleEnabled===void 0||e.unauthorisedToggleEnabled,howToUseEnabled:e?.howToUseEnabled===void 0||e.howToUseEnabled,bookmarkingEnabled:e?.bookmarkingEnabled!==void 0?e.bookmarkingEnabled:n}};var h={init:g};0&&(module.exports={init});
1
+ var C=Object.create;var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var w=(o,e)=>{for(var t in e)a(o,t,{get:e[t],enumerable:!0})},s=(o,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of k(e))!S.call(o,n)&&n!==t&&a(o,n,{get:()=>e[n],enumerable:!(l=f(e,n))||l.enumerable});return o};var g=(o,e,t)=>(t=o!=null?C(h(o)):{},s(e||!o||!o.__esModule?a(t,"default",{value:o,enumerable:!0}):t,o)),T=o=>s(a({},"__esModule",{value:!0}),o);var P={};w(P,{default:()=>F,init:()=>m});module.exports=T(P);var b=g(require("../catalogue-list/utils")),p=g(require("../../../utils/localsHelper"));const m=async({features:o,res:e,services:t})=>{const l=await b.default.getReportsList(e,t,o),{token:n,bookmarkingEnabled:E,dprUser:d}=p.default.getValues(e),i=(await t.productCollectionService.getProductCollections(n))?.map(u=>({value:u.id,text:u.name}));i&&i.length>0&&i.unshift({value:"RESET",text:"Full catalogue"});const r=await t.productCollectionStoreService.getSelectedProductCollectionId(d.id),c=r&&await t.productCollectionService.getProductCollection(d.id,r);return{data:l,productCollectionInfo:{productCollections:i,...c&&{selectedProductCollection:c}},features:v(E,o)}},v=(o,e)=>({filteringEnabled:e?.filteringEnabled===void 0||e.filteringEnabled,unauthorisedToggleEnabled:e?.unauthorisedToggleEnabled===void 0||e.unauthorisedToggleEnabled,howToUseEnabled:e?.howToUseEnabled===void 0||e.howToUseEnabled,bookmarkingEnabled:e?.bookmarkingEnabled!==void 0?e.bookmarkingEnabled:o});var F={init:m};0&&(module.exports={init});
2
2
  //# sourceMappingURL=utils.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/dpr/components/_catalogue/catalogue/utils.ts"],
4
- "sourcesContent": ["import { Response } from 'express'\nimport CatalogueListUtils from '../catalogue-list/utils'\nimport { Services } from '../../../types/Services'\nimport LocalsHelper from '../../../utils/localsHelper'\nimport { CatalogueFeatures } from './types'\n\nexport const init = async ({\n features,\n res,\n services,\n}: {\n features?: CatalogueFeatures\n res: Response\n services: Services\n}) => {\n const data = await CatalogueListUtils.getReportsList(res, services, features)\n return {\n data,\n features: setFeatures(res, features),\n }\n}\n\nconst setFeatures = (res: Response, features?: CatalogueFeatures) => {\n const { bookmarkingEnabled } = LocalsHelper.getValues(res)\n\n return {\n filteringEnabled: features?.filteringEnabled === undefined || features.filteringEnabled,\n unauthorisedToggleEnabled: features?.unauthorisedToggleEnabled === undefined || features.unauthorisedToggleEnabled,\n howToUseEnabled: features?.howToUseEnabled === undefined || features.howToUseEnabled,\n bookmarkingEnabled: features?.bookmarkingEnabled !== undefined ? features.bookmarkingEnabled : bookmarkingEnabled,\n }\n}\n\nexport default {\n init,\n}\n"],
5
- "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,SAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAA+B,sCAE/BC,EAAyB,0CAGlB,MAAMH,EAAO,MAAO,CACzB,SAAAI,EACA,IAAAC,EACA,SAAAC,CACF,KAMS,CACL,KAFW,MAAM,EAAAC,QAAmB,eAAeF,EAAKC,EAAUF,CAAQ,EAG1E,SAAUI,EAAYH,EAAKD,CAAQ,CACrC,GAGII,EAAc,CAACH,EAAeD,IAAiC,CACnE,KAAM,CAAE,mBAAAK,CAAmB,EAAI,EAAAC,QAAa,UAAUL,CAAG,EAEzD,MAAO,CACL,iBAAkBD,GAAU,mBAAqB,QAAaA,EAAS,iBACvE,0BAA2BA,GAAU,4BAA8B,QAAaA,EAAS,0BACzF,gBAAiBA,GAAU,kBAAoB,QAAaA,EAAS,gBACrE,mBAAoBA,GAAU,qBAAuB,OAAYA,EAAS,mBAAqBK,CACjG,CACF,EAEA,IAAOV,EAAQ,CACb,KAAAC,CACF",
6
- "names": ["utils_exports", "__export", "utils_default", "init", "__toCommonJS", "import_utils", "import_localsHelper", "features", "res", "services", "CatalogueListUtils", "setFeatures", "bookmarkingEnabled", "LocalsHelper"]
4
+ "sourcesContent": ["import { Response } from 'express'\nimport CatalogueListUtils from '../catalogue-list/utils'\nimport { Services } from '../../../types/Services'\nimport LocalsHelper from '../../../utils/localsHelper'\nimport { CatalogueFeatures } from './types'\n\nexport const init = async ({\n features,\n res,\n services,\n}: {\n features?: CatalogueFeatures\n res: Response\n services: Services\n}) => {\n const data = await CatalogueListUtils.getReportsList(res, services, features)\n const { token, bookmarkingEnabled, dprUser } = LocalsHelper.getValues(res)\n const productCollections = (await services.productCollectionService.getProductCollections(token))?.map(\n (collection) => ({\n value: collection.id,\n text: collection.name,\n }),\n )\n if (productCollections && productCollections.length > 0) {\n productCollections.unshift({ value: 'RESET', text: 'Full catalogue' })\n }\n const selectedProductCollectionId = await services.productCollectionStoreService.getSelectedProductCollectionId(\n dprUser.id,\n )\n const selectedProductCollection =\n selectedProductCollectionId &&\n (await services.productCollectionService.getProductCollection(dprUser.id, selectedProductCollectionId))\n return {\n data,\n productCollectionInfo: {\n productCollections,\n ...(selectedProductCollection && { selectedProductCollection }),\n },\n features: setFeatures(bookmarkingEnabled, features),\n }\n}\n\nconst setFeatures = (bookmarkingEnabled: boolean, features?: CatalogueFeatures) => {\n return {\n filteringEnabled: features?.filteringEnabled === undefined || features.filteringEnabled,\n unauthorisedToggleEnabled: features?.unauthorisedToggleEnabled === undefined || features.unauthorisedToggleEnabled,\n howToUseEnabled: features?.howToUseEnabled === undefined || features.howToUseEnabled,\n bookmarkingEnabled: features?.bookmarkingEnabled !== undefined ? features.bookmarkingEnabled : bookmarkingEnabled,\n }\n}\n\nexport default {\n init,\n}\n"],
5
+ "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,SAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAA+B,sCAE/BC,EAAyB,0CAGlB,MAAMH,EAAO,MAAO,CACzB,SAAAI,EACA,IAAAC,EACA,SAAAC,CACF,IAIM,CACJ,MAAMC,EAAO,MAAM,EAAAC,QAAmB,eAAeH,EAAKC,EAAUF,CAAQ,EACtE,CAAE,MAAAK,EAAO,mBAAAC,EAAoB,QAAAC,CAAQ,EAAI,EAAAC,QAAa,UAAUP,CAAG,EACnEQ,GAAsB,MAAMP,EAAS,yBAAyB,sBAAsBG,CAAK,IAAI,IAChGK,IAAgB,CACf,MAAOA,EAAW,GAClB,KAAMA,EAAW,IACnB,EACF,EACID,GAAsBA,EAAmB,OAAS,GACpDA,EAAmB,QAAQ,CAAE,MAAO,QAAS,KAAM,gBAAiB,CAAC,EAEvE,MAAME,EAA8B,MAAMT,EAAS,8BAA8B,+BAC/EK,EAAQ,EACV,EACMK,EACJD,GACC,MAAMT,EAAS,yBAAyB,qBAAqBK,EAAQ,GAAII,CAA2B,EACvG,MAAO,CACL,KAAAR,EACA,sBAAuB,CACrB,mBAAAM,EACA,GAAIG,GAA6B,CAAE,0BAAAA,CAA0B,CAC/D,EACA,SAAUC,EAAYP,EAAoBN,CAAQ,CACpD,CACF,EAEMa,EAAc,CAACP,EAA6BN,KACzC,CACL,iBAAkBA,GAAU,mBAAqB,QAAaA,EAAS,iBACvE,0BAA2BA,GAAU,4BAA8B,QAAaA,EAAS,0BACzF,gBAAiBA,GAAU,kBAAoB,QAAaA,EAAS,gBACrE,mBAAoBA,GAAU,qBAAuB,OAAYA,EAAS,mBAAqBM,CACjG,GAGF,IAAOX,EAAQ,CACb,KAAAC,CACF",
6
+ "names": ["utils_exports", "__export", "utils_default", "init", "__toCommonJS", "import_utils", "import_localsHelper", "features", "res", "services", "data", "CatalogueListUtils", "token", "bookmarkingEnabled", "dprUser", "LocalsHelper", "productCollections", "collection", "selectedProductCollectionId", "selectedProductCollection", "setFeatures"]
7
7
  }
@@ -22,7 +22,15 @@ describe('CatalogueUtils', () => {
22
22
  },
23
23
  } as unknown as Response
24
24
 
25
- services = {} as unknown as Services
25
+ services = {
26
+ productCollectionService: {
27
+ getProductCollections: jest.fn(() => []),
28
+ getProductCollection: jest.fn(),
29
+ },
30
+ productCollectionStoreService: {
31
+ getSelectedProductCollectionId: jest.fn(),
32
+ },
33
+ } as unknown as Services
26
34
  })
27
35
 
28
36
  it('should init the catalogue with defaults', async () => {
@@ -36,6 +44,9 @@ describe('CatalogueUtils', () => {
36
44
  howToUseEnabled: true,
37
45
  unauthorisedToggleEnabled: true,
38
46
  },
47
+ productCollectionInfo: {
48
+ productCollections: [],
49
+ },
39
50
  })
40
51
  })
41
52
 
@@ -58,6 +69,9 @@ describe('CatalogueUtils', () => {
58
69
  howToUseEnabled: true,
59
70
  unauthorisedToggleEnabled: false,
60
71
  },
72
+ productCollectionInfo: {
73
+ productCollections: [],
74
+ },
61
75
  })
62
76
  })
63
77
  })
@@ -14,15 +14,33 @@ export const init = async ({
14
14
  services: Services
15
15
  }) => {
16
16
  const data = await CatalogueListUtils.getReportsList(res, services, features)
17
+ const { token, bookmarkingEnabled, dprUser } = LocalsHelper.getValues(res)
18
+ const productCollections = (await services.productCollectionService.getProductCollections(token))?.map(
19
+ (collection) => ({
20
+ value: collection.id,
21
+ text: collection.name,
22
+ }),
23
+ )
24
+ if (productCollections && productCollections.length > 0) {
25
+ productCollections.unshift({ value: 'RESET', text: 'Full catalogue' })
26
+ }
27
+ const selectedProductCollectionId = await services.productCollectionStoreService.getSelectedProductCollectionId(
28
+ dprUser.id,
29
+ )
30
+ const selectedProductCollection =
31
+ selectedProductCollectionId &&
32
+ (await services.productCollectionService.getProductCollection(dprUser.id, selectedProductCollectionId))
17
33
  return {
18
34
  data,
19
- features: setFeatures(res, features),
35
+ productCollectionInfo: {
36
+ productCollections,
37
+ ...(selectedProductCollection && { selectedProductCollection }),
38
+ },
39
+ features: setFeatures(bookmarkingEnabled, features),
20
40
  }
21
41
  }
22
42
 
23
- const setFeatures = (res: Response, features?: CatalogueFeatures) => {
24
- const { bookmarkingEnabled } = LocalsHelper.getValues(res)
25
-
43
+ const setFeatures = (bookmarkingEnabled: boolean, features?: CatalogueFeatures) => {
26
44
  return {
27
45
  filteringEnabled: features?.filteringEnabled === undefined || features.filteringEnabled,
28
46
  unauthorisedToggleEnabled: features?.unauthorisedToggleEnabled === undefined || features.unauthorisedToggleEnabled,
@@ -5,6 +5,7 @@
5
5
  {% macro dprCatalogue(args) %}
6
6
  {% set data = args.data %}
7
7
  {% set features = args.features %}
8
+ {% set productCollectionInfo = args.productCollectionInfo %}
8
9
 
9
10
  {% set head = data.head %}
10
11
  {% set rows = data.rows %}
@@ -16,7 +17,7 @@
16
17
  {{ dprCatalogueHowToUse(features) }}
17
18
  {% endif %}
18
19
 
19
- {{ dprCatalogueFilters(id, features) }}
20
+ {{ dprCatalogueFilters(id, features, productCollectionInfo) }}
20
21
  {{ dprCatalogueList(head, rows, id) }}
21
22
  <div>
22
23
  {% endmacro %}
@@ -3,14 +3,14 @@
3
3
  {% from "../catalogue-search/view.njk" import dprCatalogueSearch %}
4
4
  {% from "../catalogue-unauthorised-toggle/view.njk" import dprUnauthorisedToggle %}
5
5
 
6
- {% macro dprCatalogueFilters(id, features) %}
6
+ {% macro dprCatalogueFilters(id, features, productCollectionInfo) %}
7
7
  {% set filteringEnabled = features.filteringEnabled %}
8
8
  {% set unauthorisedToggleEnabled = features.unauthorisedToggleEnabled %}
9
9
 
10
10
  <div class='dpr-catalogue-filters' data-dpr-module='dpr-catalogue-filters'>
11
11
  <div class='dpr-catalogue-filters--heading'>
12
12
  <div class="dpr-catalogue-filters__search">
13
- {{ dprCatalogueSearch(id) }}
13
+ {{ dprCatalogueSearch(id, productCollectionInfo) }}
14
14
  </div>
15
15
  </div>
16
16
  <div class='dpr-catalogue-filters--content'>
@@ -17,9 +17,23 @@ class DprCatalogueSearch extends DprCatalogueFilters {
17
17
  this.initSeachBoxEvents()
18
18
  this.updateTableRows()
19
19
  this.initSearchInputFromQueryParams()
20
+ this.initProductCollectionSelect()
20
21
  }
21
22
  }
22
23
 
24
+ initProductCollectionSelect() {
25
+ /**
26
+ * @type {HTMLSelectElement | undefined}
27
+ */
28
+ const productCollections = this.getElement().querySelector('#productCollection')
29
+ if (productCollections) {
30
+ productCollections.addEventListener('change', (e) => {
31
+ e.preventDefault()
32
+ productCollections.closest('form').submit()
33
+ })
34
+ }
35
+ }
36
+
23
37
  initSeachBoxEvents() {
24
38
  this.searchBox.addEventListener('keyup', (e) => {
25
39
  this.updateTableRows(e.target.value)
@@ -1,6 +1,10 @@
1
1
  {% from "govuk/components/input/macro.njk" import govukInput %}
2
+ {% from "govuk/components/select/macro.njk" import govukSelect %}
3
+
4
+ {% macro dprCatalogueSearch(id, productCollectionInfo, type = 'catalogue') %}
5
+ {% set productCollections = productCollectionInfo.productCollections %}
6
+ {% set selectedProductCollection = productCollectionInfo.selectedProductCollection %}
2
7
 
3
- {% macro dprCatalogueSearch(id, type = 'catalogue') %}
4
8
  <div class="dpr-search" data-dpr-module="dpr-catalogue-search">
5
9
  <div class="dpr-search-inputs">
6
10
  {{ govukInput({
@@ -17,6 +21,25 @@
17
21
  "data-table-id": id
18
22
  }
19
23
  }) }}
24
+ {% if productCollections.length > 0 %}
25
+ <form method="post" action="dpr/product-collection/selected">
26
+ {{ govukSelect({
27
+ id: 'productCollection',
28
+ name: 'productCollection',
29
+ value: selectedProductCollection.id,
30
+ formGroup: {
31
+ attributes: {
32
+ style: "justify-self: end;"
33
+ }
34
+ },
35
+ items: productCollections,
36
+ label: {
37
+ text: 'Your collections',
38
+ classes: "govuk-label govuk-!-font-weight-bold govuk-!-margin-bottom-2"
39
+ }
40
+ }) }}
41
+ </form>
42
+ {% endif %}
20
43
  </div>
21
44
  </div>
22
45
  {% endmacro %}
@@ -1,2 +1,2 @@
1
- var d=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of g(e))!D.call(t,i)&&i!==r&&o(t,i,{get:()=>e[i],enumerable:!(p=f(e,i))||p.enumerable});return t};var n=(t,e,r)=>(r=t!=null?d(w(t)):{},m(e||!t||!t.__esModule?o(r,"default",{value:t,enumerable:!0}):r,t)),h=t=>m(o({},"__esModule",{value:!0}),t);var x={};b(x,{default:()=>u,initDprReportingClients:()=>R});module.exports=h(x);var s=n(require("./reportingClient")),l=n(require("./dashboardClient")),a=n(require("./reportDataStore")),C=n(require("../services/missingReport/missingReportClient"));const R=(t,e,r)=>({reportingClient:new s.default(t),dashboardClient:new l.default(t),reportDataStore:new a.default(e,r),missingReportClient:new C.default(t)});var u=R;0&&(module.exports={initDprReportingClients});
1
+ var R=Object.create;var i=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of w(e))!D.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(l=f(e,o))||l.enumerable});return t};var n=(t,e,r)=>(r=t!=null?R(u(t)):{},m(e||!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),b=t=>m(i({},"__esModule",{value:!0}),t);var h={};S(h,{default:()=>g,initDprReportingClients:()=>c});module.exports=b(h);var p=n(require("./reportingClient")),s=n(require("./dashboardClient")),C=n(require("./reportDataStore")),a=n(require("../services/missingReport/missingReportClient")),d=require("../services/productCollection/productCollectionService");const c=(t,e,r)=>({reportingClient:new p.default(t),dashboardClient:new s.default(t),reportDataStore:new C.default(e,r),missingReportClient:new a.default(t),productCollectionService:new d.ProductCollectionService(t)});var g=c;0&&(module.exports={initDprReportingClients});
2
2
  //# sourceMappingURL=dprReportingClient.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/dpr/data/dprReportingClient.ts"],
4
- "sourcesContent": ["import ReportingClient from './reportingClient'\nimport DashboardClient from './dashboardClient'\nimport ReportDataStore, { RedisClient } from './reportDataStore'\nimport { ApiConfig } from './types'\nimport MissingReportClient from '../services/missingReport/missingReportClient'\n\nexport const initDprReportingClients = (\n reportingApiConfig: ApiConfig,\n redisClient: RedisClient,\n storePrefix?: string,\n) => {\n return {\n reportingClient: new ReportingClient(reportingApiConfig),\n dashboardClient: new DashboardClient(reportingApiConfig),\n reportDataStore: new ReportDataStore(redisClient, storePrefix),\n missingReportClient: new MissingReportClient(reportingApiConfig),\n }\n}\n\nexport default initDprReportingClients\n"],
5
- "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,4BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA4B,gCAC5BC,EAA4B,gCAC5BC,EAA6C,gCAE7CC,EAAgC,4DAEzB,MAAML,EAA0B,CACrCM,EACAC,EACAC,KAEO,CACL,gBAAiB,IAAI,EAAAC,QAAgBH,CAAkB,EACvD,gBAAiB,IAAI,EAAAI,QAAgBJ,CAAkB,EACvD,gBAAiB,IAAI,EAAAK,QAAgBJ,EAAaC,CAAW,EAC7D,oBAAqB,IAAI,EAAAI,QAAoBN,CAAkB,CACjE,GAGF,IAAOP,EAAQC",
6
- "names": ["dprReportingClient_exports", "__export", "dprReportingClient_default", "initDprReportingClients", "__toCommonJS", "import_reportingClient", "import_dashboardClient", "import_reportDataStore", "import_missingReportClient", "reportingApiConfig", "redisClient", "storePrefix", "ReportingClient", "DashboardClient", "ReportDataStore", "MissingReportClient"]
4
+ "sourcesContent": ["import ReportingClient from './reportingClient'\nimport DashboardClient from './dashboardClient'\nimport ReportDataStore, { RedisClient } from './reportDataStore'\nimport { ApiConfig } from './types'\nimport MissingReportClient from '../services/missingReport/missingReportClient'\nimport { ProductCollectionService } from '../services/productCollection/productCollectionService'\n\nexport const initDprReportingClients = (\n reportingApiConfig: ApiConfig,\n redisClient: RedisClient,\n storePrefix?: string,\n) => {\n return {\n reportingClient: new ReportingClient(reportingApiConfig),\n dashboardClient: new DashboardClient(reportingApiConfig),\n reportDataStore: new ReportDataStore(redisClient, storePrefix),\n missingReportClient: new MissingReportClient(reportingApiConfig),\n productCollectionService: new ProductCollectionService(reportingApiConfig),\n }\n}\n\nexport default initDprReportingClients\n"],
5
+ "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,4BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA4B,gCAC5BC,EAA4B,gCAC5BC,EAA6C,gCAE7CC,EAAgC,4DAChCC,EAAyC,kEAElC,MAAMN,EAA0B,CACrCO,EACAC,EACAC,KAEO,CACL,gBAAiB,IAAI,EAAAC,QAAgBH,CAAkB,EACvD,gBAAiB,IAAI,EAAAI,QAAgBJ,CAAkB,EACvD,gBAAiB,IAAI,EAAAK,QAAgBJ,EAAaC,CAAW,EAC7D,oBAAqB,IAAI,EAAAI,QAAoBN,CAAkB,EAC/D,yBAA0B,IAAI,2BAAyBA,CAAkB,CAC3E,GAGF,IAAOR,EAAQC",
6
+ "names": ["dprReportingClient_exports", "__export", "dprReportingClient_default", "initDprReportingClients", "__toCommonJS", "import_reportingClient", "import_dashboardClient", "import_reportDataStore", "import_missingReportClient", "import_productCollectionService", "reportingApiConfig", "redisClient", "storePrefix", "ReportingClient", "DashboardClient", "ReportDataStore", "MissingReportClient"]
7
7
  }
@@ -3,6 +3,7 @@ import DashboardClient from './dashboardClient'
3
3
  import ReportDataStore, { RedisClient } from './reportDataStore'
4
4
  import { ApiConfig } from './types'
5
5
  import MissingReportClient from '../services/missingReport/missingReportClient'
6
+ import { ProductCollectionService } from '../services/productCollection/productCollectionService'
6
7
 
7
8
  export const initDprReportingClients = (
8
9
  reportingApiConfig: ApiConfig,
@@ -14,6 +15,7 @@ export const initDprReportingClients = (
14
15
  dashboardClient: new DashboardClient(reportingApiConfig),
15
16
  reportDataStore: new ReportDataStore(redisClient, storePrefix),
16
17
  missingReportClient: new MissingReportClient(reportingApiConfig),
18
+ productCollectionService: new ProductCollectionService(reportingApiConfig),
17
19
  }
18
20
  }
19
21
 
@@ -1,2 +1,2 @@
1
- var g=Object.create;var l=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var y=(t,o)=>{for(var e in o)l(t,e,{get:o[e],enumerable:!0})},f=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of D(o))!k.call(t,i)&&i!==e&&l(t,i,{get:()=>o[i],enumerable:!(r=h(o,i))||r.enumerable});return t};var u=(t,o,e)=>(e=t!=null?g(S(t)):{},f(o||!t||!t.__esModule?l(e,"default",{value:t,enumerable:!0}):e,t)),q=t=>f(l({},"__esModule",{value:!0}),t);var v={};y(v,{default:()=>b,populateDefinitions:()=>P,populateRequestedReports:()=>R,setupResources:()=>m});module.exports=q(v);var c=u(require("../utils/definitionUtils")),p=u(require("../utils/localsHelper"));const w=(t,o)=>t[o]?t[o].toString():null,C=t=>w(t,"dataProductDefinitionsPath"),Q=t=>{const o=C(t);return o||null},m=(t,o)=>async(e,r,i)=>{V(e,r);try{return await P(t,e,r,o),await R(t,r),i()}catch(a){return i(a)}},V=(t,o)=>{const e=t.flash("DPR_ERRORS");e&&e[0]&&(o.locals.validationErrors=JSON.parse(e[0]))},P=async(t,o,e,r)=>{const{token:i}=p.default.getValues(e),a=Q(o.query),d=o.body?.dataProductDefinitionsPath,n=a||d;n&&(e.locals.dpdPathFromQuery=!0);const s=r?.dataProductDefinitionsPath;s&&(e.locals.dpdPathFromConfig=!0),e.locals.definitionsPath=n||s,e.locals.pathSuffix=`?dataProductDefinitionsPath=${e.locals.definitionsPath}`,i&&t.reportingService&&(e.locals.definitions=await t.reportingService.getDefinitions(i,e.locals.definitionsPath))},R=async(t,o)=>{const{dprUser:e}=p.default.getValues(o);if(e.id){const{definitions:r,definitionsPath:i}=o.locals,a=await t.requestedReportService.getAllReports(e.id);o.locals.requestedReports=i?a.filter(n=>c.default.getCurrentVariantDefinition(r,n.reportId,n.id)):a;const d=await t.recentlyViewedService.getAllReports(e.id);if(o.locals.recentlyViewedReports=i?d.filter(n=>c.default.getCurrentVariantDefinition(r,n.reportId,n.id)):d,t.bookmarkService){o.locals.bookmarkingEnabled=!0;const n=await t.bookmarkService.getAllBookmarks(e.id);o.locals.bookmarks=i?n.filter(s=>c.default.getCurrentVariantDefinition(r,s.reportId,s.id)):n}t.downloadPermissionService&&(o.locals.downloadingEnabled=!0)}};var b=m;0&&(module.exports={populateDefinitions,populateRequestedReports,setupResources});
1
+ var w=Object.create;var l=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var b=(t,o)=>{for(var e in o)l(t,e,{get:o[e],enumerable:!0})},g=(t,o,e,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of q(o))!V.call(t,r)&&r!==e&&l(t,r,{get:()=>o[r],enumerable:!(i=C(o,r))||i.enumerable});return t};var S=(t,o,e)=>(e=t!=null?w(Q(t)):{},g(o||!t||!t.__esModule?l(e,"default",{value:t,enumerable:!0}):e,t)),v=t=>g(l({},"__esModule",{value:!0}),t);var B={};b(B,{default:()=>A,populateDefinitions:()=>D,populateRequestedReports:()=>k,setupResources:()=>h});module.exports=v(B);var c=S(require("../utils/definitionUtils")),f=S(require("../utils/localsHelper"));const I=(t,o)=>t[o]?t[o].toString():null,F=t=>I(t,"dataProductDefinitionsPath"),E=t=>{const o=F(t);return o||null},h=(t,o)=>async(e,i,r)=>{x(e,i);try{return await D(t,e,i,o),await k(t,i),r()}catch(a){return r(a)}},x=(t,o)=>{const e=t.flash("DPR_ERRORS");e&&e[0]&&(o.locals.validationErrors=JSON.parse(e[0]))},D=async(t,o,e,i)=>{const{token:r,dprUser:a}=f.default.getValues(e),d=E(o.query),n=o.body?.dataProductDefinitionsPath,s=d||n;s&&(e.locals.dpdPathFromQuery=!0);const m=i?.dataProductDefinitionsPath;if(m&&(e.locals.dpdPathFromConfig=!0),e.locals.definitionsPath=s||m,e.locals.pathSuffix=`?dataProductDefinitionsPath=${e.locals.definitionsPath}`,r&&t.reportingService){const P=await t.productCollectionStoreService.getSelectedProductCollectionId(a.id);e.locals.definitions=await Promise.all([t.reportingService.getDefinitions(r,e.locals.definitionsPath),P&&t.productCollectionService.getProductCollection(a.id,P)]).then(([R,p])=>{if(p&&p){const y=p.products.map(u=>u.productId);return R.filter(u=>y.includes(u.id))}return R})??[]}},k=async(t,o)=>{const{dprUser:e}=f.default.getValues(o);if(e.id){const{definitions:i,definitionsPath:r}=o.locals,a=await t.requestedReportService.getAllReports(e.id);o.locals.requestedReports=r?a.filter(n=>c.default.getCurrentVariantDefinition(i,n.reportId,n.id)):a;const d=await t.recentlyViewedService.getAllReports(e.id);if(o.locals.recentlyViewedReports=r?d.filter(n=>c.default.getCurrentVariantDefinition(i,n.reportId,n.id)):d,t.bookmarkService){o.locals.bookmarkingEnabled=!0;const n=await t.bookmarkService.getAllBookmarks(e.id);o.locals.bookmarks=r?n.filter(s=>c.default.getCurrentVariantDefinition(i,s.reportId,s.id)):n}t.downloadPermissionService&&(o.locals.downloadingEnabled=!0)}};var A=h;0&&(module.exports={populateDefinitions,populateRequestedReports,setupResources});
2
2
  //# sourceMappingURL=setUpDprResources.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/dpr/middleware/setUpDprResources.ts"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { RequestHandler, Response, Request } from 'express'\nimport type { ParsedQs } from 'qs'\nimport { Services } from '../types/Services'\nimport { RequestedReport, StoredReportData } from '../types/UserReports'\nimport DefinitionUtils from '../utils/definitionUtils'\nimport { BookmarkStoreData } from '../types/Bookmark'\nimport { DprConfig } from '../types/DprConfig'\nimport localsHelper from '../utils/localsHelper'\n\nconst getQueryParamAsString = (query: ParsedQs, name: string) => (query[name] ? query[name].toString() : null)\nconst getDefinitionsPath = (query: ParsedQs) => getQueryParamAsString(query, 'dataProductDefinitionsPath')\n\nconst deriveDefinitionsPath = (query: ParsedQs): string | null => {\n const definitionsPath = getDefinitionsPath(query)\n if (definitionsPath) {\n return definitionsPath\n }\n\n return null\n}\n\nexport const setupResources = (services: Services, config?: DprConfig): RequestHandler => {\n return async (req, res, next) => {\n populateValidationErrors(req, res)\n try {\n await populateDefinitions(services, req, res, config)\n await populateRequestedReports(services, res)\n return next()\n } catch (error) {\n return next(error)\n }\n }\n}\n\nconst populateValidationErrors = (req: Request, res: Response) => {\n const errors = req.flash(`DPR_ERRORS`)\n if (errors && errors[0]) {\n res.locals.validationErrors = JSON.parse(errors[0])\n }\n}\n\nexport const populateDefinitions = async (services: Services, req: Request, res: Response, config?: DprConfig) => {\n // Get the DPD path from the query\n const { token } = localsHelper.getValues(res)\n\n const dpdPathFromQuery = deriveDefinitionsPath(req.query)\n const dpdPathFromBody = req.body?.dataProductDefinitionsPath\n const definitionsPathFromQuery = dpdPathFromQuery || dpdPathFromBody\n\n if (definitionsPathFromQuery) {\n res.locals.dpdPathFromQuery = true\n }\n\n // Get the DPD path from the config\n const dpdPathFromConfig = config?.dataProductDefinitionsPath\n if (dpdPathFromConfig) {\n res.locals.dpdPathFromConfig = true\n }\n\n // query takes presedence over config\n res.locals.definitionsPath = definitionsPathFromQuery || dpdPathFromConfig\n res.locals.pathSuffix = `?dataProductDefinitionsPath=${res.locals.definitionsPath}`\n\n if (token && services.reportingService) {\n res.locals.definitions = await services.reportingService.getDefinitions(token, res.locals.definitionsPath)\n }\n}\n\nexport const populateRequestedReports = async (services: Services, res: Response) => {\n const { dprUser } = localsHelper.getValues(res)\n if (dprUser.id) {\n const { definitions, definitionsPath } = res.locals\n\n const requested = await services.requestedReportService.getAllReports(dprUser.id)\n res.locals.requestedReports = !definitionsPath\n ? requested\n : requested.filter((report: RequestedReport) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, report.reportId, report.id)\n })\n\n const recent = await services.recentlyViewedService.getAllReports(dprUser.id)\n res.locals.recentlyViewedReports = !definitionsPath\n ? recent\n : recent.filter((report: StoredReportData) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, report.reportId, report.id)\n })\n\n if (services.bookmarkService) {\n res.locals.bookmarkingEnabled = true\n\n const bookmarks = await services.bookmarkService.getAllBookmarks(dprUser.id)\n res.locals.bookmarks = !definitionsPath\n ? bookmarks\n : bookmarks.filter((bookmark: BookmarkStoreData) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, bookmark.reportId, bookmark.id)\n })\n }\n\n if (services.downloadPermissionService) {\n res.locals.downloadingEnabled = true\n }\n }\n}\n\nexport default setupResources\n"],
5
- "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,wBAAAC,EAAA,6BAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAN,GAKA,IAAAO,EAA4B,uCAG5BC,EAAyB,oCAEzB,MAAMC,EAAwB,CAACC,EAAiBC,IAAkBD,EAAMC,CAAI,EAAID,EAAMC,CAAI,EAAE,SAAS,EA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hB,CAAgB,EAAII,EAAI,OAEvCa,EAAY,MAAMhB,EAAS,uBAAuB,cAAcc,EAAQ,EAAE,EAChFX,EAAI,OAAO,iBAAoBJ,EAE3BiB,EAAU,OAAQC,GACT,EAAAC,QAAgB,4BAA4BH,EAAaE,EAAO,SAAUA,EAAO,EAAE,CAC3F,EAHDD,EAKJ,MAAMG,EAAS,MAAMnB,EAAS,sBAAsB,cAAcc,EAAQ,EAAE,EAO5E,GANAX,EAAI,OAAO,sBAAyBJ,EAEhCoB,EAAO,OAAQF,GACN,EAAAC,QAAgB,4BAA4BH,EAAaE,EAAO,SAAUA,EAAO,EAAE,CAC3F,EAHDE,EAKAnB,EAAS,gBAAiB,CAC5BG,EAAI,OAAO,mBAAqB,GAEhC,MAAMiB,EAAY,MAAMpB,EAAS,gBAAgB,gBAAgBc,EAAQ,EAAE,EAC3EX,EAAI,OAAO,UAAaJ,EAEpBqB,EAAU,OAAQC,GACT,EAAAH,QAAgB,4BAA4BH,EAAaM,EAAS,SAAUA,EAAS,EAAE,CAC/F,EAHDD,CAIN,CAEIpB,EAAS,4BACXG,EAAI,OAAO,mBAAqB,GAEpC,CACF,EAEA,IAAOhB,EAAQG",
6
- "names": ["setUpDprResources_exports", "__export", "setUpDprResources_default", "populateDefinitions", "populateRequestedReports", "setupResources", "__toCommonJS", "import_definitionUtils", "import_localsHelper", "getQueryParamAsString", "query", "name", "getDefinitionsPath", "deriveDefinitionsPath", "definitionsPath", "services", "config", "req", "res", "next", "populateValidationErrors", "error", "errors", "token", "localsHelper", "dpdPathFromQuery", "dpdPathFromBody", "definitionsPathFromQuery", "dpdPathFromConfig", "dprUser", "definitions", "requested", "report", "DefinitionUtils", "recent", "bookmarks", "bookmark"]
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { RequestHandler, Response, Request } from 'express'\nimport type { ParsedQs } from 'qs'\nimport { Services } from '../types/Services'\nimport { RequestedReport, StoredReportData } from '../types/UserReports'\nimport DefinitionUtils from '../utils/definitionUtils'\nimport { BookmarkStoreData } from '../types/Bookmark'\nimport { DprConfig } from '../types/DprConfig'\nimport localsHelper from '../utils/localsHelper'\n\nconst getQueryParamAsString = (query: ParsedQs, name: string) => (query[name] ? query[name].toString() : null)\nconst getDefinitionsPath = (query: ParsedQs) => getQueryParamAsString(query, 'dataProductDefinitionsPath')\n\nconst deriveDefinitionsPath = (query: ParsedQs): string | null => {\n const definitionsPath = getDefinitionsPath(query)\n if (definitionsPath) {\n return definitionsPath\n }\n\n return null\n}\n\nexport const setupResources = (services: Services, config?: DprConfig): RequestHandler => {\n return async (req, res, next) => {\n populateValidationErrors(req, res)\n try {\n await populateDefinitions(services, req, res, config)\n await populateRequestedReports(services, res)\n return next()\n } catch (error) {\n return next(error)\n }\n }\n}\n\nconst populateValidationErrors = (req: Request, res: Response) => {\n const errors = req.flash(`DPR_ERRORS`)\n if (errors && errors[0]) {\n res.locals.validationErrors = JSON.parse(errors[0])\n }\n}\n\nexport const populateDefinitions = async (services: Services, req: Request, res: Response, config?: DprConfig) => {\n // Get the DPD path from the query\n const { token, dprUser } = localsHelper.getValues(res)\n\n const dpdPathFromQuery = deriveDefinitionsPath(req.query)\n const dpdPathFromBody = req.body?.dataProductDefinitionsPath\n const definitionsPathFromQuery = dpdPathFromQuery || dpdPathFromBody\n\n if (definitionsPathFromQuery) {\n res.locals.dpdPathFromQuery = true\n }\n\n // Get the DPD path from the config\n const dpdPathFromConfig = config?.dataProductDefinitionsPath\n if (dpdPathFromConfig) {\n res.locals.dpdPathFromConfig = true\n }\n\n // query takes presedence over config\n res.locals.definitionsPath = definitionsPathFromQuery || dpdPathFromConfig\n res.locals.pathSuffix = `?dataProductDefinitionsPath=${res.locals.definitionsPath}`\n\n if (token && services.reportingService) {\n const selectedProductCollectionId = await services.productCollectionStoreService.getSelectedProductCollectionId(\n dprUser.id,\n )\n\n res.locals.definitions =\n (await Promise.all([\n services.reportingService.getDefinitions(token, res.locals.definitionsPath),\n selectedProductCollectionId &&\n services.productCollectionService.getProductCollection(dprUser.id, selectedProductCollectionId),\n ]).then(([defs, selectedProductCollection]) => {\n if (selectedProductCollection && selectedProductCollection) {\n const productIds = selectedProductCollection.products.map((product) => product.productId)\n return defs.filter((def) => productIds.includes(def.id))\n }\n return defs\n })) ?? []\n }\n}\n\nexport const populateRequestedReports = async (services: Services, res: Response) => {\n const { dprUser } = localsHelper.getValues(res)\n if (dprUser.id) {\n const { definitions, definitionsPath } = res.locals\n\n const requested = await services.requestedReportService.getAllReports(dprUser.id)\n res.locals.requestedReports = !definitionsPath\n ? requested\n : requested.filter((report: RequestedReport) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, report.reportId, report.id)\n })\n\n const recent = await services.recentlyViewedService.getAllReports(dprUser.id)\n res.locals.recentlyViewedReports = !definitionsPath\n ? recent\n : recent.filter((report: StoredReportData) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, report.reportId, report.id)\n })\n\n if (services.bookmarkService) {\n res.locals.bookmarkingEnabled = true\n\n const bookmarks = await services.bookmarkService.getAllBookmarks(dprUser.id)\n res.locals.bookmarks = !definitionsPath\n ? bookmarks\n : bookmarks.filter((bookmark: BookmarkStoreData) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, bookmark.reportId, bookmark.id)\n })\n }\n\n if (services.downloadPermissionService) {\n res.locals.downloadingEnabled = true\n }\n }\n}\n\nexport default setupResources\n"],
5
+ "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,wBAAAC,EAAA,6BAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAN,GAKA,IAAAO,EAA4B,uCAG5BC,EAAyB,oCAEzB,MAAMC,EAAwB,CAACC,EAAiBC,IAAkBD,EAAMC,CAAI,EAAID,EAAMC,CAAI,EAAE,SAAS,EAAI,KACnGC,EAAsBF,GAAoBD,EAAsBC,EAAO,4BAA4B,EAEnGG,EAAyBH,GAAmC,CAChE,MAAMI,EAAkBF,EAAmBF,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A0B,SAAS,IAAKE,GAAYA,EAAQ,SAAS,EACxF,OAAOH,EAAK,OAAQI,GAAQF,EAAW,SAASE,EAAI,EAAE,CAAC,CACzD,CACA,OAAOJ,CACT,CAAC,GAAM,CAAC,CACZ,CACF,EAEa3B,EAA2B,MAAOW,EAAoBG,IAAkB,CACnF,KAAM,CAAE,QAAAM,CAAQ,EAAI,EAAAC,QAAa,UAAUP,CAAG,EAC9C,GAAIM,EAAQ,GAAI,CACd,KAAM,CAAE,YAAAY,EAAa,gBAAAtB,CAAgB,EAAII,EAAI,OAEvCmB,EAAY,MAAMtB,EAAS,uBAAuB,cAAcS,EAAQ,EAAE,EAChFN,EAAI,OAAO,iBAAoBJ,EAE3BuB,EAAU,OAAQC,GACT,EAAAC,QAAgB,4BAA4BH,EAAaE,EAAO,SAAUA,EAAO,EAAE,CAC3F,EAHDD,EAKJ,MAAMG,EAAS,MAAMzB,EAAS,sBAAsB,cAAcS,EAAQ,EAAE,EAO5E,GANAN,EAAI,OAAO,sBAAyBJ,EAEhC0B,EAAO,OAAQF,GACN,EAAAC,QAAgB,4BAA4BH,EAAaE,EAAO,SAAUA,EAAO,EAAE,CAC3F,EAHDE,EAKAzB,EAAS,gBAAiB,CAC5BG,EAAI,OAAO,mBAAqB,GAEhC,MAAMuB,EAAY,MAAM1B,EAAS,gBAAgB,gBAAgBS,EAAQ,EAAE,EAC3EN,EAAI,OAAO,UAAaJ,EAEpB2B,EAAU,OAAQC,GACT,EAAAH,QAAgB,4BAA4BH,EAAaM,EAAS,SAAUA,EAAS,EAAE,CAC/F,EAHDD,CAIN,CAEI1B,EAAS,4BACXG,EAAI,OAAO,mBAAqB,GAEpC,CACF,EAEA,IAAOhB,EAAQG",
6
+ "names": ["setUpDprResources_exports", "__export", "setUpDprResources_default", "populateDefinitions", "populateRequestedReports", "setupResources", "__toCommonJS", "import_definitionUtils", "import_localsHelper", "getQueryParamAsString", "query", "name", "getDefinitionsPath", "deriveDefinitionsPath", "definitionsPath", "services", "config", "req", "res", "next", "populateValidationErrors", "error", "errors", "token", "dprUser", "localsHelper", "dpdPathFromQuery", "dpdPathFromBody", "definitionsPathFromQuery", "dpdPathFromConfig", "selectedProductCollectionId", "defs", "selectedProductCollection", "productIds", "product", "def", "definitions", "requested", "report", "DefinitionUtils", "recent", "bookmarks", "bookmark"]
7
7
  }
@@ -96,6 +96,13 @@ describe('setUpDprResources', () => {
96
96
 
97
97
  services = {
98
98
  reportingService,
99
+ productCollectionService: {
100
+ getProductCollections: jest.fn(() => []),
101
+ getProductCollection: jest.fn(),
102
+ },
103
+ productCollectionStoreService: {
104
+ getSelectedProductCollectionId: jest.fn(),
105
+ },
99
106
  } as unknown as Services
100
107
 
101
108
  res = {
@@ -42,7 +42,7 @@ const populateValidationErrors = (req: Request, res: Response) => {
42
42
 
43
43
  export const populateDefinitions = async (services: Services, req: Request, res: Response, config?: DprConfig) => {
44
44
  // Get the DPD path from the query
45
- const { token } = localsHelper.getValues(res)
45
+ const { token, dprUser } = localsHelper.getValues(res)
46
46
 
47
47
  const dpdPathFromQuery = deriveDefinitionsPath(req.query)
48
48
  const dpdPathFromBody = req.body?.dataProductDefinitionsPath
@@ -63,7 +63,22 @@ export const populateDefinitions = async (services: Services, req: Request, res:
63
63
  res.locals.pathSuffix = `?dataProductDefinitionsPath=${res.locals.definitionsPath}`
64
64
 
65
65
  if (token && services.reportingService) {
66
- res.locals.definitions = await services.reportingService.getDefinitions(token, res.locals.definitionsPath)
66
+ const selectedProductCollectionId = await services.productCollectionStoreService.getSelectedProductCollectionId(
67
+ dprUser.id,
68
+ )
69
+
70
+ res.locals.definitions =
71
+ (await Promise.all([
72
+ services.reportingService.getDefinitions(token, res.locals.definitionsPath),
73
+ selectedProductCollectionId &&
74
+ services.productCollectionService.getProductCollection(dprUser.id, selectedProductCollectionId),
75
+ ]).then(([defs, selectedProductCollection]) => {
76
+ if (selectedProductCollection && selectedProductCollection) {
77
+ const productIds = selectedProductCollection.products.map((product) => product.productId)
78
+ return defs.filter((def) => productIds.includes(def.id))
79
+ }
80
+ return defs
81
+ })) ?? []
67
82
  }
68
83
  }
69
84
 
@@ -1,2 +1,2 @@
1
- var i=require("test-app/routes/integrationTests/redisStateTestUtils"),o=require("../../../../../cypress-tests/cypressUtils");context("Download report",()=>{const d="/embedded/platform/";let t,s;before(()=>{cy.task("resetStubs"),cy.task("resetRedis"),cy.task("stubDefinitions"),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubReportsFinishedStatus"),cy.task("stubRequestSuccessResult20"),cy.task("stubRequestSuccessReportTablesCount"),cy.task("stubViewAsyncReportingResults"),cy.task("stubRequestSuccessResult100"),cy.visit(d),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(e,l)=>l.textContent.includes("Successful Report")&&l.textContent.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),(0,o.checkA11y)(),cy.findByRole("button",{name:/Request/}).click(),(0,o.checkA11y)(),cy.findByRole("heading",{level:1,name:/Successful Report/}).should("be.visible"),cy.url().then(e=>{s=e})}),beforeEach(()=>{cy.visit(s)}),describe("Enabling download",()=>{it("should show the enable download button",()=>{cy.findByLabelText(/Enable download/).should("exist").should("be.visible"),cy.findByRole("heading",{name:"To download this report"}).should("not.exist")}),it("should show the download disabled message with link to form",()=>{cy.findByLabelText(/Enable download/).click(),cy.url().should("have.string","/report/download-disabled"),cy.findByRole("heading",{name:"To download this report"}).should("be.visible"),cy.findByRole("link",{name:"Fill out a form"})}),it("should go to the request download form",()=>{cy.findByLabelText(/Enable download/).click(),cy.findByRole("link",{name:"Fill out a form"}).click(),cy.url().then(e=>{t=e}),cy.url().should("match",/\/embedded\/platform\/dpr\/download-report\/request-download\/request-examples\/request-example-success\/tableId\/tblId_[0-9]+\/form/),cy.location().should(e=>{expect(e.search).to.match(/.*reportUrl=\/embedded\/platform\/dpr\/view-report\/async\/report\/request-examples\/request-example-success\/tblId_[0-9]+\/report/)})})}),describe("Requesting download",()=>{it("should prefill the user data in the request form",()=>{cy.visit(t),cy.findByRole("textbox",{name:"What is your Full name?"}).should("have.value","Test User"),cy.findByRole("textbox",{name:"What is your Email address?"}).should("have.value","test@user.com")}),it("should validate the required fields",()=>{cy.visit(t),cy.findByRole("alert").should("not.exist"),cy.findAllByRole("paragraph").contains("Enter your Job title").should("not.exist"),cy.findAllByRole("paragraph").contains("provide information on how you will use this data").should("not.exist"),cy.get("#more-detail-error").should("not.be.visible"),cy.findByRole("button",{name:/Submit request/}).click(),cy.findByRole("alert").should("exist"),cy.findAllByRole("paragraph").contains("Enter your Job title").should("exist"),cy.findAllByRole("paragraph").contains("provide information on how you will use this data").should("exist")}),it("should submit the download request",()=>{cy.visit(t),cy.findByRole("textbox",{name:"What is your Job title?"}).type("Software engineer"),cy.findByRole("textbox",{name:"Can you provide more detail"}).type("I like this report"),cy.findByRole("button",{name:"Submit request"}).click(),cy.findByText(/You have been granted permission/).should("be.visible"),cy.url().as("downloadRequestSubmittedPage"),cy.url().and("match",/dpr\/download-report\/request-download\/request-examples\/request-example-success\/tableId\/tblId_[0-9]+\/form\/submitted/),cy.findByRole("link",{name:/Return to report to download/}).click(),cy.findAllByRole("heading").contains("Successful Report").should("exist"),cy.findByRole("button",{name:/download/}).should("be.visible"),cy.task("stubRequestSuccessResult10MissingFirstRow"),cy.findByRole("button",{name:/download/}).click(),cy.task("checkContents10RowExcelValid").should("equal",!0)}),it("should redirect on trying to download after having the permission to download removed",()=>{(0,i.updateRedisState)("downloadPermissions",[]),cy.findByRole("heading",{name:/To download this report/}).should("not.exist"),cy.findByRole("button",{name:/download/}).click(),cy.findByRole("heading",{name:/To download this report/}).should("be.visible")})})});
1
+ var i=require("test-app/routes/integrationTests/redisStateTestUtils"),o=require("../../../../../cypress-tests/cypressUtils");context("Download report",()=>{const d="/embedded/platform/";let t,s;before(()=>{cy.task("resetStubs"),cy.task("resetRedis"),cy.task("stubDefinitions"),cy.task("stubGetProductCollections"),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubReportsFinishedStatus"),cy.task("stubRequestSuccessResult20"),cy.task("stubRequestSuccessReportTablesCount"),cy.task("stubViewAsyncReportingResults"),cy.task("stubRequestSuccessResult100"),cy.visit(d),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(e,l)=>l.textContent.includes("Successful Report")&&l.textContent.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),(0,o.checkA11y)(),cy.findByRole("button",{name:/Request/}).click(),(0,o.checkA11y)(),cy.findByRole("heading",{level:1,name:/Successful Report/}).should("be.visible"),cy.url().then(e=>{s=e})}),beforeEach(()=>{cy.visit(s)}),describe("Enabling download",()=>{it("should show the enable download button",()=>{cy.findByLabelText(/Enable download/).should("exist").should("be.visible"),cy.findByRole("heading",{name:"To download this report"}).should("not.exist")}),it("should show the download disabled message with link to form",()=>{cy.findByLabelText(/Enable download/).click(),cy.url().should("have.string","/report/download-disabled"),cy.findByRole("heading",{name:"To download this report"}).should("be.visible"),cy.findByRole("link",{name:"Fill out a form"})}),it("should go to the request download form",()=>{cy.findByLabelText(/Enable download/).click(),cy.findByRole("link",{name:"Fill out a form"}).click(),cy.url().then(e=>{t=e}),cy.url().should("match",/\/embedded\/platform\/dpr\/download-report\/request-download\/request-examples\/request-example-success\/tableId\/tblId_[0-9]+\/form/),cy.location().should(e=>{expect(e.search).to.match(/.*reportUrl=\/embedded\/platform\/dpr\/view-report\/async\/report\/request-examples\/request-example-success\/tblId_[0-9]+\/report/)})})}),describe("Requesting download",()=>{it("should prefill the user data in the request form",()=>{cy.visit(t),cy.findByRole("textbox",{name:"What is your Full name?"}).should("have.value","Test User"),cy.findByRole("textbox",{name:"What is your Email address?"}).should("have.value","test@user.com")}),it("should validate the required fields",()=>{cy.visit(t),cy.findByRole("alert").should("not.exist"),cy.findAllByRole("paragraph").contains("Enter your Job title").should("not.exist"),cy.findAllByRole("paragraph").contains("provide information on how you will use this data").should("not.exist"),cy.get("#more-detail-error").should("not.be.visible"),cy.findByRole("button",{name:/Submit request/}).click(),cy.findByRole("alert").should("exist"),cy.findAllByRole("paragraph").contains("Enter your Job title").should("exist"),cy.findAllByRole("paragraph").contains("provide information on how you will use this data").should("exist")}),it("should submit the download request",()=>{cy.visit(t),cy.findByRole("textbox",{name:"What is your Job title?"}).type("Software engineer"),cy.findByRole("textbox",{name:"Can you provide more detail"}).type("I like this report"),cy.findByRole("button",{name:"Submit request"}).click(),cy.findByText(/You have been granted permission/).should("be.visible"),cy.url().as("downloadRequestSubmittedPage"),cy.url().and("match",/dpr\/download-report\/request-download\/request-examples\/request-example-success\/tableId\/tblId_[0-9]+\/form\/submitted/),cy.findByRole("link",{name:/Return to report to download/}).click(),cy.findAllByRole("heading").contains("Successful Report").should("exist"),cy.findByRole("button",{name:/download/}).should("be.visible"),cy.task("stubRequestSuccessResult10MissingFirstRow"),cy.findByRole("button",{name:/download/}).click(),cy.task("checkContents10RowExcelValid").should("equal",!0)}),it("should redirect on trying to download after having the permission to download removed",()=>{(0,i.updateRedisState)("downloadPermissions",[]),cy.findByRole("heading",{name:/To download this report/}).should("not.exist"),cy.findByRole("button",{name:/download/}).click(),cy.findByRole("heading",{name:/To download this report/}).should("be.visible")})})});
2
2
  //# sourceMappingURL=tests.cy.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/dpr/routes/journeys/download-report/tests.cy.ts"],
4
- "sourcesContent": ["import { updateRedisState } from 'test-app/routes/integrationTests/redisStateTestUtils'\nimport { checkA11y } from '../../../../../cypress-tests/cypressUtils'\n\ncontext('Download report', () => {\n const path = '/embedded/platform/'\n let downloadRequestFormPage: string\n let viewReportUrl: string\n\n before(() => {\n cy.task('resetStubs')\n cy.task('resetRedis')\n cy.task('stubDefinitions')\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubReportsFinishedStatus')\n cy.task('stubRequestSuccessResult20')\n cy.task('stubRequestSuccessReportTablesCount')\n cy.task('stubViewAsyncReportingResults')\n cy.task('stubRequestSuccessResult100')\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return element.textContent.includes('Successful Report') && element.textContent.includes('this will succeed')\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n checkA11y()\n cy.findByRole('button', { name: /Request/ }).click()\n checkA11y()\n cy.findByRole('heading', { level: 1, name: /Successful Report/ }).should('be.visible')\n cy.url().then((url) => {\n viewReportUrl = url\n })\n })\n\n beforeEach(() => {\n cy.visit(viewReportUrl)\n })\n\n describe('Enabling download', () => {\n it('should show the enable download button', () => {\n cy.findByLabelText(/Enable download/)\n .should('exist')\n .should('be.visible')\n cy.findByRole('heading', { name: 'To download this report' }).should('not.exist')\n })\n\n it('should show the download disabled message with link to form', () => {\n cy.findByLabelText(/Enable download/).click()\n cy.url().should('have.string', '/report/download-disabled')\n cy.findByRole('heading', { name: 'To download this report' }).should('be.visible')\n cy.findByRole('link', { name: 'Fill out a form' })\n })\n\n it('should go to the request download form', () => {\n cy.findByLabelText(/Enable download/).click()\n cy.findByRole('link', { name: 'Fill out a form' }).click()\n\n cy.url().then((url) => {\n downloadRequestFormPage = url\n })\n\n cy.url().should(\n 'match',\n /\\/embedded\\/platform\\/dpr\\/download-report\\/request-download\\/request-examples\\/request-example-success\\/tableId\\/tblId_[0-9]+\\/form/,\n )\n cy.location().should((location) => {\n expect(location.search).to.match(\n /.*reportUrl=\\/embedded\\/platform\\/dpr\\/view-report\\/async\\/report\\/request-examples\\/request-example-success\\/tblId_[0-9]+\\/report/,\n )\n })\n })\n })\n\n describe('Requesting download', () => {\n it('should prefill the user data in the request form', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('textbox', { name: 'What is your Full name?' }).should('have.value', 'Test User')\n cy.findByRole('textbox', { name: 'What is your Email address?' }).should('have.value', 'test@user.com')\n })\n\n it('should validate the required fields', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('alert').should('not.exist')\n\n cy.findAllByRole('paragraph').contains('Enter your Job title').should('not.exist')\n cy.findAllByRole('paragraph').contains('provide information on how you will use this data').should('not.exist')\n cy.get('#more-detail-error').should('not.be.visible')\n\n cy.findByRole('button', { name: /Submit request/ }).click()\n\n cy.findByRole('alert').should('exist')\n cy.findAllByRole('paragraph').contains('Enter your Job title').should('exist')\n cy.findAllByRole('paragraph').contains('provide information on how you will use this data').should('exist')\n })\n\n it('should submit the download request', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('textbox', { name: 'What is your Job title?' }).type('Software engineer')\n cy.findByRole('textbox', { name: 'Can you provide more detail' }).type('I like this report')\n\n cy.findByRole('button', { name: 'Submit request' }).click()\n cy.findByText(/You have been granted permission/).should('be.visible')\n\n cy.url().as('downloadRequestSubmittedPage')\n\n cy.url().and(\n 'match',\n /dpr\\/download-report\\/request-download\\/request-examples\\/request-example-success\\/tableId\\/tblId_[0-9]+\\/form\\/submitted/,\n )\n cy.findByRole('link', { name: /Return to report to download/ }).click()\n cy.findAllByRole('heading').contains('Successful Report').should('exist')\n cy.findByRole('button', { name: /download/ }).should('be.visible')\n\n cy.task('stubRequestSuccessResult10MissingFirstRow')\n cy.findByRole('button', { name: /download/ }).click()\n cy.task('checkContents10RowExcelValid').should('equal', true)\n })\n\n it('should redirect on trying to download after having the permission to download removed', () => {\n updateRedisState('downloadPermissions', [])\n cy.findByRole('heading', { name: /To download this report/ }).should('not.exist')\n cy.findByRole('button', { name: /download/ }).click()\n cy.findByRole('heading', { name: /To download this report/ }).should('be.visible')\n })\n })\n})\n"],
5
- "mappings": "AAAA,IAAAA,EAAiC,gEACjCC,EAA0B,qDAE1B,QAAQ,kBAAmB,IAAM,CAC/B,MAAMC,EAAO,sBACb,IAAIC,EACAC,EAEJ,OAAO,IAAM,CACX,GAAG,KAAK,YAAY,EACpB,GAAG,KAAK,YAAY,EACpB,GAAG,KAAK,iBAAiB,EACzB,GAAG,KAAK,sCAAsC,EAC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,KAAK,oBAAoB,EAE3F,GAAG,WAAW,SAAU,CAAE,KAAM,gBAAiB,CAAC,EAAE,MAAM,EAC1D,GAAG,WAAW,kCAAkC,EAAE,OAAO,YAAY,EAErE,GAAG,IAAI,EAAE,GAAG,8BAA8B,EAE1C,GAAG,IAAI,EAAE,IACP,QACA,2HACF,EACA,GAAG,WAAW,OAAQ,CAAE,KAAM,8BAA+B,CAAC,EAAE,MAAM,EACtE,GAAG,cAAc,SAAS,EAAE,SAAS,mBAAmB,EAAE,OAAO,OAAO,EACxE,GAAG,WAAW,SAAU,CAAE,KAAM,UAAW,CAAC,EAAE,OAAO,YAAY,EAEjE,GAAG,KAAK,2CAA2C,EACnD,GAAG,WAAW,SAAU,CAAE,KAAM,UAAW,CAAC,EAAE,MAAM,EACpD,GAAG,KAAK,8BAA8B,EAAE,OAAO,QAAS,EAAI,CAC9D,CAAC,EAED,GAAG,wFAAyF,IAAM,IAChG,oBAAiB,sBAAuB,CAAC,CAAC,EAC1C,GAAG,WAAW,UAAW,CAAE,KAAM,yBAA0B,CAAC,EAAE,OAAO,WAAW,EAChF,GAAG,WAAW,SAAU,CAAE,KAAM,UAAW,CAAC,EAAE,MAAM,EACpD,GAAG,WAAW,UAAW,CAAE,KAAM,yBAA0B,CAAC,EAAE,OAAO,YAAY,CACnF,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { updateRedisState } from 'test-app/routes/integrationTests/redisStateTestUtils'\nimport { checkA11y } from '../../../../../cypress-tests/cypressUtils'\n\ncontext('Download report', () => {\n const path = '/embedded/platform/'\n let downloadRequestFormPage: string\n let viewReportUrl: string\n\n before(() => {\n cy.task('resetStubs')\n cy.task('resetRedis')\n cy.task('stubDefinitions')\n cy.task('stubGetProductCollections')\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubReportsFinishedStatus')\n cy.task('stubRequestSuccessResult20')\n cy.task('stubRequestSuccessReportTablesCount')\n cy.task('stubViewAsyncReportingResults')\n cy.task('stubRequestSuccessResult100')\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return element.textContent.includes('Successful Report') && element.textContent.includes('this will succeed')\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n checkA11y()\n cy.findByRole('button', { name: /Request/ }).click()\n checkA11y()\n cy.findByRole('heading', { level: 1, name: /Successful Report/ }).should('be.visible')\n cy.url().then((url) => {\n viewReportUrl = url\n })\n })\n\n beforeEach(() => {\n cy.visit(viewReportUrl)\n })\n\n describe('Enabling download', () => {\n it('should show the enable download button', () => {\n cy.findByLabelText(/Enable download/)\n .should('exist')\n .should('be.visible')\n cy.findByRole('heading', { name: 'To download this report' }).should('not.exist')\n })\n\n it('should show the download disabled message with link to form', () => {\n cy.findByLabelText(/Enable download/).click()\n cy.url().should('have.string', '/report/download-disabled')\n cy.findByRole('heading', { name: 'To download this report' }).should('be.visible')\n cy.findByRole('link', { name: 'Fill out a form' })\n })\n\n it('should go to the request download form', () => {\n cy.findByLabelText(/Enable download/).click()\n cy.findByRole('link', { name: 'Fill out a form' }).click()\n\n cy.url().then((url) => {\n downloadRequestFormPage = url\n })\n\n cy.url().should(\n 'match',\n /\\/embedded\\/platform\\/dpr\\/download-report\\/request-download\\/request-examples\\/request-example-success\\/tableId\\/tblId_[0-9]+\\/form/,\n )\n cy.location().should((location) => {\n expect(location.search).to.match(\n /.*reportUrl=\\/embedded\\/platform\\/dpr\\/view-report\\/async\\/report\\/request-examples\\/request-example-success\\/tblId_[0-9]+\\/report/,\n )\n })\n })\n })\n\n describe('Requesting download', () => {\n it('should prefill the user data in the request form', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('textbox', { name: 'What is your Full name?' }).should('have.value', 'Test User')\n cy.findByRole('textbox', { name: 'What is your Email address?' }).should('have.value', 'test@user.com')\n })\n\n it('should validate the required fields', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('alert').should('not.exist')\n\n cy.findAllByRole('paragraph').contains('Enter your Job title').should('not.exist')\n cy.findAllByRole('paragraph').contains('provide information on how you will use this data').should('not.exist')\n cy.get('#more-detail-error').should('not.be.visible')\n\n cy.findByRole('button', { name: /Submit request/ }).click()\n\n cy.findByRole('alert').should('exist')\n cy.findAllByRole('paragraph').contains('Enter your Job title').should('exist')\n cy.findAllByRole('paragraph').contains('provide information on how you will use this data').should('exist')\n })\n\n it('should submit the download request', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('textbox', { name: 'What is your Job title?' }).type('Software engineer')\n cy.findByRole('textbox', { name: 'Can you provide more detail' }).type('I like this report')\n\n cy.findByRole('button', { name: 'Submit request' }).click()\n cy.findByText(/You have been granted permission/).should('be.visible')\n\n cy.url().as('downloadRequestSubmittedPage')\n\n cy.url().and(\n 'match',\n /dpr\\/download-report\\/request-download\\/request-examples\\/request-example-success\\/tableId\\/tblId_[0-9]+\\/form\\/submitted/,\n )\n cy.findByRole('link', { name: /Return to report to download/ }).click()\n cy.findAllByRole('heading').contains('Successful Report').should('exist')\n cy.findByRole('button', { name: /download/ }).should('be.visible')\n\n cy.task('stubRequestSuccessResult10MissingFirstRow')\n cy.findByRole('button', { name: /download/ }).click()\n cy.task('checkContents10RowExcelValid').should('equal', true)\n })\n\n it('should redirect on trying to download after having the permission to download removed', () => {\n updateRedisState('downloadPermissions', [])\n cy.findByRole('heading', { name: /To download this report/ }).should('not.exist')\n cy.findByRole('button', { name: /download/ }).click()\n cy.findByRole('heading', { name: /To download this report/ }).should('be.visible')\n })\n })\n})\n"],
5
+ "mappings": "AAAA,IAAAA,EAAiC,gEACjCC,EAA0B,qDAE1B,QAAQ,kBAAmB,IAAM,CAC/B,MAAMC,EAAO,sBACb,IAAIC,EACAC,EAEJ,OAAO,IAAM,CACX,GAAG,KAAK,YAAY,EACpB,GAAG,KAAK,YAAY,EACpB,GAAG,KAAK,iBAAiB,EACzB,GAAG,KAAK,2BAA2B,EACnC,GAAG,KAAK,sCAAsC,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AAE,KAAK,oBAAoB,EAE3F,GAAG,WAAW,SAAU,CAAE,KAAM,gBAAiB,CAAC,EAAE,MAAM,EAC1D,GAAG,WAAW,kCAAkC,EAAE,OAAO,YAAY,EAErE,GAAG,IAAI,EAAE,GAAG,8BAA8B,EAE1C,GAAG,IAAI,EAAE,IACP,QACA,2HACF,EACA,GAAG,WAAW,OAAQ,CAAE,KAAM,8BAA+B,CAAC,EAAE,MAAM,EACtE,GAAG,cAAc,SAAS,EAAE,SAAS,mBAAmB,EAAE,OAAO,OAAO,EACxE,GAAG,WAAW,SAAU,CAAE,KAAM,UAAW,CAAC,EAAE,OAAO,YAAY,EAEjE,GAAG,KAAK,2CAA2C,EACnD,GAAG,WAAW,SAAU,CAAE,KAAM,UAAW,CAAC,EAAE,MAAM,EACpD,GAAG,KAAK,8BAA8B,EAAE,OAAO,QAAS,EAAI,CAC9D,CAAC,EAED,GAAG,wFAAyF,IAAM,IAChG,oBAAiB,sBAAuB,CAAC,CAAC,EAC1C,GAAG,WAAW,UAAW,CAAE,KAAM,yBAA0B,CAAC,EAAE,OAAO,WAAW,EAChF,GAAG,WAAW,SAAU,CAAE,KAAM,UAAW,CAAC,EAAE,MAAM,EACpD,GAAG,WAAW,UAAW,CAAE,KAAM,yBAA0B,CAAC,EAAE,OAAO,YAAY,CACnF,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_redisStateTestUtils", "import_cypressUtils", "path", "downloadRequestFormPage", "viewReportUrl", "_", "element", "url", "location"]
7
7
  }
@@ -10,6 +10,7 @@ context('Download report', () => {
10
10
  cy.task('resetStubs')
11
11
  cy.task('resetRedis')
12
12
  cy.task('stubDefinitions')
13
+ cy.task('stubGetProductCollections')
13
14
  cy.task('stubDefinitionRequestExamplesSuccess')
14
15
  cy.task('stubReportsFinishedStatus')
15
16
  cy.task('stubRequestSuccessResult20')
@@ -1,2 +1,2 @@
1
- var n=require("@networkMocks/report/mockVariants/feature-testing/unprintable"),a=require("@networkMocks/report/mockVariants/feature-testing/emptyQuery");context("Bookmarks list",()=>{const i="/embedded/platform/";describe("check the default starting state",()=>{it("should have the default bookmarks from the caseload bookmark config",()=>{cy.task("resetStubs"),cy.task("resetRedis"),cy.task("stubDefinitions"),cy.task("stubDefinitionUnprintable"),cy.task("stubDefinitionEmptyReport"),cy.task("stubSingleSummaries"),cy.visit(i),cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2),cy.findByRole("link",{name:(t,e)=>e.href.includes(n.featureTestingUnprintable.id)}),cy.findByRole("link",{name:(t,e)=>e.href.includes(a.featureTestingEmptyQuery.id)})})})})}),describe("check other interactions",()=>{before(()=>{cy.task("resetStubs"),cy.task("stubDefinitions"),cy.task("resetRedis"),cy.task("stubSingleSummaries"),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubDefinitionUnprintable"),cy.task("stubDefinitionEmptyReport"),cy.task("stubListExampleDashboard"),cy.task("stubDefinitionMockReportVariant35"),cy.task("stubTestDashboard8"),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("stubDashboardSuccessResult20"),cy.task("stubRequestSuccessResult20"),cy.task("stubPollingReportEndpoint")}),beforeEach(()=>{cy.visit(i)}),describe("Bookmarking via the catalogue",()=>{describe("report",()=>{it("should add a bookmark to the bookmarks list",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3),cy.findAllByRole("row").contains("Interactive Report with async filters").should("exist")})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).should("exist")})})}),it("should remove a bookmark to the bookmarks list",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).should("exist")})})})}),describe("dashboard",()=>{it("should add a bookmark to the bookmarks list",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3),cy.findAllByRole("row").contains("Data quality data set").should("exist")})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).should("exist")})})}),it("should remove a bookmark from the bookmarks list",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).should("exist")})})})}),describe("missing report",()=>{it("should not be able to be bookmarked",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Description for missing report 1")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).should("not.exist"),cy.findByRole("link",{name:/Request report/}).should("be.visible")})})})})}),describe("Removing via the user reports list",()=>{it("should remove a dashboard bookmark",()=>{cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})})}),it("should remove a report bookmark",()=>{cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})})})}),describe("Bookmarking via the report",()=>{let t;before(()=>{cy.task("stubDefinitionFeatureTestingMissingDesc"),cy.task("stubReportsFinishedStatus"),cy.task("stubViewAsyncReportingResults"),cy.task("stubRequestSuccessReportTablesCount"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(e,o)=>o.textContent.includes("Feature testing")&&o.textContent.includes("Missing variant description")&&o.textContent.includes("Example variants used for feature testing")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("combobox",{name:/Field 2/}).select("Value 2.1"),cy.findByRole("button",{name:/Request report/}).click(),cy.findByRole("button",{name:/Enable download/}).should("be.visible"),cy.url().then(e=>{t=e})}),it("should add a bookmark",()=>{cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.visit(t),cy.findByRole("button",{name:/Add bookmark/}).click(),cy.findByRole("button",{name:/Bookmarked/}).should("be.visible"),cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})})}),it("should remove a bookmark",()=>{cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.visit(t),cy.findByRole("button",{name:/Remove bookmark/}).click(),cy.findByRole("button",{name:/Bookmark removed/}),cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})})})}),describe("Bookmarking via the dashboard",()=>{let t;before(()=>{cy.task("stubTestDashboard8"),cy.task("stubMockDashboardsStatusFinished"),cy.task("stubViewAsyncResults"),cy.task("stubDashboardSuccessResult20"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(e,o)=>o.textContent.includes("Test Dashboard")&&o.textContent.includes("Dashboard used for testing testing")}).within(()=>{cy.findByRole("link",{name:"Request dashboard"}).click()})}),cy.findByRole("button",{name:/Request dashboard/}).click(),cy.url().then(e=>{t=e})}),it("should add a bookmark",()=>{cy.visit(t),cy.findByRole("button",{name:/Add bookmark/}).click().contains("Bookmarked"),cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})})}),it("should remove a bookmark",()=>{cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.visit(t),cy.findByRole("button",{name:/Remove bookmark/}).click().contains("Bookmark removed"),cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})})})}),describe("bookmarking should be idempotent",()=>{it("should not change the bookmark status of an already bookmarked item",()=>{cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.get("input").then(t=>{t.get(0).checked=!1,t.get(0).removeAttribute("checked")}),cy.get("input").invoke("attr","checked").should("equal",void 0)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.reload(),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).should("exist")})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})})}),it("should not change the bookmark status of an unbookmarked item",()=>{cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.get("input").then(t=>{t.get(0).checked=!0,t.get(0).setAttribute("checked","true")}),cy.get("input").invoke("attr","checked").should("not.equal",void 0).and("not.equal",!1)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.reload(),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).should("exist")})})})})})});
1
+ var n=require("@networkMocks/report/mockVariants/feature-testing/unprintable"),a=require("@networkMocks/report/mockVariants/feature-testing/emptyQuery");context("Bookmarks list",()=>{const i="/embedded/platform/";describe("check the default starting state",()=>{it("should have the default bookmarks from the caseload bookmark config",()=>{cy.task("resetStubs"),cy.task("resetRedis"),cy.task("stubDefinitions"),cy.task("stubGetProductCollections"),cy.task("stubDefinitionUnprintable"),cy.task("stubDefinitionEmptyReport"),cy.task("stubSingleSummaries"),cy.visit(i),cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2),cy.findByRole("link",{name:(t,e)=>e.href.includes(n.featureTestingUnprintable.id)}),cy.findByRole("link",{name:(t,e)=>e.href.includes(a.featureTestingEmptyQuery.id)})})})})}),describe("check other interactions",()=>{before(()=>{cy.task("resetStubs"),cy.task("stubDefinitions"),cy.task("resetRedis"),cy.task("stubGetProductCollections"),cy.task("stubSingleSummaries"),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubDefinitionUnprintable"),cy.task("stubDefinitionEmptyReport"),cy.task("stubListExampleDashboard"),cy.task("stubDefinitionMockReportVariant35"),cy.task("stubTestDashboard8"),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("stubDashboardSuccessResult20"),cy.task("stubRequestSuccessResult20"),cy.task("stubPollingReportEndpoint")}),beforeEach(()=>{cy.visit(i)}),describe("Bookmarking via the catalogue",()=>{describe("report",()=>{it("should add a bookmark to the bookmarks list",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3),cy.findAllByRole("row").contains("Interactive Report with async filters").should("exist")})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).should("exist")})})}),it("should remove a bookmark to the bookmarks list",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).should("exist")})})})}),describe("dashboard",()=>{it("should add a bookmark to the bookmarks list",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3),cy.findAllByRole("row").contains("Data quality data set").should("exist")})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).should("exist")})})}),it("should remove a bookmark from the bookmarks list",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).should("exist")})})})}),describe("missing report",()=>{it("should not be able to be bookmarked",()=>{cy.findByRole("tab",{name:/Bookmarks/}).click(),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Description for missing report 1")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).should("not.exist"),cy.findByRole("link",{name:/Request report/}).should("be.visible")})})})})}),describe("Removing via the user reports list",()=>{it("should remove a dashboard bookmark",()=>{cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Data quality data set")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})})}),it("should remove a report bookmark",()=>{cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})})})}),describe("Bookmarking via the report",()=>{let t;before(()=>{cy.task("stubDefinitionFeatureTestingMissingDesc"),cy.task("stubReportsFinishedStatus"),cy.task("stubViewAsyncReportingResults"),cy.task("stubRequestSuccessReportTablesCount"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(e,o)=>o.textContent.includes("Feature testing")&&o.textContent.includes("Missing variant description")&&o.textContent.includes("Example variants used for feature testing")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("combobox",{name:/Field 2/}).select("Value 2.1"),cy.findByRole("button",{name:/Request report/}).click(),cy.findByRole("button",{name:/Enable download/}).should("be.visible"),cy.url().then(e=>{t=e})}),it("should add a bookmark",()=>{cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})}),cy.visit(t),cy.findByRole("button",{name:/Add bookmark/}).click(),cy.findByRole("button",{name:/Bookmarked/}).should("be.visible"),cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})})}),it("should remove a bookmark",()=>{cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.visit(t),cy.findByRole("button",{name:/Remove bookmark/}).click(),cy.findByRole("button",{name:/Bookmark removed/}),cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})})})}),describe("Bookmarking via the dashboard",()=>{let t;before(()=>{cy.task("stubTestDashboard8"),cy.task("stubMockDashboardsStatusFinished"),cy.task("stubViewAsyncResults"),cy.task("stubDashboardSuccessResult20"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(e,o)=>o.textContent.includes("Test Dashboard")&&o.textContent.includes("Dashboard used for testing testing")}).within(()=>{cy.findByRole("link",{name:"Request dashboard"}).click()})}),cy.findByRole("button",{name:/Request dashboard/}).click(),cy.url().then(e=>{t=e})}),it("should add a bookmark",()=>{cy.visit(t),cy.findByRole("button",{name:/Add bookmark/}).click().contains("Bookmarked"),cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})})}),it("should remove a bookmark",()=>{cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",3)})}),cy.visit(t),cy.findByRole("button",{name:/Remove bookmark/}).click().contains("Bookmark removed"),cy.visit(i),cy.findByLabelText(/Bookmarks.*/i).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",2)})})})}),describe("bookmarking should be idempotent",()=>{it("should not change the bookmark status of an already bookmarked item",()=>{cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.get("input").then(t=>{t.get(0).checked=!1,t.get(0).removeAttribute("checked")}),cy.get("input").invoke("attr","checked").should("equal",void 0)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})}),cy.reload(),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).should("exist")})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Remove bookmark/}).click()})})}),it("should not change the bookmark status of an unbookmarked item",()=>{cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.get("input").then(t=>{t.get(0).checked=!0,t.get(0).setAttribute("checked","true")}),cy.get("input").invoke("attr","checked").should("not.equal",void 0).and("not.equal",!1)})}),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.reload(),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(t,e)=>e.textContent.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).should("exist")})})})})})});
2
2
  //# sourceMappingURL=tests.cy.js.map