Commit graph

29359 commits

Author SHA1 Message Date
Joe Reuter 489b39cfe7
Re-enable datemath in from/to canvas timelion args (#52159) 2019-12-11 14:14:25 +01:00
Felix Stürmer 0cd62cabbb
[Logs + Metrics UI] Remove eslint exceptions (#50979)
This removes the two eslint exceptions specific to the `infra` plugin introduced in #49244.

fixes #49563
2019-12-11 13:48:40 +01:00
Alejandro Fernández 9fcc93457f
[Logs + Metrics UI] Add missing headers in Logs & metrics (#52405)
* Fix broken aria references

`EuiDescribedFormGroup` needs an actual header in its `title` for it to
make a correct `aria-labelledby`.

* Fix `aria-labelledby` references in settings page


Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2019-12-11 13:47:37 +01:00
Robert Oskamp 248904ec87
[ML] API integration tests - initial tests for bucket span estimator (#52636)
This PR adds basic API integration tests for the bucket span estimator.
2019-12-11 11:05:36 +01:00
Jean-Louis Leysens aa31b535d1
[Watcher] New Platform (NP) Migration (#50908)
* First iteration of watch public -> new platform
Still need to switch to np ready version of use_request

* - Switched to using np ready request
- Some updates after API changes

* First attempt at server shim

* Rename file and re-enable react hooks linting

* Fix some public types and react hooks lint rules

* Fix types

* More ES lint react hooks fixes

* Migrated server lib -> ts. Part way done with migrating routes to NP router and TS

* Big subset of routes to TS and NP router - almost there

* Delete legacy error wrappers and moved last set of routes to TS and NP router

* Remove @ts-ignore's and update route registration to use shim with http router

* Added routes validations, fixes for hooks and fixes for types

* Fix more types and finish testing API routes

* Fix usage of feature catalogue and fix time buckets types

* Fix error message shape [skip ci]

* Split legacy from new platform dependencies server-side

* Refactor: Seperate client legacy and NP dependencies

* Add file: added types file

* Fix UISettings client type import

* Update license pre-routing factory spec

* Update variable names, use of I18nContext (use NP) and docs

* Use NP elasticsearchclient

* Simplify is_es_error_factory

* Fix types

* Improve code legibility and remove second use of `useAppContext`

* Use @kbn/config-schema (not validate: false) on routes!

* Fix watch create JSON spec

* Create threshold test working

* Unskip watch_edit.test.ts

* Unskip watch_list.test.ts

* Done re-enabling component integration tests

* TimeBuckets typo + remove unnecessary // @ts-ignore
2019-12-11 09:54:42 +01:00
Aleh Zasypkin 7e27f0d35f
Decouple Authorization subsystem from Legacy API. (#52638) 2019-12-11 08:55:46 +01:00
Dario Gieselaar f0eb4bb675
[APM] Fix some warnings logged in APM tests (#52487)
* [APM] Fix some warnings logged in APM tests

(Seemingly) since the React upgrade in 439708a6f9, our tests have started logging various warnings/errors to the console. The test suite is still passing but it creates a lot of noise.

Changes:

- use `act` or `wait` when appropriate
- mock useFetcher calls
- cleanup in useDelayedVisbility

* Replace tick() with wait()
2019-12-11 08:47:44 +01:00
Alexey Antonov 6a8b2a25c8
[ui/public/utils] Delete unused base_object & find_by_param (#52500)
Closes #51854
2019-12-11 10:30:45 +03:00
Alexey Antonov 1013271c85
[ui/public/utils] Move items into ui/vis (#52615)
* [ui/public/utils] Move items into ui/vis

* fix PR comments
2019-12-11 10:28:54 +03:00
spalger 3e1915d287 fix newlines in kbn-analytics build script 2019-12-10 21:07:57 -07:00
Stacey Gammon 79fc07c0c3
Add top level examples folder and command to run, --run-examples. (#52027)
* Add top level examples folder and command to run, `--run-examples`.

* Add comment explaining reason --run-examples flag turns off base path.
2019-12-10 18:02:03 -05:00
Tiago Costa 0eb4c18fe0
feat(NA): add trap for SIGINT in the git precommit hook (#52662) 2019-12-10 22:05:19 +00:00
gchaps 6e476e845d
[DOCS] Updtes description of elasticsearch.requestHeadersWhitelist (#52675) 2019-12-10 12:30:11 -08:00
Christiane (Tina) Heiligers 2dcb44850a
[Telemetry/Pulse] Updates advanced settings text for usage data (#52657)
* [Telemetry/Pulse] Updates advanced settings text for usage data
2019-12-10 12:55:41 -07:00
Frank Hassanabad 48d897e6e7
[SIEM][Detection Engine] Adds the default name space to the end of the signals index
## Summary

One liner to add the `default` to the end of the siem signals index for people to play with it.

### Checklist

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

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

~~- [ ] 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)~~

### 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)~~

~~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
2019-12-10 12:01:48 -07:00
Felix Stürmer cf28280496
[Logs UI] Generalize ML module management (#50662)
This abstracts the specific job details out of the ML module management hooks to enable re-use with the upcoming categorization module.

closes #50322
2019-12-10 19:21:10 +01:00
Joe Reuter 3c57f71c3a
Removing stateful saved object finder (#52166) 2019-12-10 17:50:00 +01:00
Joe Reuter 618e70433b
Shim oss telemetry (#51168) 2019-12-10 17:32:56 +01:00
Tim Sullivan e71deb2683
[Reporting/Screenshots] Do not fail the report if request is aborted (#52344)
* [Reporting/Screenshots] Do not fail the report if request is aborted

* take pageRequestFailed out of pageExit observable
2019-12-10 09:24:13 -07:00
Xavier Mouligneau 8115e500ff
[SIEM] [DETECTION ENG] Add MITRE ATT&CK (#52398)
* add mitre attack enterprise

* Add Mitre Att&ck on the about rule

* review

* fix internatiolazition

* bugs review

* fix ux with add reference
2019-12-10 10:46:56 -05:00
Frank Hassanabad 6ea07cbb9c
[SIEM][Detection Engine] Renaming and moving of folders and files (#52587)
## Summary

* Creates several folders
* Moves schema into smaller files
* Moves `utils.ts` in smaller files
* Splits apart the types to not be in one giant file but rather cascade bottom up

### Checklist

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

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

~~- [ ] 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)~~

### 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)~~

- [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2019-12-10 08:43:04 -07:00
Juan Álvarez 5217dfd731
update apm index pattern (#52629) 2019-12-10 16:11:58 +01:00
Maja Grubic 717e40c444
Move DashboardEmptyScreen inside DashboardViewport (#51939)
* Prototyping adding Visualization to Dashboard

* i18n fixes

* Remvoing dashboard empty screen directive

* Updating test for empty dashboard screen

* Removing unused state variable

* Adding a test for DashboardViewPort

* i18n & minor fixes

* Fixing fullscreen mode view

* Fixing failing functional test (hopefully)

* Minor style fix

* Fixing EUI text, rendering empty screen OR the panels

* Fixing empty screen in fullscreen mode

* Update snapshot

* Trying to render empty screen from Angular controller

* refactor: 💡 don't pass renderEmpty through inputs

And make sure isEmptyState is not stale.

* Fixing tests after Vadim's commit

* Removing unnecessary isEmptyStateProps

* Skipping failing test

* Removing unnecessary en.json file

* Re-adding emptyState, reintroducing functional test

* Fixing ja-JP file

* Undoing my thing to the functional test
2019-12-10 15:05:05 +00:00
Jean-Louis Leysens b4a27519b7
[Console] Move out of quarantined (#52270)
* WiP, lotta broken things, working through new editor.ts

* RowParser -> TS

* Utils to TS and regular module

* Finished first version of core & sense editor wrappers. Tokenizer provider test working. Still need to delete some files

* WiP - moved A LOT of code around and busy fixing sense-editor tests

* Fix sense editor test

* Clean up mocks

* Moved A LOT of code out of quarantined.
Still working on sense editor's integration test
Not running yet.

* WiP still finishing up manual testing

* Fix use of Ace Range and fix open documentation

* Move out of quarantined!

* Remove load remote editor state for now

* - fix use of token iterator
- remove ace ranges from sense editor spec and fix spec 🤦

* Address getSelectionRange document TODO
Clean up use of jquery
Remove use of `done` inside async tests (input_tokenization.test.js)
Capitalize elasticsearch
Introduce helper for converting to AceRange inside legacy core editor
Update typings
Clean up imports
Cleaner variable assignment

* Update src/legacy/core_plugins/console/public/np_ready/application/models/sense_editor/curl.ts

Co-Authored-By: Rory Hunter <pugnascotia@users.noreply.github.com>

* Remove commented-out code
lib/utils.js -> lib/utils.ts
Rename engulfling range (sense_editor)

* Rename format request function

* utils.ts default export usage cleanup

* Update replace regex and add another utils test

* Remove legacy replace behaviour

* Fix typo in comment
2019-12-10 13:16:23 +01:00
Shahzad f6c44df066
[Uptime] Feature/expandable row in details ping list (#51890)
* update columns

* update expand row in ping list
2019-12-10 12:37:57 +01:00
Matthias Wilhelm c4e4da377d
[Discover] Move State to inner angular (#52369) 2019-12-10 12:21:57 +01:00
Pierre Gayvallet 1cdbd600a9
moves eui mapping to own file (#52518) 2019-12-10 12:19:50 +01:00
Maryia Lapata 33989b0805
[Visualize] Shim with local application service (#49891)
* Add dashboard updates

* Use I18nProvider instead of I18nContext

* remove unused dependencies

* Centralizing and cleaning up legacy imports

* Fix merge conflict

* fix merge bugs and rename main dynamic entrypoint

* Rename app to legacy_app

* Clear deps

* fix jest tests

* fix saved object finder bug

* Fix unit tests

* Ignore TS

* revert using stateless component for this PR

* fix types

* Fix merge conflicts

* Update deps

* Revert filter bar export

* Revert ts-ignore

* Clean up

* Refactoring

* Fix test

* Remove global_state_sync

* Refactoring

* Remove uiExports/embeddableFactories

* Trigger digest cycle in local angular when vis is changed.

* Fix TS

* Revert back syncOnMount

* Add missed import

* Revert import 'uiExports/embeddableFactories'

* Update app navigation func test

* Update app navigation func test

* Update app navigation func test

* Remove 'kibana-install-dir' arg in pluginFunctionalTestsRelease

* Fix review comments

* Fix code review comments

* Rename alias

* Fix indexPatterns

* Use IndexPatternsContract interface
2019-12-10 13:50:45 +03:00
Frank Hassanabad 23edb41739
[SIEM][Detection Engine] Utilizes native alert tags
## Summary

* Changes out the params of tags to use the native alert tags.
* Updated unit tests
* Updated examples

Tests are:

Post a query with a tag
```sh
./post_rule.sh ./rules/queries/query_with_tags.json
```

Filter by that tag:

```sh
./find_rule_by_filter.sh "alert.attributes.tags:tag_1"
```

Update a query with a tag:

```sh
./update_rule.sh ./rules/updates/update_tags.json
```


### Checklist

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

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

~~- [ ] 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)~~

### 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)~~

- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2019-12-09 20:57:38 -07:00
Frank Hassanabad 5fb59f36a0
[SIEM][Detection Engine] Fixes a bug with signalsIndex key for configuration
## Summary

* Simple small bug fix so that the `signalsIndex` works again.

Without this any developer starting up Kibana with their `xpack.siem.signalsIndex` set will get a quick crash.

Test:
Add this key to your `kibana.dev.yml`
```sh
xpack.siem.signalsIndex: .siem-signals-your-name
```

Ensure it starts up without crashing. Take the key out, ensure it starts up without crashing.

In the folder:
```sh
detection_engine/scripts
```

You can run this and get back the index you expect which is whatever you set the key to and the space you're in:

```sh
./get_signal_index.sh 
{
  "name": ".siem-signals-your-name-default"
}
```

### Checklist

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

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

~~- [ ] 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)~~

### 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)~~

- [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2019-12-09 20:50:25 -07:00
Spencer 6ea1b2ccee
[ftr/lifecycle] refactor to be typesafe (#52453)
* [ftr/lifecycle] refactor to be typesafe

* update test fixture
2019-12-09 18:46:45 -07:00
Tiago Costa 6d5c8caadc
Adds support for log rotation (#49750)
* chore(NA): add log options to config yml

* chore(NA): remove unwanted option from config declaration

* chore(NA): add the bootstrap for the logging rotate feature

* feat(NA): base interface setup for log rotation feature

* docs(NA): add documentation for the new logging rotate options. chore(NA): added new schema validations

* chore(NA): base lifecycle methods and logic

* feat(NA): monitor logic for log rotate feature

* fix(NA): basic log rotation lifecycle

* chore(NA): fix typo on config file

* feat(NA): add rotate files feature to log rotator

* chore(NA): fix log rotate config

* chore(NA): some tests to try logging rotate lifecycle

* feat(NA): correct log rotation logic

* fix(NA): lifecycle for the log rotator

* test(NA): add a test case

* chore(NA): correctly add the new defaults to the config schema

* test(NA): change dir generation for test

* chore(NA): mock log rotate for logging service test

* test(NA): fix temp dir permission issue

* test(NA): try to fix test

* chore(NA): remove usage of mkdtemp

* refact(NA): feature logging rotation reimplementation in order to make it work across platforms

* fix(NA): bug on file size monitor handle

* fix(NA): remove wrong commented out code

* chore(NA): correctly identify if we should use polling

* chore(NA): fix some code comment

* refact(NA): minor implementation details

* chore(NA): change the order of logging mix

* test(NA): add some more test cases

* test(NA): add the majority of the test cases

* test(NA): add last test case

* test(NA): fallback conditions

* chore(NA): add logging rotate config keys to the docker image

* chore(NA): move logging.rotate.enable setting to enabled

* chore(NA): clarify documentation for logging rotate

* chore(NA): use regular instead of logWithMetadata

* chore(NA): move chokidar to a prod dep

* chore(NA): add log explaining why we had fallback to use polling

* test(NA): fix unit tests

* test(NA): fix unit tests

* chore(NA): correctly place this.running condition

* chore(NA): remove redundant call

* fix(NA): log filename containing numbers would produce invalid sorting

* chore(NA): remove existsSync function call from readRotatedFilesMetadata function

* chore(NA): Update docs/setup/settings.asciidoc

Co-Authored-By: Tyler Smalley <tylersmalley@me.com>

* chore(NA): Update docs/setup/settings.asciidoc

Co-Authored-By: Tyler Smalley <tylersmalley@me.com>

* chore(NA): Update docs/setup/settings.asciidoc

Co-Authored-By: Tyler Smalley <tylersmalley@me.com>

* chore(NA): Update docs/setup/settings.asciidoc

Co-Authored-By: Tyler Smalley <tylersmalley@me.com>

* chore(na): update src/legacy/server/logging/rotate/index.js

Co-Authored-By: Tyler Smalley <tylersmalley@me.com>

* chore(NA): remove unused config line from docker vars

* chore(NA): update documentation to include info about non exact limits

* chore(NA): remove redudant if clause

* fix(NA): correctly work with new keepFiles limit after start

* fix(NA): warning log for logging rotate

* chore(NA): replace logwithmetadate with log

* docs(NA): correct log to right terms

* docs(NA): add comment about usage of slice(-1)

* refact(NA): changing polling interval from seconds to milliseconds

* docs(NA): fix comments for shouldRotate method

* chore(NA): update src/legacy/server/logging/rotate/log_rotator.js

Co-Authored-By: Mikhail Shustov <restrry@gmail.com>

* chore(NA): update src/legacy/server/logging/rotate/log_rotator.js

Co-Authored-By: Mikhail Shustov <restrry@gmail.com>

* refact(NA): small change

* refact(NA): bound stop

* refact(NA): shouldUsePolling test function

* refact(NA): move named truncate function to delete

* refact(NA): typescript conversion

* chore(NA): type update for log rotation index file

* docs(NA): add experimental tag on docs

* chore(NA): add call protection of clearTimeout

* refact(NA): cleanup comments and wrong added logs plus inline config

* chore(NA): replace ts-ignore by non null assertion operator

* docs(NA): extend documentation for _renameRotatedFilesByOne call

* chore(NA): fix type problems for process.emit on nodejs
2019-12-10 01:32:20 +00:00
Mike Côté ca5f6d78f1
Denormalize actionTypeId into alert actions for easier filtering (#51628)
* Denormalize actionTypeId for easier filtering of alerts

* Add tests

* No longer pass actionTypeId for each alert action in APIs

* Add tests to ensure denormalizeActions works on multiple actions

* Fix ESLint errors
2019-12-09 19:30:42 -05:00
Luke Elmers de4269f8d4
Fix import causing Kibana to crash in IE11. (#52248) 2019-12-09 16:29:47 -07:00
Zacqary Adam Xeper 21f9ab255a
[Logs UI] Refactor log entry data fetching to hooks (#51526)
* Get initialinitial log fetch working with v2 store

* Replicate shouldLoadAroundPosition logic within hooks

* Reload entries on filter change

* Add scroll to load additional entries functionality

* Cleanup types types and remove state/remote folder

* Typescript cleanup

* Remove extraneous console.log

* Fix typecheck

* Add action to load new entries manually

* Typecheck fix

* Move v2 store stuff into logs containers

* Typecheck fix

* More typecheck fix

* Remove filterQuery from log highlights redux bridge

* Rename LogEntriesDependencies to LogEntriesFetchParams

* Fix endless reloading bug

* Fix duplicate entry rendering

* Make sourceId into a dynamic parameter

* Fix bug in pagesAfterEnd not being reported causing endless reload

* Fix bugs with live streaming
2019-12-09 17:24:58 -06:00
Robert Oskamp d429a9a1e8 [ML] Functional tests - fix typing issue (#52167)
* Use char by char typing in all text fields

* Add dely before first typed charakter when typing char by char

* Remove delay before typing again

* Use clearCharByChar option for input fields

* Revert "Use clearCharByChar option for input fields"

This reverts commit e412d7bc64.

* Revert "Use char by char typing in all text fields"

This reverts commit 2fbccc57c6.

* Disable jobCreatorUpdate for tests

* Revert "Disable jobCreatorUpdate for tests"

This reverts commit e178fd82ab.

* Check typing char by char for job wizard inputs

* Remove .only from anomaly detection suite

* Move setValueWithChecks from testSubjects to a ML service
2019-12-09 16:00:36 -07:00
Spencer 3293ede421
remove remaining idx usage (#52354)
* remove remaining idx usage

* handle possibly undefined value

* update NOTICE.txt
2019-12-09 15:59:07 -07:00
Nathan Reese a863dca9c2
[Maps] better style defaults (#52420)
* [Maps] better style defaults

* rename consts
2019-12-09 14:38:46 -07:00
Pierre Gayvallet c692689f21
fix import (#52555) 2019-12-09 22:18:57 +01:00
Ryland Herrick 45df5fdf42
[SIEM] Migrate backend to use New Platform services (#51144)
* Mark incoming plugin members as readonly

These cannot and should not be modifiable.

* Use env var instead of EnvironmentMode

* There doesn't appear to be an EnvMode in the new platform
* We're only using envMode to check whether we're in production
* We're already using process.env.NODE_ENV elsewhere

We can revisit this, but for now I'm simplifying things under this
assumption.

* Pass our setup context to the compose function

We're going to retrieve our router instance from this, for now.

* Remove unused static files route

I spent a few minutes trying to do this in the new platform, only to
realize that this was cargo culted from another plugin's structure and
never used.

* WIP: convert main GraphQL endpoints to New Platform

Splits the existing dual-method route into separate GET/POST
routes, while converting it to the NP routing syntax

TODO:
* Full route schema declarations
* Address context being moved off of the response object and into its
own object; callWithRequest is currently broken for this reason.

* Remove unnecesary Request type

While the defaultIndex patterns can be retrieved on the request itself,
that requires this special case of our FrameworkRequest.

In my smoke testing, the incoming `indices` argument was never different from
the one present on the request payload. Xavier had mentioned that these
might be redundant and a relic of some quick prototyping, so I'm going
to simplify this logic and delete that type under this assumption.

* Retrieve Elasticsearch client from RequestHandlerContext

In order to minimize the amount of noise on this refactor, I'm adding
the RequestHandlerContext to the existing FrameworkRequest object that
we already pass around.

This also removes some adapter methods that were cribbed from infra but
have since become unused. There are likely more.

* Use uiSettings client from RequestHandlerContext

Pulls from the new platform instead of from request.server.

* Remove unused properties from RequestFacade

One of these was obviated by the refactor to NP routing; the other may
never have been necessary.

* Remove unused interface

This is a relic that is no longer used in the codebase.

* Make error response code dynamic

* Handle GraphQL errors

Refactors to use new platform's responses instead of Boom.

Unless we intentionally do not want isGraphQLError error headers, I saw no
reason for the latter two branches of this method (and merged them).

* Fix graphiQL route

We needed to loosen the restriction on our main POST graphQL route, as
the requests coming from graphiQL do not match our normal format.

* Clean up logging

* Remove unused var injection functionality

I could not find a case where we were using these vars within the siem
app.

* Fix typo on config fetching

* Migrate to NP IndexPatterns service

* Removes unused extra parameter on callWithRequest
  * I think this was a relic from the infra code
* Clean up typings of callWithRequest
  * GenericParams is, ironically, not generic enough to handle all ES
  client calls. Instead we type it as Record<string, any> but ensure
  that our function adheres to the APICaller interface.

* Use savedObjects client in request context

These resolvers already receive a request containing the NP context, so
we can retrieve our client directly from that, now.

* Rename dependencies -> plugins to match kibana.json

* Remove unnecessary type annotation

The type of callCluster is already checked due to being passed to the
IndexPatternsFetcher constructor.

* Add siem plugin to new platform

For now this just generates a config observable with some defaults;
everything still lives in the legacy plugin.

* WIP: flattening out plugin initialization

Rather than pass our legacy API around everywhere, let's be explicit
about who needs what, and start flattening things out so that we can
move the legacy-independent stuff over.

* Pass our plugin context to initServerWithKibana

We can get the NP equivalent of `pkg.version` from
context.env.packageInfo.version, so let's do that and remove a usage of
config().

* Simplify siem configuration

As far as I can tell, the only siem config that we're using is
`xpack.siem.enabled`. The `query` was a holdover from infra, and if
we're using the `sources` queries at all, it's only with the default
values. Since our config is not typed, trying to add `sources` config
only results in runtime errors.

This removes the KibanaConfigurationAdapter entirely, and instead passes
what is effectively { sources: {} } to the SourcesConfigurationAdapter.

* Run all legacy-free setup through our plugin

Once this is vetted, we should be able to move the entire tree under the
plugin into the new platform plugin. We can inline the compose and
init_server calls into the plugin once things are vetted and stable; for
now leaving them there cuts down on the diff.

* Temporarily ignore our unused config declaration

* Fix detection engine route tests

While we're passing a properly bound route function in the app, the
tests' interfaces needed to be updated. Adds a helper method for
retrieving a bound route function from a Server object.

* Add some rudimentary schema validation to our graphQL endpoints

* Remove defunct server.config fn

The last remaining usage of this config was removed in #51985.

* Group our dev endpoints together

The graphiQL endpoint is the only thing that currently uses the GET
endpoint; everything else that talks to graphQL uses POST. For that
reason, I'm putting them in the same scope (along with annotating here)
to make that a bit clearer.

* Determine environment from plugin context

The kibana platform did and does provide this interface to check with
environment we're running in.

* Migrate xpack_main to NP features service

* Fix some issues missed in the previous merge

DE added some dependencies on both the server and request objects. Most
have NP equivalents and can be converted, but for now let's just add
them back to the Facades and convert in another PR.

Also changes one function to pull plugins from the server object, rather
than the server object living on the request (as this is how similar
functions are structured right now).

* Fix type resulting from bad merge resolution

* Fix type error due to incorrect usage of Hapi.Request

Pull elasticsearch service off our legacy server object, rather than
indirectly off the request object. Still legacy, but it's one less step
for later.
2019-12-09 15:17:29 -06:00
Nathan Reese cb60a77bb9
[Maps] only show styles that apply to layer feature types in legend (#52335)
* [Maps] only show styles that apply to layer feature types in legend

* update hasLegendDetails check to include style property filters

* clean up
2019-12-09 13:26:50 -07:00
Patrick Mueller 942f5420ed
provide finer detail on action execution errors (#52146)
resolves https://github.com/elastic/kibana/issues/52103
2019-12-09 15:03:18 -05:00
Lukas Olson 25c750b225
Cancel discarded KQL value suggestion requests (#51411)
* Fix filter matches index for filters with partial meta

* Abort discarded KQL value suggestion requests

* Abort server-side connection to ES

* Fix failing test
2019-12-09 12:43:52 -07:00
Frank Hassanabad 4bbe3cf85b
[SIEM][Detection Engine] Removes filter type, fixes bugs, adds more examples (#52452)
## Summary

* This removes the filter type and all the tests associated with it.
* This fixes a critical bug where filter from params was being passed down instead of esFilter
* This adds and cleans up all the rule examples for documenters and developers and users.
* This fixes a bug with empty queries
* This makes it so you can have simple filters which replace the filter capability
* This cleans up info and debug messages more

### Checklist

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

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

~~- [ ] 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)~~

- [x] [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)~~

### 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)~~

- [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2019-12-09 12:39:06 -07:00
Matt Bargar 77dca06253
Support nested fields in existing filter types (#49537)
* Add automatic support for nested fields in existing filter types

* Index pattern could be undefined

* add test for handleNestedFilter function

* remove console.log

* add tests for all "getFilterField" functions

* update migrateFilters to work on full filter objects so that it doesn't
have to worry about queries that have been wrapped with `nested`

* add test to ensure fromFilters auto wraps filters on nested fields

* Add smoke test for nested filter and move filter editor tests into
their own suite for easier running and debugging

* fix bad type change

* dedupe filterToQuery logic

* fix helper that wasn't doing what it said it did

* Convert test from pre-merge to jest

* Use new time range style
2019-12-09 14:16:15 -05:00
Matt Bargar c7046a080f
Flag nested fields as non-aggregatable (#51774)
* Flag nested fields as non-aggregatable

* Update tests
2019-12-09 13:59:49 -05:00
Tim Roes 419ea47cca
Upgrade typescript-eslint to 2.10.0 (#52528) 2019-12-09 19:49:15 +01:00
Poff Poffenberger 94b2eb4908
[Canvas] Add simple visual test for fullscreen (#51234)
* Add simple visual test for fullscreen workpads in Canvas

* Adding canvas to the config

* Adding sample data visual tests

* Refactor to use new helper method

* Reverting sample data visual test for now

* Forgot to add the awaits
2019-12-09 12:39:06 -06:00
Wylie Conlon 7a629466c1
[Lens] Show keyword fields for pre-7.3 index patterns (#52410) 2019-12-09 13:09:41 -05:00
Kukhyeon Heo 77f4f8c250 ui/management -> new platform (#45747)
Created management plugin under core_plugins.
Filled the plugin with 2 services: IndexPatternManagementService and SavedObjectsManagementService.
Removed related codes in ui/management and changed the paths.
2019-12-09 11:56:51 -06:00