]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/form/VMCPUFlagSelector.js
1 /*jslint confusion: true*/
2 Ext
.define('PVE.form.VMCPUFlagSelector', {
3 extend
: 'Ext.grid.Panel',
4 alias
: 'widget.vmcpuflagselector',
7 field
: 'Ext.form.field.Field'
10 disableSelection
: true,
22 fields
: ['flag', { name
: 'state', defaultValue
: '=' }, 'desc'],
24 // FIXME: let qemu-server host this and autogenerate or get from API call??
25 { flag
: 'md-clear', desc
: 'Required to let the guest OS know if MDS is mitigated correctly' },
26 { flag
: 'pcid', desc
: 'Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs' },
27 { flag
: 'spec-ctrl', desc
: 'Allows improved Spectre mitigation with Intel CPUs' },
28 { flag
: 'ssbd', desc
: 'Protection for "Speculative Store Bypass" for Intel models' },
29 { flag
: 'ibpb', desc
: 'Allows improved Spectre mitigation with AMD CPUs' },
30 { flag
: 'virt-ssbd', desc
: 'Basis for "Speculative Store Bypass" protection for AMD models' },
31 { flag
: 'amd-ssbd', desc
: 'Improves Spectre mitigation performance with AMD CPUs, best used with "virt-ssbd"' },
32 { flag
: 'amd-no-ssb', desc
: 'Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs' },
33 { flag
: 'pdpe1gb', desc
: 'Allow guest OS to use 1GB size pages, if host HW supports it' }
42 getValue: function() {
44 var store
= me
.getStore();
47 // ExtJS does not has a nice getAllRecords interface for stores :/
48 store
.queryBy(Ext
.returnTrue
).each(function(rec
) {
49 var s
= rec
.get('state');
51 var f
= rec
.get('flag');
60 flags
+= me
.unkownFlags
.join(';');
65 setValue: function(value
) {
67 var store
= me
.getStore();
69 me
.value
= value
|| '';
73 me
.getStore().queryBy(Ext
.returnTrue
).each(function(rec
) {
74 rec
.set('state', '=');
77 var flags
= value
? value
.split(';') : [];
78 flags
.forEach(function(flag
) {
79 var sign
= flag
.substr(0, 1);
80 flag
= flag
.substr(1);
82 var rec
= store
.findRecord('flag', flag
);
84 rec
.set('state', sign
);
86 me
.unkownFlags
.push(flag
);
91 var res
= me
.mixins
.field
.setValue
.call(me
, value
);
98 renderer: function(v
) {
100 case '=': return 'Default';
101 case '-': return 'Off';
102 case '+': return 'On';
103 default: return 'Unknown';
109 xtype
: 'widgetcolumn',
112 onWidgetAttach: function (column
, widget
, record
) {
113 var val
= record
.get('state') || '=';
114 widget
.down('[inputValue=' + val
+ ']').setValue(true);
115 // TODO: disable if selected CPU model and flag are incompatible
121 validateOnChange
: false,
124 change: function(f
, value
) {
125 var v
= Object
.values(value
)[0];
126 f
.getWidgetRecord().set('state', v
);
128 var view
= this.up('grid');
129 view
.dirty
= view
.getValue() !== view
.originalValue
;
131 //view.checkChange();
137 boxLabelAlign
: 'before',
162 initComponent: function() {
165 // static class store, thus gets not recreated, so ensure defaults are set!
166 me
.getStore().data
.forEach(function(v
) {
170 me
.value
= me
.originalValue
= '';
172 me
.callParent(arguments
);