From 32b9d5c748d1d9b17ad8ffc126638105b2c9efd8 Mon Sep 17 00:00:00 2001 From: Rob Cresswell Date: Tue, 16 May 2017 09:27:18 +0100 Subject: [PATCH] Make the "Select Boot Source" order deterministic This patch makes the "Select Boot Source" dropdown in the Source step of the new Launch Instance have a deterministic order. The slight downside to this is that the order needs to be recalculated as new possible boot sources are loaded. However, given that this is the second step of the workflow, this is unlikely to ever be noticed by a user. Change-Id: Iaa2e37bae02c9ce5ab654ac8a3327c0834e7b49e Closes-Bug: 1640493 (cherry picked from commit b0099bbb870e4664185e724850db3fdb7887a903) --- .../workflow/launch-instance/launch-instance-model.service.js | 3 +++ .../workflow/launch-instance/source/source.controller.js | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js index dbe2b00028..d9890d303c 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js @@ -649,6 +649,9 @@ type: type, label: label }); + model.allowedBootSources.sort(function(a, b) { + return a.type > b.type; + }); } } 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 391b8e711b..8444d70983 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 @@ -393,8 +393,7 @@ return $scope.model.allowedBootSources; }, function changeBootSource(newValue) { - if (angular.isArray(newValue) && newValue.length > 0 && - !$scope.model.newInstanceSpec.source_type) { + if (angular.isArray(newValue) && newValue.length > 0) { updateBootSourceSelection(newValue[0].type); $scope.model.newInstanceSpec.source_type = newValue[0]; }