-
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
moving visualize/utils to new platform #56650
Conversation
Pinging @elastic/kibana-app-arch (Team:AppArch) |
bcf388c
to
0b4f53e
Compare
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.
All LGTM, most of my notes are just around conflicts with #56353. Depending on which merges first, we'll need to update the other PR accordingly.
return new DefaultFieldFormat(); | ||
const createFormat = fieldFormats.serializeFieldFormat; | ||
const getFormat = (mapping?: SerializedFieldFormat) => { | ||
return npStart.plugins.data.fieldFormats.deserialize(mapping as 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.
You may be able to get rid of as any
with !
, or by doing if (mapping)
return npStart.plugins.data.fieldFormats.deserialize(mapping as any); | |
return mapping ? npStart.plugins.data.fieldFormats.deserialize(mapping) : undefined; |
...or:
return npStart.plugins.data.fieldFormats.deserialize(mapping as any); | |
return npStart.plugins.data.fieldFormats.deserialize(mapping!); |
import { Vis } from '../../../../../visualizations/public'; | ||
import { tabifyGetColumns } from '../../../../../../ui/public/agg_response/tabify/_get_columns'; | ||
|
||
const getTableAggs = (vis: Vis): AggConfig[] => { |
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.
nit: I'm adding IAggConfig
in #56353, so if that merges first, it would be preferable to use it here instead.
import { | ||
convertDateRangeToString, | ||
DateRangeKey, | ||
} from '../../../../../legacy/ui/public/agg_types/buckets/date_range'; | ||
import { | ||
convertIPRangeToString, | ||
IpRangeKey, | ||
} from '../../../../../legacy/ui/public/agg_types/buckets/ip_range'; |
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.
These will also break when #56353 merges; the BWC for imports from agg_types
only supports imports from the top level ui/agg_types
:
import {
convertDateRangeToString,
DateRangeKey,
convertIPRangeToString,
IpRangeKey,
} from 'ui/agg_types';
import { AggConfig } from '../../../../../legacy/ui/public/agg_types'; | ||
import { SerializedFieldFormat } from '../../../../expressions/common/types'; | ||
|
||
export const serializeFieldFormat = (agg: AggConfig): SerializedFieldFormat => { |
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.
Same note re: IAggConfig
5e35f04
to
42bde92
Compare
@elasticmachine merge upstream |
353584e
to
7e3d5e4
Compare
@elasticmachine merge upstream |
347f059
to
693c2dc
Compare
import { getTableAggs } from '../../../legacy_imports'; | ||
|
||
import { Vis } from '../../../../../visualizations/public'; | ||
import { tabifyGetColumns } from '../../../../../../ui/public/agg_response/tabify/_get_columns'; |
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 should be no legacy imports within the vis types, please re-export those via legacy_imports
(same with the type import a little further up). I'm currently working on a separate PR that will break on these changes.
|
||
// @ts-ignore | ||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths | ||
import { createFiltersFromEvent } from '../../../../../data/public/actions/filters/create_filters_from_event'; |
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.
Should we re-export this from the top level of the data plugin?
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 would consider waiting for #57177
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.
Also expect breakage on #56975 🙄 |
* under the License. | ||
*/ | ||
|
||
export interface DateRangeKey { |
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.
Isn't this the same as the TimeRange
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.
And convertDateRangeToString
looks like a function that could be exported as a utility from data/public/index
, taking in a TimeRange
and returning a string
@@ -38,6 +38,7 @@ export class FieldFormatsRegistry { | |||
protected defaultMap: Record<string, IFieldFormatConfig> = {}; | |||
protected metaParamsOptions: Record<string, any> = {}; | |||
protected getConfig?: GetConfigFn; | |||
deserialize: 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.
public deserialize: Function
?
@@ -24,7 +24,13 @@ | |||
export { HTML_CONTEXT_TYPE, TEXT_CONTEXT_TYPE } from './content_types'; | |||
export { FieldFormat } from './field_format'; | |||
export { FieldFormatsRegistry } from './field_formats_registry'; | |||
export { getHighlightRequest, asPrettyString, getHighlightHtml } from './utils'; | |||
export { | |||
getHighlightRequest, |
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 removed this file and changed the way we export utils here #56975
# Conflicts: # src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts # src/plugins/data/public/index.ts
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.
Kibana app changes LGTM
|
||
// @ts-ignore | ||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths | ||
import { createFiltersFromEvent } from '../../../../../data/public/actions/filters/create_filters_from_event'; |
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.
This reverts commit 3d3cbfa
@elasticmachine merge upstream |
|
||
export class FieldFormatsRegistry { | ||
protected fieldFormats: Map<FieldFormatId, IFieldFormatType> = new Map(); | ||
protected defaultMap: Record<string, FieldFormatConfig> = {}; | ||
protected metaParamsOptions: Record<string, any> = {}; | ||
protected getConfig?: FieldFormatsGetConfigFn; | ||
public deserialize: (mapping: SerializedFieldFormat) => IFieldFormat = () => { | ||
return new (FieldFormat.from(identity))(); |
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 input is not being used here?
src/plugins/data/public/index.ts
Outdated
@@ -303,7 +306,7 @@ export { | |||
TimeHistoryContract, | |||
} from './query'; | |||
export * from './ui'; | |||
|
|||
export { FieldFormatsStart } from './field_formats'; |
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.
No need to export this I think
Use DataPluginPublicStart['fieldFormats'] where needed
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.
Overall LGTM
d5cca21
to
4554631
Compare
@elasticmachine merge upstream |
1 similar comment
@elasticmachine merge upstream |
# Conflicts: # x-pack/plugins/translations/translations/ja-JP.json # x-pack/plugins/translations/translations/zh-CN.json
55336d3
to
2c5581e
Compare
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Test FailuresKibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces·ts.Visualize visualize space with no features disabled can view existing VisualizationStandard Out
Stack Trace
History
To update your PR or re-run it, just comment with: |
# Conflicts: # x-pack/plugins/translations/translations/ja-JP.json # x-pack/plugins/translations/translations/zh-CN.json
…re/files-and-filetree * 'master' of github.com:elastic/kibana: (139 commits) Move Ace XJSON lexer-rules, worker and utils to es_ui_shared (elastic#57563) [Upgrade Assistant] Fix filter deprecations search filter (elastic#57541) [ML] New Platform server shim: update indices routes (elastic#57685) Bump redux dependencies (elastic#53348) [Index management] Client-side NP ready (elastic#57295) change id of x-pack event_log plugin to eventLog (elastic#57612) [eventLog] get kibana.index name from config instead of hard-coding it (elastic#57607) revert allow using any path to generate fixes ui titles (elastic#57535) Fix login redirect for expired sessions (elastic#57157) Expose Vis on the contract as it requires visTypes (elastic#56968) [SIEM][Detection Engine] Fixes queries to ignore errors when signals index is not present [Remote clusters] Migrate client-side code out of legacy (elastic#57365) Fix failed test reporter for SIEM Cypress use (elastic#57240) skip flaky suite (elastic#45244) update chromedriver to 80.0.1 (elastic#57602) change slack action to only report on whitelisted host name (elastic#57582) [kbn/optimizer] throw errors into stream on invalid completion (elastic#57735) moving visualize/utils to new platform (elastic#56650) ...
Summary
moves utils related to fieldFormatters to data/fieldFormatters and moves getTableAggs to vislib legend (last place its used)
Dev Docs
if you are importing
FormatFactory, getFormat or createFormat
fromui/visualize/utilities
you should upgrade to importing the new platform version of those:
getFormat
usenpStart.plugins.data.fieldFormats.deserialize()
createFormat
(renamed toserialize
) and FormatFactory type: