Commit graph

7381 commits

Author SHA1 Message Date
Angela Chuang e97b451cc1
[SIEM] add custom reputation link (#57814)
* add custom reputation link

* fix unit test

* add number of limitation to reputation links

* fix dependency

* apply defaultFieldRendererOverflow to reputation link

* fix unit test

* fix url template

* fix display links

* fix types

* fix for review

* update test case

* update snapshot

* add icons and tooltips

* fix style

* update test

* add external link component

* update test

* fix types

* fix style

* update snapshot

* remove useMemo

* update description

* code review

* review II

* code review

* update description

* fix unit test

* fix unit test

* fix unit test

* fix unit test

* fix types

* fix styles

* fix style

* fix style

* fix review

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-26 16:42:15 +00:00
Chris Cowan 8021fd887a
[Metrics UI] Custom Metrics for Inventory View (#58072)
* [Metrics UI] Add custom metrics interface to Inventory View

* WIP

* Adding workflows for editing custom metrics

* Polishing visual design

* Removing extra text

* Fixing types and return values

* fixing i18n

* Adding aria labels for clearity

* Changing custom group by to match same width as custom metric

* updating integration test for custom metrics

* Fixing type def
2020-02-26 09:36:43 -07:00
Pete Harverson 32fb5c1532
[ML] Fixes creation of a watch for an anomaly detection job (#58597) 2020-02-26 16:30:10 +00:00
Nathan Reese 3212754e62
[Maps] add Top term aggregation (#57875)
* [Maps] add Top term aggregation

* update pew-pew source to handle terms agg

* make helper function for pulling values from bucket

* update terms source

* better join labels

* categoricla meta

* remove unused constant

* remove unused changes

* remove unused constant METRIC_SCHEMA_CONFIG

* update jest expect

* fix auto complete suggestions for top term

* get category autocomplete working with style props from joins

* pluck categorical style meta with real field name

* mock MetricsEditor to fix jest test

* review feedback

* es_agg_utils.js to es_agg_utils.ts

* typing updates

* use composit agg to avoid search.buckets limit

* i18n update and functional test fix

* stop paging through results when request is aborted

* remove unused file

* do not use composite agg when no terms sub-aggregations

* clean up

* pass indexPattern to getValueAggsDsl

* review feedback

* more review feedback

* ts-ignore for untyped imports in tests

* more review feedback

* add bucket.hasOwnProperty check

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-26 07:50:11 -07:00
Nathan L Smith 2ea4bdfe0d
Server-side license check for APM service map (#58547)
* Factor our the license checking logic and messaging to common
* Add licensing plugin as a dependency of the APM plugin
* Throw a forbidden error on the server if trying to access the service map routes
2020-02-26 07:14:08 -06:00
Joe Reuter dfcd4d1e93
Functional tests: Fix saved object management button click retry (#58218) 2020-02-26 11:34:11 +01:00
Pierre Gayvallet a4e82c4e6d
Adapt es-archiver to call _migrate endpoint instead of creating a migrator (#56971)
* es-archiver call _migrate endpoint instead of creating a migrator

* fix crlf....

* use promise instead of callback accessor

* attempt with disabled authent

* enable security again

* set mapping to dynamic before calling migration endpoint

* rename space data from non-spaced tests

* add documentation on the `rerun` flag

* create router with the `/api/saved_objects` prefix

* add unit test about strict mapping

* add integration test on migrate endpoint

* wrap route handler with handleLegacyErrors

* add remark about limitations of the rerun flag

* Apply suggestions from code review

Co-Authored-By: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* do not return detailed index result

* add access tag to migrate route

* use /internal prefix for migrate endpoint

* fix integ tests

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Josh Dover <me@joshdover.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
2020-02-26 10:39:16 +01:00
James Gowdy 71254de3c2
[ML] Adding get records endpoint wrapper (#58500) 2020-02-26 09:21:32 +00:00
Søren Louv-Jansen 0e0f114d03
[APM] Improve debug output (#58467) 2020-02-26 07:40:06 +01:00
Xavier Mouligneau b56eead4ac
[SIEM] [Detections] Refactor the all rules page (#58428)
* Refactor the all rules page to be easier to test

* review with Garrett

* bring back utility bar under condition

* fix bugs tags and allow switch to show loading when enable/disable rule

* fix rules selection when trigerring new rules

* fix imports/exports can only use rule_id as learned today

* review I
2020-02-25 21:59:44 -05:00
Mike Côté 24b8ecf74d
Add localization to missing action types (#58554) 2020-02-25 21:47:53 -05:00
Mike Côté 29439789ab
Add migration support to the event log (#58010)
* Initial work

* Add missing file

* Add tests where missing

* Add kibana version to esNames

* Share ILM policy across versions
2020-02-25 18:18:27 -05:00
Lukas Olson ef80ebf1bb
[Search service] Add async search strategy (#53057)
* Add async search strategy

* Add async search

* Fix async strategy and add tests

* Move types to separate file

* Revert changes to demo search

* Update demo search strategy to use async

* Add cancellation to search strategies

* Add tests

* Simplify async search strategy

* Move loadingCount to search strategy

* Update abort controller library

* Bootstrap

* Abort when the request is aborted

* Add utility and update value suggestions route

* Fix bad merge conflict

* Update tests

* Move to data_enhanced plugin

* Remove bad merge

* Revert switching abort controller libraries

* Revert package.json in lib

* Move to previous abort controller

* Fix test to use fake timers to run debounced handlers

* Revert changes to example plugin

* Fix loading bar not going away when cancelling

* Call getSearchStrategy instead of passing  directly

* Add async demo search strategy

* Fix error with setting state

* Update how aborting works

* Fix type checks

* Add test for loading count

* Attempt to fix broken example test

* Revert changes to test

* Fix test

* Update name to camelCase

* Fix failing test

* Don't require data_enhanced in example plugin

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 15:57:40 -07:00
Andrew Cholakian 87f6cd1152
[Uptime] Show only total in snapshot heading (#58376)
This fixes a number of design issues. Fixes https://github.com/elastic/kibana/issues/58372
2020-02-25 16:40:06 -06:00
Ryland Herrick 2501919a8a
Remove support of HEAD request in signals index route (#58489)
Until these are officially supported in new platform, it's best to not
rely on this behavior. We can achieve roughly the same functionality
with a GET request. Modifies the existing script accordingly, in case
anyone's still using it.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 15:33:49 -06:00
Larry Gregory ca5fb7fb01
Use links instead of click handlers when switching spaces (#57730)
* use links instead of click handlers when switching spaces

* remove unused imports

* remove use of deprecated injectedMetadata service

* simplify SpacesManager constructor

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 15:56:28 -05:00
Thomas Neirynck d9e3d744ba
[Maps] Add EPSG-code to docs (#58378) 2020-02-25 14:21:25 -05:00
Nathan Reese 30fb4eb694
[Maps] remove duplicated pagintation text in locked tooltips (#58383) 2020-02-25 11:50:54 -07:00
James Gowdy d50031e721
[ML] Global calendars (#57890)
* [ML] Global calendars

* updating snapshots

* changes based on review

* larger spacer

* updating jest snapshot
2020-02-25 18:02:40 +00:00
Anton Dosov 93556a9bdd
Visualizations plugin np_ready (#57983)
Partially addresses #50897

updates visualizations plugin

makes visualizations/saved_visualizations np_ready
makes visualizations/embeddable np_ready
remove DefaultVisEditor dependency from visualizations
import AggConfigs directly instead of ui/public
Clean up imports from root. use relative imports
Remove bind directive import
2020-02-25 18:31:24 +01:00
Vadim Dalecky 120f03dc06
Add <FormCreateDrilldown> component (#58335)
* refactor: 💡 use .story for Storybook and standartize dir struct

* feat: 🎸 add <FlyoutFrame> component

* feat: 🎸 add <FlyoutCreateDrilldown> component

* refactor: 💡 improve FlyoutCreateDrilldownAction

* test: 💍 add <FlyoutFrame> tests

* docs: ✏️ add @todo for <DrilldownHelloBar>

* feat: 🎸 make name editable in <FormCreateDrilldown>

* test: 💍 add <FormCreateDrilldown> name field tests

* chore: 🤖 change drilldown translation keys
2020-02-25 18:02:25 +01:00
MadameSheema 712c0851a7
[SIEM] Deletes duplicated tests (#58453)
* deletes duplicated test

* deletes duplicated fields browser test
2020-02-25 17:15:31 +01:00
MadameSheema 21d98d787e
skips 'ResizeObserver loop limit exceeded' error (#58465) 2020-02-25 17:10:18 +01:00
Kerry Gallagher b17aa35513
[Logs / Metrics UI] Handle index.scss (#58219)
* Ensure our index.scss file is handled
2020-02-25 15:28:41 +00:00
Devin W. Hurley 10bf90f9f5
[SIEM] [Detection Engine] Increase unit test coverage (#58274)
* updates read privileges route tests

* fixes test for 404 when alertsClient is not present, adds new test for catching errors at the route level for prepackaged rules route

* fixes test for happy path on create rules bulk route (missing mock resulted in 200, but was still throwing an error), adds tests for covering case where a rule with a matching rule id is found to have already existed, adds a test covering the case where createRules throws an error and that error is caught in the catch block, and appears in the response

* adds more jest functions to beforeEach to ensure mockImplementation state used by spyOn is not carried over between tests, increases test coverage for create rules route

* updates unit test coverage for delete rules route and bulk delete

* increase unit test coverage for find_rules_route

* add test case to get_prepackaged_rules where findRules throws an error

* adds unit test for missing alertsClient in patch_rules_bulk route

* adds unit test coverage for transform error and pathRules throwing an error on patch rules route

* adds unit test coverage for rule not found, transform error, and readRules throws an error on read_rules_route

* adds unit test coverage for update rules (bulk) routes

* increases unit test coverage for open close signals route

* updates coverage for signals query route

* adds unit tests for rules status route, updates utils test coverage. Removed unreachable code.

* updates test coverage, removes usage of pipes from ndjson to stream conversion and returns arrays of tranformers to be used in createPromiseFromStreams so that unhandled promise rejections can be handled appropriately.

* fixes type errors

* fix bug on transform when rulestatus saved objects array is empty because we are no longer passing in the current status, we are passing in the whole saved object.

* adds unit test for when readRules throws an error inside of get export by object ids

* adds unit tests for catching errors on read rules and fixes property undefined bug in catch block

* removes unused function from utils

* adds the 'else' clause back to the getTupleDuplicateErrorsAndUniqueRules function and adds a test case for when an attempt to import rules with missing ruleIds is made, and the expected outcome.
2020-02-25 09:34:53 -05:00
Jean-Louis Leysens 899270a108
[Upgrade Assistant] Move out of legacy folder (#58034)
* Create x-pack/plugins skeleton for upgrade assistant

* Move public folder contents

Move the public folder of Upgrade Assistant and migrate public to use HttpSetup (remove axios)

* Include stylesheets in public

* Move server side out of legacy

Begin migration of Reindex worker to new platform

Move imports around so that it satsifies new platform constraints like not importing
server side code (even types) in client.

* Updated the routes with new dependencies and removed server shim

* Fix router unit tests

* Fix server lib tests

After changing function signatures for the reindex server factory (and others) all
of the tests needed to be revisited and brought in line with the new APIs.

Also used core/server mocks where appropriate

* Clean up types issues

* Fix setting credentials on request header

* Removed the security plugin from Upgrade Assistant

The security plugin is a potential future consumer of the Upgrade Assistant's deprecation feature
and we would therefore not want to create a circular depedency here. We pull in the licensing plugin
rather (as it is less likely that we will depend on that) and use it to determine whether security
is available and enabled.

* Migrate to config to new platform config

xpack.upgrade_assistant.enabled

* Remove unused types

* Fix import issue

* Move upgrade assistant back to Elasticsearch management section

* Update dotfiles

Added elasticsearch ui team as upgrade assistant code owner
Updated i18nrc.json path

* Alphabetical ordering in xpack/i18nrc.json

* Implemented PR feedback

Renamed callCluster -> callAsUser to be more consistent
with platform naming.

Added comment about why we are not using security plugin
directly inside of Upgrade Assistant.

Fixed long path imports and use 'src/core/..' throughout.

Fixed import ordering.

Renamed variables inside of telemetry lib.

* Revert to longer import path

In plugin.ts importing from 'kibana/server' or 'src/core/server'
results in a module not found error.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 15:31:04 +01:00
Justin Kambic d339740c2d
[Uptime] Migrate server to new platform (#53939)
* Move uptime legacy server to plugins directory.

* Re-add feature registration code.

* Move feature registration back to kibana bootstrap file.

* Delete obsolete test file.

* Remove i18n call from untracked file.

* Implement feedback.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 09:27:18 -05:00
patrykkopycinski 418c44a47e
[SIEM] Fix unnecessary re-renders on the Overview page (#56587) 2020-02-25 15:00:50 +01:00
Nathan L Smith afb5d8fa58
Fix service map popover transaction duration (#58422)
It's already microseconds, so not converting it fixes it.

Checked services to see if all metrics match now and they do!

Fixes #55679
2020-02-25 07:43:46 -06:00
James Gowdy b756cc3915
[ML] Adding filebeat config to file dataviz (#58152)
* [ML] Adding filebeat config to file dataviz

* adding extra help text

* removing commented out code

* adding extra blank line to processors section

* cleaning up types

* moving hosts line out of function

* typo in config text

* updating config based on review

* tiny refactor

* translating paths text
2020-02-25 13:39:50 +00:00
Andrew Cholakian 71d6c22114
[Uptime] Improve refresh handling when generating test data (#58285)
When generating test data we refresh excessively, this can fill up the
ES queues and break the tests if we run massive tests. I originally ran
into this with https://github.com/elastic/kibana/pull/58078/ which I
closed due to finding a better approach.

While none of our current tests have the scale to expose this problem,
we certainly will add tests that do later, so we should keep this
change.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 07:18:04 -06:00
Alejandro Fernández db276d1894
[Logs / Metrics UI] Remove path prefix from ViewSourceConfigur… (#58238)
In the NP the routes have already the app name on them. Adding it to
this button made the app name double

    /app/metrics/metrics/settings
    /app/logs/logs/settings

The button only needs to go to the settings page within the app where
it's being loaded, so we can safely drop the prefix.

Closes #58233
2020-02-25 13:39:13 +01:00
Robert Oskamp 6fc6cb8b36
[ML] Functional tests - adjust classification model memory (#58445)
This PR increases the model memory setting in the classification creation test.
2020-02-25 13:22:29 +01:00
David Roberts 31cc2015b7
[ML] Use event.timezone instead of beat.timezone in file upload (#58447)
This is because beat.timezone was renamed to event.timezone in
elastic/beats#9458

The corresponding file structure finder change is
elastic/elasticsearch#52720
2020-02-25 12:18:35 +00:00
Felix Stürmer 900a8290fb
[Logs UI] Unskip and stabilitize log column configuration tests (#58392)
This attempts to make the log column configuration tests more robust to inconsistent DOM and interaction timing.

fixes #58059
2020-02-25 11:52:37 +01:00
Alejandro Fernández Haro 506268c926
[Telemetry] Separate the license retrieval from the stats in the usage collectors (#57332)
* [Telemetry] Merge OSS and XPack usage collectors

* Create X-Pack collector again

* Separate the license retrieval from the stats

* Fix telemetry tests with new fields

* Use Promise.all to retrieve license and stats at the same time

* Fix moment mock

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 10:31:35 +00:00
Joe Reuter 5910e83722
hide welcome screen for cloud (#58371) 2020-02-25 11:27:25 +01:00
Maryia Lapata 737205fb9b
Move src/legacy/ui/public/notify/app_redirect to kibana_legacy (#58127)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 13:19:02 +03:00
Robert Oskamp 1a96ff3c30
[ML] Functional tests - stabilize typing during df analytics creation (#58227)
This PR makes the typing in data frame analytics tests more robust.
2020-02-25 11:00:10 +01:00
MadameSheema 1a15d3ae83
[SIEM] Upgrades cypress to version 4.0.2 (#58400)
* upgrades cypress to version 4.0.2

* fixes failing tests
2020-02-25 09:05:22 +01:00
Sébastien Loix 277b38079e
[Index management] Move to new platform "plugins" folder (#58109) 2020-02-25 13:12:27 +05:30
Justin Kambic a00ebc6f18
[Uptime] Delete useless try...catch blocks (#58263)
* Delete useless try...catch blocks.

* Delete unneeded function.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-24 18:44:52 -05:00
Andrew Cholakian 5eefdbb842
[Uptime] Use scripted metric for snapshot calculation (#58247) (#58389)
Fixes #58079

This is an improved version of #58078

Note, this is a bugfix targeting 7.6.1 . I've decided to open this PR directly against 7.6 in the interest of time. We can forward-port this to 7.x / master later.

This patch improves the handling of timespans with snapshot counts. This feature originally worked, but suffered a regression when we increased the default timespan in the query context to 5m. This means that without this patch the counts you get are the maximum total number of monitors that were down over the past 5m, which is not really that useful.

We now use a scripted metric to always count precisely the number of up/down monitors. On my box this could process 400k summary docs in ~600ms. This should scale as shards are added.

I attempted to keep memory usage relatively slow by using simple maps of strings.
2020-02-24 16:46:58 -06:00
Søren Louv-Jansen 13eacb51f0
[APM] Stabilize agent configuration API (#57767) 2020-02-24 23:43:40 +01:00
Lukas Olson 7e087633d2
Remove unused indexPattern:fieldMapping:lookBack advanced setting (#58147)
* Remove unused indexPattern:fieldMapping:lookBack advanced setting

* Remove unused translations

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-24 14:44:03 -07:00
Brandon Kobel 77fe83e7db
Remove restriction that route must start with /api to use api authorization (#58351)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-24 13:04:30 -08:00
Maggie Ghamry 858fe2e925
[Canvas] Toggles footer editable controls when you turn off edit mode #52786 (#58044)
* Bug fix update

update to toggle footer edit controls "off" when locking edit controls.

* Update to toggle

Update to toggle, so that only the "Expression Editor" and tray are hidden when locking controls.

* Update to toggle logic

Added canUserWrite property, and added a condition to ensure the "page" tray still shows once the Expression editor is locked

* Update to property definition

Update to consolidate isWriteable and canUserWrite into one variable instead of two.

* Adding Test (in progress) code

Adding Toolbar test code (so far) - needs to be completed to address nested compononet storybook issue

* Adding issue link

Adding issue link in TODO comments

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-24 14:44:18 -05:00
Nathan L Smith 7bec52a964
Show blank lines instead of N/A on service map popovers (#57014)
* Show blank lines instead of N/A on service map popovers

Because RUM agents never show CPU or memory usage, we don't want to always show the metric with N/A. If a metric is null, just hide the lines.

Break up the display and fetching components and update the popover stories to show the list.

Update some types.

* Fix metric typings
2020-02-24 13:24:46 -06:00
Jen Huang 12f35d5788
Add ingest manager header component (#58300)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-24 10:23:44 -08:00
Walter Rafelsberger b88b99140b
[ML] Fix transforms license check. (#58343)
Fixes an error where the transforms page would load blank with an expired license. Fixes the issue by adding a type guard. With an expired license, the page now renders again correctly the error message.
2020-02-24 18:44:24 +01:00
Marta Bondyra c6f5fdd061
Advanced settings UI change to centralize save state (#53693) 2020-02-24 17:42:34 +01:00
Melissa Alvarez 6b735c9ca0
[ML] New Platform server shim: update usage collector to use core savedObjects (#58058)
*  use NP savedObjects and createInternalRepository for usage collection

* fix route doc typo

* update MlTelemetrySavedObject type

* remove fileDataVisualizer routes dependency on legacy es plugin

* update mlTelemetry tests

* remove deprecated use of getSavedObjectsClient
2020-02-24 11:17:29 -05:00
Steph Milovic 98aa1d2d4f
[SIEM] [Case] Enable case by default. Snake to camel on UI (#57936) 2020-02-22 07:29:44 -07:00
Aaron Caldwell 9c8c47befb
[File upload] Update remaining File Upload dependencies for NP migration (#58128)
* Remove old route ref, no longer used

* Use core elasticsearch service

* Remove getSavedObjectsRepository, use NP internalRepository

* Update tests and clean up

* Remove unused test vars
2020-02-21 16:37:39 -07:00
Caroline Horn 5fefb76a26
Use EuiTokens for ES field types (#57911)
* [FieldIcon] Refactor to extend EuiToken and props

* [Add to FieldIcon] Export props

* [Graph] Updated instances of FieldIcon

* [Maps] Update FieldIcon instance

* [Lens] Update FieldIcon usage


* [Discover] Update FieldIcon usage


* Remove comment

* [Lens] Delete unused files

* [Graph] Fix alignments

* More cleanup

* Fixing snaps

* [Lens] Removing method `getColorForDataType`

The method no longer returns the correct color and EuiProgress doesn’t currently support all the colors from the token map. @cchaos will follow up with a PR to address the coloring of the field data charts. Right now they will fallback to pink for progress and default for charts.

* [Maps] Fixing implementations of FieldIcon

* [Graph] Using css utility class instead of custom class

* Snap

* Fix css to use var
2020-02-21 18:28:53 -05:00
Yuliia Naumenko 1eb0176036
Added UI support for the default action group for Alert Type Model (#57603)
* Added UI support for the default action group for Alert Type Model

* Fixed set default on  alert type select

* Fixed type check

* Moved setting of default alert type to the server api

* Added default value for actionGroups if it is empty in register alert type functions

* Fixed type check

* Fixed due to comments	aed89377b9	Yuliia Naumenko <yuliia.naumenko@elastic.com>	Feb 20, 2020 at 12:40 PM

* Renamed defaultActionGroup to defaultActionGroupId

* Fixed failing tests
2020-02-21 13:58:54 -08:00
Mikhail Shustov d61ef267d5
force savedObject API consumers to define SO type explicitly (#58022)
* force savedObject consumers to define type explicitly

* address comments

* regen docs
2020-02-21 22:11:05 +01:00
Robert Austin 02efb01c48
[Endpoint] Add a flyout to alert list. (#57926)
* Filter alert API so it shows only Alerts instead of all documents in the index
* Clicking an item in the alert list will open a flyout
2020-02-21 14:44:02 -05:00
Aaron Caldwell cca7555c4b
Make sure index pattern has fields before parsing (#58242) 2020-02-21 12:41:35 -07:00
Corey Robertson 0adfdcafe1
Sanitize workpad before sending to API (#57704)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-21 12:16:22 -05:00
Dima Arnautov 3d9eb2a679
[ML] Transform: Support multi-line JSON notation in advanced editor (#58015)
* [ML] use xJsonMode

* [ML] remove commented code

* [ML] move use_x_json_mode hook, disable json formatting

* [ML] mocks for shared_imports

* [ML] ts-ignore worker import
2020-02-21 17:45:42 +01:00
Charlie Pichette fb04b7afb4
[Endpoint] Refactor Management List Tests (#58148)
* endpoint-161-refactor-management-list-test

* fix location of es archive file
2020-02-21 11:44:57 -05:00
Brandon Kobel c91b6ceebc
Updating to @elastic/lodash@3.10.1-kibana4 (#54662)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-21 07:27:40 -08:00
Walter Rafelsberger 96000fa425
[ML] Transforms: Adds clone feature to transforms list. (#57837)
Adds a Clone action to the transform management list. The action opens the transform wizard with prepopulated configurations based on the selected transform. The fields for the transform name and target index will not be populated to avoid the obvious "already exists" warnings.
2020-02-21 15:31:56 +01:00
Melissa Alvarez fe932fce6e
[ML] New Platform server shim: update fields service routes (#58060)
* update fieldsService routes to use NP router

* fix file name typo

* add routes names for docs
2020-02-21 09:27:25 -05:00
nnamdifrankie 2aa359a650
[Endpoint] EMT-184: change endpoints to metadata up and down the code base. (#58038)
[Endpoint] EMT-184: change endpoints to metadata up and down the code base.
2020-02-21 08:15:48 -05:00
MadameSheema 61e35eab81
[SIEM] Cleans Cypress tests code (#58134)
* deletes 'events viewer' lib

* deletes 'fields browser' lib

* deletes 'inspect' lib

* deletes 'ml conditional links' lib

* deletes 'navigate' lib

* delete 'overview' lib

* deletes 'pagination' lib

* deletes 'timeline' lib

* deletes 'url state' lib

* deletes the rest of lib folders

* reorders tasks and screens

* reorders 'integration' folder

* orders integration files

* extracts defeault timeout to cypress configuration

* orders screens files

* cleans tasks files

* fixes type check
2020-02-21 09:10:34 +01:00
Ryland Herrick 2121b8c1b2
Prevent core savedObjects plugin from being overridden (#58193)
PR #57452 added an empty savedObjects plugin with the same name as the
core plugin. Due to the way we were spreading into our context coupled
with the fact that we don't get NP's whitelisting of plugins on legacy,
we were overriding the core plugin here.

If this happens again, we should perhaps whitelist our plugins here.
2020-02-20 20:08:55 -06:00
Josh Dover 5238493381
Expose serverBasePath on client-side (#58070) 2020-02-20 14:43:15 -07:00
Vadim Dalecky 4cd809aa7d
Drilldown plugin (#58097)
* feat: 🎸 add <PanelOptionsMenu> component

* feat: 🎸 use presentational <PanelOptionsMenu> component

* feat: 🎸 create stubs for Drilldown components

* feat: 🎸 open new drilldown flyout from panel's context menu

* feat: 🎸 setup Drilldowns plugin in X-Pack

* feat: 🎸 add Storybook to drilldowns plugin

* refactor: 💡 move drilldown components to x-pack

* feat: 🎸 add stub action to open drilldown flyout

* feat: 🎸 add drilldowns plugin to translation index

* fix: 🐛 correct TypeScript type check

* fix: 🐛 use correct i18n namespace

* ci: 🎡 add drilldowns plugin to CODEOWNERS file

* fix: 🐛 revert back <PanelOptionsMenu> change

* fix: 🐛 type must not be empty
2020-02-20 21:59:29 +01:00
Melissa Alvarez 3f4640b13d
[ML] New Platform server shim: update datafeed routes (#57739)
* convert datafeed routes to new platfrom

* update datafeed schema

* consolidate datafeedConfig schema for datafeed + job validation
2020-02-20 15:50:12 -05:00
Spencer 4aedf2b75b
add monaco to kbn/ui-shared-deps and load required features for all uses (#58075)
* add monaco to kbn/ui-shared-deps and load required features for all uses

* forgot to save a change

* remove unused imports

* include a cache buster to counteract issue #58077

* include monaco.ts in ts project
2020-02-20 12:58:42 -07:00
Zacqary Adam Xeper d96cf70cd4
Add throttle param to Alerting readme (#57609)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-20 13:45:58 -06:00
Maryia Lapata 857f9f8379
[NP] Move ui/saved_objects to NP (#57452)
* Move saved_objects to NP

* Update path for imports

* Remove ui/saved_objects

* Update i18n IDs

* Convert test

* Replace Bluebird to Promise; fix unit tests

* Mock openConfirm in test

* Add kibana.json

* Check unit test

* Update unit tests
2020-02-20 21:20:23 +03:00
Alejandro Fernández 5953e62a72
[Logs UI] Fix column reordering in settings page (#58104)
* Ensure only one element has scroll

Apparently having multiple elements with scroll confuses the
`react-beautiful-dnd` mechanism to determine the position of the
elements. Adding `overflowY` to the app root fixes it.

* Fix upper bound check for log column reordering

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-20 17:57:00 +01:00
CJ Cenizal c3001c4469
Add filter for ILM phase to Index Management (revert #45486) (#57402) 2020-02-20 08:27:53 -08:00
Rachel Shen 289b2fa611
Clarify Precision function in Timelion Kibana (#58031)
* Closes issue 26100
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-20 08:59:44 -07:00
Mike Côté 783663fa52
Skip flaky alert details test (#58120)
* Skip flaky test

* Skip suite

* Skip suite
2020-02-20 08:46:28 -07:00
Xavier Mouligneau 602aca3387
[SIEM] Detections container/rules unit tests (#58055)
* add unit test for rules api

* add unit test for useFetchIndexPatterns

* fix useFetchIndexPatterns and add unit test for usePersistRule

* add more unit test for container/rules

* review

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-20 10:39:43 -05:00
Maggie Ghamry 3cba05128e
[Canvas] Adds argument to open all links in new tab within markdown element (#57017)
* Adds toggle to open links in new tab within markdown element

* Updating test for markdown function

* Switch to using Markdown Component

* Update ui.ts

Update to change toggle verbiage per Ryan's request, and reuse the Kibana Markdown per Corey's help and recommendation. Still working on updating the styles (consulting Ryan)

* Update toggle.js

Update to prevent text for "Open links in new tab from wrapping" - the example from the horizontal bar chart is quite differently, and reads from "axisConfig" - when I changed the argType to "axisConfig", the layout was the same, but I'll need some input on which specific styles to add to the "ToggleArgInput" - I think this is where the style updates need to occur to get the toggle to stay on the same line, but may be wrong.

* Update ui.ts

Update to original message string per Ryan's feedback, now that there is no wrapping

* Update to UI styles per Ryan's feedback

* updating message per Ryan's request

* Update ui.ts

update to fix internationalization issues

Co-authored-by: Corey Robertson <crob611@gmail.com>
2020-02-20 10:12:19 -05:00
Michail Yasonik 5cfc5ef9ff
Reverting grouped nav UI (#57724)
* reverting grouped nav ui

* removing Management name change
2020-02-20 09:14:11 -05:00
Melissa Alvarez 47bb7c61b6
update estimateBucketSpan schema and api test (#58004) 2020-02-20 09:13:49 -05:00
Alexey Antonov ed2ca68d79
[ui/agg_response/tabify] -> TypeScript & Jest & Shim (#57660)
* [ui/agg_response/tabify] -> TypeScript & Jest & Shim

[ui/agg_response/tabify] -> TypeScript & Jest & Shim

Part of #57394

* fix CI

* move tabify into new folder

* TypeScript _bucket.js

* rename _buckets -> bucket

* fix CI

* tabify.test.js -> tabify.test.ts

* tabify.js -> tabify.ts

* fix JEST

* Update src/legacy/core_plugins/data/public/search/tabify/types.ts

Co-Authored-By: Luke Elmers <lukeelmers@gmail.com>

* fake_hierarchical_data.js -> fake_hierarchical_data.ts

* TimeRange -> TabbedRangeFilterParams

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Luke Elmers <lukeelmers@gmail.com>
2020-02-20 15:40:00 +03:00
Robert Oskamp 16eb81628f
[ML] Transform functional tests - bootstrap transform job for clone test (#57992)
This PR adds transform bootstrapping to the functional test transform.api service and demonstrates the usage in a new cloning test file, which will be completed as part of the transform cloning PR.
2020-02-20 13:31:03 +01:00
Jean-Louis Leysens b07aa09606
[Watcher] Refactor to use client from RequestHandlerContext (#57834)
* Remove elasticsearch setup service from route deps

Removed the callWithRequestFactory entirely. This setup was introducing a pattern where
route handlers were not pulling the ES client fromt the route handler context. For this
refactor we need to extend the route handler context with watcher specific client actions
and so we also extend RequestHandlerContext globally.

In this commit we also update the types for params, query and body schema on each route to avoid
using any everwhere.

* Add generic types to license wrapper

Adding <P, Q, B> to the license wrapper made it a transparent
wrapper from a type perspective so we can remove the need to
eplicitly set RequestHandler<P, Q, B> on the handler.

Also cleaned up a variable name "response" -> "searchResults"

Also removed elasticsearch from the RouteDependencies type.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-20 13:25:02 +01:00
Joe Reuter e23b547fb0
Use static time for tsvb rollup test (#57701) 2020-02-20 10:30:00 +01:00
patrykkopycinski b70d54438f
[SIEM] Fix ResizeObserver polyfill (#58046) 2020-02-20 08:27:51 +01:00
Frank Hassanabad 8097bd8dc1
[SIEM][Detection Engine] Fixes return codes where some were rule_id instead of id
## Summary

Fixes some return error codes where they were `rule_id` when they should have been `id`

- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
2020-02-19 19:44:11 -07:00
spalger 1464706b5c skip flaky suite (#56816) 2020-02-19 19:32:58 -07:00
spalger dbb4a66e0d skip flaky suite (#58059) 2020-02-19 19:29:20 -07:00
spalger ba983f0683 skip flaky suite (#45348) 2020-02-19 19:26:40 -07:00
Melissa Alvarez 8d5a02fc90
migrates notification server routes to NP (#57906) 2020-02-19 20:57:40 -05:00
John Dorlus a36467e66e
Moved all of the show/hide toggles outside of ordered lists. (#57163)
* Moved all of the show/hide toggles outside of ordered lists.

* Fixed styling issues for indice list.

* Fixed i10n tag that I accidentally changed.

* Added component to show/hide indices.

* Abstracted out some of the common parts of the Show Hide component and implemented the general component in the pages. Also made conditional for the i18n tags.

* Fixed changes per comments. Restored <EuiText> to fix the issue with the bullet points. Updated the i18n tags to be more generic. Created 2 components for formatted message.

* Fixed internalization issues..

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-19 17:27:50 -05:00
Oliver Gupte 96a0aa0266
[APM] NP Migration - Moves plugin server files out of legacy (#57532)
* Closes @56832 Migrates uses of the saved objects client to the internal
and context scoped clients exposed in the new platform core setup

* moves apm server, common, and typings dirs to the new plugin directory

* fixes path imports and type errors

* fixes some lint errors

* fixes CI failure. Use internal saved objects client like before.

* uses the context-scoped saved objects client for saving runtime APM indices,
and uses the internal saved objects client when creating apm index
pattern, so that any user who navigates to apm can trigger it

* fixes the type check error by updating import paths

* renamed files and directories to snake_case to pass scripts/check_file_casing

* rebase fixes and commit filename case changes

* moves get_indices_privileges.ts out of legacy path
2020-02-19 13:43:03 -08:00
Aaron Caldwell ef1565347c
[Maps][Telemetry] Migrate Maps telemetry to NP (#55055)
* Move maps telemetry to NP. Some clean-up, some ts conversion

* Update naming & org to be more in-line with guidelines

* Get TELEMETRY_TYPE from constants

* Ignore ts error importing from js file

* Set original array type passed into the function to array of ILayerTypeCount. Set return type on reduce function

* Remove unneeded 'any' types where used. Add in interfaces for map & index pattern saved objects

* Review feedback. Add layer, source, map saved object types and use

* Review feedback. Updates based on type check

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-19 13:57:36 -07:00
Christos Nasikas ff0d2d9988
[SIEM][Case] Merge header components (#57816)
* Create edit node component

* Accept EditNodeComponent

* Switch to old header

* test

* Remove iconType

* Remove isEditTitle

* Move translations

* Delete header_page_new component

* Move editable title component to different folder

* Update jest snapshot

* Rename prop

* Make EditableTitleComponent more generic

* useCallback instead of inline functions in props

* Hardcode titles

* Move UI state inside EditableTitleComponent

* Seperate title's tests

* Create tests for EditableTitleComponent

* useCallbacks on EditableTitle component

* Create translation for aria-label in edit icon

* Check if switched to edit mode after pressing submit

* Test title when canceled

Co-authored-by: patrykkopycinski <contact@patrykkopycinski.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-19 21:08:31 +02:00
Melissa Alvarez c2d98a0841
[ML] New Platform server shim: update job audit messages routes (#57925)
* migrate all job audit messages routes to NP

* update types and add missing api names from validation
2020-02-19 13:48:21 -05:00
Søren Louv-Jansen 0340fac149
[APM] Don’t include UI filters when fetching a specific transaction (#57934)
* [APM] Don’t include UI filters when fetching transaction

When fetching an error sample, the related transaction is also fetched. This transaction should not be filtered by ui filters

* Fix snapshot

* Update term mock term used for ui filter
2020-02-19 17:25:55 +01:00
spalger 29ac6fea71 skip flaky suite (#57762) (#57997) (#57998) 2020-02-19 08:22:37 -07:00
Gidi Meir Morris 85097d5fad
adds pagination on Alert Instances list on Alert Details page (#57524)
* added pagination on alert instances page

* extracted default page size to a constant for alerting UI as a whole

* Fix test failure

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
2020-02-19 10:08:01 -05:00
Yara Tercero ca3f27aca9
[SIEM] [Detections Engine] Import rules unit tests (#57466)
* Added unit tests for detection engine import_rules_route and moved out small portion of import_rules_route into a util to be unit tested as well.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-19 09:42:50 -05:00
spalger c91e4a77c1 skip flaky suite (#57946) 2020-02-19 07:38:21 -07:00
spalger d7c36d04f2 skip flaky suite (#44631) 2020-02-19 07:35:17 -07:00
Dima Arnautov 4fa59429b2
[ML] New Platform server shim: update system routes (#57835)
* [ML] NP system routes

* [ML] apidoc.json

* [ML] address PR comments

* [ML] fix apidoc methods, passing es_search endpoint payload

* [ML] add dummy body validation for es_search, fix ignoreSpaces query param

* [ML] _has_privileges validate body
2020-02-19 14:40:18 +01:00
Alison Goryachev cf743f3216
[Remote clusters] Fix regression with xpack.remote_clusters.ui.enabled setting (#57895) 2020-02-19 08:10:18 -05:00
MadameSheema 9d37535b64
refactors 'url state' tests (#57981) 2020-02-19 13:08:27 +01:00
Joe Reuter 28034d05a9
Remove injected reference from home app (#57836) 2020-02-19 12:51:26 +01:00
Cauê Marcondes e7b63863ab
[APM] Use ES Permission API to check if a user has permissions to read from APM indices (#57311)
* get indices privileges from has_privileges api

* changing to ES privileges api

* changing missing permission page

* always show dimiss button

* always show dimiss button

* changing message and unit test

* fixing react warning message
2020-02-19 10:27:46 +00:00
Casper Hübertz 077879ae6e
[APM] Fix trace sample double pagination summary (#57558)
* [APM] Remove PaginationContainer

Removing the old pagination from the trace summary title.

* [APM] Removing PaginationContainer component ref

* [APM] Change the vertical alignment to center

* [APM] Leaving the EuiPagination component in place

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-19 10:44:41 +01:00
Vadim Dalecky 0101c638f9
feat: 🎸 allow disablint action trigger execution in embeddables (#57691)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-19 10:31:41 +01:00
Kerry Gallagher a4d8bc841b
Add enabled key schema validation (#57935) 2020-02-19 09:02:26 +00:00
Robert Oskamp 7b125e3ce0
[ML] Functional tests - run all tests as poweruser (#57809)
This PR runs all functional ML and transform tests (except existing security and feature controls tests) as a poweruser instead of the default superuser.
2020-02-19 08:47:18 +01:00
John Schulz 5a99642cfb
Add Ingest Manager plugin to master (#56567)
* [Fleet] Add permissions checks (#48143)

* Add permissions check to API

* Add permissions check to UI

* Undo changes

* Update index.tsx

* Update enroll.ts

* add API tests for permissions

* add fleet to trial license check

* Agent enrollment flyout (#48173)

* Fix agent table empty prompt

* First pass at agent enrollment flyout with placeholders

* Move enrollment commands into separate file and enable templated vars

* Use default double braces for templating

* [Fleet] unenroll agent from the details page (#48286)

* [Fleet] add API to unenroll agents
* [Fleet] return a 403 for inactive agent
* [Fleet] UI to unenroll an agent from the detail page

* [Fleet] Filter inactive agent from the listing (#48466)

* [Fleet] Expose policy change method from fleet plugins (#48562)

* [IM] add screenshot detail view and image endpoint (#48149)

* add api endpoint to handle images

* #47978 add screenshots component with single image

* update padding around screenshot

* import existing API_ROOT

* move ImageRequestParams interface and fix type

* pass the content-type through and add test

* fix ie11 issues with nested flex items, change radius to use eui variable

* use eui variables for padding

* add aria label and image description

* [IM] Use EPM in variables & types (#48453)

* IntegrationsManager -> EPM

* integrationsManager -> epm

* [iI]ntegration -> [pP]ackage. Update tests.

* Don't rename integrations registry URL.

* Update i18n key in x-pack/.i18nrc.json

* Update path to functional test config

* Add epm to recently re-enabled privileges test

* Update two values recently added in main feature branch

* Move/update screenshot tests

* [Fleet] Allow to edit metadata (#48682)

* [Fleet] Add a toggle to show Inactive users (#48917)

* Multiselect to unenroll agents (#48852)

* Initial pass at multiselect to unenroll agents

* Adjust loading state button text

* Fix types; use unenroll provider in agent details

* Update select all agents kuery

* Prevent inactive agents from being selected

* [Fleet] Fix privilege tests after merge of master (#49118)

* [Fleet] Temporary use the elastic user as kibana user to be able to create API keys (#49037)

* [EPM] Fix package version requirement structure (#49172)

* [EPM] Fix package version requirement structure

In https://github.com/elastic/integrations-registry/pull/134 the API structure changes. This PR should adjust to the new structure.

* Update x-pack/legacy/plugins/integrations_manager/common/types.ts

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* Update x-pack/legacy/plugins/integrations_manager/common/types.ts

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* Update x-pack/legacy/plugins/integrations_manager/common/types.ts

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* Update x-pack/legacy/plugins/integrations_manager/common/types.ts

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* [EPM] 48799 markdown into readme (#49180)

* add markdown component and fetch markdown

* add package.json file with react-markdown dependency

* add markdown renderers, use readme path

* remove description and rename to readme

* remove dropshadow on images

* add loading component for readme request

* comment on loading components

* Add command to spin up a mock server for ingest endpoints (#49259)

* 48654 files from registry (#49580)

* Replace image path/handler with generic file one

* Incorporate tests from #48696

* [EPM] Make screenshot image captions optional (#48912)

* Make screenshot image captions optional

* fix typos, type, rename variable

* [EPM] update to layout and and spacing (#49413)

* fix height and color issues

* make container full height

* remove panels per design update and make white bg color

* adjust spacing

* check for empty response

* fix eslint issue

* fix layout in safari

* remove unused component

* [EPM] Rename registry url to new path (#49598)

The integrations-registry repository was renamed to package-registry and with it also all the assets inside. The url under which the service is served will also be changed (not done yet). As soon as this is done, this PR should be merged.

* [EPM] rewrite relative image paths (#49637)

* rewrite relative image paths

* remove EuiImage, use transformImageUri, clean up

* [EPM] Use NP registerFeature (#49625)

* Use NP registerFeature

* Added features plugin to deps. Used it in setup.

Moved `registerFeature` from `init` to plugin setup.

Moved rest of init into `createSetupShim`. `init` is now

```ts
init(server: Legacy.Server) {
    const { initializerContext, coreSetup, pluginsSetup } = createSetupShim(server);

    new Plugin(initializerContext).setup(coreSetup, pluginsSetup);
  },
```

Moved feature (argument for `registerFeature`) to separate file.

Renamed plugin-specific `CoreSetup` to `EPMCoreSetup`

* [Fleet] Filter agents list table by policy name (#49968)

* Add policies lib and adapters

* Fix mock server headers

* Initial pass at policy filter dropdown by manipulating kuery string

* Adjust spec return values

* Use separate state for policy filter; fix typings and disable some eslint rules

* Fix react-related eslint errors

/Users/jfsiii/work/kibana/x-pack/legacy/plugins/integrations_manager/public/hooks/use_links.tsx
  26:20  error  React Hook "useCore" is called in function "addBasePath" which is neither a React function component or a custom React Hook function  react-hooks/rules-of-hooks

/Users/jfsiii/work/kibana/x-pack/legacy/plugins/integrations_manager/public/screens/detail/readme.tsx
  26:35  error  React Hook "useLinks" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
  39:6   error  React Hook useEffect has a missing dependency: 'readmePath'. Either include it or remove the dependency array                                       react-hooks/exhaustive-deps

/Users/jfsiii/work/kibana/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_results.tsx
  27:42  error  `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`  react/no-unescaped-entities
  27:49  error  `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`  react/no-unescaped-entities

✖ 5 problems (5 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

* Remove ui/* imports (#50094)

* [Fleet] Use ES api keys for agent authentication (#49639)

* add collapsible read me component (#49990)

* add collapsible read me component

* Update x-pack/legacy/plugins/integrations_manager/public/components/content_collapse.tsx

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* add empty array as second argument to useLayoutEffect

* [EPM] Make API consistent for package installation and removal (#48745)

* Adjust type names

* Install package in one go.

* Integration -> Package

* Really install all known assets

* Remove ingest pipelines on package deletion.

* [EPM] Replace image paths/handlers with generic ones for file (#48688)

* Replace image path/handler with generic file one

* Incorporate tests from #48696

* Fix merge error.

* Type tuning

* Adjust types

* Remove asset types from routes altogether

* Add timelion-sheet back to types.

* Respond with full package info to install/delete

* Be specific in return type.

* Keep installAssets() as separate step

* [EPM] Add unit tests for pathParts (#50279)

* [EPM] Add unit tests for pathParts

This adds unit tests for the pathParts function. I initially wanted to enhance the function to also support paths like `iptables-1.0.4/dataset/log/elasticsearch/ingest-pipeline/pipeline.json`. But without unit tests it was hard for me to make the changes.

This adds a unit test driven by a table so we can extend it later. Adding these tests also helps me to better understand the code.

As a note for myself, the command to run these tests is:

```
node scripts/jest --watch ./legacy/plugins/integrations_manager/server/registry/index.test.ts
```

* Update docs for merging master into feature branch (#50396)

* [Fleet] Remove in memory repository (#50431)

* [EPM] Documentation of HTTP routes & TS types for Ingest (#48798)

* Add beginning models and two routes for Ingest

* Update types & models per discussion w/Ruflin
Also reviewed data structures listed at https://docs.google.com/document/d/1IBR3f9dpHqJmXYEdg06WV34KSMd3g5k4aMGa4jde_Eg/edit#

* Update: /policies always returns array. /policy returns single policy

* Add pagination for /policy & /datasources. Uses per_page & page params

* Add API metadata. Standardize policy_id param name.

* Update descriptions to match Google Doc. Move use case to Policy.

Disabled the '@typescript-eslint/array-type' rule because it was going around in circles. It didn't like Datasource[] or Array<Datasource>

* Return to initial TS annotation for Arrays

Remove the line disabling @typescript-eslint/array-type now that it's behaving normally again 🤷

* [EPM] Add directory structure for server/lib. (#50469)

* Add directory structure for server/lib.

* 'tests' seems to be more common than 'test'

* Make CI happy

* [EPM] Add basic documentation directory (#50478)

* [EPM] Add basic documentation directory

Having the doc directory around allows us to easily add docs from here on to document how EPM works.

To run the docs build, use the following command from the kibana directory:

```
../docs/build_docs --doc docs/epm/index.asciidoc --open
```

The above assumes that docs (https://github.com/elastic/docs) are checked out in the same directory as Kibana.

With this change, the EPM docs build is not included yet in the overall docs build. For this adjustments to https://github.com/elastic/docs/blob/master/conf.yaml must be made.

* [EPM] Add basic index template (#50471)

This PR adds the very basic index template we will use for the packages. It contains all the basic settings and some examples. The examples will be remove as soon as we have an actual implementation with packages but for now is convenient to see if it is a valid package.

This code is put into the lib directory as it does not tie directly into any handlers.

It also adds an functional tests for loading a template. This means we have a way to check if a template is valid in Elasticsearch. Based on this we can check in the future all our generated templates for validity with Elasticsearch.

To run the functional test, go to the Kibana x-pack directory. Start the first command:

```
node scripts/functional_tests_server.js --config test/epm_api_integration/config.ts
```

Keep the above running and switch to an other Terminal. Now run:

```
node scripts/functional_test_runner.js --config x-pack/test/epm_api_integration/config.ts
```

* 40752 rewrite ingest pipeline (#50627)

* Add directory structure for server/lib.

* 'tests' seems to be more common than 'test'

* Make CI happy

* Implement pipeline rewriting.

* Add more testcases

* For posterity (comment change)

* Allow beats-style template delimiters

* Be more succinct

* Document better

* Replace AssetType enum with union type (#50696)

See https://github.com/elastic/kibana/pull/50609#discussion_r346080439

Discussed in Slack and agree to revert for now. Can track down the issues & restore later

* Remove unnecessary await if we can return the promise (#50329)

* Fix whitespace per figma comments. Closes #47348 (#47350)

* Add fix & comment for TS 3.7.2 regression

* [EPM] cleanup assets, filter assets for those currently supported (#50609)

* cleanup assets, filter assets for those currently supported

* removed unused type

* fix type

* add comment for better type

* change type name to be more descriptive

* hardcode image width for ie11 (#49796)

* hardcode image width for ie11

* eslint

* improve comment

* add maxWidth

* [EPM] useKibana hook & render in plugin.start (#50110)

* plugin.start now does reactdom.render vs returning react element

export plugin function from public/index

* Move setClient call from plugin.start to plugin.setup

* Use `useUiSetting$` from `useKibana` hooks

* Fix broken app due to bad hooks usage

Can't use useKibana outside a React component.

Reverting to prior approach since it's still NP. Can revisit context usage in a followup PR

* [EPM] Install package from detail view on button click (#50735)

* Support basic "click button -> show spinner -> installed" install flow

* Remove incorrect comments. Add TS return types to data functions.

* [EPM] Use NP feature_catalogue.register (#50108)

* Use NP feature_catalogue.register

* Use type from NP plugin

* fix linting

* fix types

* fix headers in Fleet

* skipping test due to ES param change

* Revert "skipping test due to ES param change"

This reverts commit d05f20decf.

* remove type field

* remove unused import

* [EPM] Final(?) update from integrations_manager -> EPM (#50976)

* Update (all remaining?) references from integrations_manager to EPM

* Update path in i18n file

* [EPM] update compatibility section (#50975)

* change min max version to single range value

* add elastic stack icon and change text

* remove badge from version and use code font

* remove euistyled

* add back version component lost in merge

* remove euiStyled

* remove old file

* Restore RequirementVersionRange type

* Disable test for elasticsearch username.

Temporary work around until we know how the stack wants to add the permissions we need. Either adding to the kibana user or creating a new user.

* Revert "Disable test for elasticsearch username."

This reverts commit f1020e4eab.

* Disable test for elasticsearch username.

    Temporary work around until we know how the stack wants to add the permissions we need. Either adding to the kibana user or creating a new user.

* Fix EPM typing issues in register feature

* Fix typings after master merge

* [EPM] CI fixes (#51284)

* Initialize es in test.

* Add it(), no es.init()

* Clean up.

* [EPM] add confirmation modal (#51172)

* add confirmation modal, move install state to Header

* update callout to use title

* move components only used in detail view to detail dir

* use better variable names

* update to more descriptive  variable names

* Restore prior response vaulues for install & delete package (#51252)

Discussed this with @skh https://github.com/elastic/kibana/pull/51112#commitcomment-35961413 & https://github.com/elastic/kibana/pull/51112#commitcomment-35970664 as well as in a video call

Also added some TS type annotations for data fetching functions to make the contracts more explicit

* [EPM] /package API only lists installable assets. Restore enums. (#51414)

* API only shows installable assets. Server types to own file. Restore enums

* Fix type imports

* Only return installable asset types (kibana for now)

* server/types now only has code from hapi which shouldn't go to client

* Add more restricted TS types to DisplayAssets object

* Flip order of arguments to Extract

In these cases it still works the same, but looking at https://www.typescriptlang.org/docs/handbook/advanced-types.html the signature is

`Extract<T, U>` - Extract from `T` those types that are assignable to `U`

so the larger set should be first

* [Fleet] Enrollment api key UI (#51495)

* Make button pretty in dark mode as well. (#51610)

* [EPM] Add docs entry about registryUrl config (#51697)

This documentation is at the moment mainly for internal use. I found myself searching for this URL several times in the code or PRs so I thought I rather add it to the docs for now.

* [EPM] Remove encoding of Kibana objects as not needed anymore

* [Fleet] Move agent status server side and API to get aggregated status for a policy (#51673)

* [EPM] Add basic docs around install/delete API endpoint (#51728)

This is mainly for internal usage at the moment to look up.

* Ingest/policy (#51741)

* wip policy

* tweaks

* tweaks

* FIX TYPOS

* WIP move policy => agent config conversion to fleet, WIP policy changed method

* fix tests and bugs

* updates tests and snaps

* more fixes

* use AGENT_POLLING_INTERVAL

* cleanup and fix some formatting

* Update x-pack/legacy/plugins/ingest/server/libs/datasources.ts

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* Update x-pack/legacy/plugins/ingest/server/libs/datasources.ts

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* Update x-pack/legacy/plugins/ingest/server/libs/outputs.ts

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* Update x-pack/legacy/plugins/fleet/server/libs/policy.ts

Co-Authored-By: John Schulz <github.com@jfsiii.org>

* fix things broken by PR review suggestions

* remove unused field

* fix types

* fix mappings

* add datasource mappings

* Fix mappings and remove get full policy from checkin

* Fix ingest api integration tests

* run es-lint to fix fleet

* Fix typescript issues

* [EPM] Track package install state and add toast notification (#51734)

* add notifications from core to plugin

* add package install state hook

* fix type error

* use toMountPoint helper to add jsx to notification

* add warning notification to failed install

* make notifications dependency explicit prop

* move PackageInstall provider lower

* add comment about InstallStatus type overlapping InstallationStatus

* use InstallStatus type in InstallationButton component

* fix type

* [Ingest] Adds support for a working default output (#51841)

* aadding config

* add working settings to the default output

* remove default username and password

* update libs

* [EPM] Add basics for creating the ILM setup (#50474)

This contains the basic objects to setup ILM

* Create index and alias with a write index
* Get the policy

The code does not contain any functional tests yet as it is still open on how to do it best. I suggest to get this in as a foundation and then iterate on top of it.

* [EPM] Add datasource (ingest pipeline) from package (#51851)

## Summary

This mixes a few concerns but I think it's worth it to show the parts working together.

Take a look at the individual commits for a better separation of features.

This adds 
 - the `/datasource/install/{pkgkey}` endpoint which installs ingest pipelines from a package into ES and saves a reference to them in the EPM state Saved Object
 - Connects the "Add datasource" button in the successful installation Toast to the new API
 - Adds a toast notification to inform the user the datasource was added correctly
 - Adds a "Delete Package" button on the details page so we can uninstall a package while we're waiting for the separate view which allows deletes
 - b99eda6 Pushes logic that was in the detail view into `InstallationButton`. This consolidates the logic in one component (or one component & the existing hook) and, iiic, means we can put `<InstallationButton package={...} />` on any view and get the same behavior

I'm marking this as a normal PR so people can merge if they wish

![add-datasource-delete-package-small](https://user-images.githubusercontent.com/57655/69775686-7fb39280-1167-11ea-8d41-e2b8a02252a1.gif)

* [EPM] Add basic processing of fields.yml file (#51148)

The fields.yml is used to generate the Elasticsearch template and Kibana index pattern. This PR adds a very basic implementation of processing the fields.yml and then create an Elasticsearch template out of it. The only fields that are supported at the moment are keyword fields, more will be added as a follow up.

The testing was implemented with a golden file. The output from the method is compared to a json file. If the input is changed or the method is changed, it is possible to regenerate the files with the `-generate` flag as following:

```
node scripts/jest  ./legacy/plugins/epm/server/lib/template/template.test.ts -generate
```

This will allow us to quickly test many inputs / outputs in the future, make adjustments to the existing files and generate the new outputs. We then can compare it in the diff it the changes make sense.

* [EPM] Create basic implementation to merge input template and dataset manifest (#51803)

* [EPM] Create basic implementation to merge input template and dataset manifest

With this code it is possible to take an input template for the agent and merge it with the config variables from the dataset manifest file. Currently only the name and the default value are merged. Later on we must implement to be able to pass user configured variables to it and make decision based on OS selection.

Closing https://github.com/elastic/kibana/issues/51794

* [EPM] Refactoring of lib structure (#51885)

This refactors the structure of lib. As so far all the lib parts are related to assets in the package, it is organised the same way with the same structure. Each directory has its own tests directory if it needs one. This makes it possible to (almost) not need relative paths for tests.

* [EPM] Allow to read files from fields directory (#51958)

This change allows to also extract files from the `fields` directory. Previously this was not possible because it always assumed a service must be there.

* [EPM] Install Elasticsearch Index Template for data source (#51878)

This installs the Elasticsearch index template for each dataset in a package. For now the names are hardcoded based on package key and dataset name but will be more dynamic later on when we pass the full dataset information.

The dataset extractions is a bit "hacky" at the moment and we should get a full implementation of dataset at a later stage and replace this code.

* [Fleet] Policy list, details, create, edit UIs (#51950)

* Set up simple policies list view

* Adjust spec to return single policy

* Set up simple policy details page

* Add demo stats/chart to policy details

* Add description string

* Initial setup of policy form and create policy UI

* Policy create/edit form; integrate policy list api

* Integrate create policy api

* Integrate policy detail, agent status, and policy edit APIs; adjust policy list api integration in agent enrollment

* Fix edit policy mock meta

* Fix policy list search bar

* PR and linting fixes; use typings from ingest plugin

* Fix i18n

* [EPM] Add datasource saved object type (#51871)

## Summary

This PR makes a few assumptions, and contains a lot of refactoring. It might be beneficial to look at the resulting directory structure under `server` first to get the (new) big picture.

Assumptions:
- our API deals with several concerns, for now these are packages and datasources
- we manage our own HTTP API endpoints for these concerns (in particular, don't use the ingest plugin for that)
- we manage (for now) the Kibana saved object in which datasources are saved. importing and calling methods from the ingest plugin to do that down the road will (hopefully) be a manageable change

This led to the following decisions:
- the code is separated into subdirectories by concern, containing all the route handlers and tightly coupled code
- for now, these directories are in `server/packages` and `server/datasources`. I'm tempted to move them into `server/api/{packages,datasources}` but wanted to limit the amount of refactoring in one PR
- shared code lives in `server/lib`
- some code from `server/packages` has been almost duplicated to handle saving to Datasource saved objects, some has been refactored and is used from both places. The deduplication needs further improvement
- maybe `server/registry` should also move under `server/lib` (but see above, I'm trying to not move everything around all at once)

Testing:

* Please note that this is a breaking change because the saved object type for package information
has also been renamed. You'll need to start with a fresh `.kibana-*` index. Restarting `yarn es snapshot` (withouth specifying a data directory) should do the trick.

* Package installation should still work, e.g. with a GET request to `http://localhost:5601/api/epm/package/coredns-1.0.1`. The saved objects for packages can be inspected with a GET request to `http://localhost:5601/api/saved_objects/epm-package/$PKG_KEY`, e.g. `http://localhost:5601/api/saved_objects/epm-package/coredns-1.0.1`
* Datasource creation should still work, e.g. with a GET request to `http://localhost:5601/api/epm/datasource/install/coredns-1.0.1`. The saved objects for datasources can be inspected with a GET to `http://localhost:5601/api/saved_objects/epm-datasource/$PKG_KEY`, e.g. `http://localhost:5601/api/saved_objects/epm-datasource/coredns-1.0.1`

* [Fleet] Expose policy during agent checkin (#51968)

* [EPM] Add /epr prefix to the tar.gz download path (#51881)

The registry slightly changed the .tar.gz path because of download stats reason. This adjusts for it. See https://github.com/elastic/package-registry/pull/169

* [EPM] Move template installation to lib and add asset helper  (#52049)

* [EPM] Move template installation to lib and add asset helper

All the logic related to the installation of the templates for a package should be inside the template library folder. This moves the logic into this folder.

A few refactorings were made to simplify installation:

* Introduction of DataSet interface: This interface is needed to extract the data sets inside a package and install one template per data set.
* Pass package instead of package key to installation process: Passing the package instead of the package key means fetching of package information is decoupled from the installation process and abstracted. This separates the two concerns and should simplify testing.
* getAsssets method: The getAssets methods works on top of the package object to extract asset paths. It is inspired by get_objects methods but supports passing a package and a dataset.

Currently one problem with testing that exists is that to fetch the content of an asset is not decoupled yet.

* [EPM] Reduce data source to one type (#52061)

Between Fleet / Ingest / EPM there had been several interface definitions of Datasource and the related types. This reduces it to one place for the definition. The same applies to the policy definition.

The goal of this is that from now on we all rely on the same definition. If we make changes, we make them in all parts of the code.

In this PR is only the minimal change needed to get us all on one interface. Further changes will be needed that we all rely on the same saved objects etc.

* add export command

* revert 2 more files to rely on export

* revert imports

* Fix types for Datasource Saved Object

* merge in master

* fix type check

* Run VSCode's organize imports on EPM files (#52234)

Learned about it on Slack from https://twitter.com/ryanchenkie/status/1201883268527927301

Blog at https://code.visualstudio.com/updates/v1_23#_run-code-actions-on-save

Basically does the order we've been loosely following (3rd party, then relative) & alphabetic by location and variable name.

It's not customizable but it's reasonable and, afaict, consistent.

* [EPM] More realistic datasource SO. Error if package not installed. (#52229)

* Move cache 'hack' into getAssetsData

* p -> pkg. package is reserved. pkgkey is used in many places

* Remove unnecessary type cast

* Clarify reasons behind asset path manipulation

* Return the Datasource; not the Saved Object.

* Use real values from package in fake datasource SO

* Error if /datasource/install before /package/install

```
> curl --user elastic:changeme localhost:5601/api/epm/datasource/install/coredns-1.0.1
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "coredns-1.0.1 is not installed"
}

> curl --user elastic:changeme localhost:5601/api/epm/install/coredns-1.0.1
[
  {
    "id": "53aa1f70-443e-11e9-8548-ab7fbe04f038",
    "type": "dashboard"
  },
  {
    "id": "Metricbeat-CoreDNS-Dashboard-ecs",
    "type": "dashboard"
  },
  {
    "id": "75743f70-443c-11e9-8548-ab7fbe04f038",
    "type": "visualization"
  },
  {
    "id": "36e08510-53c4-11e9-b466-9be470bbd327-ecs",
    "type": "visualization"
  },
  {
    "id": "277fc650-67a9-11e9-a534-715561d0bf42",
    "type": "visualization"
  },
  {
    "id": "cfde7fb0-443d-11e9-8548-ab7fbe04f038",
    "type": "visualization"
  },
  {
    "id": "a19df590-53c4-11e9-b466-9be470bbd327-ecs",
    "type": "visualization"
  },
  {
    "id": "a58345f0-7298-11e9-b0d0-414c3011ddbb",
    "type": "visualization"
  },
  {
    "id": "9dc640e0-4432-11e9-8548-ab7fbe04f038",
    "type": "visualization"
  },
  {
    "id": "3ad75810-4429-11e9-8548-ab7fbe04f038",
    "type": "visualization"
  },
  {
    "id": "57c74300-7308-11e9-b0d0-414c3011ddbb",
    "type": "visualization"
  },
  {
    "id": "27da53f0-53d5-11e9-b466-9be470bbd327-ecs",
    "type": "visualization"
  },
  {
    "id": "86177430-728d-11e9-b0d0-414c3011ddbb",
    "type": "visualization"
  },
  {
    "id": "4804eaa0-7315-11e9-b0d0-414c3011ddbb",
    "type": "visualization"
  }
]

> curl --user elastic:changeme localhost:5601/api/epm/datasource/install/coredns-1.0.1
[
  {
    "id": "coredns_1_0_1_dataset_log_elasticsearch_ingest_pipeline_pipeline_plaintext_json",
    "type": "ingest-pipeline"
  },
  {
    "id": "coredns_1_0_1_dataset_log_elasticsearch_ingest_pipeline_pipeline_json_json",
    "type": "ingest-pipeline"
  },
  {
    "id": "coredns_1_0_1_dataset_log_elasticsearch_ingest_pipeline_pipeline_entry_json",
    "type": "ingest-pipeline"
  }
]
```

* fix duplicated imports

* [EPM] Move golden files generation over to jest snapshot (#52203)

* [EPM] Move golden files generation over to jest snapshot

I initially used my own implementation to write the generated files. It runs out jest has a feature to write snapshots which simplifies the code a lot.

I added a loop with an additional test file so in the future we can just keep adding test files without having to modify the test code.

To updated the snapshots, the param `-u` has to be used:

```
node scripts/jest legacy/plugins/epm/server/lib/fields/field.test.ts -u
```

* [EPM] Create metrics-* and logs-* Kibana index pattern (#52277)

This creates the very basic Kibana index patterns metrics-* and logs-* for Kibana. At the moment it is overwritten every time. We need to change this in the future to take the fields from all installed data sources and regenerate it.

* [EPM] Create helper for elasticsearch asset names (#52265)

Most of the Elasticsearch assets have the same base name. This creates a helper to get the base name for the assets. In case we decide to change the base name in the future, we can change it in one place.

* fix tests and destructing

* [EPM] Update Registry types. Prevent errors installing certain datasources. (#52285)

* Update RegistryPackage type

* Use download key from EPR to fetch archive

* Fix errors caused by correcting the Registry types.

The issues were largely that some Registry types like `title, `datasets` and `assets` where marked as required, but are actually optional. This highlighted area in the code were we relied on them always being present.

We added to the issue by wrapping Registry types in `Required` which made those items which were correctly listed as optional, required for EPM code. Updated EPM types to reflect the largely pass-through nature of the EPM types.

There are two properties which we ensure are in every EPM response, those were put into their own (unexported) type.

Confirm by trying to add a datasource to a package which has no datasources, like apache-1.0.1 or system-2.0.1. In `feature-ingest` and the earlier version of this PR, the `/datasource/install` call returns a 500. In this PR it succeeds.

* [EPM] Add setup of default ILM policies (#52272)

This creates two ILM policies: logs-default and metrics-default. These are the default ILM policies used. Currently the policy content is hardcoded in the code but should be fetched from the base package in the future. The setup happens as part of the datasource installation. When a data source is installed it is a good time to check if the assets are there but we might extract this to a better place in the future.

* [EPM] 52075 add data source first page (#52320)

* Update RegistryPackage type

* add first page of add data source

* fix for ie11 flex min width bug

* remove toDetailViewRelative

* remove unneeded spread

* Update TS type names for EPR search results (#52512)


 * `RegistryList -> RegistrySearchResults`
 * `RegistryListItem -> RegistrySearchResult`

* Restore import sort order from #52234 (#52548)

Many of the changes from #52234 were lost. Presumably due to PR(s) merging which were based on branches which had the previous unsorted order.

* [EPM] Replace wildcard export (#52554)


 * PackageNotInstalledError -> packages/index.ts
 * pkgToPkgKey -> registry/index.ts (will convert existing `${name}-${version}` instances later)

* Replace export * from packages.

There's an argument that the import sites should be updated to import from `packages/get`, `packages/install`, etc but that can wait for a later PR.

* [EPM] Reduce usage of epm-package SavedObject (#52576)

* Delete existing Installation type. Rename InstallationAttributes to Installation

* Reduce usage of EPM SO. Add getInstallation().

Replaced two calls of getInstallationObject() with getInstallation().

Two less places with knowledge of SO internals.

Lots of potential improvements for EPM TS types remain (refactoring/removing Installable, etc), but this is a good incremental step, IMO

* [EPM] Fix missing export link (#52628)

Without it, things break. I am surprised CI did not catch this.

* [EPM] Cleanup ILM loading (#52632)

Before the check for the ILM policy to exist triggered an exception. With this change it is a normal response also if the policy does not exist yet.

A follow up issue will be created in Elasticsearch to get a HEAD request for this available.

* [EPM] Switch to staging URL for registry (#52626)

The old cluster with the registry will be removed as soon as this is merged.

* [EPM] Use Dataset interface to generate template (#52255)

This will make sure we have to pass much feature params and can fully rely on the datasource object to create names for assets.

* [Fleet] Use agent events to compute agent health (#52513)

* [EPM] Data source integration tests (#52542)

* Add fixtures for data source integration test.

* Move test setup to beforeEach

* Add test for datasource creation

* Handle pipelines in yml format.

* Make integration test for adding a data source pass.

* Use EPR staging URL with CDN. (#52776)

See https://github.com/elastic/kibana/pull/52626#pullrequestreview-330622868

* [EPM] Add Data Source page updates (#52705)

* remove dupe type RegistryPackage

* change switches to checkboxes, use datasets to create checkboxes, add some local form state

* update types

* [EPM] redirect after package install (#52771)

* add callback after successful installation and redirect

* add temp data sources tab content to access add data source page

* remove assets tab for mvp

* hide data sources link and redirect from data sources tab if package not installed

* change callback name

* remove commented out assets logic

* add redirect to hook

* fix type

* Use ingest datasource api (#52964)

Incremental change. Uses HTTP API for datasource creation. Will do follow-up PR which uses JS function instead

* Remove duplicate fetchInfo & installTemplates

I think this was from a bad merge, but pretty sure we don't want these functions called twice in the same function

* WIP. Pushing so others can see

* Improve correctness/flexibility of absolute URL

* Disable datasource test & template installation

* [Ingest] Data source APIs (#52448)

* Clean up ingest imports and remove unneeded mock_spec files

* Initial pass at datasources lib and API endpoints

* Add add/remove datasource to/from policy API endpoints

* Add datasource contract tests and related policy contract tests; update snapshots

* Fix tests

* Fix tests again

* Fix tests 3

* Adjust routes, PR feedback

* modify epm createDatasource endpoint to use user data (#52971)

* change epm/datasource/install/{pkg} to POST, send user data to endpoint, install pipelines and templates based on user selected datasets

* change test to post for installing a datasource

* change some names and types around

* delete request.headers['transfer-encoding'] being passed through from epm request

* [EPM] Don't share CreateFakeDatasource type (#53068)

It's not shared between client & server so it doesn't need to be in common. Also, it imports server code which would try to bring server types to the client. It's types so they're compiled away but it's important to keep common to what's truly common. Breaking this separation is why we thought enums broke the client. A lint rule just landed in master to prevent this.

* [EPM] Index template generation fixes (#53104)

* Only add keyword type field to mappings.

* Index template installation

* Handle empty fields definition files
* Re-enable index template installation

* [Fleet] Assign/Unassign data source from policy UI (#53058)

* Add index files to export various modules; normalize imports

* Clean up unused files; extract datasources table component from policy details page

* Expose http client to frontend libs; remove unused types; import ES UI's useRequest lib

* Adjust shape of rest api adapter interface to better match with rest of kibana; remove unused node adapter; change per_page param to perPage in agent events route

* Initial pass at assign data sources flyout

* Initial pass at unassigning data sources from policy

* Make data sources table searchable by package values

* Fix enrollment key lib for rest adapter param changes

* Fix imports and types

* `yarn.lock` changes after bootstrapping

* [EPM] Implement getConfig for dataset (#53261)

* [EPM] Implement getConfig for dataset

* Implements a getConfig method on a dataset object. 
* Build the configuration for each dataset in a package.
* construct and save streams into datasource saved object

* [EPM] Fix template installation (#53272)

As dataset.package was not set, the installed templates contained undefined in the template name. This changes fixes this.

* [EM] Refactor ingest pipeline installation (#53309)

* Refactor ingest pipeline installation

* Only install index templates for requested datasets

* Add index.default_pipeline to index template

* Hook up pipeline rewriting

* Add correct types.

* change POST create datasources path (#53165)

* change POST create datasources path

* remove pkgkey from params

* Fix creation of a data source with a custom ID (#53537)

* [Ingest] Return associated policy IDs in data source info (#53350)

* Return number of policies from data source, surface in assign data source UI

* Update snapshots

* [EPM]: Assign data source to policy in UI (#53597)

* Let ES generate source ids. Refactor along the way.
* Datasource.id isn't optional. It's just missing before we send to Ingest
* Delete EPM's mapping of datasources saved object. Ingest handles that.
* Keep datasource object-related work in constructDatasource
* Move asset installation into own function. Keep entry point high-level.
* More descriptive (less ambiguous) names for these two functions
* Use enum values from Ingest instead of plain strings
* Limit the 'type' key of references to known asset types.
* Update variable names to clarify that we're merging arrays of references
* Use [].flat instead .reduce + .concat to avoid error on empty arrays.
* Pass PackageInfo value directly to component vs pulling off n properties
* Name handlers/options based on the data, not the UI element
* Populate policy combo box based on values from Ingest policy API
* Mark Dataset.vars as optional.
* Add TODOs

* Add commands to run API tests to README (#53847)

* Limit functions to 3 params max. Update those which used more (#53848)

* [EPM] Code in 'common' directories shouldn't import server code (#53854)

* [Fleet] Code in 'common' directories shouldn't import server code (#53938)

* [Fleet] Remove server code from common folder in fleet
* [Fleet] Fix typescript issues after master merge
* [EPM] Fix typescript issues after master merge

* Fix eslint issues

* Fix typescript issues after merge

* Fix merge master missing line

* Fix merge conflict

* [Fleet] Fix registration of Ingest management section (#54065)

* Fix registration of Ingest management section

* Fix i18n key

* [Fleet] Remove server code from common folder in ingest (#53969)

* [Fleet] Connect fleet to policy change update (#53201)

* [Fleet] Send created event when a policy is created
* [Fleet] updated created event when a policy is created
* [Fleet] Send deleted event when a policy is deleted

* [Fleet] Rename output.url => output.hosts (#54258)

* [Ingest] Remove policies UI (#54308)

* Remove meta field UI from policy add/edit form

* Initial pass at policy bulk+single delete UI and API

* Adjust policy links from agent list and detail pages so that links are only active if policy exists

* Add delete policy UI to policy detail page

* Disable policy delete button for default policy

* Commit updated kbn-pm artifact.

CI is failing with messages like
14:52:28  ERROR: 'yarn kbn run build -i @kbn/pm' caused changes to the following files:
14:52:28
14:52:28  packages/kbn-pm/dist/index.js

Following advice from https://elastic.slack.com/archives/C0D8P2XK5/p1570032166063400 and running/committing build

* Update kbn/pm package

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>

* [EPM] create logs metrics index patterns (#54037)

* fixes bug in for loop returning too early and not looping through all yaml files creating incomplete index template, move loading yaml files to own function, other cleanup

* use reduce in place of for loop

* basic functionality for creating index patterns

* separate logs and metrics index patterns

* dedupe fields

* adjust flattenFields to rename nested fields with parent name path

* some tests

* use yml files for tests

* add awaits as part of installing the package

* optimize loading of yaml files

* fix typo

* change type packageName to package

* update tests to use all files from the beginning

* fix type errors

* fix test

* Use dataset.package from registry

https://github.com/elastic/kibana/pull/54037#pullrequestreview-340362812

* Form validation on add datasource page. (#53920)

* [Ingest] Add support for policy `label` field (#54413)

* Allow `label` field in policy APIs, update UIs to support `label` field

* PR review changes, typo fixes, update tests

* [Fleet] Fix api key creation (#54498)

* [Fleet] Move agent acks to his own endpoint (#54401)

* [Ingest] Fix MaxListenersExceededWarning during kibana boot (#54745)

* [Fleet] Create a default api key for the default output (#54658)

* [EPM] update index pattern fields (#54862)

* add DatasetType type

* move loadFieldsFromYaml to fields

* add logic to determine field values

* update tests

* add back accidentally removed readFromDocValues

* remove DatasetType and add IndexPatternType

* rename dedup to dedupe

* group tests

* use null coalescing operator

* Fix typing issues

* [Fleet] Support agent event subtype STOPPING (#55231)

* [EPM] Prevent double submit when creating data sources

Update installationRequested state after submit (#55100)

* [EPM] handle alias fields when creating kibana index pattern (#55254)

* add alias support, update flattenFields to handle alias copying, update and add tests

* update snapshot

* update findFieldByPath to return undefined if not leaf node

* remove temporary alias type from map

* [EPM] handle multi fields when creating index patterns (#55554)

* handle mult_fields

* move nested function out

* [Fleet] Fleet/spec docs (#55619)

* [EPM] Start to document definitions (#55361)

This is a first stab at creating a place where we define the terms we use across ingest management. This is not complete but defines a place where we can add all the future defintions.

* [EPM] Indexing strategy docs (#55301)

* [EPM] Indexing strategy docs

This documentation is to start documenting our new indexing strategy in a public place and have it versioned. This will allow us to share the current state of the indexing strategy more easily in a single place, track it when updated and also already have it ready for our future users to look it up and understand the benefits of it.

* update typos

* fix one more typo

* apply review feedback

* skip fields that are disabled (#55735)

* [Fleet] Fix fleet typing issues after merging master

* [EPM] Create fieldFormatMap in kibana index pattern (#55892)

* add support for fieldFormatMap

* output params must be camel case

* fix case

* add url_template param

* [Fleet] Use user from saved object to create apiKeys (#55458)

* [EPM] Document package upgrade behaviour (#56138)

This PR adds more detailed documentation on what should happen when a package is upgraded.

* Remove some explicit typing to pass type checks.

This abstraction will be removed in the single plugin going into master.

* remove readFromDocValues (#56227)

* Add symlink to yarn.lock to fix(?) CI

https://github.com/elastic/kibana/pull/56443/checks?check_run_id=418123781 failed saying EPM directory "MUST have a 'yarn.lock' symlink"

Seems to have originated with https://github.com/elastic/kibana/pull/55440

Following example from other legacy/plugins/* in that PR

* Like 441d9ed, but correct

* [Ingest] Convert `ingest` plugin to new platform `ingest_manager` plugin (#56262)

* Seed Ingest Manager as a new NP plugin

* Add contexts for core, deps, and config. Begin routing and nav UI

* Export NP ready request from top-level es_ui_shared/public/

* Add nav styling w/ theming, add useRequest hook

* Set up license and config server-side services; add test routes

* Move most types and constants into /common

* Initial pass at:
* data stream and agent config models
* data stream routes and schemas

* Initial pass at agent config api route handlers

* Change plugin id to camel case

* Fix circular schema dependency, add security as optional plugin

* Create appContext service, use request user info in agent config routes + libs

* Create default agent config

* Add default output host config, output typings, and create default output and its api key

* Move saved object mapping to new plugin

* Change data streams -> datasources

* Add legacy plugin to bootstrap mappings

* Adjust fleet's ingest dependencies

* Disable policies UI in Fleet

* Adjust EPM's ingest dependencies

* Adjust ingest manager base API route

* Adjust fleet's client side ingest dependencies

* Remove more ingest dependencies from fleet

* REMOVE MOST OF LEGACY INGEST PLUGIN

* Add section for agent configs in UI nav

* Allow useRequest and sendRequest consumers to specify typing for response

* Initial pass at porting over agent config list UI

* Port over agent config creation

* Port over delete agent config functionality

* Fix app routing

* Port over fleet setup routes

* Adjust fleet's ingest dependencies

* Make fleet happy path work, skip some tests (MESSY! :))

* Remove policy list UI code from fleet

* Change useRequestResponse error type

* Add missing agent config schemas and hooks

* Fix type check issues

* Register IM under management

* Fix type issues as a result of changes to use/sendRequest interfaces

* Make all ingest saved objects *not* space-aware

* Fix i18n path

* Fix app categories import

* Fix datasource package assets schema (array of asset objects)

* Seed Ingest Manager privileges to fix tests

* Change `features` to optional plugin instead of required

* Fix security privileges tests

* Fix feature test

* Fix duplicate enrollment key created for default agent config

* Fix fleet agent enrollment by catching agent config 404

* PR feedback

* First pass at deleting everything related to EPM & Fleet plugins

* Remove EPM-specific react-markdown

* Remove some unwanted differences from master.
Removed more EPM and Fleet changes

* React.FC -> React.FunctionComponent to match the pattern in master

* Selectively enable features based on config values

* Fix typing and(?) CI

* Enable xpack.ingestManger during tests

Follow example from xpack.endpoint flags

* Don't create BASE_URL value based on PLUGIN_ID

* Don't add optional routes. Use config for registry url

* Add README with some skeleton docs on tests, etc

* Undo changes to some files based on PR feedback

* Commit the result of 'yarn kbn run build -i @kbn/pm'

* Commit the result of 'yarn kbn run build -i @kbn/pm'

* WIP. But add some passing api integration tests

 └-: apis
   └-> "before all" hook
   └-: Ingest Manager plugin
     └-> "before all" hook
     └-: /agent_configs
       └-> "before all" hook
       └-> should get agent configs
         └-> "before each" hook: global before each
         └- ✓ pass  (42ms) "apis Ingest Manager plugin /agent_configs should get agent configs"
       └-> should create agent config
         └-> "before each" hook: global before each
         └- ✓ pass  (63ms) "apis Ingest Manager plugin /agent_configs should create agent config"
       └-> should have new agent config
         └-> "before each" hook: global before each
         └- ✓ pass  (41ms) "apis Ingest Manager plugin /agent_configs should have new agent config"
       └-> should delete that new config
         └-> "before each" hook: global before each
         └- ✓ pass  (1.0s) "apis Ingest Manager plugin /agent_configs should delete that new config"
       └-> should get datasources
         └-> "before each" hook: global before each
         └- ✓ pass  (26ms) "apis Ingest Manager plugin /agent_configs should get datasources"
       └-> should 404 from EPM package api
         └-> "before each" hook: global before each
         └- ✓ pass  (41ms) "apis Ingest Manager plugin /agent_configs should 404 from EPM package api"
       └-> "after all" hook
     └-> "after all" hook
   └-> "after all" hook

6 passing (1.2s)

* WIP

* Fix TS type errors.

Types are created tests. Should they come from test project?

* Add route to delete datasources (mirrors agent_configs api)

* Remove old ESArchiver files

* Add integration tests for each /agent_config & /datasources route

* Update README

Remove bash integration test scripts

* More updates to README

* Remove xpack.kueryAutocomplete from x-pack/.i18n.json

* Use default appRoute. We can't use /app/ingest (at least for now).

Looking at the app_router it seems like any route starting with `/app` must be `/app/:appId`.

I also don't think appRoute is fully supported. I'll follow up with Platform.

* Use appBasePath from app mount params for React Router basename

* Remove out-of-date comments

* Use the ES client from core

* Move License & Config services WIP. Pushing to share

* Move config & license services into App Context service.

* Remove FTR tests for Ingest Manager

* Remove license-related propperties

* Remove clusterClient properties

* Don't set this.security if not in dependencies

* WIP (failing) integration_test

* No more unknown key errors. Timeouts now

* Test routes with default (disabled) and manager-only flags

* Add tests to cover all permutations of flags (A, AB, AC, ABC)

* Use TS types vs config-schema in common & public

Move all @kbn/config-schema usage to server

Co-authored-by: Matt Apperson <me@mattapperson.com>
Co-authored-by: Jen Huang <its.jenetic@gmail.com>
Co-authored-by: Nicolas Chaulet <n.chaulet@gmail.com>
Co-authored-by: Sandra Gonzales <neptunian@users.noreply.github.com>
Co-authored-by: Nicolas Ruflin <spam@ruflin.com>
Co-authored-by: Sonja Krause-Harder <krauseha@gmail.com>
Co-authored-by: Brian Seeders <seeders@gmail.com>
Co-authored-by: Tyler Smalley <tylersmalley@me.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-18 21:30:38 -05:00
Spencer 8f37f6e10c
Unskip flaky tests (#57715)
* Revert "Skip flaky test (#57675)"

This reverts commit c965a9efa8.

* Revert "disable firefox smoke tests so we can fix flakiness out of band"

This reverts commit fe3864282a.

* Revert "skip flaky tests (#57643)"

This reverts commit b22045433e.

* Revert "skip flaky suite (#50018)"

This reverts commit b058dc2fe7.

* Revert "skip settings tests (#57608)"

This reverts commit 64625b282c.

* Revert "skip failing suite (#44631)"

This reverts commit 8aa718d11e.

* Revert "skip flaky suite (#44631)"

This reverts commit 6e4efdfa7c.

* Revert "skip flaky test (#57377)"

This reverts commit 59672ab5da.

* Revert "Skip save query tests (#57589)"

This reverts commit 431a1e9c89.

* remove hard coded timeouts

* Revert "Revert "disable firefox smoke tests so we can fix flakiness out of band""

This reverts commit 271f8814d5.

* Revert "remove hard coded timeouts"

This reverts commit 8b843d0aa6.

* wait for managementHome to exist, don't bail early if it's missing

* Revert "skip flaky suite (#45244)"

This reverts commit 0cee1a4adb.

* extend timeouts for common existsOrFail() calls

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-18 19:11:05 -07:00
Garrett Spong 05947ade76
[SIEM] [Detection Engine] Fixes Signals Table bulk selection issues (#56825)
## Summary

This PR fixes regressions around the bulk selection action, including:

* Incorrect total when opening/closing signals
* Selection total persisting after opening/closing signals
* `Select All` checkbox remaining selected after opening/closing signals
* Bulk action not being enabled after opening/closing via single action while others are selected

##### Incorrect total / persisted selection total
<details><summary>Before</summary>
<p>

![selection_persisted_wrong_count](https://user-images.githubusercontent.com/2946766/73814700-0d7faf80-47a1-11ea-9ec1-c6cb6a3d30c3.gif)

</p>
</details>

<details><summary>After</summary>
<p>

![selection_persisted_wrong_count_fix](https://user-images.githubusercontent.com/2946766/73814704-107aa000-47a1-11ea-9eb9-4f56d3d3f8c2.gif)
</p>
</details>


##### Bulk action not being enabled
<details><summary>Before</summary>
<p>

![selection_disabled_bulk_action](https://user-images.githubusercontent.com/2946766/73814695-09ec2880-47a1-11ea-8a37-ae35a19979ab.gif)
</p>
</details>

<details><summary>After</summary>
<p>

![selection_disabled_bulk_action_fixed](https://user-images.githubusercontent.com/2946766/73814701-0f497300-47a1-11ea-8c73-3a131bda59f6.gif)
</p>
</details>







### Checklist

Delete any items that are not applicable to this PR.

- [ ] ~Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~
- [ ] ~[Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~
- [ ] ~[Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~
- [ ] ~This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~
- [ ] ~This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)~
- [ ] ~This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~

### For maintainers

- [ ] ~This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
2020-02-18 17:05:32 -07:00
Tim Sullivan c47612f240
[Reporting] Unit test for screenshot observable (#57638)
[Reporting] test the screenshot observable
2020-02-18 16:20:53 -07:00
Jonathan Budzenski 76d475a64c
Refactor test entry by runner (#44679)
Over the last few years we've increased the number of test runners.
Entry points by test type have become too lage of a category for unique
names, so this moves top level test scripts under yarn and replaces test
types with the runner name.

e.g. `yarn test:browser` -> `yarn test:karma`

Closes #41133

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-18 16:21:36 -06:00
Davis Plumlee f6dc67470d
Alert list frontend pagination (#57142) 2020-02-18 15:21:10 -05:00
Vadim Dalecky 6436862dc5
Types (#57801)
* feat: 🎸 add Values<T>

* feat: 🎸 add UnionToIntersection<T> type

* refactor: 💡 use UnionToIntersection<T> in Canvas from @kbn/

* feat: 🎸 add PublicKeys<T> and PublicContract<T> types

* style: 💄 fix ESLint errors
2020-02-18 20:52:03 +01:00
Brandon Kobel 7763a6055a
Handling a 404 when the space's telemetry collector runs (#55921)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-18 11:47:01 -08:00
Kerry Gallagher 0a6c748cc8
[Logs / Metrics] New Platform migration (full cutover) (#54583)
* Fully migrates metrics and logs to the NP

Co-authored-by: Jason Rhodes <jason.matthew.rhodes@gmail.com>
Co-authored-by: John Schulz <github.com@jfsiii.org>
Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
2020-02-18 19:22:27 +00:00
Jonathan Buttner 4f27e1927a
[Endpoint] EDVT-72 EDVT-25 Initial Resolver Backend Refactored (#57593)
* Stubbed route, static tree
Changing commit author to me

* Starting the queries

* Built out children api

* using agent id instead of labels and implementing the get node route

* Adding pagination, need to write tests

* Removing track_total_hits because it defaults to 10k

* Allowing null for origin information

* Building out tests

* Adding more response tests

* Adding test for children route

* Forgot to save

* Reverting first commit and keeping my changes to resolver route

* Working search handler tests

* Adding api test

* Trying to figure out the query issue

* Working api tests

* A little refactoring of common types

* Fixing tests

* Some clean up and fixing bad merge

* Working api

* Changing phse0 names

* Refactoring duplicate code in route

* Adding test for count query and fixing api test

* Renaming phase 1 to elastic endpoint

* Removing test files without tests

* Restructuring things

* Building events for process handler

* Working unit tests

* Working integration tests

* Pagination test is failing

* More refactoring

* Add alternative fields to support other datasources

* Working refactored routes

* Strip out 'synthetic id' stuff

* allow ppid to be undefined

* Some clean up and fixing typescript lint errors

* Removing changes to alerts

* Remove the additional query with the _id cursor

* Use Buffer.from instead of new Buffer

* Fixing import

* Fix decoding

* Fix Promise return type

* Fixing linter used before assigned problem

* Removing unused import

* gzipping the test file

* Addressing feedback, more clean next cursor

* Fixing cast for search_after

* Fixing test failure and adding comments

* Fixing timestamp string type failure

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Andrew Stucki <andrew.stucki@gmail.com>
2020-02-18 14:22:14 -05:00
Yuliia Naumenko 1b15872ab8
Guide for creating alert / action types in the UI (#55963)
* Guide for creating alert type UI

* Type fixed

* Extended documentation for alert type and expression components usage

* fixed merge issues

* Added info for embedding create alert flyout

* Added alert type registration details

* Fixed table definition

* Fixed the rest of the tables styles

* Added builtin action types description

* Added example for action type

* Extended action create description

* Fixed some parts

* Fixed review comments

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Fixed review comments

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
2020-02-18 11:12:07 -08:00
Xavier Mouligneau fbf75e3391
[SIEM] fix circular dependency (#57729)
* fix Timeline url dependency

* fix circular dependency

* rename ColumnHeader to ColumnHeaderOptions
2020-02-18 13:45:20 -05:00
MadameSheema bca0d1c2be
refactors 'toggle-column' tests (#57845) 2020-02-18 19:03:01 +01:00
Yuliia Naumenko c07ff7174e
Alerting plugin migrate to Kibana platform (#57635)
* Moved alerting plugin to new platform

* Fixed type checks

* Fixed failing tests

* Fixed functional tests

* Fixed plugin context initialization

* small typo

* Fixed type checks

* Fixed create alert schema

* Moved alerting files to Kibana platform folder

* Fixed duration validation

* Fixed find page size

* Fixed type check

* Fixed due to comments

* Fixed merge issues

* Added missing

* Fixed alerting functional tests

* Fixed tests

* Fixed update schema validation

* Added throttle update

* Fixed failing tests

* test

* fixed setup alerting dependencies for siem and monitoring plugins

* Fixed siem setup dependancies
2020-02-18 09:05:56 -08:00
nnamdifrankie b5090fae3b
[Endpoint] EMT-128: add os variant and agent name (#57618)
[Endpoint] EMT-128: add os variant and agent name
2020-02-18 11:59:24 -05:00
Frank Hassanabad 7c6e6bf08a
[SIEM][Detection Engine] Removes internal tags when copying signals from rules
## Summary

Removes internal tags when copying tags from rules to the signals

Before where you can see internal tags going in:
<img width="1565" alt="Screen Shot 2020-02-14 at 5 17 36 PM" src="https://user-images.githubusercontent.com/1151048/74578011-6d1f4d00-4f4f-11ea-9057-e89896944af8.png">

After where you can see internal tags not being pushed in:
<img width="1555" alt="Screen Shot 2020-02-14 at 5 22 52 PM" src="https://user-images.githubusercontent.com/1151048/74578023-81fbe080-4f4f-11ea-8f37-86f7e5fe29f5.png">

Notice that these two internal tags should no longer be there:
```
__internal_immutable:false
__internal_rule_id:3b1bcf8a-7826-43b8-833b-6485aa700c41
```

### Checklist

Delete any items that are not applicable to this PR.

~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

~~- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)~~

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
2020-02-18 09:45:18 -07:00
Melissa Alvarez 6685bd000c
[ML] New Platform server shim: update job validation routes (#57644)
* wip: convert jobValidation routes to NP

* fix typo in np migration docs

* replace legacy es plugin with callAsInternalUser from context

* add schema info for job validation routes

* update types and schema for job + cardinality validation

* update bucketSpanEstimator test

* update job validation schema
2020-02-18 11:25:33 -05:00
Nathan Reese c5ab9828b4
[Maps] only request field in docvalue_fields when the field supports doc values (#57372)
* [Maps] only request field in docvalue_fields when the field supports doc values

* do not include scripted fields in sourceOnlyFields

* review feedback

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-18 09:24:41 -07:00
Shahzad 326a162b42
[Uptime] Fix/filter group autocomplete (#57686)
* added autocomplete

* snaps

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-18 16:54:29 +01:00
Walter Rafelsberger 60f7081e08
[ML] Transform: Fix transform wizard query autocomplete. (#57833)
Fixes a regression introduced by #56358. We're reusing the KqlFilterBar from the ML plugin in the transform plugin and missed updating the dependency management. Note this PR is only about fixing that regression. Future work on NP migration should take care of cleaning up the dependency management in the transforms plugin in general.
2020-02-18 16:03:31 +01:00
Pierre Gayvallet 055c61110f
migrate savedObjects routes to core (#56734)
* migrate `get` route

* migrate `create` route

* migrate `delete` route

* migrate `find` route

* migrate `update` route

* migrate `bulk_get` route

* migrate `bulk_create` route

* remove route-related mixin tests

* migrate `bulk_update` route

* fix expectTypeRequired assertion

* migrate `log_legacy_imports` route

* migrate `export` route

* fix karma tests

* array is better than object in some situations.

* remove prototype pollution tests

* adapt ftr assertions

* adapt ftr assertions

* adapt yet more ftr assertions

* migrate `import` route

* fix test tests

* fix getSortedObjectsForExport usages

* fix snapshots

* fix so ui exports usages due to merge

* create router with prefix

* creates `savedObjects` namespace config in addition to `migrations`

* migrate `resolve_import_errors` route

* remove old types file

* fix FTR assertion

* remove types parameter from copy_to_space

* move route tests to integration_tests

* use byteSize instead of number

* fix unit tests

* add has_reference query parameter

Co-authored-by: Mikhail Shustov <restrry@gmail.com>
2020-02-18 15:40:21 +01:00
MadameSheema c8f9fca8da
'search or filter' test refactor (#57826) 2020-02-18 15:37:21 +01:00
patrykkopycinski ad5daba2ea
[SIEM] Replace AutoSizer with use-resize-observer (#56588) 2020-02-18 14:53:31 +01:00
MadameSheema 66e685b4a8
refactors 'flyout-button' tests (#57572)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-18 10:03:43 +01:00
Victor Martinez 446fda62f2
[jenkins] Notify GH Checks for the apm-ui e2e pipeline (#52900) 2020-02-18 08:25:14 +00:00
James Gowdy 3c51fb0314
[ML] File data viz fix index pattern warning after index change (#57807) 2020-02-18 07:16:40 +00:00
James Gowdy c31c7ee4c7
[ML] Adding get buckets endpoint wrapper (#57752)
* [ML] Adding results buckets endpoint wrapper

* removing unnecessary spread operator

* correcting timstamp format in api doc

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-17 15:06:42 +00:00
Joe Reuter 9388ff7b43
Fix auto refresh in visualizations and lens (#57667) 2020-02-17 13:52:53 +01:00
Cauê Marcondes f49581ce34
[APM] Divide "Actions menu" into sections to improve readability (#56623)
* transaction actions menu

* transaction actions menu

* fixing pr comments

* fixing pr comments

* fixing pr comments

* fixing pr comments

* fixing unit test

* fixing unit test

* using moment to calculate the timestamp

* renaming labels

* Changing section subtitle

* fixing unit tests

* replacing div for react fragment

* refactoring

* removing marginbottom property

* div is needed to remove the margin from the correct element
2020-02-17 12:05:46 +00:00
Alejandro Fernández Haro 5c7af8656f
[Telemetry] Fix bug introduced in #55859 (#57441)
* [Telemetry] Refactor to TS Monitoring telemetry_collection files

* [Telemetry] Fetch side documents generated by monitoring to build up the Kibana plugins stats

* Update x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_beats_stats.ts

Co-Authored-By: Ahmad Bamieh <ahmadbamieh@gmail.com>

* Fix import in test file

* Move mocha tests to Jest + TS

* Fix extended telemetry in functional tests

* Fix types

* [Telemetry] Fix bug in usage_collector wrong function override

* Revert integration tests (change not needed)

Co-authored-by: Ahmad Bamieh <ahmadbamieh@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-17 11:21:01 +00:00
Walter Rafelsberger 54f5cc1ce3
[ML] Anomaly Detection: Fixes hiding date picker for settings pages. (#57544)
- Fixes hiding the global date picker on anomaly detection settings pages.
- Consolidates various timefilter usages for enabling/disabling the date picker into a useTimefilter() hook.
2020-02-17 11:53:42 +01:00
James Gowdy 545240065a
[ML] Categorization examples privilege check (#57375)
* [ML] Categorization examples privilege check

* adding privileges check to endpoint

* fixing typo

* moving privilege check to router

* removing unused variable

* rebasing master

* removing comment

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-17 10:47:50 +00:00
Jean-Louis Leysens 3d7bae4ed2
Move Ace XJSON lexer-rules, worker and utils to es_ui_shared (#57563)
* Move mode and lexer rules to shared space

* Update searchprofiler mode rules

* Moved x-json worker out of searchprofiler and into es_ui_shared (for use in Watcher)
Renamed ace/mode -> ace/modes

* Moved collapse and expand literal string functions to es_ui_shared

* Fix some imports
Enable Watcher editor to parse XJson using XJsonMode

* Fix imports

Import JSON highlight rules in XJSONHighlight rules

* Move console_lang, fix Jest tests

Exporting console_lang through the es_ui_shared/public barrel caused the XJsonMode to imported to a index_management too and any other plugin that may
import something from that directory. console_lang was moved to it's own top level directory es_ui_shared/console_lang.

We also included a mock for tests using XJsonMode to import from console_lang.

* Fixed OSS Jest tests

Console Jest tests were still failing because they did not mock out the raw-loader imported worker file

* Expand triple quotes in editor

Upon entering the advanced watcher creation view, the JSON should be scanned for triple quote expansion

* Bring all editors themes in line

Editors had github theme, which diverged from the textmate theme used in Console and SearchProfiler

* Added XJSON mode to simulate alternative input editor

Slight refactor to the logic for using XJSON mode. Created an adhoc hook for wrapping the
logic of useState and moved lanugage util imports there too to reduce the number of imports
in both the watcher form and simulate tabs in advanced creation.

* Moved x-json worker to x-pack

x-json worker is currently only used inside of x-pack. Also testing
for if this will fix the CI/prod build

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-17 11:06:20 +01:00
Jean-Louis Leysens 26fdc4a6b3
[Upgrade Assistant] Fix filter deprecations search filter (#57541)
* Made eui search field not a controlled component
Added validateRegExpString util

* Update error message display. Use EuiCallOut and i18n to replicate other search filter behaviour, e.g. index management.

* Remove unused variable

* Update Jest snapshot

* Updated layout for callout

The previous callout layout looked off-center next to the controls in the table.

* Update copy and remove intl

Update "Filter Invalid:" to sentence case
Remove inject intl wrapper from CheckupControls component
Remove unnecessary grow={true}

* Updated Jest component snapshot

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-17 11:03:57 +01:00
Dima Arnautov 84be262075
[ML] New Platform server shim: update indices routes (#57685)
* [ML] NP indices routes

* [ML] fix error function

* [ML] fix createAndOpenUrl function
2020-02-17 10:59:07 +01:00
patrykkopycinski f4d29abf1c
Bump redux dependencies (#53348) 2020-02-17 09:58:54 +01:00
Sébastien Loix 8e17fdabd4
[Index management] Client-side NP ready (#57295) 2020-02-17 14:22:07 +05:30
Patrick Mueller 5d3797ee0b
change id of x-pack event_log plugin to eventLog (#57612)
change id of x-pack event_log plugin to eventLog
2020-02-16 20:10:35 -05:00
Patrick Mueller f998174898
[eventLog] get kibana.index name from config instead of hard-coding it (#57607)
fixes https://github.com/elastic/kibana/issues/55629
2020-02-16 17:55:52 -05:00
Ben Skelker 67087e34d1
fixes ui titles (#57535)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-16 10:39:58 +02:00
Joe Portner 3b232ae735
Fix login redirect for expired sessions (#57157) 2020-02-15 19:32:16 -05:00
Frank Hassanabad 94c856dd42
[SIEM][Detection Engine] Fixes queries to ignore errors when signals index is not present
## Summary

Fixes a bug where if you try to query the signals index and it is not present you would get an error that would bubble up to the UI.

Before:
<img width="824" alt="Screen Shot 2020-02-13 at 12 57 55 PM" src="https://user-images.githubusercontent.com/1151048/74499587-74881d00-4ea1-11ea-93b0-8d7258f79404.png">

After:
<img width="790" alt="Screen Shot 2020-02-13 at 8 43 28 PM" src="https://user-images.githubusercontent.com/1151048/74499619-9386af00-4ea1-11ea-889b-cb1853e399e3.png">

<img width="804" alt="Screen Shot 2020-02-13 at 8 43 34 PM" src="https://user-images.githubusercontent.com/1151048/74499624-971a3600-4ea1-11ea-862b-9695ecbadcbe.png">


Also fixes a regression bug with error toasters showing up when they shouldn't because of a signals index not existing. This only effects 7.6.x and master and is _not_ part of 7.6.0 at the moment.

* https://github.com/elastic/kibana/issues/57641

### Checklist

Delete any items that are not applicable to this PR.

~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

~~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~~

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

~~- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)~~

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
2020-02-14 20:14:59 -07:00
Alison Goryachev 6e3790537d
[Remote clusters] Migrate client-side code out of legacy (#57365) 2020-02-14 21:10:33 -05:00
spalger 0cee1a4adb skip flaky suite (#45244) 2020-02-14 18:46:01 -07:00
Patrick Mueller 96c39a5a14
change slack action to only report on whitelisted host name (#57582)
Previously, when using the slack action with a url which was not whitelisted, the entire URL was reported in the error.  With this change, only the hostname is reported in the error.
2020-02-14 18:29:50 -05:00
Peter Pisljar 78bff535e0
moving visualize/utils to new platform (#56650) 2020-02-14 18:16:49 -05:00
Chris Roberson e319269e18
[Monitoring] Support shipping directly to the monitoring cluster (#57022)
* Support shipping directly to the monitoring cluster

* Add timestamp

* PR feedback

* Use utc
2020-02-14 16:07:44 -05:00
Mike Côté 918c0dec9f
Increase stability when initializing the Elasticsearch index for the event log (#57465)
* Fix ILM policy creation

* Handle errors thrown in scenario multiple Kibana instances are started at the same time

* Fix tests and cleanup

* Start adding tests

* Refactor tests, add index template failure test

* Create cluster client adapter to facilitate testing and isolation

* Fix places calling callEs still

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-14 15:38:45 -05:00
Tim Sullivan 34ae99b516
[Reporting/New Platform] Provide async access to server-side dependencies (#56824)
* [Reporting/New Platform] Provide async access to server-side

* consistent name for reportingPlugin

* Prettier changes

* simplify reporting usage collector setup

* add more tests

* extract internals access to separate core class

* fix tests

* fix imports for jest and build

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-14 12:36:08 -07:00
Paul Tavares fe21356020
[Endpoint] Policy List UI route and initial view (#56918)
* Initial Policy List view

* Add `endpoint/policy` route and displays Policy List
* test cases (both unit and functional)

Does not yet interact with API (Ingest).
2020-02-14 14:14:39 -05:00
Pete Harverson 73cb0aa840
[ML] New Platform server shim: update filters routes to use new platform router (#57597)
* [ML] Update filters routes to use new platform router

* [ML] Edits to filters route following review

* [ML] Edits following review and fix job service api docs

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-14 19:08:02 +00:00
Josh Dover 6bd09d616f
Fix maybe behavior with object type (#55932) 2020-02-14 12:06:59 -07:00
Greg Thompson 0abfd3c72f
Upgrade EUI to v19.0.0 (#57284)
* eui to v19.0.0

* typescript updates; idAria removal

* src snapshot updates

* mock euicode and euicodeblock for jest

* x-pack snapshot updates

* mock euicode for jest

* more euicode snapshots

* mock euicode in storyshots

* types/enzyme yarn.lock

* sidenav type update
2020-02-14 13:06:31 -06:00
Corey Robertson 98564f857d
Update Canvas usage of Storage from kibana-utils (#55595)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-14 10:57:06 -05:00
James Gowdy 52b4fe7404
[ML] Categorization wizard functional tests (#57600)
* [ML] Categorization wizard functional tests

* changes based on review

* some idiot left his own name in the code
2020-02-14 15:54:49 +00:00
Nathan Reese d27fc476dd
[Maps] refactor Join component to remove componentDidUpdate (#57518)
* [Maps] refactor Join component to remove componentDidUpdate

* [Maps] refactor LayerPanel to remove getDerivedStateFromProps

* consolidate async layer state loading into LayerPanel component

* fix jest snapshot

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-14 08:36:49 -07:00
Candace Park 1492d5a372
[Endpoint] Task/basic endpoint list (#55623)
* Adds host management list to endpoint security plugin

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-14 10:12:34 -05:00
Robert Oskamp f0cb03e599 Transform functional tests - disable saved search test 2020-02-14 16:08:10 +01:00
Robert Austin a790f61460
Resolver: Animate camera, add sidebar (#55590)
This PR adds a sidebar navigation. clicking the icons in the nav will focus the camera on the different nodes. There is an animation effect when the camera moves.
2020-02-14 09:41:22 -05:00
Mike Côté c965a9efa8
Skip flaky test (#57675) 2020-02-14 08:55:13 -05:00
Walter Rafelsberger cefe28c1f4
[ML] Fix single metric viewer chart resize. (#57578)
Fix to trigger a chart update with the correct width when resizing the browser window. Previously after a browser refresh, or opening the view from a bookmarked URL, the chart would not resize until a state change was made to the view (such as moving the zoom slider or altering the time range).
2020-02-14 14:52:04 +01:00
Angela Chuang 0adda9d270
[SIEM] Remove additional props for matrix histogram (#54979)
* update DNS histogram

* fix indent

* hide dropdown if only one option provided

* update DNS histogram

* fix types

* wip

* isolate matrix histogram on server side

* fix type for graphql

* fix types

* fix tests

* fix types

* fix types

* add unit test

* add unit test

* fix types

* split histogram configs to an object

* an idea to simplify more

* add unit test

* remove updateDateRange passing down to matrixHistogram

* change histogramType to enum

* handle the case which config not available

* fix review

* fix review II

* fix parser for dns histogram

* revert change

* isolate parsers

* fix unit

Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com>
2020-02-14 13:44:18 +00:00
Joe Reuter 948bfa9950
Clean up shims of Graph, Home, Dashboard, Visualize (#57331) 2020-02-14 14:11:18 +01:00
Walter Rafelsberger c1cf4896a5
[ML] Fix brush visibility. (#57564)
Fixes brush visibility. The brush will no longer be hidden if it covers the full available timespan. Removes all code that was earlier used to manage brush visibility.
2020-02-14 13:07:54 +01:00
Dario Gieselaar 979c1d24fa
[APM] Add xpack.apm.enabled key to config schema (#57539)
Closes #57418.
2020-02-14 13:06:57 +01:00
igoristic f8b06e3726
[Monitoring] Fixed logs timezone (#57611)
* Fixed logs timezone

* Passing tz as a param

* Fixed tests

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-14 06:29:49 -05:00
Cauê Marcondes 1aadf3e021
[APM] Custom actions: Settings list page for managing custom actions (#56853)
* creating customize ui and empty prompt

* new custome ui page, with create custom action flyout

* removing import

* removing import

* fixing translations

* fixing pr comments

* fixing pr comments

* fixing translations

* fixing labels

* renaming

* fixing translations
2020-02-14 10:35:33 +00:00
Joe Reuter 104d4abecf
Migrate vega and graph configs to new platform (#57011) 2020-02-14 11:10:41 +01:00
Ryland Herrick 8513498e2d
[SIEM] Final Shimming/Prep for Server NP Migration (#56814)
* Route all our server setup through the plugin

Next we'll be trimming down ServerFacade to the final few dependencies,
and using our plugin dependencies for the rest.

* Clean up server plugin exports

For now, let's try to simplify our typings by exporting our plugin's
dependencies from the plugin itself, since we know it already knows
about them.

* Move DE Routes to to conventional location

I'm throwing the alerting registration in the plugin for now, too.

* Loosen up our RequestFacade

Now that we've audited our use of request objects, we can switch to the
more friendly LegacyRequest that all our utilities are expecting.
LegacyRequest doesn't have plugins, either, so our only remaining errant
usage is retrieving clients from it, which we call out explicitly.

* Remove uses of 'src' alias

This just threw an error on startup, so I'm fixing all of them to be
safe.

* Fix types of our GraphQL requests

These come through as new KibanaRequests and not as the LegacyRequest
that I had incorrectly typed them as.

I'm only caring about the `body` property right now, since that's all we
really deal with, and in testing it was all that was populated in our
actual requests, too.

* Initialize our routes with SetupServices

We're using the legacy version for now, but ServerFacade will be gone by
the end of the migration.

* Swap legacy spaces plugin for NP

This changes the signature of getIndex, which is used in quite a few
places. We'll see how bad that looks in the next commit.

* Remove unneeded typing

We're already ignoring another portion of the platform shim due to it
being incompatibly typed, so we might as well remove this.

* WIP: Converting our DE routes to use consolidated services

This contains our legacy stuff for now. Eventually, it will only be our
NP services. This breaks a few tests due to the way createMockServer
works, but I'll clean that up momentarily.

* Fix DE routing tests following refactor

The createMockServer helper does a few things differently:

* returns mocked LegacyServices that can be passed to our route
factories
* does not return a server object as we don't need it, except for:
* returns an inject function that we can use to execute a request

We're casting our services because we're only mocking a subset of what
LegacySetupServices entails.

Mainly, this allows me to continue moving
things off of ServerFacade without significant refactoring of tests.

* Fix incompatible request types

Unfortunately, LegacyRequest does not allow a request's `query` values
to be anything other than a string or string[]. However, in practice
they can (and are) objects, booleans, etc.

Our request types (e.g. QueryRequest) are correct, but because service
functions are LegacyRequest's implementation of `query`, we need to cast
them lest a type error occur.

For now, the easiest solution is to do this in the request handler:
intersecting with our RequestFacade (LegacyRequest) allows us to both a)
pluck our query params off the request and b) pass the request to NP
services.

* Move our use of encryptedSavedObjects to NP

We're just retrieving a boolean from it right now, which is also guarded
against the plugin being unavailable. If this usage becomes more
widespread, we'll make this available at a higher level, probably in
redux.

* Use NP elasticsearch client

* Simplifies our generic type to accept two arguments: params and the
return value
  * Options is fixed and we were never specifying anything meaningful
  there
* Updates all DE cluster calls to use callWithRequestFactory

* Update DE mocks with NP elasticsearch

* createMockServer now returns the callCluster mock, so that you can easily
mock a client response without needing to know the details of how we
define that function

* Remove savedObjects dependency from our legacy dependencies

This was added during a refactor, but we were never actually using this
code. We always retrieve the client from the request via
getSavedObjectsClient.

I think that the NP client has a slightly different interface, so we're
going to create a helper to retrieve it from the request, same as we do
with the elastic client.

In the future, both of these will be available on the request context,
and we can remove the helpers entirely.

* WIP: Convert services to stateful object

In trying to migrate over the savedObjectsClient, I realized that it is
not available during setup in the same way that the ES client is.

Since our routes need pieces from both setup and start phases, I've
added a Services class to accumulate/transform these services and expose
scoped clients when given a legacy request.

In New Platform, these clients will be available upon the request
context and we should be able to remove getScopedServicesFactory for our
routes. A subset of Services' functionality may still be useful, we'll
see.

* WIP: Converting routes to use Services factory

I decided that config shouldn't live in here, as this is only
client-related stuff. Probably going to rename this ClientsService.

Things are still very much broken.

* WIP: Qualifying our Service to ClientsService

This gets us client-related services (ES, SavedObjects, Alerts), but it
is independent of any configuration, which is gonna be another service.

* Fix types on getIndex function

This is a weird helper, I'm not really sure where it should go.

* Our ClientsService is a clients ... service

Return clients, as this is closer to what we'll get in the request
context.

* Clean up our server types

* Declare legacy types at top-level file
* Don't re-export from the plugin solely for convenience, that's a
slippery slope straight to circular dependencies
* Remove RequestFacade as it was a facade for LegacyRequest
* Rename ServerFacade/LegacySetupServices to just LegacyServices

* Refactor mocks for new architecture

* Separates config, server, and client mocks, as they're now independent
in our system, route-wise.
* gets one test working, the rest will follow.

* Simplify our routing mocks

* Adds mock for our new clients service
* Greatly simplifies both server and mock configs
* Renames factory method of client service

* Loosen graphQL endpoint validations

These work fine in production, but it's graphQL so we don't really need
the additional validation of these endpoints, and we weren't leveraging
these types anywhere in Typescript land.

Additionally, these restrictive validations prevent the initial
introspection calls done by graphiQL to get schema information, and
without schemae graphiql wasn't very helpful. This is a dev-only
problem, but that's the audience of graphiql.

* Remove unused graphql endpoint

This was only registered in dev mode; I thought that it was needed by
graphiql. However, after digging further I realized that graphiQL also
only makes POST calls to our real graphQL endpoint, so this route is
unnecessary.

* Reduce our dependence on PluginInitializerContext

After a little more introspection I realized our FrameworkAdapter
doesn't need the kibana version. It was only used in order to make a dev
request via (graphiql), but even that can be performed with a simpler
xsrf header.

This meant that we really only wanted to know whether we're in
production or not, so instead we pass that simple boolean to the
constructor.

* Fix FrameworkAdapter type

We no longer need this property.

* Update detections route tests

Uses the new routes interfaces, and our corresponding new mocks.

* Remove unnecessary null checks

Our savedObjectsClient is always going to be there.

* Remove unused type

YAGNI

* Remove unused savedObjects client

Turns out we were only destructuring this client for the null check.

* Handle case where spaces is disabled

We already null-coalesce properly in the clients service, but this
property access was missed.

* Return default signals index if spaces are disabled

* Remove unnecessary casting of our alerts client mock

I think that this was the result of us importing the wrong AlertsClient
type, or perhaps the types were out of sync. Regardless, they work now.

* Return the 'default' space even when spaces are disabled

This will allow users with spaces disabled to enable spaces without
losing data. The tradeoff is that they may be surprised when signals
don't exist within their configured xpack.siem.signalsIndex.

* Account for spaces being disabled in ClientsService

* Updates types to reflect that spaces may be unavailable
* Adds a test for getSpaceId's behavior when spaces are disabled

* Fix false positives in query signals routes tests

* Refactors mock expectations so that they're actually evaluated; they
can't go within a mockImplementation call as it's evaluated in the wrong
scope.
* Fixes duplicated test to use the proper assertions

* style: Prefer null coalescing over ternary
2020-02-13 22:10:27 -06:00
Jonathan Budzenski b22045433e
skip flaky tests (#57643) 2020-02-13 19:03:26 -06:00
spalger b058dc2fe7 skip flaky suite (#50018) 2020-02-13 15:21:23 -07:00
Jonathan Budzenski 64625b282c
skip settings tests (#57608) 2020-02-13 16:19:51 -06:00
spalger 8aa718d11e skip failing suite (#44631) 2020-02-13 15:16:48 -07:00
Steph Milovic ad600c8cd3
[SIEM] [Case] Initial UI (#57283) 2020-02-13 15:02:32 -07:00
Joe Portner 5b5421c5af
Fix detection of "system requests" in plugins (#57149)
This aligns plugin usage with the new way that the Kibana Platform
handles checking for system requests.
2020-02-13 16:33:17 -05:00
Melissa Alvarez fdef02617e
[ML] New Platform server shim: update job service schema (#57614) 2020-02-13 14:13:59 -07:00
spalger 6e4efdfa7c skip flaky suite (#44631) 2020-02-13 13:40:55 -07:00
Casper Hübertz 5fe53d1cd6
[APM] Update monospace font family variable (#57555)
* [APM] Remove fontFamily variable (not in use)

* [APM] Update fontFamilyCode font family

* Update snapshots
2020-02-13 21:05:28 +01:00
spalger 59672ab5da skip flaky test (#57377) 2020-02-13 12:34:36 -07:00
Jonathan Budzenski 431a1e9c89
Skip save query tests (#57589)
Several tests using the
savedQueryManagementComponent.saveNewQueryMissingOrFail method have been
failing with 'waiting for element'.  Temproary adding a skip for tests
using this method

Related #50018
Related #44631
Related #45348
2020-02-13 12:30:22 -07:00
Nathan Reese 6b62f5a175
[Maps] allow simultaneous opening of multiple tooltips (#57226)
* split TooltipPopover from TooltipContent

* display multiple tooltips

* hack to fix spacing

* hover tooltip

* fix jest tests for new props

* update snapshots

* simplify jest tests

* avoid opening up multiple tooltips in same location

* remove duplicated code

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-13 12:09:42 -07:00
Shahzad 05bf3eeebd
[Uptime] Fix/host connected components (#56969)
* added test for pages

* fixed types

* moved redux logic to connected

* comment

* update type

* type fix
2020-02-13 18:34:18 +01:00
Melissa Alvarez fd1386ed18
[ML] New Platform server shim: update job service routes to use new platform router (#57403)
* wip: convert jobService route file to TS and use NP router

* add schema definitions for route params

* add api docs description for routes

* update schema and rename client

* update calendarManager

* fix typo in schema

* use NP context savedObjectsClient for rollup true

* request no longer passed to JobServiceProvider

* update anomalyDetectors schema for job update

* add missing key to anomalydetectors schema
2020-02-13 12:12:28 -05:00
Nathan Reese 3f3969dedf
[Maps] Fix document source top hits split by scripted field (#57481)
* [Maps] Fix document source top hits split by scripted field

* fix i18n message

* review feedback

* remove unneeded scss file
2020-02-13 09:22:36 -07:00
James Gowdy 02319b7da8
[ML] Categorization field example endpoint tests (#57471)
* [ML] Categorization example endpoint tests

* adding data

* removing debug code

* adding endpoint error test

* updating version in archive
2020-02-13 13:11:31 +00:00
Marta Bondyra c333576a13
[Lens] Filter out pinned filters from saved object of Lens (#57197) 2020-02-13 13:59:27 +01:00
Joe Reuter 4437858fe3
Lens client side shim cleanup (#56976) 2020-02-13 13:54:51 +01:00
Nathan Reese 717d471a23
[Maps] do not show border color for icon in legend when border width is zero (#57501)
* [Maps] do not show border color for icon in legend when border width is zero

* fix jest tests

* fix jest tests

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-13 05:52:02 -07:00
MadameSheema 83cce379ad
refactors 'data-providers' tests (#57474) 2020-02-13 12:31:40 +01:00
Ahmad Bamieh 06df2b0db6
[Telemetry] Migrate public to NP (#56285)
* NP telemetry plugin barebones

* fully migrate telemetry sender

* license plugin to use NP telemetry

* fully migrated public to NP

* finish components testing

* fix all tests

* self code review

* remove commented code

* bracket notication for private methods

* bracket notication for private methods

* update license management tests

* afharo code review fixes

* type safe private method access in tests

* fix typecheck

* more type check fixes

* i18n check

* fix welcome page tests

* i18n optedInNoticeBanner title

* fix advanced settings field settings

* field name

* fix home snapshots

* listen to app id change

* NP code review fixes

* NP code review fixes

* update telemetry configs with np deprecations

* pass telemetry from setup instead of npStart

* type check

* update core snapshots with new api exposed

* remove debugging logs

* update home contract

* update home contract

* fix test eslint import

* navigate back to dashboard before start of next case for reporting

* gitignore reporting failure_debug generated dir

* use gotoDashboardEditMode instead of switch

* = instead of :

* merge master

* escape unused forced types in Field

* rename mock to mocks for eslint

* Update src/plugins/telemetry/public/components/telemetry_management_section.tsx

Co-Authored-By: Alejandro Fernández Haro <afharo@gmail.com>

* fix save/clear type

Co-authored-by: Alejandro Fernández Haro <afharo@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-13 09:44:01 +02:00
Gidi Meir Morris c5a60b94a9
address flaky test where instances might have different start… (#57506) 2020-02-13 06:35:18 +02:00
Spencer 4e8ab56497
build immutable bundles for new platform plugins (#53976)
* build immutable bundles for new platform plugins

* only inspect workers if configured to do so

* [navigation] use an index.scss file

* add yarn.lock symlink

* set pluginScanDirs in test so fixtures stay consistent

* cleanup helpers a little

* fix type error

* support KBN_OPTIMIZER_MAX_WORKERS for limiting workers via env

* test support for KBN_OPTIMIZER_MAX_WORKERS

* expand the available memory for workers when only running one or two

* add docs about KBN_OPTIMIZER_MAX_WORKERS environment variable

* fix README link

* update kbn/pm dist

* implement bundle caching/reuse

* update kbn/pm dist

* don't check for cache if --no-cache is passed

* update renovate config

* standardize on index.scss, move console styles over

* add support for --no-cache to cli

* include worker config vars in optimizer version

* ignore concatenated modules

* update integration test

* add safari to browserslist to avoid user-agent warnings in dev

* update docs, clean up optimizer message/misc naming

* always handle initialized messages, don't ignore states that are attached to specific events

* reword caching docs, add environment var to disable caching

* tweak logging and don't use optimizer.useBundleCache as that's disabled in dev

* handle change notifications

* batch changes for 1 second

* rename CompilerState type to CompilerMsg

* getChanges() no longer needs to assign changes to dirs

* remove unused deps

* split up run_worker.ts and share cacheKey generation logic

* add a couple docs

* update tests and remove unused imports

* specify files when creating bundle cache key

* remove one more unused import

* match existing dev cli output more closely

* update kbn/pm dist

* set KBN_NP_PLUGINS_BUILT to avoid warning in CI

* avoid extending global window type

* add note to keep pluginScanDirs in sync

* pass browserslistEnv in workerConfig so it is used for cache key

* load commons.bundle.js in parallel too

* emit initialized+success states if all bundles are cached

* load bootstraps as quickly as possible

* skip flaky suite

* bump

* update jest snapshots

* remove hashing from cache key generation

* remove unnecessary non-null assertion

* improve docs and break up Optimizer#run()

* remove unused import

* refactor kbn/optimizer to break up observable logic, implement more helpful cache invalidation logic with logging

* fix tests

* add initializing phase

* avoid rxjs observable constructor

* remove unnecessary rxjs helper, add tests for bundle cache

* update consumers of optimizer

* update readme with new call style

* replace "new platform" with "kibana platform"

* fix a couple more renames

* add support for several plain-text file formats

* fix naming of OptimizerMsg => OptimizerUpdate, use "store" naming too

* one more OptimizerMsg update

* ensure bundles are not cached when cache config is false

* test for initializing states and bundle cache events

* remove unnecessary timeout change

* Remove unnecessary helpers

* Add tests for BundleCache class

* Add tests for Bundle class

* test summarizeEvent$

* missing paths are no longer listed in mtimes map

* add tests for optimizer/cache_keys

* Add some extra docs

* Remove labeled loop

* add integration test for kbn-optimizer watcher components

* querystring-browser removed

* tweak logging a smidge, improve info and final message

* remove unused imports

* remove duplication of getModuleCount() method

* move type annotation that validates things

* clear up the build completion message

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 19:42:42 -07:00
Devin W. Hurley ee6386b71f
[SIEM] [Detection Engine] Reject if duplicate rule_id in request payload (#57057)
* prevents creation of rules when duplicate rule_id is present

* adds unit test to reflect change

* genericizes duplicate discovery functions, allows creation of non-duplicated rules even when duplicates are discovered, keeps same return type signature, updates relevant test for duplicates in request payload

* utilizes countBy and removes reduce in favor of a filter on getDuplicates function

* fix type

* removes skip from e2e test for duplicates on bulk create, updates expected response in e2e test, fixes bug where duplicated error messages appeared for each instance of a duplicated rule_id (found this one through the e2e tests)! Adds unit test to catch this case.

* getDuplicate returns empty array instead of null, removes unnecessary return logic

* removes null coalescing from includes in filter

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 21:13:43 -05:00
Brandon Kobel bc8a41a886
Add autocomplete="off" for input type="password" to appease the scanners (#56922)
* Add autocomplete="off" for input type="password" to appease the scanners

* Using new-password instead of off for the new/confirm passwords

* Setting more autoComplete="new-password" attributes

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 16:02:11 -08:00
Ryland Herrick fef3a2958c
Use default spaces suffix for signals index if spaces disabled (#57244)
Addresses #57221.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 17:38:18 -06:00
Andrea Del Rio 0faab4aa48
[Alerting] Create alert design cleanup (#56929) 2020-02-12 14:58:15 -08:00
Nathan Reese be7daa8057
[Maps] Autocomplete for custom color palettes and custom icon palettes (#56446)
* [Maps] type ahead for stop values for custom color maps and custom icon maps

* use Popover to show type ahead suggestions

* datalist version

* use EuiComboBox

* clean up

* wire ColorStopsCategorical to use StopInput component for autocomplete

* clean up

* cast suggestion values to string so boolean fields work

* review feedback

* fix problem with stall suggestions from previous field

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 14:23:47 -07:00
Gidi Meir Morris fd193fdf59
[Alerting] make actionGroup name's i18n-able (#57404)
We want to make the Action Group i18n-able for display in the AlertDetails page, so instead of just a list of ids, the AlertType now registers an object where key is the id and value is the human readable, and translatable, value.
2020-02-13 10:21:48 +13:00
Gidi Meir Morris d00adca730
fixed flaky test (#57490) 2020-02-13 09:58:16 +13:00
Mike Côté 3da8a76fc2
Disable action plugin functionality when ESO plugin is using an ephemeral encryption key (#56906)
* Disable actions client when ESO using generated key

* Add test for getActionsClientWithRequest

* Add other part to plugin.test.ts

* Cleanup tests a bit

* Cleanup tests

* plugin.test.ts cleanup

* Add warning logs on setup

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 13:49:16 -05:00
Alexey Antonov deda49e9f0
[ui/utils/query_string]: Remove unused methods & migrate apps to querystring lib (#56957)
* replace querystring (querystring-browser) -> query-string

* QueryString remove encode/decode methods

* remove query_string file

* remove querystring-browser from package.json

* add kibana_utils\url module

* cleanup

* update notice.txt

* fix merge conflict

* fix CI

* fix wrong import

* fix CI

* fix X-Pack firefox smoke test

* remove urlUtils.parseUrlQuery

* remove url.stringifyUrlQuery

* use url.encodeQuery

* Record<string, any> -> ParsedQuery

* Update src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx

Co-Authored-By: Luke Elmers <lukeelmers@gmail.com>

* add more tests for APM

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Luke Elmers <lukeelmers@gmail.com>
2020-02-12 19:51:03 +03:00
MadameSheema b7ba72b835
refactors pagination tests (#57348) 2020-02-12 17:27:05 +01:00
Pete Harverson 842b317566
[ML] Adds extra functional tests for index data visualizer (#57439)
* [ML] Adds extra functional tests for index data visualizer

* [ML] Remove test tag and uncomment clean-up
2020-02-12 15:41:27 +00:00
Dario Gieselaar 6581426fb8
[APM] Remove initial time range for service maps (#57308)
* [APM] Remove initial time range for service maps

The initial time range for the service maps request might no longer be necessary, from what I can tell. Not having it improves the overall loading time and the user experience.

* Remove loading indicator for service maps

* Don't unnecessarily paginate

* Unset loading indicator if component unmounts
2020-02-12 15:20:31 +01:00
Shahzad cb976705a9
[Uptime] Implemented drag and select on charts (#57089)
* Implemented drag and select on charts

* fix test

* unused

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 15:00:20 +01:00
Mike Côté de3816e9b7
Don't create API key for disabled alerts when calling update API (#57102)
* Avoid creating an API key for a disabled alert on update

* Fix tests to work with refactor from other PR

* Fix ESLint errors

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 08:57:12 -05:00
Liza Katz b8c5b249fc
Explicit namespaces for esFilters (#57177)
* Explicit namespaces for esQuery and esQuery

* Remove unnecessary file from siem

* remove jsonvalue definition from siem

* esFilters refactor O_O

* Delete IFilterType

* import fixes

* Fix merge

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 13:22:06 +02:00
Alexey Antonov c1a40f33ac
fix Master branch (#57421)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 12:05:36 +02:00
James Gowdy 7e753e9883
[ML] Removing missed timefilter use (#57373) 2020-02-12 09:07:16 +00:00
Mikhail Shustov 2abc3f5793
[NP] Add meta-data and timestamp formatting for Log Record (#56982)
* log meta in pattern layout

* address pgayvallet comment

* add conversion patterns for timestamp

* use comparison instead of inline snapshots

* logs. use elasticsearch and LP compatible timezone format in json layout

* use regexp groups and dot separator for ms. as in default iso format

* use America/New_York timezone as default as it set in guess anyway

* fix APM tests. they need to reset timezone locally and restore it after

* fix logging tests
2020-02-12 09:04:50 +01:00
Liza Katz 6eaeca8538
Explicit index pattern namespace (#57194)
* Explicit index pattern namespace

* typing of index patterns

* fix ts error on master

* export FieldList

* Move isFilterable into indexPatterns namespace

* Server index pattern cleanup

* comment

* isDefault

* karma mock fix + discover fix

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 09:04:51 +02:00
Garrett Spong 93138a3570
[SIEM] Fixes Host Details Events Table to only show events for specified Host (#57388)
## Summary

Fixes an issue where the `Events Table` on the `Host Details` page would show all events instead of those for the specific host. Also adds tests to make sure this doesn't happen again 🙂 

Note: This will not interfere with any user-added queries/filters as those are added separately. 

##### Before / After (See Event count at bottom of image)
<img width="300" alt="Screen_Shot_2020-02-11_at_15_35_12" src="https://user-images.githubusercontent.com/2946766/74286988-2f6bbb80-4ce6-11ea-9ca2-35d4ae9ff3f2.png"> <img width="300" alt="Screen_Shot_2020-02-11_at_15_46_23" src="https://user-images.githubusercontent.com/2946766/74287150-840f3680-4ce6-11ea-9267-365753a52fc2.png">



### Checklist

Delete any items that are not applicable to this PR.

- [ ] ~Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~
- [ ] ~[Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~
- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
- [ ] ~This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~
- [ ] ~This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)~
- [ ] ~This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~

### For maintainers

- [ ] ~This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
2020-02-11 20:11:01 -07:00
Poff Poffenberger 0dd8129b0e
[Canvas] Move sample data and feature registration to canvas np plugin (#56564)
* Move sample data and feature registration to canvas np plugin

* Prepare to move i18n to new platform and adjust paths

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-11 17:24:21 -06:00
Patrick Mueller f304f88605
instrument task manager with apm transactions (#55356)
Adds some apm transaction boundaries for parts of task manager, so that
they will show up in APM as new types of transactions.  Should provide
some visibility into the ES calls made by task manager for alerting and
actions, especially under stress testing scenarios.
2020-02-11 18:20:56 -05:00
Gidi Meir Morris 3effcdb94a
displays Alert Instance state on Alert Details page (#56842)
Adds a list of Alert Instances to the Alert Details page based off of the current state of the Alert.
2020-02-12 11:53:06 +13:00
Justin Kambic 7f336b497d
[Uptime] Remove redundant adapter function (#56980)
* Remove get_doc_count function in favor of index status function.

* Rename adapter function.

* Remove obsolete import.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-11 17:28:23 -05:00
Frank Hassanabad f890776e6d
[SIEM][Detection Engine] Backend end-to-end tests
## Summary

* Adds end to end integration tests
* Fixes a bug with import where on imports it was forcing all rules that were being imported to be set to be "enabled: false" instead of honoring what the original export has set for its enabled.
* Adds a few "to be safe" await block so that the front end does not get a race condition within the bulk deletes and other parts of the code.
* Fixes `statusCode` to be `status_code` and removes most of the Hapi Boomer errors
* Changes PUT to be PATCH for partial updates
* Adds true updates with PUT
* Put some TODO blocks around existing bugs found in the API in the e2e tests that we might have time to get to or might not. This will let others maintaining the tests know that once they fix the bug they should update the end to end test to change the behavior.  

Testing this:

Go to the latest CI logs and look for any particular lines from the test executing such as:

```ts
should set the response content types to be expected
```

Also run this manually on your machine through this command:

```ts
node scripts/functional_tests --config x-pack/test/detection_engine_api_integration/security_and_spaces/config.ts
```

Change a test manually and re-run the above command to watch something fail.


Screen shot of what you should see on the CI machine when these are running:
<img width="1825" alt="Screen Shot 2020-02-08 at 10 15 21 AM" src="https://user-images.githubusercontent.com/1151048/74089355-ae9a8e80-4a5d-11ea-9050-86e68d7e3bba.png">


### Checklist

Delete any items that are not applicable to this PR.

~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

~~- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)~~

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

### For maintainers

- [x] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2020-02-11 15:24:30 -07:00
Shahzad 5bfbf5f530
[Uptime] Added tests for pages (#56736)
* added test for pages

* fixed types

* update types

* update snap

* PR feedback

* PR feedback
2020-02-11 22:48:22 +01:00
Vadim Dalecky 454d0a2646
Expressions refactor (#54342)
* feat: 🎸 add UiComponent interface

* feat: 🎸 add adapter for react => ui components and back

* refactor: 💡 move registries to shared /common folder

* feat: 🎸 create expressions service state contaienr

* chore: 🤖 export some symbols

* feat: 🎸 add Executor class

* test: 💍 add simple integration test

* feat: 🎸 move registries into executor

* feat: 🎸 add initial implementation of Execution

* feat: 🎸 move Executor's state container into a signle file

* refactor: 💡 move createError() to /common folder

* feat: 🎸 use Executor in plugin definition

* refactor: 💡 rename handlers to FunctionHandlers

* feat: 🎸 improve function typings

* feat: 🎸 move types and func in sep folder, improve Execution

* refactor: 💡 cleanup expression_types folder

* refactor: 💡 improve typing names of expression types

* refactor: 💡 remove lodash from ExpressionType and improve types

* test: 💍 add ExpressionType tests

* refactor: 💡 remove function wrappers around types

* refactor: 💡 move functions to /common

* test: 💍 improve expression function tests

* feat: 🎸 create /parser folder

* refactor: 💡 move function types into /expression_functions dir

* refactor: 💡 improve parser setup

* refactor: 💡 fix export structure and move args into expr_func

* test: 💍 add ExpressionFunctionParameter tests

* fix: 🐛 fix executor types and imports

* refactor: 💡 move getByAlias to plugin, fix Execution types

* feat: 🎸 add function for argument parsing

* test: 💍 add Executor type tests

* test: 💍 add executor function and context tests

* test: 💍 check that Executor returns Execution

* test: 💍 add basic tests for Execution

* test: 💍 add basic test for execution of a chain of functions

* test: 💍 add "mult" function tot tests

* feat: 🎸 create separate expression_renderer folder

* feat: 🎸 use new executor in public plugin

* feat: 🎸 remove renderers from executor, add result to execution

* fix: 🐛 fix Kibana TypeScript errors

* test: 💍 add file to write integration tests for expr plugin

* refactor: 💡 move state_containers to /common

* refactor: 💡 move /parser to /ast and inline format() function

* refactor: 💡 remove remaining @kbn/interpreter imports

* feat: 🎸 better handling and typing for Executor context

* feat: 🎸 use Executor.run function in plugin

* fix: 🐛 fix TypeScript type errors

* test: 💍 move integration tests into one file

* feat: 🎸 create ExpressionsService

* chore: 🤖 clean up legacy code

* feat: 🎸 use ExpressionsService in /public

* refactor: 💡 move inspector adapters to /common

* feat: 🎸 improve execution

* feat: 🎸 add state to execution state and don't clone AST

* test: 💍 add tests for Execution object

* test: 💍 improve expression test helpers

* test: 💍 add Execution tests

* refactor: 💡 improve required argument checking

* fix: 🐛 fix Kibana TypeScript errors

* test: 💍 add ExpressionsService unit tests

* fix: 🐛 fix Expression plugin TypeScript types

* refactor: 💡 prefix React component with React*

* fix: 🐛 fix X-Pack TypeScript errors

* fix: 🐛 fix test TypeScript errors

* fix: 🐛 fix issues preventing loading

* feat: 🎸 remove getInitialContext() handler

* fix: 🐛 fix TypeScript errors

* chore: 🤖 remove uicomponent interface

* chore: 🤖 remove missing import

* fix: 🐛 correctly handle .query in "kibana" expression function

* refactor: 💡 call first arg in expression functions "input"

* fix: 🐛 do not free Execution state container

* test: 💍 fix tests after refactor

* test: 💍 fix more tests after refactor

* fix: 🐛 remove redundant export

* test: 💍 update intepreter_functional test shapshots

* fix: 🐛 relax "kibana" function throwing on missin gsearch ctx

* refactor: 💡 don't use ExpressionAST interface in Canvas

* docs: ✏️ improve ExpressionRenderer JSDocs

* refactor: 💡 rename context.types to inputTypes in internal fn

* refactor: 💡 replace context.types by unknown in ExprFuncDef

* refactor: 💡 improve expression function definitions in OSS

* fix: 🐛 correctly set name on metric_vis_fn

* refactor: 💡 improve Lens definitions of expression functions

* refactor: 💡 improve Canvas expression function definitions

* test: 💍 add createMockExecutionContext() helper

* refactor: 💡 add some type to events$ observable in expr handler

* feat: 🎸 add types to observables in data handler

* refactor: 💡 use inputTypes in canvas

* fix: 🐛 fix interpreter grammer generation script

* feat: 🎸 allow array in getByAlias

* test: 💍 simplify test function specs

* test: 💍 fix autocomplete tests

* fix: 🐛 use correct expression types and NP getFunctions() API

* refactor: 💡 use NP expressions to get renderer

* fix: 🐛 use context.types on server-side Canvas function defs

* refactor: 💡 use NP API to register Canvas renderers

* feat: 🎸 use NP API to get types

* style: 💄 minor formatting changes

* feat: 🎸 use NP API to get expression functions

* fix: 🐛 fix Canvas workpads

* test: 💍 add missing mock functions

* refactor: 💡 improve Lens func definition argument types

* fix: 🐛 fix Lens type error

* feat: 🎸 make lens datatable work again

* feat: 🎸 bootstrap ExpressionsService on server-side

* feat: 🎸 expose more registry related functions in contract

* feat: 🎸 add environment: server to server-side expressions

* docs: ✏️ add documentation

* test: 💍 add missing Jest mocks

* fix: 🐛 correct TypeScript type

* docs: ✏️ improve documentation

* fix: 🐛 make FunctionHelpDict type contain only Canvas functions

* fix: 🐛 fix merge conflict

* test: 💍 fix expression mocks
2020-02-11 19:47:36 +01:00
Melissa Alvarez 9fd75dbb91
[ML] New Platform server shim: update annotation routes to use new platform router (#57067)
* update annotation routes to use NP router

* create ts file for feature check

* update schema to allow null value for earliest/latestMs

* update annotations model test

* use NP security plugin to access user info
2020-02-11 13:36:13 -05:00
Poff Poffenberger d0dfacd863
Remove injected ui app vars from Canvas (#56190)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-11 12:34:37 -06:00
Melissa Alvarez c0497ce972
update max_anomaly_score route schema to handle possible undefined values (#57339) 2020-02-11 13:26:52 -05:00
Poff Poffenberger 57f5924f9f
Add mock of a legacy ui api to re-enable Canvas storybook (#56673)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-11 12:07:01 -06:00
Tyler Smalley 9d7bdd3799
[monitoring] Removes noisy event received log (#57275)
This log is very noisy when running in verbose and does not appear to
have much value in debugging.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-02-11 09:59:21 -08:00
Jean-Louis Leysens e7773f27c5
Remove use of copied MANAGEMENT_BREADCRUMBS and use setBreadcrumbs from management section's mount (#57324) 2020-02-11 18:33:21 +01:00
Matthew Kime 0d30327e01
Advanced Settings management app to kibana platform plugin (#56931)
* advanced settings component registry to new platform
2020-02-11 10:41:37 -06:00
Dima Arnautov b133357311
[ML] New Platform server shim: update recognize modules routes to use new platform router (#57206)
* [ML] modules with NP router

* [ML] use extendedRouteInitializationDeps

* [ML] add apidoc annotations

* [ML] address PR comments

* [ML] convert data_recognizer test to jest

* [ML] optional indexPatternName
2020-02-11 17:11:29 +01:00
Dima Arnautov 733f6023d9
[ML] Fix overall stats for saved search on the Data Visualizer page (#57312)
* [ML] fix overall stats fetch with a saved search

* [ML] refactor
2020-02-11 17:04:00 +01:00
James Gowdy b3e8bdf767
[ML] [NP] Removing ui imports (#56358)
* [ML] [NP] Removing ui imports

* replacing timefilter and ui context

* replacing ui/i18n and ui/metadata

* removing ui/system_api

* removing ui/notify

* removing most ui/new_platform

* fix explorer date format loading

* removing ui/chrome

* fixing timebuckets test

* fixing jest tests

* adding http

* testing odd CI type failure

* revrting type test changes

* fixing odd test type error

* refactoring dependencies

* removing injectI18n and using withKibana for context

* updating components to use kibana context

* re-enabling some tests

* fixing translation strings

* adding comments

* removing commented out code

* missing i18n

* fixing rebase conflicts

* removing unused ui contexts

* changes based on review

* adding text to errors

* fixing management plugin

* changes based on review

* refeactor after rebase

* fixing test
2020-02-11 16:03:42 +00:00
MadameSheema 7c05928e6f
[SIEM] Fixes failing Cypress tests (#57202)
* fixes events viewer tests

* fixes 'toggle column' tests

* fixes 'url state' tests

* fixes type check issues
2020-02-11 16:52:16 +01:00
Melissa Alvarez 82d2831c56
fix results service schema (#57217) 2020-02-11 10:21:33 -05:00
Mike Côté 62e3189c34
Fix update alert API to still work when AAD is out of sync (#57039)
* Ensure update API still works when AAD is broken

* Add API integration test

* Fix ESLint errors

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-11 07:47:10 -05:00
Walter Rafelsberger c654018122
[ML] Anomaly Detection: Fix jobs list default refresh. (#57086)
* [ML] Fix anomaly detection jobs list default refresh.

* [ML] Fix initial load of jobs list.

* [ML] Fix blockRefresh check.

* [ML] Fix blockRefresh check.

* [ML] Fix passing globalState between main tabs and retain custom refreshInterval when loading jobs list.
2020-02-11 12:45:28 +00:00
Nathan Reese d7c2552944
[Maps] do not disable other styling when symbol size is dynmaic (#57247) 2020-02-11 05:38:16 -07:00
Pierre Gayvallet c13b0751f3
kbn-config-schema: allow parsing of array and object types from string (#57189)
* allow parsing from string for object-ish and array types

* update snapshots

* fix FTR assertion

* add documentation note about using a json string as input
2020-02-11 11:19:02 +01:00
Liza Katz eb54678f35
Explicit namespaces for esQuery and esKuery (#57172)
* Explicit namespaces for esQuery and esQuery

* Remove unnecessary file from siem

* remove jsonvalue definition from siem

* server
  FieldFormatsRegistry,

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-11 12:14:58 +02:00
Justin Kambic c383f50cdd
Consume core startup services. (#57259) 2020-02-11 11:01:15 +01:00
Jean-Louis Leysens b67b1c3173
[Watcher] Fix flaky functional test (#56393)
* Give a bit more time for machines on CI

* Remove unnecessary sleep

* Dummy error logs [do not commit to master]

* Revert "Dummy error logs [do not commit to master]"

Also only update data (and call serializer) on a success response, not on an error response.

* Remove common.sleep and rewrite the comment explaining the use of retry.waitFor

* Fix typo

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-11 09:39:20 +01:00