diff --git a/lib/foreman_snapshot_management/engine.rb b/lib/foreman_snapshot_management/engine.rb index 600233c..1790900 100644 --- a/lib/foreman_snapshot_management/engine.rb +++ b/lib/foreman_snapshot_management/engine.rb @@ -63,7 +63,7 @@ class Engine < ::Rails::Engine context.add_pagelet :main_tabs, :name => N_('Snapshots'), :partial => 'hosts/snapshots_tab', - :onlyif => proc { |host| host&.compute_resource&.capable?(:snapshots) } + :onlyif => proc { |host| host&.uuid.present? && host&.compute_resource&.capable?(:snapshots) } end end end diff --git a/webpack/components/SnapshotManagementCard/SnapshotManagementCard.js b/webpack/components/SnapshotManagementCard/SnapshotManagementCard.js index deb6900..19f4c1a 100644 --- a/webpack/components/SnapshotManagementCard/SnapshotManagementCard.js +++ b/webpack/components/SnapshotManagementCard/SnapshotManagementCard.js @@ -18,7 +18,7 @@ const SnapshotManagementCard = ({ hostDetails, ...props }) => { hostDetails?.capabilities?.includes('snapshot_include_quiesce') || false, }; - if (hostDetails?.id && hostDetails?.permissions) + if (hostDetails?.uuid && hostDetails?.id && hostDetails?.permissions) { children.push( { capabilities={capabilities} /> ); - return ( - - {children} - - ); + return ( + + {children} + + ); + } + else + return null; }; export default SnapshotManagementCard; @@ -46,6 +49,7 @@ SnapshotManagementCard.propTypes = { hostDetails: PropTypes.shape({ name: PropTypes.string, id: PropTypes.number, + uuid: PropTypes.string, capabilities: PropTypes.array, permissions: PropTypes.shape({ create_snapshots: PropTypes.bool,