From 236d2d7ed263f7077c97e9972a745591bbd65f23 Mon Sep 17 00:00:00 2001 From: Sky Brewer <sky.brewer@ess.eu> Date: Wed, 15 May 2024 15:17:53 +0200 Subject: [PATCH] Add story for undeployable Adds some more examples to IOCDetails.json to have all options in desplaying IocDetailsView. Make IOCDetails.json clearer data is faked, and for what purpose each example is for. --- .../IOC/IOCLiveStatus/IOCLiveStatus.spec.js | 8 +- src/mocks/fixtures/IOCDetails.json | 141 +++++++++++++++--- .../views/IOC/IocDetailsView.stories.js | 19 ++- 3 files changed, 137 insertions(+), 31 deletions(-) diff --git a/src/components/IOC/IOCLiveStatus/IOCLiveStatus.spec.js b/src/components/IOC/IOCLiveStatus/IOCLiveStatus.spec.js index a4b03c62..d8930101 100644 --- a/src/components/IOC/IOCLiveStatus/IOCLiveStatus.spec.js +++ b/src/components/IOC/IOCLiveStatus/IOCLiveStatus.spec.js @@ -13,7 +13,7 @@ function IOCLiveStatusContainer() { const params = useMemo( () => ({ - ioc_id: 2 + ioc_id: 5 }), [] ); @@ -28,11 +28,11 @@ function IOCLiveStatusContainer() { function commonTests() { // Expect IOC name in badge - cy.contains("CCCE:SC-IOC-001"); + cy.contains("CCCE:SC-IOC-005"); // Expected in Info table: - cy.contains("ee3ae2a8"); // git reference - cy.contains("Test IOC for CCCE"); // description + cy.contains("0.0.TEST"); // git reference + cy.contains("Test IOC for CCCE LiveStatus"); // description cy.contains("ccce-w40.cslab.esss.lu.se"); // deployed on // Expect alerts to be displayed diff --git a/src/mocks/fixtures/IOCDetails.json b/src/mocks/fixtures/IOCDetails.json index 5772cafb..ec0d60db 100644 --- a/src/mocks/fixtures/IOCDetails.json +++ b/src/mocks/fixtures/IOCDetails.json @@ -1,39 +1,91 @@ [ { "id": 1, - "description": "This is a test IOC for demonstrating the deployment tool", - "createdBy": "johnsparger", - "namingName": "CCCE:SC-IOC-003", + "description": "Test IOC for CCCE", + "createdBy": "johnsmith", + "namingName": "CCCE:SC-IOC-001", "namingUuid": "77325d6f-6d85-443f-b448-3d99a941e23e", "gitProjectId": 5215, - "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/e3-ioc-test_49.git", - "sourceVersion": "0.0.1", - "sourceVersionShort": "0.0.1", + "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git", + "sourceVersion": "0.0.TEST", + "sourceVersionShort": "0.0.TEST", "activeDeployment": null, "alerts": [], - "operationInProgress": false, + "operationInProgress": true, "active": null }, { "id": 2, - "description": "Test IOC for CCCE", - "createdBy": "johnsparger", + "description": "Test IOC for CCCE Deployable", + "createdBy": "johnsmith", "namingName": "CCCE:SC-IOC-001", - "namingUuid": "d8d674c6-6f1a-467e-abd7-ead80dc82152", - "gitProjectId": 4801, - "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/ccce-demo-w38.git", - "sourceVersion": "ee3ae2a8b9e7e83e4eb511eee340716e9d541056", - "sourceVersionShort": "ee3ae2a8", + "namingUuid": "77325d6f-6d85-443f-b448-3d99a941e23e", + "gitProjectId": 5215, + "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git", + "sourceVersion": "0.0.TEST", + "sourceVersionShort": "0.0.TEST", + "activeDeployment": null, + "alerts": [], + "operationInProgress": false, + "active": null + }, + { + "id": 3, + "description": "Test IOC for CCCE Deployed", + "createdBy": "johnsmith", + "namingName": "CCCE:SC-IOC-003", + "namingUuid": "77325d6f-6d85-443f-b448-3d99a941e23e", + "gitProjectId": 5215, + "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git", + "sourceVersion": "0.0.TEST", + "sourceVersionShort": "0.0.TEST", + "activeDeployment": { + "id": 58, + "createdBy": "johnsmith", + "startDate": "2022-04-06T07:33:50.410+00:00", + "undeployment": false, + "namingName": "CCCE:SC-IOC-003", + "gitProjectId": 5215, + "sourceVersion": "0.0.TEST", + "sourceVersionShort": "0.0.TEST", + "endDate": "2022-01-01T01:01:10.000+00:00", + "iocName": "CCCE:SC-IOC-003", + "host": { + "csEntryId": 4195, + "csEntryIdValid": true, + "fqdn": "ccce-w40.cslab.esss.lu.se", + "hostName": "ccce-w40", + "network": "CSLab-GeneralLab" + }, + "status": "JOB", + "awxJobId": 4544, + "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git" + }, + "alerts": [], + "operationInProgress": false, + "active": true + }, + { + "id": 4, + "description": "Test IOC for CCCE Deployed with Errors", + "createdBy": "johnsmith", + "namingName": "CCCE:SC-IOC-004", + "namingUuid": "77325d6f-6d85-443f-b448-3d99a941e23e", + "gitProjectId": 5215, + "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git", + "sourceVersion": "0.0.TEST", + "sourceVersionShort": "0.0.TEST", "activeDeployment": { "id": 58, - "createdBy": "johnsparger", + "createdBy": "johnsmith", "startDate": "2022-04-06T07:33:50.410+00:00", "undeployment": false, - "namingName": "CCCE:SC-IOC-001", - "gitProjectId": 4801, - "sourceVersion": "ee3ae2a8b9e7e83e4eb511eee340716e9d541056", - "endDate": "2022-04-06T07:35:20.736+00:00", - "iocName": "CCCE:SC-IOC-001", + "namingName": "CCCE:SC-IOC-004", + "gitProjectId": 5215, + "sourceVersion": "0.0.TEST", + "sourceVersionShort": "0.0.TEST", + "endDate": "2022-01-01T01:01:10.000+00:00", + "iocName": "CCCE:SC-IOC-004", "host": { "csEntryId": 4195, "csEntryIdValid": true, @@ -43,8 +95,7 @@ }, "status": "JOB", "awxJobId": 4544, - "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/ccce-demo-w38.git", - "sourceVersionShort": "ee3ae2a8" + "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git" }, "alerts": [ { @@ -61,7 +112,49 @@ "active": true }, { - "id": 346, - "description": "Some description" + "id": 5, + "description": "Test IOC for CCCE LiveStatus", + "createdBy": "johnsmith", + "namingName": "CCCE:SC-IOC-005", + "namingUuid": "77325d6f-6d85-443f-b448-3d99a941e23e", + "gitProjectId": 5215, + "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git", + "sourceVersion": "0.0.TESTLIVE", + "sourceVersionShort": "0.0.TESTLIVE", + "activeDeployment": { + "id": 58, + "createdBy": "johnsmith", + "startDate": "2022-04-06T07:33:50.410+00:00", + "undeployment": false, + "namingName": "CCCE:SC-IOC-005", + "gitProjectId": 5215, + "sourceVersion": "0.0.TEST", + "sourceVersionShort": "0.0.TEST", + "endDate": "2022-01-01T01:01:10.000+00:00", + "iocName": "CCCE:SC-IOC-005", + "host": { + "csEntryId": 4195, + "csEntryIdValid": true, + "fqdn": "ccce-w40.cslab.esss.lu.se", + "hostName": "ccce-w40", + "network": "CSLab-GeneralLab" + }, + "status": "JOB", + "awxJobId": 4544, + "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git" + }, + "alerts": [ + { + "type": "ERROR", + "message": "Example alert without link" + }, + { + "type": "ERROR", + "message": "Example alert with link", + "link": "https://google.com" + } + ], + "operationInProgress": false, + "active": true } ] diff --git a/src/stories/views/IOC/IocDetailsView.stories.js b/src/stories/views/IOC/IocDetailsView.stories.js index fab005ae..887b59ca 100644 --- a/src/stories/views/IOC/IocDetailsView.stories.js +++ b/src/stories/views/IOC/IocDetailsView.stories.js @@ -12,17 +12,30 @@ const Template = (args) => ( useTestUser {...args} > - <IOCDetailsContainer id={1} /> + <IOCDetailsContainer id={args.id} /> </AppHarness> ); export const Default = (args) => <Template {...args} />; Default.args = { + id: 1, ...userImpersonatorArgs }; export const Deployable = (args) => <Template {...args} />; Deployable.args = { - id: 2, - ...Default.args + ...Default.args, + id: 2 +}; + +export const Deployed = (args) => <Template {...args} />; +Deployed.args = { + ...Default.args, + id: 3 +}; + +export const DeployedErrors = (args) => <Template {...args} />; +DeployedErrors.args = { + ...Default.args, + id: 4 }; -- GitLab