Add filename to UI and config name to filename
This commit is contained in:
parent
f3320b802c
commit
9b1fa82981
@ -61,7 +61,7 @@ def save_config_state(name):
|
|||||||
if not name:
|
if not name:
|
||||||
name = "Config"
|
name = "Config"
|
||||||
current_config_state["name"] = name
|
current_config_state["name"] = name
|
||||||
filename = os.path.join(config_states_dir, datetime.now().strftime("%Y_%m_%d-%H_%M_%S") + ".json")
|
filename = os.path.join(config_states_dir, datetime.now().strftime("%Y_%m_%d-%H_%M_%S") + "_" + name + ".json")
|
||||||
print(f"Saving backup of webui/extension state to {filename}.")
|
print(f"Saving backup of webui/extension state to {filename}.")
|
||||||
with open(filename, "w", encoding="utf-8") as f:
|
with open(filename, "w", encoding="utf-8") as f:
|
||||||
json.dump(current_config_state, f)
|
json.dump(current_config_state, f)
|
||||||
@ -175,6 +175,7 @@ def update_config_states_table(state_name):
|
|||||||
|
|
||||||
config_name = config_state.get("name", "Config")
|
config_name = config_state.get("name", "Config")
|
||||||
created_date = time.asctime(time.gmtime(config_state["created_at"]))
|
created_date = time.asctime(time.gmtime(config_state["created_at"]))
|
||||||
|
filepath = config_state.get("filepath", "<unknown>")
|
||||||
|
|
||||||
code = f"""<!-- {time.time()} -->"""
|
code = f"""<!-- {time.time()} -->"""
|
||||||
|
|
||||||
@ -200,6 +201,7 @@ def update_config_states_table(state_name):
|
|||||||
style_commit = STYLE_PRIMARY
|
style_commit = STYLE_PRIMARY
|
||||||
|
|
||||||
code += f"""<h2>Config Backup: {config_name}</h2>
|
code += f"""<h2>Config Backup: {config_name}</h2>
|
||||||
|
<span>Filepath: {filepath}</span>
|
||||||
<span>Created at: {created_date}</span>"""
|
<span>Created at: {created_date}</span>"""
|
||||||
|
|
||||||
code += f"""<h2>WebUI State</h2>
|
code += f"""<h2>WebUI State</h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user