Merge pull request #1819 from getredash/patches

Fix: form component was inserting empty values
This commit is contained in:
Arik Fraimovich
2017-06-13 09:41:24 +03:00
committed by GitHub

View File

@@ -1,4 +1,4 @@
import { each, contains, find } from 'underscore';
import { isUndefined, each, contains, find } from 'underscore';
import endsWith from 'underscore.string/endsWith';
import template from './dynamic-form.html';
@@ -115,8 +115,9 @@ function DynamicForm($http, toastr, $q) {
if (Object.keys($scope.target.options).length === 0) {
const properties = type.configuration_schema.properties;
Object.keys(properties).forEach((property) => {
$scope.target.options[property] =
properties[property].default || '';
if (!isUndefined(properties[property].default)) {
$scope.target.options[property] = properties[property].default;
}
});
}
}