diff --git a/src/mocks/fixtures/ccce-api.json b/src/mocks/fixtures/ccce-api.json index 1ea40f8032efb432c3ad9e26438ec55f688172e3..c93169d9f7dae5baa5d8c174b99c0d94b7e816eb 100644 --- a/src/mocks/fixtures/ccce-api.json +++ b/src/mocks/fixtures/ccce-api.json @@ -33,6 +33,9 @@ { "name": "Statistics" }, + { + "name": "Maintenance" + }, { "name": "Hosts" }, @@ -41,6 +44,241 @@ } ], "paths": { + "/api/v1/maintenance_mode": { + "put": { + "tags": ["Maintenance"], + "summary": "Set Maintenance Mode", + "operationId": "setMaintenanceMode", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetMaintenance" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Maintenance Mode Changed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MaintenanceMode" + } + } + } + }, + "400": { + "description": "Incomplete request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "409": { + "description": "Maintenance Mode already set to that value", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "422": { + "description": "Unprocessable request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "500": { + "description": "Service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "503": { + "description": "Remote service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/api/v1/maintenance_mode/current": { + "get": { + "tags": ["Maintenance"], + "summary": "Get Current Maintenance Mode", + "operationId": "getCurrentMode", + "responses": { + "200": { + "description": "Found Mode", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MaintenanceMode" + } + } + } + }, + "404": { + "description": "Maintenance Mode not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "500": { + "description": "Service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + } + } + }, + "put": { + "tags": ["Maintenance"], + "summary": "End Current Maintenance Mode", + "operationId": "endCurrentMaintenanceMode", + "responses": { + "201": { + "description": "Maintenance Mode Changed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MaintenanceMode" + } + } + } + }, + "400": { + "description": "Incomplete request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "403": { + "description": "Forbidden: User doesn't have the necessary permissions", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "409": { + "description": "Maintenance Mode already set to that value", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "422": { + "description": "Unprocessable request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "500": { + "description": "Service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + }, + "503": { + "description": "Remote service exception", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralException" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, "/api/v1/iocs": { "get": { "tags": ["IOCs"], @@ -2277,9 +2515,9 @@ "operationId": "listHosts", "parameters": [ { - "name": "query", + "name": "text", "in": "query", - "description": "Search for host name", + "description": "Search text (Search for host name or description)", "required": false, "schema": { "type": "string" @@ -3210,21 +3448,22 @@ }, "components": { "schemas": { - "CreateIoc": { + "SetMaintenance": { "type": "object", "properties": { - "namingUuid": { - "type": "string" + "startAt": { + "type": "string", + "format": "date-time" }, - "gitProjectId": { - "type": "integer", - "format": "int64" + "endAt": { + "type": "string", + "format": "date-time" }, - "repository_name": { + "message": { "type": "string" } }, - "description": "IOC to create" + "description": "Maintenance Mode to set to" }, "GeneralException": { "type": "object", @@ -3237,6 +3476,38 @@ } } }, + "MaintenanceMode": { + "type": "object", + "properties": { + "startAt": { + "type": "string", + "format": "date-time" + }, + "endAt": { + "type": "string", + "format": "date-time" + }, + "message": { + "type": "string" + } + } + }, + "CreateIoc": { + "type": "object", + "properties": { + "namingUuid": { + "type": "string" + }, + "gitProjectId": { + "type": "integer", + "format": "int64" + }, + "repository_name": { + "type": "string" + } + }, + "description": "IOC to create" + }, "Alert": { "type": "object", "properties": { diff --git a/src/views/host/HostListView.js b/src/views/host/HostListView.js index 544acdb5fa989f7912b51376e36f76bbfbceb97a..6c991a1ff5cfe676be6850d047b0416c24dd282c 100644 --- a/src/views/host/HostListView.js +++ b/src/views/host/HostListView.js @@ -119,11 +119,9 @@ export function HostListView() { // Request new search results whenever search or pagination changes useEffect(() => { - let requestParams = initRequestParams( - pagination, - deserialize(urlState.query) - ); + let requestParams = initRequestParams(pagination); requestParams.filter = hostFilter; + requestParams.text = deserialize(urlState.query); getHosts(requestParams); return () => {