+ this.lookup('cdGrid').reconfigure();
+ this.lookup('netGrid').reconfigure();
+ },
+
+ onOSTypeChange: function(_cb, value) {
+ let me = this;
+ if (!value) {
+ return;
+ }
+ let store = me.lookup('cdGrid').getStore();
+ let collection = store.getData().getSource() ?? store.getData();
+ let rec = collection.find('autogenerated', true);
+
+ let isWindows = (value ?? '').startsWith('w');
+ if (rec) {
+ rec.set('hidden', !isWindows);
+ rec.commit();
+ }
+ let prepareVirtio = me.lookup('prepareForVirtIO').getValue();
+ let defaultScsiHw = me.getView().vmConfig.scsihw ?? '__default__';
+ me.lookup('scsihw').setValue(prepareVirtio && isWindows ? 'virtio-scsi-single' : defaultScsiHw);
+
+ me.refreshGrids();
+ },
+
+ onPrepareVirtioChange: function(_cb, value) {
+ let me = this;
+
+ let scsihw = me.lookup('scsihw');
+ scsihw.suspendEvents();
+ scsihw.setValue(value ? 'virtio-scsi-single' : me.getView().vmConfig.scsihw);
+ scsihw.resumeEvents();
+
+ me.refreshGrids();
+ },
+
+ onScsiHwChange: function(_field, value) {
+ let me = this;
+ me.getView().vmConfig.scsihw = value;
+ },
+
+ onUniqueMACChange: function(_cb, value) {
+ let me = this;
+
+ me.getViewModel().set('uniqueMACAdresses', value);
+
+ me.lookup('netGrid').reconfigure();
+ },
+
+ renderMacAddress: function(value, metaData, record, rowIndex, colIndex, store, view) {
+ let me = this;
+ let vm = me.getViewModel();
+
+ return !vm.get('uniqueMACAdresses') && value ? value : 'auto';