]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/qemu/OSTypeEdit.js
Add Windows 2016 as available ostype to select
[pve-manager.git] / 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',
5 insideWizard: false,
6
7 controller: {
8 xclass: 'Ext.app.ViewController',
9 control: {
10 'radiogroup': {
11 change: function(field, value) {
12 var me = this;
13 if (!me.getView().insideWizard) {
14 return;
15 }
16
17 var targetValues;
18
19 if (PVE.qemu.OSDefaults[value.ostype]) {
20 targetValues = PVE.qemu.OSDefaults[value.ostype];
21 } else {
22 targetValues = PVE.qemu.OSDefaults.generic;
23 }
24
25 me.setWidget('pveBusSelector', targetValues.busType);
26 me.setWidget('pveNetworkCardSelector', targetValues.networkCard);
27 me.setWizardHiddenValue('qemuScsiController', targetValues.scsihw);
28 }
29 }
30 },
31 setWidget: function(widget, newValue) {
32 // changing a widget is safe only if ComponentQuery.query returns us
33 // a single value array
34 var widgets = Ext.ComponentQuery.query('pveQemuCreateWizard ' + widget);
35 if (widgets.length === 1) {
36 widgets[0].setValue(newValue);
37 } else {
38 throw 'non unique widget :' + widget + ' in Wizard';
39 }
40 },
41 setWizardHiddenValue: function(property, newValue) {
42 var wizards = Ext.ComponentQuery.query('pveQemuCreateWizard ');
43 if (wizards.length === 1) {
44 wizards[0][property] = newValue;
45 } else {
46 throw 'non unique wizard, unable to set ' + property;
47 }
48 }
49 },
50
51 initComponent : function() {
52 var me = this;
53
54 me.column1 = [
55 {
56 xtype: 'component',
57 html: 'Microsoft Windows',
58 cls:'x-form-check-group-label'
59 },
60 {
61 xtype: 'radiofield',
62 name: 'ostype',
63 inputValue: 'win10'
64 },
65 {
66 xtype: 'radiofield',
67 name: 'ostype',
68 inputValue: 'win8'
69 },
70 {
71 xtype: 'radiofield',
72 name: 'ostype',
73 inputValue: 'win7'
74 },
75 {
76 xtype: 'radiofield',
77 name: 'ostype',
78 inputValue: 'w2k8'
79 },
80 {
81 xtype: 'radiofield',
82 name: 'ostype',
83 inputValue: 'wxp'
84 },
85 {
86 xtype: 'radiofield',
87 name: 'ostype',
88 inputValue: 'w2k'
89 }
90 ];
91
92 me.column2 = [
93 {
94 xtype: 'component',
95 html: 'Linux/' + gettext('Other OS types'),
96 cls:'x-form-check-group-label'
97 },
98 {
99 xtype: 'radiofield',
100 name: 'ostype',
101 inputValue: 'l26'
102 },
103 {
104 xtype: 'radiofield',
105 name: 'ostype',
106 inputValue: 'l24'
107 },
108 {
109 xtype: 'radiofield',
110 name: 'ostype',
111 inputValue: 'solaris'
112 },
113 {
114 xtype: 'radiofield',
115 name: 'ostype',
116 inputValue: 'other'
117 }
118 ];
119
120 Ext.Array.each(me.column1, function(def) {
121 if (def.inputValue) {
122 def.boxLabel = PVE.Utils.render_kvm_ostype(def.inputValue);
123 }
124 });
125 Ext.Array.each(me.column2, function(def) {
126 if (def.inputValue) {
127 def.boxLabel = PVE.Utils.render_kvm_ostype(def.inputValue);
128 }
129 });
130
131 Ext.apply(me, {
132 useFieldContainer: {
133 xtype: 'radiogroup',
134 allowBlank: false
135 }
136 });
137
138 me.callParent();
139 }
140 });
141
142 Ext.define('PVE.qemu.OSTypeEdit', {
143 extend: 'PVE.window.Edit',
144
145 initComponent : function() {
146 var me = this;
147
148 Ext.apply(me, {
149 subject: 'OS Type',
150 items: Ext.create('PVE.qemu.OSTypeInputPanel')
151 });
152
153 me.callParent();
154
155 me.load({
156 success: function(response, options) {
157 var value = response.result.data.ostype || 'other';
158 me.setValues({ ostype: value});
159 }
160 });
161 }
162 });