-
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
[Logs UI][Metrics UI] Replace usage of deprecated IndexPattern types #114448
Changes from 1 commit
84f8c95
af705e7
2014c2b
4167cc9
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 |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
* 2.0. | ||
*/ | ||
|
||
import { IndexPattern, KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; | ||
import { DataView } from '../../../../../../../src/plugins/data/common'; | ||
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. Why not keep importing from 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. Right, that was sloppy of me! I'll fix that :) 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. Looking at the other files, they seem to pull mostly form /common, is that something I should look to change as well? |
||
import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; | ||
|
||
export interface GenericValidationError { | ||
type: 'generic'; | ||
|
@@ -67,17 +68,15 @@ export const validateStringNotEmpty = (fieldName: string, value: string): FormVa | |
export const validateColumnListNotEmpty = (columns: unknown[]): FormValidationError[] => | ||
columns.length <= 0 ? [{ type: 'empty_column_list' }] : []; | ||
|
||
export const validateIndexPattern = (indexPattern: IndexPattern): FormValidationError[] => { | ||
export const validateIndexPattern = (indexPattern: DataView): FormValidationError[] => { | ||
return [ | ||
...validateIndexPatternIsTimeBased(indexPattern), | ||
...validateIndexPatternHasStringMessageField(indexPattern), | ||
...validateIndexPatternIsntRollup(indexPattern), | ||
]; | ||
}; | ||
|
||
export const validateIndexPatternIsTimeBased = ( | ||
indexPattern: IndexPattern | ||
): FormValidationError[] => | ||
export const validateIndexPatternIsTimeBased = (indexPattern: DataView): FormValidationError[] => | ||
indexPattern.isTimeBased() | ||
? [] | ||
: [ | ||
|
@@ -88,7 +87,7 @@ export const validateIndexPatternIsTimeBased = ( | |
]; | ||
|
||
export const validateIndexPatternHasStringMessageField = ( | ||
indexPattern: IndexPattern | ||
indexPattern: DataView | ||
): FormValidationError[] => { | ||
const messageField = indexPattern.getFieldByName('message'); | ||
|
||
|
@@ -111,7 +110,7 @@ export const validateIndexPatternHasStringMessageField = ( | |
} | ||
}; | ||
|
||
export const validateIndexPatternIsntRollup = (indexPattern: IndexPattern): FormValidationError[] => | ||
export const validateIndexPatternIsntRollup = (indexPattern: DataView): FormValidationError[] => | ||
indexPattern.type != null | ||
? [ | ||
{ | ||
|
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.
Instead of casting to
any
, how about we use a// @ts-expect-error
? That could increase the likelihood that the person updating thegetQuerySuggestions
signature will be prompted by CI to remove the workaround.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.
Much better, thanks!