-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing bug where an error is displayed when saving a new scripted field #10820
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,8 @@ uiModules | |
|
||
self.cancel = redirectAway; | ||
self.save = function () { | ||
self.saving = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm always wary of flags like this since they can get stuck in an incorrect state. For instance if Instead, what would you think of creating an array of existing field names on controller instantiation (around line 52) and then use that in our template's conditional instead of the live index pattern?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems reasonable, I will make it so. I've found myself using state flags to denote asynchronous actions and their current state a lot to disable buttons, etc. (especially with React/Flux) but you're right that in this scenario the lack of a It's also probably worthwhile, in another PR, to add in a .catch so if an error is thrown that we display it to the user. |
||
|
||
const indexPattern = self.indexPattern; | ||
const fields = indexPattern.fields; | ||
const field = self.field.toActualField(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we could replace
editor.indexPattern.fields.byName[editor.field.name]
witheditor.existingFieldNames.includes(editor.field.name)