Commit graph

41 commits

Author SHA1 Message Date
Chris Roberson 3a396027f6
[Monitoring] Migrate server to NP (#56675)
* First pass

* First pass

* Add new routes

* Getting closer

* Remove legacy server code, and other fixes

* Register the plugin with xpack

* Pass a legacy client to telemetry

* Suport callWithInternalUser

* Remove this

* More NP work

* Fix some tests

* Fix broken test

* Move over new telemetry changes, and fix other issues

* Fix TODO item

* Reuse the same schema as elasticsearch module

* Use a singular config definition here

* Disable this for now

* Use the right method

* Use custom config again

* Tweak the config to make this optional

* Remove these

* Remove these unnecessary files

* Fix jest test

* Fix some linting issues

* Fix type issue

* Fix localization issues

* Use the elasticsearch config

* Remove todos

* Fix this check

* Move kibana alerting over

* PR feedback

* Use new metrics core service

* Change config for xpack_api_polling_frequency_millis

* Make sure this is disabled for now

* Disable both

* Update this to the new function

* Tighten up legacy api needs

* Check for existence

* Fix jest tests

* Cleaning up the plugin definition

* Create custom type in our plugin

* Revert this change

* Fix CI issues

* Add these tests back

* Just use a different collector type

* Handle errors better

* Use custom type

* PR feedback

* Fix type issues

* PR feedback
2020-03-20 14:02:15 -04:00
Justin Kambic fcf439625b
[Uptime] Add Alerting UI (#57919)
* WIP trying things.

Add new alert type for Uptime.

Add defensive checks to alert executor.

Move status check code to dedicated adapter function.

Clean up code.

* Port adapter function to dedicated file.

* WIP.

* Working on parameter selection.

* Selector expressions working.

* Working on actions.

* Change anchor prop for popovers.

* Reference migrated alerting plugin.

* Clean up code for draft.

* Add button to expose flyout. Clean up some client code.

* Add test for requests function, add support for filters.

* Reorganize and clean up files.

* Add location and filter support to monitor status request function.

* Add tests for monitor status request function.

* Specify default action group id in alert registration.

* Extract repeated string value to a constant.

* Move test file to server in NP plugin.

* Update imports after NP migration.

* Fix UI bug that caused incorrect location selections in alert creation.

* Change alert expression language to clarify meaning.

* Add ability for user to select timerange units.

* Add code that fixes active item highlighting.

* Add better default value for active index selection.

* Introduce dedicated field number component.

* Add message to status check alert.

* Add tests for context message.

* Formalize alert action group definitions.

* Extract monitor id squashing from context message generator.

* Write test for monitor ID uniqueness function.

* Add alert state creator function and tests.

* Update action group id value.

* Add tests for alert factory and executor function.

* Rename alert context props to be more domain-specific.

* Clean up unnecessary type markup.

* Clean up alert ui controls file.

* Better organize new registration code.

* Simplify some logic code.

* Clean up bootstrap code.

* Add unit tests for alert type.

* Delete temporary test code from triggers_actions_ui.

* Rename a test file.

* Add some comments to annotate a file.

* Add io-ts type checking to alert create validation and alert executor.

* Add translation of plaintext content string.

* Further simplify monitor status alert validation.

* Add io-ts type checking to alert params.

* Update a comment.

* Prefer inline snapshots to more error-prone assertions.

* Clean up and comment request function.

* Rename a symbol.

* Fix broken types in reducer file and add a test.

* Fix a validation logic error and add tests.

* Delete unused import.

* Delete obsolete dependency.

* Fix function call to have correct parameters.

* Fixing some import weirdness.

* Reintroduce accidentally-deleted code.

* Delete unneeded require from legacy entry file.

* Remove unneeded connected component.

* Update flyout controls for new interface and delete connected components.

* Remove unneeded require from app index file.

* Introduce data-test-subj attributes to various components to assist with functional tests.

* Introduce functional test helpers for alert flyout.

* Add functional test arch and a test for alerting UI to ES SSL test suite.

* Add explicit exports to module index.

* Reorganize file to keep interfaces closer to their implementations.

* Move create alert button to better position.

* Clean up a file.

* Update a functional test attribute, clean up a file, rename a selector, add tests.

* Add a comment.

* Make better default alert message, translate messages, add/update tests.

* Fix broken type.

* Update obsolete snapshot.

* Introduce mock provider to tests and update snapshots.

* Reduce a strange type to `any`.

* Add alert flyout button connected component.

* Add alert flyout wrapper connected component.

* Create connected component for alert monitor status alert.

* Clean up index files.

* Update i18nrc file to cover translation in server plugin code.

* Fix broken imports.

* Update test snapshots.

* Prefer more descriptive type.

* Prefer more descriptive type.

* Prefer built-in React propType to custom.

* Prefer simpler validation.

* Add whitespace to clean up file.

* Extract function and write tests.

* Simplify validation function.

* Add navigate to alerting button.

* Move context item inside the items list.

* Clean up alert creation component.

* Update type check parsing and error messaging, and update snapshot/test assertions.

* Update broken snapshot.

* Update README for running functional tests.

* Update functional test service to reflect improved UX.

* Fix broken type that resulted from a mistake during a merge resolution.

* Add spacer between alert title and kuery bar.

* Update the id and name of our alert type because it was never changed from placeholder value.

* Rename alert keys.

* Fix broken unit tests.

* Add aria-labels to alert UI.

* Implement design feedback.

* Fix broken test snapshots.

* Add missing props to unit tests to staisfy updated types.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-19 12:50:05 -04:00
Sébastien Loix 2a8a7d7970
[License Management] NP migration (#60250) 2020-03-18 13:36:20 +01:00
Aaron Caldwell 5cab334248
[Maps] Move redux reducers and store logic to NP (#58294)
* Plugin file and services in place. Some redux logic ported

* Port and update index pattern util

* Move reducers over to NP. Update refs in legacy

* Port inspector to NP

* Move some kibana services init to NP. Some cleaning

* Clean up work not related to reducers/store

* Ignore temp imports from NP. Clean up of changes unrelated to this PR

* More cleanup. Check injected vars avab. before calling to handle dashboard case

* Bind embeddables services the same way Maps app services bound. Create function for eventual init in NP

* Call binding from constructor. Fix npStart plugins arg

* Adapt changes from master

* Register inspector views for embeddable. Add NP folder to i18n

* Clean up. Add comments. Move inspector map view registration to NP

* Remove unused inspector files in legacy

* Move full screen action to legacy

* Add in missing tooltip updates

* Review feedback. Update constants and i18n_getters to latest in NP

* Review feedback. Add redundancy comments to common files redundant in legacy and NP

* Remove unneeded copy of parse xml string test in legacy

* Review feedback. Remove redundant portions. Export from NP where possible. General clean up

* Remove remaining refernce and case for 'TOUCH_LAYER'. It's never used
2020-03-12 10:27:27 -06:00
Walter Rafelsberger f4f956dfeb
[ML] Transforms: Migrate client plugin to NP. (#59443)
Migrates the client side plugin of transforms to NP.
- Gets rid of the last parts of the shim (http, documentation links)
- Moves the plugin from x-pack/legacy/plugins/transform/public to x-pack/plugins/transform
- Creates a custom mock for appDependencies based on NP services
- Fixes jest tests to get rid of all act() related warnings
2020-03-06 17:44:35 +01:00
Sébastien Loix a05c3211b9
[Snapshot & Restore] NP migration (#59109) 2020-03-05 15:07:23 +05:30
Aaron Caldwell c4458ca1b4
[File upload] Move File Upload to New Platform (#58550)
* Move file upload to np. Some additional mods & removals

* Consume file upload from NP in maps and pass to kibana services

* Register telemetry mappings

* Init indexPatternService in start method

* Fix type check issues. Add missing prop to telemetry

* Update i18n path

* Review feedback
2020-03-04 06:44:44 -07:00
Walter Rafelsberger bb55e8a21c
[ML] Transforms: Migrate server plugin to NP. (#58714)
Migrate transform legacy server to NP.
- Create server plugin/index for transform in x-pack/plugins.
- Move all legacy/server files to plugins/transform
2020-03-03 09:01:45 +01:00
Patrick Mueller 5b7270541c
[alerting] initial index threshold alertType and supporting APIs (#57030)
Adds the first built-in alertType for Kibana alerting, an index threshold alert, and associated HTTP endpoint to generate preview data for it.

addresses the server-side requirements for issue  https://github.com/elastic/kibana/issues/53041
2020-02-28 11:48:28 -05:00
Melissa Alvarez 8c3d71b370
[ML] NP: migrate server (#58680)
* remove obsolete legacy server deps

* licensePreRoutingFactory uses licensing plugin rather than legacy xpack

* move schemas to dir in routes

* use NP license check method for license check

* store license data in plugin for passing to check

* create server plugin files in NP plugin dir

* remove dependency on legacy xpack plugin

* add sample data links first step

* move all server dirs from legacy to np dir

* fix requiredPlugin spaces name and update import routes

* delete unnecessary files and add sample data links

* update license and privilege check tests

* add routeInit types
2020-02-27 21:15:08 -05:00
Jean-Louis Leysens 899270a108
[Upgrade Assistant] Move out of legacy folder (#58034)
* Create x-pack/plugins skeleton for upgrade assistant

* Move public folder contents

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

* Include stylesheets in public

* Move server side out of legacy

Begin migration of Reindex worker to new platform

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

* Updated the routes with new dependencies and removed server shim

* Fix router unit tests

* Fix server lib tests

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

Also used core/server mocks where appropriate

* Clean up types issues

* Fix setting credentials on request header

* Removed the security plugin from Upgrade Assistant

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

* Migrate to config to new platform config

xpack.upgrade_assistant.enabled

* Remove unused types

* Fix import issue

* Move upgrade assistant back to Elasticsearch management section

* Update dotfiles

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

* Alphabetical ordering in xpack/i18nrc.json

* Implemented PR feedback

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

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

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

Fixed import ordering.

Renamed variables inside of telemetry lib.

* Revert to longer import path

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

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-25 15:31:04 +01:00
Sébastien Loix 277b38079e
[Index management] Move to new platform "plugins" folder (#58109) 2020-02-25 13:12:27 +05:30
Vadim Dalecky 4cd809aa7d
Drilldown plugin (#58097)
* feat: 🎸 add <PanelOptionsMenu> component

* feat: 🎸 use presentational <PanelOptionsMenu> component

* feat: 🎸 create stubs for Drilldown components

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

* feat: 🎸 setup Drilldowns plugin in X-Pack

* feat: 🎸 add Storybook to drilldowns plugin

* refactor: 💡 move drilldown components to x-pack

* feat: 🎸 add stub action to open drilldown flyout

* feat: 🎸 add drilldowns plugin to translation index

* fix: 🐛 correct TypeScript type check

* fix: 🐛 use correct i18n namespace

* ci: 🎡 add drilldowns plugin to CODEOWNERS file

* fix: 🐛 revert back <PanelOptionsMenu> change

* fix: 🐛 type must not be empty
2020-02-20 21:59:29 +01:00
John Schulz 5a99642cfb
Add Ingest Manager plugin to master (#56567)
* [Fleet] Add permissions checks (#48143)

* Add permissions check to API

* Add permissions check to UI

* Undo changes

* Update index.tsx

* Update enroll.ts

* add API tests for permissions

* add fleet to trial license check

* Agent enrollment flyout (#48173)

* Fix agent table empty prompt

* First pass at agent enrollment flyout with placeholders

* Move enrollment commands into separate file and enable templated vars

* Use default double braces for templating

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

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

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

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

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

* add api endpoint to handle images

* #47978 add screenshots component with single image

* update padding around screenshot

* import existing API_ROOT

* move ImageRequestParams interface and fix type

* pass the content-type through and add test

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

* use eui variables for padding

* add aria label and image description

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

* IntegrationsManager -> EPM

* integrationsManager -> epm

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

* Don't rename integrations registry URL.

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

* Update path to functional test config

* Add epm to recently re-enabled privileges test

* Update two values recently added in main feature branch

* Move/update screenshot tests

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

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

* Multiselect to unenroll agents (#48852)

* Initial pass at multiselect to unenroll agents

* Adjust loading state button text

* Fix types; use unenroll provider in agent details

* Update select all agents kuery

* Prevent inactive agents from being selected

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

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

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

* [EPM] Fix package version requirement structure

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

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

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

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

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

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

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

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

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

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

* add markdown component and fetch markdown

* add package.json file with react-markdown dependency

* add markdown renderers, use readme path

* remove description and rename to readme

* remove dropshadow on images

* add loading component for readme request

* comment on loading components

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

* 48654 files from registry (#49580)

* Replace image path/handler with generic file one

* Incorporate tests from #48696

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

* Make screenshot image captions optional

* fix typos, type, rename variable

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

* fix height and color issues

* make container full height

* remove panels per design update and make white bg color

* adjust spacing

* check for empty response

* fix eslint issue

* fix layout in safari

* remove unused component

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

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

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

* rewrite relative image paths

* remove EuiImage, use transformImageUri, clean up

* [EPM] Use NP registerFeature (#49625)

* Use NP registerFeature

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

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

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

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

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

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

Renamed plugin-specific `CoreSetup` to `EPMCoreSetup`

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

* Add policies lib and adapters

* Fix mock server headers

* Initial pass at policy filter dropdown by manipulating kuery string

* Adjust spec return values

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

* Fix react-related eslint errors

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

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

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

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

* Remove ui/* imports (#50094)

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

* add collapsible read me component (#49990)

* add collapsible read me component

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

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

* add empty array as second argument to useLayoutEffect

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

* Adjust type names

* Install package in one go.

* Integration -> Package

* Really install all known assets

* Remove ingest pipelines on package deletion.

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

* Replace image path/handler with generic file one

* Incorporate tests from #48696

* Fix merge error.

* Type tuning

* Adjust types

* Remove asset types from routes altogether

* Add timelion-sheet back to types.

* Respond with full package info to install/delete

* Be specific in return type.

* Keep installAssets() as separate step

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

* [EPM] Add unit tests for pathParts

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

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

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

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

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

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

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

* Add beginning models and two routes for Ingest

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

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

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

* Add API metadata. Standardize policy_id param name.

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

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

* Return to initial TS annotation for Arrays

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

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

* Add directory structure for server/lib.

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

* Make CI happy

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

* [EPM] Add basic documentation directory

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

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

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

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

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

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

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

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

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

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

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

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

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

* 40752 rewrite ingest pipeline (#50627)

* Add directory structure for server/lib.

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

* Make CI happy

* Implement pipeline rewriting.

* Add more testcases

* For posterity (comment change)

* Allow beats-style template delimiters

* Be more succinct

* Document better

* Replace AssetType enum with union type (#50696)

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

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

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

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

* Add fix & comment for TS 3.7.2 regression

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

* cleanup assets, filter assets for those currently supported

* removed unused type

* fix type

* add comment for better type

* change type name to be more descriptive

* hardcode image width for ie11 (#49796)

* hardcode image width for ie11

* eslint

* improve comment

* add maxWidth

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

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

export plugin function from public/index

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

* Use `useUiSetting$` from `useKibana` hooks

* Fix broken app due to bad hooks usage

Can't use useKibana outside a React component.

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

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

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

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

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

* Use NP feature_catalogue.register

* Use type from NP plugin

* fix linting

* fix types

* fix headers in Fleet

* skipping test due to ES param change

* Revert "skipping test due to ES param change"

This reverts commit d05f20decf.

* remove type field

* remove unused import

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

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

* Update path in i18n file

* [EPM] update compatibility section (#50975)

* change min max version to single range value

* add elastic stack icon and change text

* remove badge from version and use code font

* remove euistyled

* add back version component lost in merge

* remove euiStyled

* remove old file

* Restore RequirementVersionRange type

* Disable test for elasticsearch username.

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

* Revert "Disable test for elasticsearch username."

This reverts commit f1020e4eab.

* Disable test for elasticsearch username.

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

* Fix EPM typing issues in register feature

* Fix typings after master merge

* [EPM] CI fixes (#51284)

* Initialize es in test.

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

* Clean up.

* [EPM] add confirmation modal (#51172)

* add confirmation modal, move install state to Header

* update callout to use title

* move components only used in detail view to detail dir

* use better variable names

* update to more descriptive  variable names

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

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

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

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

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

* Fix type imports

* Only return installable asset types (kibana for now)

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

* Add more restricted TS types to DisplayAssets object

* Flip order of arguments to Extract

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

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

so the larger set should be first

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

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

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

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

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

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

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

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

* Ingest/policy (#51741)

* wip policy

* tweaks

* tweaks

* FIX TYPOS

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

* fix tests and bugs

* updates tests and snaps

* more fixes

* use AGENT_POLLING_INTERVAL

* cleanup and fix some formatting

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

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

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

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

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

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

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

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

* fix things broken by PR review suggestions

* remove unused field

* fix types

* fix mappings

* add datasource mappings

* Fix mappings and remove get full policy from checkin

* Fix ingest api integration tests

* run es-lint to fix fleet

* Fix typescript issues

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

* add notifications from core to plugin

* add package install state hook

* fix type error

* use toMountPoint helper to add jsx to notification

* add warning notification to failed install

* make notifications dependency explicit prop

* move PackageInstall provider lower

* add comment about InstallStatus type overlapping InstallationStatus

* use InstallStatus type in InstallationButton component

* fix type

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

* aadding config

* add working settings to the default output

* remove default username and password

* update libs

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

This contains the basic objects to setup ILM

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

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

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

## Summary

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Set up simple policies list view

* Adjust spec to return single policy

* Set up simple policy details page

* Add demo stats/chart to policy details

* Add description string

* Initial setup of policy form and create policy UI

* Policy create/edit form; integrate policy list api

* Integrate create policy api

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

* Fix edit policy mock meta

* Fix policy list search bar

* PR and linting fixes; use typings from ingest plugin

* Fix i18n

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

## Summary

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

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

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

Testing:

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

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

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

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

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

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

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

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

A few refactorings were made to simplify installation:

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

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

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

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

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

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

* add export command

* revert 2 more files to rely on export

* revert imports

* Fix types for Datasource Saved Object

* merge in master

* fix type check

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

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

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

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

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

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

* Move cache 'hack' into getAssetsData

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

* Remove unnecessary type cast

* Clarify reasons behind asset path manipulation

* Return the Datasource; not the Saved Object.

* Use real values from package in fake datasource SO

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

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

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

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

* fix duplicated imports

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

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

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

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

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

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

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

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

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

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

* fix tests and destructing

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

* Update RegistryPackage type

* Use download key from EPR to fetch archive

* Fix errors caused by correcting the Registry types.

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

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

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

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

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

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

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

* Update RegistryPackage type

* add first page of add data source

* fix for ie11 flex min width bug

* remove toDetailViewRelative

* remove unneeded spread

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


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

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

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

* [EPM] Replace wildcard export (#52554)


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

* Replace export * from packages.

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

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

* Delete existing Installation type. Rename InstallationAttributes to Installation

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

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

Two less places with knowledge of SO internals.

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

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

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

* [EPM] Cleanup ILM loading (#52632)

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

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

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

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

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

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

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

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

* Add fixtures for data source integration test.

* Move test setup to beforeEach

* Add test for datasource creation

* Handle pipelines in yml format.

* Make integration test for adding a data source pass.

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

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

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

* remove dupe type RegistryPackage

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

* update types

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

* add callback after successful installation and redirect

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

* remove assets tab for mvp

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

* change callback name

* remove commented out assets logic

* add redirect to hook

* fix type

* Use ingest datasource api (#52964)

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

* Remove duplicate fetchInfo & installTemplates

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

* WIP. Pushing so others can see

* Improve correctness/flexibility of absolute URL

* Disable datasource test & template installation

* [Ingest] Data source APIs (#52448)

* Clean up ingest imports and remove unneeded mock_spec files

* Initial pass at datasources lib and API endpoints

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

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

* Fix tests

* Fix tests again

* Fix tests 3

* Adjust routes, PR feedback

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

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

* change test to post for installing a datasource

* change some names and types around

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

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

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

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

* Only add keyword type field to mappings.

* Index template installation

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

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

* Add index files to export various modules; normalize imports

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

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

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

* Initial pass at assign data sources flyout

* Initial pass at unassigning data sources from policy

* Make data sources table searchable by package values

* Fix enrollment key lib for rest adapter param changes

* Fix imports and types

* `yarn.lock` changes after bootstrapping

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

* [EPM] Implement getConfig for dataset

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

* [EPM] Fix template installation (#53272)

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

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

* Refactor ingest pipeline installation

* Only install index templates for requested datasets

* Add index.default_pipeline to index template

* Hook up pipeline rewriting

* Add correct types.

* change POST create datasources path (#53165)

* change POST create datasources path

* remove pkgkey from params

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

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

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

* Update snapshots

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

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

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

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

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

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

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

* Fix eslint issues

* Fix typescript issues after merge

* Fix merge master missing line

* Fix merge conflict

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

* Fix registration of Ingest management section

* Fix i18n key

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

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

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

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

* [Ingest] Remove policies UI (#54308)

* Remove meta field UI from policy add/edit form

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

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

* Add delete policy UI to policy detail page

* Disable policy delete button for default policy

* Commit updated kbn-pm artifact.

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

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

* Update kbn/pm package

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

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

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

* use reduce in place of for loop

* basic functionality for creating index patterns

* separate logs and metrics index patterns

* dedupe fields

* adjust flattenFields to rename nested fields with parent name path

* some tests

* use yml files for tests

* add awaits as part of installing the package

* optimize loading of yaml files

* fix typo

* change type packageName to package

* update tests to use all files from the beginning

* fix type errors

* fix test

* Use dataset.package from registry

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

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

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

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

* PR review changes, typo fixes, update tests

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

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

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

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

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

* add DatasetType type

* move loadFieldsFromYaml to fields

* add logic to determine field values

* update tests

* add back accidentally removed readFromDocValues

* remove DatasetType and add IndexPatternType

* rename dedup to dedupe

* group tests

* use null coalescing operator

* Fix typing issues

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

* [EPM] Prevent double submit when creating data sources

Update installationRequested state after submit (#55100)

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

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

* update snapshot

* update findFieldByPath to return undefined if not leaf node

* remove temporary alias type from map

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

* handle mult_fields

* move nested function out

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

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

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

* [EPM] Indexing strategy docs (#55301)

* [EPM] Indexing strategy docs

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

* update typos

* fix one more typo

* apply review feedback

* skip fields that are disabled (#55735)

* [Fleet] Fix fleet typing issues after merging master

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

* add support for fieldFormatMap

* output params must be camel case

* fix case

* add url_template param

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

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

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

* Remove some explicit typing to pass type checks.

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

* remove readFromDocValues (#56227)

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

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

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

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

* Like 441d9ed, but correct

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

* Seed Ingest Manager as a new NP plugin

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

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

* Add nav styling w/ theming, add useRequest hook

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

* Move most types and constants into /common

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

* Initial pass at agent config api route handlers

* Change plugin id to camel case

* Fix circular schema dependency, add security as optional plugin

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

* Create default agent config

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

* Move saved object mapping to new plugin

* Change data streams -> datasources

* Add legacy plugin to bootstrap mappings

* Adjust fleet's ingest dependencies

* Disable policies UI in Fleet

* Adjust EPM's ingest dependencies

* Adjust ingest manager base API route

* Adjust fleet's client side ingest dependencies

* Remove more ingest dependencies from fleet

* REMOVE MOST OF LEGACY INGEST PLUGIN

* Add section for agent configs in UI nav

* Allow useRequest and sendRequest consumers to specify typing for response

* Initial pass at porting over agent config list UI

* Port over agent config creation

* Port over delete agent config functionality

* Fix app routing

* Port over fleet setup routes

* Adjust fleet's ingest dependencies

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

* Remove policy list UI code from fleet

* Change useRequestResponse error type

* Add missing agent config schemas and hooks

* Fix type check issues

* Register IM under management

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

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

* Fix i18n path

* Fix app categories import

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

* Seed Ingest Manager privileges to fix tests

* Change `features` to optional plugin instead of required

* Fix security privileges tests

* Fix feature test

* Fix duplicate enrollment key created for default agent config

* Fix fleet agent enrollment by catching agent config 404

* PR feedback

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

* Remove EPM-specific react-markdown

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

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

* Selectively enable features based on config values

* Fix typing and(?) CI

* Enable xpack.ingestManger during tests

Follow example from xpack.endpoint flags

* Don't create BASE_URL value based on PLUGIN_ID

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

* Add README with some skeleton docs on tests, etc

* Undo changes to some files based on PR feedback

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

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

* WIP. But add some passing api integration tests

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

6 passing (1.2s)

* WIP

* Fix TS type errors.

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

* Add route to delete datasources (mirrors agent_configs api)

* Remove old ESArchiver files

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

* Update README

Remove bash integration test scripts

* More updates to README

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

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

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

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

* Use appBasePath from app mount params for React Router basename

* Remove out-of-date comments

* Use the ES client from core

* Move License & Config services WIP. Pushing to share

* Move config & license services into App Context service.

* Remove FTR tests for Ingest Manager

* Remove license-related propperties

* Remove clusterClient properties

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

* WIP (failing) integration_test

* No more unknown key errors. Timeouts now

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

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

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

Move all @kbn/config-schema usage to server

Co-authored-by: Matt Apperson <me@mattapperson.com>
Co-authored-by: Jen Huang <its.jenetic@gmail.com>
Co-authored-by: Nicolas Chaulet <n.chaulet@gmail.com>
Co-authored-by: Sandra Gonzales <neptunian@users.noreply.github.com>
Co-authored-by: Nicolas Ruflin <spam@ruflin.com>
Co-authored-by: Sonja Krause-Harder <krauseha@gmail.com>
Co-authored-by: Brian Seeders <seeders@gmail.com>
Co-authored-by: Tyler Smalley <tylersmalley@me.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-18 21:30:38 -05:00
Kerry Gallagher 0a6c748cc8
[Logs / Metrics] New Platform migration (full cutover) (#54583)
* Fully migrates metrics and logs to the NP

Co-authored-by: Jason Rhodes <jason.matthew.rhodes@gmail.com>
Co-authored-by: John Schulz <github.com@jfsiii.org>
Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
2020-02-18 19:22:27 +00:00
Yuliia Naumenko c07ff7174e
Alerting plugin migrate to Kibana platform (#57635)
* Moved alerting plugin to new platform

* Fixed type checks

* Fixed failing tests

* Fixed functional tests

* Fixed plugin context initialization

* small typo

* Fixed type checks

* Fixed create alert schema

* Moved alerting files to Kibana platform folder

* Fixed duration validation

* Fixed find page size

* Fixed type check

* Fixed due to comments

* Fixed merge issues

* Added missing

* Fixed alerting functional tests

* Fixed tests

* Fixed update schema validation

* Added throttle update

* Fixed failing tests

* test

* fixed setup alerting dependencies for siem and monitoring plugins

* Fixed siem setup dependancies
2020-02-18 09:05:56 -08:00
Alison Goryachev 6e3790537d
[Remote clusters] Migrate client-side code out of legacy (#57365) 2020-02-14 21:10:33 -05:00
Alison Goryachev 82972eff0d
[Remote clusters] Migrate server code out of legacy (#56781) 2020-02-10 15:25:07 -05:00
Mike Côté 8951424f82
Convert triggers and actions UI to Kibana Platform (#56388)
* Convert triggers and actions UI to Kibana Platform

* Copy ui/time_buckets over

* Fix i18n

* Fix scss

* Fix UI from not loading anymore
2020-02-06 10:50:26 -05:00
Alexey Antonov be61507349
Move kuery_autocomplete ⇒ NP (#56607)
* Move kuery_autocomplete ⇒ NP

Closes: #51277

* fix i18n keys

* update translations

* data_xpack -> data_enhanced

* data -> data_enhanced

* fix i18nrc

* fix PR comments
2020-02-04 18:25:26 +03:00
Jean-Louis Leysens bb37b0f613
[Watcher] Move out of legacy (#54752)
* Moved out of legacy folder

* First iteration of watcher plugin that renders

* Move create Timebuckets to plugin root
Update route registration and fix license checking for NP

* Re-enable Component integration tests

* Minor fix for data deserializer in api.ts

* Slight logic refactor, more defensive plugin startup

* Re-add legacy folder for SCSS pipeline

* Remove duplicate style sheet

* Fix type issue with TimeBuckets export

* Update license management routing logic (issued warning for using basepath on navigating away from license management)
Remove commented out code in watcher

* More defensive plugin registration

* Fix i18n issues and restore registration of feature on home view

* Remove watcher license error check copy

* Restore license error message in watcher

* Fix mock context value

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-23 15:35:36 +01:00
Gidi Meir Morris 838d7ba213
migrate Actions to Kibana platform (#55026)
Migrates the Actions plugin from Legacy on to the Kibana Platform.
2020-01-22 17:08:54 +00:00
Joe Reuter 7c40a24fcc
Tutorial migration (#54910) 2020-01-22 15:31:11 +01:00
Jean-Louis Leysens b8d35105c7
[SearchProfiler] Move out of legacy (#55331)
* Initial move of searchprofiler into new platform directory, lots of things need testing

* Whitespace, clean up types and remove unused files

* First iteration of end-to-end plugin working

- Updated license check to only check for presence of basic license (not search profiler as a feature
- Updated the payload: removed types from validation
- Also added README in public regarding the location of styles

* Added extractProfilerErrorMessage function to interface with new error reporting from profiler endpoint

* Fix paths to test_utils

* Update I18n for search profiler

* Fix react hooks ordering bug with license status updates and fix test (wait for first license object before rendering)

* Added index.ts file to common in searchprofiler route
Marked types and values as internal
Removed unnecessary "async" from function
Update import to not use "src" alias

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-22 13:58:18 +01:00
Yuliia Naumenko 8259445350
Create UI for alerting and actions plugin (#48959)
* Refactored reducers type definitions

* Fixed dependancy objects

* Fixed action add

* Fixed logging app icon

* Added action types params fields

* Added fields for check and re-notify alert

* Add tags to alert list

* Adjusted threshold expression with validation, added visualization

* Move delete button to the left and hide when no selection

* Rename action list title column to name

* fixed request

* Removed watcher labels

* Design cleanup

* Added expression default values

* Added visualization for index threshold alert

* Rename Actions tab to Connectors

* Rename "create action" to "create connector"

* Remove actions column name

* Add count per action type

* Hide checkboxes when user can't delete

* Add title to home, rename Alerting UI breadcrumb (remove UI part)

* Added correct binding for interval and throttle

* Added tags support for create Alert UI

* Added server error display in UI on save alert

* Added connectors for action forms

* Update button styles

* Switch inputs to compressed forms

* Fixed some fields for add alert form

* Fixed updating action by index

* Fixed filter for index/fields api requests

* Remove the test alert type that was in the init function

* Fixed action type icon on add connector form and did small refactoring on action forms; added action validation

* Rename alerting UI plugin to triggers and actions UI (or something else) #50305

* Implemented action connector edit UI

* Add bulk actions to alerts list

* Update home title spacing

* Fixed editing secrets action property

* Changing behaviour of bulk actions and disable buttons during request

* Refactored plugin definition with appdependency interface

* Moved add dependencies to the separate file

* Enable visualization if only hasExpressionErrors passed

* Fixed add action twice on click card

* Fix actions column in alert list

* Fixed action canSave capability

* Renamed Actions to ActionConnectors in appropriate UI files

* Renamed alertTypeParams to params in UI code

* Add filter for tags

* Cleanup previous commit

* Fix alert type filter

* Refactored edit form to use ActionTableItem

* Renamed ActionTableItem to ActionConnectorTableItem

* Fixed missing button key error for alerts list filter

* Renamed translation labels for connectors

* Enable UI plugin by default

* Rename buildin to builtin

* Fix some type checks

* Add API tests

* Split API file into smaller files

* Rename plugin id

* Remove dependency on actions plugin (should be optional dep in NP)

* Fix some translation ids

* Revert "Rename plugin id"

This reverts commit f6daeb3d5e.

* Rename method for loading connectors

* Added functional tests base

* Fix functional test type filter

* Add test alert type for now

* Initial connectors functional tests

* Rename description to name

* Use unique connector names to allow re-running tests

* Assert on more things

* Update alert/action menu items. Flyout width. Add index.scss file

* Added action connector list unit tests

* Add bulk delete functional test

* Move tests to SSL functional environment

* Fix tests

* Added unit tests for actionTypeRegistry and alertTypeRegistry

* Fixed update connector with only properties

* Added some functional tests for alerts with TODOs

* connectors list page cleanup

* empty state cleanup

* Added connector edit flyout unit test

* Fix functional tests

* text cleanup

* zindex fix for index threshold trigger

* Expand the functional tests, add assertions

* Fixed edit connector from the Name column, and removed pencil button

* Remove tags filter, use search bar instead

* Finalize functional tests

* Support filtering alerts by action type

* Rename plugin name for translations

* Rename default breadcrumb title to alerts and actions

* Added unit tests for connectors empty prompt, fixed api tests

* Added unit test for select action type menu for create connector; Fixed update selected connector for edit form

* Added unit test for edit connector flyout

* Added alerts list unit tests

* Added connector form unit tests

* Added connector reducer unit tests

* Fixed some failing unit tests

* Fixed alerts list unit tests

* Set alert tab default if it is available

* Added doc_title and get_time_units unit tests

* Added some test fixes

* Fixed index threshold expression to display only index and fields

* Added email building action unit tests

* Added unit tests for builtin action types

* Remove test alert type

* Move create alert UI behind feature flag 'createAlertUiEnabled'

* Fix functional tests

* Update codeowners

* Update codeowners for tests

* Revert watcher changes

* Fix type check failure

* Fix unit test failures

* Fixed typecheck failures

* Fixed language check errors

* Did some text/type fixes

* Fixed typecheck

* Fixed unit tests warning

* Fix failing functional tests

* Fix registry tests to have cleaner diff when it fails

* Make DEFAULT_SECTION a Section type

* Remove unused constructor

* Make app dependency error string same line

* Remove unused error pages

* Set interface to alerts context

* Fix action_connector_form.tsx label

* Fix label in connector_add_flyout.tsx

* Fix label in alert_add.tsx

* Move alert_types to builtin_alert_types

* Move some threshold constants into threshold folder

* Move api.ts within threshold folder

* Removed duplication logic from action type and alert type registry list

* Fixed email action type test and adjusted validation to support arrays ony

* Added missing connector fields for email action type

* Fixed building action types issues due to comments

* Refactored with more new platform structure; fixed some comments from review

* Capitalize Actions in 'Alerts and Actions' labels

* Skip flaky tests

* Fix failing functional test

* Fixed failing unit tests, added new deps

* Fixed type checks

* Fixed language check failing

* Fix broken functional tests

* Refactored actionConnectors and alerting context

* Removed doc title service

* added get time options type definitions

* removed obsolete code

* Made generic registry type for actionTypes and alert types

* Fixed some enum types

* fixed type check CI

* Convert EuiSearchBar to normal text field

* Fix typo

* Fix conditional rendering

* Fix bug where selection doesn't reset

* Fix broken functional test, wait for ENTER key to search alerts

* Make app section hide from menu when user doesn't have access

* Fixed connector name validation (error due to renaming from description)

* Removed obsolete useEffect

* Removed unused ShareRouter

* Fixed key validation error

* Mobed wrongly wrapped objects

* Removed useEffect from connectors form

* Replaced error forms with eui controls props

* Added delete confirmation dialog for connectors list

* Fixed build errors

* Fixed failing test

* Skip flaky tests

* Added null check for app context - render components tree only if it isn't null

* Fixed type check eror

* Did changes on the UX and text/labels commnets

* Fixed failing tests

* Fixed error handling

* Refactored Webhook form http headers due to the mockup

* Fixed build

* Fix labels issue

* Fix spacing and form row alignment

* Fixed failing type check

* put ownfocus on popover in actions list

* fix spacing and flex

* fix color on conectors list

* clean up webhook headers form

* fix logic check for headers

* Made changes due to review comments

* Fixed delete connector test

* Fixed all flaky test for delete connectors 53956

* Fixed type check due to NP changes

* Disable plugin by default

* Added configuration props for functional tests to enable triggers and actions ui

* removed timeout from test

* added enable triggers and actions to functional/config.js

* fix the build

* Changed ci group and disabled plugin

* changed config setting to root

* Changed disable approach

* Experiment with index managment

* Set back configuration settings for triggers and actions

* Enable plugins

* Set index management to disabled to see the failing issue

* Revert experimental back for index_managment

* Fixed type check

Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
Co-authored-by: dave.snider@gmail.com <dave.snider@gmail.com>
Co-authored-by: DeFazio <michael.defazio@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Peter Schretlen <peter.schretlen@gmail.com>
2020-01-13 16:16:20 -08:00
Joe Reuter c73f984e7f
Migrate graph server and licensing handling (#52279) 2019-12-13 11:33:15 +01:00
Robert Austin 8fb8ef94b1
Add Endpoint plugin and Resolver embeddable (#51994)
* Add functional tests for plugins to x-pack (so we can do a functional test of the Resolver embeddable)
* Add Endpoint plugin
* Add Resolver embeddable
* Test that Resolver embeddable can be rendered
2019-12-06 14:55:16 -05:00
Gidi Meir Morris c485893ab2
Improves performance of task execution in Task manager
This PR include three key changes:

1. Run tasks as soon as they have been marked as running, rather than wait for the whole batch to me marked
2. Use a custom refresh setting of refresh: false where possible, in place of wait_for, in order to speed up Task Manager's internal workflow
3. Instrumentation of Task Manager exposing Activity / Inactivity metrics in Performance test runs
2019-11-06 08:44:13 -05:00
Court Ewing 0b82cfeae7
Remove experimental code app (#49404)
* Fix erroneous code plugin import in apm

* Stop running legacy code plugin

* Stop testing code app and apis

* Remove code plugin source and deprecate config

* Remove code plugin docs

* Remove xpack.code translations

* Remove code import on api_integration

* Remove code privilege from security test

* remove two more mentions of code

* remove code es_archives

* remove code doc images
2019-10-28 11:40:27 -04:00
Brandon Kobel a149497b73
NP Security HTTP Interceptors (#39477)
* We have a NP plugin! :celebration:

* Redirecting to login on all 401s

* Adding commented out code for when credentials are omitted

* Fixing types

* Respond 403 when user changes password with incorrect current password

* Adding AnonymousPaths where we ignore all 401s

* Adding anonymous path tests

* Extracted a dedicated SessionExpires class and added tests

* Fixing plugin after refactoring to add SessionExpired

* Beginning to work on the session timeout interceptor

* Fixing UnauthorizedResponseInterceptor anonymous path test

* Removing test anonymous path

* Trying to improve readability

* Displaying session logout warning

* Mocking out the base path

* Revert "Mocking out the base path"

This reverts commit 824086c168.

* Changing coreMock to use a concrete instance of BasePath

* Adding session timeout interceptor tests

* Adding session timeout tests

* Adding more tests for short session timeouts

* Moving some files to a session folder

* More thrashing around: renaming and reorganizing

* Renaming Interceptor to HttpInterceptor

* Fixing some type errors

* Fixing legacy chrome API tests

* Fixing other tests to use the concrete instance of BasePath

* Adjusting some types

* Putting DeeplyMocked back, I don't get how DeeplyMockedKeys works

* Moving anonymousPaths to public core http

* Reading sessionTimeout from injected vars and supporting null timeout

* Doesn't extend session when there is no response

* Updating docs and snapshots

* Casting sessionTimeout injectedVar to "number | null"

* Fixing i18n issues

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

Co-Authored-By: Larry Gregory <lgregorydev@gmail.com>

* Adding milliseconds postfix to SessionTimeout private fields

* Even better anonymous paths, with some validation

* Adjusting public method docs for IAnonymousPaths

* Adjusting spelling of base-path to basePath

* Update x-pack/plugins/security/public/session/session_timeout.tsx

Co-Authored-By: Larry Gregory <lgregorydev@gmail.com>

* Update src/core/public/http/anonymous_paths.ts

Co-Authored-By: Josh Dover <me@joshdover.com>

* Update src/core/public/http/anonymous_paths.ts

Co-Authored-By: Josh Dover <me@joshdover.com>

* AnonymousPaths implements IAnonymousPaths and uses IBasePath

* Removing DeeplyMocked

* Removing TODOs

* Fixing types...

* Now, ever more normal
2019-10-24 08:59:45 -07:00
Tim Sullivan f157f79e4b
[Reporting] Replace Job Completion Notifier as NP Plugin (#47283)
* [Reporting] Replace Job Completion Notifier as NP Plugin

* beautiful toasts

* unit test

* showNotifications returns observable

* fix kibana.json

* depends on links

* no prettier ignore

* Update content per feedback

* Remove unnecessary wrapper

* remove type annos and condense

* use an observable of the stop method

* rename the new platform plugin to match legacy

* fix i18n config

* additional plugin rename

* i18n strings prefix change

* try something with x-pack/.i18nrc.json

* remove a few more notifier phrasing from plugin definition
2019-10-18 16:20:50 -07:00
Ahmad Bamieh a42a767285
[Telemetry] Move to OSS (#45769)
* update paths and licenses

* localization collector in oss

* node-crypto typings in oss

* update telemetry i18n labels

* update translation rc files

* remove duplicate components in home for telemetry

* update tests

* finalize collection + move csp collector to oss

* self review

* use apm instead of beats

* xpack collection

* fix collection tests

* remove space specific settings

* mock npSetup and npStart

* disable banner in tests

* remove commented mock

* monitoring np telemetry fixes

* replace telemetryOptedIn in oss instead of xpack_main

* fix telemetry OptIn test
2019-10-16 10:24:20 +03:00
Larry Gregory 7fd639b700
Spaces - server-side to NP plugin (#46181) 2019-10-15 09:17:40 -04:00
Walter Rafelsberger bcf9ec3662
[transform] Move ML "Data Frame Transforms" to Kibana management section "Transforms". (#45880)
Moves "Data frame transforms" from the ML plugin to its own "transform" plugin within the Kibana management section.
2019-10-09 11:13:27 -07:00
Mengwei Ding 8bdb20a1e0
[Code] migrate Code config/logging/feature service to new platform (#46664)
* [Code] code backend NP migration

* Move code plugin config to NP config service

* Move code plugin logger to NP logger service

* minor type error

* remove joi config

* addressing comments

* fix unit tests

* Migrate to xpack feature service for NP

* minor comments

* fix code mocha test scripts

* fix type

* fix i18nrc.json for code
2019-10-03 11:20:18 -07:00
Vadim Dalecky f4ea04c9cc
Advanced ui actions 2 np (#46948)
* feat: 🎸 move advanced_ui_actions plugin to NP

* fix: 🐛 fix NP plugin configs

* fix: 🐛 remove import from legacy platform
2019-10-01 12:25:45 +02:00
Joe Reuter eed848ab2e New visualization editor Lens (#36437)
* [lens] Initial Commit (#35627)

* [visualization editor] Initial Commit

* [lens] Add more complete initial state

* [lens] Fix type issues

* [lens] Remove feature control

* [lens] Bring back feature control and add tests

* [lens] Update plugin structure and naming per comments

* replace any usage by safe casting

* [lens] Respond to review comments

* [lens] Remove unused EditorFrameState type

* [lens] Initial state for IndexPatternDatasource (#36052)

* [lens] Add first tests to indexpattern data source

* Respond to review comments

* Fix type definitions

* [lens] Editor frame initializes datasources and visualizations (#36060)

* [lens] Editor frame initializes datasources and visualizations

* Respond to review comments

* Fix build issues

* Fix state management issue

* [lens][draft] Lens/drag drop (#36268)

Add basic drag / drop component to Lens

* remove local package (#36456)

* [lens] Native renderer (#36165)

* Add nativerenderer component

* Use native renderer in app and editor frame

* [Lens] No explicit any (#36515)

* [Lens] Implement basic editor frame state handling (#36443)

* [lens] Load index patterns and render in data panel (#36463)

* [lens] Editor frame initializes datasources and visualizations

* Respond to review comments

* Fix build issues

* remove local package

* [lens] Load index patterns into data source

* Redo types for Index Pattern Datasource

* Fix one more type

* Respond to review comments

* [draft] Lens/line chart renderer (#36827)

Expression logic for the Lens xy chart.

* [lens] Index pattern data panel (initial) (#37015)

* [lens] Index pattern switcher

* Respond to review comments

* [Lens] Editor state 2 (#36513)

* [lens] Dimension panel that generates columns (#37117)

* [lens] Dimension panel that generates columns

* Update from review comments

* [lens] Generate esdocs queries from index pattern (#37361)

* [lens] Generate esdocs queries from index pattern

* Remove unused code

* Update yarn.lock from yarn kbn bootstrap

* [Lens] Add basic Lens xy chart suggestions (#37030)

Basic xy chart suggestions

* [Lens] Expression rendering (#37648)

* [Lens] Expression handling (#37876)

* [Lens] Lens/xy config panel (#37391)

Basic xy chart configuration panel

* [Lens] Xy expression building (#37967)

* [Lens] Initialize visualization with datasource api (#38142)

* [lens] Dimension panel lets users select operations and fields individually (#37573)

* [lens] Dimension panel lets users select operations and fields individually

* Split files and add tests

* Fix dimension labeling and add clear button

* Support more aggregations, aggregation nesting, rollups, and clearing

* Fix esaggs expression

* Increase top-level test coverage of dimension panel

* Update from review comments

* [Lens] Rename columns (#38278)

* [Lens] Lens/index pattern drag drop (#37711)

* Basic xy chart suggestions

* Re-apply XY config panel after force merge

* Initial integration of lens drag and drop

* Tweak naming, remove irellevant comment

* Tweaks per Wylie's feedback

* Add xy chart internationalization
Tweak types per Joe's feedback

* Update xy chart i18n implementation

* Fix i18n id

* Add drop tests to the lens index pattern

* improve tests

* [lens] Only allow aggregated dimensions (#38820)

* [lens] Only allow aggregated dimensions

* [lens] Index pattern suggest on drop

* Fully remove value

* Revert "[lens] Index pattern suggest on drop"

This reverts commit 604c6ed68c.

* Fix type errors

* [lens] Suggest on drop (#38848)

* [lens] Index pattern suggest on drop

* Add test for suggestion without date field

* fix merge

* [Lens] Parameter configurations and new dimension config flow (#38863)

* fix eslint failure

* [lens] Fix build by updating saved objects and i18n (#39391)

* [lens] Update location of saved objects code

* Update internatationalization

* Remove added file

* [lens] Fix arguments to esaggs using booleans (#39462)

* [lens] Datatable visualization plugin (#39390)

* [lens] Datatable visualization plugin

* Fix merge issues and add tests

* Update from review

* Fix file locations

* [lens] Use first suggestion when switching visualizations (#39377)

* [lens] Label each Y axis with its operation label (#39461)

* [lens] Label each Y axis with its operation label

* Remove comment

* Add link to chart issue

* [Lens] Suggestion preview rendering (#39576)

* [Lens] Popover configs (#39565)

* [Lens] Basic layouting (#39587)

* remove datasource public API in suggestions (#39772)

* [Lens] Basic save / load (#39257)

Add basic routing, save, and load to Lens

* [lens] Fix lint error

* [lens] Use node scripts/eslint.js --fix to fix errors

* [lens] Include link to lens from Visualize (#40542)

* [lens] Support stacking in xy visualization (#40546)

* [lens] Support stacking in xy visualization

* Use chart type switcher for stacked and horizontal xy charts

* Clean up remaining isStacked code

* Fix type error

* [Lens] Add xy split series support (#39726)

* Add split series to lens xy chart

* [lens] Lens Filter Ratio (#40196)

* WIP filter ratio

* Fix test issues

* Pass dependencies through plugin like new platform

* Pass props into filter ratio popover editor

* Provide mocks to filter_ratio popover test

* Add another test

* Clean up to prepare for review

* Clean up unnecessary changes

* Respond to review comments

* Fix tests

* [Lens] Terms order direction (#39884)

* fix types

* [Lens] Data panel styling and optimizations (#40787)

Style the data panel (mostly Joe Reuter's doing). Optimize a bunch of the Lens stack.

* [Lens] Optimize dimension panel flow (#41114)

* [Lens] re-introduce no-explicit-any (#41454)

* [Lens] No results marker (#41450)

* [lens] Support layers for visualizing results of multiple queries (#41290)

* [lens] WIP add support for layers

* [lens] WIP switch to nested tables

* Get basic layering to work

* Load multiple tables and render in one chart

* Fix priority ordering

* Reduce quantity of linting errors

* Ensure that new xy layer state has a split column

* Make the "add" y / split the trailing accessor

* Various fixes for datasource public API and implementation

* Unify datasource deletion and accessor removal

* Fix broken scss

* Fix xy visualization TypeScript errors?

* Build basic suggestions

* Restore save/load and fix typescript bugs

* simplify init routine

* fix save tests

* fix persistence tests

* fix state management tests

* Ensure the data table is aligned to the top

* Add layer support to Lens datatable

* Give xy chart a default layer initially

* Allow deletion of layers in xy charts

* xy: Make split accessor singular
Remove commented code blocks

* Change expression type for lens_merge_tables

* Fix XY chart rendering expression

* Fix type errors relating to `layerId` in table suggestions

* Pass around tables for suggestions with associated layerIds

* fix tests in workspace panel

* fix editor_frame tests

* Fix xy tests, skip inapplicable tests
that will be implemented in a separate PR

* add some tests for multiple datasources and layers

* Suggest that split series comes before X axis in XY chart

* Get datatable suggestion working

* Adjust how xy axis labels are computed

* Datasource suggestions should handle layers and have tests

* Fix linting in XY chart and remove commented code

* Update snapshots from earlier change

* Fix linting errors

* More cleanup

* Remove commented code

* Test the multi-column editor

* XY Visualization does not need to track datasourceId

* Fix various comments

* Remove unused xy prop
Add datasource header to datatable config

* Use operation labels for XY chart

* Adding and removing layers is reflected in the datasource

* rewrote datasource state init

* clean up editor_frame frame api implementation

* clean up editor frame

* [Lens] Embeddable (#41361)

* [lens] Move XY chart config into popover and fix layering (#41927)

* [lens] Move XY chart config into popover and fix layering

* Fix tests

* Update style

* Change wrapping of layer settings popover

* [Lens] Fix bugs in date_histogram and filter ratio (#42046)

* [Lens] Performance improvements (#41784)

* fix type error

* switch default size of terms operation to 3 (#42334)

* [lens] Improve suggestions for split series (#42052)

* [lens] Add chart switcher (#42093)

* solve merge conflicts

* fix test case

* [Lens] Allow only current visualization on field drop in workspace (#42344)

* [Lens] Remove indexpattern id on column (#42429)

* [lens] Implement app-level filtering and time picker (#42031)

* [lens] Implement app-level filtering and time picker

* More integration with filter bar

* Clean up test code and type errors

* Add frame level tests for syncing with app

* Add test coverage for app logic

* Simplify state management from app down

* Fix import errors

* Clarify whether properties are ids or titles for index pattern

* pass new saved object by ref

* add dirty state checking

* Fix tests

* [Lens] Add some tests around document handling in dimension panel (#42670)

* [Lens] Terms operation boolean support (#42817)

* [lens] Minor UX/UI improvements in Lens (#42852)

* Make dimension popover toggle when clicking button

* Without suggestions hide suggestion panel

* Add missing translations (#42921)

* [Lens] Config panel design (#42980)

* Fix up design of config panel

Does not include config popover

* Remove a couple of non-null assertions (#43013)

* Remove a couple of non-null assertions

* Remove orphaned import

* [Lens] Switch indexpattern manually (#42599)

* [Lens] Update frame to put suggestions at the bottom (#42997)

* fix type errors

* switch indexpattern on layer if there is only a single empty one (#43079)

* [Lens] Suggest reduced versions of current data table (#42537)

* [Lens] Field formatter support (#38874)

* Fix bugs

* [Lens] Add bucket nesting editor to indexpattern (#42869)

* [Lens] Remove unnecessary fields and indexing from mappings (#43285)

* [Lens] Xy scale type (#42142)

* [lens] Allow updater function to be used for updating state (#43373)

* [Lens] Lens metric visualization (#39364)

* Fix axis rotation (#43792)

* [Lens] Auto date histogram (#43775)

* Add auto date histogram

* Improve documentation and cleanup

* Add tests

* Change test name

* [Lens] Fix query bar integration (#43865)

* [Lens] Clean up operations code (#43784)

* [Lens] Functional tests (#44279)

Foundational layer for lens functional tests. Lens-specific page objects are not in this PR.

* [Lens] Add Lens visualizations to Visualize list (#43398)

* [Lens] Suggestion improvements (#43688)

* [lens] Calculate existence of fields in datasource (#44422)

* [lens] Calculate existence of fields in datasource

* Fix route registration

* Add page object and use existence in functional test

* Simplify layout of filters for index pattern

* Respond to review feedback

* Update class names

* Use new URL constant

* Fix usage of base path

* Fix lint errors

* [Lens ] Preview metric (#43755)

* format filter ratio as percentage (#44625)

* [Lens] Remove datasource suggestion id (#44495)

* [Lens] Make breadcrumbs look and feel like Visualize (#44258)

* [lens] Fix breakage from app-arch movements (#44720)

* [lens] Fix type error in test from merge

* [lens] Fix registration of embeddable (#45171)

* [Lens] Functional tests (#44814)

Basic functional tests for Lens, by no means comprehensive. This is more of a smokescreen test of some normal use cases.

* [lens] Add Lens to CODEOWNERS (#45296)

* [lens] Fix visualization alias registration

* [lens] Fix usage of EUI after typescript upgrade (#45404)

* [lens] Fix usage of EUI after typescript upgrade

* Use local fix instead of workaround

* [lens] Fix usage of expressions plugin (#45544)

* [lens] Fix usage of expressions plugin

* Use updated exports from #45538

* Fix imports and mocha tests

* Use relative instead of absolute path to fix tests

* [lens] More cleanup from QueryBar changes in master (#45687)

* [lens] Fix build and use new platform from entry points (#45834)

* [lens] Fix build and use new platform from entry points

* Fix params for existence route
2019-09-17 14:57:53 -04:00
Aleh Zasypkin 9d69b72a5f
Move base feature controls functionality from XPack Main plugin to a dedicated XPack Features plugin (#44664) 2019-09-09 19:15:58 +02:00
Eli Perelman 4667c46cae
Add x-pack plugin for new platform server licensing information (#43623)
* Add x-pack plugin for new platform server licensing information

* Update x-pack translations

* Implement core plugin interface for licensing plugin:

* Rename references to service to plugin

* Use CoreStart in licensing start method

* Fix outstanding reference error

* Fix type check errors

* Address outstanding review comments

* Fix type error in tests

* Address review comments, move polling logic to standalone

* Split up test files

* Fix bad reference in test

* Use relative reference to poller util

* Add more plugin tests to address review comments

* Fix different manners of config generation in licensing plugin

* Update test fixtures

* Fix path to test fixtures
2019-08-29 18:28:31 -05:00
Stacey Gammon a9b479a667
Per panel time range (#43153)
* Per panel time range

* Added tests and fixed lack of await check for incompatibility

* Remove a couple more unneccessary `anys`
2019-08-14 11:54:11 -04:00
Ahmad Bamieh 81153c2a22
[i18n] .i18nrc file as the source of truth and enhance tooling (#39774)
* scan node_modules/@kbn directory for i18n

* remove es-lint-disable-next line

* update paths

* look inside .i18nrc.json instead of traversing files

* split .i18nrc file and enhance i18n tooling

* checkout master kibana config

* include x-pack/.i18nrc.json file

* remove unused import

* fix i18n_integrate

* fix i18n_integrate

* code review changes

* code review changes

* try using scanDir

* revert to using concat

* add config type

* code review fixes

* finalize PR

* revert kibana.yml
2019-07-21 15:06:03 +03:00