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

[Data View Editor] Replace EmptyIndexPatternPrompt with NoDataViews component #126491

Closed
wants to merge 4,549 commits into from

Conversation

majagrubic
Copy link
Contributor

@majagrubic majagrubic commented Feb 28, 2022

Summary

This PR replaces the EmptyIndexPatternPrompt component with the NoDataViews component from the shared-ux plugin. Since all plugins should use the shared-ux component now, no need to maintain the two components

The problem with DataViewEditor consuming SharedUX bundle directly is that it would create a circular dependency, since SharedUX had a dependency on DataViewEditor. In order to overcome that, I've created a separate shared_ux_components plugin that would contain only pure components and have no external dependencies. But I don't really like this approach, so open to suggestions.

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

FrankHassanabad and others added 30 commits February 28, 2022 10:44
… from saved objects to exception lists (elastic#125182)

## Summary

Exposes the functionality of
* search_after
* point in time (pit)

From saved objects to the exception lists. This _DOES NOT_ expose these to the REST API just yet. Rather this exposes it at the API level to start with and changes code that had hard limits of 10k and other limited loops. I use the batching of 1k for this at a time as I thought that would be a decent batch guess and I see other parts of the code changed to it. It's easy to change the 1k if we find we need to throttle back more as we get feedback from others.

See this PR where `PIT` and `search_after` were first introduced: elastic#89915
See these 2 issues where we should be using more paging and PIT (Point in Time) with search_after: elastic#93770 elastic#103944

The new methods added to the `exception_list_client.ts` client class are:
* openPointInTime
* closePointInTime
* findExceptionListItemPointInTimeFinder
* findExceptionListPointInTimeFinder
* findExceptionListsItemPointInTimeFinder
* findValueListExceptionListItemsPointInTimeFinder

The areas of functionality that have been changed:
* Exception list exports
* Deletion of lists
* Getting exception list items when generating signals

Note that currently we use our own ways of looping over the saved objects which you can see in the codebase such as this older way below which does work but had a limitation of 10k against saved objects and did not do point in time (PIT)

Older way example (deprecated):
```ts
  let page = 1;
  let ids: string[] = [];
  let foundExceptionListItems = await findExceptionListItem({
    filter: undefined,
    listId,
    namespaceType,
    page,
    perPage: PER_PAGE,
    pit: undefined,
    savedObjectsClient,
    searchAfter: undefined,
    sortField: 'tie_breaker_id',
    sortOrder: 'desc',
  });
  while (foundExceptionListItems != null && foundExceptionListItems.data.length > 0) {
    ids = [
      ...ids,
      ...foundExceptionListItems.data.map((exceptionListItem) => exceptionListItem.id),
    ];
    page += 1;
    foundExceptionListItems = await findExceptionListItem({
      filter: undefined,
      listId,
      namespaceType,
      page,
      perPage: PER_PAGE,
      pit: undefined,
      savedObjectsClient,
      searchAfter: undefined,
      sortField: 'tie_breaker_id',
      sortOrder: 'desc',
    });
  }
  return ids;
```

But now that is replaced with this newer way using PIT:
```ts
  // Stream the results from the Point In Time (PIT) finder into this array
  let ids: string[] = [];
  const executeFunctionOnStream = (response: FoundExceptionListItemSchema): void => {
    const responseIds = response.data.map((exceptionListItem) => exceptionListItem.id);
    ids = [...ids, ...responseIds];
  };

  await findExceptionListItemPointInTimeFinder({
    executeFunctionOnStream,
    filter: undefined,
    listId,
    maxSize: undefined, // NOTE: This is unbounded when it is "undefined"
    namespaceType,
    perPage: 1_000,
    savedObjectsClient,
    sortField: 'tie_breaker_id',
    sortOrder: 'desc',
  });
  return ids;
```

We also have areas of code that has perPage listed at 10k or a constant that represents 10k which this removes in most areas (but not all areas):
```ts
      const items = await client.findExceptionListsItem({
        listId: listIds,
        namespaceType: namespaceTypes,
        page: 1,
        pit: undefined,
        perPage: MAX_EXCEPTION_LIST_SIZE, // <--- Really bad to send in 10k per page at a time
        searchAfter: undefined,
        filter: [],
        sortOrder: undefined,
        sortField: undefined,
      });
```

That is now:
```ts
      // Stream the results from the Point In Time (PIT) finder into this array
      let items: ExceptionListItemSchema[] = [];
      const executeFunctionOnStream = (response: FoundExceptionListItemSchema): void => {
        items = [...items, ...response.data];
      };

      await client.findExceptionListsItemPointInTimeFinder({
        executeFunctionOnStream,
        listId: listIds,
        namespaceType: namespaceTypes,
        perPage: 1_000,
        filter: [],
        maxSize: undefined, // NOTE: This is unbounded when it is "undefined"
        sortOrder: undefined,
        sortField: undefined,
      });
```

Left over areas will be handled in separate PR's because they are in other people's code ownership areas.

### 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
…d is visualized with visualizeGeoFieldAction (elastic#123540)

* elastic#121908 - Maps usage tracking feature

* #e-121908 - refactoring; Added naming constants for used apps;

* elastic#121908 - updates for UiCounterMetricType, schema, metric analytics

* elastic#121908 - refactoring; Fixed import syntax, type in report

* elastic#121908 - refactoring

* elastic#121908 - refactoring

* 121908 - refactoring

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…etric unified renderer (elastic#125251)

* Add `labelFont` and `LabelPosition` args in metric expression

* Fix CI

* Fixed remarks

* Some fixes

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…tic#124124)

* Add lens config options

* wip

* Pr feedback

* simplify align

* improve typing

* update typing

* PR feedback

* Design PR feedback

* snapshot

* update snap

* design suggestions

* Use bottom as default position for title and some other small refactoring

* Fix test

* Fix shapshot

* Fix shapshot

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Uladzislau Lasitsa <Uladzislau_Lasitsa@epam.com>
* Shape argument turned to required.

* Added checks for the gauge arguments.

* Moved (metric/min/max/goal)Accessor arguments to (metric/min/max/goal).

* Split gauge and lens state.

* Added support of vis_dimensions.

* Some fixes for uniformity.

* Moved findAccessor out of dimensions.

* Made accessors/vis_dimension functionality reusable for other plugins.

* Fixed test snapshots.

* Fixed snapshots.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* use discover locator in obs plugin

* move import up
…_range, number_range and date_range (elastic#125389)

* allow last value, min and max on dates

* fix tests

* fix typo

* fix tests

* nit

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Replaces previous `config.get` pattern typed to `string | undefined` with a full `MonitoringConfig` type.
* added loading spinner to add agent flyout

* fixed create agent policy scenario
elastic#125772)

**Addresses:** elastic#125502

## Summary

Removed the `rulesBulkEditEnabled` experimental flag from the config and its usage from the client-side code.
[Workplace Search] Add indexing rules table
)

* readded missing packages to keep up to date list

* rename
…bug (elastic#124909)

### Summary

Addresses elastic#124742

#### Issue TLDR
Import of rules that reference exception items with comments fail. Failure message states that comments cannot include `created_at`, `created_by`, `id`.
Co-authored-by: Tyler Smalley <tyler.smalley@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…ted_field.json (elastic#125321)

* remove es_archive with kbn_archive invalid_scripted_field.json

* remove unused es_archive files

* replace another usage of es_archives/invalid_scripted_field

* clear any existing index patterns before loading our new one

* remove .only

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…est (elastic#125784)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [Snapshot & Restore] Fix repository types on Cloud

* [Snapshot & Restore] Move repo types tests into `on-prem` describe block

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Andrea Del Rio <delrio.andre@gmail.com>
…5673)

* Move stripping unsafe headers to the screenshotting plugin
* Encapsulate conditional headers handling in the screenshotting plugin
* Add KibanaRequest support on input
@majagrubic majagrubic changed the title Data view editor/no data views [Data View Editor] Replace EmptyIndexPatternPrompt with NoDataViews component Feb 28, 2022
@majagrubic majagrubic force-pushed the data-view-editor/no-data-views branch 2 times, most recently from 040b11e to e5a527b Compare March 2, 2022 15:20
@majagrubic majagrubic force-pushed the data-view-editor/no-data-views branch from e5a527b to da2dee8 Compare March 2, 2022 15:21
@kibana-ci
Copy link
Collaborator

kibana-ci commented Mar 3, 2022

💔 Build Failed

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dataViewEditor 86 73 -13
sharedUX 47 31 -16
sharedUXComponents - 26 +26
total -3

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
sharedUXComponents - 8 +8

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dataViewEditor 115.5KB 38.2KB -77.3KB
sharedUX 100.5KB 9.2KB -91.3KB
sharedUXComponents - 89.5KB +89.5KB
total -79.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dataViewEditor 10.7KB 10.8KB +149.0B
sharedUX 4.7KB 4.8KB +46.0B
sharedUXComponents - 5.3KB +5.3KB
total +5.5KB
Unknown metric groups

API count

id before after diff
sharedUXComponents - 12 +12

async chunk count

id before after diff
dataViewEditor 2 1 -1
sharedUX 3 2 -1
sharedUXComponents - 1 +1
total -1

ESLint disabled in files

id before after diff
dataViewEditor 3 2 -1
sharedUXComponents - 1 +1
total -0

Total ESLint disabled count

id before after diff
dataViewEditor 5 4 -1
sharedUXComponents - 1 +1
total -0

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@majagrubic
Copy link
Contributor Author

closing in favor of: #127941

@majagrubic majagrubic closed this Mar 17, 2022
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.