diff --git a/cypress/e2e/catalogue/catalogueItems.cy.ts b/cypress/e2e/catalogue/catalogueItems.cy.ts index 373a5aa13..7aee4b32b 100644 --- a/cypress/e2e/catalogue/catalogueItems.cy.ts +++ b/cypress/e2e/catalogue/catalogueItems.cy.ts @@ -34,7 +34,7 @@ describe('Catalogue Items', () => { expect(patchRequests.length).equal(1); const request = patchRequests[0]; expect(JSON.stringify(request.body)).equal( - '{"catalogue_category_id":"4","name":"test","description":"test Description","properties":[{"name":"Resolution","value":18},{"name":"Frame Rate","value":60},{"name":"Sensor Type","value":"IO"},{"name":"Sensor brand","value":"pixel"},{"name":"Broken","value":true},{"name":"Older than five years","value":false}],"manufacturer":{"name":"test","address":"1 house test TX3 6TY","web_url":"https://test.co.uk"}}' + '{"catalogue_category_id":"4","name":"test","description":"test Description","properties":[{"name":"Resolution","value":18},{"name":"Frame Rate","value":60},{"name":"Sensor Type","value":"IO"},{"name":"Sensor brand","value":"pixel"},{"name":"Broken","value":true},{"name":"Older than five years","value":false}],"manufacturer":{"name":"test","address":"1 house test TX3 6TY","url":"https://test.co.uk"}}' ); }); }); @@ -63,7 +63,7 @@ describe('Catalogue Items', () => { expect(patchRequests.length).equal(1); const request = patchRequests[0]; expect(JSON.stringify(request.body)).equal( - '{"catalogue_category_id":"4","name":"test","description":"","properties":[{"name":"Resolution","value":18},{"name":"Sensor Type","value":"IO"},{"name":"Broken","value":true}],"manufacturer":{"name":"test","address":"1 house test TX3 6TY","web_url":"https://test.co.uk"}}' + '{"catalogue_category_id":"4","name":"test","description":"","properties":[{"name":"Resolution","value":18},{"name":"Sensor Type","value":"IO"},{"name":"Broken","value":true}],"manufacturer":{"name":"test","address":"1 house test TX3 6TY","url":"https://test.co.uk"}}' ); }); }); diff --git a/src/api/catalogueItem.test.tsx b/src/api/catalogueItem.test.tsx index d6645861d..65ac5e5cc 100644 --- a/src/api/catalogueItem.test.tsx +++ b/src/api/catalogueItem.test.tsx @@ -95,7 +95,7 @@ describe('catalogue items api functions', () => { manufacturer: { address: '10 My Street', name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', }, properties: [ { name: 'Resolution', unit: 'megapixels', value: 12 }, diff --git a/src/app.types.tsx b/src/app.types.tsx index 7cdc8fa91..17ce2141a 100644 --- a/src/app.types.tsx +++ b/src/app.types.tsx @@ -41,7 +41,7 @@ export interface CatalogueItemDetails { export interface CatalogueItemManufacturer { name: string; address: string; - web_url: string; + url: string; } export interface CatalogueItemProperty { diff --git a/src/catalogue/catalogue.component.tsx b/src/catalogue/catalogue.component.tsx index 8b421825c..8c5d16e6b 100644 --- a/src/catalogue/catalogue.component.tsx +++ b/src/catalogue/catalogue.component.tsx @@ -85,7 +85,7 @@ function Catalogue() { React.useState({ name: '', address: '', - web_url: '', + url: '', }); const [catalogueItemPropertyValues, setCatalogueItemPropertyValues] = diff --git a/src/catalogue/items/catalogueItemsDialog.component.test.tsx b/src/catalogue/items/catalogueItemsDialog.component.test.tsx index 47e61083f..0ee294ba8 100644 --- a/src/catalogue/items/catalogueItemsDialog.component.test.tsx +++ b/src/catalogue/items/catalogueItemsDialog.component.test.tsx @@ -34,7 +34,7 @@ describe('Catalogue Items Dialog', () => { onChangeCatalogueItemDetails: onChangeCatalogueItemDetails, catalogueItemManufacturer: { name: '', - web_url: '', + url: '', address: '', }, onChangeCatalogueItemManufacturer: onChangeCatalogueItemManufacturer, @@ -70,7 +70,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [12, 60, 'IO', 'pixel', true, false], catalogueItemManufacturer: { name: 'Sony', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '1 venus street UY6 9OP', }, }; @@ -87,7 +87,7 @@ describe('Catalogue Items Dialog', () => { name: 'test', manufacturer: { name: 'Sony', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '1 venus street UY6 9OP', }, properties: [ @@ -110,7 +110,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [12, null, 'IO', null, true, ''], catalogueItemManufacturer: { name: 'Sony', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '1 venus street UY6 9OP', }, }; @@ -127,7 +127,7 @@ describe('Catalogue Items Dialog', () => { name: 'test', manufacturer: { name: 'Sony', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '1 venus street UY6 9OP', }, properties: [ @@ -147,7 +147,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [12, null, 'IO', null, 'true', 'false'], catalogueItemManufacturer: { name: 'Sony', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '1 venus street UY6 9OP', }, }; @@ -164,7 +164,7 @@ describe('Catalogue Items Dialog', () => { name: 'test', manufacturer: { name: 'Sony', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '1 venus street UY6 9OP', }, properties: [ @@ -232,7 +232,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: ['rsdf', 'fsdf', 'pixel', null, false, ''], catalogueItemManufacturer: { name: 'Sony', - web_url: 'sony.com', + url: 'sony.com', address: '1 venus street UY6 9OP', }, }; @@ -274,7 +274,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [12, null, 'IO', null, true, ''], catalogueItemManufacturer: { name: 'Sony', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '1 venus street UY6 9OP', }, }; @@ -322,7 +322,7 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, @@ -330,7 +330,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [24, 240, 'CCD', 'Nikon', false, true], catalogueItemManufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }; @@ -370,14 +370,14 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, propertyValues: ['12a', '21a', 'pixel', null, false, ''], catalogueItemManufacturer: { name: 'Manufacturer A', - web_url: 'example.com', + url: 'example.com', address: '10 My Street', }, }; @@ -427,7 +427,7 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, @@ -435,7 +435,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [null, 240, null, 'Nikon', '', true], catalogueItemManufacturer: { name: '', - web_url: '', + url: '', address: '', }, }; @@ -497,7 +497,7 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, @@ -505,7 +505,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [24, 240, 'CCD', 'Nikon', true, true], catalogueItemManufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }; @@ -552,7 +552,7 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, @@ -560,7 +560,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [24, 240, 'CCD', 'Nikon', 'true', 'false'], catalogueItemManufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }; @@ -607,7 +607,7 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, @@ -615,7 +615,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [24, 240, 'CCD', 'Nikon', false, true], catalogueItemManufacturer: { name: 'Sony1', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '12 venus street UY6 9OP', }, }; @@ -628,7 +628,7 @@ describe('Catalogue Items Dialog', () => { expect(axiosPatchSpy).toHaveBeenCalledWith('/v1/catalogue-items/90', { manufacturer: { name: 'Sony1', - web_url: 'https://sony.com', + url: 'https://sony.com', address: '12 venus street UY6 9OP', }, }); @@ -659,7 +659,7 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, @@ -667,7 +667,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [24, 240, 'CCD', 'Nikon', false, true], catalogueItemManufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }; @@ -769,7 +769,7 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, @@ -777,7 +777,7 @@ describe('Catalogue Items Dialog', () => { propertyValues: [24, 240, 'CCD', 'NIkon', false, true], catalogueItemManufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }; @@ -830,14 +830,14 @@ describe('Catalogue Items Dialog', () => { id: '90', manufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }, propertyValues: [12, 60, 'IO', 'pixel', true, false], catalogueItemManufacturer: { name: 'Manufacturer A', - web_url: 'http://example.com', + url: 'http://example.com', address: '10 My Street', }, }; @@ -996,7 +996,7 @@ describe('Catalogue Items Dialog', () => { expect(onChangeCatalogueItemManufacturer).toHaveBeenCalledWith({ ...props.catalogueItemManufacturer, - web_url: newManufacturerUrl, + url: newManufacturerUrl, }); }); }); diff --git a/src/catalogue/items/catalogueItemsDialog.component.tsx b/src/catalogue/items/catalogueItemsDialog.component.tsx index 55048a9a6..015966776 100644 --- a/src/catalogue/items/catalogueItemsDialog.component.tsx +++ b/src/catalogue/items/catalogueItemsDialog.component.tsx @@ -112,7 +112,7 @@ function CatalogueItemsDialog(props: CatalogueItemsDialogProps) { onChangeCatalogueItemManufacturer({ name: '', address: '', - web_url: '', + url: '', }); onChangePropertyValues([]); setPropertyErrors( @@ -209,12 +209,12 @@ function CatalogueItemsDialog(props: CatalogueItemsDialogProps) { // Check Manufacturer URL if ( - !catalogueItemManufacturer.web_url.trim() || - !isValidUrl(catalogueItemManufacturer.web_url) + !catalogueItemManufacturer.url.trim() || + !isValidUrl(catalogueItemManufacturer.url) ) { setManufacturerWebUrlError(true); setManufacturerWebUrlErrorMessage( - !catalogueItemManufacturer.web_url.trim() + !catalogueItemManufacturer.url.trim() ? 'Please enter a Manufacturer URL' : 'Please enter a valid Manufacturer URL. Only "http://" and "https://" links with typical top-level domain are accepted' ); @@ -350,12 +350,12 @@ function CatalogueItemsDialog(props: CatalogueItemsDialogProps) { // Check Manufacturer URL if ( - !catalogueItemManufacturer.web_url.trim() || - !isValidUrl(catalogueItemManufacturer.web_url) + !catalogueItemManufacturer.url.trim() || + !isValidUrl(catalogueItemManufacturer.url) ) { setManufacturerWebUrlError(true); setManufacturerWebUrlErrorMessage( - !catalogueItemManufacturer.web_url.trim() + !catalogueItemManufacturer.url.trim() ? 'Please enter a Manufacturer URL' : 'Please enter a valid Manufacturer URL. Only "http://" and "https://" links with typical top-level domain are accepted' ); @@ -728,11 +728,11 @@ function CatalogueItemsDialog(props: CatalogueItemsDialogProps) { label="Manufacturer URL" required={true} sx={{ marginLeft: '4px', marginTop: '16px' }} - value={catalogueItemManufacturer.web_url} + value={catalogueItemManufacturer.url} onChange={(event) => { onChangeCatalogueItemManufacturer({ ...catalogueItemManufacturer, - web_url: event.target.value, + url: event.target.value, }); setFormError(false); setFormErrorMessage(undefined); diff --git a/src/catalogue/items/catalogueItemsLandingPage.component.tsx b/src/catalogue/items/catalogueItemsLandingPage.component.tsx index 6768fb7e4..fdb131f70 100644 --- a/src/catalogue/items/catalogueItemsLandingPage.component.tsx +++ b/src/catalogue/items/catalogueItemsLandingPage.component.tsx @@ -62,7 +62,7 @@ function CatalogueItemsLandingPage() { React.useState({ name: '', address: '', - web_url: '', + url: '', }); const [catalogueItemPropertyValues, setCatalogueItemPropertyValues] = @@ -235,9 +235,9 @@ function CatalogueItemsLandingPage() { - {catalogueItemIdData.manufacturer.web_url} + {catalogueItemIdData.manufacturer.url} } /> diff --git a/src/catalogue/items/catalogueItemsTable.component.test.tsx b/src/catalogue/items/catalogueItemsTable.component.test.tsx index 3a4424a39..85bfb73f4 100644 --- a/src/catalogue/items/catalogueItemsTable.component.test.tsx +++ b/src/catalogue/items/catalogueItemsTable.component.test.tsx @@ -23,7 +23,7 @@ describe('Catalogue Items Table', () => { onChangeCatalogueItemDetails: onChangeCatalogueItemDetails, catalogueItemManufacturer: { name: '', - web_url: '', + url: '', address: '', }, onChangeCatalogueItemManufacturer: onChangeCatalogueItemManufacturer, diff --git a/src/catalogue/items/catalogueItemsTable.component.tsx b/src/catalogue/items/catalogueItemsTable.component.tsx index f0107f18f..a9ca01b29 100644 --- a/src/catalogue/items/catalogueItemsTable.component.tsx +++ b/src/catalogue/items/catalogueItemsTable.component.tsx @@ -305,9 +305,9 @@ const CatalogueItemsTable = (props: CatalogueItemsTableProps) => { - {item.manufacturer.web_url} + {item.manufacturer.url}