Commit graph

447 commits

Author SHA1 Message Date
Davis McPhee
30b2065dd1
[Discover] Fix useCustomization returning undefined on first render (#181788)
## Summary

This PR fixes an issue where the `useCustomization` hook in Discover
always returns `undefined` on the first render, which can have
unintended consequences. This went unnoticed before, but the work in
#166406 revealed the issue, resulting in the Logs Explorer flyout
initializing to the wrong width.

With this fix, the width initializes correctly, but the default value of
`60%` causes the layout to become crammed, so I updated it to what
seemed like a more reasonable default of `650px`. I can change this to
something else if we feel there's a better default.

**Before (`60%`):**
<img width="1997" alt="before"
src="50994ca9-f232-4c5c-a948-46a0e9202864">

**Now (`650px`):**
<img width="1997" alt="after"
src="dcc8f53f-0f17-4b2f-9e33-9b1ba134d4ae">

### Checklist

- [ ] 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
- [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)

### 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)
2024-04-30 15:44:18 -03:00
Tim Sullivan
d059886e8a
[AppEx-SharedUX] Remove toMountPoint parameter from TableListViewKibanaProvider (#182030)
## Summary

The `toMountPoint` module from `@kbn/kibana-react-plugin/public` is
deprecated. Many areas of code need to include it and provide it as a
required prop of `TableListViewKibanaProvider`. This PR resolves that:
it shouldn't need to be a required prop anywhere, since it is a
stateless component and can be included as-needed.

This PR also updates the inclusion of `toMountPoint` to use the
non-deprecated source, which is `@kbn/react-kibana-mount`. As a side
effect of that, some consumers need to update the `core` property being
passed, to ensure it includes the `analytics`, `i18n` and `theme`
services.

### Checklist

Delete any items that are not applicable to this PR.

- [ ] [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: Anton Dosov <anton.dosov@elastic.co>
2024-04-30 11:14:48 -07:00
Devon Thomson
102c207025
[Embeddables Rebuild] Example aesthetics (#181920)
Slight aesthetic changes to the example embeddables
2024-04-29 15:28:48 -04:00
Devon Thomson
89b7a65426
[Embeddables Rebuild] Restrict types & remove per panel versioning (#181751)
Removes per-panel versioning and makes a few changes to further lock down types to make the new embeddable system more consistent and less error-prone.
2024-04-29 13:43:17 -04:00
Patryk Kopyciński
0780c19322
Add explicit children types (#181257)
## Summary

Prep work for React@18 bump

tl;dr In React@18 `React.FC` doesn't contain `children` anymore, so in
order to make the bump easier I have decided to split the effort in
multiple faces and hopefully this will make it easier for everyone

This PR focuses only on adding explicit `children` declaration either by
using `React.PropsWithChildren` type or by adding `children:
React.ReactNode` to the existing props types

https://github.com/DefinitelyTyped/DefinitelyTyped/issues/46691

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Sergi Massaneda <sergi.massaneda@gmail.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
Co-authored-by: James Gowdy <jgowdy@elastic.co>
2024-04-29 16:56:41 +01:00
Devon Thomson
98d2ab2e1a
[Embeddables Rebuild] Data table example (#181768)
Adds a new data table example that shows how embeddables can interact with their siblings
2024-04-26 16:12:30 -04:00
Tim Sullivan
bc87224b41
[Discover] Remove usage of deprecated React rendering utilities (#181623)
## Summary

Partially addresses https://github.com/elastic/kibana-team/issues/805

These changes come up from searching in the code and finding where
certain kinds of deprecated AppEx-SharedUX modules are imported.
**Reviewers: Please interact with critical paths through the UI
components touched in this PR, ESPECIALLY in terms of testing dark mode
and i18n.**

This focuses on code within **Discover**. Due to related type-safety
needs there are also some minor changes in the **Data** plugin.

<img width="1196" alt="image"
src="7f8d3707-94f0-4746-8dd5-dd858ce027f9">

Note: this also makes inclusion of `i18n` and `analytics` dependencies
consistent. Analytics is an optional dependency for the SharedUX
modules, which wrap `KibanaErrorBoundaryProvider` and is designed to
capture telemetry about errors that are caught in the error boundary.

### 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
- [ ] 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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>
2024-04-26 11:48:06 -07:00
Nathan Reese
438f623f3d
Add "Register new embeddable type" to Embeddable tutorial (#181761)
PR adds "Register new embeddable type" section to Embeddable tutorial
<img width="600" alt="Screenshot 2024-04-25 at 12 25 59 PM"
src="075c534b-0b1b-4600-a057-d601d09da5d1">

PR also groups example embeddables to make them easier to find
<img width="600" alt="Screenshot 2024-04-25 at 12 26 12 PM"
src="82d55fca-bbe8-4b63-a80e-dd052307d7e5">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-04-26 12:02:48 -06:00
Nathan Reese
f39dc96f83
[Embeddables Rebuild] Remove legacy examples (#181635)
PR does the following
1. removes legacy example embeddables
2. Replaces FilterDebugger legacy embeddable with react embeddable
3. Moves FilterDebugger react embeddable to portable_dashboards_example
since that is where its used
4. Fixes DashboardContainer.addNewPanel to return ApiType for react
embeddables.

### test instructions
1. start kibana `yarn start --run-examples`
2. Open kibana menu and click "Developer examples"
3. Use developer examples search bar to find "Portable Dashboards"
example and click on the card
4. Verify first example that shows control filters works

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-04-26 08:53:28 -06:00
Nathan Reese
60ab2cfe95
PresentationPanel props hidePanelChrome (#181473)
### Changes
1. adds `hidePanelChrome` parameter to `ReactEmbeddableRenderer`. When
true, embeddable is rendered without `PresentationPanel` wrapper
2. Removes `embeddable-explorer` plugin
3. Moves Embeddable developer example into embeddable_examples plugin
4. Creates new examples that demonstrate how to use
`ReactEmbeddableRenderer`
<img width="600" alt="Screenshot 2024-04-23 at 5 19 18 PM"
src="5167a2a4-1968-42e6-92f7-4577c9cda3c6">

Follow-up work to narrow scope of this PR
1. add key concepts to embeddable overview
2. add "Register new embeddable type" tab that details how to create a
new embeddable and shows how you can add embeddable examples to
dashboard
3. group embeddable examples into a single item in "Add panel" menu - to
show best practices of how to keep menu clean
4. remove class based example embeddables

### Test instructions
1. start kibana with `yarn start --run-examples`
5. Open kibana menu and click "Developer examples"
6. Click "Embeddables" card and run examples

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-04-24 14:05:19 -06:00
Davis McPhee
22dd9f86f4
[Discover] Remove Discover customization profiles (#181259)
## Summary

This PR removes the current Discover customization profile system from
the codebase while leaving the remainder of the customization framework
unaffected.

Testing notes:
- Discover should be unaffected by these changes.
- Logs Explorer should be unaffected by these changes.
- The Timeline ES|QL tab should be unaffected by these changes.
- The `discover_customization_examples` plugin has been migrated from
using a customization profile to using the `DiscoverContainer` component
to embed Discover within its own page, as is done for Logs Explorer and
Timeline.

Resolves #181355.

### Checklist

- [ ] 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
- [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)

### 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>
2024-04-23 12:39:32 -03:00
Nathan Reese
46cb23a80d
Update SearchReactEmbeddable example to use sessionId and abortSignal (#181249)
Fixes https://github.com/elastic/kibana/issues/181199

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-04-23 08:07:33 -06:00
Cee Chen
cbc68cd40c
Upgrade EUI to v94.1.0 (major EuiTable refactors) (#180514)
`v93.6.0`  `v94.1.0`

> [!important]
> 👋 Hello everyone - this is a special release containing `EuiTable`'s
conversion to Emotion, several long-overdue cleanups and breaking
changes, and one or two fun new features. First, let's address the big
questions:

### Q: I'm listed as a codeowner, how much should I manually QA/review?

Answer: It depends on what exactly in your code changed, but _in
general_ I would strongly suggest at least pulling this branch down and
doing a quick visual smoke test of all tables (_note: **not**
datagrids_) in your apps/plugins. You should not expect to see any major
visual regressions.

If your table contained any kind of custom styling or behavior (e.g.
custom CSS, etc.) I **strongly** recommend taking more time to QA
thoroughly to ensure your table still looks and behaves as expected.
Teams with very manual or specific updates will be flagged below in
comment threads.

### Q: When do I need to review by?

This PR will be merged **after** 8.14FF. Because this upgrade touches so
many files and teams, we're aiming for asking for an admin merge by EOD
4/18 regardless of full approval status.

As always, you're welcome to ping us after merge if you find any issues
later ([see our
FAQ](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)),
as you will have until 8.15FF to catch any bugs.

### Q: What breaking changes were made, and why?

Here's a quick shortlist of all the changes made that affected the
majority of the commits in this PR:

#### <u>Removed several top-level table props</u>
- The `responsive` prop has been removed in favor of the new
`responsiveBreakpoint` prop (same `false` behavior as before)
- The following props were removed from basic and in-memory tables:
  - `hasActions`, `isSelectable`, and `isExpandable`
- These props were not used for functionality and were only used for
styling tables in mobile/responsive views, which is not a best practice
pattern we wanted for our APIs. Mobile tables are now styled correctly
without needing consumers to pass these extra props.
  - `textOnly`
- This prop was unused and had no meaningful impact on tables or table
content.

#### Removed hidden mobile vs. desktop DOM

Previously, EUI would set classes that applied `display: none` CSS for
content that was hidden for mobile vs. desktop. This is no longer the
case, and content that only displays for mobile or only displays for
desktop will no longer render to the DOM at all if the table is not in
that responsive state.

This is both more performant when rendering large quantities of
cells/content, and simpler to write test assertions for when comparing
what the user actually sees vs. what the DOM ‘sees’.
(c3eeb08441e4b6efe6505e7cddaa87b540ddb259,
78cefcd954a7b46eaccd05e431b5e24dc86071a3)

#### Removed direct usages of table `className`s

EuiTable `classNames` no longer have any styles attached to them, so
some instances where Kibana usages were applying the `className` for
styles have been replaced with direct component usage or removed
entirely (86ce80b61f).

#### Custom table cell styles

Any custom CSS for table cells was previously being applied to the inner
`div.euiTableCellContent` wrapper. As of this latest release, the
`className` and `css` props will now be applied directly to the outer
`td.euiTableRowCell` element. If you were targeting custom styles table
cells, please re-QA your styles to ensure everything still looks as
expected.

---

<details open><summary>Full changelog (click to collapse)</summary>

##
[`v94.1.0-backport.0`](https://github.com/elastic/eui/releases/v94.1.0-backport.0)

**This is a backport release only intended for use by Kibana.**

**Bug fixes**

- Fixed a visual text alignment regression in `EuiTableRowCell`s with
the `row` header scope
([#7681](https://github.com/elastic/eui/pull/7681))

**Accessibility**

- Improved `EuiBasicTable` and `EuiInMemoryTable`'s selection checkboxes
to have unique aria-labels per row
([#7672](https://github.com/elastic/eui/pull/7672))

## [`v94.1.0`](https://github.com/elastic/eui/releases/v94.1.0)

- Updated `EuiTableHeaderCell` to show a subdued `sortable` icon for
columns that are not currently sorted but can be
([#7656](https://github.com/elastic/eui/pull/7656))
- Updated `EuiBasicTable` and `EuiInMemoryTable`'s
`columns[].actions[]`'s to pass back click events to `onClick` callbacks
as the second callback
([#7667](https://github.com/elastic/eui/pull/7667))

## [`v94.0.0`](https://github.com/elastic/eui/releases/v94.0.0)

- Updated `EuiTable`, `EuiBasicTable`, and `EuiInMemoryTable` with a new
`responsiveBreakpoint` prop, which allows customizing the point at which
the table collapses into a mobile-friendly view with cards
([#7625](https://github.com/elastic/eui/pull/7625))
- Updated `EuiProvider`'s `componentDefaults` prop to allow configuring
`EuiTable.responsiveBreakpoint`
([#7625](https://github.com/elastic/eui/pull/7625))

**Bug fixes**

- `EuiBasicTable` & `EuiInMemoryTable` `isPrimary` actions are now
correctly shown on mobile views
([#7640](https://github.com/elastic/eui/pull/7640))
- Table `mobileOptions`:
([#7642](https://github.com/elastic/eui/pull/7642))
- `mobileOptions.align` is now respected instead of all cells being
forced to left alignment
- `textTruncate` and `textOnly` are now respected even if a `render`
function is not passed

**Breaking changes**

- Removed unused `EuiTableHeaderButton` component
([#7621](https://github.com/elastic/eui/pull/7621))
- Removed the `responsive` prop from `EuiTable`, `EuiBasicTable`, and
`EuiInMemoryTable`. Use the new `responsiveBreakpoint` prop instead
([#7625](https://github.com/elastic/eui/pull/7625))
- The following props are no longer needed by `EuiBasicTable` or
`EuiInMemoryTable` for responsive table behavior to work correctly, and
can be removed: ([#7632](https://github.com/elastic/eui/pull/7632))
  - `isSelectable`
  - `isExpandable`
  - `hasActions`
- Removed the `showOnHover` prop from `EuiTableRowCell` /
`EuiBasicTable`/`EuiInMemoryTable`'s `columns` API. Use the new actions
`columns[].actions[].showOnHover` API instead.
([#7640](https://github.com/elastic/eui/pull/7640))
- Removed top-level `textOnly` prop from `EuiBasicTable` and
`EuiInMemoryTable`. Use `columns[].textOnly` instead.
([#7642](https://github.com/elastic/eui/pull/7642))

**DOM changes**

- `EuiTable` mobile headers no longer render in the DOM when not visible
(previously rendered with `display: none`). This may affect DOM testing
assertions. ([#7625](https://github.com/elastic/eui/pull/7625))
- `EuiTableRowCell` now applies passed `className`s to the parent `<td>`
element, instead of to the inner cell content `<div>`.
([#7631](https://github.com/elastic/eui/pull/7631))
- `EuiTableRow`s rendered by basic and memory tables now only render a
`.euiTableRow-isSelectable` className if the selection checkbox is not
disabled ([#7632](https://github.com/elastic/eui/pull/7632))
- `EuiTableRowCell`s with `textOnly` set to `false` will no longer
attempt to apply the `.euiTableCellContent__text` className to child
elements. ([#7641](https://github.com/elastic/eui/pull/7641))
- `EuiTableRowCell` no longer renders mobile headers to the DOM unless
the current table is displaying its responsive view.
([#7642](https://github.com/elastic/eui/pull/7642))
- `EuiTableHeaderCell` and `EuiTableRowCell` will no longer render in
the DOM at all on mobile if their columns' `mobileOptions.show` is set
to `false`. ([#7642](https://github.com/elastic/eui/pull/7642))
- `EuiTableHeaderCell` and `EuiTableRowCell` will no longer render in
the DOM at all on desktop if their columns' `mobileOptions.only` is set
to `true`. ([#7642](https://github.com/elastic/eui/pull/7642))

**CSS-in-JS conversions**

- Converted `EuiTable`, `EuiTableRow`, `EuiTableRowCell`, and all other
table subcomponents to Emotion
([#7654](https://github.com/elastic/eui/pull/7654))
- Removed the following `EuiTable` Sass variables:
([#7654](https://github.com/elastic/eui/pull/7654))
  - `$euiTableCellContentPadding`
  - `$euiTableCellContentPaddingCompressed`
  - `$euiTableCellCheckboxWidth`
  - `$euiTableHoverColor`
  - `$euiTableSelectedColor`
  - `$euiTableHoverSelectedColor`
  - `$euiTableActionsBorderColor`
  - `$euiTableHoverClickableColor`
  - `$euiTableFocusClickableColor`
- Removed the following `EuiTable` Sass mixins:
([#7654](https://github.com/elastic/eui/pull/7654))
  - `euiTableActionsBackgroundMobile`
  - `euiTableCellCheckbox`
  - `euiTableCell`
</details>
2024-04-19 00:05:48 +01:00
Tim Sullivan
e4a32f8f3c
[SharedUX] Remove usage of deprecated React rendering utilities (#180516)
## Summary

Partially addresses https://github.com/elastic/kibana-team/issues/805

Follows https://github.com/elastic/kibana/pull/180003

These changes come up from searching in the code and finding where
certain kinds of deprecated AppEx-SharedUX modules are imported.
**Reviewers: Please interact with critical paths through the UI
components touched in this PR, ESPECIALLY in terms of testing dark mode
and i18n.**

This focuses on code within AppEx-SharedUX. [Reporting changes are
separate](https://github.com/elastic/kibana/pull/).

<img width="1107" alt="image"
src="c0d2ce08-ac35-45a7-8192-0b2256fceb0e">

### 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
- [ ] 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)
2024-04-17 07:52:41 -07:00
Nathan Reese
1c38891dfc
[embeddable rebuild] change onFetchContextChanged from accepting callback to returning an observable (#180410)
Closes https://github.com/elastic/kibana/issues/180363

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-04-11 13:45:22 -06:00
Devon Thomson
3a1936f81f
[Embeddables Rebuild] Clean up parenting structure (#179769)
Significantly cleans up the PresentationContainer interface by adding a `children$` publishing subject.
2024-04-05 13:37:53 -04:00
Nathan Reese
e23335ba8b
[embeddable refactor] complete fetch context interface (#179776)
Closes https://github.com/elastic/kibana/issues/179838

1. define `PublishesSearchSource` interface
2. define `PublishesReload` interface
3. Add optional `timeslice$` to `PublishesTimeRange` interface
4. Update `DashboardContainer` to implement `PublishesSearchSource`,
`PublishesReload`, and `PublishesTimeRange` interfaces
5. `onFetchContextChanged` utility method created to consolidate fetch
context logic into a single re-usable component.

### Test instructions
1. Start kibana with `yarn start --run-examples`
2. Install sample web logs data set
3. create new dashboard, add `Unified search example` panel
4. Change time range, filters, search and verify panel fetches count for
narrowed data range
5. add timeslider control and advance timeslider, verify panel fetches
count for timeslice
6. Click reload, verify panel reloads count

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-04-04 20:57:03 -06:00
Hannah Mudge
4cc61b98e1
[Embeddable Rebuild] Make React embeddables work in Canvas (#179667)
Closes https://github.com/elastic/kibana/issues/179548

## Summary

This PR makes it so that React embeddables will now work in Canvas. It
does so by doing two main things:

1. It ensures that the `ReactEmbeddableRenderer` is used in Canvas when
an embeddable exists in the React embeddable registry - if it does not
exist, it continues to use the legacy embeddable factory's `render`
method.

Since Canvas auto-applies all changes and doesn't have save
functionality like Dashboard does, we must keep track of changes **as
they happen** and update the expression to match the new Embeddable
input - therefore, I had to add a `onAnyStateChange` callback to the
`ReactEmbeddableRenderer` as a backdoor for Canvas. As a bonus to this,
embeddables that **previously** didn't respect inline editing (such as
the Image embeddable) will start to work once they are converted!


3. It adds a new trigger (`ADD_CANVAS_ELEMENT_TRIGGER`) specifically for
registering an embeddable to the **Canvas** add panel menu. This trigger
can be attached to the **same action** that the Dashboard
`ADD_PANEL_TRIGGER` is attached to - this makes it super simple to add
React embeddables to Canvas:
    
    ```typescript
    uiActions.registerAction<EmbeddableApiContext>({
      id: ADD_EMBEDDABLE_ACTION_ID,
      isCompatible: async ({ embeddable }) => { ... },
      execute: async ({ embeddable }) => { ... },
      getDisplayName: () => { ... },
    });

    // register this action to the Dashboard add panel menu:
uiActions.attachAction('ADD_PANEL_TRIGGER', ADD_EMBEDDABLE_ACTION_ID);

    // register this action to the Canvas add panel menu:
uiActions.attachAction('ADD_CANVAS_ELEMENT_TRIGGER',
ADD_EMBEDDABLE_ACTION_ID);
    ```

As a small cleanup, I also replaced some inline embeddable expressions
with `embeddableInputToExpression` - this is because I was originally
missing `| render` at the end of my expression, and I didn't catch it
because the expressions I was comparing it to were all declared inline.
This should help keep things more consistent.

### How to Test
I attached the `ADD_EUI_MARKDOWN_ACTION_ID` action to the new
`ADD_CANVAS_ELEMENT_TRIGGER`, so the new EUI Markdown React embeddable
should show up in the Canvas add panel menu. Ensure that this React
embeddable can be added to a workpad, and make sure it responds to edits
as expected:



d9062949-9c61-4c9e-8a8e-08042753eab6



### 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] 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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-04-03 15:29:07 -07:00
Alejandro Fernández Haro
1c1e20afdb
Use rxjs instead of rxjs/operators (#179553) 2024-04-02 11:41:33 -07:00
Stratoula Kalafateli
804684310f
[ES|QL] Move last packages to the project team (#179538)
Move last packages to the esql prject team
2024-03-27 08:25:55 -07:00
Marco Liberati
fb19e57a4e
[ES|QL] New @kbn/esql-services package (#179029)
## Summary

Closes https://github.com/elastic/kibana/issues/172649

This PR extracts the ES|QL service like "validation", "autocomplete",
"code_action" (quick fixes) and some other services into a separate
package `@kbn/esql-validation-autocomplete` which has no tie with Monaco
editor anymore.

All the AST and grammar logic has been encapsulated into a single
`@kbn/esql-ast` package who contains the `getAst` function together with
the `parser` and `lexer`.

## Validation enhancements

The validation API has been enhanced to gracefully degrade whenever
callbacks are not provided, via the `ignoreOnMissingCallback` option.
Tests are included as well for this scenario.

### Example plugin

An example plugin app has been developed to show to to use the
validation API

<img width="500" alt="Screenshot 2024-03-22 at 17 45 38"
src="ebc172d3-ee61-4f3a-9e42-dcb9b15c7e69">

The app starts with a missing callback:

<img width="855" alt="Screenshot 2024-03-22 at 17 36 22"
src="c9b81370-8a10-487d-b22f-2359e1365a54">

Toggling the ignore option will hide the index error due to the lack of
`getSources` callback:

<img width="816" alt="Screenshot 2024-03-22 at 17 28 17"
src="931f4e5f-3ad6-46f7-97ca-63d7bb66646b">

Warnings are shown as well when detected:

<img width="807" alt="Screenshot 2024-03-22 at 17 35 56"
src="5e3e0537-cba2-475f-946b-0302867384ca">

#### Code snippet

The example app produces a copyable code snippet of the current
configuration of the validator:

![Code
snippet](https://private-user-images.githubusercontent.com/924948/316838987-fd16da58-8790-40b2-851d-b92aca1811dc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE0NTY0MzUsIm5iZiI6MTcxMTQ1NjEzNSwicGF0aCI6Ii85MjQ5NDgvMzE2ODM4OTg3LWZkMTZkYTU4LTg3OTAtNDBiMi04NTFkLWI5MmFjYTE4MTFkYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMzI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDMyNlQxMjI4NTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00ZDhhOGRlMjZjMzZhN2NjNTdkYWMxYTNjOWVkNTA3NDk5NGViOTg2NWEzMTAyZGM4MGYyOTQ0YjQ2N2Q3ZDI1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.H-3r_B57NK1-rS8UbR_bxlNtAMQ0flFGtW0oTIiOlr0)

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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>
2024-03-27 14:39:48 +01:00
Nathan Reese
61047aead0
[embeddable refactor] initializeTimeRange utility (#179379)
Move timeRange$ logic into reusable `initializeTimeRange` method.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-03-25 18:18:17 -06:00
Devon Thomson
b4e0a04af9
[Embeddables Rebuild] Async factories (#179302)
Changes the new Embeddable factory definition to take an async function instead of the factory object directly.
2024-03-25 15:44:57 -04:00
Devon Thomson
59b1f8ae94
[Embeddables Rebuild] Move titles API (#179202)
Moves the titles API and state comparators away from the embeddable plugin and to the presentation-publishing package.
2024-03-22 12:28:20 -04:00
Nathan Reese
85d243a059
[embeddable refactor] search react embeddable example (#178681)
Closes [178630](https://github.com/elastic/kibana/issues/178630)

To run examples, start kibana with `yarn start --run-examples`

PR adds "Unified search example" to Dashboard "Add panel" menu
<img width="400" alt="Screenshot 2024-03-13 at 9 33 22 PM"
src="d1edb4f5-ac1e-49bd-ad03-f624af74fff1">

Embeddable displays count with unified search context from dashboard.
Changing unified search and global time picker will cause search to
update
<img width="400" alt="Screenshot 2024-03-13 at 9 34 09 PM"
src="675b2c7d-9fc0-4173-aa67-354483593c09">

Embeddable also allows for setting custom time range on the panel
<img width="418" alt="Screenshot 2024-03-13 at 9 34 52 PM"
src="a79ea546-c4ce-4af5-8bb3-7be9cac7c02c">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-03-21 19:54:55 -06:00
Marta Bondyra
095c0593c5
[kbn-dnd-package] Divide draggable and droppable (#177282)
## Summary

Refactors a `<DragDrop/>` component to `<Draggable/>` and
`<Droppable/>`.

1. Performance gains
Performance improvements – one rerender less and then longest render
dropped by 30-40% (for 6x slowdown from 250 to 150ms action). The main
reason is that the components that were switching between being
Draggable and Droppable don't have to do it anymore so we don't mount
and unmount components as often.

<img width="856" alt="Screenshot 2024-02-22 at 17 10 07"
src="1555d1e0-93e6-4037-8636-470ea5101a14">

<img width="834" alt="Screenshot 2024-02-22 at 17 11 27"
src="11db4f37-e1c8-4ca5-83b7-c59d7937ce9a">

2. Readability improvements
Now it's much easier to see if the component is a drop zone or a
draggable component. The logic that was mixed between these two is
untangled and the components are smaller thanks to it.

4. Better API
It's easier to add a `<Draggable/>` or `<Droppable/>` components.

6. Small bugs fixes
Flash of colors when starting dragging in reorder group
![Feb-22-2024
17-15-32](e63296f5-1bc5-455c-ad7b-05738511f16a)

Annotation cut content
<img width="297" alt="Screenshot 2024-02-22 at 17 17 49"
src="ce4ab3d1-2a89-49cc-9230-c2ade194d1a3">

Half-transparent content when dragging - it doesn't make sense.
<img width="284" alt="Screenshot 2024-02-22 at 17 16 51"
src="fcafc12e-2ec9-4f93-a224-c7b4c8852e09">

7. Rewriting all the dnd tests from the package to rtl. It's still not
ideal, but way more tested from user perspective and way more readable.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-03-21 14:30:14 +01:00
Devon Thomson
fa799d7a08
[Embeddable Rebuild] Change Parenting Structure (#178426)
Changes the structure of the React Embeddable system's factories to reduce boilerplate and potential for bugs.
2024-03-13 12:38:08 -04:00
Jeramy Soucy
f214e207e5
Replace Encrypted Saved Object AAD exclude list with include list (#167705)
Closes #156023

## Summary

ESO = Encrypted Saved Object(s)

This PR modifies the `EncryptedSavedObjectTypeRegistration` definition,
replacing the `attributesToExcludeFromAAD` property with a
`attributesToIncludeInAAD` property. The purpose is to alter the default
inclusion of new SO attributes, which will help to resolve potential
decryption issues with serverless zero downtime upgrades (see
https://github.com/elastic/kibana/issues/156023).

NOTE: nested fields are included when the parent field is added to the
include list. In this way the include list behaves just as the exclude
list did.

#### Attention Code Owners: 
I attempted to create the include list for existing ESOs by comparing
the exclude list to the full list of attributes, ~~however, I am sure
this is either incomplete or partially incorrect~~ UPDATE: new tests
have been created to validate the include list (see the **Testing**
section). These changes will need to be carefully audited by the owning
teams during the review process. This PR will not merge until all code
owners have reviewed and approved the changes. If your team is a
consumer of ESOs, please see the **Testing** section below.

## Testing
Automated test suites have been updated to account for the changes to
ESO registration. The riskier part of this PR are the changes to
existing ESOs, and validating that they are effectively identical to
their previous implementations. I have used main branch Kibana to
generate several ESOs - one of each type, then saved those raw encrypted
objects to an esArchiver JSON file. New functional tests, in the
`encrypted_saved_objects_api_integration` suite, have been created to
verify that those objects can be successfully decrypted using the new
ESO definitions containing the AAD include list.

### ESO Types to Validate
See
`x-pack/test/encrypted_saved_objects_api_integration/tests/encrypted_saved_objects_aad_include_list.ts`

- [x] ACTION_SAVED_OBJECT_TYPE/'action'
- [x] ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE/'action_task_params'
- [x] CONNECTOR_TOKEN_SAVED_OBJECT_TYPE/'connector_token'
- [x] RULE_SAVED_OBJECT_TYPE/'alert'
- [x] 'api_key_pending_invalidation'
- [x] OUTPUT_SAVED_OBJECT_TYPE/'ingest-outputs
- [x] MESSAGE_SIGNING_KEYS_SAVED_OBJECT_TYPE/'fleet-message-signing-keys
- [x] UNINSTALL_TOKENS_SAVED_OBJECT_TYPE/'fleet-uninstall-tokens'
- [x] syntheticsApiKeyObjectType/'uptime-synthetics-api-key'
- [x] syntheticsMonitorType/'synthetics-monitor'
- [x] syntheticsParamType/'synthetics-param'

### Flaky Test Runner
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5419

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
2024-03-08 11:15:02 -05:00
Drew Tate
880f793ccc
[Visualizations] legacy vis behavior on serverless (#176935)
## Summary

Close https://github.com/elastic/kibana/issues/176536
Close https://github.com/elastic/kibana/issues/176742

### Links to legacy visualization editors are once again disabled
<img width="208" alt="Screenshot 2024-02-14 at 10 19 52 AM"
src="711f5372-d7f6-4f0d-88c6-605e528d6f13">

### A better message in the inspector
<img width="685" alt="Screenshot 2024-02-14 at 10 23 25 AM"
src="734a8f6a-0f00-46c7-8d27-2a86a24cf7ab">


### 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-02-22 08:44:14 -06:00
Sébastien Loix
9db8d2558c
[Core] Deprecate nav link status (#176383) 2024-02-16 11:06:33 -07:00
Devon Thomson
6827db46d5
[Embeddable rebuild] Allow Dashboard to provide references (#176455)
Adds the ability for the Dashboard to provide references for its React Embeddable children to inject, and adds the ability for the React Embeddable children to provide extracted references back to the Dashboard.
2024-02-12 14:55:16 -05:00
Devon Thomson
23b4b538f8
[Embeddables rebuild] Decouple add panel trigger (#176110)
Decouples the `ADD_PANEL_TRIGGER` from the Embeddables framework  by making it take a `PresentationContainer` as context instead.
2024-02-07 09:57:58 -05:00
Devon Thomson
435680612e
[Embeddables rebuild] Add new registry (#176018)
Creates a new registry for `React Embeddables` and allows the Dashboard to render them.
2024-02-02 15:10:19 -05:00
Cee Chen
447cd44bf2
Upgrade EUI to v92.2.1 (#175849)
`v92.1.1``v92.2.1`

---

## [`v92.2.1`](https://github.com/elastic/eui/releases/v92.2.1)

**Bug fixes**

- Removed unintentional i18n tokens in prior release that should not
have been exported

## [`v92.2.0`](https://github.com/elastic/eui/releases/v92.2.0)

- Updated `EuiFlyoutResizable` with new optional `onResize` callback
([#7464](https://github.com/elastic/eui/pull/7464))

**Bug fixes**

- Fixed an issue in `EuiResizableContainer` where `onResizeEnd` could
become a stale closure when renders occured between resize start and
end, resulting in an outdated version of a consumer's `onResizeEnd`
callback being called
([#7468](https://github.com/elastic/eui/pull/7468))
- Fixed `EuiTextArea` to correctly fire `onChange` callbacks on clear
button click ([#7473](https://github.com/elastic/eui/pull/7473))
- Fixed `EuiContextMenu`'s panel titles & items to not show underlines
on hover for non-interactive elements
([#7474](https://github.com/elastic/eui/pull/7474))

**Deprecations**

- Remove unused public `EuiHue` and `EuiSaturation` subcomponent
exports. Use the parent `EuiColorPicker` component instead
([#7460](https://github.com/elastic/eui/pull/7460))
- Remove unused public `EuiCommentTimeline` subcomponent export. Use the
parent `EuiComment` or `EuiCommentList` components instead.
([#7467](https://github.com/elastic/eui/pull/7467))
2024-01-30 08:54:10 -08:00
Eyo O. Eyo
b25407edba
Update Kibana code editor dependencies (#171720)
## Summary

This PR started out as an attempt to resolve
https://github.com/elastic/kibana/issues/166559; which it does, the
appropriate colours for the message prompt displayed when an edit
attempt on read only content is made in the code editor for both dark
and light mode are now set;

 ### Light mode
<img width="412" alt="Screenshot 2023-11-22 at 11 30 17"
src="8675dd9f-b413-4098-a903-7ac63dc367fb">

### Dark mode
<img width="843" alt="Screenshot 2023-11-22 at 11 29 31"
src="64fd39e0-d5dd-4556-b6ca-75ba8fc55c94">

#### Noteworthy**

- See https://code.visualstudio.com/api/references/theme-color for more
clarification on the style definitions added to this PR
- There's also been accommodation made for consumers of the code editor
to provide their own custom message through the prop `readOnlyMessage`.
- That been said it's worth pointing out that this PR updates
react-monaco-editor and monaco-editor packages to their latest version,
primarily because the functionality that provides support to provide
customization for the providing a color scheme that would support in our
use case for setting colors for dark mode and light mode appropriately,
shipped in version 0.40.0 of monaco editor, also for react-monaco-editor
prior to it's current latest the pinned version of monaco editor was
0.38.0.
- Monaco-yaml is also updated in the PR, matching the change in
expectation of the underlying monaco-editor api.
~- Updates to the packages referenced above, in turn caused the
installed version of prettier to be updated to the latest minor version
2.8.8. This change caused some lint changes to the project files where
parentheses were added to types with Index Access on another type
created using the typeof operator (more context
[here](https://github.com/prettier/prettier/issues/14990)), for this
reason I've opted to lockdown prettier version, so that this PR only
contains the changes required for updating the code editor. A subsequent
PR will be created to revert the package lockdown so that PR contains
only the lint changes that will occur.~

### 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)
<!-- - [ ]
[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 -->
- [x] 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&mdash;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&mdash;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: Aleh Zasypkin <aleh.zasypkin@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-01-25 10:30:02 +01:00
Nathan Reese
33077eaa99
Add overview section to actions and triggers example (#175152)
PR updates actions and triggers example with an "Overview" section
better explaining the top level concepts. PR also re-works the hello
world example to have a better explaination of what it does and simplify
the example

### before
<img width="800" alt="Screenshot 2024-01-18 at 12 08 44 PM"
src="5969b35e-a307-402a-aba4-a5b4ffa9920b">

### after
<img width="800" alt="Screenshot 2024-01-18 at 12 06 46 PM"
src="e2eb416e-c7a0-4a04-83e8-2383fbe12dae">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-01-22 09:05:13 -07:00
Julia Rechkunova
118125168c
[UnifiedDocViewer] Redesign header and make actions responsive (#173780)
- Resolves https://github.com/elastic/kibana/issues/163239
- Resolves https://github.com/elastic/kibana/issues/164660
- Related PR https://github.com/elastic/kibana/pull/173765

## Summary

- large screen and max 3 items => it will render an icon and a label for
each action:
<img width="500" alt="Screenshot 2024-01-03 at 18 02 23"
src="f125a544-59c2-4ac9-aa87-9e72dd2c6deb">

- otherwise: max 3 icons and the rest in a context menu:
<img width="400" alt="Screenshot 2024-01-03 at 18 02 07"
src="942b5cdb-2774-401a-9c68-daeb01b5d459">

- small screen: all items are in the context menu
<img width="678" alt="Screenshot 2024-01-03 at 18 01 39"
src="52b9fb2a-b022-4a56-ad3c-e022b6876c0a">


I also extended "Discover customization" example plugin to showcase more
actions. For testing you can run kibana with `yarn start --run-examples`
and update number of additional actions locally via
690c38e689/examples/discover_customization_examples/public/plugin.tsx (L411)

### 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
- [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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
2024-01-10 13:28:52 -07:00
Thomas Neirynck
f606085210
[SO] remove some plugin dependencies (#174282)
## Summary

Removes some `savedObject` plugin dependencies.

### 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)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-01-10 10:34:00 -05:00
Eyo O. Eyo
d458b5382f
Remove legacy kibana react code editor (#171047)
## Summary

This PR removes the legacy kibana react code-editor, alongside replacing
all import declarations of this legacy component to the one offered by
shared-ux, i.e import declaration source of `'@kbn/kibana-react/public'`
is switched to `@kbn/code-editor`.

Also in this PR an helper for writing jest tests has been included
through the package `@kbn/code-editor-mock`, this would facilitate
mocking the editor, especially given that the code editor leverages
couple of APIs that are aren't included by default in jsdom, among them,
`matchMedia`, `ResizeObserver`. The provided mock is sufficient for most
use cases and can be setup in any package within kibana as a
[`node_module`
mock](https://jestjs.io/docs/manual-mocks#mocking-node-modules) without
having to repeatedly manually mock the editor within individual test
files. An example for how this might be done can be found here
ec5ba25368


### 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)
-->
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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

<!--
- [ ] 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&mdash;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&mdash;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>
2024-01-05 14:35:09 +01:00
Tomasz Kajtoch
b043545208
Upgrade EUI to v91.0.0 (with backports) (#170716)
`v90.0.0``v91.0.0-backport.0`

⚠️ While this upgrade pings many teams and has a large code diff, **the
majority of the changes are snapshots or tests-related** and do not
touch source code, so should theoretically only need a code review and
not dedicated QA.

The changes in EUI that required a large swathe of these updates are:

- **EuiPopover** removed an extra unnecessary `<div>` wrapper on its
anchors, which affected many snapshots and a few CSS overrides, which
should have been updated
- **EuiButtonGroup** now renders `<button>` elements instead of `<input
type="radio">` elements for single selection, which affected both
snapshots and E2E tests
- **EuiSuperDatePicker**'s absolute date input now requires an `Enter`
keypress when parsing dates (affected E2E tests)
- **EuiComboBox**, when rendered with `singleSelection={{ plainText:
'true' }}`, no longer renders a pill (i.e. text). This combobox type now
behaves more like an `EuiFieldText`, where the selection is rendered via
input `value` instead. This affected a high amount of E2E tests (both
FTR and Cypress), both in terms of updating assertions and changing
selections, but should **not** significantly affect user experience -
see https://github.com/elastic/eui/pull/7332 for more.

---

##
[`v91.0.0-backport.0`](https://github.com/elastic/eui/tree/v91.0.0-backport.0)

**This is a backport release only intended for use by Kibana.**

- Added `esqlVis`, `pipeBreaks`, and `pipeNoBreaks` icon glyphs.
- `EuiSelectable` now allows configurable text truncation via
`listProps.truncationProps`
([#7388](https://github.com/elastic/eui/pull/7388))
- `EuiTextTruncate` now supports a new `calculationDelayMs` prop for
working around font loading or layout shifting scenarios
([#7388](https://github.com/elastic/eui/pull/7388))

**Bug fixes**

- Fixed a bug with `EuiSelectable`s with custom `truncationProps`, where
scrollbar widths were not being accounted for
([#7392](https://github.com/elastic/eui/pull/7392))

## [`91.0.0`](https://github.com/elastic/eui/tree/v91.0.0)

- Updated the background color of `EuiPopover`s in dark mode to increase
visibility & contrast against other page/panel backgrounds
([#7310](https://github.com/elastic/eui/pull/7310))
- Memoized `EuiDataGrid` to prevent unneeded re-renders
([#7324](https://github.com/elastic/eui/pull/7324))
- Added a configurable `role` prop to `EuiAccordion`
([#7326](https://github.com/elastic/eui/pull/7326))
- Added a configurable `role` prop to `EuiGlobalToastList`
([#7328](https://github.com/elastic/eui/pull/7328))
- For greater flexibility, `EuiSuperDatePicker` now allows users to
paste ISO 8601, RFC 2822, and Unix timestamps in the `Absolute` tab
input, in addition to timestamps in the `dateFormat` prop
([#7331](https://github.com/elastic/eui/pull/7331))
- Plain text `EuiComboBox`es now behave more like a normal text
field/input. Backspacing will no longer delete the entire value, and
selected values can now be double clicked and copied.
([#7332](https://github.com/elastic/eui/pull/7332))
- `EuiDataGrid`'s display settings popover now allows users to clear the
"Lines per row" input before typing in a new number
([#7338](https://github.com/elastic/eui/pull/7338))
- Improved the UX of `EuiSuperDatePicker`'s Absolute tab for users
manually typing in timestamps
([#7341](https://github.com/elastic/eui/pull/7341))
- Updated `EuiI18n`s with multiple `tokens` to accept dynamic `values`
([#7341](https://github.com/elastic/eui/pull/7341))

**Bug fixes**

- Fixed `EuiComboBox`'s `onSearchChange` callback to pass the correct
`hasMatchingOptions` value
([#7334](https://github.com/elastic/eui/pull/7334))
- Fixed an `EuiSelectableTemplateSitewide` bug where the `popoverButton`
behavior would break if passed a non-DOM React wrapper
([#7339](https://github.com/elastic/eui/pull/7339))

**Deprecations**

- `EuiPopover`: deprecated `anchorClassName`. Use `className` instead
([#7311](https://github.com/elastic/eui/pull/7311))
- `EuiPopover`: deprecated `buttonRef`. Use `popoverRef` instead
([#7311](https://github.com/elastic/eui/pull/7311))
- `EuiPopover`: removed extra `.euiPopover__anchor` div wrapper. Target
`.euiPopover` instead if necessary
([#7311](https://github.com/elastic/eui/pull/7311))
- Deprecated `EuiButtonGroup`'s `name` prop. This can safely be removed.
([#7325](https://github.com/elastic/eui/pull/7325))

**Breaking changes**

- Removed deprecated `euiPaletteComplimentary` - use
`euiPaletteComplementary` Instead
([#7333](https://github.com/elastic/eui/pull/7333))

**Accessibility**

- Updated `type="single"` `EuiButtonGroup`s to render standard buttons
instead of radio buttons under the hood, per recent a11y recommendations
([#7325](https://github.com/elastic/eui/pull/7325))
- `EuiAccordion` now defaults to a less screenreader-noisy `group` role
instead of `region`. If your accordion contains significant enough
content to be a document landmark role, you may re-configure it back to
`region`. ([#7326](https://github.com/elastic/eui/pull/7326))
- Reduced screen reader noisiness when sorting `EuiDataGrid` columns via
toolbar ([#7327](https://github.com/elastic/eui/pull/7327))
- `EuiGlobalToastList` now defaults to a `log` role. If your toasts will
always require immediate user action, consider (with caution) using the
`alert` role instead.
([#7328](https://github.com/elastic/eui/pull/7328))

**CSS-in-JS conversions**

- Updated `$euiFontFamily` and `$euiCodeFontFamily` to match Emotion
fonts ([#7332](https://github.com/elastic/eui/pull/7332))

---------

Co-authored-by: Cee Chen <constance.chen@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2023-12-18 11:15:15 -06:00
renovate[bot]
1868489bb5
Update dependency @elastic/charts to v61 (main) (#170914)
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@elastic/charts](https://togithub.com/elastic/elastic-charts) |
[`60.0.0` ->
`61.0.0`](https://renovatebot.com/diffs/npm/@elastic%2fcharts/60.0.0/61.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@elastic%2fcharts/61.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@elastic%2fcharts/61.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@elastic%2fcharts/60.0.0/61.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@elastic%2fcharts/60.0.0/61.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>elastic/elastic-charts (@&#8203;elastic/charts)</summary>

###
[`v61.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#6100-2023-11-08)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v60.0.0...v61.0.0)

##### Bug Fixes

- `onRenderChange` callback trigger on resize
([#&#8203;2228](https://togithub.com/elastic/elastic-charts/issues/2228))
([be30c1b](be30c1bd48))
- **axis:** always render `tickLine` unless `visible` is `false`
([#&#8203;2194](https://togithub.com/elastic/elastic-charts/issues/2194))
([ec95d50](ec95d50180))
- **BarSeries:** ignore histogram mode in determining stacked series
([#&#8203;2225](https://togithub.com/elastic/elastic-charts/issues/2225))
([27b4281](27b4281581))
- clamp brushing min of last bucket
([#&#8203;2227](https://togithub.com/elastic/elastic-charts/issues/2227))
([155c22d](155c22dee1))
- **deps:** update dependency
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to ^88.5.0
([#&#8203;2179](https://togithub.com/elastic/elastic-charts/issues/2179))
([2bb921e](2bb921e42b))
- **deps:** update dependency
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to ^88.5.4
([#&#8203;2190](https://togithub.com/elastic/elastic-charts/issues/2190))
([05b33e5](05b33e58f2))
- **deps:** update dependency
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to ^89.1.0
([#&#8203;2212](https://togithub.com/elastic/elastic-charts/issues/2212))
([a91f68d](a91f68d6b7))
- **deps:** update dependency
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to v89
([#&#8203;2193](https://togithub.com/elastic/elastic-charts/issues/2193))
([132327d](132327d980))
- **deps:** update dependency
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to v90
([#&#8203;2222](https://togithub.com/elastic/elastic-charts/issues/2222))
([10cd53b](10cd53b2e6))

##### chore

- reclaim charts theme ownership from eui
([#&#8203;2175](https://togithub.com/elastic/elastic-charts/issues/2175))
([422c7d5](422c7d529e))

##### Features

- **metric:** allow alpha colors and improve contrast logic
([#&#8203;2184](https://togithub.com/elastic/elastic-charts/issues/2184))
([dd5732e](dd5732e83b))

##### BREAKING CHANGES

- **BarSeries:** now ignores histogram mode in determining stacked
series
- elastic charts theme renamed to `LEGACY_DARK_THEME` and
`LEGACY_LIGHT_THEME` in favor of the main `DARK_THEME` and `LIGHT_THEME`
which was merged with eui theme overrides. These new themes are now
default.
- **axis:** Now respects `tickLine.padding` whenever `tickLine.visible`
is `true`

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/elastic/kibana).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40Ni4wIiwidXBkYXRlZEluVmVyIjoiMzcuNDYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: nickofthyme <nicholas.partridge@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-12-13 14:56:54 -05:00
Christiane (Tina) Heiligers
13434dc28e
Adds run without basepath configured to examples readme (#173086)
Kibana crashes when running the examples with a basepath configured with
too many redirects during auth.
This PR warns about that in the examples/README

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-12-12 11:22:02 -07:00
Jeramy Soucy
835d4aff4c
Implements Encrypted Saved Objects Model Version API (#166302)
Closes #161002
Closes #170073

## Summary

This PR implements a createModelVersion API in the Encrypted Saved
Objects plugin to support upward migrations for model version encrypted
saved objects.

Much like how the `createMigration` API provided a way to wrap migration
functions to support migration of encrypted saved objects prior to the
model version paradigm, the new `createModelVersion` API provides a way
to wrap a model version definition for the same purpose.

`createModelVersion` manipulates the changes defined for a model version
('unsafe_transform', 'data_backfill', 'data_removal'), merging them into
a single transform function in which the saved object document is
decrypted, transformed, and then encrypted again. The document is
decrypted with the `encrypted saved object type registration` provided
by the required `inputType` parameter. Similarly, the document is by
encrypted with the `encrypted saved object type registration` provided
by the required `outputType` parameter.

An example plugin (`examples/eso_model_version_example`) provides a
demonstration of how the createModelVersion API should be used. The UI
of the example plugin gives an idea of what the encrypted saved objects
look like before and after the model version changes are applied.

## Testing

### Manual Testing
- Modify the example plugin implementation in
`examples/eso_model_version_example` to include different changes or
additional model versions.

### Unit Tests
-
`x-pack/plugins/encrypted_saved_objects/server/create_model_version.test.ts`

### Functional Tests
-
`x-pack/test/encrypted_saved_objects_api_integration/tests/encrypted_saved_objects_api.ts`
-
`x-pack/test/encrypted_saved_objects_api_integration/tests/encrypted_saved_objects_decryption.ts`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-12-07 16:01:29 -05:00
Tim Sullivan
f044bcccdb
[shared-ux] no-data analytics page package code cleanup (#172416)
## Summary

1. Update "type" in kibana.jsonc files where applicable for improvement
to developer experience.
2. Create `@kbn/content-management-table-list-view-table-common` package
and update imports

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-12-04 13:07:59 -07:00
Alejandro Fernández Haro
fd09c26d15
async-import plugins in the server side (#170856)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-11-15 00:55:56 -07:00
Julia Rechkunova
145cc8f13b
[Discover] Show "unsaved changes" label when in unsaved state of saved search (#169548)
- Resolves https://github.com/elastic/kibana/issues/135887

## Summary

This PR adds "Unsaved changes" badge to Discover for modified saved
searches. It also removes "Reset search" button from the histogram area.
Code for the badge is added to a new package
`@kbn/unsaved-changes-badge`.

<img width="600" alt="Screenshot 2023-10-23 at 18 05 34"
src="ad200a28-79e1-4cc5-8e28-6352d4b85322">

![Oct-23-2023
18-06-39](cacf4ff2-525c-4759-aba9-34ce75089ddd)


### 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
- [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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-11-13 13:36:25 +01:00
Eyo O. Eyo
f27427b949
Removes duplicated RedirectAppLinks component (#170304)
## Summary

This PR removes the [duplicated RedirectAppLinks
component](https://github.com/elastic/kibana/blob/v8.10.4/src/plugins/kibana_react/public/app_links/redirect_app_link.tsx)
which has been marked as deprecated since
74a00fad20.

All references to the previous import declaration from
`@kbn/kibana-react-plugin/public` have been replaced with
`@kbn/shared-ux-link-redirect-app`, this change ensures that the current
app behaviour is preserved, and changes to match the expectation of the
new component have been applied where necessary.

Changes relating to the new `RedirectAppLinks` component; 
- The component does not accept a `className` anymore as it is not a
presentational component despite it being used as one previously,
there's change to make accommodation for how it had been used.
- The component introduces a`data-test-subj` attribute with the value
`kbnRedirectAppLink` on the dom node that wraps it's children.


### 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)~
-->
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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

<!--
~- [ ] 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&mdash;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&mdash;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>
2023-11-13 10:17:13 +01:00
Tim Sullivan
09f4708de4
Functional tests for KibanaErrorBoundary (#170569)
Part of https://github.com/elastic/kibana-team/issues/646

This PR adds an example plugin in `examples/error_boundary` that shows
usage of KibanaErrorBoundary.

The example plugin is used in a functional test to ensure errors are
caught in the appropriate way, and error messages include a working
Refresh button.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-11-08 11:23:19 -07:00
Pierre Gayvallet
d64e246cb7
Change signature of Plugin.stop to maybe async (#170225)
## Summary

Fix https://github.com/elastic/kibana/issues/83612

This PR doesn't change any behavior, as we're already supporting (and
awaiting) promises returned from `stop` calls to plugin, it just changes
the type's signature to reflect that.

Also removed empty `stop` methods from existing plugins to make
typescript happy.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-11-06 01:38:19 -07:00
Alison Goryachev
2b1cd4d080
Disable guided onboarding on serverless (#168303) 2023-11-03 13:11:05 -04:00