Commit f421994b authored by Dietmar Maurer's avatar Dietmar Maurer

use separate button for disk throttle.

There is enough space in the toolbar, so this is good enought for now.
Also remove some dead code, and re-ordered HDEdit to use both columns, which
looks better inside the CreateWizard.
parent 0bad228a
...@@ -97,6 +97,7 @@ Ext.define('PVE.qemu.HDInputPanel', { ...@@ -97,6 +97,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.drive = {}; me.drive = {};
me.column1 = []; me.column1 = [];
me.column2 = [];
if (!me.confid || me.unused) { if (!me.confid || me.unused) {
me.bussel = Ext.createWidget('PVE.form.ControllerSelector', { me.bussel = Ext.createWidget('PVE.form.ControllerSelector', {
...@@ -199,20 +200,18 @@ Ext.define('PVE.qemu.HDInputPanel', { ...@@ -199,20 +200,18 @@ Ext.define('PVE.qemu.HDInputPanel', {
}); });
} }
me.column1.push({ me.column2.push({
xtype: 'CacheTypeSelector', xtype: 'CacheTypeSelector',
name: 'cache', name: 'cache',
value: '', value: '',
fieldLabel: gettext('Cache') fieldLabel: gettext('Cache')
}); });
if (!me.insideWizard) { me.column2.push({
me.column1.push({ xtype: 'pvecheckbox',
xtype: 'pvecheckbox', fieldLabel: gettext('No backup'),
fieldLabel: gettext('No backup'), name: 'nobackup'
name: 'nobackup' });
});
}
me.callParent(); me.callParent();
} }
......
...@@ -218,12 +218,6 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -218,12 +218,6 @@ Ext.define('PVE.qemu.HardwareView', {
return; return;
} }
var rowdef = rows[rec.data.key];
if (!rowdef.editor) {
return;
}
var editor = rowdef.editor;
var win = Ext.create('PVE.qemu.HDThrottle', { var win = Ext.create('PVE.qemu.HDThrottle', {
pveSelNode: me.pveSelNode, pveSelNode: me.pveSelNode,
confid: rec.data.key, confid: rec.data.key,
...@@ -240,11 +234,6 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -240,11 +234,6 @@ Ext.define('PVE.qemu.HardwareView', {
return; return;
} }
var rowdef = rows[rec.data.key];
if (!rowdef.editor) {
return;
}
var win = Ext.create('PVE.window.HDResize', { var win = Ext.create('PVE.window.HDResize', {
disk: rec.data.key, disk: rec.data.key,
nodename: nodename, nodename: nodename,
...@@ -262,11 +251,6 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -262,11 +251,6 @@ Ext.define('PVE.qemu.HardwareView', {
return; return;
} }
var rowdef = rows[rec.data.key];
if (!rowdef.editor) {
return;
}
var win = Ext.create('PVE.window.HDMove', { var win = Ext.create('PVE.window.HDMove', {
disk: rec.data.key, disk: rec.data.key,
nodename: nodename, nodename: nodename,
...@@ -278,15 +262,10 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -278,15 +262,10 @@ Ext.define('PVE.qemu.HardwareView', {
win.on('destroy', reload); win.on('destroy', reload);
}; };
var diskthrottleMenu = Ext.create('Ext.menu.Item', { var edit_btn = new PVE.button.Button({
text: 'Disk Throttle',
handler: run_diskthrottle
});
var edit_btn = Ext.create('Ext.button.Split', {
text: gettext('Edit'), text: gettext('Edit'),
selModel: sm, selModel: sm,
// disabled: true, disabled: true,
enableFn: function(rec) { enableFn: function(rec) {
if (!rec) { if (!rec) {
return false; return false;
...@@ -294,18 +273,7 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -294,18 +273,7 @@ Ext.define('PVE.qemu.HardwareView', {
var rowdef = rows[rec.data.key]; var rowdef = rows[rec.data.key];
return !!rowdef.editor; return !!rowdef.editor;
}, },
handler: run_editor, handler: run_editor
menu: new Ext.menu.Menu({
items: [
{
text: gettext('Edit'),
handler: run_editor,
},
diskthrottleMenu
]
})
}); });
var resize_btn = new PVE.button.Button({ var resize_btn = new PVE.button.Button({
...@@ -322,7 +290,6 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -322,7 +290,6 @@ Ext.define('PVE.qemu.HardwareView', {
handler: run_resize handler: run_resize
}); });
var move_btn = new PVE.button.Button({ var move_btn = new PVE.button.Button({
text: gettext('Move disk'), text: gettext('Move disk'),
selModel: sm, selModel: sm,
...@@ -337,6 +304,20 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -337,6 +304,20 @@ Ext.define('PVE.qemu.HardwareView', {
handler: run_move handler: run_move
}); });
var diskthrottle_btn = new PVE.button.Button({
text: gettext('Disk Throttle'),
selModel: sm,
disabled: true,
enableFn: function(rec) {
if (!rec || rec.data.key.match(/^unused\d+/)) {
return false;
}
var rowdef = rows[rec.data.key];
return rowdef.tdCls == 'pve-itype-icon-storage' && !rec.data.value.match(/media=cdrom/);
},
handler: run_diskthrottle
});
var remove_btn = new PVE.button.Button({ var remove_btn = new PVE.button.Button({
text: gettext('Remove'), text: gettext('Remove'),
selModel: sm, selModel: sm,
...@@ -431,7 +412,8 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -431,7 +412,8 @@ Ext.define('PVE.qemu.HardwareView', {
remove_btn, remove_btn,
edit_btn, edit_btn,
resize_btn, resize_btn,
move_btn move_btn,
diskthrottle_btn
], ],
rows: rows, rows: rows,
sorterFn: sorterFn, sorterFn: sorterFn,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment