-
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
Remove src/plugins/vis_default_editor -> src/plugins/visualizations cyclic dependencies #86988
Conversation
…yclic dependencies Part of elastic#86758
Pinging @elastic/kibana-app (Team:KibanaApp) |
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.
operations - Circular dependency list LGTM
src/plugins/vis_default_editor/public/components/agg_common_props.ts
Outdated
Show resolved
Hide resolved
tooltip?: ReactNode; | ||
} | ||
import { AggGroupNames, AggParam } from '../../data/public'; | ||
import type { ISchemas, Schema } from '../../visualizations/public'; | ||
|
||
export class Schemas implements ISchemas { |
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.
discuss: I don't have a strong opinion here, but I'm not sure the Schemas
class should stay in vis_default_editor
since now..
Is there any reason to leave it here ?
Assuming interfaces were moved into visualizations, the class definition should be also moved 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.
good point, I've checked that and looks like you are right. visualizations
is more suitable place for that. Initially I thought that we use it only in vis_default_editor
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 don't have a strong opinion either but I think that Schemas class is highly connected with the editor so I am not sure that it should be part of the visualizations 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.
@stratoula I don't agree with you that it's more connected with vis_default_editor
. From my point of view It's related to visualizations
cause other plugins read this value though public schemas
field in VisType
object (see src/plugins/visualizations/public/vis_types/base_vis_type.ts)
What I did it my last commit:
Schemas
marked as private forvizualizations
plugin and now we use it only from one place. In future we can probably remove it cause I don't see any reason to keep that class. We use it only for restructure initialtype.editorConfig.schemas
array. Perhaps we can create simple static functions to make this more obvious.
@timroes please correct me if I'm wrong but I see our current design like on screen below (sorry for ugly picture). The main idea here that our visualizations should not know about about the visDefaultEditor
and use API-types from visualizations
plugin. It allow us to simply change change the editor just by modifying schema in future
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.
Ok Aliaksei, I see your point and the last change has made things a little bit better. I will approve it as it removes the dependencies between the plugins.
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 Schemas
were already a bit on the fence and still are unfortunately. While I think the sole purpose they are used today are the default editor and to build its UI (and thus I would say semantically they belong most into the default editor plugin), we returned them as a high level concept from the VisType as Alexej mentioned and thus they became a core concept of the vis registration itself (and should belong in visualizations).
So I would see two options:
- Change the API that Schemas will not be returned as a core concept of visualization registry, but be purely part of the editor, e.g. by passing it into a property of the default editor explciitly and always specifying the default editor explicitly (like
registerVisType({ ..., editor: () => <DefaultEditor schemas={schemas} />, ... })
) and then move then also in vis default editor and keep them there, or - (the easier solution for now): don't change the APIs and keep them as they are, in which case I think they need to live in
Visualizations
for now, since they are a high level concern of VisType (and the registry).
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.
@timroes It's looks like a right things, but unfortunately not only the vis_default_editor
uses schemas and it was a blocker why I didn't remove it at all in that PR. At least one plugin vis_type_xy
reads that value (see src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.tsx
) and to avoid any regression I decided to keep it in visualizations plugin. Semantically currently it's a best place for that.
From my point of view, we should:
visualizations
plugin should have onlySchema
interface; It probably should be renamed toEditorSchema
Schemas
class andISchema
interface should be removed at all;- For
vis_default_editor
we should create simple functions to extractmetrics/buckets
from theeditorConfig.schemas
in more obvious way. - Think why
vis_type_xy
uses schemas. Looks strange
But it's out of that PR. If you agree with me or have your own plan to refactor that let's create a new item for that.
src/plugins/vis_default_editor/public/components/sidebar/state/actions.ts
Outdated
Show resolved
Hide resolved
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, didn't test
The only my concern is about leaving the Schema
class in vis_default_editor
, but it's OK to be merged overall
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.
Region and tile map changes lgtm w/ green CI!
- code review
- tested locally in chrome
@elasticmachine merge upstream |
@elasticmachine merge upstream |
# Conflicts: # src/plugins/visualizations/public/vis_types/types.ts
@elasticmachine merge upstream |
@elasticmachine merge upstream |
expected head sha didn’t match current head ref. |
@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, tested locally with Safari. No regressions found and the cyclic dependencies are gone.
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
…yclic dependencies (elastic#86988) * Remove src/plugins/vis_default_editor -> src/plugins/visualizations cyclic dependencies Part of elastic#86758 * Update agg_common_props.ts * Schemas -> visualizations * fix JEST * make Schemas class private for visualizations plugin * fix type error * fix markdown app in visualize app * remove visualizations from kibana.json's Co-authored-by: Kibana Machine <[email protected]>
* master: [APM] Define placement “Right” to offset tooltip (elastic#87729) Fix UI glitch on SOM delete confirmation modal (elastic#87623) Remove src/plugins/vis_default_editor -> src/plugins/visualizations cyclic dependencies (elastic#86988) [Timelion] Fix tests flakiness on suggestion click (elastic#87273) [Uptime] Fix/details page tabs (elastic#86296) [ML] Fix earliest and latest texts for date fields (elastic#87482) chore(NA): move grokdebugger plugin test fixtures out of __tests__ folder (elastic#87765) [Security Solution] Refactor Cypress scenarios to use internal contex… (elastic#86609) [Security Solution] Unskip cypress tests (elastic#86653)
…yclic dependencies (#86988) (#87804) * Remove src/plugins/vis_default_editor -> src/plugins/visualizations cyclic dependencies Part of #86758 * Update agg_common_props.ts * Schemas -> visualizations * fix JEST * make Schemas class private for visualizations plugin * fix type error * fix markdown app in visualize app * remove visualizations from kibana.json's Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
Part of #84750
Summary
Removes circular dependencies between
vis_default_editor
andvisualizations
plugins.The dependencies that were removed based on the
node scripts/find_plugins_with_circular_deps --debug
script.Dev docs
What was changed in that PR:
ISchemas
andSchema
interfaces were moved fromvis_default_editor
tovisualizations
plugin.Schemas
class was moved fromvis_default_editor
tovisualizations
plugin (now it's a private class, we should not use it out ofvisualizations
plugin)Before:
Now: