add an 'installed' tag to extensions
This commit is contained in:
parent
991e2dcee9
commit
713c48ddd7
|
@ -206,12 +206,13 @@ def refresh_available_extensions_from_data(hide_tags):
|
||||||
if url is None:
|
if url is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
existing = installed_extension_urls.get(normalize_git_url(url), None)
|
||||||
|
extension_tags = extension_tags + ["installed"] if existing else extension_tags
|
||||||
|
|
||||||
if len([x for x in extension_tags if x in tags_to_hide]) > 0:
|
if len([x for x in extension_tags if x in tags_to_hide]) > 0:
|
||||||
hidden += 1
|
hidden += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
existing = installed_extension_urls.get(normalize_git_url(url), None)
|
|
||||||
|
|
||||||
install_code = f"""<input onclick="install_extension_from_index(this, '{html.escape(url)}')" type="button" value="{"Install" if not existing else "Installed"}" {"disabled=disabled" if existing else ""} class="gr-button gr-button-lg gr-button-secondary">"""
|
install_code = f"""<input onclick="install_extension_from_index(this, '{html.escape(url)}')" type="button" value="{"Install" if not existing else "Installed"}" {"disabled=disabled" if existing else ""} class="gr-button gr-button-lg gr-button-secondary">"""
|
||||||
|
|
||||||
tags_text = ", ".join([f"<span class='extension-tag' title='{tags.get(x, '')}'>{x}</span>" for x in extension_tags])
|
tags_text = ", ".join([f"<span class='extension-tag' title='{tags.get(x, '')}'>{x}</span>" for x in extension_tags])
|
||||||
|
@ -222,7 +223,11 @@ def refresh_available_extensions_from_data(hide_tags):
|
||||||
<td>{html.escape(description)}</td>
|
<td>{html.escape(description)}</td>
|
||||||
<td>{install_code}</td>
|
<td>{install_code}</td>
|
||||||
</tr>
|
</tr>
|
||||||
"""
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
for tag in [x for x in extension_tags if x not in tags]:
|
||||||
|
tags[tag] = tag
|
||||||
|
|
||||||
code += """
|
code += """
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -272,7 +277,7 @@ def create_ui():
|
||||||
install_extension_button = gr.Button(elem_id="install_extension_button", visible=False)
|
install_extension_button = gr.Button(elem_id="install_extension_button", visible=False)
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
hide_tags = gr.CheckboxGroup(value=["ads", "localization"], label="Hide extensions with tags", choices=["script", "ads", "localization"])
|
hide_tags = gr.CheckboxGroup(value=["ads", "localization", "installed"], label="Hide extensions with tags", choices=["script", "ads", "localization", "installed"])
|
||||||
|
|
||||||
install_result = gr.HTML()
|
install_result = gr.HTML()
|
||||||
available_extensions_table = gr.HTML()
|
available_extensions_table = gr.HTML()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user