Skip to content

Commit

Permalink
Merge branch 'rename-maufacturer-api-functions-#674' into RHF-ZOD-Man…
Browse files Browse the repository at this point in the history
…ufacturers-#663

* rename-maufacturer-api-functions-#674: (23 commits)
  Omit overridden types #664
  Update httpd:2.4.59-alpine3.20 Docker digest to 71f38b7
  Update Node.js to 6ce211b
  changed disabled rpws text to `text.secondary` #507
  Point CI API tests back to develop #661
  update breadcrumbs snapshot
  changed tooltip labels to say `details` #507
  removed uneeded aria-label in breadcrumbs #507
  refactored external links test #689
  removed string used for debugging
  updated snapshots #507
  fixed breadcrumbs fastpass issue #507
  changed aria-label  in overflow tooltip
  changed obsolete replacement table unselectable item text colour #507
  added label to obsolete reason textfield #507
  improved colour contrast in cat cat dialog #507
  added aria-label to tooltip #507
  point at ral-facilities/inventory-management-system-api#294 for the e2e tests
  Rename catalogue_item_properites to properties #661
  added aria label to tooltip in items dialog
  ...
  • Loading branch information
joshuadkitenge committed Jun 21, 2024
2 parents 027aa4e + 3475297 commit a30ae93
Show file tree
Hide file tree
Showing 32 changed files with 220 additions and 251 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Specify a base image
FROM node:20.14.0-alpine3.20@sha256:66c7d989b6dabba6b4305b88f40912679aebd9f387a5b16ffa76dfb9ae90b060
FROM node:20.14.0-alpine3.20@sha256:6ce211be2226e86d61413dc19f11cab7ab96205837811c6356881a4157cea0c5

# Set the working directory
WORKDIR /inventory-management-system-run
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dockerfile to build and serve inventory management system

# Build stage
FROM node:20.14.0-alpine3.20@sha256:66c7d989b6dabba6b4305b88f40912679aebd9f387a5b16ffa76dfb9ae90b060 as builder
FROM node:20.14.0-alpine3.20@sha256:6ce211be2226e86d61413dc19f11cab7ab96205837811c6356881a4157cea0c5 as builder

WORKDIR /inventory-management-system-build

Expand Down Expand Up @@ -30,7 +30,7 @@ RUN set -eux; \
yarn build;

# Run stage
FROM httpd:2.4.59-alpine3.20@sha256:554f25b8496f360a58febaaa5df9effb8e037cc1b70b27d40b7353a85e8edbf0
FROM httpd:2.4.59-alpine3.20@sha256:71f38b7a2394cccbbcfca9a1d17f3a0a03444e98aac8e4bd1616786c27bf6b64

