]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/window/Settings.js
1 Ext
.define('PVE.window.Settings', {
2 extend
: 'Ext.window.Window',
5 title
: gettext('My Settings'),
12 text
: gettext('Close'),
14 this.up('window').close();
24 xclass
: 'Ext.app.ViewController',
30 var sp
= Ext
.state
.Manager
.getProvider();
32 var username
= sp
.get('login-username') || Proxmox
.Utils
.noneText
;
33 me
.lookupReference('savedUserName').setValue(username
);
36 'button[name=reset]': {
38 var blacklist
= ['GuiCap', 'login-username', 'dash-storages'];
39 var sp
= Ext
.state
.Manager
.getProvider();
41 for (state
in sp
.state
) {
42 if (sp
.state
.hasOwnProperty(state
)) {
43 if (blacklist
.indexOf(state
) !== -1) {
51 window
.location
.reload();
54 'button[name=clear-username]': {
57 var usernamefield
= me
.lookupReference('savedUserName');
58 var sp
= Ext
.state
.Manager
.getProvider();
60 usernamefield
.setValue(Proxmox
.Utils
.noneText
);
61 sp
.clear('login-username');
64 'grid[reference=dashboard-storages]': {
65 selectionchange: function(grid
, selected
) {
67 var sp
= Ext
.state
.Manager
.getProvider();
69 // saves the selected storageids as
71 // or clears the variable
72 if (selected
.length
> 0) {
73 sp
.set('dash-storages',
74 Ext
.Array
.pluck(selected
, 'id').join(','));
76 sp
.clear('dash-storages');
79 afterrender: function(grid
) {
81 var sp
= Ext
.state
.Manager
.getProvider();
82 var store
= me
.getStore();
84 me
.suspendEvent('selectionchange');
85 var storages
= sp
.get('dash-storages') || '';
86 storages
.split(',').forEach(function(storage
){
87 // we have to get the records
88 // to be able to select them
90 var item
= store
.getById(storage
);
96 me
.getSelectionModel().select(items
);
97 me
.resumeEvent('selectionchange');
106 title
: gettext('Browser Settings'),
117 xtype
: 'displayfield',
118 fieldLabel
: gettext('Dashboard Storages'),
125 reference
: 'dashboard-storages',
127 selType
: 'checkboxmodel'
130 header
: gettext('Name'),
131 dataIndex
: 'storage',
134 header
: gettext('Node'),
140 field
: ['type', 'storage', 'id', 'node'],
141 rstore
: PVE
.data
.ResourceStore
,
146 sorters
: [ 'node','storage']
154 xtype
: 'displayfield',
155 fieldLabel
: gettext('Saved User name'),
158 stateId
: 'login-username',
159 reference
: 'savedUserName',
164 cls
: 'x-btn-default-toolbar-small proxmox-inline-button',
165 text
: gettext('Clear User name'),
167 name
: 'clear-username'
174 xtype
: 'displayfield',
175 fieldLabel
: gettext('Layout'),
181 cls
: 'x-btn-default-toolbar-small proxmox-inline-button',
182 text
: gettext('Reset Layout'),