From 7b3436d2689e30e1e0357749c2d8873c5e72e7a4 Mon Sep 17 00:00:00 2001 From: Domonkos Gulyas <domonkos.gulyas@ess.eu> Date: Tue, 10 Dec 2024 07:53:42 +0000 Subject: [PATCH] CE-3403: Display reverse alias --- src/mocks/fixtures/RecordResponse.json | 6 +- src/mocks/fixtures/ccce-api.json | 914 ++++++++++++------------ src/store/deployApi.ts | 5 +- src/views/records/Alias.jsx | 28 + src/views/records/RecordDetailsView.jsx | 25 +- 5 files changed, 503 insertions(+), 475 deletions(-) create mode 100644 src/views/records/Alias.jsx diff --git a/src/mocks/fixtures/RecordResponse.json b/src/mocks/fixtures/RecordResponse.json index 57f84725..b22bb6a0 100644 --- a/src/mocks/fixtures/RecordResponse.json +++ b/src/mocks/fixtures/RecordResponse.json @@ -14,7 +14,7 @@ "iocVersion": "3926de9c5a8fa42fa8b239f98bf3477059d4cbb6", "description": "Application Directory", "recordType": "waveform", - "alias": null + "aliasFor": null }, { "name": "CCCE:SC-IOC-010:#APP_DIR1", @@ -26,7 +26,7 @@ "iocVersion": "3926de9c5a8fa42fa8b239f98bf3477059d4cbb6", "description": "Application Directory Part 1", "recordType": "stringin", - "alias": null + "aliasFor": null }, { "name": "CCCE:SC-IOC-010:#APP_DIR2", @@ -38,7 +38,7 @@ "iocVersion": "3926de9c5a8fa42fa8b239f98bf3477059d4cbb6", "description": "Application Directory Part 2", "recordType": "stringin", - "alias": null + "aliasFor": null } ] } diff --git a/src/mocks/fixtures/ccce-api.json b/src/mocks/fixtures/ccce-api.json index 90f87924..1de64c44 100644 --- a/src/mocks/fixtures/ccce-api.json +++ b/src/mocks/fixtures/ccce-api.json @@ -60,18 +60,18 @@ "required": true }, "responses": { - "400": { - "description": "Incomplete request", + "201": { + "description": "Maintenance Mode Changed", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/MaintenanceMode" } } } }, - "500": { - "description": "Service exception", + "400": { + "description": "Incomplete request", "content": { "application/json": { "schema": { @@ -80,8 +80,8 @@ } } }, - "422": { - "description": "Unprocessable request", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -90,8 +90,8 @@ } } }, - "401": { - "description": "Unauthorized", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", "content": { "application/json": { "schema": { @@ -100,8 +100,8 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "409": { + "description": "Maintenance Mode already set to that value", "content": { "application/json": { "schema": { @@ -110,8 +110,8 @@ } } }, - "503": { - "description": "Remote service exception", + "422": { + "description": "Unprocessable request", "content": { "application/json": { "schema": { @@ -120,8 +120,8 @@ } } }, - "409": { - "description": "Maintenance Mode already set to that value", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -130,12 +130,12 @@ } } }, - "201": { - "description": "Maintenance Mode Changed", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MaintenanceMode" + "$ref": "#/components/schemas/GeneralException" } } } @@ -196,8 +196,8 @@ } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -226,8 +226,8 @@ } } }, - "424": { - "description": "Metadata file not found, or not processable", + "409": { + "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", "content": { "application/json": { "schema": { @@ -236,8 +236,8 @@ } } }, - "401": { - "description": "Unauthorized", + "422": { + "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", "content": { "application/json": { "schema": { @@ -246,8 +246,8 @@ } } }, - "503": { - "description": "Remote service exception", + "424": { + "description": "Metadata file not found, or not processable", "content": { "application/json": { "schema": { @@ -256,8 +256,8 @@ } } }, - "422": { - "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -266,8 +266,8 @@ } } }, - "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { @@ -300,18 +300,18 @@ "required": true }, "responses": { - "400": { - "description": "Incomplete request", + "201": { + "description": "IOC undeployment initiated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/BatchJob" } } } }, - "500": { - "description": "Service exception", + "400": { + "description": "Incomplete request", "content": { "application/json": { "schema": { @@ -320,8 +320,8 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -330,8 +330,8 @@ } } }, - "424": { - "description": "Metadata file not found, or not processable", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", "content": { "application/json": { "schema": { @@ -340,8 +340,8 @@ } } }, - "401": { - "description": "Unauthorized", + "409": { + "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", "content": { "application/json": { "schema": { @@ -350,8 +350,8 @@ } } }, - "503": { - "description": "Remote service exception", + "422": { + "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", "content": { "application/json": { "schema": { @@ -360,8 +360,8 @@ } } }, - "422": { - "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", + "424": { + "description": "Metadata file not found, or not processable", "content": { "application/json": { "schema": { @@ -370,8 +370,8 @@ } } }, - "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -380,12 +380,12 @@ } } }, - "201": { - "description": "IOC undeployment initiated", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BatchJob" + "$ref": "#/components/schemas/GeneralException" } } } @@ -414,18 +414,18 @@ "required": true }, "responses": { - "400": { - "description": "Incomplete request", + "201": { + "description": "IOC job initiated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/BatchJob" } } } }, - "500": { - "description": "Service exception", + "400": { + "description": "Incomplete request", "content": { "application/json": { "schema": { @@ -434,8 +434,8 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -444,8 +444,8 @@ } } }, - "424": { - "description": "Metadata file not found, or not processable", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", "content": { "application/json": { "schema": { @@ -454,8 +454,8 @@ } } }, - "401": { - "description": "Unauthorized", + "409": { + "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", "content": { "application/json": { "schema": { @@ -464,8 +464,8 @@ } } }, - "503": { - "description": "Remote service exception", + "422": { + "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", "content": { "application/json": { "schema": { @@ -474,18 +474,18 @@ } } }, - "201": { - "description": "IOC job initiated", + "424": { + "description": "Metadata file not found, or not processable", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BatchJob" + "$ref": "#/components/schemas/GeneralException" } } } }, - "422": { - "description": "IOC has no active / NetBox host not found / IOC is not deployed correctly", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -494,8 +494,8 @@ } } }, - "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { @@ -635,12 +635,12 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "A paged array of IOCs", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/PagedIocResponse" } } } @@ -655,12 +655,12 @@ } } }, - "200": { - "description": "A paged array of IOCs", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PagedIocResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -682,18 +682,18 @@ "required": true }, "responses": { - "500": { - "description": "Service exception", + "201": { + "description": "IOC created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/Ioc" } } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", + "400": { + "description": "Incomplete, or bad request", "content": { "application/json": { "schema": { @@ -702,8 +702,8 @@ } } }, - "422": { - "description": "Unprocessable request", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -712,8 +712,8 @@ } } }, - "424": { - "description": "Metadata file not found, or not processable", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions in Gitlab", "content": { "application/json": { "schema": { @@ -722,8 +722,8 @@ } } }, - "401": { - "description": "Unauthorized", + "409": { + "description": "IOC already created", "content": { "application/json": { "schema": { @@ -732,8 +732,8 @@ } } }, - "400": { - "description": "Incomplete, or bad request", + "422": { + "description": "Unprocessable request", "content": { "application/json": { "schema": { @@ -742,8 +742,8 @@ } } }, - "409": { - "description": "IOC already created", + "424": { + "description": "Metadata file not found, or not processable", "content": { "application/json": { "schema": { @@ -752,8 +752,8 @@ } } }, - "503": { - "description": "Remote service exception", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -762,12 +762,12 @@ } } }, - "201": { - "description": "IOC created", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Ioc" + "$ref": "#/components/schemas/GeneralException" } } } @@ -796,8 +796,8 @@ "required": true }, "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Job updated", "content": { "application/json": { "schema": { @@ -806,8 +806,8 @@ } } }, - "200": { - "description": "Job updated", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -816,8 +816,8 @@ } } }, - "401": { - "description": "Unauthorized", + "404": { + "description": "Job not found", "content": { "application/json": { "schema": { @@ -826,8 +826,8 @@ } } }, - "404": { - "description": "Job not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -851,16 +851,6 @@ "description": "Renewing valid, non-expired JWT token", "operationId": "tokenRenew", "responses": { - "500": { - "description": "Service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, "200": { "description": "Ok", "content": { @@ -891,6 +881,16 @@ } } }, + "500": { + "description": "Service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, "503": { "description": "Login server unavailable", "content": { @@ -926,12 +926,12 @@ "required": true }, "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Ok", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/LoginResponse" } } } @@ -946,18 +946,18 @@ } } }, - "200": { - "description": "Ok", + "403": { + "description": "User doesn't have permission to log in", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoginResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "503": { - "description": "Login server unavailable", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -966,8 +966,8 @@ } } }, - "403": { - "description": "User doesn't have permission to log in", + "503": { + "description": "Login server unavailable", "content": { "application/json": { "schema": { @@ -997,18 +997,18 @@ } ], "responses": { - "404": { - "description": "Ioc not found", + "200": { + "description": "Found IOC", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IocDetails" } } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1017,18 +1017,18 @@ } } }, - "200": { - "description": "Found IOC", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IocDetails" + "$ref": "#/components/schemas/GeneralException" } } } }, - "401": { - "description": "Unauthorized", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1056,18 +1056,18 @@ } ], "responses": { - "500": { - "description": "Service exception", + "204": { + "description": "IOC deleted", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "string" } } } }, - "503": { - "description": "Git repository can not be deleted", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1076,8 +1076,8 @@ } } }, - "404": { - "description": "IOC not found", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", "content": { "application/json": { "schema": { @@ -1086,8 +1086,8 @@ } } }, - "401": { - "description": "Unauthorized", + "404": { + "description": "IOC not found", "content": { "application/json": { "schema": { @@ -1096,8 +1096,8 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "409": { + "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", "content": { "application/json": { "schema": { @@ -1106,18 +1106,18 @@ } } }, - "204": { - "description": "IOC deleted", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/GeneralException" } } } }, - "409": { - "description": "Concurrent deployment, undeployment, start or stop for IOC is ongoing", + "503": { + "description": "Git repository can not be deleted", "content": { "application/json": { "schema": { @@ -1160,18 +1160,18 @@ "required": true }, "responses": { - "404": { - "description": "Ioc not found", + "200": { + "description": "IOC updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/Ioc" } } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1180,8 +1180,8 @@ } } }, - "422": { - "description": "Unprocessable request", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", "content": { "application/json": { "schema": { @@ -1190,8 +1190,8 @@ } } }, - "401": { - "description": "Unauthorized", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { @@ -1200,8 +1200,8 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "409": { + "description": "IOC already created or concurrent deployment, undeployment, start or stop for IOC is ongoing", "content": { "application/json": { "schema": { @@ -1210,8 +1210,8 @@ } } }, - "503": { - "description": "Remote service exception", + "422": { + "description": "Unprocessable request", "content": { "application/json": { "schema": { @@ -1220,8 +1220,8 @@ } } }, - "409": { - "description": "IOC already created or concurrent deployment, undeployment, start or stop for IOC is ongoing", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1230,12 +1230,12 @@ } } }, - "200": { - "description": "IOC updated", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Ioc" + "$ref": "#/components/schemas/GeneralException" } } } @@ -1267,18 +1267,21 @@ } ], "responses": { - "409": { - "description": "Ongoing deployment, or undeployment for IOC", + "200": { + "description": "Undeployment created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/Deployment" + } } } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1287,8 +1290,8 @@ } } }, - "401": { - "description": "Unauthorized", + "403": { + "description": "Forbidden: user doesn't have the necessary permissions to undeploy", "content": { "application/json": { "schema": { @@ -1297,21 +1300,18 @@ } } }, - "200": { - "description": "Undeployment created", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Deployment" - } + "$ref": "#/components/schemas/GeneralException" } } } }, - "403": { - "description": "Forbidden: user doesn't have the necessary permissions to undeploy", + "409": { + "description": "Ongoing deployment, or undeployment for IOC", "content": { "application/json": { "schema": { @@ -1330,8 +1330,8 @@ } } }, - "404": { - "description": "Not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1390,8 +1390,8 @@ } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1410,8 +1410,8 @@ } } }, - "409": { - "description": "Ongoing operation for IOC", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { @@ -1420,8 +1420,8 @@ } } }, - "401": { - "description": "Unauthorized", + "409": { + "description": "Ongoing operation for IOC", "content": { "application/json": { "schema": { @@ -1440,8 +1440,8 @@ } } }, - "404": { - "description": "Not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1542,8 +1542,8 @@ } } }, - "503": { - "description": "Remote server exception", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1552,8 +1552,8 @@ } } }, - "500": { - "description": "Service exception", + "503": { + "description": "Remote server exception", "content": { "application/json": { "schema": { @@ -1581,29 +1581,29 @@ } } ], - "responses": { - "500": { - "description": "Service exception", + "responses": { + "200": { + "description": "Found record", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/RecordDetails" } } } }, - "200": { - "description": "Found record", + "404": { + "description": "Record not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RecordDetails" + "$ref": "#/components/schemas/GeneralException" } } } }, - "404": { - "description": "Record not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1632,18 +1632,21 @@ } ], "responses": { - "503": { - "description": "Remote service unreachable", + "200": { + "description": "Naming names, and UUIDs from the Names service", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/NameResponse" + } } } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1652,21 +1655,18 @@ } } }, - "200": { - "description": "Naming names, and UUIDs from the Names service", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/NameResponse" - } + "$ref": "#/components/schemas/GeneralException" } } } }, - "401": { - "description": "Unauthorized", + "503": { + "description": "Remote service unreachable", "content": { "application/json": { "schema": { @@ -1701,18 +1701,18 @@ } ], "responses": { - "422": { - "description": "Too many IOCs use the same Naming UUID", + "200": { + "description": "Ok", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IdUsedByIoc" } } } }, - "500": { - "description": "Service exception", + "422": { + "description": "Too many IOCs use the same Naming UUID", "content": { "application/json": { "schema": { @@ -1721,12 +1721,12 @@ } } }, - "200": { - "description": "Ok", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IdUsedByIoc" + "$ref": "#/components/schemas/GeneralException" } } } @@ -1750,8 +1750,8 @@ } } }, - "500": { - "description": "Service exception", + "404": { + "description": "Maintenance Mode not found", "content": { "application/json": { "schema": { @@ -1760,8 +1760,8 @@ } } }, - "404": { - "description": "Maintenance Mode not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1777,6 +1777,9 @@ "summary": "End Current Maintenance Mode", "operationId": "endCurrentMaintenanceMode", "responses": { + "204": { + "description": "Maintenance Mode ended" + }, "400": { "description": "Incomplete request", "content": { @@ -1787,8 +1790,8 @@ } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -1797,11 +1800,8 @@ } } }, - "204": { - "description": "Maintenance Mode ended" - }, - "422": { - "description": "Unprocessable request", + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", "content": { "application/json": { "schema": { @@ -1810,8 +1810,8 @@ } } }, - "401": { - "description": "Unauthorized", + "422": { + "description": "Unprocessable request", "content": { "application/json": { "schema": { @@ -1820,8 +1820,8 @@ } } }, - "403": { - "description": "Forbidden: User doesn't have the necessary permissions", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -1988,12 +1988,12 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "A paged array of deployments", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/PagedJobResponse" } } } @@ -2008,12 +2008,12 @@ } } }, - "200": { - "description": "A paged array of deployments", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PagedJobResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2039,16 +2039,6 @@ } ], "responses": { - "500": { - "description": "Service exception", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GeneralException" - } - } - } - }, "200": { "description": "Job details", "content": { @@ -2078,6 +2068,16 @@ } } } + }, + "500": { + "description": "Service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } } } } @@ -2100,12 +2100,12 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Job details", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/AwxJobDetails" } } } @@ -2130,8 +2130,8 @@ } } }, - "503": { - "description": "Remote service exception", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -2140,12 +2140,12 @@ } } }, - "200": { - "description": "Job details", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AwxJobDetails" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2171,12 +2171,12 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Job log", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/AwxJobLog" } } } @@ -2191,18 +2191,18 @@ } } }, - "200": { - "description": "Job log", + "404": { + "description": "Deployment not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AwxJobLog" + "$ref": "#/components/schemas/GeneralException" } } } }, - "503": { - "description": "Remote service exception", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -2211,8 +2211,8 @@ } } }, - "404": { - "description": "Deployment not found", + "503": { + "description": "Remote service exception", "content": { "application/json": { "schema": { @@ -2247,28 +2247,28 @@ } ], "responses": { - "404": { - "description": "Ioc not found", + "200": { + "description": "Log lines", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IocStatusResponse" } } } }, - "200": { - "description": "Log lines", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IocStatusResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "500": { - "description": "Service exception", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { @@ -2277,8 +2277,8 @@ } } }, - "401": { - "description": "Unauthorized", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -2308,18 +2308,18 @@ } ], "responses": { - "404": { - "description": "Ioc not found", + "200": { + "description": "Found IOC description", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IocDescriptionResponse" } } } }, - "500": { - "description": "Service exception", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { @@ -2328,12 +2328,12 @@ } } }, - "200": { - "description": "Found IOC description", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IocDescriptionResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2359,22 +2359,22 @@ } ], "responses": { - "404": { - "description": "Ioc not found", + "200": { + "description": "Alerts of the IOC", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IocAlertResponse" } } } }, - "200": { - "description": "Alerts of the IOC", + "404": { + "description": "Ioc not found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IocAlertResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2428,22 +2428,22 @@ } ], "responses": { - "503": { - "description": "Logging server unavailable", + "200": { + "description": "Log lines", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/LokiResponse" } } } }, - "200": { - "description": "Log lines", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LokiResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2458,8 +2458,8 @@ } } }, - "401": { - "description": "Unauthorized", + "503": { + "description": "Logging server unavailable", "content": { "application/json": { "schema": { @@ -2495,22 +2495,22 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Ok", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/IdUsedByIoc" } } } }, - "200": { - "description": "Ok", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IdUsedByIoc" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2523,22 +2523,22 @@ "tags": ["Inventory"], "operationId": "fetchInventory", "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Inventory response", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/InventoryResponse" } } } }, - "200": { - "description": "Inventory response", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/InventoryResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2603,18 +2603,18 @@ } ], "responses": { - "503": { - "description": "Remote server exception", + "200": { + "description": "A paged array of hosts", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/PagedNetBoxHostResponse" } } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -2622,9 +2622,9 @@ } } } - }, - "401": { - "description": "Unauthorized", + }, + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -2633,12 +2633,12 @@ } } }, - "200": { - "description": "A paged array of hosts", + "503": { + "description": "Remote server exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PagedNetBoxHostResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2673,22 +2673,22 @@ } ], "responses": { - "503": { - "description": "Logging server unavailable", + "200": { + "description": "Log lines", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/LokiResponse" } } } }, - "200": { - "description": "Log lines", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LokiResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2703,8 +2703,8 @@ } } }, - "401": { - "description": "Unauthorized", + "503": { + "description": "Logging server unavailable", "content": { "application/json": { "schema": { @@ -2738,18 +2738,18 @@ } ], "responses": { - "503": { - "description": "Remote server exception", + "200": { + "description": "Host status", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/HostStatusResponse" } } } }, - "500": { - "description": "Service exception", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { @@ -2758,18 +2758,18 @@ } } }, - "200": { - "description": "Host status", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HostStatusResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "404": { - "description": "Not found", + "503": { + "description": "Remote server exception", "content": { "application/json": { "schema": { @@ -2848,12 +2848,12 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Found Host", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/PagedAssociatedIocs" } } } @@ -2868,12 +2868,12 @@ } } }, - "200": { - "description": "Found Host", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PagedAssociatedIocs" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2898,12 +2898,12 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Found Host", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/HostInfoWithId" } } } @@ -2928,12 +2928,12 @@ } } }, - "200": { - "description": "Found Host", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HostInfoWithId" + "$ref": "#/components/schemas/GeneralException" } } } @@ -2958,18 +2958,18 @@ } ], "responses": { - "503": { - "description": "Remote server exception", + "200": { + "description": "Host alerts", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/HostAlertResponse" } } } }, - "500": { - "description": "Service exception", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { @@ -2978,8 +2978,8 @@ } } }, - "404": { - "description": "Not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -2988,12 +2988,12 @@ } } }, - "200": { - "description": "Host alerts", + "503": { + "description": "Remote server exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HostAlertResponse" + "$ref": "#/components/schemas/GeneralException" } } } @@ -3018,12 +3018,12 @@ } ], "responses": { - "500": { - "description": "Service exception", + "200": { + "description": "Found Host", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/HostInfoWithId" } } } @@ -3048,12 +3048,12 @@ } } }, - "200": { - "description": "Found Host", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HostInfoWithId" + "$ref": "#/components/schemas/GeneralException" } } } @@ -3098,25 +3098,25 @@ } ], "responses": { - "503": { - "description": "Git exception", + "200": { + "description": "List of Tags and CommitIds for a specific GitLab repo", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/GitReference" + } } } } }, - "200": { - "description": "List of Tags and CommitIds for a specific GitLab repo", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GitReference" - } + "$ref": "#/components/schemas/GeneralException" } } } @@ -3131,8 +3131,8 @@ } } }, - "401": { - "description": "Unauthorized", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -3171,28 +3171,28 @@ } ], "responses": { - "503": { - "description": "Git exception", + "200": { + "description": "Git reference type", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/ReferenceTypeResponse" } } } }, - "200": { - "description": "Git reference type", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ReferenceTypeResponse" + "$ref": "#/components/schemas/GeneralException" } } } }, - "500": { - "description": "Service exception", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -3221,18 +3221,21 @@ } ], "responses": { - "503": { - "description": "Git exception", + "200": { + "description": "Information about the current user", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/UserInfoResponse" + } } } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -3241,8 +3244,8 @@ } } }, - "401": { - "description": "Unauthorized", + "404": { + "description": "Not found", "content": { "application/json": { "schema": { @@ -3251,21 +3254,18 @@ } } }, - "200": { - "description": "Information about the current user", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserInfoResponse" - } + "$ref": "#/components/schemas/GeneralException" } } } }, - "404": { - "description": "Not found", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -3299,25 +3299,25 @@ } ], "responses": { - "503": { - "description": "Git exception", + "200": { + "description": "List of Gitlab projects of allowed groups", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "array", + "items": { + "$ref": "#/components/schemas/GitProject" + } } } } }, - "200": { - "description": "List of Gitlab projects of allowed groups", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GitProject" - } + "$ref": "#/components/schemas/GeneralException" } } } @@ -3332,8 +3332,8 @@ } } }, - "401": { - "description": "Unauthorized", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { @@ -3368,18 +3368,18 @@ } ], "responses": { - "503": { - "description": "Git exception", + "200": { + "description": "Git project details", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "$ref": "#/components/schemas/GitProjectDto" } } } }, - "500": { - "description": "Service exception", + "404": { + "description": "Project not found", "content": { "application/json": { "schema": { @@ -3388,8 +3388,8 @@ } } }, - "404": { - "description": "Project not found", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3398,12 +3398,12 @@ } } }, - "200": { - "description": "Git project details", + "503": { + "description": "Git exception", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GitProjectDto" + "$ref": "#/components/schemas/GeneralException" } } } @@ -3442,8 +3442,8 @@ } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -3452,8 +3452,8 @@ } } }, - "401": { - "description": "Unauthorized", + "404": { + "description": "Role not found by authorization service", "content": { "application/json": { "schema": { @@ -3462,8 +3462,8 @@ } } }, - "503": { - "description": "Login server unavailable", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3472,8 +3472,8 @@ } } }, - "404": { - "description": "Role not found by authorization service", + "503": { + "description": "Login server unavailable", "content": { "application/json": { "schema": { @@ -3510,8 +3510,8 @@ } } }, - "500": { - "description": "Service exception", + "401": { + "description": "Unauthorized", "content": { "application/json": { "schema": { @@ -3520,8 +3520,8 @@ } } }, - "401": { - "description": "Unauthorized", + "403": { + "description": "Permission denied", "content": { "application/json": { "schema": { @@ -3530,8 +3530,8 @@ } } }, - "403": { - "description": "Permission denied", + "500": { + "description": "Service exception", "content": { "application/json": { "schema": { @@ -3565,12 +3565,12 @@ "description": "Logging out the user", "operationId": "logout", "responses": { - "503": { - "description": "Login server unavailable or remote error", + "200": { + "description": "Ok", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeneralException" + "type": "object" } } } @@ -3585,12 +3585,12 @@ } } }, - "200": { - "description": "Ok", + "503": { + "description": "Login server unavailable or remote error", "content": { "application/json": { "schema": { - "type": "object" + "$ref": "#/components/schemas/GeneralException" } } } @@ -4137,7 +4137,7 @@ "recordType": { "type": "string" }, - "alias": { + "aliasFor": { "type": "string" } } @@ -4171,7 +4171,7 @@ "recordType": { "type": "string" }, - "alias": { + "aliasFor": { "type": "string" }, "properties": { @@ -4182,6 +4182,12 @@ }, "hostId": { "type": "string" + }, + "aliasTo": { + "type": "array", + "items": { + "type": "string" + } } } }, diff --git a/src/store/deployApi.ts b/src/store/deployApi.ts index 5321ec51..5e238428 100644 --- a/src/store/deployApi.ts +++ b/src/store/deployApi.ts @@ -907,7 +907,7 @@ export type Record = { iocVersion?: string; description?: string; recordType?: string; - alias?: string; + aliasFor?: string; }; export type PagedRecordResponse = { totalCount?: number; @@ -925,7 +925,8 @@ export type RecordDetails = { iocVersion?: string; description?: string; recordType?: string; - alias?: string; + aliasFor?: string; + aliasTo?: string[]; properties?: { [key: string]: string; }; diff --git a/src/views/records/Alias.jsx b/src/views/records/Alias.jsx new file mode 100644 index 00000000..fa57dfd7 --- /dev/null +++ b/src/views/records/Alias.jsx @@ -0,0 +1,28 @@ +import { EmptyValue, InternalLink, useUniqueKeys } from "@ess-ics/ce-ui-common"; +import { Stack } from "@mui/material"; + +export const Alias = ({ aliases }) => { + const itemsKeys = useUniqueKeys(aliases); + + if (!aliases || aliases.length === 0) { + return <EmptyValue />; + } + + return ( + <Stack + direction="row" + gap={1.5} + flexWrap="wrap" + > + {aliases.map((alias, index) => ( + <InternalLink + key={itemsKeys[index]} + to={`/records/${alias}`} + label={alias} + > + {`${alias}${index < aliases.length - 1 && aliases.length > 1 ? "," : ""}`} + </InternalLink> + ))} + </Stack> + ); +}; diff --git a/src/views/records/RecordDetailsView.jsx b/src/views/records/RecordDetailsView.jsx index 9f25bd6f..f877be0b 100644 --- a/src/views/records/RecordDetailsView.jsx +++ b/src/views/records/RecordDetailsView.jsx @@ -6,11 +6,11 @@ import { KeyValueTable, GlobalAppBarContext, InternalLink, - EmptyValue, useAPIMethod, formatDateAndTime } from "@ess-ics/ce-ui-common"; import { useParams, useNavigate } from "react-router-dom"; +import { Alias } from "./Alias"; import { RecordBadge } from "../../components/records/RecordBadge"; import { applicationTitle, @@ -78,17 +78,8 @@ export function RecordDetailsView() { ) : ( record?.iocName ), - Alias: record.alias ? ( - <Typography> - <InternalLink - to={`/records/${record.alias}`} - label={`Record details, alias ${record?.alias}`} - > - {record?.alias} - </InternalLink> - </Typography> - ) : ( - <EmptyValue /> + "Alias for": ( + <Alias aliases={record?.aliasFor ? [record?.aliasFor] : []} /> ), Description: record?.description, Version: record?.iocVersion, @@ -104,7 +95,8 @@ export function RecordDetailsView() { </Typography> ) : ( record?.hostName - ) + ), + "Alias to": <Alias aliases={record?.aliasTo} /> }; for (const [key, value] of Object.entries(record.properties)) { @@ -114,11 +106,12 @@ export function RecordDetailsView() { subset["Record type"] = value; } else if (key.toLowerCase().includes("recorddesc")) { subset.Description = value; - } else if (key.toLowerCase().includes("alias")) { - subset.Alias = value; } else if (key.toLowerCase() === "iocversion") { subset["IOC Revision"] = value; - } else if (key.toLowerCase() !== "iocid") { + } else if ( + key.toLowerCase() !== "iocid" && + key.toLowerCase() !== "alias" + ) { subset[key.replaceAll("_", " ")] = value; } } -- GitLab