Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Add support for customizing profile context #9

Closed

Conversation

davismcphee
Copy link
Owner

Summary

WIP.

Checklist

For maintainers

@davismcphee davismcphee self-assigned this Oct 31, 2024
@davismcphee davismcphee force-pushed the discover-custom-context branch from 4cb58ab to c227122 Compare November 2, 2024 00:52
elastic-renovate-prod bot and others added 13 commits November 5, 2024 15:52
…on creating New Knowledge Base index. (elastic#198892) (elastic#199045)

## Summary

BUG: elastic#198892

This PR fixes the BUG where we would show `Duplicate entry?`
confirmation modal on new document creation. This happens because the
state is not being reset properly on flyout close and we use previous
values in the new entry creation flow.

### To test

1. Create a global entry (document or index)
2. Edit the entry from 1
3. Switch global to private
4. Save entry => This will trigger `Duplicate entry?` confirmation modal
(save it)
5. Press `New > Index/Document`
6. Fill out required fields
7. Press `Save` button

### 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 (elastic#198735)

## Summary

This PR aims to fix Flaky tests related to agentless detected by
elastic#189038 and
elastic#192126 by adding proper
handling of the `waitFor` methods.

It was also detected with
elastic/security-team#10979 that some other
methods were not proper handled by `waitFor`, leading to the assertions
inside those unhandled `waitFor` being skipped by Jest.

This PR also introduces ESLint to enforce proper handling of waitFor
methods in tests files for Fleet and Cloud Security plugins.

Additional note: These changes should also unblock the failing tests on
the [React18 use waitFor with assertion callbacks in place of
waitForNextUpdate](elastic#195087) PR


**Fleet changes**

- ESLint rule added to enforce handling `waitFor` on React Testing
Library.
- `useSetupTechnology` hook tests reviewed and updated to handle the
waitFor. Fixed issue identified when reviewing the tests.
- step_define_package_policy.test.tsx: Added package policy vars to the
mock to proper handle the use cases
- step_select_hosts.test.tsx: Handled waitFor, identified outdated test
- step_edit_hosts.test.tsx: Handled waitFor, identified outdated test
With the introduction of the ESLint rule other tests were triggering
ESLint errors, I attempted to fix them while retaining the same
intention, let me know if more changes are needed.

**Cloud Security changes**

- ESLint rule added to enforce handling `waitFor` on React Testing
Library.
- Updated cloud security posture version to include agentless global
tags on End to End tests

**@elastic/kibana-operations changes**

- Added
[eslint-plugin-testing-library](https://testing-library.com/docs/ecosystem-eslint-plugin-testing-library/)
an ESLint plugin for Testing Library that helps users to follow best
practices and anticipate common mistakes when writing tests.
- The adoption and enablement of the rules are opt-in.
…ble (elastic#197453)

## Summary

Closes elastic#184631

It keeps the chart configuration when the user is doing actions
compatible with the current query such as:

- Adding a where filter (by clicking the table, the sidebar, the chart)
- Changes the breakdown field and the field type is compatible with the
current chart
- Changing to a compatible chart type (from example from bar to line or
pie to treemap)
- Changing the query that doesnt affect the generated columns mapped to
a chart. For example adding a limit or creating a runtime field etc.

The logic depends on the suggestions. If the suggestions return the
preferred chart type, then we are going to use this. So it really
depends on the api and the type / number of columns. It is as smarter as
it can in order to not create bugs. I am quite happy with the result. It
is much better than what we have so far.


![meow](https://github.com/user-attachments/assets/c4249e5e-e785-4e57-8651-d1f660f5a61a)

### Next steps
I would love to do the same on the dahsboard too, needs more time
though. But the changes made here will def work in favor

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

---------

Co-authored-by: Marta Bondyra <[email protected]>
Adds a placeholder pipeline for `kibana / package registry promote`.

Initially, in a follow up PR, this will run a daily promotion of
`docker.elastic.co/package-registry/distribution:lite` to the kibana-ci
namespace. We can also run some verification steps if desired.

The distribution is a relatively large image, and nearly always running
uncached on CI due to the update frequency. This should help us balance
having an up to date image and avoiding cache misses.
## Summary

This PR adds a `getRenderAppWrapper` extension to Discover to support
advanced state management use cases. It also includes new documentation
for the extension point, and overriding default profile implementations:


https://github.com/user-attachments/assets/70633cbb-1cfe-47fe-984e-ba8afb18fc90

To test, add the following config to `kibana.dev.yml`:
```yml
discover.experimental.enabledProfiles:
  [
    'example-root-profile',
    'example-solution-view-root-profile',
    'example-data-source-profile',
    'example-document-profile',
  ]
```

Then ingest demo logs and run this in dev tools:
```
POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "kibana_sample_data_logs",
        "alias": "my-example-logs"
      }
    }
  ]
}
```

Flaky test runs:
- 🔴 x25:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7238
- 🔴 x25:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7289
- 🟢 x25:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7291
- x25:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7303

### 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)
- [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
- [x] [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#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Julia Rechkunova <[email protected]>
@davismcphee davismcphee force-pushed the discover-custom-context branch from 62b9435 to 8e25d89 Compare November 6, 2024 01:04
@davismcphee davismcphee closed this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants