mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 15:21:28 +00:00
fix #759: save columns of resourceGrid
with this patch, the resourceGrid saves its state when the columns are changed (resized, sorted, etc.) also add a little reset button to the toolbar Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
0be88ae197
commit
df6345f9ba
2
debian/changelog.Debian
vendored
2
debian/changelog.Debian
vendored
@ -4,6 +4,8 @@ pve-manager (4.1-32) unstable; urgency=medium
|
|||||||
|
|
||||||
* fix #143: add disk/mem percent sort
|
* fix #143: add disk/mem percent sort
|
||||||
|
|
||||||
|
* fix #759: save columns of resourceGrid
|
||||||
|
|
||||||
-- Proxmox Support Team <support@proxmox.com> Wed, 20 Apr 2016 09:21:17 +0200
|
-- Proxmox Support Team <support@proxmox.com> Wed, 20 Apr 2016 09:21:17 +0200
|
||||||
|
|
||||||
pve-manager (4.1-31) unstable; urgency=medium
|
pve-manager (4.1-31) unstable; urgency=medium
|
||||||
|
@ -350,3 +350,16 @@
|
|||||||
.x-form-display-field-default {
|
.x-form-display-field-default {
|
||||||
min-height: 20px;
|
min-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.x-button-reset:before {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for resetcolumnsbutton */
|
||||||
|
.x-button-reset:after{
|
||||||
|
content: "\f0e7 ";
|
||||||
|
position: relative;
|
||||||
|
text-shadow: 0 0 2px #fff;
|
||||||
|
left: -3px;
|
||||||
|
top: 2px;
|
||||||
|
}
|
||||||
|
@ -3,7 +3,14 @@ Ext.define('PVE.grid.ResourceGrid', {
|
|||||||
alias: ['widget.pveResourceGrid'],
|
alias: ['widget.pveResourceGrid'],
|
||||||
|
|
||||||
border: false,
|
border: false,
|
||||||
|
saveCurrentState: function(){
|
||||||
|
var me = this;
|
||||||
|
me.saveState();
|
||||||
|
},
|
||||||
|
defaultSorter: {
|
||||||
|
property: 'type',
|
||||||
|
direction: 'ASC'
|
||||||
|
},
|
||||||
initComponent : function() {
|
initComponent : function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
@ -14,12 +21,7 @@ Ext.define('PVE.grid.ResourceGrid', {
|
|||||||
|
|
||||||
var store = Ext.create('Ext.data.Store', {
|
var store = Ext.create('Ext.data.Store', {
|
||||||
model: 'PVEResources',
|
model: 'PVEResources',
|
||||||
sorters: [
|
sorters: me.defaultSorter,
|
||||||
{
|
|
||||||
property : 'type',
|
|
||||||
direction: 'ASC'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
proxy: { type: 'memory' }
|
proxy: { type: 'memory' }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -149,7 +151,21 @@ Ext.define('PVE.grid.ResourceGrid', {
|
|||||||
|
|
||||||
Ext.apply(me, {
|
Ext.apply(me, {
|
||||||
store: store,
|
store: store,
|
||||||
|
stateful: true,
|
||||||
|
stateId: 'resourcegrid',
|
||||||
tbar: [
|
tbar: [
|
||||||
|
{
|
||||||
|
xtype: 'button',
|
||||||
|
itemId: 'resetbutton',
|
||||||
|
tooltip: gettext("Reset Columns"),
|
||||||
|
iconCls: 'fa fa-fw fa-columns x-button-reset',
|
||||||
|
handler: function(button, e, opts) {
|
||||||
|
var sp = Ext.state.Manager.getProvider();
|
||||||
|
me.getStore().sort(me.defaultSorter);
|
||||||
|
me.reconfigure(null, PVE.data.ResourceStore.defaultColums());
|
||||||
|
sp.clear(me.stateId);
|
||||||
|
}
|
||||||
|
},
|
||||||
'->',
|
'->',
|
||||||
gettext('Search') + ':', ' ',
|
gettext('Search') + ':', ' ',
|
||||||
{
|
{
|
||||||
@ -206,13 +222,15 @@ Ext.define('PVE.grid.ResourceGrid', {
|
|||||||
},
|
},
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
rstore.un("load", load_cb);
|
rstore.un("load", load_cb);
|
||||||
}
|
},
|
||||||
|
columnschanged: 'saveCurrentState',
|
||||||
|
columnresize: 'saveCurrentState',
|
||||||
|
columnmove: 'saveCurrentState',
|
||||||
|
sortchange: 'saveCurrentState',
|
||||||
},
|
},
|
||||||
columns: coldef
|
columns: coldef
|
||||||
});
|
});
|
||||||
|
|
||||||
me.callParent();
|
me.callParent();
|
||||||
|
|
||||||
updateGrid();
|
updateGrid();
|
||||||
rstore.on("load", load_cb);
|
rstore.on("load", load_cb);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user