Merge "do not flush selection on "old" boot source"
This commit is contained in:
commit
9c9a7e3327
@ -428,7 +428,10 @@
|
|||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
function updateBootSourceSelection(selectedSource) {
|
function updateBootSourceSelection(selectedSource) {
|
||||||
ctrl.currentBootSource = selectedSource;
|
if (ctrl.currentBootSource !== selectedSource) {
|
||||||
|
ctrl.selection.length = 0;
|
||||||
|
ctrl.currentBootSource = selectedSource;
|
||||||
|
}
|
||||||
if ((selectedSource === bootSourceTypes.IMAGE ||
|
if ((selectedSource === bootSourceTypes.IMAGE ||
|
||||||
selectedSource === bootSourceTypes.INSTANCE_SNAPSHOT) && $scope.model.volumeBootable) {
|
selectedSource === bootSourceTypes.INSTANCE_SNAPSHOT) && $scope.model.volumeBootable) {
|
||||||
$scope.model.newInstanceSpec.vol_create =
|
$scope.model.newInstanceSpec.vol_create =
|
||||||
@ -451,8 +454,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateDataSource(key, preSelection) {
|
function updateDataSource(key, preSelection) {
|
||||||
selection.length = 0;
|
|
||||||
if (preSelection) {
|
if (preSelection) {
|
||||||
|
ctrl.selection.length = 0;
|
||||||
push.apply(selection, preSelection);
|
push.apply(selection, preSelection);
|
||||||
}
|
}
|
||||||
angular.extend(ctrl.tableData, bootSources[key]);
|
angular.extend(ctrl.tableData, bootSources[key]);
|
||||||
|
@ -290,6 +290,20 @@
|
|||||||
scope.$apply();
|
scope.$apply();
|
||||||
expect(scope.$broadcast).toHaveBeenCalled();
|
expect(scope.$broadcast).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
it('should not flush selection if boot source still the same', function() {
|
||||||
|
ctrl.currentBootSource = 'image';
|
||||||
|
ctrl.selection = ['test_selection'];
|
||||||
|
ctrl.updateBootSourceSelection('image');
|
||||||
|
scope.$apply();
|
||||||
|
expect(ctrl.selection).toEqual(['test_selection']);
|
||||||
|
});
|
||||||
|
it('should flush selection on new boot source', function() {
|
||||||
|
ctrl.currentBootSource = 'image';
|
||||||
|
ctrl.selection = ['test_selection'];
|
||||||
|
ctrl.updateBootSourceSelection('volume');
|
||||||
|
scope.$apply();
|
||||||
|
expect(ctrl.selection).toEqual([]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('source allocation', function() {
|
describe('source allocation', function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user