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

[Enterprise Search] Migrate shared components used in Workplace Search Groups #76345

Merged

Conversation

scottybollinger
Copy link
Contributor

@scottybollinger scottybollinger commented Sep 1, 2020

Summary

This PR migrates the shared components that are needed for the migration of the Workplace Search Groups section of the admin dashboard to Kibana.

The following components are being migrated as a part of this PR:

As a part of this PR, the types and constants used by Workplace Search were ported over.

These components were migrated with no changes to the logic and tests were added.

In addition, the main functionality we were using from react-router-named-routes has been dropped in favor of React Router's generatePath. The reasoning behind this is that the plugin has no TypeScript support and has not been updated in years.

Any styles that are needed for the components will be included in the main Groups migration PR.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

We need a way to format routes using parametrized routes in Workplace Search. We used to the `react-router-named-routes` library, but it is 5 years old has has no typings. I extracted the function we needed into a util.
For the 7.9 Kibana MVP, we used a temporary function to generate this route. Aligning this component to use the helper other parts of the app will use after migration.
Various types and constants migrated for use in groups component
Also adds a mock for contentSources. For now the array only has one item needed for this test, but in future tests, more sources will be added to that array.
@scottybollinger scottybollinger added Feature:Plugins release_note:skip Skip the PR/issue when compiling release notes v7.10.0 labels Sep 1, 2020
@scottybollinger scottybollinger deleted the groups-shared-components branch September 1, 2020 03:40
@scottybollinger scottybollinger restored the groups-shared-components branch September 1, 2020 12:50
@scottybollinger
Copy link
Contributor Author

This was closed by accident

Uses Object.entries instead of for…in. This is more modern and allows for 100% test coverage.

Also removed `toString()` as `encodeURIComponent()` seems to automatically cast to string
We’re not returning anything so map is not needed
Copy link
Contributor

@yakhinvadim yakhinvadim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I don't have many comments.

Unike formatRoute, generatePath adds the trailing slash automatically
@scottybollinger
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@yakhinvadim yakhinvadim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
enterpriseSearch 372.4KB +150.0B 372.3KB

History

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

@scottybollinger scottybollinger merged commit 6f94bf7 into elastic:master Sep 2, 2020
@scottybollinger scottybollinger deleted the groups-shared-components branch September 2, 2020 18:55
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 76345 or prevent reminders by adding the backport:skip label.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 4, 2020
scottybollinger added a commit to scottybollinger/kibana that referenced this pull request Sep 4, 2020
…h Groups (elastic#76345)

* Add shared images and export file

* Migrate SourceIcon component

* Add util to format routes

We need a way to format routes using parametrized routes in Workplace Search. We used to the `react-router-named-routes` library, but it is 5 years old has has no typings. I extracted the function we needed into a util.

* Update recent_activity to use formatRoute

For the 7.9 Kibana MVP, we used a temporary function to generate this route. Aligning this component to use the helper other parts of the app will use after migration.

* Add types and constants

Various types and constants migrated for use in groups component

* Migrate SourceRow component

Also adds a mock for contentSources. For now the array only has one item needed for this test, but in future tests, more sources will be added to that array.

* Migrate SourcesTable component

* Migrate TablePaginationBar component

* Migrate UserIcon component

* Migrate UserRow component

* Refactor format_route

Uses Object.entries instead of for…in. This is more modern and allows for 100% test coverage.

Also removed `toString()` as `encodeURIComponent()` seems to automatically cast to string

* Remove unused import

* Use forEach instead of map

We’re not returning anything so map is not needed

* Minify images

* Remove formatRoute in favor of generatePath

Unike formatRoute, generatePath adds the trailing slash automatically

* Stop renaming methods

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 4, 2020
scottybollinger added a commit that referenced this pull request Sep 4, 2020
…h Groups (#76345) (#76817)

* Add shared images and export file

* Migrate SourceIcon component

* Add util to format routes

We need a way to format routes using parametrized routes in Workplace Search. We used to the `react-router-named-routes` library, but it is 5 years old has has no typings. I extracted the function we needed into a util.

* Update recent_activity to use formatRoute

For the 7.9 Kibana MVP, we used a temporary function to generate this route. Aligning this component to use the helper other parts of the app will use after migration.

* Add types and constants

Various types and constants migrated for use in groups component

* Migrate SourceRow component

Also adds a mock for contentSources. For now the array only has one item needed for this test, but in future tests, more sources will be added to that array.

* Migrate SourcesTable component

* Migrate TablePaginationBar component

* Migrate UserIcon component

* Migrate UserRow component

* Refactor format_route

Uses Object.entries instead of for…in. This is more modern and allows for 100% test coverage.

Also removed `toString()` as `encodeURIComponent()` seems to automatically cast to string

* Remove unused import

* Use forEach instead of map

We’re not returning anything so map is not needed

* Minify images

* Remove formatRoute in favor of generatePath

Unike formatRoute, generatePath adds the trailing slash automatically

* Stop renaming methods

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Plugins release_note:skip Skip the PR/issue when compiling release notes v7.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants