Skip to content

Commit

Permalink
Fixing bug where an error is displayed when saving a new scripted fie…
Browse files Browse the repository at this point in the history
…ld (#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
  • Loading branch information
kobelb authored Apr 10, 2017
1 parent 67a6d29 commit 10c79d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/public/field_editor/field_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class="form-control"
data-test-subj="editorFieldName">
</div>
<div ng-if="editor.creating && editor.indexPattern.fields.byName[editor.field.name]" class="hintbox">
<div ng-if="editor.creating && editor.existingFieldNames.includes(editor.field.name)" class="hintbox">
<p>
<i class="fa fa-danger text-danger"></i>
<strong>Mapping Conflict:</strong>
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/field_editor/field_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 10c79d9

Please sign in to comment.