* Replace EuiCodeBlock with JsonCodeEditor in DiscoverGrid
* Add optional "hasLineNumbers" property to JsonCodeEditor and removed line numbers from the popover
* Update json_code_editor snapshot
* Add functional test for cell expanded content popover
* Remove unused code
* Fix geo point case and refactor some code
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- To make use of the docsLinks service which is only usable in client side code, Anomaly Detection's validation messages are not fully returned from the server anymore. Instead just the message ID and necessary metadata to parse the message template gets returned.
- getMessages() no longer uses inline hard coded documentation links but picks links from the docsLinks service.
- The code that rendered the messages originally on the server has been move to a function parseMessages() which can now be used on the client side and accepts the docsLinks services to get URLs to documentation from it.
- This means we no longer need to get the current version/branch information for the server side code.
- Tests have been updated to reflect the changes: API integration tests only check for the now reduced messages containing only message IDs and metadata. The expected results of the API integration tests are used as mocks for the client side function parseMessages(), this allows use to cover the same code and messages as previously.
### 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.
## Problem
While working on changes for bulk reassign https://github.com/elastic/kibana/issues/90437, I found that the server has a runtime error and returns a 500 if given an invalid or missing id.
<details><summary>server error stack trace</summary>
```
│ proc [kibana] server log [12:21:48.953] [error][fleet][plugins] TypeError: Cannot read property 'policy_revision_idx' of undefined
│ proc [kibana] at map (/Users/jfsiii/work/kibana/x-pack/plugins/fleet/server/services/agents/helpers.ts:15:34)
│ proc [kibana] at Array.map (<anonymous>)
│ proc [kibana] at getAgents (/Users/jfsiii/work/kibana/x-pack/plugins/fleet/server/services/agents/crud.ts:191:32)
│ proc [kibana] at runMicrotasks (<anonymous>)
│ proc [kibana] at processTicksAndRejections (internal/process/task_queues.js:93:5)
│ proc [kibana] at Object.reassignAgents (/Users/jfsiii/work/kibana/x-pack/plugins/fleet/server/services/agents/reassign.ts:91:9)
│ proc [kibana] at postBulkAgentsReassignHandler (/Users/jfsiii/work/kibana/x-pack/plugins/fleet/server/routes/agent/handlers.ts:314:21)
│ proc [kibana] at Router.handle (/Users/jfsiii/work/kibana/src/core/server/http/router/router.ts:272:30)
│ proc [kibana] at handler (/Users/jfsiii/work/kibana/src/core/server/http/router/router.ts:227:11)
│ proc [kibana] at exports.Manager.execute (/Users/jfsiii/work/kibana/node_modules/@hapi/hapi/lib/toolkit.js:60:28)
│ proc [kibana] at Object.internals.handler (/Users/jfsiii/work/kibana/node_modules/@hapi/hapi/lib/handler.js:46:20)
│ proc [kibana] at exports.execute (/Users/jfsiii/work/kibana/node_modules/@hapi/hapi/lib/handler.js:31:20)
│ proc [kibana] at Request._lifecycle (/Users/jfsiii/work/kibana/node_modules/@hapi/hapi/lib/request.js:370:32)
│ proc [kibana] at Request._execute (/Users/jfsiii/work/kibana/node_modules/@hapi/hapi/lib/request.js:279:9)
```
</details>
<details><summary>see test added in this PR fail on master</summary>
```
1) Fleet Endpoints
reassign agent(s)
bulk reassign agents
should allow to reassign multiple agents by id -- some invalid:
Error: expected 200 "OK", got 500 "Internal Server Error"
```
</details>
## Root cause
Debugging runtime error in `searchHitToAgent` found some TS type mismatches for the ES values being returned. Perhaps from one or more of the recent changes to ES client & Fleet Server. Based on `test:jest` and `test:ftr`, it appears the possible types are `GetResponse` or `SearchResponse`, instead of only an `ESSearchHit`.
https://github.com/elastic/kibana/pull/94632/files#diff-254d0f427979efc3b442f78762302eb28fb9c8857df68ea04f8d411e052f939cL11
While a `.search` result will include return matched values, a `.get` or `.mget` will return a row for each input and a `found: boolean`. e.g. `{ _id: "does-not-exist", found: false }`. The error occurs when [`searchHitToAgent`](1702cf98f0/x-pack/plugins/fleet/server/services/agents/helpers.ts (L11)) is run on a get miss instead of a search hit.
## PR Changes
* Added a test to ensure it doesn't fail if invalid or missing IDs are given
* Moved the `bulk_reassign` tests to their own test section
* Filter out any missing results before calling `searchHitToAgent`, to match current behavior
* Consolidate repeated arguments into and code for getting agents into single [function](https://github.com/elastic/kibana/pull/94632/files#diff-f7377ed9ad56eaa8ea188b64e957e771ccc7a7652fd1eaf44251c25b930f8448R70-R87): and [TS type](https://github.com/elastic/kibana/pull/94632/files#diff-f7377ed9ad56eaa8ea188b64e957e771ccc7a7652fd1eaf44251c25b930f8448R61-R68)
* Rename some agent service functions to be more explicit (IMO) but behavior maintained. Same API names exported.
This moves toward the "one result (success or error) per given id" approach for https://github.com/elastic/kibana/issues/90437
### Checklist
- [x] [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
## 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.
* Add engines mock and fix mock role mapping
The original asRoleMapping was merely for a smoke test in the shared component. Refactored to work better in App Search component
* Add RoleMappingsLogic
* Fix test description
Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
* Fix test description
Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
* Add flash messages when creating, updating or deleting
* Add path and resetState calls
Refactoring the tests showed me that some parts of the state weren’t being reset.
* Refactor handleAuthProviderChange logic
I some how got the test coverage at 100% with my wrong way of doing tests before (scary). When I fixed it I noticed that noting I could do would trigger the fallback of just returning the `[ANY_AUTH_PROVIDER]` array. After talking with Constance, we could not come up with a way to trigger it either, given the conditions.
She had suggested removing the first return statement but that caused an empty array being returned sometimes.
Ultimately, I was able to get it working and covered with these changes.
* Refactor tests per PR feedback
The places where `role: 'superuser’` was deleted in the listeners was a side effect of using `setRoleMappingData` and not `mount`
* Add back deleted assertion
* Copy nit
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
* [Connectors UI] Make UI use new connector APIs
* fixed tests
* fixed due to comment
* fixed due to comment
* fixed test
* fixed test
* fixed test
* moved rewrite_request_case to the common folder
* fixed due to comments
* [Reporting-CSV Export] Re-write CSV Export using SearchSource
* replace PIT solution with scan-and-scroll
* update tests
* cleanup
* simplify pr
* update docs
* update docs
* update telemetry schema
* use getSearchRequestBody instead of flatten
* Revert "update docs"
This reverts commit ab9f4d9642.
* optimize some async calls
* cleanup
* --wip-- [skip ci]
* fix telemetry schema
* fix telemetry tests
* fix snapshot
* api docs
* api doc updates
* use import type
* format the data through chains of maps
* add another saved search to reporting/ecommerce_kibana
* add a failing test
* add error logging to query failures
* put clear scroll in a finally so the ES error can be captured
* log dat error
* set dat fieldsFromSource
* --wip-- [skip ci]
* Revert "add another saved search to reporting/ecommerce_kibana"
This reverts commit 6edf26eff2.
* functional test fixes
* clean up ecommerce test archive
* add test for new search with fieldsFromSource set
* add tests and refactor tests
* cleanup redundant conditionals
* add GenerateCsv.getFields
* fix some tests
* fix double-escaping
* fix test snapshots and refactoring
* fix other tests
* fix test
* fix default index pattern in functional tests
* fix ts and sort fields when they come from API response
* --wip-- [skip ci]
* fix formatting and increase maxSizeBytes for testing
* remove client-side logic for sanitizing fields
* do not prepend timefield name if it already is a column
* test the logic to prepend timeField
* test the logic to sort the fields
* fix functional test
* preserve the error from data.search
* add functional test for ES returning an error
* fix snapshot
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* XY Axis, integrate legend color picker with the eui palette
* Fix functional test to work with the eui palette
* Order eui colors by group
* Add unit test for use color picker
* Add useMemo to getColorPicker
* Remove the grey background from the first focused circle
* Fix bug caused by comparing lowercase with uppercase characters
* Fix bug on complimentary palette
* Fix CI
* fix linter
* Use uppercase for hex color
* Use eui variable instead
* Changes on charts.json
* Make the color picker accessible
* Fix ci and tests
* Allow keyboard navigation
* Close the popover on mouse click event
* Fix ci
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Update Result component to render a custom drag handle
* Update Result library with a draggable example
- note: this doesn't actually handle reorder logic, it's purely a UI/UX example
* Update CurationResult to pass dragHandleProps through to Result
* Fix incorrect copy
* Fix incorrect copy
* Update Box icon to match other icon sizes
* Add missing spacer on connector configuration screen
* Add missing spacer to Manage Source modal on Group page
* Remove shadows on Security page
* Align the last column content in tables to the right
* Fix colors on save custom source page
"Secondary" is greenish in new version is EUI, we need "subdued"
* Fix link to personal dashboard
* Add missing breadcrumbs to Security and Settings pages
* Deduplicate Security tests on Basic and Platinum licenses
* Prevent range slider from shifting to left when priority is 10
When priority is 10, the number become wider and it pushes the range slider to the left. This commit is a quick fix for that. We could improve it later by adding a proper input.
* Fix i18n duplicate ID
* Revert "Fix link to personal dashboard"
This reverts commit 5fc3ad2937.
* fix get_legend_config error in canvas/lib/index
* convert resolve_dataurl to ts to fix canvas/lib/index failure
* convert expression_form_handler to ts to fix canvas/lib/index failure
* convert canvas lib/error into ts
* canvas: do not compile json file due to effect on performance
* remove type. it is not exported and inferred as any implicitly
* fix datatable error in lib/index.d.ts file
* fix url resolver
* case manually to avoid incompatibility error
* merge all the typings at root level
* merge x-pack/tsconfig into tsconfig.json
* fix tsconfig after changes in master
* remove unnecessary typings
* update paths to the global typings
* update paths to the global elaticsearch typings
* fix import
* fix path to typings/elasticsearch in fleet plugin
* remove file deleted from master
* fix lint errors
* block node allocation notices on cloud
* added test to check that notices are not showing
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Added text help for each entry input option
* Add new unit test
* Fix wrong import on test file
* Change entry variable to readonly. Use it.each instead of a for loop
* Move function inside useMemo since it is only used there
* Remove old commented code
* Update failing test
- Adds a Kibana API endpoint transforms/_nodes
- Adds number of nodes to the stats bar in the transforms list.
- Shows a callout when no transform nodes are available.
- Disable all actions except delete when no transform nodes are available.
- Disables the create button when no transform nodes are available.
* WIP: Add basic structure of our ML Job callout
* Tests are not implemented
* logic is questionable
* Detections now makes redundant ML API calls
* Fix JSDoc reference
* Move ML Jobs callout to Rules page
As opposed to the more general Detections page.
* Extends callout logic to include installation of any affected jobs
* If old jobs are used with new ECS data, you'll be missing
anomalies/alerts
* If new jobs are used with old ECS data, you'll be missing
anomalies/alerts
* Flesh out our link to ML Job compatibility docs
This page doesn't exist yet; the URI/copy is subject to change.
* ML Job Upgrade -> ML Job Compatibility
This is a more accurate name for the concept since the problem is more
general than presence/absence of an upgrade.
* Add some placeholder copy to get the ball rolling
* Test callout behavior with different API responses
* Prevent fetching ML data when ML popover is opened/closed
We already fetch this data when the component is initially rendered. In
the normal workflow of page load -> open popover, we perform six (6) ML
API calls, 3 of which are redundant.
The one downside of this is that opening/closing the popover will not
refresh data; however, this workflow would previously have resulted in 6
API calls as well.
* Revert "Prevent fetching ML data when ML popover is opened/closed"
This reverts commit 810b78d2b9.
* Update link to relevant documentation
We're going to add a new section to this existing page, and link
directly to that heading. We should be able to generate whatever anchor
we need here, so choosing one arbitrarily on the assumption that docs
can make it work.
* Update copy from product
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Update CurationLogic to handle queries management
- updating the active query
- adding queriesLoading and organicDocumentsLoading state
- clean up / refactor updateCurations slightly - instead of taking a {queries} param, we should opt for a separate updateQueries action and storing a queries state
- this allows us to more granularly hook into activeQuery when queries is updated without the current activeQuery and correct for that
* Add ActiveQuerySelect component
- used for switching the currently active query
* Add ManageQueriesModal component
- used for editing/adding/removing the queries a curation manages
- primarily a light wrapper around the existing reusable CurationQueries component (also used in the create new curation view)
* Add OrganicDocuments and CurationResult components
* Update Curation view with new components
+ update breadcrumb to pull from queries instead of curation.queries, mostly for consistency w/ other usages & slightly faster responsiveness when updating queries
* Fix unnecessary import
* Meeting feedback: organic documents title copy tweak
* PR feedback - test assertion
* ensure feature influence column is shown for outlier jobs
* add popoverContent schema type featureInfluence
* add featureInfluence cell content check to functional test
* update types
* ensure computeFeatureInfluence is added to jobConfig
* always remove invalid feature influence columns for outlier jobs
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Fixed Pagerduty dedupKey is not set via API for Uptime alerts
* fixed test
* fixed test
* fixed test
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* When xpack.securitySolution.fleetServerEnabled is true, then Endpoint artifact manifest will use a fleet-server relative url for the artifacts generated (note: this flag is temporary until we ship v7.13)
* Refactors the security solution fleet integration extension point callbacks so that some action handlers can be executed in parallel (the creation of detection engine prepackaged rules can sometime take some time to complete
* chore(NA): ensure scripts run with --preserve-symlinks
* chore(NA): run webpack configs with symlinks: false
* chore(NA): fix pkg json load on kbn test
* chore(NA): add script into setup node env
* chore(NA): fix kbn test for relative improt
* chore(NA): fix change on docs
* chore(NA): move ensure node preserve symlinks into setup node env
* chore(NA): update changed docs
* chore(NA): update jest unit test
* chore(NA): fix wrapper script exit code
* chore(NA): updated generated plugin list docs
* fix(NA): make functional test runner use kbn utils repo_root
* chore(NA): fix eslint imports
* chore(NA): missing react correct config on eslint package
* chore(NA): use correct value to make test pass locally
* chore(NA): fix jest tests
* chore(NA): try remove extra preserve symlinks
* chore(NA): fix windows environment
* chore(NA): fix kbn-optimizer to run with preserve-symlinks
* chore(NA): fix integration jest test for kbn/optimizer
* chore(NA): remove require.resolve from eslintrc.js
* chore(NA): avoid load json file
* chore(NA): move kbn/utils import into kbn/dev-utils
* chore(NA): use correct dependencies on eslint config package
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Fixes and unskips tests. Also makes the tests less picky. Although I enjoy seeing the changes on ES promotions of error messages in case we see something really bad happening, it's too manual of a process to fix and puts too much of a burden on operations to skip the error messages.
### Checklist
- [x] [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
* add num_top_classes and feature_importance checks to validation
* ensure validation details view up to date
* ensure topClasses messages shows correct number. update types
* update functional test
* update cloning functional test for regression type job