-
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
Move ensureDefaultIndexPattern into data plugin #63100
Move ensureDefaultIndexPattern into data plugin #63100
Conversation
1345cb5
to
6d0a4e0
Compare
src/plugins/data/public/plugin.ts
Outdated
@@ -182,6 +183,7 @@ export class DataPublicPlugin implements Plugin<DataPublicPluginSetup, DataPubli | |||
ui: { | |||
IndexPatternSelect: createIndexPatternSelect(core.savedObjects.client), | |||
SearchBar, | |||
ensureDefaultIndexPattern: createEnsureDefaultIndexPattern(core, indexPatterns), |
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 think this should not be exported from here.
It's not really a UI component, and the naming makes it extra unclear.
It looks more like it should be a useDefaultIndexPattern
hook, that is exported from kibana_react
.
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 would be the best way to implement this (except the thing about showing the warning banner, it would be disappeared right after a plugin is destroyed),
but unfortunately, right now it's only used across angular driven plugins and I guess there is no way to integrate this pattern well there
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.
@lizozom What do you think about exporting this from IndexPatternsService
?
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.
It looks more like it should be a useDefaultIndexPattern hook, that is exported from kibana_react
I agree the ergonomics of this would be better. The only problem is that the way this helper is currently written (with bannerId
and timeoutId
being stateful), means we really have no choice but to put it somewhere in the runtime contract of the data
plugin, as kibana_utils
and kibana_react
are only imported statically.
I don't have strong feelings on whether it goes in ui
or IndexPatternsService
, but since it contains state that needs to be shared across apps, it seems those are our only options outside of refactoring the function altogether and storing that state elsewhere (e.g. sessionStorage).
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.
So what would be the final decision?
Should it stay in ui
or moved into IndexPatternsService
, or even postponed in respect of #57401 ?
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.
If @lizozom doesn't like the idea of putting it in ui
, then IMHO it's fine to put it on IndexPatternsService
. She should be available tomorrow and can hopefully chime in if she has any other ideas.
or even postponed in respect of #57401 ?
I don't think we should wait on that issue to fix this bug. That discussion is still in early stages & I don't know when the actual implementation will be prioritized.
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 think moving it to the index pattern service is better.
It's not an actual UI component.
Thanks!
@elasticmachine merge upstream |
…dex_pattern # Conflicts: # src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js
…ibana into np/move_ensure_index_pattern
This was eventually moved into |
@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.
Tested in Chrome and works as expected. Just wondering why documentation changed for the search service...
isStringType: (agg: import("./search").AggConfig) => boolean; | ||
isType: (type: string) => (agg: import("./search").AggConfig) => boolean; | ||
isType: (...types: string[]) => (agg: import("./search").AggConfig) => boolean; |
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.
Where is this change coming 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.
Seems all of the docs changes were not directly related to changes in this PR,
because after the last merge with the master, all of them are just gone (means the same changes have been already merged -> https://github.com/elastic/kibana/blob/master/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md#search-variable)
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.
Weird, I thought we had a check for that in the build.
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.
CI checks that the latest api.json
file is up to date and committed but doesn't verify that docs (based on this file) are up to date. so if you --accept
api changes but don't commit the new docs this could happen.
…dex_pattern # Conflicts: # docs/development/plugins/data/public/kibana-plugin-plugins-data-public.createsearchsource.md # src/plugins/data/public/public.api.md
…ibana into np/move_ensure_index_pattern
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.
Code changes here LGTM.
My only nit would be that it'd be nice to add ensureDefaultIndexPattern
to our src/data/public/mocks.ts
for completeness. The mocks aren't complete for index patterns ATM anyway, but even a simple jest.fn()
would be a useful starting point and save us from needing to add this later.
@lukeelmers I'd just deleted the mock in this commit to prevent adding the platform team into this thread, because it makes to update couple of snapshots in management, since it has already lasted too long 😄 |
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.
👍 For platform changes
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Move ensure_default_index_pattern into data plugin * Update docs to include ensureDefaultIndexPattern * Fix translations * Move helper into index_patterns service * Update docs * Remove mock * Add mock Co-authored-by: Elastic Machine <[email protected]>
* Move ensure_default_index_pattern into data plugin * Update docs to include ensureDefaultIndexPattern * Fix translations * Move helper into index_patterns service * Update docs * Remove mock * Add mock Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
…bana into ingest-node-pipeline/open-flyout-create-edit * 'feature/ingest-node-pipelines' of github.com:elastic/kibana: (116 commits) [Ingest Node Pipelines] More lenient treatment of on-failure value (elastic#64411) Report Deletion via UI- functional test (elastic#64031) Bump handlebars dependency from 4.5.3 to 4.7.6 (elastic#64402) [Uptime] Update TLS settings (elastic#64111) [alerting] removes usage of any throughout Alerting Services code (elastic#64161) [CANVAS] Moves notify to a canvas service (elastic#63268) [Canvas] Misc NP Stuff (elastic#63703) update apm index pattern (elastic#64232) Task/hostlist pagination (elastic#63722) [NP] Vega migration (elastic#63849) Move ensureDefaultIndexPattern into data plugin (elastic#63100) [Fleet] Fix agent status count to not include unenrolled agents (elastic#64106) Migrate graph_workspace saved object registration to Kibana platform (elastic#64157) Index pattern management UI -> TypeScript and New Platform Ready (edit_index_pattern) (elastic#64184) [ML] EuiDataGrid ml/transform components. (elastic#63447) [ML] Moving to kibana capabilities (elastic#64057) Move input_control_vis into NP (elastic#63333) remove reference to local application service in graph (elastic#64288) KQL removes leading zero and breaks query (elastic#62748) [FieldFormats] Cleanup: rename IFieldFormatType -> FieldFormatInstanceType (elastic#64193) ...
Summary
Since we started moving legacy plugins into NP,
this comment #59895 (comment) became more than relevant.
While importing
ensureDefaultIndexPattern
statically, it gets into different plugins bundles, so such variables asbannerId
&timeoutId
, which are tracked for banner appeared, are not in sync between apps and eventually ends up with duplicated banners (currently thedashboard
is in NP, butdiscover
&visualize
are about to be moved, so there would be 3 copies of the same banner):Checklist
Delete any items that are not applicable to this PR.
For maintainers