]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/qemu/OSTypeEdit.js
1 Ext
.define('PVE.qemu.OSTypeInputPanel', {
2 extend
: 'PVE.panel.InputPanel',
3 alias
: 'widget.pveQemuOSTypePanel',
4 onlineHelp
: 'qm_os_settings',
8 xclass
: 'Ext.app.ViewController',
10 'combobox[name=osbase]': {
11 change
: 'onOSBaseChange'
13 'combobox[name=ostype]': {
14 afterrender
: 'onOSTypeChange',
15 change
: 'onOSTypeChange'
18 onOSBaseChange: function(field
, value
) {
19 this.lookup('ostype').getStore().setData(PVE
.Utils
.kvm_ostypes
[value
]);
21 onOSTypeChange: function(field
) {
22 var me
= this, ostype
= field
.getValue();
23 if (!me
.getView().insideWizard
) {
26 var targetValues
= PVE
.qemu
.OSDefaults
.getDefaults(ostype
);
28 me
.setWidget('pveBusSelector', targetValues
.busType
);
29 me
.setWidget('pveNetworkCardSelector', targetValues
.networkCard
);
30 me
.setWizardHiddenValue('qemuScsiController', targetValues
.scsihw
);
32 setWidget: function(widget
, newValue
) {
33 // changing a widget is safe only if ComponentQuery.query returns us
34 // a single value array
35 var widgets
= Ext
.ComponentQuery
.query('pveQemuCreateWizard ' + widget
);
36 if (widgets
.length
=== 1) {
37 widgets
[0].setValue(newValue
);
39 throw 'non unique widget :' + widget
+ ' in Wizard';
42 setWizardHiddenValue: function(property
, newValue
) {
43 var wizards
= Ext
.ComponentQuery
.query('pveQemuCreateWizard ');
44 if (wizards
.length
=== 1) {
45 wizards
[0][property
] = newValue
;
47 throw 'non unique wizard, unable to set ' + property
;
52 initComponent : function() {
55 /*jslint confusion: true */
58 xtype
: 'displayfield',
59 value
: gettext('Guest OS') + ':',
60 hidden
: !me
.insideWizard
66 fieldLabel
: gettext('Type'),
70 store
: Object
.keys(PVE
.Utils
.kvm_ostypes
)
76 fieldLabel
: gettext('Version'),
84 fields
: ['desc', 'val'],
85 data
: PVE
.Utils
.kvm_ostypes
.Linux
,
87 datachanged: function (store
) {
88 var ostype
= me
.lookup('ostype');
89 var old_val
= ostype
.getValue();
90 if (!me
.insideWizard
&& old_val
&& store
.find('val', old_val
) != -1) {
91 ostype
.setValue(old_val
);
93 ostype
.setValue(store
.getAt(0));
100 /*jslint confusion: false */
106 Ext
.define('PVE.qemu.OSTypeEdit', {
107 extend
: 'PVE.window.Edit',
109 initComponent : function() {
114 items
: [{ xtype
: 'pveQemuOSTypePanel' }]
120 success: function(response
, options
) {
121 var value
= response
.result
.data
.ostype
|| 'other';
122 var osinfo
= PVE
.Utils
.get_kvm_osinfo(value
);
123 me
.setValues({ ostype
: value
, osbase
: osinfo
.base
});