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] Added the InlineEditableTable component #107208

Merged
merged 16 commits into from
Jul 29, 2021

Conversation

JasonStoltz
Copy link
Member

@JasonStoltz JasonStoltz commented Jul 29, 2021

Summary

This is a component required by the Crawler view. It is a wrapper around the ReorderableTable component. It adds CRUD operations for the items in the table.

This commit history in this PR is NOT very coherent. This PR unfortunately will likely need to be reviewed as one big diff.

While this is mostly a port from the component of the same name from ent-search, there are a few key changes that I made along the way:

  1. Firstly, I pulled this component into many smaller components and utilities to better isolate and test individual parts of this table. I tried to simplify these parts as I went, so they may look a bit different than the original.
  2. I changed this table to not rely on EUI table types. I found that it made the types hard to follow. I (hopefully) have simplified types and made them more explicit in this PR.
  3. The old component let you specify which field on an Item acted as the unique "id" field of that item. I dropped that and instead we are requiring that all items used with this component have an "id" field. This was for simplicity.
  4. The logic is now a "keyed" logic, and we are using BindLogic so that we can use the logic in sub-components without having to pass through the key (and other props) down through the component tree.

To get an idea of what all of the scenarios that this component can be used for, please check out both the unit tests and the component library.

latest

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@JasonStoltz JasonStoltz requested a review from a team July 29, 2021 17:15
@JasonStoltz JasonStoltz requested a review from a team as a code owner July 29, 2021 17:15
@JasonStoltz JasonStoltz requested a review from a team July 29, 2021 17:15
@JasonStoltz JasonStoltz added auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes v7.15.0 labels Jul 29, 2021
Comment on lines +35 to +37
// TODO This could likely be a selector
isEditing: boolean;
// TODO we should editingItemValue have editingItemValue and editingItemId should be a selector
Copy link
Member

@cee-chen cee-chen Jul 29, 2021

Choose a reason for hiding this comment

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

Just to check, I'm seeing 7 TODO type comments in the full diff - were they left in intentionally for a future PR or did you want to address them before merge?

Copy link
Member Author

Choose a reason for hiding this comment

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

I left them in as something we could do later at some point. Not critical though. I'm not doing them in this PR in any case, so if you'd prefer I'm happy to just remove them.

Copy link
Member

Choose a reason for hiding this comment

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

Nope, I think they serve well as future TODOs!

@byronhulcher byronhulcher self-requested a review July 29, 2021 18:12
Copy link
Contributor

@byronhulcher byronhulcher left a comment

Choose a reason for hiding this comment

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

I still need to QA this but it looks good. There are a bunch of todos as @constancecchen pointed out, is the plan to address those in a future PR for GenericEndpointInlineEditableTable or as tech debt down the road?

/>
);
const bindLogic = wrapper.find(BindLogic);
expect(bindLogic.props()).toEqual(
Copy link
Contributor

Choose a reason for hiding this comment

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

🤯

>;

export const InlineEditableTableLogic = kea<InlineEditableTableLogicType<ItemWithAnID>>({
path: (key: string) => ['enterprise_search', 'inline_editable_table_logic', key],
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember losing so much time before realizing I had to use a function for the path

Copy link
Member

Choose a reason for hiding this comment

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

I remember Byron swooping in like an eagle and solving this for me! 🎉

import { Column } from '../reorderable_table/types';

export interface FormErrors {
[key: string]: string | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this needs the | undefined. This should be equivalent to

export interface FormErrors {
  [key: string]: string;
}

I think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point

@byronhulcher
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@byronhulcher byronhulcher left a comment

Choose a reason for hiding this comment

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

Thanks @JasonStoltz!

@JasonStoltz JasonStoltz enabled auto-merge (squash) July 29, 2021 20:49
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
enterpriseSearch 1448 1464 +16

Async chunks

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

id before after diff
enterpriseSearch 2.1MB 2.1MB +4.5KB

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

@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 29, 2021
kibanamachine added a commit that referenced this pull request Jul 30, 2021
…#107247)

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
streamich pushed a commit to vadimkibana/kibana that referenced this pull request Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes v7.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants