Fix the name of Bare Metal Nodes

When create or edit, fill in name of node, then clear it, creating and editing nodes throws an error

Closes-Bug: #1991208
Change-Id: Ia2ad3fb1f9f4a5fa38e59df68386caf5c0c74d3d
This commit is contained in:
xusongfu
2022-09-29 15:22:24 +08:00
parent be289f56cb
commit 069d45af87

View File

@@ -150,7 +150,8 @@ export class Create extends StepAction {
body[key] = newValue;
}
} else {
body[key] = values[key];
const isEmptyName = key === 'name' && values[key] === '';
body[key] = isEmptyName ? null : values[key];
}
});
body.driver_info = driverInfo;
@@ -186,8 +187,13 @@ export class Create extends StepAction {
} else {
const oldValue = originData[key];
if (!isEqual(oldValue, value) && (oldValue || value)) {
obj.op = 'replace';
replaces.push(obj);
if (key === 'name' && value === '') {
obj.op = 'remove';
dels.push(obj);
} else {
obj.op = 'replace';
replaces.push(obj);
}
}
}
});