-
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
Hides advanced json for count metric #74636
Hides advanced json for count metric #74636
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@@ -115,6 +115,7 @@ function getAggParamsToRender({ | |||
} | |||
|
|||
if (!paramEditor) { | |||
if (agg.type.name === 'count' && param.type === 'json') return; |
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.
Your solutions was tested locally and it works fine. But could you please use METRIC_TYPES.COUNT
instead of hardcoded value.
Also from the design perspective I don't like idea to add some if
's into high level component. From my point of view all of that edge cases should be handled in src/plugins/vis_default_editor/public/components/agg_params_map.ts
But looks like agg_params_map
also requires some refactoring to exclude some fields from that map =( but I prefer to go this way
@sulemanof what do you think?
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.
IMHO,
the restriction of an any param should come from an agg type.
The source of building any aggregation on UI is the agg.type.params
, which is based on agg config.
In that case, we should restrict the count
metric have the json
param in its config.
I could suggest smth like that:
src/plugins/data/common/search/aggs/metrics/count.ts
and than in src/plugins/data/common/search/aggs/agg_type.ts
The same is happening now to customLabel
param:
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.
Probably yes, /plugins/data/common/search/aggs/metrics/count_fn.ts
should be also updated
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.
Than you both ❤️ Will look into this
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.
Overall the changes to the aggs service make sense. In the long run I'd like to completely remove the "magic" addition of the json
param onto every agg type, and instead have each agg explicitly declare it so that you don't need something like a json: false
setting. But that's pretty far outside the scope of this PR, so in the interim I'm comfortable with this approach.
...rest, | ||
json: getParsedValue(args, 'json'), | ||
}, | ||
params: rest, |
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 should remove the json
argument from the function definition above as well, since it's no longer being used.
Note that this might cause a TS error because the function definition is using AggExpressionFunctionArgs
which is pulling the relevant type from the AggParamsMapping
. For count
, the value used is BaseAggParams
which includes json:
[METRIC_TYPES.COUNT]: BaseAggParams; |
If TS gives you trouble, you may need to define an AggParamsMetricCount
in the count.ts
file without extending BaseAggParams
as others agg types do.
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.
Thanx @lukeelmers , I missed that, TS looks happy btw :)
@elasticmachine merge upstream |
@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 💟
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.
App arch code updates LGTM!
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededBuild metricspage load bundle size
History
To update your PR or re-run it, just comment with: |
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.
* remove advanced json for count agg * Remove only advanced json from count agg * use Constant from data plugin * add the logic to data plugin * remove json arg from function definition * remove unecessary translations Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…s-for-710 * 'master' of github.com:elastic/kibana: (43 commits) [APM] Chart units don't update when toggling the chart legends (elastic#74931) [ILM] Add support for frozen phase in UI (elastic#75968) Hides advanced json for count metric (elastic#74636) add client-side feature usage API (elastic#75486) [Maps] add drilldown support map embeddable (elastic#75598) [Enterprise Search] Request handler refactors/enhancements + update existing routes to use shared handler (elastic#76106) [Resolver] model `location.search` in redux (elastic#76140) [APM] Prevent imports of public in server code (elastic#75979) fix eslint issue skip flaky suite (elastic#76223) [APM] Transaction duration anomaly alerting integration (elastic#75719) [Transforms] Avoid using "Are you sure" (elastic#75932) [Security Solution][Exceptions] - Fix bug of alerts not updating after closure from exceptions modal (elastic#76145) [plugin-helpers] improve 3rd party KP plugin support (elastic#75019) [docs/getting-started] link to yarn v1 specifically (elastic#76169) [Security_Solution][Resolver] Resolver loading and error state (elastic#75600) Fixes App Search documentation links (elastic#76133) Fix alerts unable to create / update when the name has trailing whitepace(s) (elastic#76079) [Resolver] Fix useSelector usage (elastic#76129) [Enterprise Search] Migrate util and components from ent-search (elastic#76051) ... # Conflicts: # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/data_tier_allocation/node_allocation.tsx # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx # x-pack/plugins/index_lifecycle_management/public/application/services/policies/types.ts # x-pack/plugins/index_lifecycle_management/public/application/services/policies/warm_phase.ts
* remove advanced json for count agg * Remove only advanced json from count agg * use Constant from data plugin * add the logic to data plugin * remove json arg from function definition * remove unecessary translations Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Closes #74241
We want to hide the advanced json input when the user selects the Count aggregation as it can't affect this specific aggregation.
Checklist