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

[Logs UI] Replace deprecated getInjectedVar with NP spaces API #74280

Merged
merged 4 commits into from
Aug 6, 2020

Conversation

weltenwort
Copy link
Member

Summary

This replaces the use of getInjectedVar() in order to access the active space's id with getActiveSpace() from the spaces plugin. It introduces some crude guard against the new asynchronous availability of the id which differs from the previous, synchronous availability.

closes #68142

@weltenwort weltenwort added v8.0.0 Feature:Logs UI Logs UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v7.10.0 labels Aug 4, 2020
@weltenwort weltenwort added this to the Logs UI 7.10 milestone Aug 4, 2020
@weltenwort weltenwort self-assigned this Aug 4, 2020

export type PluginKibanaContextValue = CoreStart & InfraClientStartDeps;

export const createKibanaContextForPlugin = (core: CoreStart, pluginsStart: InfraClientStartDeps) =>
Copy link
Member Author

Choose a reason for hiding this comment

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

ℹ️ This in combination with the useKibanaContextForPlugin() hook below aims at providing a typed Kibana context value as recommended by the kibana_react plugin.

import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
import {
import type { CoreSetup, CoreStart, Plugin as PluginClass } from 'kibana/public';
Copy link
Member Author

@weltenwort weltenwort Aug 4, 2020

Choose a reason for hiding this comment

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

ℹ️ These explicit type imports just try to make sure we don't accidentally pull runtime code into the eagerly loaded entry point bundle.

@weltenwort weltenwort marked this pull request as ready for review August 5, 2020 09:31
@weltenwort weltenwort requested a review from a team as a code owner August 5, 2020 09:31
@elasticmachine
Copy link
Contributor

Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui)

@weltenwort weltenwort added the release_note:skip Skip the PR/issue when compiling release notes label Aug 5, 2020
@Kerry350 Kerry350 self-requested a review August 6, 2020 09:08
Copy link
Contributor

@Kerry350 Kerry350 left a comment

Choose a reason for hiding this comment

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

LGTM, works as expected 🎉


// This is a rather crude way of guarding the dependent providers against
// arguments that are only made available asynchronously. Ideally, we'd use
// React concurrent mode and Suspense in oder to handle that more gracefully.
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed 👍 (Nit: there's a small typo in the comment with oder)

@weltenwort
Copy link
Member Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
infra 1056 +1 1055

async chunks size

id value diff baseline
infra 3.5MB +4.0KB 3.5MB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@weltenwort weltenwort merged commit 152f41c into elastic:master Aug 6, 2020
weltenwort added a commit that referenced this pull request Aug 6, 2020
… (#74517)

* Replace getInjectedVar() with NP spaces API

* Fix typo in comment

* Fix typo in comment

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@weltenwort weltenwort mentioned this pull request Aug 6, 2020
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Logs UI Logs UI feature release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Logs App] Use new getActiveSpace function, abandon getInjectedVar()
4 participants