-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Expose NP FieldFormats service to server side #55419
Conversation
09ee28a
to
d6cb97f
Compare
Pinging @elastic/kibana-app-arch (Team:AppArch) |
@elasticmachine merge upstream |
@@ -244,15 +244,15 @@ module.exports = { | |||
{ | |||
target: [ | |||
'(src|x-pack)/plugins/**/*', | |||
'!(src|x-pack)/plugins/*/server/**/*', |
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.
modified to add support for:
x-pack/legacy/plugins/reporting/export_types/csv/server/
# Conflicts: # src/legacy/core_plugins/kibana/index.js # src/legacy/ui/ui_mixin.js
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 - however it would be nice if we would export FieldFormat
separately from the top level so we don't have to pull it out of the helper. Not a blocker though
# Conflicts: # src/legacy/ui/public/agg_types/agg_config.ts # src/legacy/ui/public/agg_types/agg_type.ts # src/legacy/ui/public/agg_types/buckets/terms.ts # src/plugins/data/public/search/search_source/search_source.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.
As far as I'm concerned, I'm ok with merging this.
We can figure out the exact interface of field formats on the server side with @elastic/kibana-platform and do a follow up.
@lukeelmers what do you think?
@elasticmachine merge upstream |
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.
LGTM! Thanks for dealing with all of the merge conflicts as we were reviewing @alexwizp 😉
/** @public */ | ||
export type FieldFormatsSetup = ReturnType<FieldFormatsService['setup']>; | ||
|
||
/** @public */ | ||
export type FieldFormatsStart = ReturnType<FieldFormatsService['start']>; |
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.
Ah, yes I misread that on the server the returned fieldFormatsRegistry
is wrapped in the service factory. I thought they actually returned the same values which was why I commented in the first place.
In this case I agree with @lizozom, I don't want to block this PR on resolving it, so let's revisit later.
For now @alexwizp would you please add a TODO
on the server service code noting that we should come back and remove the factory so server/client can have the same interface?
Just a note that I'm adding the dev docs label to this PR so that it shows up in our tooling as "missing docs" -- that way we don't forget to make the necessary updates as we approach release. |
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.
LGTM for migration.md
* Expose NP FieldFormats service to server side * fix CI * fix PR comments * fix PR comments * fix CI * getFieldFormatsRegistry -> getFieldFormatRegistry * fix CI * memoize - add resolve cache function * fix Jest * move IFieldFormatMetaParams to types.ts * FieldFormatRegistry -> FieldFormatsRegistry * update src/core/MIGRATION.md * update public contract Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> # Conflicts: # x-pack/legacy/plugins/reporting/export_types/csv/server/execute_job.test.js
* Expose NP FieldFormats service to server side (#55419) * Expose NP FieldFormats service to server side * fix CI * fix PR comments * fix PR comments * fix CI * getFieldFormatsRegistry -> getFieldFormatRegistry * fix CI * memoize - add resolve cache function * fix Jest * move IFieldFormatMetaParams to types.ts * FieldFormatRegistry -> FieldFormatsRegistry * update src/core/MIGRATION.md * update public contract Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> # Conflicts: # x-pack/legacy/plugins/reporting/export_types/csv/server/execute_job.test.js * fix merge conflict
…ve-out-legacy * 'master' of github.com:elastic/kibana: (187 commits) [ML] Reseting categorization validation if category field is cleared (elastic#56029) [SIEM] Fields browser readable (elastic#56000) [docs] Remove unused callout (elastic#56032) Refactor saved object management registry usage (elastic#54155) [SIEM][Detection Engine] critical blocker, updates the pre-packaged rules, removes dead ones, adds license file (elastic#56090) Fix failing snapshot artifact tests when using env var (elastic#56063) Fix Github PR comment formatting (elastic#56078) [Maps] fix join metric field selection bugs (elastic#56044) Create a new menu for observability links (elastic#54847) [SIEM] [Detection Engine] Fixes histogram intervals (elastic#55969) make test less flaky by retrying if list is re-rendered (elastic#55949) Remove matrix build support (elastic#54202) Add animation to service map layout (elastic#56042) [Canvas] Remove Angular and unnecessary reporting config from Canvas (elastic#54050) [Uptime] Simplify snapshot max to Infinity (elastic#55931) [Uptime] Reintroduce a column for url (elastic#55451) Cleanup action task params objects after successful execution (elastic#55227) [CI] Retry flaky tests (elastic#53961) Expose NP FieldFormats service to server side (elastic#55419) [Endpoint] EMT-65: make endpoint data types common, restructure (elastic#54772) ... # Conflicts: # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/__snapshots__/split_panel.test.tsx.snap # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/containers/panel.tsx # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/context.tsx # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/index.ts # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/split_panel.test.tsx # src/legacy/ui/public/vis/editors/default/default_editor.tsx # src/plugins/console/public/application/components/split_panel/__snapshots__/split_panel.test.tsx.snap # src/plugins/console/public/application/components/split_panel/components/resizer.tsx # src/plugins/console/public/application/components/split_panel/containers/panel.tsx # src/plugins/console/public/application/components/split_panel/containers/panel_container.tsx # src/plugins/console/public/application/components/split_panel/context.tsx # src/plugins/console/public/application/components/split_panel/index.ts # src/plugins/console/public/application/components/split_panel/registry.ts # src/plugins/console/public/application/components/split_panel/split_panel.test.tsx # src/plugins/kibana_react/public/split_panel/__snapshots__/split_panel.test.tsx.snap # src/plugins/kibana_react/public/split_panel/containers/panel.tsx # src/plugins/kibana_react/public/split_panel/context.tsx # src/plugins/kibana_react/public/split_panel/index.ts # src/plugins/kibana_react/public/split_panel/split_panel.test.tsx
* master: (77 commits) [ML] Reseting categorization validation if category field is cleared (elastic#56029) [SIEM] Fields browser readable (elastic#56000) [docs] Remove unused callout (elastic#56032) Refactor saved object management registry usage (elastic#54155) [SIEM][Detection Engine] critical blocker, updates the pre-packaged rules, removes dead ones, adds license file (elastic#56090) Fix failing snapshot artifact tests when using env var (elastic#56063) Fix Github PR comment formatting (elastic#56078) [Maps] fix join metric field selection bugs (elastic#56044) Create a new menu for observability links (elastic#54847) [SIEM] [Detection Engine] Fixes histogram intervals (elastic#55969) make test less flaky by retrying if list is re-rendered (elastic#55949) Remove matrix build support (elastic#54202) Add animation to service map layout (elastic#56042) [Canvas] Remove Angular and unnecessary reporting config from Canvas (elastic#54050) [Uptime] Simplify snapshot max to Infinity (elastic#55931) [Uptime] Reintroduce a column for url (elastic#55451) Cleanup action task params objects after successful execution (elastic#55227) [CI] Retry flaky tests (elastic#53961) Expose NP FieldFormats service to server side (elastic#55419) [Endpoint] EMT-65: make endpoint data types common, restructure (elastic#54772) ...
@@ -70,6 +77,14 @@ export const reporting = (kibana: any) => { | |||
const pluginsSetup: ReportingSetupDeps = { | |||
usageCollection: server.newPlatform.setup.plugins.usageCollection, | |||
}; | |||
|
|||
const fieldFormatServiceFactory = async (uiSettings: IUiSettingsClient) => { | |||
const [, plugins] = await coreSetup.getStartServices(); |
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.
Hi, what does this do? This is not the only core service that we use. Why is it only necessary to implement this one using a callback?
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 talked to @alexwizp and we came to an understanding that this belongs in the existing ReportingPlugin#start method: https://github.com/elastic/kibana/blob/f0fbb99/x-pack/legacy/plugins/reporting/server/plugin.ts#L114
@alexwizp will make that change, so the Reporting team does not absorb the added tech debt and can keep focus on our other migration tasks.
const kbToBase64Length = (kb: number) => { | ||
return Math.floor((kb * 1024 * 8) / 6); | ||
}; | ||
|
||
interface ReportingDeps { | ||
data: DataPluginStart; | ||
} |
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 do we need this interface? It seems redundant with ReportingSetupDeps
@alexwizp @lukeelmers I have some questions about the changes to the Reporting code. When we look at how other dependencies are being pulled in for Reporting migration, this one really stands out. |
💔 Build FailedHistory
To update your PR or re-run it, just comment with: |
Closes: #54571
Summary
The fieldFormats service is used on the server side as well.
At the moment, it resides in src/legacy/ui/field_formats/mixin/field_formats_service.ts and only the FE plugin exposes it.
We should expose the field registry from the server side plugin at data.fieldFormats.
Dev Docs
The fieldFormats service is used on the server side as well.
At the moment, it resides in src/legacy/ui/field_formats/mixin/field_formats_service.ts and only the FE plugin exposes it.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers