Skip to content

Commit

Permalink
Fix for 'flying' Ext Toast after adding a new process.
Browse files Browse the repository at this point in the history
The toast used to appear at a seemingly random location instead of in the bottom-right corner. Fixed by manually setting the position after an insertion. However, requires for the animation of the toast to be disabled.
  • Loading branch information
dmaerzendorfer committed Mar 1, 2022
1 parent f4a4b44 commit cf04321
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/Resources/public/js/window/activeProcesses.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug
items: [
headerText,
progressPanel,
actionBtnsPanel
actionBtnsPanel
],
});

Expand All @@ -105,7 +105,16 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug
this.displayList.push(panel);
if (this.toast != null) {
this.toast.insert(0,panel);

this.toast.show();

//workaround for toast appearing at a random location after adding a process:
//after showing, set the postion to the bottom right
let width = $(window).width();
let height = $(window).height();
let toastSize = this.toast.getSize();
//does only seem to work without animation if animations are disabled for the toast
this.toast.setPosition(width-toastSize.width,height-toastSize.height,false);
}

},
Expand Down Expand Up @@ -184,8 +193,8 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug

_updateActionBtns: function(actionBtnsPanel, item) {

actionBtnsPanel.items.removeAll(); //do not remove them as it causes flickering
actionBtnsPanel.update();
actionBtnsPanel.items.removeAll(); //do not remove them as it causes flickering
actionBtnsPanel.update();

if(item.actionItems.length){
for(let i = 0; i < item.actionItems.length; i++){
Expand All @@ -208,7 +217,7 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug

_updatePanelTitle : function(data){
if(this.toast){
// let title = t('plugin_pm_process_list_title') + ' <small id="processManagerActiveText">(' + data.active +' from ' + data.total +' active)</small> ';
// let title = t('plugin_pm_process_list_title') + ' <small id="processManagerActiveText">(' + data.active +' from ' + data.total +' active)</small> ';
//this.toast.setTitle(title);
//do not use setTitle as it causes scrolling
let el = document.getElementById('processManagerActiveText');
Expand Down Expand Up @@ -255,6 +264,7 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug
title: t('plugin_pm_process_list_title') + ' <small id="processManagerActiveText"></small>',
width: 700,
autoScroll : false,
animate: false,
maxHeight:400,
autoShow: true,
closeAction : 'hide', //do not destroy as we get errors when panel disappears and a new process is started - seems to be a bug in Ext.Toast
Expand Down

0 comments on commit cf04321

Please sign in to comment.