This PR fixes a bug in the source classifier as it is currently not
identifying xml as a static file.
As part of this I've also identified a TODO in the source classifier
related with the evaluating order.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
As part of a [larger navigation embeddable
discussion](https://github.com/elastic/kibana/pull/162285#issuecomment-1679729003),
it was noted that there were inconsistencies between how we display the
panel type between the saved object modal and the context menu action.
Turns out, this is because we were using the embeddable `type` in the
`"Save to library"` modal title while the context menu action uses the
factory's `displayName` - while this coincidentally worked **in most
cases** (`maps` and `visualization`), it **does not** work for Lens
panels, since we want to use the proper noun `"Lens"` in this case
rather than the saved object type `"lens"`:
<p align="center"><img width="500"
src="d56659bf-ff13-4974-80bb-f267fdcb1cff"/></p>
This was even **more** obvious with the navigation embeddable, since the
saved object type is currently `"navigation_embeddable"` (this may
change in the future):
<p align="center"><img width="500"
src="868daebb-fa51-4f97-bd23-3cf47472fadf"/></p>
Therefore, by switching to use the factory's `displayName` (if
available), the saved object modal will now stay consistent with the
`"Edit <x>"` option in the context menu for each panel.
| Before | After |
|--------|--------|
|

|

|
|

|
|
|

|
<br><p
align="center">**No change**, as expected.</p> |
|

|
<br><p
align="center">**No change**, as expected.</p> |
Note that, in the above "After" screenshots, `Links` is still
capitalized unnecessarily - this is because, if we change the factory's
`displayName` to be the lowercase `"links"`, this fixes the modal but it
**also** impacts the item in the add panel context menu and the panel
actions context menu, like so:
| Add panel context menu | Panel actions context menu |
|--------|--------|
|

| |
This is because the link embeddable is not currently registered as a
"visualization" and so the `"Add panel"` context menu logic is handled
as part of `getEmbeddableFactoryMenuItem` in
`./src/plugins/dashboard/public/dashboard_app/top_nav/editor_menu.tsx`
rather than `getVisTypeMenuItem` (this **could** potentially be fixed by
https://github.com/elastic/kibana/issues/162840 since we have custom
logic for displaying aliases). While the lowercase `"links"` in the
panel actions context menu is **desired**, it is **not** desirable to
have the lowercase `"links"` in the add panel context menu - however, it
is not currently possible to change one without changing the other.
Note that this is **also** true for the `"Image"` embeddable - by
changing the `displayName` of the image factory from `"Image"` to
`"image"`, the `"Edit"` panel actions context menu item would be
displayed correctly as `"Edit image"` (currently, it is `"Edit Image"`)
but the lowercase `"image"` would also be displayed in the add panel
context menu, which is undesirable.
It will require a larger refactor to fix these inconsistencies, so it
should be addressed separately.
### Checklist
- [x] 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)
### 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)
Part of https://github.com/elastic/kibana/issues/155764.
In this PR, I'm setting the
`xpack.task_manager.allow_reading_invalid_state` serverless setting to
`false` so Kibana doesn't allow reading invalid state when loading
tasks.
I'm also doing the same for the functional tests to ensure valid task
state is always read.
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/kibana/issues/140135
Closes https://github.com/elastic/kibana/issues/159724
## Summary
### Changes to range slider
This PR migrates the range slider control to use the `EuiDualRange`
component, which both (a) removes a bunch of range slider code , thus
improving DX, and (b) improves the usability of the control by
simplifying the different states and making the slide animation much
smoother:
| Before | After |
|--------|--------|
| 
| 
|
Note that, due to the fact that migrating to the `EuiDualRange`
component means we no longer control the opening/closing of the popover,
this makes the "selections that extend beyond the current min/max of the
data" scenario slightly more difficult to handle. Specifically, we need
to decide the best time to recalculate the min/max of the slider as the
user's selections change.
The benefit of having control over the popover opening and closing was
that we could calculate the range slider's min/max values **when the
popover opened** and lock them in place so that they stayed static as
the user dragged:
<div align="center"><img width="500px"
src="1bf552d4-e70e-41ce-bf85-ab9ed0262398"
/></div><br/>
However, because the `EuiDualRange` handles the behaviour of the popover
and we therefore do not know when it opens/closes, it is not currently
possible to fully replicate this old behaviour. We have two main
options:
1. Recalculate the min/max of the range slider the user drags, which
gives a "sliding" effect:
<div align="center"><img width="500px"
src="4bb32b22-990e-40e9-a7df-78afca16bd27"
/></div>
2. Debounce this min/max calculation - with this, we avoid the "sliding"
effect shown above, and the min/max values **only get adjusted** when
the pin has been static for a long enough period of time (specifically,
`750ms`) or when the pin is dropped (i.e. the user lets go of the
mouse):
<div align="center"><img width="500px"
src="ac8943e6-4bcc-42dd-8cbb-1cdb627ba9f2"
/></div>
Ultimately, I went with option 2 in this PR. As a future enhancement, we
could replicate the old behaviour by adding some sort of
`onPopoverClosed` or `onPopoverOpened` logic to the `EuiDualRange`
component - however, this would need discussion with the EUI team to
ensure that this is the best way to handle it and not too specific to
our use case. Since EUI changes take awhile to propagate to KIbana, it's
not worth holding up this PR even further.
### Consistency with other control types
To keep things consistent, this PR also switches both the options list
and time slider controls to use the `EuiInputPopover` component and
removes the redundant control titles from the popover header:
| Before | After |
|--------|--------|
|

