The disk format is selected automatically when using file to create image

The disk format field has its onchange listener in horizon.forms.js file,
but it is valid only when the change is made by mouse or keyboard.
So, angularJs controller is just change its value and its listener is
not triggered. The listener can't be triggered manually within controller.
This commit set the display manually and resolve it.

Change-Id: I8c228bac9392003055a808eeb56b733ac4c9b07a
Closes-Bug: #1760006
This commit is contained in:
wangliangyu 2018-03-30 11:42:01 +08:00
parent 9ab701b5e2
commit b0fccd3355

View File

@ -23,6 +23,7 @@
ctrl.copyFrom = angular.element('#id_image_url').val();
ctrl.diskFormat = angular.element('#id_disk_format option:selected').val();
ctrl.selectTitle = $('#id_disk_format').parents('.themable-select').find('.dropdown-title');
ctrl.selectImageFormat = function (path) {
if (!path) {
return;
@ -33,8 +34,10 @@
if ($('#id_disk_format').find('[value=' + format + ']').length !== 0) {
/* eslint-enable angular/ng_angularelement */
ctrl.diskFormat = format;
ctrl.selectTitle.text($('#id_disk_format').find('[value=' + format + ']').text());
} else {
ctrl.diskFormat = "";
ctrl.selectTitle.text($('#id_disk_format').find('option').first().text());
}
};
}