From ae8b8b5a5b4943df04f55dbec6c6db7e497d72c8 Mon Sep 17 00:00:00 2001 From: MD-Levitan Date: Mon, 3 May 2021 20:49:40 +0300 Subject: Add feature to delete service --- frontend/src/components/panels/ServicesPane.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'frontend/src/components') diff --git a/frontend/src/components/panels/ServicesPane.js b/frontend/src/components/panels/ServicesPane.js index 5986804..9f89485 100644 --- a/frontend/src/components/panels/ServicesPane.js +++ b/frontend/src/components/panels/ServicesPane.js @@ -85,6 +85,19 @@ class ServicesPane extends Component { } }; + deleteService = () => { + const service = this.state.currentService; + if (this.validateService(service)) { + backend.delete("/api/services", service).then((res) => { + this.reset(); + this.setState({serviceStatusCode: res.status}); + this.loadServices(); + }).catch((res) => { + this.setState({serviceStatusCode: res.status, serviceResponse: JSON.stringify(res.json)}); + }); + } + }; + validateService = (service) => { let valid = true; if (!validation.isValidPort(service.port, true)) { @@ -207,6 +220,8 @@ class ServicesPane extends Component { + {isUpdate ? : ""} -- cgit v1.2.3-70-g09d2