public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0
@ 2021-05-26  8:58 Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 01/11] data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest Dominik Csapak
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

this series contains preparations/fixes/changes for extjs 7.0
1/11 ("data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest")
- 5/11 ("panel/RRDChart: fix legend/undoZoom")

are backwards compatible and should also work for extjs 6.0.1

patches from 6/11 will only work with extjs 7.0.0

Dominik Csapak (11):
  data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest
  Toolkit: set download url for draw containers to '-'
  Toolkit: set clearPropertiesOnDestroy to false by default
  css: add css changes for treelist
  panel/RRDChart: fix legend/undoZoom
  Toolkit: update overrides for scroll fixes
  Toolkit: update focusJump override
  Toolkit: remove firefox touchscreen override
  Toolkit: remove pie chart fix
  Toolkit: remove textarea fix
  Toolkit: remove Datepicker fix

 src/Toolkit.js                | 336 ++++++++++++++++++----------------
 src/css/ext6-pmx.css          |  15 ++
 src/data/ProxmoxProxy.js      |   1 +
 src/data/reader/JsonObject.js |   1 +
 src/panel/GaugeWidget.js      |   2 +
 src/panel/RRDChart.js         |  15 +-
 6 files changed, 208 insertions(+), 162 deletions(-)

-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 01/11] data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 02/11] Toolkit: set download url for draw containers to '-' Dominik Csapak
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

extjs 7.0 gives the responseType to the XMLHTTPRequest (which
is 'json' for a json reader), but that means that the response is
automatically decoded by the browser, with no means to get the original
return back

in our case, for successful api calls it would work, but some of our
errors are plain text, not json, so the decoded json object is 'null'
and we lose the error information

revert the type to 'undefined' which tells the browser not do do any
decoding

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/data/ProxmoxProxy.js      | 1 +
 src/data/reader/JsonObject.js | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/data/ProxmoxProxy.js b/src/data/ProxmoxProxy.js
