## Summary
This removes some duplicate API calls to reduce pressure on the backend and speed up querying times within the application for the front end. This fixes some of the issues of https://github.com/elastic/kibana/issues/82327, but there are several performance improvements that are going to be needed to help reduce the slowness when you have a system under a lot of pressure.
So far this removes duplication for these API calls when you are on the manage detection rules page:
```ts
api/detection_engine/rules/_find
api/detection_engine/rules/_find_statuses
api/detection_engine/tags
```
<img width="2465" alt="Screen Shot 2021-01-14 at 3 53 21 PM" src="https://user-images.githubusercontent.com/1151048/104662295-c031e080-5687-11eb-92d7-18b9ad355646.png">
* This hides the tags and searches while the page is loading to avoid duplicate calls when the pre-packaged rules counts come back
* This untangles the refetchRules from the refetchPrePackagedRulesStatus as two separate calls to avoid issues we have with re-rendering and re-calling the backend.
### 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
* [Maps] fix zooming while drawing shape filter logs errors in console
* add unit test
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Remove Manage button from Source overview page
* Replace empty select option with "Leave unassigned"
* Replace content source key with id
* Update Google icons
* Replace anchor with EuiLink
* Add Folders as one of the synced items for Box
* Add DLP feature UI to Jira and Confluence cloud pages
* Fix the "Fix" link path
Also updated TS types to match ent-search
* Fix copy and button color on "Content source is disabled" callout
* Remove incorrect copy from Private sources empty state
* Move constants from logic file to a separate file, rename a constant
* Fix i18n path to not include file name
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [APM] Only display relevent sections for rum agent in service overview (#85546)
* call `isRumAgentName` once
* User experience callout links to the selected service
* Update shared logic mocks to automatically mock their exports
* Update FlashMessages to also mock its helper fns
* Fix tests that were relying on component exports from shared logic files
* Fix broken flash_messages tests
- Caused by leaking auto mocks - work around this by importing from files directly and not from index.ts
- Also clean up / use new auto mocks (e.g. for kibana)
- Convert old instances of useValues mock to setMockValues
* [AS] Update AnalyticsLogic test to use new auto mockers
+ move LogicMounter and destructured mock values to top of describe block
* [AS] Update CredentialsLogic
+ udpate to use new clearFlashMessages helper
* [AS] Update documents logic tests
* [AS] Update engines logic tests
* [AS] Update log retention logic test
* [Shared] Update IndexingStatus tests
+ update to use LogicMounter
* [Shared] Update telemetry logic test
* [WS] Update AddSourceLogic
+ update to use new clearFlashMessages helper
* [WS] Update groups logic files
+ update to use new flash message helpers
* [WS] Update OverviewLogic test
* [WS] Update AddSource component test
+ consolidate mocks imports
* [Shared] Clean up KibanaLogic imports
- all jest.mocks come along from the ride when the __mocks__ folder is imported, so HttpLogic is now automatically already mocked
* [AS] Update EngineRouter test
## Summary
Changes `DELETE` to `POST` for _bulk_delete on the client only for a variety of reasons.
According to the RFC, not all servers and proxies need to honor DELETE having a body. From: https://tools.ietf.org/html/rfc7231
```
A payload within a DELETE request message has no defined semantics;
sending a payload body on a DELETE request might cause some existing
implementations to reject the request.
```
Within at least one proxy, h2o2, we have found that it does indeed change request headers which will cause NodeJS to not attach the body of a `DELETE`:
https://github.com/hapijs/h2o2/issues/124
Also from other communities such as OpenAPI where they debated this, they allow it but discourage it for reasons outlined there that I will not repeat here:
https://github.com/OAI/OpenAPI-Specification/pull/1937
Elastic Search API's and other Kibana API's use `POST` rather than `DELETE` for their bodies that are attached to `DELETE`:
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
We still support bodies in `DELETE` and `POST` but are just changing the web client to utilize `POST` moving forward.
### Checklist
Reviewed and we already have unit tests and end to end tests for these use cases so we are good with just updating them.
- [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
* clear ping state when PingList component in unmounted
* update ping list content
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Add small helper to reduce boilerplate on async tests expected to throw
- Also hopefully a bit more descriptive on what's happening
* Update all test files using the previous try/catch do nothing blocks to use new helper
* Unskip "Observer location" test block.
* Commit temp "describe.only" to make flaky test runner go faster.
* Add optional chain for some potentially-null props.
* Make overview filters type partial.
* Repair broken types.
* Remove \`only\` call from test.
* Add search source to example plugin.
* Add uiSetting for fields API.
* Update SearchSource to support fields API.
* [PoC] reading from the fields API in Discover
* Add N fields as a default column
* Make fields column non-removeable
* Do not add 'fields' to state
* Remove fields from app state and read from source when needed
* Remove fields column if a new column is added
* Add search source to example plugin.
* Add uiSetting for fields API.
* Update SearchSource to support fields API.
* Improve error handling in search examples plugin.
* Add unit tests for legacy behavior.
* Remove uiSettings feature flag; add fieldsFromSource config.
* Rewrite flatten() based on final API design.
* Update example app based on final API design.
* Update maps app to use legacy fieldsFromSource.
* Update Discover to use legacy fieldsFromSource.
* Rename source filters to field filters.
* Address feedback.
* Update generated docs.
* Update maps functional test.
* Formatting fields column similar to _source
* Moving logic for using search API to updating search source
* Fix small merge error
* Move useSource switch to Discover section of advanced settings
* Do not use fields and source at the same time
* Remove unmapped fields switch
* Add basic support for grouping multifields
* Remove output.txt
* Fix some merge leftovers
* Fix some merge leftovers
* Fix merge errors
* Fix typescript errors and update nested fields logic
* Add a unit test
* Fixing field formats
* Fix multifield selection logic
* Request all fields from source
* Fix eslint
* Fix default columns when switching between _source and fields
* More unit tests
* Update API changes
* Add unit test for discover field details footer
* Remove unused file
* Remove fields formatting from index pattern
* Remove unnecessary check
* Addressing design comments
* Fixing fields column display and renaming it to Document
* Adding more unit tests
* Adding a missing check for useNewFieldsAPI; minor fixes
* Fixing typescript error
* Remove unnecessary console statement
* Add missing prop
* Fixing import order
* Adding functional test to test fields API
* [Functional test] Clean up in after
* Fixing context app
* Addressing PR comments
* Updating failed snapshot
* Addressing PR comments
* Fixing i18n translations, updating type
* Addressing PR comments
* Updating a functional test
* Add a separate functional test for fields API
* Read fields from source in a functional test
* Skip buggy test
* Use default behavior in functional tests
* Fixing remaining failing tests
* Fixing date-nanos test
* Updating FLS test
* Fixing yet another functional test
* Skipping non-relevant tests
* Fixing more tests
* Update stub import in test
* Fix import
* Fix invalid import
Co-authored-by: Luke Elmers <luke.elmers@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
The alerts plugin was importing `JsonObject` from the infra plugin. The infra plugin imported `JsonObject`, `JsonValue`, and `JsonArray` from kibanaUtils and then re-exported them.
Remove the re-export from the infra plugin and instead always import these types from kibanaUtils.
* [ML] Improving existing job check in anomaly detection wizard
* fixing job id validation
* allow group ids to be reused
* updating module exists endpoint
* fixing issuse with job without group list
* fixing test and translation ids
* fixing validator when model plot is disabled
* changes based on review
* adding group id check to edit job flyout
* small refactor and fixing edit job issue
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* cleaning up unused types and legacy logic
* added new relative age logic with unit tests
* export the calculate relative timing function that returns millisecond values
* added exports to index.ts file
* copy update and test update
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* waits for the timeline modal before doing validations
* unskips search bar test
* unskips URL compatibility tests
* unksips attach timeline to a case tests
* unksips sourcerer test
* unskips pagination
* unskips inspect tests
* unskips fields browsers tests
* unskips toogle column in timeline tests
* unskips persistent timeline test
* removes comment
* fixes drag and drop test
* fixes adds a field to the timeline when the user drags and drops a field test
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [APM] Optimize anomaly data loading strategy
Closes#86423.
* Fix tests/types
* Review feedback
* Optimize ML calls for latency chart
* Optimize ML loading for latency chart
* Remove unused optimization
* Update snapshots for E2E tests
* Make sure area is stacked in correct order
* Review feedback + log warning if more than one ML job was found
* Review feedback
* [Workplace Search] Remove user icon from source details
Removes user icons from source details group list, since the users don't exist in Kibana.
* Refactor to remove entire GroupAvatars component
* Remove unused interface
* Remove flex group
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Add remaining log retention components
- Will shortly be used by Analytics view
* [i18n] Change log retention date from moment to react-intl FormattedDate
- this correctly localizes the dates when Kibana is in different languages, e.g. zh-CN, ja-JP
* Refactor log_retention/messaging
- Convert to all JSX/React vs plain strings (makes it easier to deal with FormattedDate/FormattedMessages)
- Consolidate to single component that takes various log types (e.g. analytics, api)
- This is important for adding future switches & toggles - there is *significantly* less complex strings to localize this way (2 short strings vs 5+ long sentences)
* Update existing instances to use new LogRetentionMessage
* Update translation strings
- to account for new i18n logs type values & IDs
* Attempt to fix test timezone shenanigans
* [PR feedback] Types
* [PR feedback] i18n pluralization
* Update LogRetentionTooltip and LogRetentionCallout to manage fetching log retention
+ change ILM to LogRetention per PR feedback
* Update LogRetentionLogic to prevent duplicate fetches
- e.g. if both LogRetentionTooltip and LogRetentionCallout are on the same page (which they will be)
We had fixed the link in the header menu a while back, but there were a couple other places where the link had not beed updated.
Replace `KibanaLink` component with a function to get the href for the upgrade assistant and use that everywhere.
Fixes#87647.
* Closes#87726. Uses ms as the unit for latencies in service overview.
* removes optional chaining in those cases where it is not needed
* updates test snapshot with correct value
* Revert "updates test snapshot with correct value"
This reverts commit 9a1bdd7b44.
* update param name from time -> value
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Set up server API routes
* Set up very basic AnalyticsLogic file
- mostly just contains API call & basic loading/error state for now - actual usable vars will be defined in a future PR
* [PR feedback] Unnecessary exports
* [PR feedback] Clean up analyticsAvailable reducer
* [PR feedback] Types order
* [PR feedback] Unnecessary API validation
* Closes#88268. Divides the throughput count of the selected range by deltaAsMinutes
* update old test snapshot
* update values in test snapshot
* update values in test snapshot
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Add cancel functionality to pollSearch
Makes sure that DELETE requests are properly sent even if consumer unsubscribes.
* Update poll_search.test.ts
* cancel on abort
* fix jest
* ADded jest test
* Cancel to be called once
* Only cancel internally on abort
* ts + addd defer
* ts
* make cancel code prettier
* Cancel even after unsubscribe
* Throw abort error if already aborted
* Only delete once
Co-authored-by: Lukas Olson <olson.lukas@gmail.com>
* Ensure that services that depend on fleet are only initialized if fleet dependency is available
* rename "Ingest manager" to "Fleet" in UI strings/code comments