introduce a new browser setting, with which the users can choose between
the automatic mode of choosing columns, or always using 1/2/3 columns
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
},
updateColumns: function(container) {
},
updateColumns: function(container) {
- let factor = container.getSize().width < 1400 ? 1 : 2;
+ let mode = Ext.state.Manager.get('summarycolumns') || 'auto';
+ let factor;
+ if (mode !== 'auto') {
+ factor = parseInt(mode, 10);
+ if (Number.isNaN(factor)) {
+ factor = 1;
+ }
+ } else {
+ factor = container.getSize().width < 1400 ? 1 : 2;
+ }
if (container.oldFactor === factor) {
return;
if (container.oldFactor === factor) {
return;
+ me.mon(sp, 'statechange', function(provider, key, value) {
+ if (key !== 'summarycolumns') {
+ return;
+ }
+ PVE.Utils.updateColumns(me);
+ });
+
+
+ let sp = Ext.state.Manager.getProvider();
+ me.mon(sp, 'statechange', function(provider, key, value) {
+ if (key !== 'summarycolumns') {
+ return;
+ }
+ PVE.Utils.updateColumns(me.getComponent('itemcontainer'));
+ });
rrdstore.startUpdate();
me.on('destroy', rrdstore.stopUpdate);
}
rrdstore.startUpdate();
me.on('destroy', rrdstore.stopUpdate);
}
+ let sp = Ext.state.Manager.getProvider();
+ me.mon(sp, 'statechange', function(provider, key, value) {
+ if (key !== 'summarycolumns') {
+ return;
+ }
+ PVE.Utils.updateColumns(me.getComponent('itemcontainer'));
+ });
me.lookupReference('noVNCScalingGroup').setValue({ noVNCScalingField: vncMode });
}
me.lookupReference('noVNCScalingGroup').setValue({ noVNCScalingField: vncMode });
}
+ let summarycolumns = sp.get('summarycolumns');
+ me.lookup('summarycolumns').setValue(summarycolumns || 'auto');
+
var settings = ['fontSize', 'fontFamily', 'letterSpacing', 'lineHeight'];
settings.forEach(function(setting) {
var val = localStorage.getItem('pve-xterm-' + setting);
var settings = ['fontSize', 'fontFamily', 'letterSpacing', 'lineHeight'];
settings.forEach(function(setting) {
var val = localStorage.getItem('pve-xterm-' + setting);
me.getSelectionModel().select(items);
me.resumeEvent('selectionchange');
}
me.getSelectionModel().select(items);
me.resumeEvent('selectionchange');
}
+ },
+ 'field[reference=summarycolumns]': {
+ change: function(el, newValue) {
+ var sp = Ext.state.Manager.getProvider();
+ sp.set('summarycolumns', newValue);
+ }
+ {
+ xtype: 'box',
+ autoEl: { tag: 'hr'}
+ },
+ {
+ xtype: 'proxmoxKVComboBox',
+ fieldLabel: gettext('Summary columns') + ':',
+ labelWidth: 150,
+ stateId: 'summarycolumns',
+ reference: 'summarycolumns',
+ comboItems: [
+ ['auto', 'auto'],
+ ['1', '1'],
+ ['2', '2'],
+ ['3', '3'],
+ ],
+ },