Merge pull request #3493 from lukasolson/fix-booleans-index-patterns

Fix boolean and index pattern editors in advanced settings.
This commit is contained in:
Spencer 2015-03-31 16:44:31 -07:00
commit a8eb412116
5 changed files with 7 additions and 4 deletions

View file

@ -40,7 +40,6 @@
<input
ng-show="conf.bool"
ng-model="conf.unsavedValue"
ng-checked="conf.unsavedValue === undefined ? conf.defVal : conf.unsavedValue"
type="checkbox"
class="form-control">
</form>

View file

@ -38,7 +38,7 @@ define(function (require) {
};
$scope.edit = function (conf) {
conf.unsavedValue = conf.value || conf.defVal;
conf.unsavedValue = conf.value == null ? conf.defVal : conf.value;
$scope.configs.forEach(function (c) {
c.editting = (c === conf);
});

View file

@ -47,7 +47,7 @@ define(function (require) {
var editor = getEditorType(conf);
conf.json = editor === 'json';
conf.bool = editor === 'bool';
conf.bool = editor === 'boolean';
conf.array = editor === 'array';
conf.normal = editor === 'normal';
conf.tooComplex = !editor;

View file

@ -15,7 +15,7 @@ define(function (require) {
return 'array';
}
return (typeof def.value);
return (def.value != null ? typeof def.value : typeof value);
}
return getValType;

View file

@ -26,6 +26,10 @@ define(function (require) {
expect(getValType({value: 'someString'})).to.be('string');
expect(getValType({value: 'someString'}, 42)).to.be('string');
});
it('should return the type of the value if the default value is null', function () {
expect(getValType({value: null}, 'someString')).to.be('string');
});
});
});
});