mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-14 14:45:06 +03:00
add progressbar to extension update check; do not check for updates for disabled extensions
This commit is contained in:
parent
d04e3e921e
commit
f8feeaaedb
@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
function extensions_apply(_, _){
|
function extensions_apply(_, _){
|
||||||
disable = []
|
var disable = []
|
||||||
update = []
|
var update = []
|
||||||
|
|
||||||
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){
|
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){
|
||||||
if(x.name.startsWith("enable_") && ! x.checked)
|
if(x.name.startsWith("enable_") && ! x.checked)
|
||||||
disable.push(x.name.substr(7))
|
disable.push(x.name.substr(7))
|
||||||
@ -16,11 +17,24 @@ function extensions_apply(_, _){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function extensions_check(){
|
function extensions_check(){
|
||||||
|
var disable = []
|
||||||
|
|
||||||
|
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){
|
||||||
|
if(x.name.startsWith("enable_") && ! x.checked)
|
||||||
|
disable.push(x.name.substr(7))
|
||||||
|
})
|
||||||
|
|
||||||
gradioApp().querySelectorAll('#extensions .extension_status').forEach(function(x){
|
gradioApp().querySelectorAll('#extensions .extension_status').forEach(function(x){
|
||||||
x.innerHTML = "Loading..."
|
x.innerHTML = "Loading..."
|
||||||
})
|
})
|
||||||
|
|
||||||
return []
|
|
||||||
|
var id = randomId()
|
||||||
|
requestProgress(id, gradioApp().getElementById('extensions_installed_top'), null, function(){
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return [id, JSON.stringify(disable)]
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_extension_from_index(button, url){
|
function install_extension_from_index(button, url){
|
||||||
|
@ -13,7 +13,7 @@ import shutil
|
|||||||
import errno
|
import errno
|
||||||
|
|
||||||
from modules import extensions, shared, paths
|
from modules import extensions, shared, paths
|
||||||
|
from modules.call_queue import wrap_gradio_gpu_call
|
||||||
|
|
||||||
available_extensions = {"extensions": []}
|
available_extensions = {"extensions": []}
|
||||||
|
|
||||||
@ -50,12 +50,17 @@ def apply_and_restart(disable_list, update_list):
|
|||||||
shared.state.need_restart = True
|
shared.state.need_restart = True
|
||||||
|
|
||||||
|
|
||||||
def check_updates():
|
def check_updates(id_task, disable_list):
|
||||||
check_access()
|
check_access()
|
||||||
|
|
||||||
for ext in extensions.extensions:
|
disabled = json.loads(disable_list)
|
||||||
if ext.remote is None:
|
assert type(disabled) == list, f"wrong disable_list data for apply_and_restart: {disable_list}"
|
||||||
continue
|
|
||||||
|
exts = [ext for ext in extensions.extensions if ext.remote is not None and ext.name not in disabled]
|
||||||
|
shared.state.job_count = len(exts)
|
||||||
|
|
||||||
|
for ext in exts:
|
||||||
|
shared.state.textinfo = ext.name
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ext.check_updates()
|
ext.check_updates()
|
||||||
@ -63,7 +68,9 @@ def check_updates():
|
|||||||
print(f"Error checking updates for {ext.name}:", file=sys.stderr)
|
print(f"Error checking updates for {ext.name}:", file=sys.stderr)
|
||||||
print(traceback.format_exc(), file=sys.stderr)
|
print(traceback.format_exc(), file=sys.stderr)
|
||||||
|
|
||||||
return extension_table()
|
shared.state.nextjob()
|
||||||
|
|
||||||
|
return extension_table(), ""
|
||||||
|
|
||||||
|
|
||||||
def extension_table():
|
def extension_table():
|
||||||
@ -273,12 +280,13 @@ def create_ui():
|
|||||||
with gr.Tabs(elem_id="tabs_extensions") as tabs:
|
with gr.Tabs(elem_id="tabs_extensions") as tabs:
|
||||||
with gr.TabItem("Installed"):
|
with gr.TabItem("Installed"):
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row(elem_id="extensions_installed_top"):
|
||||||
apply = gr.Button(value="Apply and restart UI", variant="primary")
|
apply = gr.Button(value="Apply and restart UI", variant="primary")
|
||||||
check = gr.Button(value="Check for updates")
|
check = gr.Button(value="Check for updates")
|
||||||
extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False).style(container=False)
|
extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False).style(container=False)
|
||||||
extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False).style(container=False)
|
extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False).style(container=False)
|
||||||
|
|
||||||
|
info = gr.HTML()
|
||||||
extensions_table = gr.HTML(lambda: extension_table())
|
extensions_table = gr.HTML(lambda: extension_table())
|
||||||
|
|
||||||
apply.click(
|
apply.click(
|
||||||
@ -289,10 +297,10 @@ def create_ui():
|
|||||||
)
|
)
|
||||||
|
|
||||||
check.click(
|
check.click(
|
||||||
fn=check_updates,
|
fn=wrap_gradio_gpu_call(check_updates, extra_outputs=[gr.update()]),
|
||||||
_js="extensions_check",
|
_js="extensions_check",
|
||||||
inputs=[],
|
inputs=[info, extensions_disabled_list],
|
||||||
outputs=[extensions_table],
|
outputs=[extensions_table, info],
|
||||||
)
|
)
|
||||||
|
|
||||||
with gr.TabItem("Available"):
|
with gr.TabItem("Available"):
|
||||||
|
Loading…
Reference in New Issue
Block a user