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 b0099bbb87)
This commit is contained in:
Rob Cresswell 2017-05-16 09:27:18 +01:00 committed by Feilong Wang
parent 3bc399f3ae
commit 32b9d5c748
2 changed files with 4 additions and 2 deletions

View File

@ -649,6 +649,9 @@
type: type,
label: label
});
model.allowedBootSources.sort(function(a, b) {
return a.type > b.type;
});
}
}

View File

@ -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];
}