diff --git a/app/backend/wol/consumers.py b/app/backend/wol/consumers.py index 47ed52e5..6c1f0797 100644 --- a/app/backend/wol/consumers.py +++ b/app/backend/wol/consumers.py @@ -84,7 +84,17 @@ class WSConsumer(AsyncWebsocketConsumer): } ) elif received["type"] == "update_device": - await self.update_device(received["data"]) + try: + await self.update_device(received["data"]) + await self.send(text_data=json.dumps({ + "type": "operationStatus", + "message": "Success" + })) + except Exception as e: + await self.send(text_data=json.dumps({ + "type": "operationStatus", + "message": "Error" + })) elif received["type"] == "update_port": await self.update_port(received["data"]) elif received["type"] == "update_settings": diff --git a/app/frontend/src/App.svelte b/app/frontend/src/App.svelte index 51d70f99..0ea06f27 100644 --- a/app/frontend/src/App.svelte +++ b/app/frontend/src/App.svelte @@ -70,6 +70,12 @@ a.href = URL.createObjectURL(file); a.download = fileName; a.click(); + } else if (currentMessage.type == "operationStatus") { + if (currentMessage.message == "Success") { + showToast(currentMessage.message, "Device was saved and will be visible on next ping", "success") + } else if (currentMessage.message == "Error") { + showToast(currentMessage.message, "Error while saving the device. Please check the logs.", "danger") + } } }) })