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

Fixes #36846 - Override REX job names for package install by search #10772

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Oct 19, 2023

What are the changes introduced in this pull request?

Previously, REX job names for bulk package installs were Katello database IDs, e.g. the description for the job would be "Install package(s) id ^ (2196)" or some such.

This change overrides that default description to actually display the package names, in most cases. (see considerations below)

image

Descriptions have been updated for

  • bulk update
  • bulk install
  • bulk remove

Considerations taken when implementing this change?

There are some .. nuances here. As you may know, we have a useBulkSelect React hook that allows us to store information about which items are selected. It can either be in "normal" mode, or "Select all" mode. The behavior changes depending on the mode.

"Normal" mode - A set of numeric IDs is stored (selectionSet), representing every item the user has selected. (These are typically the database ID, not the table row number.) This is how we start out. You can also click "select page" to select all items on the current page, and you'll remain in normal mode. Conveniently, when using selectionSet, we also record the selected items' other data, including package names in this case, and store it in a variable called selectedResults.

"Select all" mode - You can click the Select All checkbox to select all items on all pages. Since the front end hasn't yet downloaded the list of all the IDs for all pages, we don't yet know the complete list-- we just know that the user has indicated to select everything. When we enter "Select all" mode, we stop using the selectionSet and just say, "ok, everything is selected." But what if the user now wants to deselect some items? We then have to start populating an exclusionSet, which you can think of as the opposite of selectionSet. It's basically saying that the user has selected everything except these IDs. However, when using exclusionSet we don't currently have the benefit of having stored selectedResults.

Long story short: In this PR, we take advantage of selectedResults to provide nice REX job descriptions where we can. So what about "Select all" mode?

  • Bulk update: If you've actually selected everything, the message will read 'Update all packages.' Otherwise, we don't know the package names of the ones you've deselected, so the message will just read 'Update lots of packages.'
  • Bulk install: Technically "Select all" mode works if you want to install all of the thousands of packages available to a host. But that's, like, insane and real users would never do that, right? so I didn't do anything special here. I think it would just say 'Install package(s)'
  • Bulk remove: "Select all" mode is actually disabled for bulk remove (we do have limits!) so no worries here.

For errata REX jobs, this isn't as much of a problem because that already uses the somewhat more friendly "Errata ID" field, instead of the database ID.

What are the testing steps for this pull request?

To test this, you don't actually have to be able to communicate with the host. But you do have to have REX set up.

Test all of the scenarios and make sure you get the expected messages

@lfu
Copy link
Member

lfu commented Oct 23, 2023

Normal mode:
image

All mode:
image

Copy link
Member

@lfu lfu left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

@jeremylenz jeremylenz force-pushed the 36846-what-packages-are-those branch from 8ef6a08 to 1bcbe18 Compare October 23, 2023 19:59
@jeremylenz
Copy link
Member Author

fixed tests

@jeremylenz jeremylenz force-pushed the 36846-what-packages-are-those branch from 1bcbe18 to 2ac796b Compare October 23, 2023 20:07
@jeremylenz
Copy link
Member Author

[test katello]

@jeremylenz jeremylenz merged commit 586f2fe into Katello:master Oct 25, 2023
5 checks passed
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.

2 participants