## Summary
This PR closes https://github.com/elastic/kibana/issues/152139
This change brings a big performance improvement in Loading of the
Charts
### Checklist
- [x] Add new endpoint to retrieve filtered data based on URL params
- [x] Replace Embeddables with Elastic Charts
- [x] Delete existing code for Embeddables
- [x] Handle Loaders
- [x] Add similar No results found visualisations
- [x] Add Cy Tests
- [x] Add API Tests
## Demo
https://user-images.githubusercontent.com/7416358/232797685-1b009d5d-cd4a-4041-aa33-872647491ced.mov
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Resolves https://github.com/elastic/kibana/issues/135035.
In this PR, I'm removing the deprecated attribute
`alerting_framework_heath` from the alerting framework health API.
## To verify
1. Start Kibana.
2. Call `/api/alerting/_health`.
3. Notice `alerting_framework_heath` is no longer part of the HTTP API
response.
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
## Summary
Resolves: https://github.com/elastic/kibana/issues/155306
Exposes the `/_active` route to get all currently active maintenance
windows
```
GET `${INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window/_active`
body: {}
Response: MaintenanceWindow[]
```
### 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
resolves#119267
## Summary
As [discussed in the
issue](https://github.com/elastic/kibana/issues/119267#issuecomment-1370135711),
we believed the issue to be timing between file write and read, however
this is not the case. I found that two 'saved_object_find' events were
being logged - the expected user one (for a 'dashboard'), and one by the
fleet app (for 'epm-packages'). Should the 'epm-packages' event get
logged before the 'dashboard' event, the test fails because the first
'saved_object_find' event it finds does not contain the expected user
data in the audit. This appears to happen much less frequently in CI
than locally for whatever reason.
## Fix
I have added additional criteria when looking for the
'saved_object_find' event so it will only find an event for a
'dashboard' object.
## Testing
Flaky Test Runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2150
## Summary
Bug ticket https://github.com/elastic/kibana/issues/131967 describes an
issue where the alert prevalence count is not correct for fields that
have array values (such as `process.args`).
## Solution
Getting the correct count for those fields involved adding more `term`
conditions to the prevalence query and the timeline filter. This ensures
that only alerts with the *exact* same array values match instead of
partial matches as before.
https://user-images.githubusercontent.com/68591/231395154-b5a1c968-8308-49fb-a218-f3611f8331c3.mov
### 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
- [x] Get approval from the product team
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This PR modifies the bulk delete files API to support deleting the case
attachments even when the file does not exist. We could run into this
scenario if a user deleted the file outside of cases first and then
attempts to delete the case attachment.
## Summary
This PR replaces all but Host Count metric charts with Lens and aligns
the formulas used in Lens with the formulas used in the Snapshot API.
The Hosts Count was not converted yet, because Snapshot API
[post-process the results and filters out hosts that don't have metrics
and come from
APM](47c71b3025/x-pack/plugins/infra/server/routes/snapshot/lib/transform_metrics_ui_response.ts (L61)).
I decided to keep it unchanged until we start using a new API, which
won't have that step.
In order to avoid multiple requests going to the server simultaneously,
I introduced an intersection observer in the Lens chart component. It
will make them only trigger a request once the user has scrolled over a
chart component. This aims to prevent the occurrence of
`circuit_breaking_exception` exceptions when async_search has to process
too much data.
### Differences between Lens and current KPI charts
<img width="533" alt="image"
src="https://user-images.githubusercontent.com/2767137/232526591-4812059e-ba1f-4e59-a060-820570230084.png">
Currently, Lens doesn't provide an option for adding a suffix to the
metric value nor set a max number of decimal places. (e.g (e.g 3.8 Mbit
**/s**)
### For reviewer
Unfortunately, it's a big PR. Everything in the `lens/formulas` folder
is just related to the metric formulas that are reused between KPIs and
Metrics Charts.
The core of the changes is in the `lens/visualization_types` folder. It
contains the details on how to build different objects to render either
a metric type of chart or a lineXY one.
I have also aligned `cpu` and `memory` formulas with what we have in the
Inventory Model. When comparing the current KPI with the new ones in
Lens Embeddable, the results were not matching.
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Closes#149342.
It accomplishes this by returning the ArchivePackage, unzipped bundled
package that includes most of the same fields as the RegistryPackage.
These fields are used in APM to support the fleet migration workflow.
Fixes#154913
## Summary
Changes functional test to use the maps PageObject methods for entering
and exiting fullscreen. These methods provide better retry handling.
## Summary
This PR is just the first phase for response ops to go through their
saved object attributes. The idea is to comment out all the attributes
that we all agree that we do not need to filter/search/sort/aggregate
on.
After, in a second phase/PR, we will create a new file who will
represent all of attributes in our saved object as a source of truth.
Then, we will generate our SO mappings from this source of truth to
register our saved object.
Phase 3, we will try to generate also our type from our source of truth.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Fixes#151595
## Summary
In this PR we will be merging a feature branch into `main`.
This feature branch is a collection of several different PRs with file
functionality for cases.
- https://github.com/elastic/kibana/pull/152941
- https://github.com/elastic/kibana/pull/153957
- https://github.com/elastic/kibana/pull/154432
- https://github.com/elastic/kibana/pull/153853
Most of the code was already reviewed so this will mainly be used for
testing.
- Files tab in the case detail view.
- Attach files to a case.
- View a list of all files attached to a case (with pagination).
- Preview image files attached to a case.
- Search for files attached to a case by file name.
- Download files attached to a case.
- Users are now able to see file activity in the case detail view.
- Image files have a different icon and a clickable file name to
preview.
- Other files have a standard "document" icon and the name is not
clickable.
- The file can be downloaded by clicking the download icon.
## Release notes
Support file attachments in Cases.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Fixes an issue there the global state `_g` and app state `_a` would get
out of sync and overwrite each other. For example, a click on Refresh in
the date picker (global state) could reset the search bar (app state) to
empty.
The issue was that in `x-pack/packages/ml/url_state/src/url_state.tsx`
the `searchString` could become a stale value in `setUrlState`. This PR
fixes it by using the approach already used in `usePageUrlState`: The
`searchString` is passed on to be stored via `useRef` so that the
`setUrlState` setter can always access the most recent value.
## Summary
This PR for fixing the 'Flakiness' for our FTR Column Sort test cases.
The fix includes adding a 1 second delay or sleep between the test
clicking on the column its trying to sort and the test getting values
for that column.
There seems to be a problem from time to time where the values on that
column is not correct for a split second after clicking on the column to
sort it. Adding 1 second delay allows enough time for the column to sort
and show the correct value before we get the value for comparison with
the sorted (using our sorting function on the test)
This delay also fix the issue where the test fails because it checks for
an element while the page is still loading. I ran this 'fix' on our
flaky test runner for over 1000 runs and it hasn't fail so far, whereas
back then It would fail 3-4 times out of 450 runs
### Some other stuff that I tried before choosing this fix includes:
- Breaking the Column sort test cases into smaller test, currently we
test all Column sort in 1 test thus when 1 fail it might fail the next
one too.
- wait until loading element doesn't exist but I seem to be encountering
some issue when i use waitFor. Thus, I switch it to check if loading
element don't exist but It doesnt seem to help that much on fixing
column sort issue
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
resolves https://github.com/elastic/kibana/issues/135402
Allows deployments to not have the default footer added to alerting
emails via the new `xpack.actions.enableFooterInEmail` config setting.
The default value is `true`, which renders the footer. Setting the
value to `false` will cause no footer to be rendered.
Also changes the footer separator from `--` to `---`, which renders
nicer in HTML, as a `<hr>` element.
Resolves https://github.com/elastic/kibana/issues/153769
In this PR, I'm making `config`, `secrets` and `params` require a
validation in their connector type definition. Even in scenarios no
values are used, an empty object validation is required. This prevents
arbitrary data from being passed through.
Only `ES Index`, `Server Log` and `Teams` had some empty validators.
Adding them won't be a breaking change because the HTTP API defaults
missing `config` and `secrets` to `{}` ([see
here](https://github.com/elastic/kibana/blob/main/x-pack/plugins/actions/server/routes/create.ts#L19-L24)).
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Resolves: https://github.com/elastic/kibana/issues/152270
Specs:
https://docs.google.com/document/u/1/d/1-QblF6P19W9o5-10Us3bfgN80GRfjSIhybHrvJS_ObA/edit
This PR implements the following:
- New maintenance window SO
- New maintenance window client in the alerting plugin (generates and
queries maintenance window events, and other CRUD functionality around
the SO)
- New maintenance window REST APIs
- Kibana privileges for reading/writing maintenance window
This PR does not include integration with task runner, a new PR will be
created to do that work.
## APIs:
```
Find all maintenance windows in current space
GET `${INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window/_find`
body: {}
```
```
Create maintenance window:
POST `${INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window`
body: {
title: string,
duration: number,
r_rule: RRule
}
```
```
Update maintenance window by ID:
POST `${INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window/{id}`,
body: {
title?: string,
duration?: number,
enabled?: boolean,
r_rule?: RRule,
}
```
```
Get maintenance window by ID:
GET `${INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window/{id}`,
```
```
Delete maintenance window by ID:
DELETE `${INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window/{id}`,
```
```
Archive maintenance window by ID:
POST `${INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window/{id}/_archive`,
body: {
archive: boolean
}
```
```
Finish maintenance window by ID:
POST `${INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window/{id}/_finish`,
```
## Maintenance window response schema:
```
{
id: string;
title: string;
enabled: boolean;
duration: number;
expirationDate: string;
events: DateRange[];
rRule: RRuleParams;
status: 'running' | 'upcoming' | 'finished' | 'archived';
startDate: string | null;
endDate: string | null;
createdBy: string | null;
updatedBy: string | null;
createdAt: string;
updatedAt: string;
}
```
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR filters out all alerts that are already attached to the selected
case. To avoid breaking changes and not confuse the users (trying to
find which alert is attached to which case) the UI will not produce any
error.
### 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
### For maintainers
- [x] 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)