mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Clean up dashboard ping result post-rename/delete (#4170)
This commit is contained in:
parent
a9b7d98194
commit
27185265f6
1 changed files with 15 additions and 0 deletions
|
@ -281,8 +281,11 @@ class EsphomeLogsHandler(EsphomeCommandWebSocket):
|
|||
|
||||
|
||||
class EsphomeRenameHandler(EsphomeCommandWebSocket):
|
||||
old_name: str
|
||||
|
||||
def build_command(self, json_message):
|
||||
config_file = settings.rel_path(json_message["configuration"])
|
||||
self.old_name = json_message["configuration"]
|
||||
return [
|
||||
"esphome",
|
||||
"--dashboard",
|
||||
|
@ -291,6 +294,15 @@ class EsphomeRenameHandler(EsphomeCommandWebSocket):
|
|||
json_message["newName"],
|
||||
]
|
||||
|
||||
def _proc_on_exit(self, returncode):
|
||||
super()._proc_on_exit(returncode)
|
||||
|
||||
if returncode != 0:
|
||||
return
|
||||
|
||||
# Remove the old ping result from the cache
|
||||
PING_RESULT.pop(self.old_name, None)
|
||||
|
||||
|
||||
class EsphomeUploadHandler(EsphomeCommandWebSocket):
|
||||
def build_command(self, json_message):
|
||||
|
@ -859,6 +871,9 @@ class DeleteRequestHandler(BaseHandler):
|
|||
if build_folder is not None:
|
||||
shutil.rmtree(build_folder, os.path.join(trash_path, name))
|
||||
|
||||
# Remove the old ping result from the cache
|
||||
PING_RESULT.pop(configuration, None)
|
||||
|
||||
|
||||
class UndoDeleteRequestHandler(BaseHandler):
|
||||
@authenticated
|
||||
|
|
Loading…
Reference in a new issue