mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-19 21:00:14 +08:00
make it obvious that a config_status is corrupted
also format HTML removing unnecessary text blocks
This commit is contained in:
parent
7ca20adc6d
commit
2c10fda399
@ -200,8 +200,7 @@ def update_config_states_table(state_name):
|
|||||||
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>")
|
filepath = config_state.get("filepath", "<unknown>")
|
||||||
|
|
||||||
code = f"""<!-- {time.time()} -->"""
|
try:
|
||||||
|
|
||||||
webui_remote = config_state["webui"]["remote"] or ""
|
webui_remote = config_state["webui"]["remote"] or ""
|
||||||
webui_branch = config_state["webui"]["branch"]
|
webui_branch = config_state["webui"]["branch"]
|
||||||
webui_commit_hash = config_state["webui"]["commit_hash"] or "<unknown>"
|
webui_commit_hash = config_state["webui"]["commit_hash"] or "<unknown>"
|
||||||
@ -227,11 +226,11 @@ def update_config_states_table(state_name):
|
|||||||
if current_webui["commit_hash"] != webui_commit_hash:
|
if current_webui["commit_hash"] != webui_commit_hash:
|
||||||
style_commit = STYLE_PRIMARY
|
style_commit = STYLE_PRIMARY
|
||||||
|
|
||||||
code += f"""<h2>Config Backup: {config_name}</h2>
|
code = f"""<!-- {time.time()} -->
|
||||||
|
<h2>Config Backup: {config_name}</h2>
|
||||||
<div><b>Filepath:</b> {filepath}</div>
|
<div><b>Filepath:</b> {filepath}</div>
|
||||||
<div><b>Created at:</b> {created_date}</div>"""
|
<div><b>Created at:</b> {created_date}</div>
|
||||||
|
<h2>WebUI State</h2>
|
||||||
code += f"""<h2>WebUI State</h2>
|
|
||||||
<table id="config_state_webui">
|
<table id="config_state_webui">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -243,16 +242,22 @@ def update_config_states_table(state_name):
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label{style_remote}>{remote}</label></td>
|
<td>
|
||||||
<td><label{style_branch}>{webui_branch}</label></td>
|
<label{style_remote}>{remote}</label>
|
||||||
<td><label{style_commit}>{commit_link}</label></td>
|
</td>
|
||||||
<td><label{style_commit}>{date_link}</label></td>
|
<td>
|
||||||
|
<label{style_branch}>{webui_branch}</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<label{style_commit}>{commit_link}</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<label{style_commit}>{date_link}</label>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
"""
|
<h2>Extension State</h2>
|
||||||
|
|
||||||
code += """<h2>Extension State</h2>
|
|
||||||
<table id="config_state_extensions">
|
<table id="config_state_extensions">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -299,8 +304,7 @@ def update_config_states_table(state_name):
|
|||||||
if current_ext.commit_hash != ext_commit_hash:
|
if current_ext.commit_hash != ext_commit_hash:
|
||||||
style_commit = STYLE_PRIMARY
|
style_commit = STYLE_PRIMARY
|
||||||
|
|
||||||
code += f"""
|
code += f""" <tr>
|
||||||
<tr>
|
|
||||||
<td><label{style_enabled}><input class="gr-check-radio gr-checkbox" type="checkbox" disabled="true" {'checked="checked"' if ext_enabled else ''}>{html.escape(ext_name)}</label></td>
|
<td><label{style_enabled}><input class="gr-check-radio gr-checkbox" type="checkbox" disabled="true" {'checked="checked"' if ext_enabled else ''}>{html.escape(ext_name)}</label></td>
|
||||||
<td><label{style_remote}>{remote}</label></td>
|
<td><label{style_remote}>{remote}</label></td>
|
||||||
<td><label{style_branch}>{ext_branch}</label></td>
|
<td><label{style_branch}>{ext_branch}</label></td>
|
||||||
@ -309,10 +313,16 @@ def update_config_states_table(state_name):
|
|||||||
</tr>
|
</tr>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
code += """
|
code += """ </tbody>
|
||||||
</tbody>
|
</table>"""
|
||||||
</table>
|
|
||||||
"""
|
except Exception as e:
|
||||||
|
print(f"[ERROR]: Config states {filepath}, {e}")
|
||||||
|
code = f"""<!-- {time.time()} -->
|
||||||
|
<h2>Config Backup: {config_name}</h2>
|
||||||
|
<div><b>Filepath:</b> {filepath}</div>
|
||||||
|
<div><b>Created at:</b> {created_date}</div>
|
||||||
|
<h2>This file is corrupted</h2>"""
|
||||||
|
|
||||||
return code
|
return code
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user