From 5b52d60d3d88c96c7ca7b3852c7d2683eb6bb0ca Mon Sep 17 00:00:00 2001 From: Partha Aji Date: Tue, 24 Oct 2023 09:24:50 -0400 Subject: [PATCH] Refs #36793 - Addressed comments --- app/registries/foreman/settings/general.rb | 2 +- app/registries/menu/loader.rb | 4 ++-- .../PF4/TableIndexPage/Table/SelectAllCheckbox/index.js | 2 +- .../components/PF4/TableIndexPage/Table/TableHooks.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/registries/foreman/settings/general.rb b/app/registries/foreman/settings/general.rb index aa55a9865cf3..bb2c86a2c409 100644 --- a/app/registries/foreman/settings/general.rb +++ b/app/registries/foreman/settings/general.rb @@ -51,7 +51,7 @@ description: N_("Whether or not to show a menu to access experimental lab features (requires reload of page)"), default: false, full_name: N_('Show Experimental Labs')) - setting('new_hosts_pages', + setting('new_hosts_page', type: :boolean, description: N_("Whether or not to show the new overview page for All Hosts (requires reload of page)"), default: false, diff --git a/app/registries/menu/loader.rb b/app/registries/menu/loader.rb index d708144b0ad4..6cc122201e13 100644 --- a/app/registries/menu/loader.rb +++ b/app/registries/menu/loader.rb @@ -53,9 +53,9 @@ def self.load menu.sub_menu :hosts_menu, :caption => N_('Hosts'), :icon => 'fa fa-server' do menu.item :hosts, :caption => N_('All Hosts'), - :if => proc { !Setting[:new_hosts_pages] } + :if => proc { !Setting[:new_hosts_page] } menu.item :newhosts, :caption => N_('All Hosts'), - :if => proc { Setting[:new_hosts_pages] }, + :if => proc { Setting[:new_hosts_page] }, :url => '/new/hosts', :url_hash => { :controller => 'api/v2/hosts', :action => 'index' } diff --git a/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/SelectAllCheckbox/index.js b/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/SelectAllCheckbox/index.js index 9b7221bcdd7f..05df24bb7e0c 100644 --- a/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/SelectAllCheckbox/index.js +++ b/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/SelectAllCheckbox/index.js @@ -28,7 +28,7 @@ const SelectAllCheckbox = ({ // Checkbox states: false = unchecked, null = partially-checked, true = checked // Flow: All are selected -> click -> none are selected // Some are selected -> click -> none are selected - // None are selected -> click -> page is selected + // None are selected -> click -> all are selected, or page is selected (depends on canSelectAll) const onSelectAllCheckboxChange = checked => { if (checked && selectionToggle !== null) { if (!canSelectAll) { diff --git a/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/TableHooks.js b/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/TableHooks.js index 48b8024433e3..02479d3e65f5 100644 --- a/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/TableHooks.js +++ b/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/Table/TableHooks.js @@ -54,7 +54,7 @@ class ReactConnectedSet extends Set { export const useSet = initialArry => { const [, setToggle] = useState(Date.now()); // needed because mutating a Ref won't cause React to rerender - const forceRender = () => setToggle(Date.now()); + const forceRender = () => setToggle(Symbol()); const set = useRef(new ReactConnectedSet(initialArry, forceRender)); return set.current; };