katello 4.3.0.rc1 → 4.3.0.rc4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (299) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/api_controller.rb +4 -0
  3. data/app/controllers/katello/api/v2/capsule_content_controller.rb +11 -3
  4. data/app/controllers/katello/api/v2/content_uploads_controller.rb +1 -1
  5. data/app/controllers/katello/api/v2/generic_content_units_controller.rb +10 -4
  6. data/app/controllers/katello/api/v2/host_errata_controller.rb +5 -0
  7. data/app/controllers/katello/api/v2/host_packages_controller.rb +2 -0
  8. data/app/controllers/katello/api/v2/host_tracer_controller.rb +4 -0
  9. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +8 -0
  10. data/app/controllers/katello/api/v2/repositories_controller.rb +35 -3
  11. data/app/controllers/katello/api/v2/repository_sets_controller.rb +2 -2
  12. data/app/controllers/katello/api/v2/root_controller.rb +10 -19
  13. data/app/controllers/katello/concerns/api/v2/bulk_extensions.rb +3 -13
  14. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +1 -9
  15. data/app/controllers/katello/remote_execution_controller.rb +1 -1
  16. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
  17. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +7 -5
  18. data/app/lib/actions/katello/repository/destroy.rb +3 -3
  19. data/app/lib/actions/katello/repository/import_upload.rb +12 -2
  20. data/app/lib/actions/pulp/repository/sync.rb +0 -2
  21. data/app/lib/actions/pulp3/abstract_async_task.rb +16 -4
  22. data/app/lib/actions/pulp3/capsule_content/generate_metadata.rb +5 -4
  23. data/app/lib/actions/pulp3/capsule_content/reclaim_space.rb +25 -0
  24. data/app/lib/actions/pulp3/orchestration/repository/import_repository_upload.rb +36 -0
  25. data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +1 -1
  26. data/app/lib/actions/pulp3/repository/commit_upload.rb +3 -1
  27. data/app/lib/actions/pulp3/repository/import_upload.rb +4 -2
  28. data/app/lib/actions/pulp3/repository/reclaim_space.rb +25 -0
  29. data/app/lib/actions/pulp3/repository/save_artifact.rb +12 -8
  30. data/app/lib/katello/resources/cdn.rb +10 -1
  31. data/app/lib/katello/resources/registry.rb +1 -1
  32. data/app/models/katello/concerns/host_managed_extensions.rb +7 -4
  33. data/app/models/katello/concerns/smart_proxy_extensions.rb +21 -9
  34. data/app/models/katello/content_view_version.rb +1 -6
  35. data/app/models/katello/glue/pulp/repo.rb +1 -2
  36. data/app/models/katello/host_tracer.rb +2 -0
  37. data/app/models/katello/pulp3/repository_reference.rb +7 -0
  38. data/app/models/katello/repository.rb +2 -30
  39. data/app/models/katello/root_repository.rb +3 -44
  40. data/app/models/setting/content.rb +2 -8
  41. data/app/presenters/katello/host_package_presenter.rb +21 -0
  42. data/app/services/katello/bulk_items_helper.rb +35 -0
  43. data/app/services/katello/pulp3/api/core.rb +16 -2
  44. data/app/services/katello/pulp3/content.rb +4 -2
  45. data/app/services/katello/pulp3/pulp_content_unit.rb +9 -3
  46. data/app/services/katello/pulp3/repository.rb +9 -4
  47. data/app/services/katello/pulp3/repository_mirror.rb +1 -1
  48. data/app/services/katello/repository_type.rb +2 -1
  49. data/app/services/katello/smart_proxy_helper.rb +10 -1
  50. data/app/views/foreman/job_templates/change_content_source.erb +42 -0
  51. data/app/views/foreman/job_templates/install_errata.erb +8 -6
  52. data/app/views/foreman/job_templates/resolve_traces.erb +4 -5
  53. data/app/views/foreman/job_templates/resolve_traces_-_katello_ansible_default.erb +3 -5
  54. data/app/views/foreman/smart_proxies/_content_sync.html.erb +17 -4
  55. data/app/views/foreman/smart_proxies/_reclaim_space.html.erb +12 -0
  56. data/app/views/foreman/smart_proxies/show.html.erb +4 -2
  57. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +6 -0
  58. data/app/views/katello/api/v2/{organizations/cdn_configuration.rabl → cdn_configurations/show.json.rabl} +4 -0
  59. data/app/views/katello/api/v2/content_facet/show.json.rabl +8 -0
  60. data/app/views/katello/api/v2/content_view_filters/show.json.rabl +0 -1
  61. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -1
  62. data/app/views/katello/api/v2/host_packages/base.json.rabl +2 -0
  63. data/app/views/katello/api/v2/organizations/show.json.rabl +1 -1
  64. data/app/views/katello/api/v2/repositories/show.json.rabl +0 -3
  65. data/config/routes/api/v2.rb +5 -10
  66. data/db/migrate/20210331180353_katello_pool_organization_id_not_nullable.rb +2 -0
  67. data/db/migrate/20211115215210_drop_ostree_branches.rb +13 -0
  68. data/db/migrate/20211129200124_remove_dependency_solving_algorithm_setting.rb +5 -0
  69. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +1 -2
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +3 -3
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +21 -1
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.factory.js +2 -1
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/sync-state.service.js +2 -0
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +0 -10
  75. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-versions.html +0 -3
  76. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +0 -10
  77. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-versions.module.js +0 -1
  78. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version.html +0 -7
  79. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/content.service.js +0 -5
  80. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.module.js +0 -1
  81. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.routes.js +0 -11
  82. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js +1 -2
  83. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-repositories.controller.js +14 -2
  84. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +2 -4
  85. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.filter.js +0 -10
  86. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-reclaim-space-modal.controller.js +36 -0
  87. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +16 -2
  88. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details-reclaim-space-modal.html +18 -0
  89. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +13 -0
  90. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
  91. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +3 -6
  92. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +4 -1
  93. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +1 -0
  94. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/product-repositories-reclaim-space-modal.controller.js +35 -0
  95. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repositories.routes.js +0 -9
  96. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository.factory.js +3 -1
  97. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories-reclaim-space-modal.html +18 -0
  98. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +7 -8
  99. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/pulp-primary/pulp-primary.controller.js +35 -0
  100. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/pulp-primary/pulp-primary.factory.js +18 -0
  101. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/pulp-primary/pulp-primary.module.js +14 -0
  102. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/pulp-primary/pulp-primary.routes.js +16 -0
  103. data/engines/bastion_katello/lib/bastion_katello/engine.rb +0 -1
  104. data/lib/katello/permission_creator.rb +3 -4
  105. data/lib/katello/plugin.rb +4 -10
  106. data/lib/katello/repository_types/ostree.rb +3 -1
  107. data/lib/katello/tasks/reset.rake +2 -2
  108. data/lib/katello/tasks/upgrades/4.3/fix_url_auth.rake +25 -0
  109. data/lib/katello/version.rb +1 -1
  110. data/package.json +1 -0
  111. data/webpack/components/AddedStatusLabel.js +2 -1
  112. data/webpack/components/EditableTextInput/EditableTextInput.js +76 -17
  113. data/webpack/components/EditableTextInput/__tests__/editableTextInput.test.js +82 -0
  114. data/webpack/components/EditableTextInput/editableTextInput.scss +4 -0
  115. data/webpack/components/Packages/index.js +63 -0
  116. data/webpack/components/RoutedTabs/index.js +3 -1
  117. data/webpack/components/Search/Search.js +7 -1
  118. data/webpack/components/SelectAllCheckbox/index.js +2 -2
  119. data/webpack/components/Table/EmptyStateMessage.js +4 -2
  120. data/webpack/components/Table/MainTable.scss +7 -1
  121. data/webpack/components/Table/TableHooks.js +10 -19
  122. data/webpack/components/Table/TableWrapper.js +3 -3
  123. data/webpack/components/WithOrganization/__snapshots__/withOrganization.test.js.snap +3 -3
  124. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard.js +24 -30
  125. data/webpack/components/extensions/HostDetails/HostDetailsConstants.js +1 -0
  126. data/webpack/components/extensions/HostDetails/HostDetailsSelectors.js +16 -0
  127. data/webpack/components/extensions/HostDetails/HostErrata/HostErrataConstants.js +2 -0
  128. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesActions.js +11 -0
  129. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesConstants.js +2 -0
  130. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesSelectors.js +16 -0
  131. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/SecondaryTabsRoutes.js +4 -0
  132. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/constants.js +1 -0
  133. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab.js +119 -25
  134. data/webpack/components/extensions/HostDetails/Tabs/HostTracesConstants.js +1 -0
  135. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.js +127 -0
  136. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.scss +11 -0
  137. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +30 -4
  138. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionConstants.js +1 -0
  139. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsActions.js +73 -0
  140. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsConstants.js +2 -0
  141. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsSelectors.js +16 -0
  142. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +347 -0
  143. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.scss +7 -0
  144. data/webpack/components/extensions/HostDetails/Tabs/TracesTab.js +38 -31
  145. data/webpack/components/extensions/HostDetails/Tabs/__tests__/bookmarks.fixtures.json +12 -0
  146. data/webpack/components/extensions/HostDetails/Tabs/__tests__/contentOverrides.fixtures.json +227 -0
  147. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +423 -2
  148. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packages.fixtures.json +28 -0
  149. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +91 -0
  150. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySets.fixtures.json +120 -0
  151. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +307 -0
  152. data/webpack/components/extensions/HostDetails/Tabs/__tests__/resolveErrata.fixtures.json +35 -0
  153. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +55 -9
  154. data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +28 -14
  155. data/webpack/containers/Application/overrides.scss +31 -9
  156. data/webpack/global_index.js +11 -4
  157. data/webpack/redux/reducers/RedHatRepositories/enabled.fixtures.js +0 -2
  158. data/webpack/scenes/Content/ContentConfig.js +23 -7
  159. data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +2 -0
  160. data/webpack/scenes/ContentCredentials/ContentCredentialActions.js +18 -0
  161. data/webpack/scenes/ContentCredentials/ContentCredentialConstants.js +2 -0
  162. data/webpack/scenes/ContentCredentials/ContentCredentialSelectors.js +12 -0
  163. data/webpack/scenes/ContentCredentials/__tests__/contentCredentials.fixtures.js +73 -0
  164. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +8 -12
  165. data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +1 -1
  166. data/webpack/scenes/ContentViews/Copy/__tests__/copyContentView.test.js +1 -1
  167. data/webpack/scenes/ContentViews/Create/ContentViewFormComponents.js +3 -3
  168. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +7 -2
  169. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.scss +7 -0
  170. data/webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js +9 -9
  171. data/webpack/scenes/ContentViews/Delete/ContentViewDeleteWizard.js +6 -6
  172. data/webpack/scenes/ContentViews/Delete/Steps/CVDeleteEnvironmentsSelection.js +39 -37
  173. data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionFinish.js +10 -4
  174. data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionReview.js +35 -33
  175. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +12 -7
  176. data/webpack/scenes/ContentViews/Delete/__tests__/cvVersionsData.fixtures.json +2 -6
  177. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentEnvironments.js +13 -14
  178. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +36 -31
  179. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +8 -8
  180. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +108 -41
  181. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +3 -2
  182. data/webpack/scenes/ContentViews/Details/Filters/Add/CVFilterAddModal.js +2 -2
  183. data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterCreateResult.fixtures.json +1 -2
  184. data/webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js +1 -4
  185. data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +6 -6
  186. data/webpack/scenes/ContentViews/Details/Filters/CVErrataDateFilterContent.js +11 -5
  187. data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +6 -9
  188. data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +5 -8
  189. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +40 -43
  190. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +2 -2
  191. data/webpack/scenes/ContentViews/Details/Filters/ContentType.js +4 -4
  192. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +6 -8
  193. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +6 -1
  194. data/webpack/scenes/ContentViews/Details/Filters/Rules/ContainerTag/AddEditContainerTagRuleModal.js +1 -1
  195. data/webpack/scenes/ContentViews/Details/Filters/Rules/Package/AddEditPackageRuleModal.js +16 -22
  196. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +8 -8
  197. data/webpack/scenes/ContentViews/Details/Filters/__tests__/ContentViewPackageGroupFilter.test.js +3 -5
  198. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewErrataByDateDetails.fixtures.json +1 -8
  199. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetail.fixtures.json +1 -2
  200. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +5 -9
  201. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvAllRepos.fixtures.json +0 -2
  202. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataDateFilterContent.test.js +1 -9
  203. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +2 -4
  204. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErratumFilterDetails.fixtures.json +1 -2
  205. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvFilterDetailModuleAffectedRepos.fixtures.json +1 -8
  206. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvFilterDetailWithAffectedRepos.fixtures.json +1 -8
  207. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +2 -4
  208. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilterDetails.fixtures.json +1 -2
  209. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvPackageFilterDetail.fixtures.json +1 -3
  210. data/webpack/scenes/ContentViews/Details/Promote/ContentViewVersionPromote.js +61 -32
  211. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +6 -1
  212. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +5 -8
  213. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +55 -9
  214. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +2 -0
  215. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +0 -2
  216. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionContent.js +48 -29
  217. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionEnvironments.js +2 -2
  218. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionErrata.js +9 -7
  219. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionErrata.scss +5 -2
  220. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +38 -9
  221. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveCVVersionWizard.js +4 -1
  222. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVEnvironmentSelectionForm.js +59 -53
  223. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVVersionDeleteFinish.js +14 -3
  224. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVVersionRemoveReview.js +24 -17
  225. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +3 -3
  226. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/versionsResponseData.fixtures.json +1 -4
  227. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetails.js +4 -2
  228. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsHeader.js +134 -32
  229. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionRepositoryCell.js +8 -3
  230. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionComponent.fixtures.json +1 -4
  231. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.fixtures.json +1 -2
  232. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +21 -1
  233. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetailsCounts.fixtures.json +1 -2
  234. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetailsEmpty.test.js +22 -1
  235. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionRepositories.fixtures.json +1 -18
  236. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.fixtures.json +5 -5
  237. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +2 -0
  238. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersionsWithTask.fixtures.json +1 -3
  239. data/webpack/scenes/ContentViews/Details/contentViewInfo.scss +0 -4
  240. data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +66 -53
  241. data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +40 -28
  242. data/webpack/scenes/ContentViews/Publish/PublishContentViewWizard.js +3 -3
  243. data/webpack/scenes/ContentViews/Publish/__tests__/publishContentView.test.js +14 -14
  244. data/webpack/scenes/ContentViews/Publish/cvPublishForm.scss +6 -0
  245. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +53 -12
  246. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +12 -6
  247. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +6 -6
  248. data/webpack/scenes/ContentViews/components/ContentViewIcon.js +12 -7
  249. data/webpack/scenes/ContentViews/components/ContentViewsCounter.js +2 -2
  250. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.js +26 -27
  251. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.scss +18 -6
  252. data/webpack/scenes/ContentViews/components/WizardHeader.js +44 -0
  253. data/webpack/scenes/ContentViews/components/contentViewIcon.scss +13 -2
  254. data/webpack/scenes/Organizations/OrganizationActions.js +22 -24
  255. data/webpack/scenes/Organizations/OrganizationConstants.js +1 -3
  256. data/webpack/scenes/Organizations/OrganizationReducer.js +0 -7
  257. data/webpack/scenes/Organizations/OrganizationSelectors.js +16 -0
  258. data/webpack/scenes/Organizations/__tests__/OrganizationActions.test.js +1 -21
  259. data/webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js +0 -20
  260. data/webpack/scenes/Organizations/__tests__/organizations.fixtures.js +34 -23
  261. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationForm.js +185 -0
  262. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationForm.scss +3 -0
  263. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +112 -146
  264. data/webpack/scenes/Subscriptions/Manifest/__tests__/CdnConfigurationForm.test.js +114 -0
  265. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +121 -31
  266. data/webpack/scenes/Subscriptions/Manifest/index.js +14 -3
  267. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +1 -0
  268. data/webpack/scenes/Tasks/TaskActions.js +4 -3
  269. data/webpack/scenes/Tasks/__tests__/__snapshots__/TaskActions.test.js.snap +1 -0
  270. data/webpack/utils/helpers.js +2 -2
  271. metadata +62 -43
  272. data/app/controllers/katello/api/v2/ostree_branches_controller.rb +0 -16
  273. data/app/lib/actions/pulp/repository/presenters/ostree_presenter.rb +0 -91
  274. data/app/models/katello/ostree_branch.rb +0 -12
  275. data/app/models/katello/repository_ostree_branch.rb +0 -7
  276. data/app/services/katello/pulp/ostree_branch.rb +0 -14
  277. data/app/services/katello/pulp/repository/ostree.rb +0 -48
  278. data/app/views/katello/api/v2/ostree_branches/compare.json.rabl +0 -10
  279. data/app/views/katello/api/v2/ostree_branches/index.json.rabl +0 -7
  280. data/app/views/katello/api/v2/ostree_branches/show.json.rabl +0 -5
  281. data/app/views/katello/api/v2/root/resource_list.json.rabl +0 -3
  282. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-ostree-branches.html +0 -26
  283. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-ostree.html +0 -27
  284. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branch-repositories.controller.js +0 -77
  285. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branch.controller.js +0 -31
  286. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch-info.html +0 -15
  287. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch-repositories.html +0 -72
  288. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch.html +0 -30
  289. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branch.factory.js +0 -27
  290. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.controller.js +0 -67
  291. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.module.js +0 -15
  292. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.routes.js +0 -50
  293. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches.html +0 -40
  294. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-manage-ostree-branches.html +0 -40
  295. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/ostree-upstream-sync-policy.service.js +0 -26
  296. data/webpack/components/extensions/HostDetails/Tabs/SubscriptionTab.js +0 -12
  297. data/webpack/scenes/Content/Details/ContentCounts.js +0 -42
  298. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +0 -108
  299. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +0 -158
@@ -1,11 +1,14 @@
1
1
  import React, { useState, useMemo, useCallback } from 'react';
2
2
  import useDeepCompareEffect from 'use-deep-compare-effect';
3
3
  import { useDispatch, useSelector } from 'react-redux';
4
+ import { Redirect } from 'react-router-dom';
4
5
  import { STATUS } from 'foremanReact/constants';
5
6
  import PropTypes from 'prop-types';
6
- import { Form, FormGroup, TextArea, ActionGroup, Button, Modal, ModalVariant, Alert } from '@patternfly/react-core';
7
+ import {
8
+ Form, FormGroup, TextArea, ActionGroup, Button,
9
+ Modal, ModalVariant, Alert, TextContent, AlertActionCloseButton,
10
+ } from '@patternfly/react-core';
7
11
  import { translate as __ } from 'foremanReact/common/I18n';
8
-
9
12
  import {
10
13
  selectEnvironmentPaths,
11
14
  selectEnvironmentPathsStatus,
@@ -20,12 +23,15 @@ import ComponentEnvironments from '../ComponentContentViews/ComponentEnvironment
20
23
  import Loading from '../../../../components/Loading';
21
24
 
22
25
  const ContentViewVersionPromote = ({
23
- cvId, versionIdToPromote, versionNameToPromote, versionEnvironments, setIsOpen,
26
+ cvId, versionIdToPromote, versionNameToPromote,
27
+ versionEnvironments, setIsOpen, detailsPage,
24
28
  }) => {
25
29
  const [description, setDescription] = useState('');
26
30
  const [userCheckedItems, setUserCheckedItems] = useState([]);
27
- const [promoting, setPromoting] = useState(false);
31
+ const [alertDismissed, setAlertDismissed] = useState(false);
32
+ const [loading, setLoading] = useState(false);
28
33
  const [forcePromote, setForcePromote] = useState([]);
34
+ const [redirect, setRedirect] = useState(false);
29
35
  const environmentPathResponse = useSelector(selectEnvironmentPaths);
30
36
  const environmentPathStatus = useSelector(selectEnvironmentPathsStatus);
31
37
  const environmentPathLoading = environmentPathStatus === STATUS.PENDING;
@@ -39,7 +45,7 @@ const ContentViewVersionPromote = ({
39
45
  const dispatch = useDispatch();
40
46
 
41
47
  const onPromote = () => {
42
- setPromoting(true);
48
+ setLoading(true);
43
49
  dispatch(promoteContentViewVersion({
44
50
  id: versionIdToPromote,
45
51
  description,
@@ -51,13 +57,18 @@ const ContentViewVersionPromote = ({
51
57
 
52
58
  useDeepCompareEffect(() => {
53
59
  if (promoteResolved && promoteResponse) {
54
- setIsOpen(false);
55
60
  dispatch(getContentViewVersions(cvId));
61
+ if (detailsPage) {
62
+ setRedirect(true);
63
+ } else {
64
+ setIsOpen(false);
65
+ }
56
66
  }
57
67
  if (promoteError) {
58
- setPromoting(false);
68
+ setLoading(false);
59
69
  }
60
- }, [promoteResponse, promoteResolved, promoteError, setPromoting, setIsOpen, dispatch, cvId]);
70
+ }, [promoteResponse, promoteResolved, promoteError, detailsPage,
71
+ setRedirect, setLoading, setIsOpen, dispatch, cvId]);
61
72
 
62
73
  const envPathFlat = useMemo(() => {
63
74
  if (!environmentPathLoading) {
@@ -88,6 +99,12 @@ const ContentViewVersionPromote = ({
88
99
  setForcePromote(userCheckedItems.filter(item => !isValid(item)));
89
100
  }, [userCheckedItems, setForcePromote, isValid]);
90
101
 
102
+ const submitDisabled = loading || userCheckedItems.length === 0;
103
+
104
+ if (redirect && detailsPage) {
105
+ return (<Redirect to="/versions" />);
106
+ }
107
+
91
108
  return (
92
109
  <Modal
93
110
  title={__(`Promote version ${versionNameToPromote}`)}
@@ -98,10 +115,14 @@ const ContentViewVersionPromote = ({
98
115
  }}
99
116
  appendTo={document.body}
100
117
  >
101
- {promoting ? <Loading loadingText={__('Please wait while the task starts..')} /> :
102
- <>
103
- <Form>
104
- <FormGroup label="Description" fieldId="description">
118
+ {loading ?
119
+ <Loading loadingText={__('Please wait while the task starts..')} /> :
120
+ <Form onSubmit={(e) => {
121
+ e.preventDefault();
122
+ onPromote();
123
+ }}
124
+ >
125
+ <FormGroup label={__('Description')} fieldId="description">
105
126
  <TextArea
106
127
  isRequired
107
128
  type="text"
@@ -112,28 +133,34 @@ const ContentViewVersionPromote = ({
112
133
  onChange={value => setDescription(value)}
113
134
  />
114
135
  </FormGroup>
115
- </Form>
116
- <hr />
117
- {forcePromote.length > 0 && (
118
- <Alert variant="info" isInline title="Force Promotion">
119
- <p>{__('Selected environments are out of the environment order. ' +
120
- 'The recommended practice is to promote to the next environment in the path.')}
121
- </p>
122
- <ComponentEnvironments environments={forcePromote} />
123
- </Alert>)}
124
- <EnvironmentPaths
125
- userCheckedItems={userCheckedItems}
126
- setUserCheckedItems={setUserCheckedItems}
127
- promotedEnvironments={versionEnvironments}
128
- publishing={false}
129
- />
130
- <Form>
131
- <ActionGroup>
136
+ {!alertDismissed && forcePromote.length > 0 && (
137
+ <Alert
138
+ variant="info"
139
+ isInline
140
+ title={__('Force promotion')}
141
+ actionClose={<AlertActionCloseButton onClose={() => setAlertDismissed(true)} />}
142
+ >
143
+ <TextContent>
144
+ {forcePromote.length > 1 ? __('Selected environments ') : __('Selected environment ')}
145
+ <ComponentEnvironments environments={forcePromote} />
146
+ {forcePromote.length > 1 ?
147
+ __(' are out of the environment path order. The recommended practice is to promote to the next environment in the path.') :
148
+ __(' is out of the environment path order. The recommended practice is to promote to the next environment in the path.')
149
+ }
150
+ </TextContent>
151
+ </Alert>)}
152
+ <EnvironmentPaths
153
+ userCheckedItems={userCheckedItems}
154
+ setUserCheckedItems={setUserCheckedItems}
155
+ promotedEnvironments={versionEnvironments}
156
+ publishing={false}
157
+ />
158
+ <ActionGroup style={{ margin: 0 }}>
132
159
  <Button
133
160
  aria-label="promote_content_view"
134
161
  variant="primary"
135
- isDisabled={promoting}
136
- onClick={() => onPromote()}
162
+ isDisabled={submitDisabled}
163
+ type="submit"
137
164
  >
138
165
  {__('Promote')}
139
166
  </Button>
@@ -142,7 +169,7 @@ const ContentViewVersionPromote = ({
142
169
  </Button>
143
170
  </ActionGroup>
144
171
  </Form>
145
- </>}
172
+ }
146
173
  </Modal>
147
174
  );
148
175
  };
@@ -153,11 +180,13 @@ ContentViewVersionPromote.propTypes = {
153
180
  versionNameToPromote: PropTypes.string.isRequired,
154
181
  versionEnvironments: PropTypes.arrayOf(PropTypes.shape({})),
155
182
  setIsOpen: PropTypes.func,
183
+ detailsPage: PropTypes.bool,
156
184
  };
157
185
 
158
186
  ContentViewVersionPromote.defaultProps = {
159
187
  versionEnvironments: [],
160
188
  setIsOpen: null,
189
+ detailsPage: false,
161
190
  };
162
191
 
163
192
  export default ContentViewVersionPromote;
@@ -1,7 +1,9 @@
1
1
  import React, { Fragment } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { urlBuilder } from 'foremanReact/common/urlHelpers';
4
+ import { translate as __ } from 'foremanReact/common/I18n';
4
5
  import ContentConfig from '../../../Content/ContentConfig';
6
+ import InactiveText from '../../components/InactiveText';
5
7
 
6
8
  // type: [plural_name, singular_name, link]
7
9
  const repoLabels = {
@@ -14,7 +16,6 @@ const repoLabels = {
14
16
  docker_manifest_list: ['container manifest lists', 'container manifest list', 'content/docker_manifest_lists'],
15
17
  docker_tag: ['container tags', 'container tag', 'content/docker_tags'],
16
18
  file: ['files', 'file', 'content/files'],
17
- ostree_branch: ['ostree branches', 'ostree branch', 'content/ostree_branches'],
18
19
  package_group: ['package groups', 'package group', 'package_groups'],
19
20
  srpm: ['source RPMs', 'source RPM', 'source_rpms'], // no link?
20
21
  };
@@ -46,11 +47,15 @@ const ContentCounts = ({ productId, repoId, counts }) => {
46
47
  if (config) {
47
48
  const { pluralLowercase, singularLowercase, pluralLabel } = config.names;
48
49
  info = [pluralLowercase, singularLowercase, pluralLabel];
50
+ } else if (!info) {
51
+ info = ['unknown units', 'unknown unit', ''];
49
52
  }
50
53
  // package and rpm are the same
51
54
  if (type !== 'package' && count > 0) allCounts.push(appendCount(type, count, info, productId, repoId));
52
55
  });
53
56
 
57
+ if (!allCounts.length) return <InactiveText text={__('No content')} />;
58
+
54
59
  return <Fragment>{allCounts}</Fragment>;
55
60
  };
56
61
 
@@ -1,5 +1,6 @@
1
1
  import React, { useState, useEffect, useCallback } from 'react';
2
2
  import useDeepCompareEffect from 'use-deep-compare-effect';
3
+ import { lowerCase, upperFirst } from 'lodash';
3
4
  import { useSelector, shallowEqual, useDispatch } from 'react-redux';
4
5
  import {
5
6
  Bullseye,
@@ -34,7 +35,6 @@ import LastSync from './LastSync';
34
35
  import RepoIcon from './RepoIcon';
35
36
  import AddedStatusLabel from '../../../../components/AddedStatusLabel';
36
37
  import SelectableDropdown from '../../../../components/SelectableDropdown';
37
- import { capitalize } from '../../../../utils/helpers';
38
38
  import { hasPermission } from '../../helpers';
39
39
 
40
40
  const allRepositories = 'All repositories';
@@ -95,7 +95,7 @@ const ContentViewRepositories = ({ cvId, details }) => {
95
95
  { title: <Bullseye><RepoIcon type={contentType} /></Bullseye> },
96
96
  { title: <a href={urlBuilder(`products/${productId}/repositories`, '', id)}>{name}</a> },
97
97
  productName,
98
- { title: <LastSync {...{ lastSyncWords, lastSync }} /> },
98
+ { title: <LastSync {...{ startedAt: lastSync?.started_at, lastSyncWords, lastSync }} /> },
99
99
  { title: <ContentCounts {...{ counts, productId }} repoId={id} /> },
100
100
  {
101
101
  title: <AddedStatusLabel added={addedToCV || statusSelected === ADDED} />,
@@ -129,8 +129,8 @@ const ContentViewRepositories = ({ cvId, details }) => {
129
129
  allRepoTypes[allRepositories] = 'all';
130
130
  repoTypesResponse.forEach((type) => {
131
131
  const { name } = type;
132
- const typeFullName = Object.prototype.hasOwnProperty.call(repoTypeNames, name) ?
133
- repoTypeNames[name] : capitalize(name);
132
+ const typeFullName = name in repoTypeNames ?
133
+ repoTypeNames[name] : upperFirst(lowerCase(name));
134
134
  allRepoTypes[`${typeFullName} Repositories`] = name;
135
135
  });
136
136
  setRepoTypes(allRepoTypes);
@@ -209,9 +209,6 @@ const ContentViewRepositories = ({ cvId, details }) => {
209
209
  const defaultFilters = [allRepositories, ALL_STATUSES];
210
210
 
211
211
  const dropdownItems = [
212
- <DropdownItem aria-label="bulk_add" key="bulk_add" isDisabled={!hasNotAddedSelected} component="button" onClick={addBulk}>
213
- {__('Add')}
214
- </DropdownItem>,
215
212
  <DropdownItem aria-label="bulk_remove" key="bulk_remove" isDisabled={!hasAddedSelected} component="button" onClick={removeBulk}>
216
213
  {__('Remove')}
217
214
  </DropdownItem>,
@@ -255,7 +252,7 @@ const ContentViewRepositories = ({ cvId, details }) => {
255
252
  </SplitItem>
256
253
  <SplitItem>
257
254
  <SelectableDropdown
258
- items={[ADDED, NOT_ADDED, ALL_STATUSES]}
255
+ items={[ALL_STATUSES, ADDED, NOT_ADDED]}
259
256
  title={__('Status')}
260
257
  selected={statusSelected}
261
258
  setSelected={setStatusSelected}
@@ -1,10 +1,21 @@
1
1
  import React, { Fragment } from 'react';
2
- import { CheckCircleIcon, ExclamationTriangleIcon, ExclamationCircleIcon, InProgressIcon } from '@patternfly/react-icons';
2
+ import {
3
+ CheckCircleIcon,
4
+ ExclamationTriangleIcon,
5
+ ExclamationCircleIcon,
6
+ InProgressIcon,
7
+ } from '@patternfly/react-icons';
8
+ import { FormattedDate } from 'react-intl';
9
+ import { Tooltip, TooltipPosition } from '@patternfly/react-core';
10
+
3
11
  import { foremanUrl } from 'foremanReact/common/helpers';
4
12
  import PropTypes from 'prop-types';
13
+ import { translate as __ } from 'foremanReact/common/I18n';
5
14
  import InactiveText from '../../components/InactiveText';
6
15
 
7
- const LastSync = ({ lastSyncWords, lastSync, emptyMessage }) => {
16
+ const LastSync = ({
17
+ lastSyncWords, lastSync, emptyMessage, startedAt,
18
+ }) => {
8
19
  if (lastSync && lastSyncWords) {
9
20
  let Icon;
10
21
  let color = 'black';
@@ -26,16 +37,50 @@ const LastSync = ({ lastSyncWords, lastSync, emptyMessage }) => {
26
37
  Icon = Fragment;
27
38
  }
28
39
 
40
+ if (startedAt) {
41
+ return (
42
+ <Tooltip
43
+ position={TooltipPosition.top}
44
+ content={
45
+ <FormattedDate
46
+ value={startedAt}
47
+ day="2-digit"
48
+ month="long"
49
+ hour="2-digit"
50
+ minute="2-digit"
51
+ year="numeric"
52
+ />}
53
+ >
54
+ <a
55
+ href={foremanUrl(`/foreman_tasks/tasks/${id}/`)}
56
+ style={{
57
+ display: 'inline-flex', alignItems: 'center', margin: 0,
58
+ }}
59
+ >
60
+ <Icon style={{ color, marginRight: '5px' }} />
61
+ <span>{lastSyncWords}{__(' ago')}</span>
62
+ </a >
63
+ </Tooltip >
64
+ );
65
+ }
66
+
29
67
  return (
30
- <a href={foremanUrl(`/foreman_tasks/tasks/${id}/`)}>
31
- <Icon style={{ color }} />&nbsp;{`${lastSyncWords} ago`}
32
- </a>
33
- );
68
+ <a
69
+ href={foremanUrl(`/foreman_tasks/tasks/${id}/`)}
70
+ style={{
71
+ display: 'flex', alignItems: 'center',
72
+ }}
73
+ >
74
+ <Icon style={{ color, marginRight: '5px' }} />
75
+ <span>{lastSyncWords}{__(' ago')}</span>
76
+ </a >);
34
77
  }
78
+
35
79
  return <InactiveText text={emptyMessage} />;
36
80
  };
37
81
 
38
82
  LastSync.propTypes = {
83
+ startedAt: PropTypes.string,
39
84
  lastSyncWords: PropTypes.string,
40
85
  lastSync: PropTypes.shape({
41
86
  id: PropTypes.string, // API returns string
@@ -45,9 +90,10 @@ LastSync.propTypes = {
45
90
  };
46
91
 
47
92
  LastSync.defaultProps = {
48
- lastSyncWords: null,
49
- lastSync: null,
50
- emptyMessage: 'Not Synced',
93
+ startedAt: undefined,
94
+ lastSyncWords: undefined,
95
+ lastSync: undefined,
96
+ emptyMessage: 'Not synced',
51
97
  };
52
98
 
53
99
  export default LastSync;
@@ -38,6 +38,8 @@ afterEach(() => {
38
38
  assertNockRequest(autoSearchScope);
39
39
  });
40
40
 
41
+ jest.mock('react-intl', () => ({ addLocaleData: () => { }, FormattedDate: () => 'mocked' }));
42
+
41
43
  test('Can enable and disable add repositories button', async (done) => {
42
44
  const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
43
45
 
@@ -62,7 +62,6 @@
62
62
  },
63
63
  "content_label": "Orion_Lagoon_Nebula_Butterfly",
64
64
  "content_counts": {
65
- "ostree_branch": 0,
66
65
  "docker_manifest": 0,
67
66
  "docker_manifest_list": 0,
68
67
  "docker_tag": 0,
@@ -131,7 +130,6 @@
131
130
  },
132
131
  "content_label": "Orion_Lagoon_Nebula_Coma",
133
132
  "content_counts": {
134
- "ostree_branch": 1,
135
133
  "docker_manifest": 2,
136
134
  "docker_manifest_list": 2,
137
135
  "docker_tag": 0,
@@ -1,47 +1,68 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Link } from 'react-router-dom';
4
- import {
5
- Text,
6
- TextContent,
7
- TextVariants,
8
- } from '@patternfly/react-core';
9
4
  import { translate as __ } from 'foremanReact/common/I18n';
10
5
  import { urlBuilder } from 'foremanReact/common/urlHelpers';
6
+ import ContentConfig from './../../../Content/ContentConfig';
7
+ import InactiveText from '../../components/InactiveText';
11
8
 
12
9
  const ContentViewVersionContent = ({ cvId, versionId, cvVersion }) => {
13
10
  const {
14
- deb_count: debCount,
15
- docker_manifest_count: dockerManifestCount,
16
- docker_tag_count: dockerTagCount,
17
- file_count: fileCount,
18
- module_stream_count: moduleStreamCount,
19
- ansible_collection_count: ansibleCollectionCount,
11
+ deb_count: debCount = 0,
12
+ docker_manifest_count: dockerManifestCount = 0,
13
+ docker_tag_count: dockerTagCount = 0,
14
+ file_count: fileCount = 0,
15
+ module_stream_count: moduleStreamCount = 0,
16
+ ansible_collection_count: ansibleCollectionCount = 0,
20
17
  } = cvVersion;
21
18
 
19
+
20
+ const genericContentTypes = ContentConfig().filter(({ names: { singularLabel } }) => {
21
+ // Ansible Collections has a tab in version details so it's handled separately below.
22
+ if (singularLabel === 'ansible_collection') return false;
23
+ const countLabel = `${singularLabel}_count`;
24
+ return !!cvVersion[countLabel];
25
+ }).map(({ names: { singularLabel, singularLowercase, pluralLowercase } }) => {
26
+ const countParam = `${singularLabel}_count`;
27
+ const count = cvVersion[countParam];
28
+ return {
29
+ label: count > 1 ? pluralLowercase : singularLowercase,
30
+ count,
31
+ };
32
+ });
33
+
34
+ const noCounts =
35
+ !Number(debCount) && !Number(dockerManifestCount) && !Number(dockerTagCount) &&
36
+ !Number(fileCount) && !Number(moduleStreamCount) && !Number(ansibleCollectionCount) &&
37
+ !genericContentTypes?.length;
38
+
39
+ if (noCounts) {
40
+ return <InactiveText text={__('No content')} />;
41
+ }
42
+
22
43
  return (
23
- <React.Fragment>
24
- {(moduleStreamCount > 0 &&
44
+ <>
45
+ {moduleStreamCount > 0 &&
25
46
  <>
26
47
  <Link to={`/versions/${versionId}/moduleStreams`}>
27
48
  {`${moduleStreamCount} Module streams`}
28
49
  </Link><br />
29
- </>)
50
+ </>
30
51
  }
31
- {(debCount > 0 &&
52
+ {debCount > 0 &&
32
53
  <>
33
54
  <Link to={`/versions/${versionId}/debPackages`}>
34
55
  {`${debCount} Deb packages`}
35
56
  </Link><br />
36
- </>)
57
+ </>
37
58
  }
38
- {(dockerManifestCount > 0 && dockerTagCount > 0 &&
59
+ {dockerManifestCount > 0 && dockerTagCount > 0 &&
39
60
  <>
40
61
  <Link to={`/versions/${versionId}/dockerTags`}>
41
62
  {`${dockerTagCount} Docker tags`}
42
63
  </Link><br />
43
64
  <a href={urlBuilder(`content_views/${cvId}#/versions/${versionId}/dockerTags`, '')}>{`${dockerManifestCount} Container manifests`}</a><br />
44
- </>)
65
+ </>
45
66
  }
46
67
  {fileCount > 0 &&
47
68
  <>
@@ -49,19 +70,17 @@ const ContentViewVersionContent = ({ cvId, versionId, cvVersion }) => {
49
70
  </>
50
71
  }
51
72
  {ansibleCollectionCount > 0 &&
52
- <>
53
- <a href={urlBuilder(`content_views/${cvId}#/versions/${versionId}/ansibleCollections`, '')}>{`${ansibleCollectionCount} Collections`}</a><br />
54
- </>
73
+ <>
74
+ <a href={urlBuilder(`content_views/${cvId}#/versions/${versionId}/ansibleCollections`, '')}>{`${ansibleCollectionCount} Collections`}</a><br />
75
+ </>
55
76
  }
56
- {(moduleStreamCount === 0 && debCount === 0 &&
57
- dockerManifestCount === 0 && dockerTagCount === 0 &&
58
- fileCount === 0 && ansibleCollectionCount === 0 &&
59
- <TextContent>
60
- <Text component={TextVariants.small}>{__('N/A')}</Text>
61
- </TextContent>
62
- )
77
+ {genericContentTypes?.length > 0 &&
78
+ genericContentTypes.map(({ label, count }) => (
79
+ <span key={label} style={{ whiteSpace: 'pre-line' }}>
80
+ {`${count} ${label}`}
81
+ </span>))
63
82
  }
64
- </React.Fragment>
83
+ </>
65
84
  );
66
85
  };
67
86
 
@@ -13,12 +13,12 @@ const ContentViewVersionEnvironments = ({ environments }) => {
13
13
 
14
14
  return environments.map(env => (
15
15
  <React.Fragment key={env.id}>
16
- <Flex>
16
+ <Flex style={{ margin: '4px 0' }} >
17
17
  <FlexItem>
18
18
  <Label isTruncated color="purple" href={`/lifecycle_environments/${env.id}`}>{env.name}</Label>
19
19
  </FlexItem>
20
20
  <FlexItem>
21
- <InactiveText text={` ${env.publish_date} ago`} /><br />
21
+ <InactiveText text={` ${env.publish_date} ago`} />
22
22
  </FlexItem>
23
23
  </Flex>
24
24
  </React.Fragment>));
@@ -15,6 +15,10 @@ const ContentViewVersionErrata = ({ cvId, versionId, errataCounts }) => {
15
15
  total,
16
16
  } = errataCounts;
17
17
 
18
+ if (!Number(total)) {
19
+ return <InactiveText text={__('No applicable errata')} />;
20
+ }
21
+
18
22
  const errataIcons = {
19
23
  security: SecurityIcon,
20
24
  bugfix: BugIcon,
@@ -31,15 +35,13 @@ const ContentViewVersionErrata = ({ cvId, versionId, errataCounts }) => {
31
35
  );
32
36
  });
33
37
 
34
- if (total === 0) {
35
- return <InactiveText text={__('No errata')} />;
36
- }
37
-
38
38
  return (
39
- <React.Fragment>
40
- <a href={urlBuilder(`content_views/${cvId}#/versions/${versionId}/errata`, '')}>{`${total || 0} `}</a>
39
+ <>
40
+ <a href={urlBuilder(`content_views/${cvId}#/versions/${versionId}/errata`, '')}>
41
+ {total || 0}{' '}
42
+ </a>
41
43
  ( <ErrataLinkwithIcon /> )
42
- </React.Fragment>
44
+ </>
43
45
  );
44
46
  };
45
47
 
@@ -1,8 +1,11 @@
1
1
  .errata-icons-with-commas {
2
+ margin: 0;
3
+
2
4
  &:not(:last-child):after {
3
5
  content: ', ';
4
- margin-right: 0.5em;
6
+ margin-right: 4px;
5
7
  }
8
+
6
9
  display: inline-flex;
7
- margin-left: 0.5em;
10
+ margin-left: 4px;
8
11
  }