Skip to content

Conversation

@Supplementing
Copy link
Contributor

Summary

🚧 WIP 🚧

TODO:

Closes #238091

This PR cleans up the agent actions menus in the agent table row, the bulk actions, and the agent details page.

Each actions menu was just different enough that unifiying them into one reusable component was not feasible. We would have lots of conditional rendering work based on where the component was being used, etc. Each one has different items, callbacks, etc.

With this in mind, and also taking notice that EUI already handles menu-nesting, I instead decided to create a reusable actions menu component that wraps up the popover, trigger (button), and context menu. It renders the button (with the styling configurable via props), allows you to set popover direction, and automatically handles nesting of children items in the menus. So from a DX perspective, we will still create MenuItems arrays in each of the three places, but we wont need to worry with building the UI in the array, just pass in an object like:

      {
        id: 'upgrade-management',
        name: (
          <FormattedMessage
            id="xpack.fleet.agentBulkActions.upgradeManagement"
            defaultMessage="Upgrade management"
          />
        ),
        panelTitle: 'Upgrade management',
        children: [
          {
            id: 'schedule-upgrade',
            name: (
              <FormattedMessage
                id="xpack.fleet.agentBulkActions.scheduleUpgradeAgents"
                defaultMessage="Schedule upgrade for {agentCount, plural, one {# agent} other {# agents}}"
                values={{ agentCount }}
              />
            ),
            icon: 'timeRefresh',
            disabled: !authz.fleet.allAgents || !isLicenceAllowingScheduleUpgrade,
            onClick: () => {
              setUpgradeModalState({ isOpen: true, isScheduled: true, isUpdating: false });
            },
            'data-test-subj': 'agentBulkActionsScheduleUpgrade',
          },

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Identify risks

Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.

@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!

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.

[Fleet] Agent actions menus redesign

2 participants