-
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
App Services: Remove remaining uiActions, expressions, data, embeddable circular dependencies. #82791
App Services: Remove remaining uiActions, expressions, data, embeddable circular dependencies. #82791
Conversation
c50fcf9
to
e531149
Compare
In working on this, I realized that we also have a data <-> embeddables circular dependency with types. Data relies on embeddable for the action contexts for value click & select range actions. Apply filter action also needs On the embeddable, side, data types are used for This design is generally just confusing, particularly the fact that these data-owned action contexts need to know about embeddables. So far there are two ways I've thought of to mitigate this:
None of these options feels great... overall I don't know enough about uiActions to understand why embeddables need to be included in some of these action contexts in the first place; they don't appear to be using embeddables for anything internally, just passing them through. This feels like a design smell that we should revisit, but that's outside the scope of this PR. Open to any other ideas I may have overlooked here... But so far my ideas boil down to the tradeoff between whether data should depend on embeddables, or embeddables on data. |
@ppisljar and i discussed this today... we both agreed that this is the preferable option, so i'm going to look into the level of effort here and go this direction if it's feasible. |
@lukeelmers Any progress or update here on how much effort this will be? Anything we can do to help with brainstorming solutions? The data plugin is currently blocking many teams from migrating to TS project references, which in turn will be blocking our migration to the Bazel build system. |
@joshdover At this point I think we have a clear path forward, but I had to pause to complete a few other high-priority items that need to make it into 7.11. I plan to pick this back up, but this probably won't be until late this week or early next. I know we're holding up other folks, so this is still next on my priority list after our remaining 7.11 commitments are addressed. |
Sounds great 😄 |
e531149
to
92f6ff9
Compare
I ran However, it created a new circular dependency The only option that isn't a significant amount of work is trying to get rid of the Otherwise I've covered all circular deps in app services-related plugins. |
Okay, I think we're all good now! 🤞 Down to 28 circular deps from 117, and all items owned by app services should be addressed! I updated the |
@@ -31,13 +31,9 @@ interface Options { | |||
type CircularDepList = Set<string>; | |||
|
|||
const allowedList: CircularDepList = new Set([ | |||
'src/plugins/charts -> src/plugins/discover', |
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.
Removing the app services-owned circular deps revealed a new circular dep between app-owned plugins, so I added it to the allowList
.
import { AggConfigSerialized } from '../../../common/search/aggs'; | ||
|
||
export async function createFiltersFromRangeSelectAction(event: RangeSelectContext['data']) { |
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.
Rather than selecting the data
property from RangeSelectContext
, I've copied those pieces over here.
|
||
const mockField = { | ||
name: 'bytes', | ||
filterable: true, | ||
}; | ||
|
||
describe('createFiltersFromValueClick', () => { | ||
let dataPoints: ValueClickContext['data']['data']; |
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.
Rather than selecting the data
property from ValueClickContext
, I've copied those pieces over here.
src/plugins/data/public/plugin.ts
Outdated
uiActions.registerAction( | ||
createFilterAction(queryService.filterManager, queryService.timefilter.timefilter) | ||
); | ||
|
||
uiActions.addTriggerAction( | ||
SELECT_RANGE_TRIGGER, | ||
'SELECT_RANGE_TRIGGER', |
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 wasn't a great way to keep these trigger IDs as consts since they lived in embeddable
, so I just used the ID string here.
export interface MockFilter { | ||
$state?: any; | ||
meta: any; | ||
query?: 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.
It doesn't make sense for embeddables to know about filter in the first place, but since all of these test helpers existed, I went ahead and made a "fake" filter interface for use in the tests.
* but expressions cannot know about vis or it creates a mess of circular dependencies. | ||
* Downstream consumers of the uiState handler will need to cast for now. | ||
*/ | ||
uiState?: unknown; |
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.
We need to get rid of uiState
in expressions eventually anyway, so this is just another reason to do so 😉
Pinging @elastic/kibana-app-services (Team:AppServices) |
141acd1
to
1f2368e
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.
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 look good, took a look at dashboards and everything seems to be working well.
1f2368e
to
cc7691f
Compare
5088150
to
548a0c6
Compare
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Distributable file count
Page load bundle
History
To update your PR or re-run it, just comment with: |
…le circular dependencies. (#82791) (#86608) * Move applyFilter, selectRange, valueClick triggers to data/embeddables. * Update imports. * Remove embeddable references to non-existent data plugin dependency. * remove data mocks from embeddable * Remove query, filters, timeRange from EmbeddableInput and move to apps. * Remove data plugin imports from embeddable test samples. * Remove circular dependencies caused by expressions renderer handlers. * Update circular deps allowList. * Remove data dependency on embeddable. * Revert accidental data plugin change. * Fix new circular deps issues. * Update generated docs. * Fix type errors in vis_type_xy * Fix inspector data table.
* master: (48 commits) Fix request with disabled aggregation (elastic#85696) [Security Solution][Detections][Threshold Rules] Threshold Rule Bug Fixes (elastic#84918) Removed a possibility to define two different names for Alert types on API and UI level. (elastic#86236) Bump Node.js from version 14.15.2 to 14.15.3 (elastic#86593) [index patterns] Fleep app - Keep saved object field list until field caps provides fields (elastic#85370) [Security Solutions] fix timeline tabs + layout (elastic#86581) Upgrade to hapi version 20 (elastic#85406) App Services: Remove remaining uiActions, expressions, data, embeddable circular dependencies. (elastic#82791) Rename chartLibrary setting to legacyChartsLibrary (elastic#86529) [CI] TeamCity updates (elastic#85843) [Maps] Use Json for mvt-tests (elastic#86492) [Rollup Jobs] Added autofocus to cron editor (elastic#86324) [Monitoring][Alerting] CCR read exceptions alert (elastic#85908) [CI] Bump memory for main CI workers (elastic#86541) Explicitly set Elasticsearch heap size during CI and local development (elastic#86513) [App Search] Updates to results on the documents view (elastic#86181) [Discover] Change default sort handling (elastic#85561) [App Search] Convert DocumentCreationModal to DocumentCreationFlyout (elastic#86508) [App Search] Sample Engines should have access to the Crawler (elastic#86502) Fixed duplication of create new modal (elastic#86489) ...
Closes #82047
As part of the work to migrate to TS project references in preparation for the new build toolchain, we needed to remove some circular dependencies that exist between the
ui_actions
andexpressions
/data
plugins.The main issue were two imports inside
ui_actions
which were used in the range select, value click, and apply filter triggers:kibana/src/plugins/ui_actions/public/types.ts
Lines 30 to 31 in 2c1bc50
These were imported to include in the shared
TriggerContextMapping
, and the respective triggers for each were all registered from theui_actions
plugin itself. This PR splits everything up as follows:TriggerContextMapping
was augmented viadeclare module
fromembeddable
anddata
declare module
pattern for trigger/action mappings #82790ui_actions
already had existing dependencies onembeddable
anddata
, so this doesn't affect any existing dependencies of those plugins.data
dependencies (query/filter/timerange) were removed fromembeddable
EmbeddableInput
types, but embeddable didn't really need to know about theseEmbeddableInput
to provide them, so that the dependency ondata
is made explicitdata
dependencies onembeddable
were removedI did some comparison on this PR using the new
find_plugins_with_circular_deps
script that was introduced in #82867, and we've gone from 117 circular dependencies down to 28 🎊Once this PR merges, all app services-owned circular dependencies should be addressed.