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] Remove any types and references to Hapi #49250

Merged

Conversation

tsullivan
Copy link
Member

Summary

Follow along #48825 in migrating Reporting to the Kibana new platform.

  1. Find several any types and replace them with the typed correction

Release Notes: Changes to prepare Reporting for Kibana v8.0.0

Checklist

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

@tsullivan tsullivan force-pushed the reporting/new-platform-shim-part-iii branch from f779325 to 470c47f Compare October 24, 2019 21:05
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

interface AvailableTotal {
export interface AvailableTotal {
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 change doesn't seem to fix any problems, but I am not sure how this works without the export. Another file imports this interface!

@elasticmachine

This comment has been minimized.

@tsullivan tsullivan added (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:enhancement Team:Stack Services v7.6.0 v8.0.0 labels Oct 25, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-stack-services (Team:Stack Services)

Copy link
Contributor

@joelgriffith joelgriffith left a comment

Choose a reason for hiding this comment

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

Really nice to see these types coming through, just a few follow ups/questions I had!

const workerFn = (job: JobSource, jobdoc: JobDocPayload | JobDoc, cancellationToken?: any) => {
const workerFn = (
job: JobSource,
arg1: JobDocPayload | JobDoc,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe:

arg1 => job
arg2 => cancelToken?

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 is not a great part of the code - without Typescript, some bad design problems were hidden.

The idea is "worker functions" can come from different export types, but one export type changes the idea about what a worker function could be, that's the "immediate" execute type, which is in CSV export from Panel Action and doesn't go through job queuing. It registers a worker function that has a different signature. It'll be great to figure this out better when ESQueue goes away :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to leave this as-is because the arguments don't have a single semantic meaning

@@ -5,15 +5,19 @@
*/

import crypto from 'crypto';
import { Logger } from '../../../types';
import { ServerFacade, Logger } from '../../../types';

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a tough one since it's setting and defaulting a config... I wonder if we can push this in our joi schema somehow?

EDIT: This was said with the thought that we should insulate ourselves from the server object as much as possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, it is tough because we could do more here to protect the environment from bad things happening. But giving them a made-up encryptionKey on the fly does help the first-time user experience.

switch (exportType.jobContentEncoding) {
case 'base64':
return Buffer.from(content, 'base64');
return content ? Buffer.from(content, 'base64') : content;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an interesting change, could you explain why we only do Buffer.from when it's defined (assuming the truthy check is for that)

Copy link
Member Author

Choose a reason for hiding this comment

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

It is because Buffer.from complains about null, so this may have been a bug hiding here.

@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@joelgriffith
Copy link
Contributor

Nice work! We'll need to figure out that encryption key stuff at some point, but save that for another PR

config.set('xpack.reporting.encryptionKey', crypto.randomBytes(16).toString('hex'));

// @ts-ignore: No set() method on KibanaConfig, just get() and has()
config.set('xpack.reporting.encryptionKey', crypto.randomBytes(16).toString('hex')); // update config in memory to contain a usable encryption key
Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, this part in particular might need a followup, if .set is not in the type because it is going away...

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@tsullivan tsullivan merged commit 08471cc into elastic:master Nov 14, 2019
@tsullivan tsullivan deleted the reporting/new-platform-shim-part-iii branch November 14, 2019 19:56
@tsullivan
Copy link
Member Author

Backporting to 7.x/7.6 depends on #50694 going in first

jloleysens added a commit to jloleysens/kibana that referenced this pull request Nov 15, 2019
…ger-ace-theme

* 'master' of github.com:elastic/kibana: (54 commits)
  [ML] Fixes word wrap in Overview page sidebar on IE (elastic#50668)
  Upgrade to TypeScript 3.7.2 (elastic#47188)
  fix: hide 'edit' button for mobile for dashboards (elastic#50639)
  fixes conditional links tests (elastic#50642)
  [SIEM] Fix IE11 timeline drag and drop issue (elastic#50528)
  [SIEM] Add SavedQuery in Timeline (elastic#49813)
  chore(NA): remove code plugin from codeowners (elastic#50451)
  [DOCS] Adds documentation on telemetry settings (elastic#50739)
  [Logs UI] Add IE11-specific CSS fixes for anomalies table (elastic#49980)
  [DOCS][SIEM]: Change Kibana advanced settings to match UI (elastic#50679)
  Change URLs for support menu (elastic#50700)
  [Reporting] Remove any types and references to Hapi (elastic#49250)
  [DOCS] Adds note about backups to Upgrade doc (elastic#50525)
  [Logs UI] Improve infra plugin compatibility with TS 3.7 (elastic#50491)
  [Task manager] Adds ensureScheduling api to allow safer rescheduling of existing tasks (elastic#50232)
  [DOCS] Adds link to content security policy doc (elastic#50698)
  Remove duplicate but in error message (elastic#50530)
  [ML] DF Analytics: Ensure creation flyout can be opened when no jobs exist (elastic#50417)
  Add filebeat notice (elastic#49065)
  [Monitoring] De-duplicate pipeline ids based on the ephemeral_id changing (elastic#49978)
  ...

# Conflicts:
#	x-pack/legacy/plugins/grokdebugger/public/components/grok_debugger/brace_imports.ts
@tsullivan
Copy link
Member Author

Backport: #50948

tsullivan added a commit to tsullivan/kibana that referenced this pull request Nov 18, 2019
* [Reporting] Remove any types and references to Hapi

* clarification comment

* fix import
tsullivan added a commit that referenced this pull request Nov 18, 2019
* [Reporting] Remove any types and references to Hapi

* clarification comment

* fix import
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 release_note:enhancement v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants