Commit graph

8816 commits

Author SHA1 Message Date
Thomas Neirynck 24f463f84c
[Maps] Track enterprise use of on-prem EMS (#85885) 2020-12-15 16:50:26 -05:00
Nathan Reese 85dae266eb
[Maps] unify legend for percentiles, interpolate, and custom ordinal color breaks (#85343)
* [Maps] unify legend for percentiles, interpolate, and custom ordinal color breaks

* unify mapbox style expression

* snapshot updates

* update jest expects

* use less than and great than symbol for first and last stop

* tslint

* do not show legend if customColorRamp is not provided

* update functional test expects

* update functional test expect

* update mapbox expect expressions in join functional tests

* update mvt expects

* revert mapbox style expression changes for interpole color ramp

* add greater then and equal to symbol for last stop

* disable stop input for first ordinal color stop

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 14:42:02 -07:00
Dima Arnautov e17cd65196
[Transform] Add support for latest function (#85784)
* [Transform] add latest to the schema definition

* [ML] update interfaces, add guards

* [Transform] WIP support latest function

* [Transform] fix request with missing_bucket after merge

* [Transform] fix error in useDeleteTransforms

* [Transform] fix types and fields sorting for pivot

* [Transform] fix types and jest tests

* [Transform] fix error shape

* [Transform] fixed card width, change description

* [Transform] fixed API integration tests

* [Transform] fix config mapper

* [Transform] improve wizard performance
2020-12-15 22:40:13 +01:00
Constance 2a71d41a60
[App Search] Document Creation Buttons & bare-bones modal/logic (#85902)
* [Setup] Add EuiCardTo helper

* Set up very basic DocumentCreationLogic file modal management

* Create buttons and modal components

* Update EngineOverviewEmpty to use only DocumentCreationButtons

- Remove API section/example/constants for now: per design discussion, we'll be moving this section into the document creation modal
- Move preceding DOCUMENT_CREATION_DESCRIPTION paragraph directly into DocumentCreationButtons, since the Documents view will just use this verbatim

* Update Documents view Index Documents button to show DocumentsCreationModal

- with some extra logic to add a new creationStep view
+ some minor test cleanup / clarification for openDocumentCreation

* Update Crawler button with conditional check

- Forgot to port this over initially

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 13:34:19 -08:00
Patrick Mueller f693697c18
[actions] expand object context variables as JSON (#85903)
resolves https://github.com/elastic/kibana/issues/75601

Previously, if a context variable that is an object is referenced in a
mustache template used as an action parameter, the resulting variable
expansion will be `[Object object]`.  In this PR, we change this so that
the expansion is a JSON representation of the object.

This is primarily for diagnostic purposes, so that customers can see
all the context variables available, and their values, while testing
testing their alerting actions.
2020-12-15 16:31:36 -05:00
Quynh Nguyen 74ae348f2d
[ML] Redesign index-based Data Visualizer (#85726) 2020-12-15 15:19:47 -06:00
Michael Olorunnisola bfb65434a6
[Security Solution][Resolver] Fix failing test & cleaned up prop drilling (#85994) 2020-12-15 16:00:30 -05:00
Pierre Gayvallet a4c4fe0504
[SO Tagging] Update tag delete modal confirmation title (#85997)
* Update tag deletion modal confirmation text

* add .
2020-12-15 21:41:47 +01:00
Thomas Neirynck 47e2663473
[Maps] Add percentile (#85367) 2020-12-15 15:40:21 -05:00
Rudolf Meijering 89bd0fbf1e
Resilient saved object migration algorithm (#78413)
* Initial structure of migration state-action machine

* Fix type import

* Retries with exponential back off

* Use discriminated union for state type

* Either type for actions

* Test exponential retries

* TaskEither types for actions

* Fetch indices instead of aliases so we can collect all index state in one request

* Log document id if transform fails

* WIP: Legacy pre-migrations

* UPDATE_TARGET_MAPPINGS

* WIP OUTDATED_DOCUMENTS_TRANSFORM

* Narrow res types depending on control state

* OUTDATED_DOCUMENTS_TRANSFORM

* Use .kibana instead of .kibana_current

* rename control states TARGET_DOCUMENTS* -> OUTDATED_DOCUMENTS*

* WIP MARK_VERSION_INDEX_READY

* Fix and expand INIT -> * transition tests

* Add alias/index name helper functions

* Add feature flag for enabling v2 migrations

* split state_action_machine, reindex legacy indices

* Don't use a scroll search for migrating outdated documents

* model: test control state progressions

* Action integration tests

* Fix existing tests and type errors

* snapshot_in_progress_exception can only happen when closing/deleting an index

* Retry steps up to 10 times

* Update api.md documentation files

* Further actions integration tests

* Action unit tests

* Fix actions integration tests

* Rename actions to be more domain-specific

* Apply suggestions from code review

Co-authored-by: Josh Dover <me@joshdover.com>

* Review feedback: polish and flesh out inline comments

* Fix unhandled rejections in actions unit tests

* model: only delay retryable_es_client_error, reset for other left responses

* Actions unit tests

* More inline comments

* Actions: Group index settings under 'index' key

* bulkIndex -> bulkOverwriteTransformedDocuments to be more domain specific

* state_action_machine tests, fix and add additional tests

* Action integration tests: updateAndPickupMappings, searchForOutdatedDocuments

* oops: uncomment commented out code

* actions integration tests: rejection for createIndex

* update state properties: clearer names, mark all as readonly

* add state properties currentAlias, versionAlias, legacyIndex and test for invalid version scheme in index names

* Use CONSTANTS for constants :D

* Actions: Clarify behaviour and impact of acknowledged: false responses

* Use consistent vocabulary for action responses

* KibanaMigrator test for migrationsV2

* KibanaMigrator test for FATAL state and action exceptions in v2 migrations

* Fix ts error in test

* Refactor: split index file up into a file per model, next, types

* next: use partial application so we don't generate a nextActionMap on every call

* move logic from index.ts to migrations_state_action_machine.ts and test

* add test

* use `Root` to allow specifying oss mode

* Add fix and todo tests for reindexing with preMigrationScript

* Dump execution log of state transitions and responses if we hit FATAL

* add 7.3 xpack tests

* add 100k test data

* Reindex instead of cloning for migrations

* Skip 100k x-pack integration test

* MARK_VERSION_INDEX_READY_CONFLICT for dealing with different versions migrating in parallel

* Track elapsed time

* Fix tests

* Model: make exhaustiveness checks more explicit

* actions integration tests: add additional tests from CR

* migrations_state_action_machine fix flaky test

* Fix flaky integration test

* Reserve FATAL termination only for situations which we never can recover from such as later version already migrated the index

* Handle incompatible_mapping_exception caused by another instance

* Cleanup logging

* Fix/stabilize integration tests

* Add REINDEX_SOURCE_TO_TARGET_VERIFY step

* Strip tests archives of */.DS_Store and __MAC_OSX

* Task manager migrations: remove invalid kibana property when converting legacy indices

* Add disabled mappings for removed field in map saved object type

* verifyReindex action: use count API

* REINDEX_BLOCK_* to prevent lost deletes (needs tests)

* Split out 100k docs integration test so that it has it's own kibana process

* REINDEX_BLOCK_* action tests

* REINDEX_BLOCK_* model tests

* Include original error message when migration_state_machine throws

* Address some CR nits

* Fix TS errors

* Fix bugs

* Reindex then clone to prevent lost deletes

* Fix tests

Co-authored-by: Josh Dover <me@joshdover.com>
Co-authored-by: pgayvallet <pierre.gayvallet@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 21:40:02 +01:00
Scotty Bollinger 15876f85b1
[Workplace Search] Split out logic between Source and AddSource (#85658)
* Copy SourceLogic to AddSourceLogic

This commit merely copies SourceLogic and renames it to AddSourceLogic with the name of the component and interfaces changed. This will make reviewing the changes easier later

* Delete duplicated logic data

* Update component paths

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 14:22:11 -06:00
John Schulz ec4fbf2901
[Fleet][EPM] Revert es-storage-related commits (#85942)
* Revert "[Fleet][EPM] Save installed package assets in ES (#83391)"

This reverts commit 81a340e681.

* Revert 00c2e96

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 15:11:46 -05:00
Nathan Reese 609d60705e
[Maps] provide function to create basemap layer descriptor (#85617)
* [Maps] provide function to create basemap layer descriptor

* update typing

* update APM map to use createBasemapLayerDescriptor

* fix useLayerList jest test

* tslint fixes

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 12:40:44 -07:00
Nathan Reese fa82f630a0
[Maps] 7.11 documentation updates (#85857)
* [Maps] 7.11 documenation updates

* update search docs with time filter legend indicator

* clean up tracks description

* fix duplicate id

* Update docs/maps/search.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/maps/vector-style.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/maps/vector-style.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* review feedback

* add percentile metric aggregation

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
2020-12-15 12:37:16 -07:00
Paul Tavares 23cd2670e1
[SECURITY SOLUTION][ENDPOINT] Trusted Apps API to retrieve item summary by OS (#85870)
* API to return trusted apps summary
2020-12-15 14:21:25 -05:00
Jane Miller 1c1e4981bb
Add malware.threshold field to mac and windows (#85971) 2020-12-15 14:15:23 -05:00
Devon Thomson e4114dc08f
Dashboard Print Optimize Class Change (#85878)
* Fixed print oversight from deangularize PR & removed grey lines from background of print optimized dashboard PDF
2020-12-15 14:01:11 -05:00
Pierre Gayvallet f4b7916699
do not throw when query parsing fails (#85970) 2020-12-15 19:54:11 +01:00
Mike Côté ccfb4b6b1d
Add footer to all emails sent by Kibana email connector with a link to open Kibana or to the alert details page (#84371)
* Initial work

* Change messaging from copy

* Fix jest tests for email connector

* Fix jest tests for alerts plugin

* Update copy

* Use server.publicBaseUrl

* Fix jest tests

* Update tests

* Cleanup jest test

* Code cleanup

* Improve email parameter names for kibana footer url

* Cleanup

* Add test for kibana footer link

* Fix type check

* Fix jest test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 13:51:44 -05:00
Kevin Qualters 47444e77c2
[Security Solution] Pass filters from SIEM to resolver, update resolver when refresh is clicked (#85812)
* Pass filters from SIEM to resolver

* Fix test type errors

* Revert loading state change, update snapshots

* Make correct check in nodeData selector

* Fix inverted logic in nodeData selector

* Revert nodeData invalidation logic

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 13:33:51 -05:00
Devon Thomson ee37f6dd91
[Time to Visualize] Transition Embeddable State Transfer to Session Storage (#85688)
* Transitioned embeddable state transfer service to use sessionStorage
2020-12-15 13:18:36 -05:00
Melissa Alvarez 11713acc7c
[ML] Data Frame Analytics: ensure map view supports dark theme (#85886)
* use current eui theme in map

* ensure labels do not overlap. add job type legend

* reduce padding in legend popover
2020-12-15 13:17:53 -05:00
Cauê Marcondes 013c1761ee
[APM] Bug: Service overview - change the Traffic and Error rate chart legend labels to the current metric (#85930)
* changing chart legends

* removing (avg) from value
2020-12-15 18:50:26 +01:00
Scotty Bollinger 7c6f1b8a0a
[Workplace Search] Add i18n to Add Source component tree (#85590)
* Add i18n for AddSourceList

* Add i18n for AvailableSourcesList

* Replace all instances of interal Link

This was missed during the migration. We need to use the components we wrap Eui components with internally.

Also fixes some imports that were unnecessarily going up one level and back down for imports.

* Add i18n for ConfigCompleted

* Add i18n for ConfigDocsLinks

* Add i18n for ConfigurationIntro

* Add i18n for ConfigureCustom

* Add i18n for ConfigureOauth

* Add i18n for ConfiguredSourcesList

* Add i18n for ReAuthenticate

* Add i18n for shared field labels

Also includea shared SourceConfigFields

* Add i18n for SaveConfig

* Add i18n for SaveCustom

* Add i18n for SourceFeatures

* Add i18n for ConnectInstance

* Fix duplicate i18n ID

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 11:44:18 -06:00
Melissa Alvarez 43e20112b1
[ML] Data Frame Analytics: check space permissions before deleting jobs (#85495)
* disable delete until checks complete

* add canDeleteJobs wrapper in saved objects service

* create DeleteJobCheckModal shared component

* wip: add deleteJobModal check in list and map views

* adding remove from current space endpoint

* updating error text

* fixing typo in variable name

* Update button content. Add untagging functionality

* adding anomaly detection delete job modal

* fix modal content bug

* refresh job map after deletion or untagging

* adding job refresh to anomaly detectors

* go straight to delete flow if only action available

* fixing test

* update text

* increase line spacing in check modal

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: James Gowdy <jgowdy@elastic.co>
2020-12-15 12:44:03 -05:00
Marco Liberati 9b71c94ff1
[Lens] Add datasource fields group help text (#85544)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 18:23:41 +01:00
Davis Plumlee 13e5e55901
[Security Solution][Detection Rules] Makes threat techniques optional (#85481) 2020-12-15 12:08:15 -05:00
Constance 07f395f7dd
Misc responsive tweaks to Documents view (#85440)
+ misc cleanup - extra div, true

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 09:02:12 -08:00
Cauê Marcondes 04d4e71ff5
removing margin for sparkline charts (#85917) 2020-12-15 16:34:11 +01:00
Tiago Costa 47ffefec09
skip flaky suite (#85899) 2020-12-15 15:15:11 +00:00
Tiago Costa 5fdace379c
skip flaky suite (#85714) 2020-12-15 15:02:26 +00:00
ymao1 853f30e23d
[Alerts] Remove Add Alerts flyout onClose (#85462)
* Remove add alerts flyout after onClose

* Updating tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Gidi Meir Morris <github@gidi.io>
2020-12-15 09:58:57 -05:00
Alison Goryachev 579ead8eaf
Handle multiple monaco editor instances for Painless lang (#85834) 2020-12-15 09:37:21 -05:00
Casper Hübertz 9ce6331ead
[APM] Increase Logstream height (#85913)
Increasing the component height for more optimal viewing experience.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 15:19:45 +01:00
Nicolas Chaulet 724b90e01b
[Fleet] Fix agent details logs on safari (#85884) 2020-12-15 09:10:17 -05:00
Steph Milovic 335cd1f6fc
[Security Solution] [Cases] Move field mappings from actions to cases (#84587) 2020-12-15 07:06:11 -07:00
Jonathan Buttner d4a631cf8e
[Security Solution][Resolver] Fixing resolver functional tests (#85647)
* Fixing resolver functional tests

* Import the animation constant

* Only check specific nodes instead of all the ones in view

* Removing check for link text

* updating test description

* Adding comments
2020-12-15 08:31:59 -05:00
Søren Louv-Jansen 20638a64e2
[APM] Correlations polish (#85116)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 13:15:00 +01:00
Daniil 845f716271
[Data table] Reactify & EUIficate the visualization (#70801)
* Use data grid for table vis

* Create basic table template

* Add table_vis_split component

* Apply cell filtering

* Add aria-label attributes

* Use field formatters for values

* Add no results component

* Remove legacy dependencies

* Add usePagination

* Create usePagination util

* Use percentage column and total row

* Use csv export button

* Update labels

* Fix merge conflicts

* Use split table

* Fix functional tests

* Fix dashboard tests

* Update data table functional tests

* Fix missed test

* Introduce showToolbar option

* Remove useless package

* Fix merge conflicts

* Return back kibanaUtils required bundle

* Revert "Remove useless package"

This reverts commit 144a7cd77c.

* Use feature flag for legacy vis

* Add footer row

* Remove lock files

* Revert "Remove lock files"

This reverts commit 5c5acd79f4.

* Minor fixes

* Use common no result message

* Fix broken tests

* Use ui state sorting

* Fix error

* Fix merge conflicts

* Add legacy functional tests

* Pull pagination footer up to keep with table

and fix column split growing continuously in dashboard

* Comments fixes

* Use cell actions for filtering

* Fix translations

* Fix comments

* Reduce legacy tests amount

* Update sorting

* Update split column layout

* Add telemetry for legacy vis

* Apply latest changes for split table

* Fix eslint errors

* Use aria labels with values

* Use aria label for export btn

* Fix functional test

* Update translations

* Cleanup

* Truncate cells content

* Enhance types in table_vis_response_handler.ts

* Persist columns width on change

* Fix sorting history

* Add a migration script for toolbar

* Export sorted table

* Use reportUiCounter instead of reportUiStats

* Fix integration tests

* Fix typos

* Adjust FieldFormat type

* Hide the density selector

* Update docs

* Fix pagination

* Restrict hiding the toolbar

* Fix column index on filter

* Add closePopover action

Co-authored-by: cchaos <caroline.horn@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 14:44:20 +03:00
Marco Liberati 62623cdab9
[Lens] New sorting feature for the datatable visualization (#84435)
Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 12:37:59 +01:00
Vadim Dalecky a57cba4978
Drilldown allow list (#85779)
* feat: 🎸 add ROW_CLICK_TRIGGER

* feat: 🎸 wire row click event to UI Actions trigger in Lens

* feat: 🎸 add row click trigger to url drilldown

* feat: 🎸 add datatable to row click context

* feat: 🎸 pass in row index in row click trigger context

* feat: 🎸 add columns to row click trigger context

* feat: 🎸 fill values and keys event scope array

* feat: 🎸 generate correct row scope variables

* fix: 🐛 report triggers from lens embeddable

* feat: 🎸 add sample preview for row click trigger

* feat: 🎸 remove url drilldown preview box

* chore: 🤖 remove mock variable generation functions

* feat: 🎸 generate context and global variable lists

* feat: 🎸 preview event variable list

* feat: 🎸 show empty url error on blur

* feat: 🎸 add ability to always show popup for executed actions

* refactor: 💡 rename multiple action execution method

* fix: 🐛 don't add separator befor group on no main items

* feat: 🎸 wire in uiActions service into datatable renderer

* feat: 🎸 check each row if it has compatible row click actions

* feat: 🎸 allow passing data to expression renderer

* feat: 🎸 add isEmbeddable helper

* feat: 🎸 pass embeddable to lens table renderer

* feat: 🎸 hide lens table row actions which are empty

* feat: 🎸 re-render lens embeddable when dynamic actions chagne

* feat: 🎸 hide actions column if there are no row actions

* feat: 🎸 re-render lens embeddable on view mode chagne

* fix: 🐛 fix TypeScript errors

* chore: 🤖 fix TypeScript errors

* docs: ✏️ update auto-generated docs

* feat: 🎸 add hasCompatibleActions to expression layer

* feat: 🎸 remove "data" from expression renderer handlers

* fix: 🐛 fix TypeScript errors

* test: 💍 fix Jest tests

* docs: ✏️ update autogenerated docs

* fix: 🐛 wrap event payload into data

* test: 💍 add "alwaysShowPopup" test

* chore: 🤖 add comment requested in review

https://github.com/elastic/kibana/pull/83167#discussion_r537340216

* test: 💍 add hasCompatibleActions test

* test: 💍 add datatable renderer test

* test: 💍 add Lens embeddable input change tests

* test: 💍 add embeddable row click test

* fix: 🐛 add url validation

* test: 💍 add url drilldown tests

* docs: ✏️ remove url drilldown preview from docs

* docs: ✏️ remove preview from url templating

* docs: ✏️ add row click description

* chore: 🤖 move 36.5 KB bundle balance to url_drilldown

* test: 💍 simplify test case

* feat: 🎸 check if external URL is valid before redirecting user

* test: 💍 check for external URL validity

* feat: 🎸 check if external URL is allowed in exec and getHref

* test: 💍 fix test import
2020-12-15 12:17:19 +01:00
Dario Gieselaar 8ccad311d0
[APM] Service overview instances table (#85770) 2020-12-15 11:04:32 +01:00
Angela Chuang e261aa2649
[Security Solution] Unskip timeline creation Cypress test (#85871)
* fix cypress

* add a comment
2020-12-15 09:29:37 +00:00
Pierre Gayvallet bd7e7090a1
properly recognize enterprise licenses (#85849) 2020-12-15 10:26:43 +01:00
Ryland Herrick 5febe5fa7e
[SecuritySolution][Detections] Adds SavedObject persistence to Signals Migrations (#85690)
* Adds new SO type for persisting our signals migrations

* WIP: Migration status SO client

Trying to forge a patterrn using io-ts to validate at runtime. I think
I've got it working but I want to refactor the pipeline out into a
reusable function(s).

* Implements our SavedObjects service for signals migrations

* Defines a simple client that delegates to the base SO client with
our SO type
* Defines a service that consumes the simpler client, adding validations
  and data transforms on top.

* Refactoring migration code to work with saved objects

As opposed to the previous ephemeral, encoded tokens, we now retrieve migration
info from saved objects.

At the API level, this means that both the create and finalize endpoints
receive a list of concrete indices. No more passing around tokens.

As both endpoints are idempotent, users can hammer them as much as they
want with the same lists of indices. Redundant creates and finalizes
will be met with inline 400 messages, and as one continues to poll the
finalize endpoint they should see more and more indices respond with
"completed: true"

* Fixing integration tests first, and anything upstream breaking them

* Clean up API integration tests

* standardize assignment of responses (with types)
* deletes migration SOs as test cleanup

* Split API tests into separate files

This was getting big and unwieldy; this splits these into one file per
endpoint.

* Refactor: split existing migration service functionality into atomic functions

This will allow us to repurpose the service to compose more
functionality and be more specifically useful, while keeping the
component logic separate.

* WIP: moving logic into migrationService.create

* Splitting get_migration_status into component functions

getMigrationStatus was really two separate aggregations, so I split them
out and we recompose them in the necessary routes.

* Move finalization logic into function

* migrationService exposes this as .finalize()
* adds an error field to our migration SO
  * We currently only have one error that we persist there, but it would
    be very time-consuming to track down that information were it not
    there.

* Adds function for migration "deletion" logic

* migrationService leverages this function
* adds new boolean to our savedObject
* deletes unused function (deleteMigrationSavedObject)

* Adds route for soft-deletion of migrations

* Updating tests related to migration status

* Adding/updating mocks/unit tests necessary to satisfy the things I
  need to test
* I mainly wanted to test that the the status endpoint filtered out the
  deleted migrations; this was accomplished with a unit test after
  fleshing out some mocks/sample data.

* Move old migration service tests to the relevant function tests

This logic was previously moved out into component functions; this moves
the tests accordingly.

* Add some unit tests around our reindex call

* Fix create migration route tests

Mocks out our migration functions, rather than stubbing ES calls
directly.

* Updates finalize route unit tests

Addresses functionality that hasn't been moved to finalizeMigration()

* Unit tests our finalization logic

Fixes a bug where we weren't accounting for soft-deleted migrations.
ALso updates our test migration SO to have a status of 'pending' as
that's a more useful default.

* Fixes finalization integration tests

These were failing due:
* a change in the migration status API response
* a bug I introduced in the finalize route

* Adds tests for our migration deletion endpoint

* unit tests
* API integration tests
* Caught/fixed bug with deleting a successful migration

* Fixes types

Removes unused code.

* Prevent race condition due to template rollover during migration

If a user has an out of date index (v1) relative to the template (v2), but the
template itself is out of date (newest is v3), then it's possible that
the template is rolled over to v3 after the v1-v2 migration has been
created but before the new index has been created.

In such a case, the new index would receive the v3 mappings but would
incorrectl be marked as v2. This shouldn't necessarily be an issue, but
it's an unnecessary state that can easily be prevented with the guard
introduced here.

* Add real usernames to migration savedObjects

In addition to the SOs themselves giving us observability into what
migration actions were performed, this gives us the additional info of
_who_ performed the action.

* Index minimal migration SO fields needed for current functionality

* Add additional migration info to status endpoint

This will allow users to finalize a migration if they've lost the
response to their POST call.

* Finalize endpoint receives an array of migration IDs, not indices

This disambiguates _which_ migrations we were finalizing if you passed
an index (which was previously: the most recent migration).

* Fix type errors in tests after we threaded through username

* Update responsibilities of migration finalize/delete endpoints

Discussions with @marshallmain lead to the following refactor:

* finalize does not delete tasks
* finalize only applies cleanup policy to a failed migration
* delete takes an array of migration ids (like finalize)
* delete hard-deletes the SavedObject of a completed (failed or
  successful) migration

This gives a bit more flexibility with the endpoints, as well as
disambiguates the semantics: it just deletes migrations!

* Fix tests that were broken during refactoring

* Fix type errors

I removed some logic here but forgot the imports :(

* Move outdated integration test

In the case of a successful migration, application of the cleanup policy
is done by the deletion endpoint. In the interest of data preservation,
we do not delete a sourceIndex unless it is explicitly deleted.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 03:25:39 -06:00
Silvia Mitter 98308f8680
[Fleet] Change permissions for Fleet enroll role (#85802)
* Add APM traces index names to Fleet enroll role

* Removes fleet permissions for `events-*` as they became obsolete

fixes #85761
2020-12-15 09:31:39 +01:00
Marshall Main 818246e467
[Security Solution][Detections] Add alert source to detection rule action context (#85488)
* Adds context.alerts as available parameter for detection rule actions

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 01:43:50 -05:00
Yuliia Naumenko 37525f80a0
License checks for alerts plugin (#85649)
* [Alerts][License] Define minimum license required for each alert type (#84997)

* Define minimum license required for each alert type

* fixed typechecks

* fixed tests

* fixed tests

* fixed due to comments

* fixed due to comments

* removed file

* removed casting to LicenseType

* [Alerts][License] Add license checks to alerts HTTP APIs and execution (#85223)

* [Alerts][License] Add license checks to alerts HTTP APIs and execution

* fixed typechecks

* resolved conflicts

* resolved conflicts

* added router tests

* fixed typechecks

* added license check support for alert task running

* fixed typechecks

* added integration tests

* fixed due to comments

* fixed due to comments

* fixed tests

* fixed typechecks

* [Alerting UI][License] Disable alert types in UI when the license doesn't support it. (#85496)

* [Alerting UI][License] Disable alert types in UI when the license doesn't support it.

* fixed typechecks

* added licensing for alert list and details page

* fixed multy select menu

* fixed due to comments

* fixed due to comments

* fixed due to comments

* fixed typechecks

* fixed license error message

* fixed license error message

* fixed typechecks

* fixed license error message

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-14 19:29:39 -08:00
Patrick Mueller 7873e3685b
Allow action types to perform their own mustache variable escaping in parameter templates (#83919)
resolves https://github.com/elastic/kibana/issues/79371
resolves https://github.com/elastic/kibana/issues/62928

In this PR, we allow action types to determine how to escape the
variables used in their parameters, when rendered as mustache
templates.  Prior to this, action parameters were recursively
rendered as mustache templates using the default mustache
templating, by the alerts library.  The default mustache
templating used html escaping.

Action types opt-in to the new capability via a new optional
method in the action type, `renderParameterTemplates()`.  If not
provided, the previous recursive rendering is done, but now with
no escaping at all.

For #62928, changed the mustache template rendering to be
replaced with the error message, if an error occurred,
so at least you can now see that an error occurred.  Useful
to diagnose problems with invalid mustache templates.
2020-12-14 20:41:13 -05:00
Yuliia Naumenko b7c9d22133
Removed Alerting & Event Log deprecated fields that should not be using (#85652)
* Removed Alerting & Event Log deprecated fields that should not be using

* fixed due to comments
2020-12-14 17:05:58 -08:00