-
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
Shim input_control_vis for KP #52243
Shim input_control_vis for KP #52243
Conversation
- Update Filter types with RangeField and PhaseFilter - Fix broken types in input_control_vis tests
- Missing control parents/ancestors - InputControlVis dirty checking not working
@elasticmachine merge upstream |
@elasticmachine merge upstream |
async getIndexPatternSelect() { | ||
const [, { data }] = await this.props.deps.core.getStartServices(); | ||
this.setState({ | ||
IndexPatternSelect: data.ui.IndexPatternSelect, |
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.
Yes :)
return this.indexPattern; | ||
} | ||
|
||
getField() { | ||
getField(): any { |
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.
Why is this any?
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.
id: indexPatternId, | ||
fields: { | ||
getByName: name => { | ||
const fields = { field1: fieldMock }; | ||
getByName: (name: any) => { |
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.
string?
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.
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.
Just a small note, the rest LGTM. Tested and visualization still works
@@ -144,7 +158,7 @@ class FieldSelectUi extends Component { | |||
label={ | |||
<FormattedMessage | |||
id="inputControl.editor.fieldSelect.fieldLabel" | |||
defaultMessage="Field" | |||
defaultMessage="IFieldType" |
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.
Seems like this happened accidentally.
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.
Thanks Joe!
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.
createFilter(phrases: any): esFilters.PhraseFilter { | ||
let newFilter: esFilters.PhraseFilter; | ||
// TODO: Fix type to be required | ||
const value = this.indexPattern.fields.getByName(this.fieldName) as IFieldType; |
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.
I thing type is dynamically inferred here
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.
Ya the method may return undefined and the js was not checking that. I added a check to throw if doesn't exist.
const value = this.indexPattern.fields.getByName(this.fieldName);
if (!value) {
throw new Error(`unable to find fieldName: ${this.fieldName} on indexPattern`);
}
if (phrases.length === 1) {
newFilter = esFilters.buildPhraseFilter(value, phrases[0], this.indexPattern);
} else {
newFilter = esFilters.buildPhrasesFilter(value, phrases, this.indexPattern);
}
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.
|
||
controls: Array<RangeControl | ListControl>; | ||
queryBarUpdateHandler: () => void; | ||
filterManager: any; |
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.
Use type from data
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.
Thanks I wasn't sure about this type.
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.
@@ -18,10 +18,10 @@ | |||
*/ | |||
|
|||
import dateMath from '@elastic/datemath'; | |||
import { TimeRange } from '../../../common'; | |||
import { IIndexPattern } from 'src/plugins/data/public'; |
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.
The import is from within the plugin
I think you could do import { IIndexPattern } from '../..';
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.
Thanks my auto import pulls from the aliases by default.
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.
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.
in terms of @elastic/kibana-app-arch service usage LGTM
(didn't checkout after updates)
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Shim input_control_vis * Convert input_control_vis src files to typescript * Add Required, Optional, Required and Class types to kbn-utility-types * Collect all ui/* imports into legacy imports file * Pass down plugin deps from top level * Add timeout and terminate_after options to SearchSourceFields
* Shim input_control_vis * Convert input_control_vis src files to typescript * Add Required, Optional, Required and Class types to kbn-utility-types * Collect all ui/* imports into legacy imports file * Pass down plugin deps from top level * Add timeout and terminate_after options to SearchSourceFields
Summary
input_control_vis
plugin for kibana platformChecklist
For maintainers