-
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 vis.aggs references from aggTypes #20508
Conversation
💔 Build Failed |
da627a8
to
2a94cb4
Compare
💔 Build Failed |
3610328
to
aba2bff
Compare
💔 Build Failed |
aba2bff
to
711be6c
Compare
💚 Build Succeeded |
711be6c
to
e90c562
Compare
💚 Build Succeeded |
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 the code on Chrome/OSX. Everything works as expected.
I've left some comment to address if possibly before merge
const parentPipelineAggWritter = function (agg, output) { | ||
const vis = agg.vis; | ||
const selectedMetric = agg.params.customMetric || vis.aggs.getResponseAggById(agg.params.metricAgg); | ||
const parentPipelineAggWritter = function (agg, output, aggs) { |
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.
Is this a typo writter
?
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 the file name is writter, sould be writer
src/ui/public/vis/agg_configs.js
Outdated
}); | ||
|
||
this.push.apply(this, configStates.map(aggConfigState => { | ||
if (aggConfigState instanceof AggConfig) return aggConfigState; |
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.
could you please add braces here?
this.id = String(opts.id || AggConfig.nextId(vis.aggs)); | ||
this.vis = vis; | ||
this._indexPattern = vis.indexPattern; | ||
this._aggs = aggs || vis.aggs; |
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._aggs
is not used inside the AggConfig class, we can remove it so we can get rid of having stored references of it's AggConfigs array inside each object.
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 is, there are some references to aggConfig (or config)._aggs
we can't remove just yet
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.
Will we work towards removing it completely? Because if we should access it from the outside, we should rather not name this like a private variable?
src/ui/public/vis/agg_config.js
Outdated
@@ -176,9 +177,9 @@ class AggConfig { | |||
* @return {void|Object} - if the config has a dsl representation, it is | |||
* returned, else undefined is returned | |||
*/ | |||
toDsl() { | |||
toDsl(aggs) { |
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.
Could you please also update the doc block here? on the doc the param is called @param {AggConfig} aggConfig
. Or maybe change the aggs
param to aggConfig
ti keep it a bit more readable
25cd0b0
to
b5d9100
Compare
src/ui/public/vis/agg_config.js
Outdated
@@ -172,13 +173,13 @@ class AggConfig { | |||
* | |||
* Adds params and adhoc subaggs to a pojo, then returns it | |||
* | |||
* @param {AggConfig} aggConfig - the config object to convert | |||
* @param {aggConfigs} aggConfigs - the config object to convert |
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.
Sould be AggConfigs
as param type
💚 Build Succeeded |
src/ui/public/vis/agg_configs.js
Outdated
}); | ||
|
||
this.push.apply(this, configStates.map(aggConfigState => { |
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.push(...configStates.map(...))
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.
Just some minor nitpicks, LGTM
💔 Build Failed |
# Conflicts: # src/ui/public/agg_types/buckets/date_histogram.js
💔 Build Failed |
remove vis.aggs references from aggTypes
_aggs
property for a few usecases where it needs to access it out of param.write function, so it no longer needs to be accessed from vis object.in UI (controllers, directives) we still have reference to vis.params, which is not problematic as vis is available on the scope there.
preparation for #19813