mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-05-14 03:41:42 -04:00
add notifications for device updates #18
This commit is contained in:
@@ -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":
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user