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

[Reporting/Migration] ReportingSetup, LegacySetup #54198

Merged

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Jan 7, 2020

Summary

This PR provides the plugin definition for the server-side of Reporting in terms of the core types of the Kibana new platform.

This takes migration progress to halfway through the migration guide. When this is merged, we will be ready for the "Switch to new platform services" section: https://github.com/elastic/kibana/blob/master/src/core/MIGRATION.md#switch-to-new-platform-services

#53898

@tsullivan tsullivan mentioned this pull request Jan 7, 2020
19 tasks
@tsullivan tsullivan force-pushed the reporting/server-plugin-definition branch 5 times, most recently from 565dd95 to 1c68276 Compare January 14, 2020 22:02
@tsullivan tsullivan force-pushed the reporting/server-plugin-definition branch from 1c68276 to 89f421d Compare January 16, 2020 16:55
@tsullivan tsullivan force-pushed the reporting/server-plugin-definition branch from 89f421d to 2b8a8b2 Compare January 16, 2020 22:23
@tsullivan tsullivan added Feature:NP Migration (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Team:Reporting Services v7.7.0 v8.0.0 labels Jan 16, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-reporting-services (Team:Reporting Services)

@tsullivan tsullivan marked this pull request as ready for review January 16, 2020 22:25
* implementation itself restricts against having Legacy dependencies passed
* into `setup`. The factory parameters take the legacy dependencies, and the
* `setup` method gets it from enclosure */
export function reportingPluginFactory(
Copy link
Member Author

@tsullivan tsullivan Jan 16, 2020

Choose a reason for hiding this comment

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

I made this factory function to accept parameters that can not directly be passed into the ReportingPlugin constructor and setup method.

I had to come up with this solution, because the guidance from the Migration guide had outdated info:

/* this is not possible if the Plugin class extends the core plugin class:
 * the setup method doesn't accept a 3rd parameter */ 
const demoSetup = new Plugin().setup(coreSetup, pluginsSetup, __LEGACY); 

cc @rudolf @pgayvallet

Copy link
Contributor

Choose a reason for hiding this comment

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

We could make this type more permissive:

interface Plugin<...> {
  setup(core: CoreSetup, plugins: TPluginsSetup, ...args: any[]): MaybePromise<TSetup>;
  /* ... */
}

Copy link
Contributor

Choose a reason for hiding this comment

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

(sorry, I'm a little late) I'm not a big fan of 'poluting' the Plugin interface, as the additional parameters will not be able to actually be injected/used once the plugin is migrated and core actually instantiate the plugin.

Maybe we could instead introduce a sub-interface for the migration period,

interface ShimedPlugin<
  TSetup = void,
  TStart = void,
  TPluginsSetup extends object = object,
  TPluginsStart extends object = object,
  TLegacySetupDeps extends object = object
> extends Plugin<TSetup, TStart, TPluginsSetup, TPluginsStart> {
  setup(
    core: CoreSetup,
    plugins: TPluginsSetup,
    legacy: TLegacySetupDeps
  ): TSetup | Promise<TSetup>;
}

@tsullivan The factory is a workaround that will do just fine however. Sorry for the outdated documentation

@tsullivan tsullivan added the release_note:skip Skip the PR/issue when compiling release notes label Jan 17, 2020
@tsullivan tsullivan requested review from joelgriffith and a team January 17, 2020 17:40
import { registerReportingUsageCollector } from './usage';
import { logConfiguration } from '../log_configuration';

// For now there is no exposed functionality to other plugins
Copy link
Member Author

Choose a reason for hiding this comment

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

In the near future, we will expose functionality to other plugins so they have an API to schedule reports of their data visualizations / CSV exports

@joelgriffith
Copy link
Contributor

https://github.com/elastic/kibana/pull/54198/files#r367683017 is interesting, otherwise LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@tsullivan tsullivan merged commit 2598d15 into elastic:master Jan 18, 2020
@tsullivan tsullivan deleted the reporting/server-plugin-definition branch January 18, 2020 04:47
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 20, 2020
* upstream/master: (24 commits)
  Show error page when accessing unavailable app (elastic#54656)
  [ML] Improving job wizards with datafeed aggregations (elastic#55180)
  remove flaly assetion. a license presence tested anyway (elastic#55289)
  fix commonly used ranges uptime (elastic#54930)
  [SIEM] Use proper icons on Detections view (elastic#55215)
  Fix: invalid translation referenced (elastic#54901)
  [State Management] Remove AppState from edit_index_pattern page (elastic#54104)
  Implements `getStartServices` on server-side (elastic#55156)
  Move vis_vega_type/data_model tests to jest (elastic#55186)
  [SIEM] [Detection Engine] Update status on rule details page (elastic#55201)
  Fix KQL value suggestions for nested fields (elastic#54820)
  Enforce camelCase format for a plugin id (elastic#53759)
  [SIEM] Detection engine cleanup for rule details/creation/edit page (elastic#55069)
  Remove nested root from index pattern (elastic#54978)
  [Reporting/Migration] ReportingSetup, LegacySetup (elastic#54198)
  [SIEM] [Detection Engine] Fixes duplicate rule action (elastic#55252)
  [SIEM] Detections add alert & signal tab (elastic#55127)
  Management API - redirect on disabled app path (elastic#55136)
  [SIEM][Detection Engine] Fixes critical regression on the backend with immutable and tags
  update local (elastic#55177)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 20, 2020
* master: (108 commits)
  [ML] Single Metric Viewer: Fix job check. (elastic#55191)
  Show error page when accessing unavailable app (elastic#54656)
  [ML] Improving job wizards with datafeed aggregations (elastic#55180)
  remove flaly assetion. a license presence tested anyway (elastic#55289)
  fix commonly used ranges uptime (elastic#54930)
  [SIEM] Use proper icons on Detections view (elastic#55215)
  Fix: invalid translation referenced (elastic#54901)
  [State Management] Remove AppState from edit_index_pattern page (elastic#54104)
  Implements `getStartServices` on server-side (elastic#55156)
  Move vis_vega_type/data_model tests to jest (elastic#55186)
  [SIEM] [Detection Engine] Update status on rule details page (elastic#55201)
  Fix KQL value suggestions for nested fields (elastic#54820)
  Enforce camelCase format for a plugin id (elastic#53759)
  [SIEM] Detection engine cleanup for rule details/creation/edit page (elastic#55069)
  Remove nested root from index pattern (elastic#54978)
  [Reporting/Migration] ReportingSetup, LegacySetup (elastic#54198)
  [SIEM] [Detection Engine] Fixes duplicate rule action (elastic#55252)
  [SIEM] Detections add alert & signal tab (elastic#55127)
  Management API - redirect on disabled app path (elastic#55136)
  [SIEM][Detection Engine] Fixes critical regression on the backend with immutable and tags
  ...
tsullivan added a commit to tsullivan/kibana that referenced this pull request Jan 21, 2020
@tsullivan
Copy link
Member Author

backport: #55441

tsullivan added a commit that referenced this pull request Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants