From de5edc47cef0a3d6fc65b1b1e2ca750253f633c7 Mon Sep 17 00:00:00 2001 From: Cristian Mondo Date: Mon, 18 Dec 2023 11:32:31 -0300 Subject: [PATCH] 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 --- .../cloud_overview/table/subcloud_table.controller.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js index 9519e493..e76956c6 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/static/dashboard/dc_admin/cloud_overview/table/subcloud_table.controller.js @@ -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); }); }