Update subcloud name only if it changes

As part of the subcloud renaming feature, it is possible to
change the name from the UI.

The API returns an error if the new name of the subcloud is
the same as the existing one, therefore this error is reflected
in the UI, preventing the ability to update the other parameters
when the name does not change.

This commit is to avoid sending the new subcloud name when it is
equal to the existing name. If some of the other parameters
change but not the subcloud name, only those other parameters
should be updated.

Story: 2010788
Task: 49287

PASS: Edit the subcloud, then click on submit to send the params
      without updates. The error should not appear informing
      that the subcloud name is the same.
PASS: Edit the subcloud, then update the name parameter with a
      new subcloud name. The subcloud name should be updated.
PASS: Edit the subcloud, then update other parameters without
      updating the subcloud name. The subcloud params should
      be updated successfully.

Change-Id: Idcb746b4bde3654062edaa69a11612439afe133f
Signed-off-by: Cristian Mondo <cristian.mondo@windriver.com>
This commit is contained in:
Cristian Mondo 2023-12-18 11:32:31 -03:00
parent df10b02e3e
commit de5edc47ce
1 changed files with 8 additions and 0 deletions

View File

@ -384,7 +384,15 @@
form: ["*"],
model: model
};
var cur_cloud_name = model.name;
return modalFormService.open(config).then(function(){
// Avoids sending the name param when the subcloud name
// is the same as the previous one.
if(cur_cloud_name == model.name){
delete model.name;
}
return dc_manager.editSubcloud(cloud.subcloud_id, model);
});
}