Skip to content
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

[InfraUI] Remove (to be deprecated) rest_total_hits_as_int parameter #30826

Merged

Conversation

Kerry350
Copy link
Contributor

@Kerry350 Kerry350 commented Feb 12, 2019

Summary

Addresses: #29435

Overview: Removes our use of the to be removed Elasticsearch rest_total_hits_as_int=true parameter.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

Change checkValidNode response parsing

Update type
@Kerry350 Kerry350 added review Feature:Metrics UI Metrics UI feature v8.0.0 Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services labels Feb 12, 2019
@Kerry350 Kerry350 self-assigned this Feb 12, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/infrastructure-ui

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@simianhacker simianhacker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.____     ________________________   
|    |   /  _____/\__    ___/     \  
|    |  /   \  ___  |    | /  \ /  \ 
|    |__\    \_\  \ |    |/    Y    \
|_______ \______  / |____|\____|__  /
        \/      \/                \/ 

I added one note but it's not required to merge. You can merge without it but I wanted to get your thoughts on the idea.

return (await search(params)).hits.total > 0;

const result = await search(params);
return result && result.hits && result.hits.total && result.hits.total.value > 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been struggling with things like this too where we need to grab a value off some deeply nested object that has optional parts all the way down 🐢. I wonder if we shouldn't just standardize on using Lodash get for things like this since we are only concerned with the value at the end of the path. That's was standard practice at one point in time for the Kibana team. I only started using the same pattern as you when I started with Typescript.

const result = await search(params)
const value = get(result, 'hits.total.value', 0);
return value > 0;

You don't need to make this change, unless you like it. Technically they are both the same so I will let you decide.

Copy link
Member

@weltenwort weltenwort Feb 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The APM team has implemented some typesafer getter pattern which we might want to copy: https://github.com/elastic/kibana/blob/master/x-pack/plugins/apm/common/idx.ts

example usage here:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should settle on something because personally I don't like typing result & result.total & result.total.value, I like editing it even less, especially when the structure changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed... the idx (which could be named better) has a few nice properties:

  • preserves the return type
  • auto-completion in the accessor
  • simple, local implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I agree it's annoying and if we can decide on a standardised solution (be it Lodash's get, APM's idx, or a tweaked custom function of our own) that'd be great. I'll merge this as is for now as it's managed to get a green build amid the CI issues. But I'll add an agenda issue for the next Infrastructure & Service Monitoring UI Sync meeting and we can decide which to use.

@Kerry350 Kerry350 merged commit 3b6409c into elastic:master Feb 13, 2019
skh added a commit to skh/kibana that referenced this pull request Apr 30, 2019
skh added a commit that referenced this pull request Apr 30, 2019
…35792)

* [Infra UI] Add new graphql endpoint for snapshot data (#34264)

* Add new graphql endpoint for snapshot data

* Polishing.

* Keep type generic that is used outside snapshots

* Keep one more generic type generic

* Use camelCase for consistency.

* Refine type names

* Add return types.

* Use idiomatic javascript.

* Factor out getAllCompositeAggregationData<T>()

* Refine naming.

* More idiomatic JavaScript, more types.

* Use pre-8.x response format (see also #30826)
@timroes timroes added the release_note:skip Skip the PR/issue when compiling release notes label Apr 26, 2021
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 30826 or prevent reminders by adding the backport:skip label.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 28, 2021
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 30826 or prevent reminders by adding the backport:skip label.

@weltenwort weltenwort added the backport:skip This commit does not require backporting label Apr 29, 2021
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Metrics UI Metrics UI feature release_note:skip Skip the PR/issue when compiling release notes review Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants