Merge "Adds support for directly patching boolean attributes"

This commit is contained in:
Jenkins 2017-08-22 13:07:11 +00:00 committed by Gerrit Code Review
commit 791eecc71e
3 changed files with 12 additions and 7 deletions

View File

@ -29,6 +29,7 @@
'$rootScope',
'$controller',
'$uibModalInstance',
'horizon.framework.widgets.toast.service',
'$log',
'$q',
'horizon.app.core.openstack-service-api.ironic',
@ -41,6 +42,7 @@
function EditPortController($rootScope,
$controller,
$uibModalInstance,
toastService,
$log,
$q,
ironic,
@ -102,8 +104,8 @@
$log.info("Updating port " + JSON.stringify(port));
patcher.buildPatch(port.address, ctrl.address.value, "/address");
patcher.buildPatch(port.pxe_enabled ? 'True' : 'False',
ctrl.pxeEnabled.value,
patcher.buildPatch(port.pxe_enabled,
ctrl.pxeEnabled.value === 'True',
"/pxe_enabled");
var attr = ctrl.localLinkConnection.toPortAttr();
if (attr) {

View File

@ -26,6 +26,7 @@
EditPortgroupController.$inject = [
'$controller',
'$uibModalInstance',
'horizon.framework.widgets.toast.service',
'$log',
'horizon.app.core.openstack-service-api.ironic',
'horizon.dashboard.admin.ironic.update-patch.service',
@ -34,6 +35,7 @@
function EditPortgroupController($controller,
$uibModalInstance,
toastService,
$log,
ironic,
updatePatchService,
@ -72,9 +74,8 @@
patcher.buildPatch(portgroup.address, ctrl.address.value, "/address");
patcher.buildPatch(portgroup.name, ctrl.name.value, "/name");
patcher.buildPatch(portgroup.standalone_ports_supported
? 'True' : 'False',
ctrl.standalone_ports_supported.value,
patcher.buildPatch(portgroup.standalone_ports_supported,
ctrl.standalone_ports_supported.value === 'True',
"/standalone_ports_supported");
patcher.buildPatch(portgroup.mode,
ctrl.mode.value,

View File

@ -59,13 +59,15 @@
* @description Check whether an item is a property
*
* @param {object} item - item to be tested
* @return {boolean} True if the item is a number, string, or date
* @return {boolean} True if the item is a number, string, date,
* or boolean.
*/
function isProperty(item) {
return item === null ||
angular.isNumber(item) ||
angular.isString(item) ||
angular.isDate(item);
angular.isDate(item) ||
typeof item === 'boolean';
}
/**