summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatiana Ovchinnikova <t.v.ovtchinnikova@gmail.com>2022-11-23 15:48:18 -0600
committerTatiana Ovchinnikova <t.v.ovtchinnikova@gmail.com>2022-11-25 18:51:26 +0000
commit4cf74f323171bda88798cd4dade4932cc0794c96 (patch)
tree2a212f7fbaa1ca0d6c03c6fc4718117896febe1c
parenta6f4500504217bec529dd67e8471bc9300605e72 (diff)
downloadhorizon-4cf74f323171bda88798cd4dade4932cc0794c96.tar.gz
Fix preselection for launch Instance dialog
Launch instance from a volumes/volume snapshot/instance snapshot should open a dialog with preselected boot source. However the dialog shows Image as selected boot source in any case, discarding the preselection. This patch fixes it, explicitly changing the boot source according to the preselection. Change-Id: I1a5a46d7be12ed179474a6a74647d0872b27b492 (cherry picked from commit 452c37dd369d2fa4c0dac9da1aba53bf1da89a30)
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
index 3a22b26df..24b949144 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
@@ -410,7 +410,7 @@
);
// When the allowedboot list changes, change the source_type
- // and update the table for the new source selection. The devault value is
+ // and update the table for the new source selection. The default value is
// set by the DEFAULT_BOOT_SOURCE config option.
// The boot source is changed only if the selected value is not included
// in the updated list (newValue)
@@ -418,7 +418,7 @@
function getAllowedBootSources() {
return $scope.model.allowedBootSources;
},
- function changeBootSource(newValue) {
+ function updateBootSource(newValue) {
if (angular.isArray(newValue) && newValue.length > 0 ) {
var opt = newValue[0];
for (var index = 0; index < newValue.length; index++) {
@@ -484,8 +484,17 @@
updateFacets(key);
}
+ // Update the initial boot source selection when launching from a preselected source
function updateDataSource(key, preSelection) {
if (preSelection) {
+ for (var index = 0; index < $scope.model.allowedBootSources.length; index++) {
+ if ($scope.model.allowedBootSources[index].type === key) {
+ $scope.model.allowedBootSources[index].selected = true;
+ }
+ else {
+ $scope.model.allowedBootSources[index].selected = false;
+ }
+ }
ctrl.selection.length = 0;
push.apply(selection, preSelection);
}