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

[Beats CM] Re-arch table assignment control definitions #23663

Conversation

justinkambic
Copy link
Contributor

Changes

The goal of these changes is to simplify the definition of assignment options for tables, and to make the components that handle the options and their associated actions more generic.

The layout and associated properties of the assignment options can now be defined like this:

export const beatsListAssignmentOptions: AssignmentControlSchema[] = [
  {
    type: AssignmentComponentType.Action,
    grow: false,
    name: 'Disenroll selected',
    showWarning: true,
    warningHeading: 'Disenroll beats',
    warningMessage: 'This will disenroll the selected beat(s) from centralized management',
    action: AssignmentActionType.Delete,
    danger: true,
  },
  {
    type: AssignmentComponentType.Popover,
    name: 'Set tags',
    grow: false,
    lazyLoad: true,
    children: [
      {
        name: 'Assign tags',
        type: AssignmentComponentType.TagBadgeList,
      },
    ],
  },
  {
    type: AssignmentComponentType.SelectionCount,
    grow: true,
    name: 'selectionCount',
  },
];

Any objects and an action handler are specified at the declaration of the table component:

<Table
  assignmentOptions={{
    items: this.state.tags || [],
    schema: beatsListAssignmentOptions,
    type: 'assignment',
    actionHandler: this.handleBeatsActions
  }}
  items={sortBy(this.state.beats, 'id') || []}
  ref={this.state.tableRef}
  type={BeatsTableType}
/>

There're three ways to display assignment options:

  • none:
    There are no controls displayed for the table.
    image

  • primary:
    When items are selected, the option is displayed next to the normal controls. This is appropriate when the controls perform actions only on the selected objects.
    image

  • assignment:
    When items are selected, the actions replace the normal controls. This is appropriate when there will be association between the table's selected objects and some other list of objects or resources.
    image

@elasticmachine
Copy link
Contributor

💔 Build Failed

@justinkambic justinkambic force-pushed the ui/switch-table-assignment-to-use-schemas branch from 63134f6 to f8f9509 Compare October 11, 2018 13:56
@justinkambic
Copy link
Contributor Author

@mattapperson I've updated this PR with significant additions after merging in the latest changes to the feature branch - so it may be worth an additional look before we merge.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@mattapperson
Copy link
Contributor

LGTM

@justinkambic justinkambic merged commit 234eae0 into elastic:feature/x-pack/management/beats Oct 16, 2018
@justinkambic justinkambic deleted the ui/switch-table-assignment-to-use-schemas branch October 16, 2018 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants