-
Notifications
You must be signed in to change notification settings - Fork 991
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 #36822 - Design new hosts overview page #9860
Conversation
1ab4260
to
4462bb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's finally here! 🥳
A couple things I noticed to start:
- Search works, but autocomplete doesn't
- Kebab is too far to the right
webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/Table.js
Show resolved
Hide resolved
|
||
const customActionKebabs = [ | ||
{ | ||
title: __('Change content source'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should actually be in Katello since it's linking to a Katello page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should set this up similar to the way it's already done for host details.
Exported from Katello to Foreman here -> https://github.com/Katello/katello/blob/a57828483396b6e02e4b6d849202a0253abe9004/webpack/global_index.js#L70
Consumed here in Foreman ->
foreman/webpack/assets/javascripts/react_app/components/HostDetails/ActionsBar/Selectors.js
Line 6 in d329c93
selectComponentByWeight('host-details-kebab'); |
which is then rendered here ->
foreman/webpack/assets/javascripts/react_app/components/HostDetails/ActionsBar/index.js
Line 49 in d329c93
const registeredItems = useSelector(selectKebabItems, shallowEqual); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Also: Should add a setting "Use new All Hosts page" or some such, which will control whether the All Hosts link in the main nav goes to the new or the old page. |
Updated the menu |
webpack/assets/javascripts/react_app/components/HostsIndex/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/HostsIndex/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/HostsIndex/index.js
Outdated
Show resolved
Hide resolved
|
||
const registeredItems = useSelector(selectKebabItems, shallowEqual); | ||
const customToolbarItems = ( | ||
<ForemanHostsIndexActionsBarContext.Provider value={{...selectAllOptions, fetchBulkParams}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳 🚀
4df18f7
to
06ffbac
Compare
const response = useAPI( | ||
'get', | ||
`${MODELS_API_PATH}?include_permissions=true`, | ||
{ | ||
key: API_REQUEST_KEY, | ||
} | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didnt check the rest of the PR, but can we not move this out of the table? the reason for the table component is so other components will not handle api calls.
Also this change breaks webhooks which also use the table component (https://github.com/theforeman/foreman_webhooks/blob/master/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/WebhooksIndexPage.js)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It made a lot more sense to me and @parthaa to move it up one level. This way the host-specifc parts (including the host API call) are in the host table component, while the generic table parts are in the table component. Not having access to response
in the hosts table caused a lot of problems.
Perhaps we could leave it as is and update webhooks instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cant the code use redux selectors to access the response
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a possibility, just seemed a bit less elegant to me.
Personally I feel like needing to access response
thru Redux defeats the whole purpose of useAPI.
@parthaa thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it in the latest commit. Secret sauce here is this line
let response = useAPI(
replacementResponse ? null : 'get',
apiUrl.includes('include_permissions')
? apiUrl
: `${apiUrl}?include_permissions=true`,
{
...apiOptions,
params: defaultParams,
}
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method being null implies that useAPI effects wont do anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some silly nits
.../assets/javascripts/react_app/components/PF4/TableIndexPage/Table/SelectAllCheckbox/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/TableHooks.js
Outdated
Show resolved
Hide resolved
controller="hosts" | ||
isDeleteable | ||
columns={columns} | ||
creatable={false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is creatable
false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think on the Hosts Index page we need create button as the same level as Hosts header. So decided to add that to the HostIndex component and not use TableIndex for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will that be added in a different pr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, we'll be adding Delete right after this PR :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the create? 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, misread that!
I can add create in the same PR, if partha doesn't add it here
app/helpers/application_helper.rb
Outdated
@@ -415,6 +415,7 @@ def ui_settings | |||
labFeatures: Setting[:lab_features], | |||
safeMode: Setting[:safemode_render], | |||
displayFqdnForHosts: Setting[:display_fqdn_for_hosts], | |||
displayNewHostsPage: Setting[:new_hosts_page] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put this under User settings, since lab features is there too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? its showing "no results - loading" |
'No results' is a lie if it's still loading. We don't know the number of results until it loads. anyway, we can fix this later, I'm not gonna block on this one :) |
Decided to leave for follow-up PR: Multi-delete @parthaa can you please squash the commits and fix lint :) |
d005c3f
to
cc2bc38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APJ. Let's get this in and continue on, since this will unblock everything else :)
thanks @parthaa!
a3d6343
to
d9025c2
Compare
That logic is in TableIndexPage anyway. So once we make a decision all the pages using it should get updated appropriately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like Foreman and integration tests need a look!
Created a HostIndex component Update the TableIndexPage as a part of this action to accept things like select all Co-authored-by: Jeremy Lenz <[email protected]>
Update the TableIndexPage as a part of this action to accept things like select all
Works with Katello/katello#10771