WORKDIR /usr/local/apache2/htdocs

Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/with_mock_data/catalogueCategories.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ describe('Catalogue Category', () => {
JSON.stringify({
name: 'test',
is_leaf: true,
catalogue_item_properties: [
properties: [
{ name: 'Updated Field 1', type: 'boolean', mandatory: false },
{
name: 'Updated Field 2',
Expand Down Expand Up @@ -350,7 +350,7 @@ describe('Catalogue Category', () => {
JSON.stringify({
name: 'test',
is_leaf: true,
catalogue_item_properties: [
properties: [
{ name: 'Updated Field 1', type: 'boolean', mandatory: false },
{
name: 'Updated Field 2',
Expand Down Expand Up @@ -692,7 +692,7 @@ describe('Catalogue Category', () => {
parent_id: null,
code: 'cameras',
is_leaf: true,
catalogue_item_properties: [
properties: [
{
name: 'Resolution',
type: 'number',
Expand Down Expand Up @@ -806,7 +806,7 @@ describe('Catalogue Category', () => {
parent_id: '2',
code: 'cameras',
is_leaf: true,
catalogue_item_properties: [
properties: [
{
name: 'Resolution',
type: 'number',
Expand Down
18 changes: 7 additions & 11 deletions cypress/e2e/with_mock_data/homePage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ describe('IMS HomePage', () => {
cy.url().should('include', '/manufacturers');
cy.go('back');

cy.origin('https://www.clf.stfc.ac.uk/Pages/EPAC-Applications.aspx', () => {
cy.on('uncaught:exception', () => {
return false;
});
});
cy.get('[data-testid="facility-button"]').click();
cy.url().should(
'equal',
'https://www.clf.stfc.ac.uk/Pages/EPAC-Applications.aspx'
);
cy.go('back');
cy.findAllByTestId('facility-button')
.first()
.should('have.attr', 'href')
.should(
'include',
'https://www.clf.stfc.ac.uk/Pages/EPAC-Applications.aspx'
);
});
});
6 changes: 4 additions & 2 deletions src/api/api.types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface APIError {
detail: string;
}

// Manufacturers
// ------------------------------------ MANUFACTURERS ------------------------------------

interface Address {
address_line: string;
Expand Down Expand Up @@ -37,7 +37,9 @@ export interface ManufacturerPatch
id: string;
}

export interface Manufacturer extends ManufacturerPost, CreatedModifiedMixin {
export interface Manufacturer
extends Omit<ManufacturerPost, 'telephone' | 'url' | 'address'>,
CreatedModifiedMixin {
id: string;
code: string;
address: Address;
Expand Down
10 changes: 5 additions & 5 deletions src/api/catalogueCategories.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('catalogue categories api functions', () => {
expect(result.current.isSuccess).toBeTruthy();
});
expect(result.current.data).toEqual({
catalogue_item_properties: [
properties: [
{
id: '1',
allowed_values: null,
Expand Down Expand Up @@ -253,7 +253,7 @@ describe('catalogue categories api functions', () => {
parent_id: '1',
code: 'wavefront-sensors',
is_leaf: true,
catalogue_item_properties: [
properties: [
{
id: '1',
name: 'Wavefront Measurement Range',
Expand All @@ -277,7 +277,7 @@ describe('catalogue categories api functions', () => {
parent_id: '1',
code: 'energy-meters',
is_leaf: true,
catalogue_item_properties: [
properties: [
{
id: '3',
name: 'Measurement Range',
Expand Down Expand Up @@ -418,7 +418,7 @@ describe('catalogue categories api functions', () => {
parent_id: '1',
code: 'wavefront-sensors',
is_leaf: true,
catalogue_item_properties: [
properties: [
{
id: '1',
name: 'Wavefront Measurement Range',
Expand All @@ -442,7 +442,7 @@ describe('catalogue categories api functions', () => {
parent_id: '1',
code: 'energy-meters',
is_leaf: true,
catalogue_item_properties: [
properties: [
{
id: '3',
name: 'Measurement Range',
Expand Down
4 changes: 2 additions & 2 deletions src/api/catalogueItems.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ describe('catalogue items api functions', () => {
name: 'RF Lenses',
is_leaf: true,
parent_id: '655ca56c1c251a2a828ca906',
catalogue_item_properties: [
properties: [
{
id: '91',
name: 'center wavelength',
Expand Down Expand Up @@ -446,7 +446,7 @@ describe('catalogue items api functions', () => {
name: 'RF Lenses',
is_leaf: true,
parent_id: '655ca56c1c251a2a828ca906',
catalogue_item_properties: [
properties: [
{
id: '90',
name: 'center wavelength',
Expand Down
3 changes: 1 addition & 2 deletions src/api/catalogueItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ export const useCopyToCatalogueItem = (): UseMutationResult<
// in tests

const targetProperties =
copyToCatalogueItem.targetCatalogueCategory
?.catalogue_item_properties;
copyToCatalogueItem.targetCatalogueCategory?.properties;

const properties = catalogueItem.properties.map((property) => {
const targetPropertyId = targetProperties?.find(
Expand Down
6 changes: 3 additions & 3 deletions src/app.types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export interface AddCatalogueCategory {
name: string;
parent_id?: string | null;
is_leaf: boolean;
catalogue_item_properties?: AddCatalogueCategoryProperty[];
properties?: AddCatalogueCategoryProperty[];
}

export interface AddCatalogueCategoryWithPlacementIds
extends AddCatalogueCategory {
catalogue_item_properties?: AddCatalogueCategoryPropertyWithPlacementIds[];
properties?: AddCatalogueCategoryPropertyWithPlacementIds[];
}

export interface EditCatalogueCategory {
Expand Down Expand Up @@ -49,7 +49,7 @@ export interface CatalogueCategory {
parent_id: string | null;
code: string;
is_leaf: boolean;
catalogue_item_properties?: CatalogueCategoryProperty[];
properties?: CatalogueCategoryProperty[];
created_time: string;
modified_time: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ describe('Catalogue Category Dialog', () => {
await waitFor(() => user.click(saveButton));

expect(axiosPostSpy).toHaveBeenCalledWith('/v1/catalogue-categories', {
catalogue_item_properties: [
properties: [
{
mandatory: true,
name: 'radius',
Expand Down Expand Up @@ -375,7 +375,7 @@ describe('Catalogue Category Dialog', () => {
await waitFor(() => user.click(saveButton));

expect(axiosPostSpy).toHaveBeenCalledWith('/v1/catalogue-categories', {
catalogue_item_properties: [
properties: [
{
allowed_values: { type: 'list', values: [1, 2, 8] },
mandatory: true,
Expand Down Expand Up @@ -414,7 +414,7 @@ describe('Catalogue Category Dialog', () => {
await waitFor(() => user.click(saveButton));

expect(axiosPostSpy).toHaveBeenCalledWith('/v1/catalogue-categories', {
catalogue_item_properties: [
properties: [
{
allowed_values: { type: 'list', values: ['1', '2', '8'] },
mandatory: true,
Expand Down Expand Up @@ -839,7 +839,7 @@ describe('Catalogue Category Dialog', () => {
parent_id: '1',
code: 'voltage-meters',
is_leaf: true,
catalogue_item_properties: [
properties: [
{
id: '1',
name: 'Measurement Range',
Expand Down Expand Up @@ -897,7 +897,7 @@ describe('Catalogue Category Dialog', () => {

expect(axiosPatchSpy).toHaveBeenCalledWith('/v1/catalogue-categories/4', {
name: 'test2',
catalogue_item_properties: undefined,
properties: undefined,
});

expect(onClose).toHaveBeenCalled();
Expand Down Expand Up @@ -972,7 +972,7 @@ describe('Catalogue Category Dialog', () => {
props.selectedCatalogueCategory = {
...mockData,
is_leaf: true,
catalogue_item_properties: [
properties: [
{
id: '1',
name: 'Field 1',
Expand Down Expand Up @@ -1002,7 +1002,7 @@ describe('Catalogue Category Dialog', () => {
expect(axiosPostSpy).toHaveBeenCalledWith('/v1/catalogue-categories', {
...values,
is_leaf: true,
catalogue_item_properties: [
properties: [
{
name: 'Field 1',
type: 'text',
Expand Down
Loading

0 comments on commit a30ae93

Please sign in to comment.