From 36e777fdad98dc058358e9c5ace87d047009344b Mon Sep 17 00:00:00 2001 From: Samir Jha Date: Thu, 19 Oct 2023 17:30:08 +0000 Subject: [PATCH] Fixes #36807 - More fixes --- .../v2/capsule_content/sync_status.json.rabl | 4 ++- .../scenes/SmartProxy/ExpandableCvDetails.js | 21 +++++++++----- .../ExpandedSmartProxyRepositories.js | 29 +++++++++++++------ .../SmartProxy/SmartProxyExpandableTable.js | 4 ++- 4 files changed, 40 insertions(+), 18 deletions(-) diff --git a/app/views/katello/api/v2/capsule_content/sync_status.json.rabl b/app/views/katello/api/v2/capsule_content/sync_status.json.rabl index 0baf011cf24..30eb72eef57 100644 --- a/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +++ b/app/views/katello/api/v2/capsule_content/sync_status.json.rabl @@ -41,9 +41,11 @@ child @lifecycle_environments => :lifecycle_environments do node :content_views do |env| env.content_views.ignore_generated.map do |content_view| + cvv = ::Katello::ContentViewVersion.in_environment(env).find_by(:content_view => content_view) attributes = { :id => content_view.id, - :cvv_id => ::Katello::ContentViewVersion.in_environment(env).find_by(:content_view => content_view)&.id, + :cvv_id => cvv&.id, + :cvv_version => cvv&.version, :label => content_view.label, :name => content_view.name, :composite => content_view.composite, diff --git a/webpack/scenes/SmartProxy/ExpandableCvDetails.js b/webpack/scenes/SmartProxy/ExpandableCvDetails.js index bbac1f31715..8f8336553f2 100644 --- a/webpack/scenes/SmartProxy/ExpandableCvDetails.js +++ b/webpack/scenes/SmartProxy/ExpandableCvDetails.js @@ -12,6 +12,7 @@ import ExpandedSmartProxyRepositories from './ExpandedSmartProxyRepositories'; const ExpandableCvDetails = ({ contentViews, counts }) => { const columnHeaders = [ __('Content view'), + __('Version'), __('Last published'), __('Synced'), ]; @@ -38,19 +39,21 @@ const ExpandableCvDetails = ({ contentViews, counts }) => { {contentViews.map((cv, rowIndex) => { const { - id, name: cvName, composite, up_to_date: upToDate, cvv_id: version, repositories, + id, name: cvName, composite, up_to_date: upToDate, + cvv_id: versionId, cvv_version: version, repositories, } = cv; - const upToDateVal = upToDate ? : ; - const isExpanded = tableRowIsExpanded(version); + const upToDateVal = upToDate ? : ; + const isExpanded = tableRowIsExpanded(versionId); return ( - - + + expandedTableRows.onToggle(isOpen, version), + onToggle: (_event, _rInx, isOpen) => + expandedTableRows.onToggle(isOpen, versionId), }} /> @@ -59,14 +62,18 @@ const ExpandableCvDetails = ({ contentViews, counts }) => { description={{cvName}} /> + + {__('Version ')}{version} + {upToDateVal} diff --git a/webpack/scenes/SmartProxy/ExpandedSmartProxyRepositories.js b/webpack/scenes/SmartProxy/ExpandedSmartProxyRepositories.js index 95fbc3ed3ee..614970cfc71 100644 --- a/webpack/scenes/SmartProxy/ExpandedSmartProxyRepositories.js +++ b/webpack/scenes/SmartProxy/ExpandedSmartProxyRepositories.js @@ -6,16 +6,19 @@ import { DataList, DataListItem, DataListItemRow, DataListItemCells, DataListCel import AdditionalCapsuleContent from './AdditionalCapsuleContent'; import InactiveText from '../ContentViews/components/InactiveText'; -const ExpandedSmartProxyRepositories = ({ contentCounts, repositories }) => { +const ExpandedSmartProxyRepositories = ({ contentCounts, repositories, syncedToCapsule }) => { const getRepositoryNameById = id => (repositories.find(repo => Number(repo.id) === Number(id)) || {}).name; - const dataListCellLists = (repo) => { const cellList = []; /* eslint-disable max-len */ - cellList.push({getRepositoryNameById(repo)}); - cellList.push({contentCounts[repo].rpm ? `${contentCounts[repo].rpm} Packages` : 'N/A'}); - cellList.push(); + if (syncedToCapsule) { + cellList.push({getRepositoryNameById(repo)}); + cellList.push({contentCounts[repo].rpm ? `${contentCounts[repo].rpm} Packages` : 'N/A'}); + cellList.push(); + } else { + cellList.push(); + } /* eslint-enable max-len */ return cellList; }; @@ -33,13 +36,19 @@ const ExpandedSmartProxyRepositories = ({ contentCounts, repositories }) => { /> - {Object.keys(contentCounts).length ? Object.keys(contentCounts).map((repo, index) => ( - + {Object.keys(contentCounts).length ? + Object.keys(contentCounts).map((repo, index) => ( + + + + + + )) : + - + ]} /> - )) : } ); @@ -48,11 +57,13 @@ const ExpandedSmartProxyRepositories = ({ contentCounts, repositories }) => { ExpandedSmartProxyRepositories.propTypes = { contentCounts: PropTypes.shape({}), repositories: PropTypes.arrayOf(PropTypes.shape({})), + syncedToCapsule: PropTypes.bool, }; ExpandedSmartProxyRepositories.defaultProps = { contentCounts: {}, repositories: [{}], + syncedToCapsule: false, }; export default ExpandedSmartProxyRepositories; diff --git a/webpack/scenes/SmartProxy/SmartProxyExpandableTable.js b/webpack/scenes/SmartProxy/SmartProxyExpandableTable.js index 1f9d463a1f3..91034b79c08 100644 --- a/webpack/scenes/SmartProxy/SmartProxyExpandableTable.js +++ b/webpack/scenes/SmartProxy/SmartProxyExpandableTable.js @@ -114,7 +114,9 @@ const SmartProxyExpandableTable = ({ smartProxyId, organizationId }) => { - + {isExpanded ? + : + <>}