index f716113..d4dfe22 100644
--- a/src/data/ProxmoxProxy.js
+++ b/src/data/ProxmoxProxy.js
@@ -17,6 +17,7 @@ Ext.define('Proxmox.RestProxy', {
     constructor: function(config) {
 	Ext.applyIf(config, {
 	    reader: {
+		responseType: undefined,
 		type: 'json',
 		rootProperty: config.root || 'data',
 	    },
diff --git a/src/data/reader/JsonObject.js b/src/data/reader/JsonObject.js
index fff774d..4298066 100644
--- a/src/data/reader/JsonObject.js
+++ b/src/data/reader/JsonObject.js
@@ -32,6 +32,7 @@ Ext.define('Proxmox.data.reader.JsonObject', {
     alias: 'reader.jsonobject',
 
     readArray: false,
+    responseType: undefined,
 
     rows: undefined,
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 02/11] Toolkit: set download url for draw containers to '-'
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 01/11] data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 03/11] Toolkit: set clearPropertiesOnDestroy to false by default Dominik Csapak
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

so that there can be no privacy leak, since the default points
to senchas server

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Toolkit.js           | 3 +++
 src/panel/GaugeWidget.js | 2 ++
 src/panel/RRDChart.js    | 3 +++
 3 files changed, 8 insertions(+)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index ffbd47a..6787173 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -659,6 +659,9 @@ Ext.define('Proxmox.selection.CheckboxModel', {
     },
 });
 
+// override the download server url globally, for privacy reasons
+Ext.draw.Container.prototype.defaultDownloadServerUrl = "-";
+
 // force alert boxes to be rendered with an Error Icon
 // since Ext.Msg is an object and not a prototype, we need to override it
 // after the framework has been initiated
diff --git a/src/panel/GaugeWidget.js b/src/panel/GaugeWidget.js
index 6cd6b60..0cc2079 100644
--- a/src/panel/GaugeWidget.js
+++ b/src/panel/GaugeWidget.js
@@ -20,6 +20,8 @@ Ext.define('Proxmox.panel.GaugeWidget', {
 	    xtype: 'polar',
 	    height: 120,
 	    border: false,
+	    // set to '-' to suppress warning in debug mode
+	    downloadServerUrl: '-',
 	    itemId: 'chart',
 	    series: [{
 		type: 'gauge',
diff --git a/src/panel/RRDChart.js b/src/panel/RRDChart.js
index 41c839e..49b3ad2 100644
--- a/src/panel/RRDChart.js
+++ b/src/panel/RRDChart.js
@@ -61,6 +61,9 @@ Ext.define('Proxmox.widget.RRDChart', {
 
     powerOfTwo: false,
 
+    // set to empty string to suppress warning in debug mode
+    downloadServerUrl: '-',
+
     controller: {
 	xclass: 'Ext.app.ViewController',
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 03/11] Toolkit: set clearPropertiesOnDestroy to false by default
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 01/11] data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 02/11] Toolkit: set download url for draw containers to '-' Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 04/11] css: add css changes for treelist Dominik Csapak
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

instead of the upstream default of 'async'

we do this since it creates some problems with our callbacks which can
happen during component destruction. The upstream reasoning does not
really makes sense for us normally, since we do not keep any references
around for most things, and thus the garbage collector can claim it.

note that this is only for components, Ext.Base sets it to 'true' by
default and we do not change this since we normally do not extend
from non-components

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Toolkit.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index 6787173..a39f64d 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -662,6 +662,12 @@ Ext.define('Proxmox.selection.CheckboxModel', {
 // override the download server url globally, for privacy reasons
 Ext.draw.Container.prototype.defaultDownloadServerUrl = "-";
 
+// stop nulling of properties
+Ext.define('Proxmox.Component', {
+    override: 'Ext.Component',
+    clearPropertiesOnDestroy: false,
+});
+
 // force alert boxes to be rendered with an Error Icon
 // since Ext.Msg is an object and not a prototype, we need to override it
 // after the framework has been initiated
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 04/11] css: add css changes for treelist
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (2 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 03/11] Toolkit: set clearPropertiesOnDestroy to false by default Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 05/11] panel/RRDChart: fix legend/undoZoom Dominik Csapak
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

add a new class 'x-treelist-pve-nav' so that we can use
ui: 'pve-nav'
instead of
ui: 'nav'
which has some default styling we do not want

also overwrite the font to FontAwesome
(extjs 7.0 uses 'FontAwesome 5 Free' which we do not ship)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/css/ext6-pmx.css | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/css/ext6-pmx.css b/src/css/ext6-pmx.css
index 97e5018..7cedaa9 100644
--- a/src/css/ext6-pmx.css
+++ b/src/css/ext6-pmx.css
@@ -112,3 +112,13 @@ div.right-aligned {
 {
     background-image:url(../images/icon-cpu.png);
 }
+
+/* change font for config panel back to fontawesome */
+.x-treelist-item-expanded > * > * > .x-treelist-item-expander::after,
+.x-treelist-item-expander::after {
+    font: 16px/1 FontAwesome;
+}
+
+.x-treelist-pve-nav {
+    background-color: #f5f5f5;
+}
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 05/11] panel/RRDChart: fix legend/undoZoom
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (3 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 04/11] css: add css changes for treelist Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 06/11] Toolkit: update overrides for scroll fixes Dominik Csapak
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

the legend is by default of type 'sprite', rever to 'dom'
but we now have to unset the '.legend', else on destruction
extjs tries to destroy it twice

also change the onAfterAnimation listener to 'redraw', since
the original event does not exist anymore, add a buffer to it
so that it is not that heavy

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/css/ext6-pmx.css  |  5 +++++
 src/panel/RRDChart.js | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/css/ext6-pmx.css b/src/css/ext6-pmx.css
index 7cedaa9..0c83d8a 100644
--- a/src/css/ext6-pmx.css
+++ b/src/css/ext6-pmx.css
@@ -122,3 +122,8 @@ div.right-aligned {
 .x-treelist-pve-nav {
     background-color: #f5f5f5;
 }
+
+/* fix padding for legend in header */
+.x-legend-inner {
+    padding: 0;
+}
diff --git a/src/panel/RRDChart.js b/src/panel/RRDChart.js
index 49b3ad2..859cb39 100644
--- a/src/panel/RRDChart.js
+++ b/src/panel/RRDChart.js
@@ -121,6 +121,9 @@ Ext.define('Proxmox.widget.RRDChart', {
 	},
 
 	onAfterAnimation: function(chart, eopts) {
+	    if (!chart.header || !chart.header.tools) {
+		return;
+	    }
 	    // if the undo button is disabled, disable our tool
 	    let ourUndoZoomButton = chart.header.tools[0];
 	    let undoButton = chart.interactions[0].getUndoButton();
@@ -137,10 +140,16 @@ Ext.define('Proxmox.widget.RRDChart', {
 	},
     ],
     legend: {
+	type: 'dom',
 	padding: 0,
     },
     listeners: {
-	animationend: 'onAfterAnimation',
+	redraw: {
+	    fn: 'onAfterAnimation',
+	    options: {
+		buffer: 500,
+	    },
+	},
     },
 
     constructor: function(config) {
@@ -200,6 +209,7 @@ Ext.define('Proxmox.widget.RRDChart', {
 	if (me.header && me.legend) {
 	    me.header.padding = '4 9 4';
 	    me.header.add(me.legend);
+	    me.legend = undefined;
 	}
 
 	if (!me.noTool) {
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 06/11] Toolkit: update overrides for scroll fixes
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (4 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 05/11] panel/RRDChart: fix legend/undoZoom Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 07/11] Toolkit: update focusJump override Dominik Csapak
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

while some scrolling issues where fixed since 6.0.1, some where introduced,
namely:
* for firefox, the correct event to listen to is 'wheel' not 'mousewheel'
* the spinner scroll direction was incorrect
* the boxOverflow scroll direction was incorrect
* the boxOverflow scroll amount was too high

functions were copied from extjs source, eslintified, and adapted

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Toolkit.js | 102 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 82 insertions(+), 20 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index a39f64d..517f1a1 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -3,11 +3,6 @@
  // do not send '_dc' parameter
 Ext.Ajax.disableCaching = false;
 
-// FIXME: HACK! Makes scrolling in number spinner work again. fixed in ExtJS >= 6.1
-if (Ext.isFirefox) {
-    Ext.$eventNameMap.DOMMouseScroll = 'DOMMouseScroll';
-}
-
 // custom Vtypes
 Ext.apply(Ext.form.field.VTypes, {
     IPAddress: function(v) {
@@ -466,29 +461,96 @@ Ext.define('Proxmox.form.field.Text', {
     },
 });
 
-// this should be fixed with ExtJS 6.0.2
-// make mousescrolling work in firefox in the containers overflowhandler
+// make mousescrolling work in firefox in the containers overflowhandler,
+// by using only the 'wheel' event not 'mousewheel'(fixed in 7.3)
+// also reverse the scrolldirection (fixed in 7.3)
+// and reduce the default increment
 Ext.define(null, {
     override: 'Ext.layout.container.boxOverflow.Scroller',
 
-    createWheelListener: function() {
-	let me = this;
-	if (Ext.isFirefox) {
-	    me.wheelListener = me.layout.innerCt.on('wheel', me.onMouseWheelFirefox, me, { destroyable: true });
+    wheelIncrement: 1,
+
+    getWheelDelta: function(e) {
+	return -e.getWheelDelta(e);
+    },
+
+    onOwnerRender: function(owner) {
+	var me = this,
+	    scrollable = {
+		isBoxOverflowScroller: true,
+		x: false,
+		y: false,
+		listeners: {
+		    scrollend: this.onScrollEnd,
+		    scope: this,
+		},
+	    };
+
+	// If no obstrusive scrollbars, allow natural scrolling on mobile touch devices
+	if (!Ext.scrollbar.width() && !Ext.platformTags.desktop) {
+	    scrollable[owner.layout.horizontal ? 'x' : 'y'] = true;
 	} else {
-	    me.wheelListener = me.layout.innerCt.on('mousewheel', me.onMouseWheel, me, { destroyable: true });
+	    me.wheelListener = me.layout.innerCt.on(
+		'wheel', me.onMouseWheel, me, { destroyable: true },
+	    );
 	}
-    },
 
-    // special wheel handler for firefox. differs from the default onMouseWheel
-    // handler by using deltaY instead of wheelDeltaY and no normalizing,
-    // because it is already
-    onMouseWheelFirefox: function(e) {
-	e.stopEvent();
-	let delta = e.browserEvent.deltaY || 0;
-	this.scrollBy(delta * this.wheelIncrement, false);
+	owner.setScrollable(scrollable);
     },
+});
+
+// extj 6.7 reversed mousewheel direction... (fixed in 7.3)
+// https://forum.sencha.com/forum/showthread.php?472517-Mousewheel-scroll-direction-in-numberfield-with-spinners
+// alse use the 'wheel' event instead of 'mousewheel' (fixed in 7.3)
+Ext.define('Proxmox.form.field.Spinner', {
+    override: 'Ext.form.field.Spinner',
+
+    onRender: function() {
+	var me = this,
+	    spinnerTrigger = me.getTrigger('spinner');
 
+	me.callParent();
+
+	// Init up/down arrow keys
+	if (me.keyNavEnabled) {
+	    me.spinnerKeyNav = new Ext.util.KeyNav({
+		target: me.inputEl,
+		scope: me,
+		up: me.spinUp,
+		down: me.spinDown,
+	    });
+
+	    me.inputEl.on({
+		keyup: me.onInputElKeyUp,
+		scope: me,
+	    });
+	}
+
+	// Init mouse wheel
+	if (me.mouseWheelEnabled) {
+	    me.mon(me.bodyEl, 'wheel', me.onMouseWheel, me);
+	}
+
+	// in v4 spinUpEl/spinDownEl were childEls, now they are children of the trigger.
+	// create references for compatibility
+	me.spinUpEl = spinnerTrigger.upEl;
+	me.spinDownEl = spinnerTrigger.downEl;
+    },
+
+    onMouseWheel: function(e) {
+	var me = this,
+	    delta;
+	if (me.hasFocus) {
+	    delta = e.getWheelDelta();
+	    if (delta > 0) {
+		me.spinDown();
+	    } else if (delta < 0) {
+		me.spinUp();
+	    }
+	    e.stopEvent();
+	    me.onSpinEnd();
+	}
+    },
 });
 
 // add '@' to the valid id
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 07/11] Toolkit: update focusJump override
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (5 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 06/11] Toolkit: update overrides for scroll fixes Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 08/11] Toolkit: remove firefox touchscreen override Dominik Csapak
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

upstream code changed a bit, update to current version

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Toolkit.js | 121 ++++++++++++++++++++++++++++++++++---------------
 1 file changed, 84 insertions(+), 37 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index 517f1a1..b85cd32 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -380,58 +380,105 @@ Ext.define(null, {
     jumpToFocus: false,
 
     saveFocusState: function() {
-	let me = this,
+	var me = this,
 	    store = me.dataSource,
 	    actionableMode = me.actionableMode,
 	    navModel = me.getNavigationModel(),
 	    focusPosition = actionableMode ? me.actionPosition : navModel.getPosition(true),
-	    refocusRow, refocusCol;
-
-	if (focusPosition) {
+	    activeElement = Ext.fly(Ext.Element.getActiveElement()),
+	    focusCell = focusPosition && focusPosition.view === me &&
+	    Ext.fly(focusPosition.getCell(true)),
+	    refocusRow, refocusCol, record;
+
+	// The navModel may return a position that is in a locked partner, so check that
+	// the focusPosition's cell contains the focus before going forward.
+	// The skipSaveFocusState is set by Actionables which actively control
+	// focus destination. See CellEditing#activateCell.
+	if (!me.skipSaveFocusState && focusCell && focusCell.contains(activeElement)) {
 	    // Separate this from the instance that the nav model is using.
 	    focusPosition = focusPosition.clone();
 
-	    // Exit actionable mode.
-	    // We must inform any Actionables that they must relinquish control.
-	    // Tabbability must be reset.
-	    if (actionableMode) {
-		me.ownerGrid.setActionableMode(false);
+	    // While we deactivate the focused element, suspend focus processing on it.
+	    activeElement.suspendFocusEvents();
+
+	    // Suspend actionable mode.
+	    // Each Actionable must silently save its state ready to resume when focus
+	    // can be restored but should only do that if the activeElement is not the cell itself,
+	    // this happens when the grid is refreshed while one of the actionables is being
+	    // deactivated (e.g. Calling  view refresh inside CellEditor 'edit' event listener).
+	    if (actionableMode && focusCell.dom !== activeElement.dom) {
+		me.suspendActionableMode();
+	    } else {
+		// Clear position, otherwise the setPosition on the other side
+		// will be rejected as a no-op if the resumption position is logically
+		// equivalent.
+		actionableMode = false;
+		navModel.setPosition();
 	    }
 
-	    // Blur the focused descendant, but do not trigger focusLeave.
-	    me.el.dom.focus();
+	    // Do not leave the element in tht state in case refresh fails, and restoration
+	    // closure not called.
+	    activeElement.resumeFocusEvents();
 
-	    // Exiting actionable mode navigates to the owning cell, so in either focus mode we must
-	    // clear the navigation position
-	    navModel.setPosition();
+	    // if the store is expanding or collapsing, we should never scroll the view.
+	    if (store.isExpandingOrCollapsing) {
+		return Ext.emptyFn;
+	    }
 
 	    // The following function will attempt to refocus back in the same mode to the same cell
-	    // as it was at before based upon the previous record (if it's still inthe store), or the row index.
+	    // as it was at before based upon the previous record (if it's still in the store),
+	    // or the row index.
 	    return function() {
+		var all;
+
+		// May have changed due to reconfigure
+		store = me.dataSource;
+
 		// If we still have data, attempt to refocus in the same mode.
 		if (store.getCount()) {
-		    // Adjust expectations of where we are able to refocus according to what kind of destruction
-		    // might have been wrought on this view's DOM during focus save.
-		    refocusRow = Math.min(focusPosition.rowIdx, me.all.getCount() - 1);
-		    refocusCol = Math.min(focusPosition.colIdx,
-					  me.getVisibleColumnManager().getColumns().length - 1);
-		    refocusRow = store.contains(focusPosition.record) ? focusPosition.record : refocusRow;
-		    focusPosition = new Ext.grid.CellContext(me).setPosition(refocusRow, refocusCol);
-
-		    if (actionableMode) {
-			me.ownerGrid.setActionableMode(true, focusPosition);
-		    } else {
-			me.cellFocused = true;
-
-			// we sometimes want to scroll back to where we were
-			let x = me.getScrollX();
-			let y = me.getScrollY();
-
-			// Pass "preventNavigation" as true so that that does not cause selection.
-			navModel.setPosition(focusPosition, null, null, null, true);
-
-			if (!me.jumpToFocus) {
-			    me.scrollTo(x, y);
+		    all = me.all;
+
+		    // Adjust expectations of where we are able to refocus according to
+		    // what kind of destruction might have been wrought on this view's DOM
+		    // during focus save.
+		    refocusRow =
+			Math.min(Math.max(focusPosition.rowIdx, all.startIndex), all.endIndex);
+
+		    refocusCol = Math.min(
+			focusPosition.colIdx,
+			me.getVisibleColumnManager().getColumns().length - 1,
+		    );
+
+		    record = focusPosition.record;
+
+		    focusPosition = new Ext.grid.CellContext(me).setPosition(
+			record && store.contains(record) && !record.isCollapsedPlaceholder
+			? record
+			: refocusRow,
+			refocusCol,
+		    );
+
+		    // Maybe there are no cells. eg: all groups collapsed.
+		    if (focusPosition.getCell(true)) {
+			if (actionableMode) {
+			    me.resumeActionableMode(focusPosition);
+			} else {
+			    // we sometimes want to scroll back to where we are
+
+			    let x = me.getScrollX();
+			    let y = me.getScrollY();
+
+			    // Pass "preventNavigation" as true
+			    // so that that does not cause selection.
+			    navModel.setPosition(focusPosition, null, null, null, true);
+
+			    if (!navModel.getPosition()) {
+				focusPosition.column.focus();
+			    }
+
+			    if (!me.jumpToFocus) {
+				me.scrollTo(x, y);
+			    }
 			}
 		    }
 		} else { // No rows - focus associated column header
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 08/11] Toolkit: remove firefox touchscreen override
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (6 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 07/11] Toolkit: update focusJump override Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 09/11] Toolkit: remove pie chart fix Dominik Csapak
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

seems to be fixed, at least i could not reproduce here.
If users report this again, we can still revert it if necessary.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Toolkit.js | 43 -------------------------------------------
 1 file changed, 43 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index b85cd32..ba06a33 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -184,49 +184,6 @@ Ext.apply(Ext.form.field.VTypes, {
     },
 });
 
-// Firefox 52+ Touchscreen bug
-// see https://www.sencha.com/forum/showthread.php?336762-Examples-don-t-work-in-Firefox-52-touchscreen/page2
-// and https://bugzilla.proxmox.com/show_bug.cgi?id=1223
-Ext.define('EXTJS_23846.Element', {
-    override: 'Ext.dom.Element',
-}, function(Element) {
-    let supports = Ext.supports,
-        proto = Element.prototype,
-        eventMap = proto.eventMap,
-        additiveEvents = proto.additiveEvents;
-
-    if (Ext.os.is.Desktop && supports.TouchEvents && !supports.PointerEvents) {
-        eventMap.touchstart = 'mousedown';
-        eventMap.touchmove = 'mousemove';
-        eventMap.touchend = 'mouseup';
-        eventMap.touchcancel = 'mouseup';
-
-        additiveEvents.mousedown = 'mousedown';
-        additiveEvents.mousemove = 'mousemove';
-        additiveEvents.mouseup = 'mouseup';
-        additiveEvents.touchstart = 'touchstart';
-        additiveEvents.touchmove = 'touchmove';
-        additiveEvents.touchend = 'touchend';
-        additiveEvents.touchcancel = 'touchcancel';
-
-        additiveEvents.pointerdown = 'mousedown';
-        additiveEvents.pointermove = 'mousemove';
-        additiveEvents.pointerup = 'mouseup';
-        additiveEvents.pointercancel = 'mouseup';
-    }
-});
-
-Ext.define('EXTJS_23846.Gesture', {
-    override: 'Ext.event.publisher.Gesture',
-}, function(Gesture) {
-    let gestures = Gesture.instance;
-
-    if (Ext.supports.TouchEvents && !Ext.isWebKit && Ext.os.is.Desktop) {
-        gestures.handledDomEvents.push('mousedown', 'mousemove', 'mouseup');
-        gestures.registerEvents();
-    }
-});
-
 Ext.define('EXTJS_18900.Pie', {
     override: 'Ext.chart.series.Pie',
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 09/11] Toolkit: remove pie chart fix
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (7 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 08/11] Toolkit: remove firefox touchscreen override Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 10/11] Toolkit: remove textarea fix Dominik Csapak
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Toolkit.js | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index ba06a33..b38e504 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -184,46 +184,6 @@ Ext.apply(Ext.form.field.VTypes, {
     },
 });
 
-Ext.define('EXTJS_18900.Pie', {
-    override: 'Ext.chart.series.Pie',
-
-    // from 6.0.2
-    betweenAngle: function(x, a, b) {
-        let pp = Math.PI * 2,
-            offset = this.rotationOffset;
-
-        if (a === b) {
-            return false;
-        }
-
-        if (!this.getClockwise()) {
-            x *= -1;
-            a *= -1;
-            b *= -1;
-            a -= offset;
-            b -= offset;
-        } else {
-            a += offset;
-            b += offset;
-        }
-
-        x -= a;
-        b -= a;
-
-        // Normalize, so that both x and b are in the [0,360) interval.
-        x %= pp;
-        b %= pp;
-        x += pp;
-        b += pp;
-        x %= pp;
-        b %= pp;
-
-        // Because 360 * n angles will be normalized to 0,
-        // we need to treat b === 0 as a special case.
-        return x < b || b === 0;
-    },
-});
-
 // we always want the number in x.y format and never in, e.g., x,y
 Ext.define('PVE.form.field.Number', {
     override: 'Ext.form.field.Number',
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 10/11] Toolkit: remove textarea fix
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (8 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 09/11] Toolkit: remove pie chart fix Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 11/11] Toolkit: remove Datepicker fix Dominik Csapak
  2021-05-28  8:43 ` [pve-devel] applied: [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Thomas Lamprecht
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Toolkit.js | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index b38e504..30dffc2 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -223,20 +223,6 @@ Ext.define('Proxmox.UnderlayPool', {
     },
 });
 
-// 'Enter' in Textareas and aria multiline fields should not activate the
-// defaultbutton, fixed in extjs 6.0.2
-Ext.define('PVE.panel.Panel', {
-    override: 'Ext.panel.Panel',
-
-    fireDefaultButton: function(e) {
-	if (e.target.getAttribute('aria-multiline') === 'true' ||
-	    e.target.tagName === "TEXTAREA") {
-	    return true;
-	}
-	return this.callParent(arguments);
-    },
-});
-
 // if the order of the values are not the same in originalValue and value
 // extjs will not overwrite value, but marks the field dirty and thus
 // the reset button will be enabled (but clicking it changes nothing)
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] [PATCH widget-toolkit 11/11] Toolkit: remove Datepicker fix
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (9 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 10/11] Toolkit: remove textarea fix Dominik Csapak
@ 2021-05-26  8:58 ` Dominik Csapak
  2021-05-28  8:43 ` [pve-devel] applied: [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Thomas Lamprecht
  11 siblings, 0 replies; 13+ messages in thread
From: Dominik Csapak @ 2021-05-26  8:58 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Toolkit.js | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index 30dffc2..6f1aee9 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -393,13 +393,6 @@ Ext.define(null, {
     },
 });
 
-// should be fixed with ExtJS 6.0.2, see:
-// https://www.sencha.com/forum/showthread.php?307244-Bug-with-datefield-in-window-with-scroll
-Ext.define('Proxmox.Datepicker', {
-    override: 'Ext.picker.Date',
-    hideMode: 'visibility',
-});
-
 // ExtJS 6.0.1 has no setSubmitValue() (although you find it in the docs).
 // Note: this.submitValue is a boolean flag, whereas getSubmitValue() returns
 // data to be submitted.
-- 
2.20.1





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [pve-devel] applied: [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0
  2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
                   ` (10 preceding siblings ...)
  2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 11/11] Toolkit: remove Datepicker fix Dominik Csapak
@ 2021-05-28  8:43 ` Thomas Lamprecht
  11 siblings, 0 replies; 13+ messages in thread
From: Thomas Lamprecht @ 2021-05-28  8:43 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 26.05.21 10:58, Dominik Csapak wrote:
> this series contains preparations/fixes/changes for extjs 7.0
> 1/11 ("data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest")
> - 5/11 ("panel/RRDChart: fix legend/undoZoom")
> 
> are backwards compatible and should also work for extjs 6.0.1
> 
> patches from 6/11 will only work with extjs 7.0.0
> 
> Dominik Csapak (11):
>   data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest
>   Toolkit: set download url for draw containers to '-'
>   Toolkit: set clearPropertiesOnDestroy to false by default
>   css: add css changes for treelist
>   panel/RRDChart: fix legend/undoZoom
>   Toolkit: update overrides for scroll fixes
>   Toolkit: update focusJump override
>   Toolkit: remove firefox touchscreen override
>   Toolkit: remove pie chart fix
>   Toolkit: remove textarea fix
>   Toolkit: remove Datepicker fix
> 
>  src/Toolkit.js                | 336 ++++++++++++++++++----------------
>  src/css/ext6-pmx.css          |  15 ++
>  src/data/ProxmoxProxy.js      |   1 +
>  src/data/reader/JsonObject.js |   1 +
>  src/panel/GaugeWidget.js      |   2 +
>  src/panel/RRDChart.js         |  15 +-
>  6 files changed, 208 insertions(+), 162 deletions(-)
> 



applied series, thanks!




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-05-28  8:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26  8:58 [pve-devel] [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 01/11] data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 02/11] Toolkit: set download url for draw containers to '-' Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 03/11] Toolkit: set clearPropertiesOnDestroy to false by default Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 04/11] css: add css changes for treelist Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 05/11] panel/RRDChart: fix legend/undoZoom Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 06/11] Toolkit: update overrides for scroll fixes Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 07/11] Toolkit: update focusJump override Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 08/11] Toolkit: remove firefox touchscreen override Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 09/11] Toolkit: remove pie chart fix Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 10/11] Toolkit: remove textarea fix Dominik Csapak
2021-05-26  8:58 ` [pve-devel] [PATCH widget-toolkit 11/11] Toolkit: remove Datepicker fix Dominik Csapak
2021-05-28  8:43 ` [pve-devel] applied: [PATCH widget-toolkit 00/11] fixes/preparation for extjs7.0 Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal