Skip to content

Commit

Permalink
Refs #36793 - Addresseing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
parthaa committed Oct 25, 2023
1 parent dd2670b commit 2ad7ece
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/controllers/hosts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -941,4 +941,9 @@ def redirection_url_on_host_deletion
def current_host_details_path(host)
Setting['host_details_ui'] ? host_details_page_path(host) : host_path(host)
end

def hosts_path
Setting[:new_hosts_page] ? '/new/hosts' : super
end

end
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,8 @@ def ui_settings
def current_host_details_path(host)
Setting['host_details_ui'] ? host_details_page_path(host) : host_path(host)
end

def hosts_path
Setting[:new_hosts_page] ? '/new/hosts' : '/hosts'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ export const useForemanDocUrl = () => useForemanMetadata().docUrl;
export const useForemanOrganization = () => useForemanMetadata().organization;
export const useForemanLocation = () => useForemanMetadata().location;
export const useForemanUser = () => useForemanMetadata().user;

export const useForemanHostsPageUrl = () => {
const { displayNewHostsPage } = useForemanSettings();
return displayNewHostsPage ? '/new/hosts' : '/hosts';
};
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import BreadcrumbBar from '../BreadcrumbBar';
import { foremanUrl } from '../../common/helpers';

Check failure on line 43 in webpack/assets/javascripts/react_app/components/HostDetails/index.js

View workflow job for this annotation

GitHub Actions / test (12)

'foremanUrl' is defined but never used

Check failure on line 43 in webpack/assets/javascripts/react_app/components/HostDetails/index.js

View workflow job for this annotation

GitHub Actions / test (14)

'foremanUrl' is defined but never used
import { CardExpansionContextWrapper } from './CardExpansionContext';
import Head from '../Head';
import { useForemanSettings } from '../../Root/Context/ForemanContext';
import { useForemanSettings, useForemanHostsPageUrl } from '../../Root/Context/ForemanContext';

Check failure on line 46 in webpack/assets/javascripts/react_app/components/HostDetails/index.js

View workflow job for this annotation

GitHub Actions / test (12)

Replace `·useForemanSettings,·useForemanHostsPageUrl·` with `⏎··useForemanSettings,⏎··useForemanHostsPageUrl,⏎`

Check failure on line 46 in webpack/assets/javascripts/react_app/components/HostDetails/index.js

View workflow job for this annotation

GitHub Actions / test (14)

Replace `·useForemanSettings,·useForemanHostsPageUrl·` with `⏎··useForemanSettings,⏎··useForemanHostsPageUrl,⏎`

const HostDetails = ({
match: {
Expand All @@ -52,7 +52,7 @@ const HostDetails = ({
location: { hash },
history,
}) => {
const { displayFqdnForHosts, displayNewHostsPage } = useForemanSettings();
const { displayFqdnForHosts } = useForemanSettings();
const { response, status } = useAPI(
'get',
`/api/hosts/${id}?show_hidden_parameters=true`,
Expand Down Expand Up @@ -114,7 +114,7 @@ const HostDetails = ({
}}
breadcrumbItems={[
{ caption: __('Hosts'),

Check failure on line 116 in webpack/assets/javascripts/react_app/components/HostDetails/index.js

View workflow job for this annotation

GitHub Actions / test (12)

Delete `⏎·················`

Check failure on line 116 in webpack/assets/javascripts/react_app/components/HostDetails/index.js

View workflow job for this annotation

GitHub Actions / test (14)

Delete `⏎·················`
url: displayNewHostsPage ? foremanUrl('/new/hosts') : foremanUrl('/hosts') },
url: useForemanHostsPageUrl() },

Check failure on line 117 in webpack/assets/javascripts/react_app/components/HostDetails/index.js

View workflow job for this annotation

GitHub Actions / test (12)

React Hook "useForemanHostsPageUrl" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?

Check failure on line 117 in webpack/assets/javascripts/react_app/components/HostDetails/index.js

View workflow job for this annotation

GitHub Actions / test (14)

React Hook "useForemanHostsPageUrl" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?
{
caption: displayFqdnForHosts
? response.name
Expand Down

0 comments on commit 2ad7ece

Please sign in to comment.