]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - form/RRDTypeSelector.js
1 Ext
.define('Proxmox.form.RRDTypeSelector', {
2 extend
: 'Ext.form.field.ComboBox',
3 alias
: ['widget.proxmoxRRDTypeSelector'],
10 stateEvents
: [ 'select' ],
12 stateId
: 'proxmoxRRDTypeSelection',
15 fields
: [ 'id', 'timeframe', 'cf', 'text' ],
17 [ 'hour', 'hour', 'AVERAGE',
18 gettext('Hour') + ' (' + gettext('average') +')' ],
19 [ 'hourmax', 'hour', 'MAX',
20 gettext('Hour') + ' (' + gettext('maximum') + ')' ],
21 [ 'day', 'day', 'AVERAGE',
22 gettext('Day') + ' (' + gettext('average') + ')' ],
23 [ 'daymax', 'day', 'MAX',
24 gettext('Day') + ' (' + gettext('maximum') + ')' ],
25 [ 'week', 'week', 'AVERAGE',
26 gettext('Week') + ' (' + gettext('average') + ')' ],
27 [ 'weekmax', 'week', 'MAX',
28 gettext('Week') + ' (' + gettext('maximum') + ')' ],
29 [ 'month', 'month', 'AVERAGE',
30 gettext('Month') + ' (' + gettext('average') + ')' ],
31 [ 'monthmax', 'month', 'MAX',
32 gettext('Month') + ' (' + gettext('maximum') + ')' ],
33 [ 'year', 'year', 'AVERAGE',
34 gettext('Year') + ' (' + gettext('average') + ')' ],
35 [ 'yearmax', 'year', 'MAX',
36 gettext('Year') + ' (' + gettext('maximum') + ')' ]
39 // save current selection in the state Provider so RRDView can read it
40 getState: function() {
41 var ind
= this.getStore().findExact('id', this.getValue());
42 var rec
= this.getStore().getAt(ind
);
48 timeframe
: rec
.data
.timeframe
,
52 // set selection based on last saved state
53 applyState : function(state
) {
54 if (state
&& state
.id
) {
55 this.setValue(state
.id
);