Skip to content

Commit

Permalink
Fixes #37144 - Use OS family for host details page packages tab
Browse files Browse the repository at this point in the history
  • Loading branch information
nadjaheitmann committed Feb 8, 2024
1 parent 8a156c1 commit 7a9c083
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
9 changes: 9 additions & 0 deletions app/views/katello/api/v2/hosts/base.json.rabl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ object @resource
@facet = @resource.content_facet

attributes :id, :name, :description

node :operatingsystem_family do |resource|
resource.operatingsystem.family
end

node :operatingsystem_major do |resource|
resource.operatingsystem.major
end

if @facet
node :content_view do
content_view = @facet&.single_content_view
Expand Down
1 change: 1 addition & 0 deletions lib/katello/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@

extend_rabl_template 'api/v2/smart_proxies/main', 'katello/api/v2/smart_proxies/pulp_info'
extend_rabl_template 'api/v2/hosts/show', 'katello/api/v2/hosts/host_collections'
extend_rabl_template 'api/v2/hosts/show', 'katello/api/v2/hosts/show'

# Katello variables for Host Registration
extend_allowed_registration_vars :activation_keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ import { hasRequiredPermissions as can,
import SortableColumnHeaders from '../../../../Table/components/SortableColumnHeaders';
import { useRexJobPolling } from '../RemoteExecutionHooks';

export const hideDebsTab = ({ hostDetails }) => {
const osMatch = hostDetails?.operatingsystem_name?.match(/(\D+) (\d+|\D+)/);
if (!osMatch) return false;
const [, os] = osMatch;
return !(osMatch && os.match(/Debian|Ubuntu/i));
};
export const hideDebsTab = ({ hostDetails }) => !(hostDetails?.operatingsystem_family === 'Debian');

const invokeRexJobs = ['create_job_invocations'];
const createBookmarks = ['create_bookmarks'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,7 @@ import {
userPermissionsFromHostDetails,
} from '../../hostDetailsHelpers';

const moduleStreamSupported = ({ os, version }) =>
os.match(/RedHat|RHEL|CentOS|Rocky|AlmaLinux|Oracle Linux/i) && Number(version) > 7;
export const hideModuleStreamsTab = ({ hostDetails }) => {
const osMatch = hostDetails?.operatingsystem_name?.match(/(\D+) (\d+)/);
if (!osMatch) return false;
const [, os, version] = osMatch;
return !(osMatch && moduleStreamSupported({ os, version }));
};
export const hideModuleStreamsTab = ({ hostDetails }) => !(hostDetails?.operatingsystem_family === 'Redhat' && Number(hostDetails?.operatingsystem_major > 7));

const EnabledIcon = ({ streamText, streamInstallStatus, upgradable }) => {
switch (true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ import { runSubmanRepos } from '../../Cards/ContentViewDetailsCard/HostContentVi
const invokeRexJobs = ['create_job_invocations'];
const createBookmarks = ['create_bookmarks'];

export const hidePackagesTab = ({ hostDetails }) => {
const osMatch = hostDetails?.operatingsystem_name?.match(/(\D+) (\d+|\D+)/);
if (!osMatch) return false;
const [, os] = osMatch;
return !(osMatch && os.match(/RedHat|RHEL|CentOS|Rocky|AlmaLinux|Alma|Oracle Linux|Oracle|Suse Linux Enterprise Server|SLES/i));
};
export const hidePackagesTab = ({ hostDetails }) => !(hostDetails?.operatingsystem_family?.match(/RedHat|SUSE/i));

const UpdateVersionsSelect = ({
packageName,
Expand Down

0 comments on commit 7a9c083

Please sign in to comment.