mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Long task dialog improvements
- Add 'Skip all' button to skip any further failed tasks - Add button to copy the log
This commit is contained in:
parent
5fed37087b
commit
0cb09698a1
20
api/js/etemplate/Et2Button/Et2ButtonCopy.ts
Normal file
20
api/js/etemplate/Et2Button/Et2ButtonCopy.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* EGroupware eTemplate2 - Button widget
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
|
* @package etemplate
|
||||||
|
* @subpackage api
|
||||||
|
* @link https://www.egroupware.org
|
||||||
|
* @author Nathan Gray
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import {Et2Widget} from "../Et2Widget/Et2Widget";
|
||||||
|
import {SlCopyButton} from "@shoelace-style/shoelace";
|
||||||
|
import {customElement} from "lit/decorators/custom-element.js";
|
||||||
|
|
||||||
|
@customElement('et2-button-copy')
|
||||||
|
export class Et2Button extends Et2Widget(SlCopyButton)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -834,10 +834,10 @@ export class Et2Dialog extends Et2Widget(SlDialog)
|
|||||||
this._template_widget.DOMContainer.setAttribute('id', this.__template.replace(/^(.*\/)?([^/]+?)(\.xet)?(\?.*)?$/, '$2').replace(/\./g, '-'));
|
this._template_widget.DOMContainer.setAttribute('id', this.__template.replace(/^(.*\/)?([^/]+?)(\.xet)?(\?.*)?$/, '$2').replace(/\./g, '-'));
|
||||||
|
|
||||||
// Look for buttons after load
|
// Look for buttons after load
|
||||||
this._contentNode.addEventListener("load", this._adoptTemplateButtons);
|
this._template_promise.then(() => {this._adoptTemplateButtons();});
|
||||||
|
|
||||||
// Default autofocus to first input if autofocus is not set
|
// Default autofocus to first input if autofocus is not set
|
||||||
this._contentNode.addEventListener("load", this._setDefaultAutofocus);
|
this._template_promise.then(() => {this._setDefaultAutofocus();});
|
||||||
|
|
||||||
// Need to update to pick up changes
|
// Need to update to pick up changes
|
||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
@ -1333,6 +1333,7 @@ export class Et2Dialog extends Et2Widget(SlDialog)
|
|||||||
let log = null;
|
let log = null;
|
||||||
let progressbar = null;
|
let progressbar = null;
|
||||||
let cancel = false;
|
let cancel = false;
|
||||||
|
let skip_all = false;
|
||||||
let totals = {
|
let totals = {
|
||||||
success: 0,
|
success: 0,
|
||||||
skipped: 0,
|
skipped: 0,
|
||||||
@ -1358,6 +1359,11 @@ export class Et2Dialog extends Et2Widget(SlDialog)
|
|||||||
log.appendChild(div);
|
log.appendChild(div);
|
||||||
|
|
||||||
totals.failed++;
|
totals.failed++;
|
||||||
|
if(skip_all)
|
||||||
|
{
|
||||||
|
totals.skipped++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Ask to retry / ignore / abort
|
// Ask to retry / ignore / abort
|
||||||
let retry = new Et2Dialog(dialog.egw());
|
let retry = new Et2Dialog(dialog.egw());
|
||||||
@ -1372,7 +1378,11 @@ export class Et2Dialog extends Et2Widget(SlDialog)
|
|||||||
break;
|
break;
|
||||||
case 'dialog[skip]':
|
case 'dialog[skip]':
|
||||||
totals.skipped++;
|
totals.skipped++;
|
||||||
break
|
break;
|
||||||
|
case 'dialog[skip_all]':
|
||||||
|
totals.skipped++;
|
||||||
|
skip_all = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Try again with previous index
|
// Try again with previous index
|
||||||
retry_index = index - 1;
|
retry_index = index - 1;
|
||||||
@ -1384,7 +1394,8 @@ export class Et2Dialog extends Et2Widget(SlDialog)
|
|||||||
// These ones will use the callback, just like normal
|
// These ones will use the callback, just like normal
|
||||||
{label: dialog.egw().lang("Abort"), id: 'dialog[cancel]'},
|
{label: dialog.egw().lang("Abort"), id: 'dialog[cancel]'},
|
||||||
{label: dialog.egw().lang("Retry"), id: 'dialog[retry]'},
|
{label: dialog.egw().lang("Retry"), id: 'dialog[retry]'},
|
||||||
{label: dialog.egw().lang("Skip"), id: 'dialog[skip]', default: true}
|
{label: dialog.egw().lang("Skip"), id: 'dialog[skip]', default: true},
|
||||||
|
{label: dialog.egw().lang("Skip all"), id: 'dialog[skip_all]'}
|
||||||
],
|
],
|
||||||
dialog_type: Et2Dialog.ERROR_MESSAGE
|
dialog_type: Et2Dialog.ERROR_MESSAGE
|
||||||
});
|
});
|
||||||
|
@ -31,6 +31,7 @@ import './Layout/Et2Tabs/Et2TabsMobile';
|
|||||||
import './Et2Avatar/Et2Avatar';
|
import './Et2Avatar/Et2Avatar';
|
||||||
import './Et2Avatar/Et2AvatarGroup';
|
import './Et2Avatar/Et2AvatarGroup';
|
||||||
import './Et2Button/Et2Button';
|
import './Et2Button/Et2Button';
|
||||||
|
import './Et2Button/Et2ButtonCopy';
|
||||||
import './Et2Button/Et2ButtonIcon';
|
import './Et2Button/Et2ButtonIcon';
|
||||||
import './Et2Button/Et2ButtonScroll';
|
import './Et2Button/Et2ButtonScroll';
|
||||||
import './Et2Button/Et2ButtonTimestamper';
|
import './Et2Button/Et2ButtonTimestamper';
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
<et2-label id="totals"></et2-label>
|
<et2-label id="totals"></et2-label>
|
||||||
<et2-vbox class="log" id="log"></et2-vbox>
|
<et2-vbox class="log" id="log"></et2-vbox>
|
||||||
</et2-vbox>
|
</et2-vbox>
|
||||||
|
<et2-button-copy slot="footer" align="right" from="_log" copy-label="Copy">
|
||||||
|
</et2-button-copy>
|
||||||
</et2-hbox>
|
</et2-hbox>
|
||||||
<styles>
|
<styles>
|
||||||
#long_task > div {
|
#long_task > div {
|
||||||
|
Loading…
Reference in New Issue
Block a user