Skip to content

Commit

Permalink
Merge pull request #113 from ral-facilities/change-web_url-to-url
Browse files Browse the repository at this point in the history
changed 'web_url' to 'url'
  • Loading branch information
MatteoGuarnaccia5 authored Nov 1, 2023
2 parents 2428ccc + 7cff6c0 commit 45e7d3f
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 94 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/catalogue/catalogueItems.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}'
);
});
});
Expand Down Expand Up @@ -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"}}'
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/api/catalogueItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion src/app.types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface CatalogueItemDetails {
export interface CatalogueItemManufacturer {
name: string;
address: string;
web_url: string;
url: string;
}

export interface CatalogueItemProperty {
Expand Down
2 changes: 1 addition & 1 deletion src/catalogue/catalogue.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function Catalogue() {
React.useState<CatalogueItemManufacturer>({
name: '',
address: '',
web_url: '',
url: '',
});

const [catalogueItemPropertyValues, setCatalogueItemPropertyValues] =
Expand Down
58 changes: 29 additions & 29 deletions src/catalogue/items/catalogueItemsDialog.component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Catalogue Items Dialog', () => {
onChangeCatalogueItemDetails: onChangeCatalogueItemDetails,
catalogueItemManufacturer: {
name: '',
web_url: '',
url: '',
address: '',
},
onChangeCatalogueItemManufacturer: onChangeCatalogueItemManufacturer,
Expand Down Expand Up @@ -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',
},
};
Expand All @@ -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: [
Expand All @@ -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',
},
};
Expand All @@ -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: [
Expand All @@ -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',
},
};
Expand All @@ -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: [
Expand Down Expand Up @@ -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',
},
};
Expand Down Expand Up @@ -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',
},
};
Expand Down Expand Up @@ -322,15 +322,15 @@ describe('Catalogue Items Dialog', () => {
id: '90',
manufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
},
catalogueItemPropertiesForm: getCatalogueItemsPropertiesById('4'),
propertyValues: [24, 240, 'CCD', 'Nikon', false, true],
catalogueItemManufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
};
Expand Down Expand Up @@ -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',
},
};
Expand Down Expand Up @@ -427,15 +427,15 @@ describe('Catalogue Items Dialog', () => {
id: '90',
manufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
},
catalogueItemPropertiesForm: getCatalogueItemsPropertiesById('4'),
propertyValues: [null, 240, null, 'Nikon', '', true],
catalogueItemManufacturer: {
name: '',
web_url: '',
url: '',
address: '',
},
};
Expand Down Expand Up @@ -497,15 +497,15 @@ describe('Catalogue Items Dialog', () => {
id: '90',
manufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
},
catalogueItemPropertiesForm: getCatalogueItemsPropertiesById('4'),
propertyValues: [24, 240, 'CCD', 'Nikon', true, true],
catalogueItemManufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
};
Expand Down Expand Up @@ -552,15 +552,15 @@ describe('Catalogue Items Dialog', () => {
id: '90',
manufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
},
catalogueItemPropertiesForm: getCatalogueItemsPropertiesById('4'),
propertyValues: [24, 240, 'CCD', 'Nikon', 'true', 'false'],
catalogueItemManufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
};
Expand Down Expand Up @@ -607,15 +607,15 @@ describe('Catalogue Items Dialog', () => {
id: '90',
manufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
},
catalogueItemPropertiesForm: getCatalogueItemsPropertiesById('4'),
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',
},
};
Expand All @@ -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',
},
});
Expand Down Expand Up @@ -659,15 +659,15 @@ describe('Catalogue Items Dialog', () => {
id: '90',
manufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
},
catalogueItemPropertiesForm: getCatalogueItemsPropertiesById('4'),
propertyValues: [24, 240, 'CCD', 'Nikon', false, true],
catalogueItemManufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
};
Expand Down Expand Up @@ -769,15 +769,15 @@ describe('Catalogue Items Dialog', () => {
id: '90',
manufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
},
catalogueItemPropertiesForm: getCatalogueItemsPropertiesById('4'),
propertyValues: [24, 240, 'CCD', 'NIkon', false, true],
catalogueItemManufacturer: {
name: 'Manufacturer A',
web_url: 'http://example.com',
url: 'http://example.com',
address: '10 My Street',
},
};
Expand Down Expand Up @@ -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',
},
};
Expand Down Expand Up @@ -996,7 +996,7 @@ describe('Catalogue Items Dialog', () => {

expect(onChangeCatalogueItemManufacturer).toHaveBeenCalledWith({
...props.catalogueItemManufacturer,
web_url: newManufacturerUrl,
url: newManufacturerUrl,
});
});
});
Expand Down
18 changes: 9 additions & 9 deletions src/catalogue/items/catalogueItemsDialog.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function CatalogueItemsDialog(props: CatalogueItemsDialogProps) {
onChangeCatalogueItemManufacturer({
name: '',
address: '',
web_url: '',
url: '',
});
onChangePropertyValues([]);
setPropertyErrors(
Expand Down Expand Up @@ -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'
);
Expand Down Expand Up @@ -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'
);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/catalogue/items/catalogueItemsLandingPage.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function CatalogueItemsLandingPage() {
React.useState<CatalogueItemManufacturer>({
name: '',
address: '',
web_url: '',
url: '',
});

const [catalogueItemPropertyValues, setCatalogueItemPropertyValues] =
Expand Down Expand Up @@ -235,9 +235,9 @@ function CatalogueItemsLandingPage() {
<MuiLink
underline="hover"
target="_blank"
href={catalogueItemIdData.manufacturer.web_url}
href={catalogueItemIdData.manufacturer.url}
>
{catalogueItemIdData.manufacturer.web_url}
{catalogueItemIdData.manufacturer.url}
</MuiLink>
}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/catalogue/items/catalogueItemsTable.component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Catalogue Items Table', () => {
onChangeCatalogueItemDetails: onChangeCatalogueItemDetails,
catalogueItemManufacturer: {
name: '',
web_url: '',
url: '',
address: '',
},
onChangeCatalogueItemManufacturer: onChangeCatalogueItemManufacturer,
Expand Down
Loading

0 comments on commit 45e7d3f

Please sign in to comment.