|

|
|

|

|
|

|

|
### 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] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- Technically, it does - but this will be resolved by the
@elastic/eui-team team adding an `aria-label` to the thumb `div`s
(https://github.com/elastic/eui/issues/7035). This is purely for the
sake of axe and/or automated `a11y` testing - it does not actually
impact `a11y` of the range slider, because the components missing an
`aria-label` are never accessible via the keyboard.
- [x] 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))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
### 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: Jatin Kathuria <jatin.kathuria@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Fixes https://github.com/elastic/kibana/issues/161081.
In this PR, I'm attempting to reduce the flakiness of the
`task_state_validation.test.ts` jest integration test by doing the
following changes:
- Ensuring each test creates a task with a different ID in case there is
a race condition with the previous test that would delete the task as
the next test runs.
- Modifying how the test waits for the task runner to be called given
the previous approach wasn't 100% that the executor would be mocked
before the task is scheduled.
Since the flaky test runner doesn't work with jest integration tests, I
instead added a for loop in my code to run the test 25x, and made CI run
it a few times:
- Commits creating for loop and setting to 25:
78561fe2ad
and
716853733e
- Commits where CI ran 25x and succeeded:
fef05d7db2,
f3b2a906fe,
7415c93465,
and
74bce2a24f
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary
* Use Serverless upsell architecture on ESS. But check for the required
license instead of capabilities.
* Covert Investigation Guide and Entity Analytics upsell to the new
architecture.
* Update upsell registering functions always to clear the state when
registering a new value. It fits perfectly ESS because the license is
observable.
### Checklist
- [x] 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)
- [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>
Context:
A few weeks ago I merged a PR that moved the calculation of the impact
estimate to the server. But by doing so I missed an essential part to
calculate it correct, the scale factor that is defined in the UI. I'm
reverting that change and making the calcs in the client again.
Along with that I fixed a problem and refactored the function that
calculate the impact simplifying it.
Before:
<img width="1313" alt="Screenshot 2023-08-14 at 10 06 39 AM"
src="c4cda975-4659-4570-afbe-4510f4e6c4fa">
After:
<img width="1320" alt="Screenshot 2023-08-14 at 10 07 29 AM"
src="98e20fc3-00bd-4266-8c8d-07fb6662c9e9">
<img width="1704" alt="Screenshot 2023-08-16 at 10 03 52 AM"
src="9dc780b2-b674-4d83-90e3-7865936dbeaf">
Fixes: https://github.com/elastic/kibana/issues/154721
## Summary
- Fixes flaky test:
`x-pack/plugins/security_solution/cypress/e2e/detection_response/rule_management/rule_actions/bulk_actions/bulk_edit_rules_actions.cy.ts`
- Test title: `Detection rules, bulk edit of rule actions`
## Details
For: `Detection rules, bulk edit of rule actions - Restricted action
privileges - User with no privileges can't add rule actions`
- Since this test logs in with a user with missing privileges, the
"Missing privileges" callout is shown at the top of the Rules Table. The
`selectNumberOfRules();` command selects rules one by one by clicking on
their checkboxes. However, flakiness was caused when the callout was
rendered while the selection of the rules was happening, causing a
layout shift that caused the selection of a checkbox to lose focus, and
not being able to be checked. This was solved by waiting the callout to
be rendered before the selection of rules start, with the new
`waitForCallOutToBeShown`method.
For: `Detection rules, bulk edit of rule actions - All actions
privileges - before/beforeEach Clause`
- Tests were failing in the `beforeEach` clause because the first test,
mentioned above, would be logged in with a `ROLES.hunter_no_actions`
role, and logging in with a user with permissions happened in a `before`
clause instead of a `beforeEach` clause. This caused the rest of the
suite to continue with a role without permissions, and the setup of the
second test would fail as the API requests done would fail with `401`.
Moving the initial logging-in from a `before` clause to a `beforeEach`
clause solved this issue.
For: `Detection rules, bulk edit of rule actions - All actions
privileges - Add a rule action to rules (existing connector)`
- This flakiness was extremely rare, but could be reproduced after about
400 iterations. It was caused by a similar reason as the first case
above: while rules were being selected one by one, the table would auto
refresh and focus would be lost from the checkbox that was about to be
selected. This aws fixed by disabling autorefresh in the setup.
### Other changes
- Prevents the installation of `security_detection_engine` package and
creates mock rules instead.
- Creates the `waitForCallOutToBeShown` method and moves the callout IDs
spread across different files to a a single file where they are exported
from.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
In #162997, the entire saved search embeddable Jest test suite was
skipped instead of just the flaky test. This PR doesn't fix the flaky
test, but unskips the test suite and instead only skips the flaky test
to ensure the other tests run.
## Summary
Adds a new `ConnectorSelectorInline` component that is displayed below
the Assistant title header.
Default:
<p align="center">
<img width="500"
src="83e6a884-103f-43c4-9a30-a0281d9941a2"
/>
</p>
Overflow:
<p align="center">
<img width="500"
src="f0d8a04e-963d-4053-90f5-2417f1c8eaca"
/>
</p>
Missing:
<p align="center">
<img width="500"
src="eff04e75-a5ab-468c-b801-1e056d527e6a"
/>
</p>
Open:
<p align="center">
<img width="500"
src="b7b97244-91a5-41ec-a096-b296e0cde644"
/>
</p>
### Checklist
Delete any items that are not applicable to this PR.
- [X] 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)
- [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] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))