From 1c0544abdbffb910837d285857515b932a073f89 Mon Sep 17 00:00:00 2001
From: space-nuko <24979496+space-nuko@users.noreply.github.com>
Date: Wed, 29 Mar 2023 19:21:57 -0500
Subject: [PATCH] Add links for commits in table, if remote is from GitHub
---
modules/ui_extensions.py | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py
index 3735965c..0843a7c0 100644
--- a/modules/ui_extensions.py
+++ b/modules/ui_extensions.py
@@ -122,6 +122,16 @@ def check_updates(id_task, disable_list):
return extension_table(), ""
+def make_commit_link(commit_hash, remote, text=None):
+ if text is None:
+ text = commit_hash[:8]
+ if remote.startswith("https://github.com/"):
+ href = os.path.join(remote, "commit", commit_hash)
+ return f'{text}'
+ else:
+ return text
+
+
def extension_table():
code = f"""
@@ -150,11 +160,15 @@ def extension_table():
if shared.opts.disable_all_extensions == "extra" and not ext.is_builtin or shared.opts.disable_all_extensions == "all":
style = STYLE_PRIMARY
+ version_link = ext.version
+ if ext.commit_hash and ext.remote:
+ version_link = make_commit_link(ext.commit_hash, ext.remote, ext.version)
+
code += f"""
|
{remote} |
- {ext.version} |
+ {version_link} |
{ext_status} |
"""
@@ -200,6 +214,9 @@ def update_config_states_table(state_name):
if current_webui["commit_hash"] != webui_commit_hash:
style_commit = STYLE_PRIMARY
+ commit_link = make_commit_link(webui_commit_hash, webui_remote)
+ date_link = make_commit_link(webui_commit_hash, webui_remote, webui_commit_date)
+
code += f"""Config Backup: {config_name}
Filepath: {filepath}
Created at: {created_date}
"""
@@ -218,8 +235,8 @@ def update_config_states_table(state_name):
|
|
- |
- |
+ |
+ |
@@ -270,13 +287,16 @@ def update_config_states_table(state_name):
if current_ext.commit_hash != ext_commit_hash:
style_commit = STYLE_PRIMARY
+ commit_link = make_commit_link(ext_commit_hash, ext_remote)
+ date_link = make_commit_link(ext_commit_hash, ext_remote, ext_commit_date)
+
code += f"""
|
|
|
- |
- |
+ |
+ |
"""