Skip to content
Snippets Groups Projects
Commit 39a7d11d authored by Johanna Szepanski's avatar Johanna Szepanski Committed by EREBUS_DMN\jsz
Browse files

adjusted IOC details story and mockdata to accomodate api changes

parent 66c76aa0
No related branches found
No related tags found
2 merge requests!542Prepare 4.1.0,!521CE-3061: Update ioc alerts and status separately
[
{
"iocId": 14,
"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
}
]
},
{
"iocId": 15,
"alertSeverity": "WARNING",
"alerts": [
{
"type": "WARNING",
"message": "This is warning 1",
"link": null
},
{
"type": "WARNING",
"message": "This is warning 2",
"link": null
}
]
},
{
"iocId": 18,
"alertSeverity": "INFO",
"alerts": [
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
]
},
{
"iocId": 39,
"alertSeverity": "WARNING",
"alerts": [
{
"type": "WARNING",
"message": "IOC is active with warning message",
"link": null
}
]
},
{
"iocId": 21,
"alertSeverity": null,
"alerts": []
},
{
"iocId": 49,
"alertSeverity": "INFO",
"alerts": [
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
]
},
{
"iocId": 40,
"alertSeverity": null,
"alerts": []
},
{
"iocId": 41,
"alertSeverity": null,
"alerts": []
},
{
"iocId": 42,
"alertSeverity": null,
"alerts": []
},
{
"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
}
]
}
]
...@@ -7,26 +7,6 @@ ...@@ -7,26 +7,6 @@
"namingUuid": "82a01351-2892-491e-932b-6fe438216cfd", "namingUuid": "82a01351-2892-491e-932b-6fe438216cfd",
"gitProjectId": 5959, "gitProjectId": 5959,
"sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git", "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-01.git",
"activeDeployment": null,
"deployedWithOldPlaybook": true,
"alerts": [
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"operationInProgress": false,
"active": null
},
{
"id": 15,
"description": "Test IOC for CCCE",
"namingName": "CCCE:MOCK2",
"createdBy": "mock user 2",
"namingUuid": "0a7fdee4-cfa6-447f-ab85-ae9335507fd3",
"gitProjectId": 5970,
"sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-02.git",
"activeDeployment": { "activeDeployment": {
"id": 410, "id": 410,
"createdBy": "johannaszepanski", "createdBy": "johannaszepanski",
...@@ -46,26 +26,21 @@ ...@@ -46,26 +26,21 @@
"hostName": "ccce-test-ioc-01", "hostName": "ccce-test-ioc-01",
"network": "CSLab-GeneralLab" "network": "CSLab-GeneralLab"
}, },
"jobId": 6588, "deployedWithOldPlaybook": true,
"sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-02.git", "operationInProgress": false
"sourceVersionShort": "d4df546c", }
"operationStatus": "FAILED" },
}, {
"id": 15,
"description": "Test IOC for CCCE",
"namingName": "CCCE:MOCK2",
"createdBy": "mock user 2",
"namingUuid": "0a7fdee4-cfa6-447f-ab85-ae9335507fd3",
"gitProjectId": 5970,
"sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-02.git",
"activeDeployment": null,
"deployedWithOldPlaybook": false, "deployedWithOldPlaybook": false,
"alerts": [ "operationInProgress": false
{
"type": "ERROR",
"message": "Example alert without link",
"link": null
},
{
"type": "ERROR",
"message": "Example alert with link",
"link": "https://google.com"
}
],
"operationInProgress": false,
"active": null
}, },
{ {
"id": 18, "id": 18,
...@@ -77,13 +52,6 @@ ...@@ -77,13 +52,6 @@
"sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-03.git", "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-test-03.git",
"activeDeployment": null, "activeDeployment": null,
"deployedWithOldPlaybook": false, "deployedWithOldPlaybook": false,
"alerts": [
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"operationInProgress": false, "operationInProgress": false,
"active": null "active": null
}, },
...@@ -120,7 +88,6 @@ ...@@ -120,7 +88,6 @@
"operationStatus": "FAILED" "operationStatus": "FAILED"
}, },
"deployedWithOldPlaybook": false, "deployedWithOldPlaybook": false,
"alerts": [],
"operationInProgress": false, "operationInProgress": false,
"active": null "active": null
}, },
...@@ -156,7 +123,6 @@ ...@@ -156,7 +123,6 @@
"operationStatus": "SUCCESSFUL" "operationStatus": "SUCCESSFUL"
}, },
"deployedWithOldPlaybook": false, "deployedWithOldPlaybook": false,
"alerts": [],
"operationInProgress": false, "operationInProgress": false,
"active": null "active": null
}, },
...@@ -170,13 +136,6 @@ ...@@ -170,13 +136,6 @@
"sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-jsztest-3.git", "sourceUrl": "https://gitlab.esss.lu.se/ccce/dev/iocs/instances/e3-ioc-jsztest-3.git",
"activeDeployment": null, "activeDeployment": null,
"deployedWithOldPlaybook": true, "deployedWithOldPlaybook": true,
"alerts": [
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"operationInProgress": false, "operationInProgress": false,
"active": null "active": null
}, },
...@@ -189,18 +148,6 @@ ...@@ -189,18 +148,6 @@
"sourceUrl": null, "sourceUrl": null,
"activeDeployment": null, "activeDeployment": null,
"deployedWithOldPlaybook": true, "deployedWithOldPlaybook": true,
"alerts": [
{
"type": "ERROR",
"message": "Cannot find the repository in Gitlab",
"link": null
},
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"operationInProgress": false, "operationInProgress": false,
"active": null "active": null
}, },
...@@ -213,18 +160,6 @@ ...@@ -213,18 +160,6 @@
"sourceUrl": null, "sourceUrl": null,
"activeDeployment": null, "activeDeployment": null,
"deployedWithOldPlaybook": true, "deployedWithOldPlaybook": true,
"alerts": [
{
"type": "ERROR",
"message": "Cannot find the repository in Gitlab",
"link": null
},
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"operationInProgress": false, "operationInProgress": false,
"active": null "active": null
}, },
...@@ -238,18 +173,6 @@ ...@@ -238,18 +173,6 @@
"sourceUrl": null, "sourceUrl": null,
"activeDeployment": null, "activeDeployment": null,
"deployedWithOldPlaybook": true, "deployedWithOldPlaybook": true,
"alerts": [
{
"type": "ERROR",
"message": "Cannot find the repository in Gitlab",
"link": null
},
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"operationInProgress": false, "operationInProgress": false,
"active": null "active": null
}, },
...@@ -263,19 +186,6 @@ ...@@ -263,19 +186,6 @@
"sourceUrl": null, "sourceUrl": null,
"activeDeployment": null, "activeDeployment": null,
"deployedWithOldPlaybook": true, "deployedWithOldPlaybook": true,
"alerts": [ "operationInProgress": false
{
"type": "ERROR",
"message": "Cannot find the repository in Gitlab",
"link": null
},
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"operationInProgress": false,
"active": null
} }
] ]
[ [
{ {
"iocId": 14, "iocId": 14,
"alertSeverity": "ERROR", "isActive": true
"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
}
],
"active": true
}, },
{ {
"iocId": 15, "iocId": 15,
"alertSeverity": "WARNING", "isActive": null
"alerts": [
{
"type": "WARNING",
"message": "This is warning 1",
"link": null
},
{
"type": "WARNING",
"message": "This is warning 2",
"link": null
}
],
"active": null
}, },
{ {
"iocId": 18, "iocId": 18,
"alertSeverity": "INFO", "isActive": null
"alerts": [
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"active": null
}, },
{ {
"iocId": 39, "iocId": 39,
"alertSeverity": null, "isActive": true
"alerts": [],
"active": null
}, },
{ {
"iocId": 21, "iocId": 21,
"alertSeverity": null, "isActive": null
"alerts": [],
"active": null
}, },
{ {
"iocId": 49, "iocId": 49,
"alertSeverity": "INFO", "isActive": null
"alerts": [
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"active": null
}, },
{ {
"iocId": 40, "iocId": 40,
"alertSeverity": null, "isActive": true
"alerts": [],
"active": true
}, },
{ {
"iocId": 41, "iocId": 41,
"alertSeverity": null, "isActive": true
"alerts": [],
"active": true
}, },
{ {
"iocId": 42, "iocId": 42,
"alertSeverity": null, "isActive": true
"alerts": [],
"active": true
}, },
{ {
"iocId": 43, "iocId": 43,
"alertSeverity": "ERROR", "isActive": null
"alerts": [
{
"type": "ERROR",
"message": "Cannot find the repository in Gitlab",
"link": null
},
{
"type": "INFO",
"message": "IOC is not deployed",
"link": null
}
],
"active": null
} }
] ]
This diff is collapsed.
...@@ -230,6 +230,17 @@ function fetchIocStatus(req) { ...@@ -230,6 +230,17 @@ function fetchIocStatus(req) {
return { body, status }; return { body, status };
} }
function fetchIocAlerts(req) {
const params = getParameters(req, "/iocs/:ioc_id/alerts");
const data = require("./fixtures/IOCAlerts.json");
const body = data.find((x) => `${x.iocId}` === params.ioc_id);
console.debug("fetchIocStatus", data, params, body);
const status = body ? 200 : 404;
return { body, status };
}
function currentlyActiveIocs(req) { function currentlyActiveIocs(req) {
const body = require("./fixtures/ActiveIocStatisticsResponse.json"); const body = require("./fixtures/ActiveIocStatisticsResponse.json");
return { body }; return { body };
...@@ -295,6 +306,7 @@ const mockAPI = { ...@@ -295,6 +306,7 @@ const mockAPI = {
createIoc, createIoc,
deleteIOC, deleteIOC,
getIocDescription, getIocDescription,
fetchIocAlerts,
fetchIocStatus, fetchIocStatus,
fetchProcServLogLines fetchProcServLogLines
}, },
...@@ -385,6 +397,13 @@ export const apiHandlers = [ ...@@ -385,6 +397,13 @@ export const apiHandlers = [
qRegExp(".*/iocs/[0-9]+/status"), qRegExp(".*/iocs/[0-9]+/status"),
mockAPI.iocs.fetchIocStatus mockAPI.iocs.fetchIocStatus
), ),
makeHandler(
"GET",
qRegExp(".*/iocs/[0-9]+/alerts"),
mockAPI.iocs.fetchIocAlerts
),
makeHandler( makeHandler(
"GET", "GET",
qRegExp(".*/iocs/.*/.*/log"), qRegExp(".*/iocs/.*/.*/log"),
......
...@@ -35,5 +35,5 @@ Deployed.args = { ...@@ -35,5 +35,5 @@ Deployed.args = {
export const DeployedErrors = (args) => <Template {...args} />; export const DeployedErrors = (args) => <Template {...args} />;
DeployedErrors.args = { DeployedErrors.args = {
...config, ...config,
id: 15 id: 14
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment