Commit graph

142 commits

Author SHA1 Message Date
Daniil Suleiman da89856503
[NP] Move visTypeVislib into NP (#63963) 2020-04-28 14:44:17 +02:00
Ryland Herrick 4cc5b3a4d3
[SIEM] Client NP Cutover (#64251)
* Move SIEM public/ folder to NP plugin

This is solely renames; fixes come next.

* Update relative imports in our API tests

* Fix linter errors following move to NP folder

These paths got a little shorter, so some lines could be collapsed.

* Move client dependencies to NP package.json

I'm removing the @types/js-yaml for now because I'm not sure we need it;
I'll add it back later if we do.

* Fix relative imports to other plugins

* Fix errant uses of ui/chrome

* Remove legacy plugin shim

* Move feature registration into plugin

This previously had to be part of legacy bootstrapping due to an order
of operations issue.

* Disconnect legacy plugin

The index file should now be redundant with what's in the plugin:

* app registration
* feature registration

* Move public gitattributes

* Remove references to legacy embeddables

We can now use the NP API. Maps embeddable will not work here until
their work is merged, but this should prevent us from importing legacy
code and thus breaking the build.

* Add our frontend dependencies to kibana.json

These are all required for now, because that's how they're typed. If
they _should_ be optional (and I think several should), we need to
update the type and handle the null case within the app.

* Replace use of ui/new_platform mocks in embeddable utils

* Fix remaining jest tests

* Replace build-breaking ui/new_platform mocks with equivalents in core
proper
* Remove unnecessary mocks of ui/new_platform

* Remove references to legacy SIEM folder

* I left the reference in CODEOWNERS in case someone tries to sneak
something back
* I left the .gitignore reference for the same reason

* Fix mocks of relative paths

These were not caught by typescript and were causing test failures.

* Export our client plugin contracts

They're empty for now.

* Move from deprecated appmount API

The new one dropped a param we weren't using.

* Add missing mock causing test failures

* Don't re-export core types from our plugin

Import them from core where we need them, instead

* Move Actions UI registry outside of mount

This is already imported, there's no benefit (and potential timing
issues) with doing this inside the mount.

* Add security's setup contract to our StartServices

This doesn't change what's used, only how we're typing it. The types are now a
little more truthful as:

* our StartPlugins don't include setup contracts
* our StartServices includes everything we use at Start time, including
the one setup plugin.

* Add order and icon back to the sidebar link

* Replace plugin class properties with constants

These are shared, and should be consistent.

* Enable our UI on NP

* Add missed plugin dependencies

We're not using their contracts, but we are importing code from them.

* Revert use of constant in translation

Can't do that, whoops

* i18n our feature catalogue entry

* Remove unnecessary array from single element

* Remove unused keys

These were the legacy translations used... well, I don't know where they
were used.

* Ignore circular dependencies in external plugins

* Normalize exclusions

* Add undeclared dependencies to kibana.json

We import our maps embeddable from maps, and we pass inspector to the
embeddable. I just missed these in my audit. This was causing errors in
the map embeddable.

* Await our call to setLayerList

This is an async call that we need to complete before we can render.

* Reduce siem plugin size

When we load our initial plugin (before our app is loaded), were were
implicitly importing all of kibana_react with this import. While a
global module prevents this from affecting our bundle size currently,
that could change in the future. Since we only need a reference to our
class, we just import that instead.
2020-04-27 17:59:21 -05:00
Gidi Meir Morris a012ddf9df
[alerting] removes usage of any throughout Alerting Services code (#64161)
This removes unneeded use of `any` throughout:
1. alerting
2. alerting_builtin
3. actions
4. task manager
5. event log

It also adds a linting rule that will prevent us from adding more `any` in the future unless an explicit exemption is made.
2020-04-24 17:04:36 +01:00
Tyler Smalley feed406c77
[eslint] no_restricted_paths config cleanup (#63741)
Major cleanup of the no_restricted_paths rule for imports of core.

For relative imports, we use eslint-module-utils/resolve which resolves
to the full filesystem path. So, to support relative and absolute
imports from the src alias we need to define both the directory and the
index including file extension.

This rule was handling both core imports, as well as imports from other
plugins. Imports from other plugins are being used much more liberally
allowed through the exceptions in tests. I choose to break these up,
removing this exception for tests for core imports.

Fixes:
Absolute imports of src/core/server/mocks were not allowed in src. This
was not an issue in x-pack due to the target excluding
!x-pack/**/*.test.* and !x-pack/test/**/*.

Non-top-level public and server imports were allowed from X-Pack tests
to the previously mentioned exclusion.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-04-23 15:59:01 -07:00
CJ Cenizal 91f7911d15
Move CCR out of legacy (#62890)
* Convert common/services and server/lib to TypeScript. Update Jest tests.
  - Remove deserializeAutoFollowPattern behavior that returned an empty object if the pattern was undefined.
* Localize mocks with the component integration tests.
* Update API unit tests to use NP mocks.
  - Break up test files.
  - Use inline mocked ES response instead of fixture files.
  - Move remaining fixture files into client integration tests directory.
* Make API route validation more strict.
* Publish isUiDisabled as part of Remote Clusters contract.
* Default trackUiMetric service to be a no-op.
* Remove security dependency.
  - Fix license check so that CCR won't render if the license is invalid.
  - Fix server security check to be more precise by checking if ES has security disabled.
* Render timestamp for autofollow errors.
2020-04-22 07:15:25 -07:00
Ryland Herrick 40f82229f0
[SIEM] Server cutover to New Platform (#63430)
* Move server code into NP folder

* NP config is not yet used
* Relative imports are somewhat broken

* Move common folder into NP

* Move cypress folder into NP

* Move scripts folder into NP

* Move misc. config into NP folder

A few of these were moved into the cypress folder as they're
cypress-specific.

I tried to update all the relative paths but some are likely broken. I'm
not going to know until other stuff is fixed, though.

* Move value for siem index pattern into common/constants

The other default values live in there, this is no different.

* Update paths following file move

If this was referencing the full project, it now references both paths
(legacy for UI, and NP for server).

* Fix typescript errors related to module resolution

These are mostly updating imports to the common/ folder on the UI side
(since things changed relative to those files).

* Replace Legacy Config with NP Config

* Updates plugin to use NP config
  * defines new config previously coming from savedObjects config
* cleans up legacy types

 Conflicts:
	x-pack/plugins/siem/server/lib/detection_engine/routes/rules/export_rules_route.ts
	x-pack/plugins/siem/server/lib/detection_engine/routes/rules/import_rules_route.ts
	x-pack/plugins/siem/server/lib/detection_engine/rules/types.ts
	x-pack/plugins/siem/server/plugin.ts
	x-pack/plugins/siem/server/routes/index.ts
	x-pack/plugins/siem/server/types.ts

* Remove local SIEM tsconfig

This was originally added to address an issue with tsserver, but that
issue is no longer relevant. The presence of this file confuses
typescript into thinking that siem is a separate TS project.

* Update kibana.json to declare our dependencies

These are not necessarily correct in terms of what's required/optional,
but this is what's declared in our types.

* Remove legacy plugin instantiation

* Removes legacy instantiation of server plugin, which is now handled by
NP
* Loosens legacy config spec so we no longer have to duplicate config
types

* Update tests with NP config

These were written against the old Hapi config function; now, we just
have a POJO.

* Update es_archiver helpers' paths

I'm not quite sure if these are working yet, but they're no longer
throwing errors.

* Ignore restricted path on script

This was cribbed from infra, who has made a similar change.

* Ignore restricted path on temporary savedObject mappings import

This will be changed subsequently when we switch to the NP form of
savedObject type registration.

* Add symlink to lockfile

* Fix paths on circular deps script

* Add separate config for Rule and Timeline saved objects

We had previously used the savedObjects' config, but those are not
currently exposed to us on New Platform. For now, we're going to split
this into two sets of values for the SOs we deal with
importing/exporting within the SIEM app, with the same defaults as
savedObjects.

* Fixing relative paths within cypress

These are strings that wouldn't be caught by typescript.
2020-04-17 12:31:54 -05:00
Dima Arnautov 7058070e15
[ML] Extract apiDoc params from the schema definitions (#62933)
* [ML] WIP apiDoc schema extractor

* [ML] extract actual type

* [ML] refactor schema definitions

* [ML] Update README.md

* [ML] extract nested

* [ML] call job validation endpoint with complete payload

* [ML] escape special chars and fix line breaks

* [ML] clean up extractDocEntries

* [ML] serializeWithType

* [ML] add missing annotations

* [ML] fix parent schema assigment

* [ML] support object composition

* [ML] support multiple schemas per block

* [ML] fix for collections

* [ML] fix calendarIdsSchema

* [ML] add ml package.json with apidoc commands

* [ML] use the single output markdown file

* [ML] fix typo

* [ML] change the Calendars order

* [ML] adjust the order in adidoc.json

* [ML] update api version

* [ML] update tsconfig.json include

* [ML] update packages/kbn-pm/dist/index.js

* [ML] update ML overrides in .eslintrc.js

* [ML] yarn.lock symlink

* Revert "[ML] yarn.lock symlink"

This reverts commit 07f06801

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-15 18:40:34 +02:00
Tim Roes ebbc062689
Move Lens frontend to Kibana Platform (#62965)
* Move Lens frontend to Kibana platform

* Fix line breaks

* Fix jest tests

* Fix remaining test

* Remove old Lens plugin entry

* Fix i18n prefix

* Add config schema

* Address review
2020-04-15 12:22:37 +02:00
Daniil Suleiman 314c4f782f
[NP] Vis Default Editor plugin (#62475)
* Move the default_editor to NP

* Fix paths

* Import styles through the visualize

* Other fixes

* Fix ip_ranges exhaustive-deps array

* Fix filters and extend bounds

* Other fixes

* Fix date_ranges tests

* Use useMount on first render

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-08 12:00:13 +03:00
Tim Roes 8429a8ede9
Fix old pathes in eslintrc (#62580) 2020-04-07 09:24:21 +02:00
Spencer 5a537d16a5
[plugin-generator] rewrite tests to match new generated plugins (#61571)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2020-03-27 10:54:54 -07:00
Luke Elmers 3401ae42e0
Goodbye, legacy data plugin 👋 (#60449) 2020-03-23 09:17:27 -06:00
MadameSheema 6598298d01
skips 'config_open.ts' files from linter check (#60248) 2020-03-16 15:13:03 +01:00
James Gowdy 35302ed273
[ML] Client side cut over (#60100)
* [ML] Client side cut over

* updating paths and commented code

* changes based on review

* disabling telemetry tests

* fixing start job stylesheets

* fixing everything that is broken

* fixing types and ml icon order

* using icon constant
2020-03-13 19:16:41 +00:00
Thomas Watson 38717982e3
Clean up .eslintrc.js with better variable naming (#59864) 2020-03-11 15:18:49 +01:00
Thomas Watson 1525dbe73d
ci: disable all Mocha rules for tape tests (#59798) 2020-03-11 08:07:06 +01:00
Thomas Watson a663f65bcc
Harden creation of child processes (#55697)
Add general protection against RCE vulnerabilities similar to the one
described in CVE-2019-7609.

Closes #49605
2020-03-10 07:51:57 +01:00
Maryia Lapata 80db96b823
Fix TS for vis_type_vislib (#58345)
* Fix TS for vislib

* Fix TS

* Revert table changes

* Update unit test

* Refactor updateAxisTitle

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-04 13:57:16 +03:00
Maryia Lapata 39f6eaf5f4
Fix TS for vis_type_table (#58347)
* Remove eslint overrides for vis_type_table

* Fix TS for vis_type_table

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

* QueryString remove encode/decode methods

* remove query_string file

* remove querystring-browser from package.json

* add kibana_utils\url module

* cleanup

* update notice.txt

* fix merge conflict

* fix CI

* fix wrong import

* fix CI

* fix X-Pack firefox smoke test

* remove urlUtils.parseUrlQuery

* remove url.stringifyUrlQuery

* use url.encodeQuery

* Record<string, any> -> ParsedQuery

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

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

* add more tests for APM

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Luke Elmers <lukeelmers@gmail.com>
2020-02-12 19:51:03 +03:00
Joe Reuter 09f1cad573
Check for legacy imports in vis types and fix problems (#56763) 2020-02-10 12:48:18 +01:00
patrykkopycinski 05edbdac78
[SIEM] Add eslint-plugin-react-perf (#55960)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-04 11:22:40 +01:00
Daniil Suleiman 7f63118d6b
Vis default editor plugin (#55612)
* Shim the default_editor

* Update paths in vis_default_editor

* Update paths in dependent plugins

* Update the dependent plugins

* Create an entry point

* Wrap the editor with kibana context

* Fix circular re-renders

* Update sub aggs mapping

* Move schemas and agg_groups to agg_types, update jest tests

* Use services from kibana context, other fixes

* Fix useEffect maximum update depth

* Create i18n namesapce for visDefaultEditor, rename translations

* Fix tests

* Resolve paths

* Remove ui/vis/vis_types

* Fix vis import

* Move editor_config_provider to ui/vis
2020-01-29 17:41:18 +03:00
Alexey Antonov 5d6dbf07b0
Expose NP FieldFormats service to server side (#55419)
* Expose NP FieldFormats service to server side

* fix CI

* fix PR comments

* fix PR comments

* fix CI

* getFieldFormatsRegistry -> getFieldFormatRegistry

* fix CI

* memoize - add resolve cache function

* fix Jest

* move IFieldFormatMetaParams to types.ts

* FieldFormatRegistry -> FieldFormatsRegistry

* update src/core/MIGRATION.md

* update public contract

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-27 22:25:39 +03:00
Jean-Louis Leysens f7c53b5690
Disallow importing Joi client side (#55018)
* Disallow importing Joi client side

* Move elasticsearch lib into server folder

* Add a comment about the 'joi' eslint rule

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 15:38:44 +01:00
Nick Partridge bd7d5eb9f6
Shim vis_type_vislib (#53536)
* shim of kbn_vislib_vis_types (now vis_type_vislib)
* Move vislib into vis_type_vislib plugin
* Convert remaining plugin files to typescript
* Rename vis to vis_type_vislib
2020-01-15 15:48:19 -06:00
Spencer 357be5970d
share specific instances of some ui packages (#54079)
* share specific instances of some ui packages

* remove unnecessary eslint changes, every package will define deps anyway

* remove mentions of moment webpackShims in eslint resolver

* remove use of lodash

* list angular as dep for x-pack

* add operations as codeowner of shared-deps pkg
2020-01-10 15:22:18 -07:00
Joe Reuter 07278aba37
remove linting rule exception for markdown (#54232) 2020-01-10 20:30:03 +01:00
Tim Roes d03d05106e
Fix tile-map react eslint errors (#54265) 2020-01-10 11:24:59 +01:00
Marta Bondyra d4f584e0cb
Fix eslint rule for vis_type_metric `jsx-a11y/click-events-hav… (#54279) 2020-01-09 17:07:44 +01:00
Matthias Wilhelm 58f792cee3
Remove eslint overwrite for src/legacy/core_plugins/kibana (#54222)
* Cleanup code 
* Remove eslint overwrite
2020-01-09 11:56:14 +01:00
Tim Roes 7ffe38569e
Fix Vega react eslint errors (#54259) 2020-01-08 18:19:20 +01:00
Anton Dosov 513428af44
add examples/ to no-restricted-path config (#54252) 2020-01-08 19:20:07 +03:00
patrykkopycinski 23a0513469
[SIEM] Add react/display-name eslint rule (#53107) 2020-01-07 18:05:04 +01:00
patrykkopycinski 677670b929
[SIEM] Enable eslint prefer-template rule (#53983)
* [SIEM] Enable eslint prefer-template rule

* cleanup

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-07 18:02:32 +01:00
patrykkopycinski 6e1328b9f0
[SIEM] Enable eslint react/no-children-prop (#53985) 2020-01-07 17:46:56 +01:00
Chris Roberson 28b6efa260
Fix linting issues (#54068)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-07 11:31:15 -05:00
Justin Kambic bd2be32876
[Uptime] Delete uptime eslint rule skip (#50912)
* Delete uptime eslint rules.

* Update hooks usage to adhere to new eslint rules.

* Delete code accidentally added during rebase.

* WIP trying things.

* Clean up types and hook usage to comply with kibana eslint rules.

* Clean up code.

* Update new useEffect hooks that are missing dependencies.

* Fix edits that broke a page.
2020-01-02 16:36:07 -05:00
spalger c52571be68 ensure prettier overrides take precedence, remove style rules 2019-12-14 17:39:10 -07:00
spalger a3553c924d [eslint] use prettier for all the things 2019-12-13 23:17:11 -07:00
spalger 1ea9d791bc Revert "Revert "Fix wrong impor (#52994)""
This reverts commit c220d770cc.
2019-12-13 14:09:51 -07:00
spalger c220d770cc Revert "Fix wrong impor (#52994)"
This reverts commit 6c1f248c4f.
2019-12-13 13:16:40 -07:00
Josh Dover ec2134d221
Add lint rule to prevent server code being imported into client (#52447) 2019-12-13 12:26:04 -06:00
Mikhail Shustov 6c1f248c4f
Fix wrong impor (#52994)
* Licensing plugin and XPackInfo uses the same license data (#52507)

* convert xpackinfo to TS

* use NP Licensing plugin in XPackInfo

* update mocks

* put license regresh hack back.

otherwise new license won't be re-fetched when signature changed. was deleted by mistake

* add functional test for legacy xpackmain

* declare setup types on client & server explicitly

* rename mock license --> licensing to match plugin name

* add tests for createLicensePoller

* fix type error

* adopt tests for xpack_info

* createXPackInfo uses new platform API

* put back error mute

* address comments

* fix renamed import

* address comment

* update tests to reduce delays

* deprecate xpack.xpack_main.xpack_api_polling_frequency_millis

* use snake_case in config

* fix wrong import
2019-12-13 18:09:36 +01:00
Spencer 7ba47eebbf
[euiUtils] fix unnecessary useEffect dep (#52782) 2019-12-11 12:49:15 -07:00
Felix Stürmer 0cd62cabbb
[Logs + Metrics UI] Remove eslint exceptions (#50979)
This removes the two eslint exceptions specific to the `infra` plugin introduced in #49244.

fixes #49563
2019-12-11 13:48:40 +01:00
Jean-Louis Leysens aa31b535d1
[Watcher] New Platform (NP) Migration (#50908)
* First iteration of watch public -> new platform
Still need to switch to np ready version of use_request

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

* First attempt at server shim

* Rename file and re-enable react hooks linting

* Fix some public types and react hooks lint rules

* Fix types

* More ES lint react hooks fixes

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

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

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

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

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

* Fix more types and finish testing API routes

* Fix usage of feature catalogue and fix time buckets types

* Fix error message shape [skip ci]

* Split legacy from new platform dependencies server-side

* Refactor: Seperate client legacy and NP dependencies

* Add file: added types file

* Fix UISettings client type import

* Update license pre-routing factory spec

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

* Use NP elasticsearchclient

* Simplify is_es_error_factory

* Fix types

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

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

* Fix watch create JSON spec

* Create threshold test working

* Unskip watch_edit.test.ts

* Unskip watch_list.test.ts

* Done re-enabling component integration tests

* TimeBuckets typo + remove unnecessary // @ts-ignore
2019-12-11 09:54:42 +01:00
Joe Reuter 69e6b2908d
fix linting errors in graph (#50907) 2019-12-03 15:44:37 +01:00
Pierre Gayvallet 99c6396fd5
Migrate Capabilities to new platform (#51438)
* create service skeleton

* move registerCapabilitiesModifier to capabilities service and rename to registerCapabilitiesSwitcher

* starts to move capabilities logic to CapabilitiesService

* move capabilities route to service

* add initial integration test for capabilities route

* capabilitiesMixin now delegates to capability service

* use server-side Capabilities import in server code

* update generated doc

* remove capabilities from injectedMetadatas

* use applications sent from client instead of server-registered navLinks

* disable authRequired for capabilities route

* (temp) exposes two endpoints for capabilities

* Add fetch-mock on capabilities call for karma tests

* adapt xpack Capabilities test - first attempt

* adapt x-pack ui_capabilities test

* add '/status' to the list of anonymous pages

* Add documentation on Capabilities APIs

* move Capabilities to core/types

* update generated docs

* add service tests

* protecting resolveCapabilities against added/removed capabilities

* update generated docs

* adapt mocks due to rebase

* add forgotten exports

* improve capabilities routes registering

* name capabilities registering methods

* resolve conflicts due to merge

* address review issues

* add comment about reason for exposing two routes

* extract createHttpServer test helper

* fix merge conflicts

* improve documentation

* remove `/status` anon registration as now done in NP status plugin

* fix merge conflicts
2019-12-03 09:34:49 +01:00
Mikhail Shustov bd63596d18
add eslint rule banning the core to import plugin code (#51563)
* add eslint rule banning the core to import plugin code

* Ban importing legacy plugin code in the сore

* fix eslint errors

* core cannot import xpack rule

* regen docs
2019-11-28 22:54:21 +01:00