horizon/openstack_dashboard/static/app/tech-debt/image-form.controller.js
Itxaka cfbfab4142 Reduce lint warnings
Reduce some of the most obvious lint warnings like braces.

Change-Id: Ib4740ed0cf358374600a99c69559fec52215727c
2016-02-25 10:28:42 +01:00

43 lines
1.3 KiB
JavaScript

/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function () {
'use strict';
angular
.module('horizon.app.tech-debt')
.controller('ImageFormController', ImageFormController);
function ImageFormController() {
var ctrl = this;
ctrl.copyFrom = angular.element('#id_image_url').val();
ctrl.diskFormat = angular.element('#id_disk_format option:selected').val();
ctrl.selectImageFormat = function (path) {
if (!path) {
return;
}
var format = path.substr(path.lastIndexOf(".") + 1).toLowerCase().replace(/[^a-z0-9]+/gi, "");
/* eslint-disable angular/ng_angularelement */
if ($('#id_disk_format').find('[value=' + format + ']').length !== 0) {
/* eslint-enable angular/ng_angularelement */
ctrl.diskFormat = format;
} else {
ctrl.diskFormat = "";
}
};
}
})();