Skip to content

Commit cf04321

Browse files
author
dmaerzendorfer
committed
Fix for 'flying' Ext Toast after adding a new process.
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.
1 parent f4a4b44 commit cf04321

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/Resources/public/js/window/activeProcesses.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug
9595
items: [
9696
headerText,
9797
progressPanel,
98-
actionBtnsPanel
98+
actionBtnsPanel
9999
],
100100
});
101101

@@ -105,7 +105,16 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug
105105
this.displayList.push(panel);
106106
if (this.toast != null) {
107107
this.toast.insert(0,panel);
108+
108109
this.toast.show();
110+
111+
//workaround for toast appearing at a random location after adding a process:
112+
//after showing, set the postion to the bottom right
113+
let width = $(window).width();
114+
let height = $(window).height();
115+
let toastSize = this.toast.getSize();
116+
//does only seem to work without animation if animations are disabled for the toast
117+
this.toast.setPosition(width-toastSize.width,height-toastSize.height,false);
109118
}
110119

111120
},
@@ -184,8 +193,8 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug
184193

185194
_updateActionBtns: function(actionBtnsPanel, item) {
186195

187-
actionBtnsPanel.items.removeAll(); //do not remove them as it causes flickering
188-
actionBtnsPanel.update();
196+
actionBtnsPanel.items.removeAll(); //do not remove them as it causes flickering
197+
actionBtnsPanel.update();
189198

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

209218
_updatePanelTitle : function(data){
210219
if(this.toast){
211-
// let title = t('plugin_pm_process_list_title') + ' <small id="processManagerActiveText">(' + data.active +' from ' + data.total +' active)</small> ';
220+
// let title = t('plugin_pm_process_list_title') + ' <small id="processManagerActiveText">(' + data.active +' from ' + data.total +' active)</small> ';
212221
//this.toast.setTitle(title);
213222
//do not use setTitle as it causes scrolling
214223
let el = document.getElementById('processManagerActiveText');
@@ -255,6 +264,7 @@ pimcore.plugin.processmanager.window.activeProcesses = Class.create(pimcore.plug
255264
title: t('plugin_pm_process_list_title') + ' <small id="processManagerActiveText"></small>',
256265
width: 700,
257266
autoScroll : false,
267+
animate: false,
258268
maxHeight:400,
259269
autoShow: true,
260270
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

0 commit comments

Comments
 (0)