From 4675c233d6f20eb0a5ce4222fe1b4febdcc122d8 Mon Sep 17 00:00:00 2001 From: Brandon Kobel Date: Mon, 10 Apr 2017 11:13:50 -0400 Subject: [PATCH] Fixing bug where an error is displayed when saving a new scripted field (#10820) * Fixing bug where an error is displayed when saving a new scripted field When a new scripted field is saved, there is a moment where a mapping error validation message is displayed because there's a field with the same name. Added a `saving` flag that is used to no longer show the validation message in this situation. * Switching approach to copying fieldNames on instantiation --- src/ui/public/field_editor/field_editor.html | 2 +- src/ui/public/field_editor/field_editor.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/public/field_editor/field_editor.html b/src/ui/public/field_editor/field_editor.html index fa8a8a1512d7a..d3446c986fa37 100644 --- a/src/ui/public/field_editor/field_editor.html +++ b/src/ui/public/field_editor/field_editor.html @@ -16,7 +16,7 @@ class="form-control" data-test-subj="editorFieldName"> -
+

Mapping Conflict: diff --git a/src/ui/public/field_editor/field_editor.js b/src/ui/public/field_editor/field_editor.js index f7bea1e49ad24..f97d785a1aaee 100644 --- a/src/ui/public/field_editor/field_editor.js +++ b/src/ui/public/field_editor/field_editor.js @@ -51,6 +51,7 @@ uiModules // only init on first create self.creating = !self.indexPattern.fields.byName[self.field.name]; + self.existingFieldNames = self.indexPattern.fields.map(field => field.name); //used for mapping conflict validation self.selectedFormatId = _.get(self.indexPattern, ['fieldFormatMap', self.field.name, 'type', 'id']); self.defFormatType = initDefaultFormat();