Commit graph

225 commits

Author SHA1 Message Date
Joe Portner 66dbb88451
Allow optional OSS to X-Pack dependencies (#107432) 2021-08-05 13:58:24 -04:00
Aleh Zasypkin ed28155165
Implement interactiveSetup plugin server side functionality: setup layout (#105222) 2021-08-03 15:52:11 +02:00
Kevin Qualters 3612a7a300
[Security Solution][RAC] Migrate add to case action to timelines plugin (#106205)
* First pass add to case action in timelines plugin

* Fix fake duplicate import lint rule and some type errors

* Fix some tests

* Remove use_insert_timeline and pass as prop

* Remove unneeded ports, fix types/tests

* Finish fixing types and tests for add to case action

* Remove duplicated security_solution code

* Pass appId as props

* Fix lint and a type error

* Use react-router-dom instead of window.location.search

* Fix broken test

* Remove unused imports

* Remove unused export and related code
2021-07-28 17:10:37 -04:00
Yaroslav Kuznietsov 473b6aad0f
[Canvas] Expression shape (#103219)
* expression_reveal_image skeleton.

* expression_functions added.

* expression_renderers added.

* Backup of daily work.

* Fixed errors.

* Added legacy support. Added button for legacy.

* Added storybook.

* Removed revealImage from canvas.

* Types fixed.

* Fixed test suite error.

* Fixed eslint error.

* Moved UI and elements, related to expressionRevealImage from canvas.

* Fixed unused translations errors.

* Moved type of element to types.

* Fixed types and added service for representing elements, ui and supported renderers to canvas.

* Added expression registration to canvas.

* Fixed

* Fixed mutiple call of the function.

* Removed support of a legacy lib for revealImage chart.

* Removed legacy presentation_utils plugin import.

* Removed useless translations and tried to fix error.

* One more fix.

* Small imports fix.

* Fixed translations.

* Made fixes based on nits.

* Removed useless params.

* fix.

* Fixed errors, related to jest and __mocks__.

* Removed useless type definition.

* Replaced RendererHandlers with IInterpreterRendererHandlers.

* fixed supported_shareable.

* Moved elements back to canvas.

* Moved views to canvas, removed expression service and imported renderer to canvas.

* Fixed translations.

* Moved libs to presentation utils.

* Fixed types and removed function_wrapper.ts

* Fixed types of test helpers.

* Fixed imports.

* One more fix.

* Fixed public API.

* Moved css to component.

* Fixed spaces at element.

* Removed unused plugin.

* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Moved related components from canvas.

* Changed imports of components.

* Removed useless translations and fixed .i18nrc.json

* More fixes of i18nrc.

* Fixed async functions.

Written current code, based on https://github.com/storybookjs/storybook/issues/7745

* Fixed one test with Expression input.

After changing the way of rendering in stories, all elements are mounting and componentDidMount is involved. The previous snapshot was without
mounted `monaco` editor.

* generated plugin and copied code from expression_reveal_image

* fixed double import after merge.

* Changed all names from reveal_image to shape.

* moved shape to plugin and added all necessary configs

* Fixed translations, fixed all imports and debug of svg.

* `function` moved to `server`.

* One shape is rewritten to `React` and rendering is written with passing necessary props.

* changed default width and heigth.

* Added `ShapeHOC`.

* Shapes changed.

* small refactor.

* Removed useless import.

* one more refactor.

* Refactor + fix errors + updated limits.

* Changed ShapePreview from pure js to react and removed `dangerouslySetInnerHTML`

* Fixed types of viewbox.

* Changed types source for Shape components.

* small refactor.

* Fixed imports.

* Removed `shape` from `canvas`

* Updated docs.

* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Changed imports of components.

* Fixed errors, related to shape and autosuggestions.

* Fixed i18n for shape.

* Moved function from public to common and registered at server.

* Fixed types error.

* Fixed snapshots and shape mocks.

* Moved some libs from `presentations_util` to `expression_shape`

* Shape refactored.

* Shape picker fixed.

* Moved `Popover` back to `canvas`

* Removed `Popover` export from presentation_utils components.

* Moved error_component and debug_component from presentation_util to expression_error.

* Removed `.i18nrc.json`.

* Removed `.i18nrc.json`.

* Removed useless scss.

* Fixed color of `error`.

* added fixes of rebase.

* More fixes of rebase error .

* Removed useless .i18nrc.json file.

* More fixes.

* More fixes of rebase.

* One more fix.

* More fixes.

* Fixed limits and translations.

* Added.

* Fixed i18nrc.

* Fixed error..

* Moved shapes to async chunks.

* One more fix.

* Some fixes.

* Trying to fix the typecheck error.

* Added temp of drawer.

* Moved shapes to the async chunk in a less complex way.

* Made `ShapeDrawer` reusable among different `expressions`.

* Changed type of `shapes` from `any` and `Shape` to `string`.

* Made changes, based on nits.

* Removed not necessary changes.

* Moved all reusable libs to `expression_shapes`.

* Reduced the size of the bundle.

* Hope, fixed type check errors.

* Removed getDefaultShapeData.

* Removed `getViewBox` from bundle.
2021-07-21 17:46:19 +03:00
Yaroslav Kuznietsov b352976b3b
[Canvas] Expression reveal image. (#101987)
* expression_reveal_image skeleton.

* expression_functions added.

* expression_renderers added.

* Backup of daily work.

* Fixed errors.

* Added legacy support. Added button for legacy.

* Added storybook.

* Removed revealImage from canvas.

* setState while rendering error fixed.

* tsconfig.json added.

* jest.config.js added.

* Demo doc added.

* Types fixed.

* added limits.

* Removed not used imports.

* i18n namespaces fixed.

* Fixed test suite error.

* Some errors fixed.

* Fixed eslint error.

* Removed more unused translations.

* Moved UI and elements, related to expressionRevealImage from canvas.

* Fixed unused translations errors.

* Moved type of element to types.

* Fixed types and added service for representing elements, ui and supported renderers to canvas.

* Added expression registration to canvas.

* Fixed

* Fixed mutiple call of the function.

* Removed support of a legacy lib for revealImage chart.

* Removed legacy presentation_utils plugin import.

* Doc error fixed.

* Removed useless translations and tried to fix error.

* One more fix.

* Small imports fix.

* Fixed translations.

* Made fixes based on nits.

* Removed useless params.

* fix.

* Fixed errors, related to jest and __mocks__.

* Removed useless type definition.

* Replaced RendererHandlers with IInterpreterRendererHandlers.

* fixed supported_shareable.

* Moved elements back to canvas.

* Moved views to canvas, removed expression service and imported renderer to canvas.

* Fixed translations.

* Types fix.

* Moved libs to presentation utils.

* Fixed one mistake.

* removed dataurl lib.

* Fixed jest files.

* elasticLogo removed.

* Removed elastic_outline.

* removed httpurl.

* Removed missing_asset.

* removed url.

* replaced mostly all tests.

* Fixed types.

* Fixed types and removed function_wrapper.ts

* Fixed types of test helpers.

* Changed limits of presentationUtil plugin.

* Fixed imports.

* One more fix.

* Fixed huge size of bundle.

* Reduced allow limit for presentationUtil

* Updated limits for presentationUtil.

* Fixed public API.

* fixed type errors.

* Moved css to component.

* Fixed spaces at element.

* Changed order of requiredPlugins.

* Updated limits.

* Removed unused plugin.

* Added rule for allowing import from __stories__ directory.

* removed useless comment.

* Changed readme.md

* Fixed docs error.

* A possible of smoke test.

* onResize changed to useResizeObserver.

* Remove useless events and `useEffect` block.

* Changed from passing handlers to separate functions.

* `function` moved to `server`.

* Fixed eslint error.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-07-01 13:30:00 +03:00
Nathan L Smith ca42cf9269
Add @storybook/testing-react (#103004) 2021-06-28 12:34:43 -05:00
Xavier Mouligneau 4fa3dc46cb
[RAC] T-Grid is moving to a new home (#100265)
* wip

* First pass at standalone and embedded redux stores and usage

* wip

* First pass at standalone and embedded redux stores and usage

* wip

* clean up

* wip

* refact(NA): remove extra pkg_npm target and add specific target folders on @kbn/i18n

* cleanup

* - fixes type errors in tests

* WIP remove use_manage_timeline

* wip add query + selector

* finishing integrating timeline manage context from redux

* integrating t-grid in security solution

* fix RowRender type

* WIP begin to move components from package to plugin

* integration of t-grid inside of security solution

* wip to make redux work

* little trick to make  it render

* - fixes a few type errors

* better integration betwen tgrid and security solutions

* bringing back tsconfig on timeline

* wip integration t-grid in observability

* fix types

* fix type in security solutions

* add type to import + trie dto get the bundle size as small as possible

* fix type in integration test

* fix type in integration test

* - fix tests

* clean up to use technical fields

* - fixes unit tests

* - mocks the `useDateFormat` function of the `useKibana` service to fix unit tests

* fix t-grid settings vs create timeline + fix inspect button

* fix last suites test

* Update unit tests, snapshots and lint

* Fix bad merge

* fix plugin export

* Fix some failing tests

* fix unit tets in timelines plugins

* fix latest test

* fix i18n

* free obs from t-grid

* Fix timeline functional plugin types

* fix store provider

* Update failing defaultHeader test

* Fix i18n usage in security solution

* Fix remaining i18n errors in timelines plugin

* Dedupe common shared types

* move drag and drop utils in package to avoid duplication

* More shared type cleanup

* add feature flag

* review I

* fix merge  with master

* fix i18n translation

* More type deduping

* Use @kbn/common-utils, fix remaining types

* fix types

* fix tests

* missing type

* fix cypress tests

Co-authored-by: Kevin Qualters <kevin.qualters@elastic.co>
Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
Co-authored-by: Andrew Goldstein <andrew.goldstein@elastic.co>
2021-06-22 18:56:33 -04:00
Tiago Costa cee33b004c
chore(NA): moving @kbn/ui-shared-deps into bazel (#101669)
* chore(NA): moving @kbn/io-ts-utils into bazel

* chore(NA): moving @kbn/ui-shared-deps into bazel

* chore(NA): compelte working build for @kbn/ui-shared-deps

* chore(NA): solve eslint problems

* chore(NA): solve typechecking

* chore(NA): debugger changes

* chore(NA): update optimizer basic integration tests

* chore(NA): ship kbn/ui-shared-deps metrics.json from new location at shared_built_assets

* chore(NA): use correct ui-shared-deps metrics file location

* chore(NA): remove webpack bazel config

* chore(NA): implement improvements on webpack config

* chore(NA): remove extra comment

* chore(NA): try esbuild-loader minimizer

* Revert "chore(NA): try esbuild-loader minimizer"

This reverts commit bffc49aaae.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-18 16:09:31 +01:00
Steph Milovic 06be699862
[Security Solution] [Cases] Various Cases cleanups (#102103) 2021-06-17 10:52:04 -06:00
Constance 12986fb8fc
[Enterprise Search] Mocks/tests tech debt - avoid hungry mocking (#101107)
* Move enzyme & misc test helpers out of __mocks__/ and into new test_helpers/

They're not technically mocks since nothing is being mocked, so we should move them into a test_helpers folder for specificity & organization

* Move React Router mocks into its own separate folder/import

This was part of the initial feedback, that it was unclear why importing something for Kea in __mocks__/index.ts was mocking react router along for the ride. Separating this out makes things clearer and imports more explicit

+ add some handy new mock useX jest.fn()s helpers, so we're not doing `useParams() as jest.Mock` errywhere

* Move Kea & logic mocks/helpers into kea_logic subfolder
- for organization

NOTE: It can't be a plain kea/ folder because then Jest automatically mocks the `kea` module itself kea 🤦

* Fix type failures

- Caused by switch from any to unknown (changed back to any + added a .test_helper suffix exclusion for any)

* Fix Enterprise Search tests/imports

- I checked all application folders but this one, whoops

* PR feedback: comment copy

* Update tests/files added since PR open with new import locations

* Fix misc react router typing

- null not being type-able as a boolean
- forgot to remove various useParam imports after adding mockUseParams
+ misc unused kea import, probably added while debugging kea mocks
2021-06-08 21:36:06 -07:00
Larry Gregory 907203d68e
Ban use of lodash.template (#100277)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-05-19 10:06:52 -04:00
Tim Roes 349b7e9f8e
Add more strict eslint rules for discover (#99241) 2021-05-05 10:54:15 +02:00
Frank Hassanabad af228f0f20
[Security Solutions] (Phase 1) Adds an application cache called metrics entities and integrates it within Security Solutions behind a feature flag (#96446)
## Summary

Phase 1 of a multi-phase cautious approach for adding an experimental application cache for Kibana solutions called `metric_entities` and integrates it within Security Solutions.

Phase 1 is putting experimental support into the application without breaking existing features. Lots of TODO's, conversations and a possible RFC from phase 1 to phase 2 approach. Some features are missing, but for phase 1 the general idea and code is all there.

To enable this first phase after checking out the branch add this to your `kibana.dev.yml`

```yml
xpack.metricsEntities.enabled: true
xpack.securitySolution.enableExperimental: ['metricsEntitiesEnabled']
```

Then go into Stack Management -> Advanced Settings (Under Security Solutions) and set the enabled to true like so:
<img width="1229" alt="Screen Shot 2021-04-08 at 2 21 02 PM" src="https://user-images.githubusercontent.com/1151048/114091276-b3cbb700-9875-11eb-9083-5c1d91dd20ed.png">

Next go to the security_solutions page and you will see it being activated and you will have these transforms running if you look under stack management:
<img width="1710" alt="Screen Shot 2021-04-29 at 2 00 27 PM" src="https://user-images.githubusercontent.com/1151048/116611174-4a2e4e00-a8f3-11eb-9e15-55cb504dfb2a.png">

On the hosts page, network, page, etc... You can see them being activated when you have no query/filter and you click on request:
<img width="1405" alt="Screen Shot 2021-04-29 at 2 01 28 PM" src="https://user-images.githubusercontent.com/1151048/116611274-6a5e0d00-a8f3-11eb-9998-9f5b3d1c5c63.png">

You will see in the request the index patterns all starting with `estc_xyz*`

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)

We have lots of TODO's but no concrete docs with this just yet.
- [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials

Behind a feature flag and this isn't there yet.
- [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2021-04-30 12:36:06 -06:00
Alejandro Fernández Haro 6ed93c3571
[Telemetry] Remove all usages of any (#98338) 2021-04-27 21:45:19 +02:00
Aleh Zasypkin 808959e316
Handle 401 Unauthorized errors in a more user-friendly way (#94927) 2021-04-27 19:09:54 +02:00
Pierre Gayvallet 251bd9afc6
Remove /src/legacy (#95510)
* starting removing stuff

* fix jest config

* disable CLI mode until other PR is merged

* fix the schema

* add deprecation for maxPayloadBytes

* fix legacy start logic

* deletes `env` from unknown args

* fix FTR test config

* some legacy service deletion

* move config validation

* remove legacy exports from entrypoint

* preserve legacy logging in core logging config

* try to fix uiSettings integration tests

* fix legacy service tests

* more type fix

* use fromRoot from @kbn/utils

* cleanup kibana.d.ts

* fix unit tests

* remove src/core/server/utils

* fix server script

* add integration test for `/{path*}` route

* add unit tests on legacy config

* adapt uiSetting IT bis

* fix tests

* update generated doc

* address some review comments

* move review comments

* fix some stuff

* fix some stuff

* fix some stuff

* fix some stuff bis

* generated doc

* add test for ensureValidConfiguration
2021-04-06 09:25:36 +02:00
Constance 3237fd0637
[Enterprise Search] Fix eslint import rule not ordering sibling mocks with parent mocks (#96070)
* Enterprise Search eslint import order rule fix
- mocks in current folder should be grouped with mocks from parent folders

* Run --fix/update instances of importing ./__mocks__
2021-04-02 09:05:53 -04:00
Pierre Gayvallet 265cc76247
Remove core->cli dependency (#95145)
* extract http_tools to package

* fix readme

* start moving stuff

* cleaning up `isDevCliParent`

* choose bootstrap script

* fix bootstrap script logic

* fix watch paths logic

* import REPO_ROOT from correct package

* create the @kbn/crypto package

* update core's `dev` config

* only export bootstrap function

* extract sslConfig to http-tools package

* fix core types

* fix optimizer tests

* fix cli_dev_mode tests

* fix basePath proxy tests

* update generated doc

* fix unit tests

* create @kbn/dev-cli-mode package

* remove useless comment

* self-review NITS

* update CODEOWNERS file

* add devOnly flag

* use variable for DEV_MODE_PATH

* review comments

* fix logger/log adapter

* fix log calls in base path proxy server

* address some review comments

* rename @kbn/http-tools to @kbn/server-http-tools

* more review comments

* move test to correct file

* add comment on getBootstrapScript

* fix lint

* lint

* add cli-dev-mode to eslint dev packages

* review comments

* update yarn.lock

* Revert "[ci] skip building ts refs when not necessary (#95739)"

This reverts commit e46a74f7
2021-03-30 13:39:32 +02:00
Larry Gregory 31ea160fc7
Move production dependencies out of devDependencies (#93997)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-26 15:23:45 -04:00
Yara Tercero bbee40c819
[Lists][Exceptions] - Adding basic linting, i18n and storybook support (#94772)
### Summary

In preparation for moving all the exceptions UI components into the lists plugin adds some linting, adds the lists plugin to the i18n config and adds storybook support. Tried to add a bit stricter linting than exists in the security solution right now, rules that we've talked about wanting to enable.
2021-03-16 21:46:20 -04:00
Frank Hassanabad 3afaebc49b
[Security Solutions] Remove commented out old linter rules (#94753)
## Summary

Cleanup .. 

* Removes commented out old linter rules from 2+ years ago. The project is very large and a lot of people are in the code base now and the comments are not relevant.
* Removes ts config optimize we don't use anymore
* Removes old script for rules we don't use anymore with elastic searches.
2021-03-16 17:40:09 -04:00
John Schulz a4fa4a62cb
Use consistent-type-imports lint rule to autofix type-only imports (#94464)
## Summary

Use the [`consistent-type-imports` lint rule ](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md) to use `import type ...` where possible

Code-only changes like this were recently added in https://github.com/elastic/kibana/pull/92979, but it was a more manual process.  This PR adds an autofixable lint rule which will keep the changes up-to-date and Just Work ™️
2021-03-15 13:58:50 +01:00
Pierre Gayvallet d0949121c8
Migrate /bootstrap.js endpoint to core (#92784)
* move bootstrap endpoint to core

* some initial cleanup

* hack around the 'try' auth status

* some UT

* more UT

* add try/catch around uISettings access

* add 'auth.isEnabled'

* remove dead files

* use `try` authent mode

* adapt UT

* revert themeTag movearound

* migrate apps route to core

* some cleanup

* nit

* add integration tests

* update generated doc

* add UT for /app route

* add etag IT

* nits

* remove auth.isEnabled API

* add tests on get_apm_config

* use string template instead of handlebars for bootstrap template

* improve plugin bundle tests

* update generated doc

* remove response.etag API

* update generated doc

* update generated doc

* update generated doc again

* extract getThemeTag

* add more unit tests
2021-03-10 10:35:26 +01:00
Patryk Kopyciński ed2a1bfb1f
[Asset Management] Add support for Live queries in Osquery (#89889) 2021-03-09 13:25:47 +01:00
Mike Côté 23ce8dcfdb
Rename alerts plugin to alerting (#92898)
* Rename alerts plugin to alerting

* Deprecate old config values

* Few more renames

* Update plugin list

* Rename xpack.alerts -> xpack.alerting

* Fix some ESLint rules

* Fix typecheck

* Fix some test failures

* Some more renames

* Fix ESLint

* Fix some test failures

* Fix failing jest test

* Undo exclusive test

* Fix APM deps

* Fix docs

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-05 13:59:34 -05:00
Joe Portner 171567d70a
ESLint rules for Spaces and Security (#93644) 2021-03-04 18:47:39 -05:00
Anton Dosov fe1ae92957
Fix wrong import in data plugin causing 100kB bundle increase (#93448) 2021-03-04 05:42:36 -05:00
John Schulz b5522ed30c
[Fleet] Add lint rule/fix for import order groups (#93300)
## Problem
Blocks of 10-15 `import`s are common in the plugin and there a few places which have ~50 lines of `import`s. It makes it more difficult to understand the where/why of what's being imported.

We've had instances while files import from the same module in different lines. i.e.

```ts
import { a } from './file';
... 5-10 lines later
import { b } from './file';
```

## Proposed solution
Add a lint rule to enforce a convention on the module `import` order. This can help in the same way Prettier & ESLint help to format type signatures or other code. It makes it easier to understand or notice any changes in the code. It's also able to be fixed automatically (`node scripts/eslint.js --fix` or any existing "format on save" in an editor).

## This PR
replaces #92980 (based on https://github.com/elastic/kibana/pull/92980#pullrequestreview-601070556)

### Lint rule
f9be98d Add eslint rule to enforce/autofix import group order. Use the same rule as a few other plugins. Groups `import` statements by type as shown in the [lint rule docs](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md#importorder-enforce-a-convention-in-module-import-order
). The order is:

  1. node "builtin" modules
  2. "external" modules
  3. "internal" modules
  4. modules from a "parent" directory
  5. "sibling" modules from the same or a sibling's directory, "index" of the current directory, everything else

e.g.

```typescript
import fs from 'fs';
import path from 'path';

import _ from 'lodash';
import chalk from 'chalk';

import foo from 'src/foo';

import foo from '../foo';
import qux from '../../foo/qux';

import bar from './bar';
import baz from './bar/baz';
import main from './';
```
The [lint rule](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md#importorder-enforce-a-convention-in-module-import-order) is relatively light handed. It only ensures  the `imports` are groups together in the given order. It doesn't alphabetize or otherwise sort the order of the files.


e.g. imports aren't rewritten to be in alphabetical order. This is fine

```ts
import from './c';
import from './a';
import from './b';
```

The [docs show other options](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md#options) and 2831f02bc7/.eslintrc.js (L1138-L1168) uses many of them

### Newlines option
The newlines settings means a change from something like

```typescript
import fs from 'fs';
import path from 'path';
import _ from 'lodash';
import chalk from 'chalk';
import foo from 'src/foo';
import foo from '../foo';
import qux from '../../foo/qux';
import bar from './bar';
import baz from './bar/baz';
import main from './';
```

to 

```typescript
import fs from 'fs';
import path from 'path';

import _ from 'lodash';
import chalk from 'chalk';

import foo from 'src/foo';

import foo from '../foo';
import qux from '../../foo/qux';

import bar from './bar';
import baz from './bar/baz';
import main from './';
```



Added it as a separate commit 2831f02 in case we want to avoid it, but I believe it's an improvement overall. Especially on the files with 25+ lines of imports. Even the "worst case" of something like this isn't bad (IMO). Especially since it's an automatic reformat like anything else in prettier


```typescript
import fs from 'fs';

import _ from 'lodash';

import foo from '../foo';

import main from './';
```
2021-03-03 13:58:20 -05:00
Alejandro Fernández Haro c0535abc06
[chore] Enable core's eslint rule: @ts-expect-error (#93086)
* [chore] Enable core's eslint rules

* Change comment from platform-team to core-team
2021-03-02 05:53:36 -05:00
Constance f3399620cf
[Enterprise Search] Add eslint import/order rules (#90530)
* Add import rules

- newlines between each group
- mocks in test files before everything else
- React before all other externals

* Run --fix on public/applications/workplace_search

* Manually fix errors still present in WS public files

- these appear to be mostly due to jest.mock() or const mixed in with imports, which confuses the autofixer

* Run --fix on public/applications/app_search

+ some manual fixes/tweaks along the way

* Run --fix on public/applications/shared

- some opinionated changes, particularly around IFlashMessages and grouping together types coming from Kibana (src->../../src)

* Run --fix on public/applications/enterprise_search

- mostly straightforward

* Run --fix on public/applications/__mocks__

* Fix remaining top-level public files

- Some opinionated changes (src/core -> ../../src/core) to keep types/mocks together

* Run --fix on server/ files

- same opinionated src->../src changes to keep deps grouped together

- opinionated require->import fetch change in enterprise_esarch_config_api.test.ts

- opinionated [] inclusion of builtins & external imports together (mostly for enterprise_search_request_handler.ts)
2021-02-09 09:33:39 -08:00
Constance 0c0a74b364
[Enterprise Search] eslint rule override: catch unnecessary backticks (#90347)
* Add eslint rule for linting unnecessary backticks

This needs to be below the Prettier overrides at the bottom of the file to override Prettier

* Run --fix

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-05 10:38:37 -08:00
Constance 3166ff3761
[Enterprise Search] eslint rule update: react/jsx-boolean-value (#90345)
* [Setup] Split rule that explicitly allows `any` in test/mock files into its own section

- so that the rules we're about to add apply correctly to all files

* Add react/jsx-boolean-value rule

* Run --fix

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-05 09:01:01 -08:00
Brandon Kobel 4584a8b570
Elastic License 2.0 (#90099)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:12:39 -08:00
Patryk Kopyciński d7028e1a5f
[Security Solution] Init Osquery plugin (#87109) 2021-01-28 08:24:55 +01:00
Brandon Kobel 170a2956c8
Updating the License (#88343)
* Updating the Licenses, except for applying eslint, building

* Applying ESLint rules,building @kbn/pm, regenerating api docs
2021-01-19 17:52:56 -08:00
Tiago Costa 9139ab15fd
chore(NA): remove mocha junit ci integrations (#88129)
* chore(NA): remove mocha junit ci integrations

* chore(NA): remove mocha script from xpack

* chore(NA): single rule exclusion on eslint config for mocha

* chore(NA): remove unused custom mocha integration code from kbn/test

* chore(NA): rewording packages readme

* docs(NA): remoe mocha mention from development-unit-tests
2021-01-15 21:17:25 +00:00
Tyler Smalley a34cd20498
[@kbn/ui-framework] Removes all but dist files (#85347)
This package has long since been deprecated and no longer maintained.
The only reason it still exists is that not all plugins have migrated
away from using the kui classes to EUI. This removes all src and build
files as a step forward.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-12-10 08:23:33 -08:00
Mikhail Shustov 4917df30b9
Update typescript eslint to v4.8 (#83520)
* update deps

* update rules

use type-aware @typescript-eslint/no-shadow instead of no-shadow. do not use no-undef, rely on TypeScript instead

* fix or mute all lint errors

* react-hooks eslint plugin fails on ? syntax

* fix wrong typings in viz

* remove React as a global type

* fix eslint errors

* update version to 4.8.1

* fix a new error
2020-11-18 18:23:08 +01:00
Gidi Meir Morris ab72206da3
[Alerting] Moves the Index & Geo Threshold UIs into the Stack Alerts Public Plugin (#82951)
This PR includes the following refactors:
1. Moves the Index Pattern Api from _Stack Alerts_ to the _Server_ plugin of _Trigger Actions UI_. This fixes a potential bug where a user could disable the _Stack Alerts_ plugin and inadvertently break the UI of the _ES Index _ action type.
2. Extracts the UI components for _Index Threshold_ and _Geo Threshold_ from the _Trigger Actions UI_ plugin and moves them into _Stack Alerts_.
2020-11-12 16:39:40 +00:00
Alexey Antonov b2d6b66fe5
[bundle optimization] fix imports of react-use lib (#82847)
* [bundle optimization] fix imports of react-use lib

* add 2 more files

* add rule into eslintrc.js

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-10 17:15:26 +03:00
Tiago Costa 0eeaafa722
chore(NA): move into single pkg json (#80015)
* chore(NA): update gitignore to include first changes from moving into a single package.json

* chore(NA): update gitignore

* chore(NA): move all the dependencies into the single package.json and apply changes to bootstrap

* chore(NA): fix types problems after the single package json

* chore(NA): include code to find the dependencies used across the code

* chore(NA): introduce pure lockfile for install dependencies on build

* chore(NA): update clean task to not delete anything from xpack node_modules

* chore(NA): update gitignore to remove development temporary rules

* chore(NA): update notice file

* chore(NA): update jest snapshots

* chore(NA): fix whitelisted licenses to include a new specify form of an already included one

* chore(NA): remove check lockfile symlinks from child projects

* chore(NA): fix eslint and add missing declared deps on single pkg json

* chore(NA): correctly update notice

* chore(NA): fix failing jest test for storyshots.test.tsx

* chore(NA): fix cypress multi reporter path

* chore(NA): fix Project tests check

* chore(NA): fix problem with logic to detect used dependes on oss build

* chore(NA): include correct x-pack plugins dep discovery

* chore(NA): discover entries under dynamic requires on vis_type_timelion

* chore(NA): remove canvas

* test(NA): fix jest unit tests

* chore(NA): remove double react declaration from storyshot test file

* chore(NA): try removing isOSS check

* chore(NA): support for plugin development

* chore(NA): update logic to fix unit tests and typechecking

* chore(NA): support to run npm scripts in child kbn projects across all envs

* chore(NA): support github checks reporter on x-pack and remove cpy types as the package correctly provides them

* chore(NA): update cpy version

* chore(NA): include last kbn pm changes

* chore(NA): update style on build_production_projects.ts

* chore(NA): remove any cast fom telemetry opt in stats

* chore(NA): remove del and re-use rm -rf again

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-02 21:18:52 +00:00
Uladzislau Lasitsa ba8e9a52b6
Timelion y-axis label not displayed (#80007)
* Moved flot in ui-shared-deps and leavt only one version.

* Removed unneeded import

* use commonJS so we can execute code between loading specific modules

* prefix i18n keys with flot.

* Fix Internationalization

* remove duplicate pie plugin

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-14 16:58:35 +03:00
Gidi Meir Morris 25c5daa83a
Renames "Built-In Alerts" feature to "Stack Alerts" and "Actions" feature to "Actions and Connectors" (#79513)
Renames "Built-In Alerts" feature to "Stack Alerts" and "Actions" feature to "Actions and Connectors" as we've decided these names make more appropriate and better communicate what these features are.
2020-10-06 17:51:05 +01:00
Nathan L Smith 564a7b1a17
Storybook 6 and config changes (#75357)
Upgrade to Storybook 6 and attempt to use the declarative configuration.

The goals of this PR (as part of Kibana's Storybook roadmap, are:

Upgrade to Storybook 6
Still allow running Storybooks with yarn storybook plugin_name
Use the declarative configuration to (hopefully) make the configuration simpler to use an easier to understand, as well as avoiding deprecation warnings and loss of future compatibility
The ways in which what I have so far differs from how we do things today are:

In the alias configuration it takes a path to a storybook configuration directory instead of the storybook.js file from before
Each plugin (it doesn't have to be a plugin; can be any directory) has a .storybook/main.js (the aliases file in @kbn/storybook specifies these locations) where they can define their Storybook configuration. You can require('@kbn/storybook').defaultConfig to get defaults and override them
@kbn/storybook has a preset that can provide Webpack and Babel configuration and Storybook parameters and decorators
Instead of dynamically creating the list of stories to import, we define them in the globs of the stories property in .storybook/main.js.
Do not build a DLL. We are using @kbn/ui-shared-deps as externals. Startup time is not quite as fast but still acceptable.
Other things done in this PR:

Allow default exports in .stories. to allow for Common Story Format CSF stories
Add guard in Webpack configuration needed for overriding CSS rules
Update filename casing check to allow for files with required names in Storybook
Clean up observability stories
Rename *.examples.tsx and *.story.tsx to *.stories.tsx
2020-09-29 19:34:05 -05:00
Brittany Joiner 63ce752dc2
Adding comment about importing lodash library (#78156)
* added comment about importing lodash library

* fixed space with prefer

* cleaned up extra space and removed comments for lodash/fp

* took out the comment in server files

* Remove newlines

Co-authored-by: Nathan L Smith <smith@nlsmith.com>
2020-09-24 11:38:11 -05:00
Pierre Gayvallet 0d09cea436
Remove legacy plugins support (#77599)
* remove ALL the things.

* adapt some types and tests

* restore ensureValidConfiguration

* fix legacy service tests

* adapt uiRender mixin

* remove legacy types

* update generated doc

* restore legacy plugin schema

* update generated doc

* remove remaining code of x-pack/legacy

* adapt imports due to merge

* cleanup CODEOWNERS

* cleanup gitignore & i18nrc

* cleanup tsconfig.json

* remove unused i18n keys

* add back `"legacy/plugins/**/*",` to tsconfig until legacy space plugin is deleted

* fix create_jest_config

* remove references from eslintrc

* more eslint cleanup

* remove `x-pack/index.js`

* fix xpack gulp scripts

* fix bug with default + named imports from boom

* remove rules from eslintrc

* remove LegacyInternals

* review comments

* update generated doc

* cleanup legacy metadatas

* revert changes to eslintrc

* update generated doc
2020-09-23 09:52:51 +02:00
Mikhail Shustov cd86b81b82
Move streams utils to the core (#76397)
* move utils/streams to the KP

* allow imports from src/core/server/utils

* ts-ify

* import streams from KP

* remove unnecessary ts-expect-error

* fix kbn-es-archiver build

* lost export

* copy array in createListStream

* remove streams from legacy utils

Co-authored-by: spalger <spalger@users.noreply.github.com>
2020-09-03 10:57:03 +02:00
CJ Cenizal e13d8dcfb7
Fix es_ui_shared eslint violations for useRequest hook (#72947)
* Reconcile request helpers with eslint rules for React hooks.
  - Add clearer cleanup logic for unmounted components.
  - Align logic and comments in np_ready_request.ts and original request.ts.
* Reorganize modules and convert tests to TS.
  - Split request.ts into send_request.ts and use_request.ts.
  - Convert test files into TS.
  - Relax SendRequestResponse type definition to type error as any instead of expecting an Error, since we weren't actually fulfilling this expectation.
* Convert everything to hooks and add test coverage for request behavior.
* Fix Watcher memoization bugs.
2020-08-31 12:55:39 -07:00
Cauê Marcondes 712c4bdde7
[APM] Prevent imports of public in server code (#75979)
* renaming test file

* removing eslint rule

* restructuring observability types

* refactoring fetchOptions type
2020-08-28 12:43:49 +02:00
Spencer 9cafade2b9
[remove] production deps which are only used in public code (#75838)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2020-08-25 08:27:15 -07:00