* Revert "Revert "Using re2 for Timelion regular expressions (#55208)""
This reverts commit c90293d03f.
* Updating re2 to 1.14.0. Still need to update build patching
* Extract the gzip to the destination, supporting multiple extract methods
* Adding 'node' to jest's moduleFileExtensions
'node' is in the defaults, not sure why we aren't using the defaults...
https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* First iteration of xjson in monaco
* Throwaway implementation in painless lab - THIS MUST BE REVERTED
* WiP on build process for new kbn-lang package
* new @kbn/langs package and update ui-shared-deps
* Update jest config for new work files
* Update painless lab -- REVERT THIS COMMIT
* Create shared useXJson mode hook
* Final update to using the new shared useXJsonMode hook -- REVERT
* Created @kbn/monaco and share through shared deps
* always access monaco through `@kbn/monaco`
* use path.resolve to create path
* add basic readme
* remove console.log call
* remove typescript support from ui-shared-deps webpack config
* use `@kbn/babel-preset`
* include the monaco styles in the kbn-ui-shared-deps
* sort package.json
* build worker at bootstrap rather than commiting to repo
* only build worker, don't pre-bundle monaco
* fix type check errors
* remove section from readme about committed dist
* keep editor.worker.js postfix
* forgot to save update to import
* license package as apache-2.0
* Added regenerator runtime for worker bundle
* revert changes to painless lab
Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Update the x-pack `createJestConfig` function to take the `rootDir` as an argument, which allows for easier overriding of the Jest configuration for a specific directory.
Previously we would run Jest in development from the x-pack directory by running something like:
```
node scripts/jest.js --testPathPattern=plugins/apm --watch
```
Currently (for me anyway) this is failing with:
```
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
```
and it would sometimes not correctly test only the changed files when a change in APM was made. It was also difficult to configure correctly with the [VSCode Jest extension](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest).
Add a jest.config.js for APM. This makes running with `--watch` better about which files it chooses to re-run and makes the VSCode extension work (including coverage mapping) with minimal configuration.
* set files to track for coverage collection
* increase timeout to 4h
* trying to add detectOpenHandles to avoid worker stuck
* update config
* make config paths more common
* update configs
* update jest oss config
* exclude 'tests' folder for coverage
* Move XJson to x-pack/es_ui_shared
Also convert files to TS and clean up use of @ts-ignore
* Move console_lang to public
* Proper use of mocks
* Globally mock out .ace.worker.js modules
Having worker code exported in `public` of es_ui_shared poisoned
a lot of Jest tests with the need to mock out the ace worker.
Instead of adding mocks everywhere we handle the importing in
Jest by adding an entry to module mapper.
* Remove manual imports of mocks
* Delete es_ui_shared/public/mocks for now
* Put useXJson code in single place
* Import and instantiate xJsonMode
* Remove language mocks imports
Besides the fact that these paths are wrong these are no longer
needed because we mock at use Jest module mapper
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* 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>
* Initial role mappings UI
* apply design edits
* address PR feedback
* fix type cast for number field
* Update x-pack/legacy/plugins/security/public/views/management/role_mappings/edit_role_mapping/components/mapping_info_panel/mapping_info_panel.tsx
Co-Authored-By: Joe Portner <5295965+jportner@users.noreply.github.com>
* Cleanup FTR configuration, and handle role mapping 404 errors properly
* align naming of role mappings feature check
* Apply suggestions from code review
Co-Authored-By: Brandon Kobel <brandon.kobel@gmail.com>
* add missing test assertions
* inlining feature check logic
* switch to using snapshot
* use href instead of onClick
* adding delete unit test
* consolidate href building
* unify page load error handling
* simplify initial loading state
* documenting unconditional catch blocks
* use nodes.info instead of transport.request
* Apply suggestions from code review
Co-Authored-By: Brandon Kobel <brandon.kobel@gmail.com>
* move model out of LP into NP
* convert except_field_rule to except_any_rule
* docs, take 1
* update gif
Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>
Co-authored-by: Brandon Kobel <brandon.kobel@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* 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
* add reactMount util to kibana_react
(kibana-react) properly export reactMount
* add MountPoint types and utility
* adapt toast API to no longer accept react elements
(toast API) properly export new Toast type
* adapt calls by using reactMount
createNotifications: do not wrap if text
* update generated doc
* add custom snapshot serializer for reactMount
* fix unit tests
fix xpack unit tests
* adapt non-ts calls
* do not add __reactMount__ property in production
* remove string check on createNotifications
* fix typo and small fix using obj spread
* improve react mount snapshot serializer
* simplify convertToEui
* rename reactMount to toMountPoint
* adapt newly added calls
* move mount types to proper file
* use new Mount types for OverlayBanner apis
* fixing typo
* adapt new calls
* use destructured imports
* 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
* [APM] Adds chart for page load averages by country in RUM page-load view
* [APM] Simplified and refined ChoroplethMap. Added legend labels.
* - Replaced Map legend slices with smooth gradient
- fixed issue with map rendering multiple times
- renamed initial props to start with 'initial'
- added some more code comments
* use correct i18n ids
* - base color progression calc directly on euiColorPrimary
- check that a layer exists before querying features
* Addressed code review feedback
* - fixes issue where min/max was not a finite value
- cleans up mouseover handler, which updates on state changes
- formats doc count for display
- style improvements
* addressed PR feedback & updated renovate.json5
* - Removed the Legend from the ChoroplethMap
- Only render tooltip when there's data
* - fix hover state not clearing properly
- add better typing around Geojson propertier for world countries
* added missing css import
* First version of Editor component and integration with the expression editor
* Adding resize detector
* Remove blue border on editor select
* Adding types for the react resize detector
* Adding worker and a few more monaco plugins
* Suggestion completion rework
* Add resize detector types as well as an IE11 full width bug fix
* Adding correct types for function definitions and monaco
* change CSS class names, add border to input
* Adding boolean styling
* Slight refactor of canvas function/arg types and adding first pass of hover
* Fixing hover interaction for functions and arguments
* Namespacing Code monaco css overrides
* Styling cleanup and simple README
* Setting up tests including some storyshots for the ExpressionInput component and Editor component
* Prop documentation for both the ExpressionInput and Editor components
* Adding Editor snapshots
* tiny cleanup
* Moving language registration, adding autocomplete suggestion types, and cleaning up editor
* Some documentation and cleanup from PR feedback
* Fixing types, adding documentation
* clean up editor, remove autocomplete toggle
* More PR cleanup
* Test fix, type fix
* fix issues around errors. code cleanup
* Move SavedObjectClient files to core/public
* Initial SavedObjectsService in public Core
* Public SavedObjectsClient tests
* Import SimpleSavedObject from src/core/public
* Use types from source files for kibana.d.ts
* Add html raw loader to x-pack/jest
* Cleanup
* Drop case utilities and improve test coverage
* Update types and documentation
* Fix build breaking when importing directly from /server in /public
* Ensure that all option paramaters are picked and renamed
* Fix option mapping and introduce stronger types
* Eslint: allow imports from src/core/*/types
* Add compatibility layer for kfetch vs http.fetch error responses
* Improve documentation
* Expose SavedObjectsMigrationLogger
* Documentation and type tweaks
* Revert type changes from 73e601f and update api docs
* Refactor request into savedObjectFetch + test
* Make legacy SavedObject compatible with http.fetch exceptions
* Fix types and tests
* simple_saved_object import from src/core/server
* server imports from root instead of server/types
* Make SavedObjectsService a class
* Don't pick unkown keys from server response
* Rename SavedObjectsFindResponse to SavedObjectsFindResponsePublic
* Remove err.response from SavedObjects fetch errors
* Revert "Remove err.response from SavedObjects fetch errors"
This reverts commit 61705ca361.
* Don't introduce err.response until we deprecate err.res
* Upgraded EUI 13.0.0 -> 13.1.0
* Bump to 13.1.1
* Reset MutationObserver polyfill to original operation
* Reset x-pack's MutationObserver polyfill to original operation
* Always mock metadata/chrome in OSS
* Enable jest env in jest mocks
* Exclude jest mocks in karma bundles
* Use setupFilesAfterEnv in config
* Remove chrome/metadata mock from x-pack
* Remove kuery mock
* Add missing mock to SIEM test
* Fix typo in mock import
* Remove top level capabilities x-pack mock
* Move kfetch mock to ui/public
* Move moment-timezone to mocks file
* Unmock kfetch in kfetch specific tests
* Make kfetch mock manual
* Removed unnecessary jest.mock
* Remove kfetch unmocks
using relative imports from x-pack to kibana core doesn't work atm.
although we cannot use absolute imports, because jest cannot match
them internally.
* chore(NA): first changes on every package.json order to support new babel 7. chore(NA): build for kbn-pm with babel 7.
* chore(NA): patch babel register to load typescrit
* chore(NA): first working version with babel 7 replacing typescript compiler.
* fix(NA): common preset declaration in order to make it work with babel-loader.
* chore(na): organizing babel preset env package json.
* chore(NA): mocha tests enabled.
* fix(NA): typo on importing
* test(NA): majority of x-pack tests ported to use babel-jest
* fix(NA): report info button test with babel-jest.
* fix(NA): polling service tests.
* test(na): fix server plugins plugin tests.
* test(NA): batch of test fixs for jest tests under babel-jest hoisting.
* chore(NA): add babel plugin to hoist mock prefixed vars on jest tests.
* chore(NA): update yarn.lock file.
* chore(NA): tests passing.
* chore(NA): remove wrong dep
* chore(NA): fix tsconfig
* chore(NA): skip babel for ts-jest.
* chore(NA): selectively apply the plugin to strip off namespace from ts files.
* chore(NA): remove not needed changes from ts tests
* chore(NA): removed ts-jest dependency. chore(NA): migrate ts tests on x-pack to use babel-jest with the new pattern.
* chore(NA): migrate kibana default distribution typescript tests to run with babel-jest and the new test mock pattern.
* chore(NA): merge and solve conflicts with master.
* chore(NA): fix problems reported by eslint
* chore(NA): fix license ovveride for babel-plugin-mock-imports
* chore(NA): update jest integration tests for kbn pm
* chore(NA): update babel jest integration tests for kbn pm.
* test(NA): update jest integration snapshot for kbn pm.
* chore(NA): apply changes according to the pull request reviews.
* chore(NA): apply changes according to the pull request reviews.
* refact(NA): migrate jest tests to the new pattern.
* fix(NA): babel 7 polyfill in the tests bundle.
* chore(NA): restore needed step in order to compile x-pack with typescript.
* chore(NA): change build to compile typescript with babel for the oss code. chore(NA): change transpile typescript task to only transpile types for x-pack. refact(NA): common preset for babel 7
* Revert "chore(NA): change build to compile typescript with babel for the oss code. chore(NA): change transpile typescript task to only transpile types for x-pack. refact(NA): common preset for babel 7"
This reverts commit 2707d538f5.
* fix(NA): import paths for tabConfigConst
* chore(NA): fix transpiling error on browser tests
* chore(NA): simplify kbn babel preset package.
* chore(NA): migrate build to use babel transpiler for typescript excluding xpack.
* fix(NA): introduced error on test quick task.
* fix(NA): fix preset for client side code on build.
* fix(NA): build with babel
* fix(NA): negated patterns in the end.
* fix(NA): kbn_tp_sample_panel_action creation.
* fix(NA): babel typescript transform plugin workaround when exporting interface name.
* refact(NA): remove not needed type cast to any on jest test.
* docs(NA): add developement documentation about jest mocks test pattern.
* chore(NA): missing unmerged path.
* chore(NA): fix jest tests for template.
* [CCR] Client integration tests (table lists) (#33525)
* Force user to re-authenticate if token refresh fails with `400` status code. (#33774)
* Improve performance of the Logstash Pipeline Viewer (#33793)
Resolves#27513.
_This PR is a combination of #31293 (the code changes) + #33570 (test updates). These two PRs were individually reviewed and merged into a feature branch. This combo PR here simply sets up the merge from the feature branch to `master`._
Summary of changes, taken from #31293:
## Before this PR
The Logstash Pipeline Viewer UI would make a single Kibana API call to fetch all the information necessary to render the Logstash pipeline. This included information necessary to render the detail drawer that opens up when a user clicks on an individual vertex in the pipeline.
Naturally, this single API call fetched _a lot_ of data, not just from the Kibana server but also, in turn, from Elasticsearch as well. The "pro" of this approach was that the user would see instantaneous results if they clicked on a vertex in a pipeline and opened the detail drawer for that vertex. The "cons" were the amount of computation Elasticsearch had to perform and the amount of data being transferred over the wire between Elasticsearch and the Kibana server as well as between the Kibana server and the browser.
## With this PR
This PR makes the Kibana API call to fetch data necessary for **initially** rendering the pipeline — that is, with the detail drawer closed — much lighter. When the user clicks on a vertex in a pipeline, a second API call is then made to fetch data necessary for the detail drawer.
## Gains, by the numbers
Based on a simple, 1-input, 1-filter, and 1-output pipeline.
* Before this PR, the Elasticsearch `logstash_stats` API responses (multiple calls were made using the `composite` aggregation over the `date_histogram` aggregation) generated a total of 1228 aggregation buckets (before any `filter_path`s were applied but across all `composite` "pages"). With this PR, the single `logstash_stats` API response (note that this is just for the initial rendering of the pipeline, with the detail drawer closed) generated 12 buckets (also before any `filter_path`s were applied). That's a **99.02% reduction** in number of buckets.
* Before this PR, the Elasticsearch `logstash_stats` API responses added up to 70319 bytes. With this PR, the single `logstash_stats` API response for the same pipeline is 746 bytes. That's a **98.93% reduction** in size.
* Before this PR, the Elasticsearch `logstash_state` API response was 7718 bytes. With this PR, the API response for the same pipeline is 2328 bytes. That's a **69.83% reduction** in size.
* Before this PR the Kibana API response was 51777 bytes. With this PR, the API response for the same pipeline is 2567 bytes (again, note that this is just for the initial rendering of the pipeline, with the detail drawer closed). That's a **95.04% reduction** in size.
* [Maps] split settings into layer and source panels (#33788)
* [Maps] split settings into layer and source panels
* fix SCSS import
* [env] exit if starting as root (#21563)
* [env] exit if starting as root
* fix windows
* s/--allow-root
* Typescript sample panel action (#33602)
* Typescript sample panel action
* Update EUI version to match main cabana version
* update yarn.lock
* add back typings include
* use correct relative path
* Home page "recent links" should communicate saved object type #21896 (#33694)
* adds object type for screen order
* adds object type for pointer hovering
* Update src/legacy/ui/public/chrome/directives/header_global_nav/components/header.tsx
Co-Authored-By: rockfield <philipp.b@ya.ru>