mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-06-22 08:14:23 +00:00
add RRDTypeSelector class
Mostly copied from pve-manager. - added gettext translations - changed class and state name
This commit is contained in:
parent
a7dcbdebb9
commit
a0ba293c12
1
Makefile
1
Makefile
@ -26,6 +26,7 @@ JSSRC= \
|
|||||||
form/Checkbox.js \
|
form/Checkbox.js \
|
||||||
form/KVComboBox.js \
|
form/KVComboBox.js \
|
||||||
form/ComboGrid.js \
|
form/ComboGrid.js \
|
||||||
|
form/RRDTypeSelector.js \
|
||||||
button/Button.js \
|
button/Button.js \
|
||||||
grid/ObjectGrid.js \
|
grid/ObjectGrid.js \
|
||||||
grid/PendingObjectGrid.js \
|
grid/PendingObjectGrid.js \
|
||||||
|
58
form/RRDTypeSelector.js
Normal file
58
form/RRDTypeSelector.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
Ext.define('Proxmox.form.RRDTypeSelector', {
|
||||||
|
extend: 'Ext.form.field.ComboBox',
|
||||||
|
alias: ['widget.proxmoxRRDTypeSelector'],
|
||||||
|
|
||||||
|
displayField: 'text',
|
||||||
|
valueField: 'id',
|
||||||
|
editable: false,
|
||||||
|
queryMode: 'local',
|
||||||
|
value: 'hour',
|
||||||
|
stateEvents: [ 'select' ],
|
||||||
|
stateful: true,
|
||||||
|
stateId: 'proxmoxRRDTypeSelection',
|
||||||
|
store: {
|
||||||
|
type: 'array',
|
||||||
|
fields: [ 'id', 'timeframe', 'cf', 'text' ],
|
||||||
|
data : [
|
||||||
|
[ 'hour', 'hour', 'AVERAGE',
|
||||||
|
gettext('Hour') + ' (' + gettext('average') +')' ],
|
||||||
|
[ 'hourmax', 'hour', 'MAX',
|
||||||
|
gettext('Hour') + ' (' + gettext('maximum') + ')' ],
|
||||||
|
[ 'day', 'day', 'AVERAGE',
|
||||||
|
gettext('Day') + ' (' + gettext('average') + ')' ],
|
||||||
|
[ 'daymax', 'day', 'MAX',
|
||||||
|
gettext('Day') + ' (' + gettext('maximum') + ')' ],
|
||||||
|
[ 'week', 'week', 'AVERAGE',
|
||||||
|
gettext('Week') + ' (' + gettext('average') + ')' ],
|
||||||
|
[ 'weekmax', 'week', 'MAX',
|
||||||
|
gettext('Week') + ' (' + gettext('maximum') + ')' ],
|
||||||
|
[ 'month', 'month', 'AVERAGE',
|
||||||
|
gettext('Month') + ' (' + gettext('average') + ')' ],
|
||||||
|
[ 'monthmax', 'month', 'MAX',
|
||||||
|
gettext('Month') + ' (' + gettext('maximum') + ')' ],
|
||||||
|
[ 'year', 'year', 'AVERAGE',
|
||||||
|
gettext('Year') + ' (' + gettext('average') + ')' ],
|
||||||
|
[ 'yearmax', 'year', 'MAX',
|
||||||
|
gettext('Year') + ' (' + gettext('maximum') + ')' ]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// save current selection in the state Provider so RRDView can read it
|
||||||
|
getState: function() {
|
||||||
|
var ind = this.getStore().findExact('id', this.getValue());
|
||||||
|
var rec = this.getStore().getAt(ind);
|
||||||
|
if (!rec) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: rec.data.id,
|
||||||
|
timeframe: rec.data.timeframe,
|
||||||
|
cf: rec.data.cf
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// set selection based on last saved state
|
||||||
|
applyState : function(state) {
|
||||||
|
if (state && state.id) {
|
||||||
|
this.setValue(state.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user