diff --git a/src/components/common/Status/StatusData.js b/src/components/common/Status/StatusData.js index 0219be0204b2424fc75c523e0c4c3e9d722dc08d..e922d850abc0b8aac3f0c3df8cec8ebae5922b16 100644 --- a/src/components/common/Status/StatusData.js +++ b/src/components/common/Status/StatusData.js @@ -66,10 +66,7 @@ export const getStatus = (state, alert) => { ) { // Active status / running return STATUS.active; - } else if ( - isActive === false && - (alertSeverity === undefined || alertSeverity === SEVERITY.info) - ) { + } else if (isActive !== false && !isActive) { // stopped/paused return STATUS.disabled; } else if ( @@ -87,21 +84,13 @@ export const getStatus = (state, alert) => { // warning return STATUS.warning; } else if ( - (!isActive || isActive === null) && - (alertSeverity === undefined || alertSeverity === SEVERITY.info) + isActive === false && + (!alertSeverity || alertSeverity === SEVERITY.info) ) { - // Inactive status return STATUS.inactive; - } else if ( - (!isActive || isActive === null) && - alertSeverity === SEVERITY.alert - ) { - // inactive with warning/error + } else if (isActive === false && alertSeverity === SEVERITY.alert) { return STATUS.inactiveAlert; - } else if ( - (!isActive || isActive === null) && - alertSeverity === SEVERITY.warning - ) { + } else if (isActive === false && alertSeverity === SEVERITY.warning) { return STATUS.inactiveWarning; } else { // unknown fallback state diff --git a/src/mocks/fixtures/IOCAlerts.json b/src/mocks/fixtures/IOCAlerts.json index c59b7949d6dd5560af3230f9d282e766d7c64940..fe65d8dab1d9c525953ae81d9d65cec804552861 100644 --- a/src/mocks/fixtures/IOCAlerts.json +++ b/src/mocks/fixtures/IOCAlerts.json @@ -17,19 +17,8 @@ }, { "iocId": 15, - "alertSeverity": "WARNING", - "alerts": [ - { - "type": "WARNING", - "message": "This is warning 1", - "link": null - }, - { - "type": "WARNING", - "message": "This is warning 2", - "link": null - } - ] + "alertSeverity": null, + "alerts": [] }, { "iocId": 18, @@ -55,16 +44,32 @@ }, { "iocId": 21, - "alertSeverity": null, - "alerts": [] + "alertSeverity": "ERROR", + "alerts": [ + { + "type": "INFO", + "message": "IOC is not deployed", + "link": null + }, + { + "type": "ERROR", + "message": "IOC's latest deployment failed, IOC may be in inconsistent state", + "link": null + }, + { + "type": "WARNING", + "message": "This is a warning message", + "link": null + } + ] }, { "iocId": 49, - "alertSeverity": "INFO", + "alertSeverity": "WARNING", "alerts": [ { - "type": "INFO", - "message": "IOC is not deployed", + "type": "WARNING", + "message": "This is a warning message", "link": null } ] @@ -86,18 +91,7 @@ }, { "iocId": 43, - "alertSeverity": "ERROR", - "alerts": [ - { - "type": "ERROR", - "message": "IOC's latest deployment failed, IOC may be in inconsistent state", - "link": null - }, - { - "type": "WARNING", - "message": "This is a warning message", - "link": null - } - ] + "alertSeverity": null, + "alerts": [] } ] diff --git a/src/mocks/fixtures/IOCStatus.json b/src/mocks/fixtures/IOCStatus.json index c3da909354450a047337517e7c5d4c06597327e3..960a113627b09dd971261121a5f3c927b0aa7d57 100644 --- a/src/mocks/fixtures/IOCStatus.json +++ b/src/mocks/fixtures/IOCStatus.json @@ -9,7 +9,15 @@ }, { "iocId": 18, - "isActive": null + "alertSeverity": "INFO", + "alerts": [ + { + "type": "INFO", + "message": "IOC is not deployed", + "link": null + } + ], + "isActive": false }, { "iocId": 39, @@ -17,11 +25,27 @@ }, { "iocId": 21, - "isActive": null + "alertSeverity": "INFO", + "alerts": [ + { + "type": "INFO", + "message": "IOC is not deployed", + "link": null + } + ], + "isActive": false }, { "iocId": 49, - "isActive": null + "alertSeverity": "INFO", + "alerts": [ + { + "type": "INFO", + "message": "IOC is not deployed", + "link": null + } + ], + "isActive": false }, { "iocId": 40,