use correct vmid for id when in vm replication panel

values.guest is only available when the field 'guest' is not a
displayfield (e.g. when in vm replication panel), so we have to
use the given vmid first and only when this is not available, fall back
to the value of the field

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2017-06-14 08:52:59 +02:00 committed by Wolfgang Bumiller
parent 701acf208a
commit de2022b85c

View File

@ -67,12 +67,13 @@ Ext.define('PVE.window.ReplicaEdit', {
if (me.isCreate) {
values.type = 'local';
var vm = vmid || values.guest;
var id = -1;
if (me.highestids[values.guest] !== undefined) {
id = me.highestids[values.guest];
if (me.highestids[vm] !== undefined) {
id = me.highestids[vm];
}
id++;
values.id = values.guest + '-' + id.toString();
values.id = vm + '-' + id.toString();
delete values.guest;
}
return values;