mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-02-16 18:32:25 +01:00
Merge pull request #531 from JeLuF/confirm
Confirm 'Clear All' and 'Stop Task'
This commit is contained in:
commit
84fae2d9e0
27
3rd-PARTY-LICENSES
Normal file
27
3rd-PARTY-LICENSES
Normal file
@ -0,0 +1,27 @@
|
||||
jquery-confirm
|
||||
==============
|
||||
https://craftpip.github.io/jquery-confirm/
|
||||
|
||||
jquery-confirm is licensed under the MIT license:
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 Boniface Pereira
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -19,8 +19,10 @@
|
||||
- Configuration to prevent the browser from opening on startup
|
||||
- Lots of minor bug fixes
|
||||
- A `What's New?` tab in the UI
|
||||
- Ask for a confimation before clearing the results pane or stopping a render task. The dialog can be skipped by holding down the shift key while clicking on the button.
|
||||
|
||||
### Detailed changelog
|
||||
* 2.4.17 - 30 Nov 2022 - Confirm before stopping or clearing all the tasks
|
||||
* 2.4.16 - 29 Nov 2022 - Bug fixes for SD 2.0 - remove the need for patching, default to SD 1.4 model if trying to load an SD2 model in SD1.4.
|
||||
* 2.4.15 - 25 Nov 2022 - Experimental support for SD 2.0. Uses lots of memory, not optimized, probably GPU-only.
|
||||
* 2.4.14 - 22 Nov 2022 - Change the backend to a custom fork of Stable Diffusion
|
||||
|
@ -12,7 +12,9 @@
|
||||
<link rel="stylesheet" href="/media/css/modifier-thumbnails.css">
|
||||
<link rel="stylesheet" href="/media/css/fontawesome-all.min.css">
|
||||
<link rel="stylesheet" href="/media/css/drawingboard.min.css">
|
||||
<link rel="stylesheet" href="/media/css//jquery-confirm.min.css">
|
||||
<script src="/media/js/jquery-3.6.1.min.js"></script>
|
||||
<script src="/media/js/jquery-confirm.min.js"></script>
|
||||
<script src="/media/js/drawingboard.min.js"></script>
|
||||
<script src="/media/js/marked.min.js"></script>
|
||||
</head>
|
||||
|
9
ui/media/css/jquery-confirm.min.css
vendored
Normal file
9
ui/media/css/jquery-confirm.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -35,6 +35,7 @@ const SETTINGS_IDS_LIST = [
|
||||
"sound_toggle",
|
||||
"turbo",
|
||||
"use_full_precision",
|
||||
"confirm_dangerous_actions",
|
||||
"auto_save_settings"
|
||||
]
|
||||
|
||||
|
10
ui/media/js/jquery-confirm.min.js
vendored
Normal file
10
ui/media/js/jquery-confirm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -138,6 +138,33 @@ function isServerAvailable() {
|
||||
}
|
||||
}
|
||||
|
||||
// shiftOrConfirm(e, prompt, fn)
|
||||
// e : MouseEvent
|
||||
// prompt : Text to be shown as prompt. Should be a question to which "yes" is a good answer.
|
||||
// fn : function to be called if the user confirms the dialog or has the shift key pressed
|
||||
//
|
||||
// If the user had the shift key pressed while clicking, the function fn will be executed.
|
||||
// If the setting "confirm_dangerous_actions" in the system settings is disabled, the function
|
||||
// fn will be executed.
|
||||
// Otherwise, a confirmation dialog is shown. If the user confirms, the function fn will also
|
||||
// be executed.
|
||||
function shiftOrConfirm(e, prompt, fn) {
|
||||
e.stopPropagation()
|
||||
if (e.shiftKey || !confirmDangerousActionsField.checked) {
|
||||
fn(e)
|
||||
} else {
|
||||
$.confirm({ theme: 'supervan',
|
||||
title: prompt,
|
||||
content: 'Tip: To skip this dialog, use shift-click or disable the setting "Confirm dangerous actions" in the systems setting.',
|
||||
buttons: {
|
||||
yes: () => { fn(e) },
|
||||
cancel: () => {}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function logMsg(msg, level, outputMsg) {
|
||||
if (outputMsg.hasChildNodes()) {
|
||||
outputMsg.appendChild(document.createElement('br'))
|
||||
@ -887,8 +914,7 @@ function createTask(task) {
|
||||
task['progressBar'] = taskEntry.querySelector('.progress-bar')
|
||||
task['stopTask'] = taskEntry.querySelector('.stopTask')
|
||||
|
||||
task['stopTask'].addEventListener('click', async function(e) {
|
||||
e.stopPropagation()
|
||||
task['stopTask'].addEventListener('click', (e) => { shiftOrConfirm(e, "Shall this task be stopped?", async function(e) {
|
||||
if (task['isProcessing']) {
|
||||
task.isProcessing = false
|
||||
task.progressBar.classList.remove("active")
|
||||
@ -905,7 +931,7 @@ function createTask(task) {
|
||||
|
||||
taskEntry.remove()
|
||||
}
|
||||
})
|
||||
})})
|
||||
|
||||
task['useSettings'] = taskEntry.querySelector('.useSettings')
|
||||
task['useSettings'].addEventListener('click', function(e) {
|
||||
@ -1047,7 +1073,7 @@ async function stopAllTasks() {
|
||||
}
|
||||
}
|
||||
|
||||
clearAllPreviewsBtn.addEventListener('click', async function() {
|
||||
clearAllPreviewsBtn.addEventListener('click', (e) => { shiftOrConfirm(e, "Remove all results and tasks from the results pane?", async function() {
|
||||
await stopAllTasks()
|
||||
|
||||
let taskEntries = document.querySelectorAll('.imageTaskContainer')
|
||||
@ -1057,7 +1083,7 @@ clearAllPreviewsBtn.addEventListener('click', async function() {
|
||||
|
||||
previewTools.style.display = 'none'
|
||||
initialText.style.display = 'block'
|
||||
})
|
||||
})})
|
||||
|
||||
stopImageBtn.addEventListener('click', async function() {
|
||||
await stopAllTasks()
|
||||
|
@ -114,6 +114,14 @@ var PARAMETERS = [
|
||||
icon: "fa-gear",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "confirm_dangerous_actions",
|
||||
type: ParameterType.checkbox,
|
||||
label: "Confirm dangerous actions",
|
||||
note: "Actions that might lead to data loss must either be clicked with the shift key pressed, or confirmed in an 'Are you sure?' dialog",
|
||||
icon: "fa-check-double",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "listen_to_network",
|
||||
type: ParameterType.checkbox,
|
||||
@ -207,6 +215,7 @@ let listenPortField = document.querySelector("#listen_port")
|
||||
let testSD2Field = document.querySelector("#test_sd2")
|
||||
let useBetaChannelField = document.querySelector("#use_beta_channel")
|
||||
let uiOpenBrowserOnStartField = document.querySelector("#ui_open_browser_on_start")
|
||||
let confirmDangerousActionsField = document.querySelector("#confirm_dangerous_actions")
|
||||
|
||||
let saveSettingsBtn = document.querySelector('#save-system-settings-btn')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user