Skip to content

Commit 3fdfc86

Browse files
authored
Merge pull request #1649 from ral-facilities/add-description-to-system-types-#1540
Add description to system types #1540
2 parents b9ac5b4 + cee12af commit 3fdfc86

File tree

8 files changed

+286
-15
lines changed

8 files changed

+286
-15
lines changed

cypress/e2e/with_api/systemTypes/systemTypes.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ describe('System Types', () => {
1313
cy.findByText('Operational').should('exist');
1414
cy.findByText('Scrapped').should('exist');
1515

16-
// Check that spares defintion button filters the table
16+
// Check that spares definition button filters the table
1717
cy.findByRole('button', { name: 'Show Spares Definition' }).click();
1818

1919
cy.findByText('Operational').should('not.exist');
2020
cy.findByText('Scrapped').should('not.exist');
2121
cy.findByText('Storage').should('exist');
2222
cy.findByText('Spares Definition Filter Applied').should('exist');
2323

24-
// filters by spares defintion from the settings page
24+
// filters by spares definition from the settings page
2525

2626
cy.findByRole('button', { name: 'navigate to settings home' }).click();
2727
cy.findByText('Spares Definition').click();

cypress/e2e/with_mock_data/systemTypes.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ describe('System Types', () => {
99
it('should render table correctly', () => {
1010
cy.findByText('Value').should('be.visible');
1111
cy.findByText('Storage').should('be.visible');
12+
cy.findByText('Description').should('be.visible');
13+
cy.findByText('Storage system type').should('be.visible');
1214
});
1315

1416
it('sets and clears the table filters', () => {

cypress/e2e/with_mock_data/systems.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ describe('Systems', () => {
928928
created_time: '2024-01-01T12:00:00.000+00:00',
929929
modified_time: '2024-01-02T13:10:10.000+00:00',
930930
type_id: '2',
931-
type: { id: '2', value: 'Operational' },
931+
type: { id: '2', value: 'Operational', description: 'Operational system type' },
932932
})
933933
);
934934
expect(JSON.stringify(await postRequests[1].json())).equal(
@@ -944,7 +944,7 @@ describe('Systems', () => {
944944
created_time: '2024-01-01T12:00:00.000+00:00',
945945
modified_time: '2024-01-02T13:10:10.000+00:00',
946946
type_id: '2',
947-
type: { id: '2', value: 'Operational' },
947+
type: { id: '2', value: 'Operational', description: 'Operational system type' },
948948
})
949949
);
950950
});

src/api/api.types.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export interface System extends CreatedModifiedMixin, Required<SystemPost> {
108108
export interface SystemType {
109109
id: string;
110110
value: string;
111+
description: string;
111112
}
112113

113114
// ------------------------------------ CATALOGUE CATEGORIES ------------------------------------

src/apiConfigProvider.component.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ describe('APIConfigProvider', () => {
5858
],
5959
},
6060
isLoading: false,
61-
sparesDefinition: { system_types: [{ id: '1', value: 'Storage' }] },
61+
sparesDefinition: {
62+
system_types: [
63+
{ id: '1', value: 'Storage', description: 'Storage system type' },
64+
],
65+
},
6266
},
6367
})
6468
);

src/mocks/SystemTypes.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
[
22
{
33
"id": "1",
4-
"value": "Storage"
4+
"value": "Storage",
5+
"description": "Storage system type"
56
},
67
{
78
"id": "2",
8-
"value": "Operational"
9+
"value": "Operational",
10+
"description": "Operational system type"
911
},
10-
{ "id": "3", "value": "Scrapped" }
12+
{ "id": "3",
13+
"value": "Scrapped",
14+
"description": "Scrapped system type"
15+
}
1116
]

src/settings/systemTypes/__snapshots__/systemsTypes.component.test.tsx.snap

Lines changed: 257 additions & 7 deletions
Large diffs are not rendered by default.

src/settings/systemTypes/systemTypes.component.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ function SystemTypes() {
6969
columnFilterModeOptions: COLUMN_FILTER_MODE_OPTIONS.string,
7070
Cell: ({ row }) => row.original.value,
7171
},
72+
{
73+
header: 'Description',
74+
Header: TableHeaderOverflowTip,
75+
accessorFn: (row) => row.description,
76+
id: 'description',
77+
filterVariant: COLUMN_FILTER_VARIANTS.string,
78+
filterFn: COLUMN_FILTER_FUNCTIONS.string,
79+
columnFilterModeOptions: COLUMN_FILTER_MODE_OPTIONS.string,
80+
},
7281
{
7382
header: 'Used For Spares',
7483
Header: TableHeaderOverflowTip,

0 commit comments

Comments
 (0)