Commit graph

3815 commits

Author SHA1 Message Date
Tiago Costa b60a438dd3
skip flaky suite (#100438) 2021-06-14 12:51:58 +01:00
James Gowdy f6ce964d9c
[ML] Switching to new datafeed preview (#101780)
* [ML] Switching to new datafeed preview

* fixing wizard test button

* adding schema validator

* fixing tests

* adding check for empty detectors list

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-14 12:31:55 +01:00
Tyler Smalley 344b6310d7 skip flaky suite (#102012) 2021-06-12 06:49:27 -07:00
Steph Milovic de07e98663
[Observability] [Cases] Cases in the observability app (#101487) 2021-06-10 16:39:27 -06:00
Yuliia Naumenko e55a93ce58
[Event Log] Populated rule.* ECS fields for alert events. (#101132)
* [Event Log] Populated rule.* ECS fields for alert events.

* added mappings

* changed the params passing

* fixed tests

* fixed type checks

* used kibanaVersion for version event rule

* fixed typos

* fixed tests

* fixed tests

* fixed tests

* fixed tests

* fixed jest tests

* removed references

* removed not populated fields

* fixed tests

* fixed tests

* fixed tests
2021-06-10 12:33:32 -07:00
Stacey Gammon e9a4028005
Add comments to some alerting plugin public API items (#101551)
* Add comments. Remove ruleType as the second param, not needed.

* Add comments. Remove ruleType as the second param, not needed.

* Fix bad type check and update docs

* update docs

* Remove unused import

* change exports to type to avoid increasing bundle size

* Update x-pack/plugins/alerting/public/plugin.ts

Co-authored-by: ymao1 <ying.mao@elastic.co>

* Update x-pack/plugins/alerting/public/plugin.ts

Co-authored-by: ymao1 <ying.mao@elastic.co>

* Update x-pack/plugins/alerting/public/plugin.ts

Co-authored-by: ymao1 <ying.mao@elastic.co>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: ymao1 <ying.mao@elastic.co>
2021-06-10 15:15:53 -04:00
Caroline Horn 61677f7a77
Fix AppContainer layout (#101793)
* Fixing app_container
* Use EUI mixin  `euiHeaderAffordForFixed()` to maintain parity
* Adding `aria-busy` when `showSpinner`
* i18n for the loading aria-label
2021-06-10 14:18:35 -04:00
Shahzad ddccace87e
[Uptime] Unskip alert functional test (#101562) 2021-06-10 20:01:21 +02:00
Joe Reuter fe3c761b40
stabilize opening of Lens from listing page (#101569) 2021-06-10 16:30:37 +02:00
Wylie Conlon b35cde568b
[Lens] Formula editor (#99297)
* 💄 Hack to fix suggestion box

* 🐛 Fix validation messages

* 🐛 Relax operations check for managedReferences

* Change completion params

* 🏷️ Fix missing arg issue

*  Add more tinymath fns

* 🐛 Improved validation around math operations + multiple named arguments

* 🐛 Use new onError feature in math expression

* ♻️ Refactor namedArguments validation

* 🐛 Fix circular dependency issue in tests + minor fixes

* Move formula into a tab

* 🔥 Leftovers from previous merge

*  Move over namedArgs from previous function

*  Add tests for transferable scenarios

*  Fixed broken test

*  Use custom label for axis

* Allow switching back and forth to formula tab

* Add a section for the function reference

* Add modal editor and markdown docs

* Change the way math nodes are validated

* Use custom portal to fix monaco positioning

* Fix model sharing issues

* Provide signature help

* 🐛 Fix small test issue

* 🐛 Mark pow arguments as required

* 🐛 validate on first render only if a formula is present

* 🔥 Remove log10 fn for now

*  Improved math validation + add tests for math functions

* Fix mount/unmount issues with Monaco

* [Lens] Fully unmount React when flyout closes

* Fix bug with editor frame unmounting

* Fix type

* Add tests for monaco providers, add hover provider

* Add test for last_value

* Usability improvements

* Add KQL and Lucene named parameters

* Add kql, lucene completion and validation

* Fix autocomplete on weird characters and properly connect KQL

* Highlight functions that have additional requirements after validating

* Fix type error and move help text to popover

* Fix escape characters inside KQL

* 🐛 Fix dataType issue when moving over to Formula

* Automatically insert single quotes on every named param

* Only insert single quotes when typing kql= or lucene=

* Reorganize help popover

* Fix merge issues

* Update grammar for formulas

* Fix bad merge

* Rough fullscreen mode

* Type updates

* Pass through fullscreen state

* Remove more chrome from full screen mode

* Fix minor bugs in formula typing

* 🐛 Decouple column order of references and output

* 🔧 Fix tests and types

*  Add first functional test

* Fix copying formulas and empty formula

* Trigger suggestion prompt when hitting enter on function or typing kql=

* 🐛 Prevent flyout from closing while interacting with monaco

* refactoring

* move main column generation into parse module

* fix tests

* refactor small formula styles and markup

* documentation

* adjustments in formula footer

* Formula refactoring (#12)

* refactoring

* move main column generation into parse module

* fix tests

* more style and markup tweak for custom formula

* Fix tests

* [Expressions] Use table column ID instead of name when set

* [Lens] Create managedReference type for formulas

* Fix test failures

* Fix i18n types

* fix fullscreen flex issues

* Delete managedReference when replacing

* refactor css and markup; add button placeholders

* [Lens] Formulas

* Tests for formula

Co-authored-by: Marco Liberati <marco.liberati@elastic.co>

* added error count placeholder

* Add tooltips

* Refactoring from code review

* Fix some editor issues

* Update ID matching to match by name sometimes

* Improve performance of Monaco, fix formulas with 0, update labels

* Improve performance of full screen toggle

* Fix formula tests

* fix stuff

* Add an extra case to prevent insertion of duplicate column

* Simplify logic and add test for output ID

* add telemetry for Lens formula (#15)

* Respond to review comments

*  Improve the signatures with better documentation and examples

* adjust border styles to account for docs collapse

* refactor docs markup; restructure docs obj; styles

* Fix formula auto reordering (#18)

* fix formula auto reordering

* add unit test

* Fix and improve suggestion experience in Formula (#19)

*  Revisit documentation and suggestions

* 👌 Integrated feedback

*  Add query validation for quotes

* Usability updates & type fixes

* add search to formula

* fix form styles to match designs

* fix text styles; revert to Markdown for control

* 👌 Integrated more feedback

* improve search

* improve suggestions

* improve suggestions even more

* 🐛 Fix i18n issues (#22)

* Persist formula on leave, fix fullscreen and popovers

* Fix documentation tests

* 🏷️ fix type issue

* 🐛 Remove hidden operations from valid functions list

* 🐛 Fix empty string query edge case

* 🐛 Enable more suggestions + extends validation

* Fix tests that depended on setState being called without function

* Error state and text wrapping updates

*  Add new module to CodeEditor for brackets matching (#25)

* Fix type

* show warning

* keep current quick function

*  Improve suggestions within kql query

* 📷 Fix snapshot editor test

* 🐛 Improved suggestion for single quote and refactored debounce

* Fix lodash usage

* Fix tests

* Revert "keep current quick function"

This reverts commit ed477054c5.

* Improve performance of dispatch by using timeout

* Improve memoization of datapanel

* Fix escape characters

* fix reduced suggestions

* fix responsiveness

* fix unit test

* Fix autocomplete on nested math

* Show errors and warnings on first render

* fix transposing column crash

* Update comment

* 🐛 Fix field error message

* fix test types

* 📝 Fix i18n name

* 💄 Manage wordwrap via react component

* Fix selector for palettes that interferes with quick functions

* Use word wrapping by default

* Errors for managed references are handled at the top level

* 🐛 Move the cursor just next to new inserted text

* ⚗️ First pass for performance

* 🐛 Fix unwanted change

*  Memoize as many combobox props as possible

*  More memoization

* Show errors in hover

* Use temporary invalid state when moving away from formula

* Remove setActiveDimension and shouldClose, fixed by async setters

* Fix test dependency

* do not show quick functions tab

* increase documentation popover width

* fix functional test

* Call setActiveDimension when updating visualization

* Simplify handling of flyout with incomplete columns

* Fix test issues

* add description to formula telemetry

* fix schema

* Update from design feedback

* More review comments

* Hide callout border from v7 theme

Co-authored-by: dej611 <dej611@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
Co-authored-by: Michael Marcialis <michael.marcialis@elastic.co>
Co-authored-by: Joe Reuter <email@johannes-reuter.de>
Co-authored-by: Marco Liberati <marco.liberati@elastic.co>
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
2021-06-10 10:09:16 -04:00
Christos Nasikas 144e014dbf
[Cases] Improve connectors mapping (#101145) 2021-06-10 11:45:25 +03:00
Domenico Andreoli 7b51debbbb
Fix es_archives path (#101737) 2021-06-10 09:39:07 +02:00
Spencer 7917e3c9d9
[kbnArchiver] convert archive names to root-relative paths (#101839)
* [kbnArchiver] convert archive names to root-relative paths

* ensure that newly multiline hooks are explicitly async

* missed a newly multiline hook

* fix exists check

* avoid extra lines by wrapping arrow body in {}

* one block more

* fix errant `name` variable

Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-06-09 20:13:00 -04:00
Tim Sullivan 3559d375b6
[Reporting] Make "ScreenCapturePanel" shareable for Canvas (#100623)
* use ScreenCapturePanel component in Canvas

* use smaller state object

* add comment about canvas-specific shared component

* fix example

* fix toast error

* fix i18n

* fix data-test-subj

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-09 17:08:33 -07:00
Yuliia Naumenko 274bbdc628
[Alerting UI] Converted Rules and Connectors management pages to new layout. (#101697)
* [Alerting UI] Converted Rules and Connectors management pages to new layout.

* fixed tests

* fixed tests

* fixed tests

* fixed tests
2021-06-09 16:56:30 -07:00
Frank Hassanabad 1cb17d025b
[Security Solution][Detections] Update detection alert mappings to ECS v1.10.0 (#101680)
## Summary

* Grabbed the ECS mappings from [v1.10.0 tag]( https://github.com/elastic/ecs/blob/v1.10.0/generated/elasticsearch/7/template.json)
* Updated the fields that had `constant_keyword` to `keyword` since we do many to 1 of source to signals index
* Wrote a unit tests which tests to ensure we don't have any `constant_keyword` fields
* Updated the `SIGNALS_TEMPLATE_VERSION` version by an increment of 10.

This should mostly fix:
https://github.com/elastic/kibana/issues/101572

Since agents add their data into `_source` even though they have a `constant_keyword`. When agents do not include the values in `_source` we will have to merge `fields` into `_source` before copying which are still planning on doing before release.

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2021-06-09 18:06:10 -04:00
Frank Hassanabad 8c03ccf1f0
Unskips migration tests now that elastic search is fixed (#101682)
## Summary

Unskips signal migration tests now that elastic search is fixed get alias bug

ES ticket about get alias bug:
https://github.com/elastic/elasticsearch/pull/72953

Tickets related that should be fixed now:
https://github.com/elastic/kibana/issues/99915
https://github.com/elastic/kibana/issues/100305

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2021-06-09 14:02:47 -06:00
ymao1 a12ff5d65d
[Alerting][Event log] Persisting duration information for active alerts in event log (#101387)
* WIP

* Storing start, duration and end in alert state

* Writing to event log

* Updating unit tests

* Adding unit tests

* Fixing uuid in tests

* Updating functional test

* Adding functional test

* Removing console logs

* Fixing unit tests

* PR fixes

* Removing uuid from alert information

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-09 11:09:05 -04:00
Nathan Reese d415357f73
Change file data visualizer links to point to new location in home application (#101393)
* Link to home file data visualizer

* remove unused import

* i18n cleanup

* remove unused import from EmptyState

* use const

* remove ml functional test cases checking for ml_file_data_visualizer

* more clean-up of ml_file_data_visualizer

* jest snapshot and nav to home page in no_ml_access tests

* revert change to functional test dual_privileges_all at everything_space

* revert another change to security_and_spaces/tests/catalogue.ts

* revert changes to x-pack/test/ui_capabilities/security_only/tests/catalogue.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-09 08:30:40 -06:00
Marco Liberati e3c3b6f334
[Lens] New summary row feature for datatable (#101075)
*  New summary row feature for datatable

*  Allow empty strings behind flag + tests

* 🐛 Address the transition problem + refactor

*  Add some unit tests

*  Add first functional tests

* 👌 first feedback addressed

*  Make it handle numeric array values

* 📝 Improved message

*  Fix functional test

* 🔥 Remove warning message for last value

* 🚨 Remove unused import

* 🐛 Fix a bug with last value

* 👌 Integrated feedback

* 💄 Migrated to combobox

*  Fix unit tests + restore right data-test-id

* 🏷️ Fix type issue

* 👌 Address all issues reported

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-09 14:27:49 +02:00
Dmitry Shevchenko 16e66b82b0
Implement "select all" rules feature (#100554) 2021-06-09 11:32:45 +02:00
Tyler Smalley c225aaaaa5 [FTR] Updates esArchive paths
PR's merged after #101345

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-06-08 21:10:36 -07:00
Tyler Smalley aa8f7f3af2 [FTR] Updates esArchive paths
PR's merged after #101345

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-06-08 21:06:50 -07:00
Frank Hassanabad 4021576436
[Security Solution][Detection Engine] Adds runtime field tests (#101664)
## Summary

Adds runtime field tests with skips around the tests that we do not support just yet.

* Adds tests around corner cases involving ".", "..", ".foo", "foo.", etc...
* Adds tests around overriding values from the runtime fields within the source document
* Adds tests around ambiguity for when we override an array in a runtime field
* Fixes minor wording around previous tests
* Fixes one line string when we do testing in one area

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2021-06-08 17:31:54 -06:00
Nicolas Chaulet 8c2c83cb7d
[Fleet] Add fleet server telemetry (#101400) 2021-06-08 18:55:48 -04:00
Spencer f466ebf1a3
[esArchiver] drop support for --dir, use repo-relative paths instead (#101345)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-06-08 17:37:42 -04:00
spalger 686ade7808 Revert "[xpack/test] restore incremental: false in ts project"
This reverts commit 3c68a0c810.
2021-06-08 14:26:26 -07:00
spalger 3c68a0c810 [xpack/test] restore incremental: false in ts project 2021-06-08 13:30:42 -07:00
Quynh Nguyen 65b8dda157
[ML] Move Index Data Visualizer into separate plugin (Part 1) (#100922)
* [ML] Add index visualizer

* [ML] Readd support for global state

* [ML] Add time buckets & fix dependencies

* [ML] Working ver

* [ML] Add back and boolean support

* [ML] Remove old files inside ml

* [ML] Rename files

* [ML] Move field type icon

* [ML] Create new folder structure

* [ML] Organize index_data_visualizer

* [ML] Move types into index_data_visualizer folder

* [ML] Move more files into file_data_visualizer

* [ML] Move more files into index_data_visualizer

* [ML] Add new data visualizer model

* [ML] Remove getVisualizerFieldStats which is not used by dv

* [ML] Delete redundant folder

* [ML] Copy old data visualizer routes to new plugin

* [ML] Remove old routes

* [ML] Disable for ml job cards tests for now

* [ML] Remove todos

* [ML] Move the toast error to the UI component

* [ML] Fix map styling

* [ML] Add runtime_mappings for internal/file_upload/time_field_range

* [ML] Move routes into folder

* [ML] Update permissions

* [ML] Update texts

* [ML] Update schemas import and api get_field_stats

* [ML] Reorg folders into common

* [ML] Update types & tests

* [ML] Update internal/data_visualizer permissions and action panel tests

* [ML] Update imports after #100863

* [ML] Fix CI

* [ML] Rename folder from file_data_visualizer to data_visualizer

* [ML] Rename i18n ids

* [ML] Update fileDataVisualizer -> dataVisualizer dependency name in ml plugin

* [ML] Remove ml prefix in data test subjs

* [ML] Fix settings and docs

* [ML] Update plugin description

* [ML] Remove mlContext dependency completely

* [ML] Set query to optional

* Revert "[ML] Update plugin description"

This reverts commit 4ab1a25c

* [ML] Update plugins list docs

* [ML] Fix types and i18n

* [ML] Revert ml data test subj/class name changes

* [ML] Split up data visualizer model, remove Logger

* [ML] Remove empty file and indexPatternFieldEditor

* [ML] Move imports of file_upload

* [ML] Update plugin dependencies

* Re-add missing data_visualizer.json

* Remove capabilities in data_visualizer

* Fix test subjs

* Update ownership for data_visualizer and file_upload code to be ml

* Update estypes after 98266

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-08 14:50:14 -05:00
Spencer bdafd27e19
[ts] migrate x-pack/test to composite ts project (#101441)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-06-08 12:54:05 -04:00
Tyler Smalley ec212c0618
[es-archiver] Use alias for Kibana mappings (#101537)
In 7.x, when saved objects point to an index and not an alias it will
assume it's pre-6.8 and perform a legacy migration. This causes issues
with the removal of oss builds. This update prevents that from happening
by using an alias.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-06-08 08:48:43 -07:00
Mikhail Shustov d920682e4e
Update @elastic/elasticsearch to 8.0.0-canary13 (#98266)
* bump @elastic/elasticsearch to canary.7

* address errors in core

* address errors in data plugin

* address errors in Alerting team plugins

* remove outdated messages in Lens

* remove unnecessary comments in ML

* address errors in Observability plugin

* address errors in reporting plugin

* address errors in Rule registry plugin

* fix errors in Security plugins

* fix errors in ES-UI plugin

* remove unnecessary union.

* update core tests

* fix kbn-es-archiver

* update to canary 8

* bump to v9

* use new typings

* fix new errors in core

* fix errors in core typeings

* fix type errors in data plugin

* fix type errors in telemetray plugin

* fix data plugin tests

* fix search examples type error

* fix errors in discover plugin

* fix errors in index_pattern_management

* fix type errors in vis_type_*

* fix errors in typings/elasticsearch

* fix type errors in actions plugin

* fix type errors in alerting and apm plugins

* fix type errors in canvas and cases

* fix errors in event_log

* fix type errors in ILM and ingest_pipelines

* fix errors in lens plugin

* fix errors in lists plugin

* fix errors in logstash

* fix errors in metrics_entities

* fix errors in o11y

* fix errors in watcher

* fix errors in uptime

* fix errors in upgrade_assistant

* fix errors in task_manager

* fix errors in stack_alerts

* fix errors in security_solution

* fix errors in rule_registry

* fix errors in snapshot_restore

* fix remaining errors

* fix search intergration tests

* adjust assetion

* bump version to canary.10

* adapt code to new naming schema

* use mapping types provided by the client library

* Revert "adjust assetion"

This reverts commit 19b8fe0464.

* fix so intergration tests

* fix http integration tests

* bump version to canary 11

* fix login test

* fix http integration test

* fix apm test

* update docs

* fixing some ml types

* fix new errors in data plugin

* fix new errors in alerting plugin

* fix new errors in lists plugin

* fix new errors in reporting

* fix or mute errors in rule_registry plugin

* more ML type fixes

* bump to canary 12

* fix errors after merge conflict

* additional ML fixes

* bump to canary 13

* fix errors in apm plugin

* fix errors in fleet plugin

* fix errors in infra plugin

* fix errors in monitoring plugin

* fix errors in osquery plugin

* fix errors in security solution plugins

* fix errors in transform plugin

* Update type imports for ES

* fix errors in x-pack plugins

* fix errors in tests

* update docs

* fix errors in x-pack/test

* update error description

* fix errors after master merge

* update comment in infra plugin

* fix new errors on xpack tests/

Co-authored-by: James Gowdy <jgowdy@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
2021-06-08 15:06:06 +02:00
Yulia Čech 2d3340b543
Unskip the test (#101414)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-08 11:38:12 +02:00
Matthias Wilhelm 65251051fd
[Discover] Deangularize discover controller (#96766)
Co-authored-by: Tim Roes <mail@timroes.de>
2021-06-08 11:27:00 +02:00
renovate[bot] 4fbb6f0baa
Update dependency @elastic/charts to v30 (master) (#101409)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: nickofthyme <nick.ryan.partridge@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
2021-06-08 10:49:31 +02:00
Devon Thomson b3ed014c1a
[Dashboard] Rebuild State Management (#97941)
* Rebuilt dashboard state management system with RTK.
2021-06-07 15:17:24 -04:00
Joe Reuter f5dc9d198f
[Lens] Increase timings for drag and drop tests (#101380) 2021-06-07 17:02:09 +02:00
Kyle Pollich dc1d98ba17
[Fleet] Move integrations to a separate app (#99848)
* WIP: Re-create separation of integrations app

* Fix breadcrumbs

* Fix add integration button/routing

* Fix integrations test paths

* Fix failing policy tab tests

* Fix type errors

* Fix more type errors

* Fix integrations home page redirect

* Fix circular import

* Fix i18n errors

* Fix FTR paths

* Fix more deep fleet import paths

* Remove unneeded state set

* Fix more type errors

* Fix failing security_solutions tests

* Address redirect back path todo

* Fix page path in FTR

* Fix type error

* 🤞 Fix FTR failures

* Fix package details path in endpoint tests

* Fix test import

* Fix add integration route + breadcrumbs

* Fix missing layout for create package policy page

* Fixup Kibana feature declaration + fix app registry arrays

* Fix Kibana startup error from feature registration

* Fix telemetry schema

* Remove integrations from privilege tests

* Increase Fleet bundle limit by 20kb to fix CI error

* Use correct updated Fleet bundle limit

* Update limits.yml via script

* Address design feedback

* Fix i18n error

* Fix failing security solution tests

* Fix type error

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-07 10:43:44 -04:00
Jonathan Buttner b6c982c3b0
[Cases] RBAC (#95058)
* Adding feature flag for auth

* Hiding SOs and adding consumer field

* First pass at adding security changes

* Consumer as the app's plugin ID

* Create addConsumerToSO migration helper

* Fix mapping's SO consumer

* Add test for CasesActions

* Declare hidden types on SO client

* Restructure integration tests

* Init spaces_only integration tests

* Implementing the cases security string

* Adding security plugin tests for cases

* Rough concept for authorization class

* Adding comments

* Fix merge

* Get requiredPrivileges for classes

* Check privillages

* Ensure that all classes are available

* Success if hasAllRequested is true

* Failure if hasAllRequested is false

* Adding schema updates for feature plugin

* Seperate basic from trial

* Enable SIR on integration tests

* Starting the plumbing for authorization in plugin

* Unit tests working

* Move find route logic to case client

* Create integration test helper functions

* Adding auth to create call

* Create getClassFilter helper

* Add class attribute to find request

* Create getFindAuthorizationFilter

* Ensure savedObject is authorized in find method

* Include fields for authorization

* Combine authorization filter with cases & subcases filter

* Fix isAuthorized flag

* Fix merge issue

* Create/delete spaces & users before and after tests

* Add more user and roles

* [Cases] Convert filters from strings to KueryNode (#95288)

* [Cases] RBAC: Rename class to scope (#95535)

* [Cases][RBAC] Rename scope to owner (#96035)

* [Cases] RBAC: Create & Find integration tests (#95511)

* [Cases] Cases client enchantment (#95923)

* [Cases] Authorization and Client Audit Logger (#95477)

* Starting audit logger

* Finishing auth audit logger

* Fixing tests and types

* Adding audit event creator

* Renaming class to scope

* Adding audit logger messages to create and find

* Adding comments and fixing import issue

* Fixing type errors

* Fixing tests and adding username to message

* Addressing PR feedback

* Removing unneccessary log and generating id

* Fixing module issue and remove expect.anything

* [Cases] Migrate sub cases routes to a client (#96461)

* Adding sub cases client

* Move sub case routes to case client

* Throw when attempting to access the sub cases client

* Fixing throw and removing user ans soclients

* [Cases] RBAC: Migrate routes' unit tests to integration tests (#96374)

Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>

* [Cases] Move remaining HTTP functionality to client (#96507)

* Moving deletes and find for attachments

* Moving rest of comment apis

* Migrating configuration routes to client

* Finished moving routes, starting utils refactor

* Refactoring utilites and fixing integration tests

* Addressing PR feedback

* Fixing mocks and types

* Fixing integration tests

* Renaming status_stats

* Fixing test type errors

* Adding plugins to kibana.json

* Adding cases to required plugin

* [Cases] Refactoring authorization (#97483)

* Refactoring authorization

* Wrapping auth calls in helper for try catch

* Reverting name change

* Hardcoding the saved object types

* Switching ensure to owner array

* [Cases] Add authorization to configuration & cases routes (#97228)

* [Cases] Attachments RBAC (#97756)

* Starting rbac for comments

* Adding authorization to rest of comment apis

* Starting the comment rbac tests

* Fixing some of the rbac tests

* Adding some integration tests

* Starting patch tests

* Working tests for comments

* Working tests

* Fixing some tests

* Fixing type issues from pulling in master

* Fixing connector tests that only work in trial license

* Attempting to fix cypress

* Mock return of array for configure

* Fixing cypress test

* Cleaning up

* Addressing PR comments

* Reducing operations

* [Cases] Add RBAC to remaining Cases APIs (#98762)

* Starting rbac for comments

* Adding authorization to rest of comment apis

* Starting the comment rbac tests

* Fixing some of the rbac tests

* Adding some integration tests

* Starting patch tests

* Working tests for comments

* Working tests

* Fixing some tests

* Fixing type issues from pulling in master

* Fixing connector tests that only work in trial license

* Attempting to fix cypress

* Mock return of array for configure

* Fixing cypress test

* Cleaning up

* Working case update tests

* Addressing PR comments

* Reducing operations

* Working rbac push case tests

* Starting stats apis

* Working status tests

* User action tests and fixing migration errors

* Fixing type errors

* including error in message

* Addressing pr feedback

* Fixing some type errors

* [Cases] Add space only tests (#99409)

* Starting spaces tests

* Finishing space only tests

* Refactoring createCaseWithConnector

* Fixing spelling

* Addressing PR feedback and creating alert tests

* Fixing mocks

* [Cases] Add security only tests (#99679)

* Starting spaces tests

* Finishing space only tests

* Refactoring createCaseWithConnector

* Fixing spelling

* Addressing PR feedback and creating alert tests

* Fixing mocks

* Starting security only tests

* Adding remainder security only tests

* Using helper objects

* Fixing type error for null space

* Renaming utility variables

* Refactoring users and roles for security only tests

* Adding sub feature

* [Cases] Cleaning up the services and TODOs (#99723)

* Cleaning up the service intialization

* Fixing type errors

* Adding comments for the api

* Working test for cases client

* Fix type error

* Adding generated docs

* Adding more docs and cleaning up types

* Cleaning up readme

* More clean up and links

* Changing some file names

* Renaming docs

* Integration tests for cases privs and fixes (#100038)

* [Cases] RBAC on UI (#99478)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

* Fixing case ids by alert id route call

* [Cases] Fixing UI feature permissions and adding UI tests (#100074)

* Integration tests for cases privs and fixes

* Fixing ui cases permissions and adding tests

* Adding test for collection failure and fixing jest

* Renaming variables

* Fixing type error

* Adding some comments

* Validate cases features

* Fix new schema

* Adding owner param for the status stats

* Fix get case status tests

* Adjusting permissions text and fixing status

* Address PR feedback

* Adding top level feature back

* Fixing feature privileges

* Renaming

* Removing uneeded else

* Fixing tests and adding cases merge tests

* [Cases][Security Solution] Basic license security solution API tests (#100925)

* Cleaning up the fixture plugins

* Adding basic feature test

* renaming to unsecuredSavedObjectsClient (#101215)

* [Cases] RBAC Refactoring audit logging (#100952)

* Refactoring audit logging

* Adding unit tests for authorization classes

* Addressing feedback and adding util tests

* return undefined on empty array

* fixing eslint

* [Cases] Cleaning up RBAC integration tests (#101324)

* Adding tests for space permissions

* Adding tests for testing a disable feature

Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-07 09:37:11 -04:00
Domenico Andreoli a4b4da3674
[master] More precise alerts matching (#99820)
* Split out test preparation and cleanup

* Load data on the remote cluster

* Update the rule to the new (remote) data
2021-06-07 14:41:33 +02:00
Frank Hassanabad 827442b4b0
[Security Solution][Detection Engine] Test cases for alias failure test cases where we don't copy aliases correctly (#101437)
## Summary

Test cases for signals and aliases, including a failure of where we do not copy alias data at the moment even if the target is an ECS compatible field.

For example with this mapping:

```json
{
  "dynamic": "strict",
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "host": {
      "properties": {
        "name": {
          "type": "alias",
          "path": "host_alias.name"
        }
      }
    },
    "host_alias": {
      "properties": {
        "name": {
          "type": "keyword"
        }
      }
    }
  }
}
```

If we detect this as a signal hit we should be copying over both:
* `host_alias.name` -> `host.name`
* `host_alias.name` -> `host_alias.name`

to the target signal index, but we only copy:
* `host_alias.name` -> `host_alias.name`

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2021-06-04 22:34:52 -04:00
ymao1 c13ae7ea64
[Event Log] Adding type_id to saved object array in event log (#100939)
* Adding new fields to event log mapping

* Populating new event log fields when executing rules and actions

* Fixing functional tests

* Adding actionTypeId

* Putting type ids into saved object array

* Fixing functional tests

* Cleanup

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-04 18:55:18 -04:00
Frank Hassanabad e5944a3646
[Security Solutions][Detection Engine] Fixes timestamp bugs within source indexes when the formats are not ISO8601 format (#101349)
## Summary

We have a few bugs where when the source index for detections is not `"strict_date_optional_time"` it is possible that we will misinterpret the format to be epoch milliseconds when it could be epoch seconds or another ambiguous format or blow up when trying to write out the signals index. This fixes it to where we query for the source index format as an ISO8601 and when we copy the date time format we copy it back out as ISO8601 and insert it into the signal index as ISO8601.

See this [gist](https://gist.github.com/FrankHassanabad/f614ec9762d59cd1129b3269f5bae41c) for more details of how this was accidentally introduced when we added support for runtime fields and the general idea of the fix.

* Removes `docvalue_field` and we now only use `fields` in detection engine search requests
* Splits out the timestamp e2e tests into their own file for `timestamps` file
* Adds more tests to ensure we copy what we expect and we are converting to ISO8601 in the signals
* Removes `ts-expect-error` in a lot of areas including tests and then I fix the types and issues once it is removed. 

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2021-06-04 16:19:59 -06:00
Frank Hassanabad 598e63b532
[Security Solutions][Detection Engine] Adds e2e tests for constant_keyword data type (#101234)
## Summary

Adds e2e tests for the `constant_keyword` regular `keyword` to compare between the two. Bugs found with these is one where we do not copy `constant_keyword` fields into signals which I added `.skip` to the tests now.

Tested these rule types:
* KQL
* EQL
* Threshold

For the mappings of the `constant_keyword` I use both the `constant_keyword` and the field `alias` like so:

```json
{
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "data_stream": {
      "properties": {
        "dataset": {
          "type": "constant_keyword",
          "value": "dataset_name_1"
        },
        "module": {
          "type": "constant_keyword",
          "value": "module_name_1"
        }
      }
    },
    "event": {
      "properties": {
        "category": {
          "type": "keyword"
        },
        "dataset": {
          "type": "alias",
          "path": "data_stream.dataset"
        },
        "module": {
          "type": "alias",
          "path": "data_stream.module"
        }
      }
    }
  }
}
``` 

To ensure we can detect against fields. I also mix them with regular const keyword fields in another index to ensure they work also in mixed use cases.

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2021-06-04 14:05:51 -06:00
Dima Arnautov 0793753b9d
[Lens] Heatmap / Swim lane integration (#97978)
* heatmap wip

* format values on X axis

* format values for cells

* show labels

* support legend configuration

* render preview

* add icon

* [ML] update visualization

* [ML] init suggestions

* [ML] fix preview

* [ML] fix groupPosition for the legend control

* [ML] add formatter for Y-axis

* [ML] filterOperations for cell value

* [ML] fill all available height

* [ML] delete unused file

* [ML] fix suggestion state

* [ML] update suggestion, add hiding logic

* [ML] suggestions unit tests

* [ML] rename legend interface

* [ML] unit tests for visualization, add error messages

* [ML] fix typos in xy visualization tests

* [ML] support click event

* [ML] add xDomain for time series data

* [ML] support empty Y axis

* [ML] change legend default position

* [ML] getTimeZone util

* [ML] hide suggestions for reorder

* [ML] support brush event

* [ML] update unit tests

* [ML] render grid lines in preview

* [ML] don't display errors on init

* [ML] utilize chartsThemeService

* [ML] support histogram for the vertical axis

* [ML] fix clearLayer

* [ML] show empty placeholder on no data

* [ML] fix X domain min

* [ML] reject suggestions for 3 or more  buckets

* [ML] suggestions for histograms and histogram for Y-axis

* [ML] fix unit tests

* [ML] update suggestions for active heatmap

* [ML] chart data test for heatmap

* [ML] test for transitioning from heatmap to barchart

* [ML] disable xDomain

* [ML] support intervals in axes configurations

* [ML] hide label on the vertical axis when there is only a horizontal dimension

* [ML] set min cell height for better suggestions preview rendering

* [ML] fix tooltip for empty vertical axis config

* [ML] fix click and brushing for empty Y axis

* [ML] update functional test

* [ML] show beta label

* [ML] fix legend control

* [ML] dataIndex sort by default for the X axis

* [ML] use euiPaletteForTemperature with quantize color scale

* [ML] hide all suggestions

* [ML] fix chart data extension issue

* [ML] fix the caret symbol positioning

* [ML] update unit tests for the heatmap suggestions

* [ML] replace EuiBetaBadge with EuiBadge

* [ML] update functional test

* [ML] fix chart switch styles

* [ML] fix functional test

* [ML] return null instead of expression with a missing value accessor

* [ML] use table id as a chart id

* [ML] fix scale type for a single row of data

* [ML] filter out undefined values

* [ML] fix isXAxisLabelVisible

* [ML] update chart_switch styles

* show warning message for the array values

* remove unused code

* replace ts-ignore with manual type casting

* add unit tests for error and warning messages

* add css class for append, conditional flex group
2021-06-04 15:28:43 -04:00
Paul Tavares 36996634c3
[Security Solution][Endpoint] Add ability to isolate the Host from the Endpoint Details flyout (#100482)
* Add un-isolate form to the endpoint flyout
* Add Endpoint details flyout footer and action button
* Refactor hooks into a directory
* Refactor endpoint list actions into reusable list + add it to Take action on details
* Refactor Endpoint list row actions to use new common hook for items
* generate different values for isolation in endpoint generator
* move `isEndpointHostIsolated()` utility to a common folder
* refactor detections to also use common `isEndpointHostIsolated()`
* httpHandlerMockFactory can now handle API paths with params (`{id}`)
* Initial set of re-usable http mocks for endpoint hosts set of pages
* fix bug in `composeHttpHandlerMocks()`
* small improvements to test utilities
* Show API errors for isolate in Form standard place
2021-06-04 10:59:53 -04:00
Nathan Reese 93df9a32a4
[Maps] embeddable migrations (#101070)
* [Maps] embeddable migrations

* review feedback

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-04 08:00:41 -06:00
Spencer be9fcad655
[fix] import from the root of @kbn/expect (#101321)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-06-03 18:13:11 -04:00
Tiago Costa f69d63e8be
fix(NA): windows ts_project outside sandbox compilation (#100947)
* fix(NA): windows ts_project outside sandbox compilation adding tsconfig paths for packages

* chore(NA): missing @kbn paths for node_modules so types can work

* chore(NA): missing @kbn paths for node_modules so types can work

* chore(NA): organizing deps on non ts_project packages

* chore(NA): change order to find @kbn packages on node_modules first

* chore(NA): add @kbn/expect typings setting on package.json

* chore(NA): fix typechecking

* chore(NA): add missing change on tsconfig file

* chore(NA): unblock windows build by not depending on the pkg_npm rule symlink in the package.json

* chore(NA): add missing depedencies on BUILD.bazel file for io-ts-list-types

* chore(NA): remove rootDirs configs

* chore(NA): change kbn/monaco targets order

* chore(NA): update kbn-monaco build

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-03 17:53:39 +01:00
Thom Heymann 07ce6374ef
Bump packages (#101167)
* Bump mini-css-extract-plugin

* Removed unused dependency

* Remove unecessary types

* Don't match _meta field
2021-06-03 19:29:57 +03:00