Closes https://github.com/elastic/kibana/issues/162915
## Summary
Replace direct calls to Fleet Secrets index with new API calls
introduced with https://github.com/elastic/elasticsearch/pull/97728
### New ES secrets APIs:
```
POST /_fleet/secret/
{
"value": "<secret value>"
}
// Returns the id of the created secret
{
"id": "<secret_id>"
}
DELETE /_fleet/secret/<secret_id>
// returns
{
"deleted": true
}
```
NOTE: I tried running the secrets integration tests in
https://github.com/elastic/kibana/issues/162732 but there is some ES
error that I'm not sure how to address. I think that the test can be
worked on separately
### Testing
Testing steps are the exact same as
https://github.com/elastic/kibana/pull/157176:
- Start EPR locally loading the `Secrets` test package from Kibana:
```
docker run -p 8080:8080 -v /Users/<YOUR_PATH>/kibana/x-pack/test/fleet_api_integration/apis/fixtures/test_packages:/packages/test-packages -v /Users/<YOUR_PATH>/kibana/x-pack/test/fleet_api_integration/apis/fixtures/package_registry_config.yml:/package-registry/config.yml docker.elastic.co/package-registry/package-registry:main
```
- Point `kibana.dev.yml` to local EPR:
```
xpack.fleet.registryUrl: http://localhost:8080
```
- Enable the secrets feature flag `secretsStorage`
- Start kibana and navigate to `integrations`, install `Secrets`
package.
- It should create and edit the package policy successfully
<img width="1800" alt="Screenshot 2023-08-08 at 16 26 52"
src="5e2b77d9-71a9-4c5f-8b3b-5fc6546d562f">
- The yml policy should have the redacted secrets and secrets ids:
<img width="771" alt="Screenshot 2023-08-08 at 15 43 22"
src="7db22c6b-b0db-4eb6-bc68-7174374c9c74">
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Changes in support of serverless:
- When the serverless project is not running with the Endpoint addon
(Endpoint Essentials or Endpoint Complete), the Create Policy preset
options should only display the "Data Collection" option
## Summary
Fixes#163084
<img width="1397" alt="Screenshot 2023-08-04 at 17 33 34"
src="8075da4d-633d-4916-b6db-491f7c87c363">
### Release note
Disable the "View rule details" option from the Alert Details' Actions
list when the rule is deleted.
## Summary
Update useUpselling hooks to avoid unnecessary re-renders by providing
an initial value.
### Checklist
Delete any items that are not applicable to this PR.
- [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
Fixes#156748
## Summary
[There is already a functional test that covers the same
functionality.](https://github.com/elastic/kibana/blob/main/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts#L727)
| Old Test | Scenario | Where it is covered now |
| ------------- | ------------- | ------------- |
| hasNext page is true | there are 2 `user-actions-list` | functional
test creates 24 UAs, displays too columns initially |
| hasNext page is true | `cases-show-more-user-actions` in document |
functional test creates 24 UAs clicks `cases-show-more-user-actions` |
## Summary
Original ticket: https://github.com/elastic/kibana/issues/145749
This PR un-skips tests which were disabled due to [upgrade to Jest 29
here](https://github.com/elastic/kibana/pull/143319).
Fixes:
1. Restructured test which checks the `isLoading` state returned by the
`useFetchOrCreateRuleExceptionList` hook
2. Make sure we call `await waitForNextUpdate();` right amount of times
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Closes https://github.com/elastic/kibana/issues/161493
Leaving the editor with unsaved changes
<img width="690" alt="image"
src="1587b8dc-83a1-4d89-993d-3150dea17836">
Go back to TSVB modal
<img width="742" alt="image"
src="a49667a1-927b-4aa8-aa1a-765a14ebd925">
## Summary
This PR is solving the following wrong behavior in text based languages.
When we are trying to depict a SQL/ESQL suggestion in Discover it is
necessary to know the type of the field. What we did so far was sending
from Discover to Lens only the column names and we were trying in Lens
to fetch the type from the dataview fields. But this doesnt cover all
the cases as both SQL (and ESQL) can create fields which cant be found
in a dataview. For example:
- Use of as `SELECT bytes, geo.dest as random_name FROM
"kibana_sample_data_logs"` in SQL
- Use rename (in ESQL)
- Create an aggregation, this will create a new variable in both
languages
- Using eval in ESQL
- ....
This PR solves the problem by passing the entire datatableColumn in the
Lens api and not only the name of the column. The types of the fields
are returned by sql, esql apis so we already have the information. We
just need to pass it in Lens.
**Fetching the correct types is very important as better suggestions
will be suggested from Lens.**
### 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
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Unfortunately, cases connector PR broke the main branch and was
reverted.
The problem happened because another PR updated an import while the
cases PR was getting merged.
I deleted the old import and now it should work fine.
Implements chat & function calling for the Observability AI Assistant.
The APM related changes are due to a correction in the `toBooleanRt`
type.
Code in `x-pack/observability_ai_assistant` has been reviewed via
feature branches.
---------
Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
## Summary
close https://github.com/elastic/kibana/issues/161545
close https://github.com/elastic/kibana/issues/153257
This PR makes `SavedObjectFinder` component backward compatible. It is
achieved by going through content- management layer, more technical
details
[here](https://docs.google.com/document/d/1ssYmqSEUPrsuCR4iz8DohkEWekoYrm2yL4QR_fVxXLg/edit)
### Testing
`SavedObjectFinder` is this component that allows to pick a saved object
(supports: `search` `index-pattern` `map` `visualization` `lens`
`event-annotation-group`:

It is used in the following places:
- Dashboard
- Add panel
- Replace panel
- Discover - Open Search
- Visualization - Select search as a source for new viz
- Graph - select source
- Cases - markdown editor add lens
- ML (3 places)
- Canvas - select embeddable panel
- Transform
- Lens > select event annotation
### Risks / Follow up
The `SavedObjectFinder` should stay mostly the same, the only notable
functional change is that now `SavedObjectFinder` doesn't support
`includeFields` which allowed partial saved object returns, this was
done to make the call backward-compatible without making the system even
more complicated as otherwise we'll need a way to abstract
`includeFields` from so attributes and allow to run migrations on it
before making a search. follow up issue to bring it back
https://github.com/elastic/kibana/issues/163043
The risk with that is that some client that have a lot of large objects
might run into performance issues when using `SavedObjectFinder`. This
can be mitigated by changing listing limit in advanced setting from
default 1000 to something lower
Improves the table hovering behavior for log rate analysis:
- When no row is hovered, it falls back to set the first row of the
current page to a hovered state. The result is that users will always
see a comparison view in the main document count chart.
- When a row gets pinned, the hovering of the other rows will be
disabled, so the comparison view in the main document count chart gets
locked on the pinned row.
## Summary
This PR enables the Compliance Dashboard page (CSP dashboards) to
self-recover from different "no findings" states so that the user
doesn't need to reload the page to see the changes after they perform
onboarding steps (install integration, deploy agent, index data, etc.)
fixes
- https://github.com/elastic/kibana/issues/156616
### Recording
d0201ebb-b8f8-4bce-b72e-3fdd85ab79fb
### Checklist
Delete any items that are not applicable to this PR.
- [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
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Reverts elastic/kibana#159674
The Elasticsearch team has changed their guidance about `fast_refresh`
and want this setting to be applied from within an Elasticsearch plugin
## Summary
Kibana API will not be public by default in serverless, this mean Fleet
API will not be accessible.
That PR fix that by changing the Fleet router to make Fleet API routes
public unless they specify `options.access` in their config, the only
route that I found that should be internal is the
/internal/fleet/reset_preconfiguration`
## Test
- [x] Added unit test to our router
manual test run Kibana in serverless and check Fleet API are still
publicly available
Before that change
<img width="1003" alt="Screenshot 2023-08-07 at 1 36 29 PM"
src="8e2fb113-f5e8-45e8-9892-f25bd9e722ad">
After that change
<img width="679" alt="Screenshot 2023-08-07 at 1 36 55 PM"
src="3cade239-5b13-4caf-bd1a-1bc8e2495c31">
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Closes#144481.
Closes#160256.
This enables content editor in dashboard to allow users to edit the
title, description, and tags from the listing page.
c2212882-43e3-45cb-83fc-493860857019
The only validation added to this flyout is the duplicate title check. I
used the same warning message as the visualize listing page.
<img width="600" alt="Screenshot 2023-07-06 at 2 11 38 PM"
src="42f7244a-1c4d-47ec-8f66-a98a63eff473">
### Checklist
Delete any items that are not applicable to this PR.
- [ ] 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/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
### Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.
When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:
| Risk | Probability | Severity | Mitigation/Notes |
|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces—unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes—Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |
### For maintainers
- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/kibana/issues/162777
flaky test runner
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2811
Failure image shows options list is still open. PR updates
optionsListEnsurePopoverIsClosed with logic to prevent 2 possible issues
1) retry added to ensure missed click will attempt to close options list
again
2) check options list is open before clicking. This will resolve issue
where options list is closed and clicking actually opens it again

---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
closes [#163080](https://github.com/elastic/kibana/issues/163080)
## 📝 Summary
This PR navigates to default discover at the end of the onboarding flow
for both custom and system workflows.
It also adds `logs-*` as the default dataview along with a preset filter
for the intended dataset during the onboarding flow.
## ✅ Testing
1. Navigate to the onboarding flow `/app/observabilityOnboarding/`
2. Choose either System logs or Stream log files
3. Go through the onboarding wizard
4. Click the Explore logs button at the end
5. Observe the DataView and Preset Filter after being navigated to
Discover
## 🎥 Demo
5eff74e4-c12a-46e7-968a-6efa34a6a7a9
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Closes#158948.
This removes the debounce on a redux action that was causing the
embeddables to not load in Canvas. It was introduced in #132831 which
fixed https://github.com/elastic/kibana/issues/123557 where changes to
the datasource settings weren't synced with the expression properly.
After extensive testing with this debounce removed, I was still unable
to reproduce the datasource/expression sync issues, so this change
shouldn't cause any regression there.
I added a smoke test that checks that embeddables render correctly after
a page change, and I added debounces to the handlers for any settings
changes in the sidebar both in the `display` tab and the `data` tab to
prevent too many updates.
While I was in here, I noticed that the corners of the dashed border
were slightly showing after switching from `border` to `outline` styles
on the embeddable panel, so I fixed the CSS here to hide them correctly
again.
### Checklist
Delete any items that are not applicable to this PR.
- [ ] 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/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
### Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.
When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:
| Risk | Probability | Severity | Mitigation/Notes |
|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces—unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes—Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |
### For maintainers
- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR instruments the code to track a few key editor performance
metrics. This is to prepare for adding a Lens editor performance
journey.
Metrics
- initial load of main chart
- time to load data
- time to render
- time to initially load and render all suggestions
For this PR, each metric is reported to the console (commented out to
pass the linter). When the journey is added, the console statements will
be converted to analytics service calls so that they show up as metrics
in the journey dashboard.
I made a few changes to increase the accuracy of the metrics.
- wrapping render-complete callbacks in `requestAnimationFrame` calls as
a temporary solution to
https://github.com/elastic/elastic-charts/issues/2124
- fixing a multiple-subscription issue in the workspace panel
---------
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Resolves https://github.com/elastic/kibana/issues/142400
## Release notes
Added ability to manage Cross-Cluster API keys.
## Summary
- Redesigned API keys page to cater for different API key types:
- **Personal API Key** - Allows external services to access the Elastic
Stack on behalf of a user.
- **Cross-Cluster API key** - Allows remote clusters to connect to your
local cluster.
- **Managed API key** - Created and managed by Kibana to correctly run
background tasks. (e.g. alerting / fleet)
- Redesigned Create/Update API key popup to allow adding Cross-Cluster
API keys.
- Redesigned View API key popup showing more information and added
feedback when API keys cannot be edited.
## Technical notes
- Refactored API key schemas and types throughout all API key related
routes, services and clients to create a single source of truth and stop
types going out of sync.
- Consolidated internal endpoints to simplify usage and reduce
unnecessary HTTP roundtrips.
- Migrated API Key form to Formik to more reliably manage state and to
simplify validation logic when toggling visibility of form elements.
- Broke out API key table and related primitives into separate reusable
components for a more cohesive design.
## Screenshots
### API keys page
<details>
<summary>Before</summary>
<img width="1249" alt="Screenshot 2023-07-24 at 10 25 04"
src="eb122597-f138-4658-9141-fd76b3291751">
</details>
<details open>
<summary>After</summary>
<img width="1159" alt="Screenshot 2023-07-23 at 17 01 24"
src="42be5002-235e-4785-83e3-eb4063ca75ba">
</details>
### Create Cross-Cluster API key flyover
<details>
<summary>Before</summary>
<img width="1261" alt="Screenshot 2023-07-24 at 10 25 21"
src="9e3ddffc-e6ec-4c9a-aaa4-a20b0ecf4d51">
</details>
<details open>
<summary>After</summary>
<img width="1172" alt="Screenshot 2023-07-23 at 17 06 41"
src="e6823c07-2154-4777-820f-a3bab9cabe0f">
</details>
### API key details flyover
<details>
<summary>Before</summary>
<img width="1262" alt="Screenshot 2023-07-24 at 10 25 35"
src="212293f3-355b-40d3-a1d6-5eea9c61c1cf">
</details>
<details open>
<summary>After</summary>
<img width="1260" alt="Screenshot 2023-07-24 at 10 34 01"
src="a5f561af-e415-49dd-9f3f-70250eb32ef7">
</details>
## Testing
### Conditions of satisfaction
1) The API Key management screen should be updated to allow the
different API Key types to be distinguished from one another.
2) Users with the elevated `manage_security` cluster privilege shall
have the ability to create & update RCS API Keys, as described in the
technical document provided by ES. This is a different privilege than
what the rest of the screen requires today.
3) API Key Invalidation will require the existing `manage_api_keys`
cluster privilege.
4) RCS API Keys are not available in the serverless offering, so these
changes should only be visible for the current offering.
Note: This functionality requires a true serverless ES instance - The
feature will not be hidden simply by running Kibana using serverless
flag
5) RCS API Keys require an `enterprise` license, and should not be
available for deployments with a lesser license level.
6) Any new APIs introduced on the Kibana side should be marked as
`internal`, for consistency with the rest of our API Key endpoints.
7) These RCS API Key changes must not be visible in the UI until support
for this is enabled in ES.
Removes `EuiPageTemplate_Deprecated` from the failure prompt in infra
tab which is displayed if the fetch request for the infra attributes
fails.
### Before
<img width="1508" alt="image"
src="b1a51640-8c65-4f55-bfa2-6878357cd6ba">
### After
<img width="1521" alt="image"
src="b502b68e-28ca-44b8-a293-4173ae4eadbb">
### No data screen
<img width="1523" alt="image"
src="510102a2-89d9-4114-b5f7-92c2e536be31">
Closes https://github.com/elastic/kibana/issues/161415