@@ -70,17 +70,6 @@ def delete(uuid):
7070 if datastore .data ['settings' ]['application' ]['tags' ].get (uuid ):
7171 del datastore .data ['settings' ]['application' ]['tags' ][uuid ]
7272
73- # Delete tag.json file if it exists
74- import os
75- tag_dir = os .path .join (datastore .datastore_path , uuid )
76- tag_json = os .path .join (tag_dir , "tag.json" )
77- if os .path .exists (tag_json ):
78- try :
79- os .unlink (tag_json )
80- logger .info (f"Deleted tag.json for tag { uuid } " )
81- except Exception as e :
82- logger .error (f"Failed to delete tag.json for tag { uuid } : { e } " )
83-
8473 # Remove tag from all watches in background thread to avoid blocking
8574 def remove_tag_background (tag_uuid ):
8675 """Background thread to remove tag from watches - discarded after completion."""
@@ -127,19 +116,11 @@ def unlink_tag_background(tag_uuid):
127116 @tags_blueprint .route ("/delete_all" , methods = ['GET' ])
128117 @login_optionally_required
129118 def delete_all ():
130- # Delete all tag.json files
131- import os
119+
132120 for tag_uuid in list (datastore .data ['settings' ]['application' ]['tags' ].keys ()):
133- tag_dir = os .path .join (datastore .datastore_path , tag_uuid )
134- tag_json = os .path .join (tag_dir , "tag.json" )
135- if os .path .exists (tag_json ):
136- try :
137- os .unlink (tag_json )
138- except Exception as e :
139- logger .error (f"Failed to delete tag.json for tag { tag_uuid } : { e } " )
121+ # TagsDict 'del' handler will remove the dir
122+ del datastore .data ['settings' ]['application' ]['tags' ][tag_uuid ]
140123
141- # Clear all tags from settings immediately
142- datastore .data ['settings' ]['application' ]['tags' ] = {}
143124
144125 # Clear tags from all watches in background thread to avoid blocking
145126 def clear_all_tags_background ():
@@ -255,7 +236,4 @@ def form_tag_edit_submit(uuid):
255236 return redirect (url_for ('tags.tags_overview_page' ))
256237
257238
258- @tags_blueprint .route ("/delete/<string:uuid>" , methods = ['GET' ])
259- def form_tag_delete (uuid ):
260- return redirect (url_for ('tags.tags_overview_page' ))
261239 return tags_blueprint
0 commit comments