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,6 +1,6 @@
1
1
  import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Grid, Col, Row, Tabs, Tab, Form, FormGroup, FormControl, ControlLabel } from 'react-bootstrap';
3
+ import { Grid, Col, Row, Tabs, Tab, FormControl, ControlLabel } from 'react-bootstrap';
4
4
  import { Button, Spinner } from 'patternfly-react';
5
5
  import ForemanModal from 'foremanReact/components/ForemanModal';
6
6
  import Slot from 'foremanReact/components/common/Slot';
@@ -12,21 +12,16 @@ import { Table } from '../../../components/pf3Table';
12
12
  import { columns } from './ManifestHistoryTableSchema';
13
13
  import DeleteManifestModalText from './DeleteManifestModalText';
14
14
  import { MANAGE_MANIFEST_MODAL_ID, DELETE_MANIFEST_MODAL_ID } from './ManifestConstants';
15
+ import { CONTENT_CREDENTIAL_CERT_TYPE } from '../../ContentCredentials/ContentCredentialConstants';
15
16
  import SimpleContentAccess from './SimpleContentAccess';
17
+ import CdnConfigurationForm from './CdnConfigurationForm';
16
18
 
17
19
  import './ManageManifestModal.scss';
18
20
 
19
21
  class ManageManifestModal extends Component {
20
- constructor(props) {
21
- super(props);
22
-
23
- this.state = {
24
- redhat_repository_url: null,
25
- };
26
- }
27
-
28
22
  componentDidMount() {
29
23
  this.props.loadManifestHistory();
24
+ this.props.getContentCredentials({ content_type: CONTENT_CREDENTIAL_CERT_TYPE });
30
25
  }
31
26
 
32
27
  componentDidUpdate(prevProps) {
@@ -57,14 +52,6 @@ class ManageManifestModal extends Component {
57
52
  }
58
53
  };
59
54
 
60
- updateRepositoryUrl = (event) => {
61
- this.setState({ redhat_repository_url: event.target.value });
62
- };
63
-
64
- saveOrganization = () => {
65
- this.props.saveOrganization({ redhat_repository_url: this.state.redhat_repository_url });
66
- };
67
-
68
55
  uploadManifest = (fileList) => {
69
56
  if (fileList.length > 0) {
70
57
  this.props.upload(fileList[0]);
@@ -102,12 +89,13 @@ class ManageManifestModal extends Component {
102
89
  disableSimpleContentAccess,
103
90
  taskInProgress,
104
91
  manifestActionStarted,
92
+ contentCredentials,
105
93
  } = this.props;
106
94
 
107
95
  const actionInProgress = (taskInProgress || manifestActionStarted);
108
- const showRedHatProviderDetails = canEditOrganizations;
96
+ const showCdnConfigurationTab = canEditOrganizations;
109
97
  const showSubscriptionManifest = (canImportManifest || canDeleteManifest);
110
- const showManifestTab = (showRedHatProviderDetails || showSubscriptionManifest);
98
+ const showManifestTab = (canEditOrganizations || showSubscriptionManifest);
111
99
  const disableSCASwitch = (
112
100
  // allow users to turn SCA off even if they are not eligible to turn it back on
113
101
  (!simpleContentAccessEligible && !simpleContentAccess) ||
@@ -125,11 +113,7 @@ class ManageManifestModal extends Component {
125
113
  url: 'http://redhat.com',
126
114
  },
127
115
  });
128
- const buttonLoading = (
129
- <span>
130
- {__('Updating...')}
131
- <span className="fa fa-spinner fa-spin" />
132
- </span>);
116
+
133
117
  const getManifestName = () => {
134
118
  let name = __('No Manifest Uploaded');
135
119
 
@@ -156,136 +140,94 @@ class ManageManifestModal extends Component {
156
140
  <Tabs id="manifest-history-tabs">
157
141
  {showManifestTab &&
158
142
  <Tab eventKey={1} title={__('Manifest')}>
159
- <Form className="form-horizontal">
160
- {showRedHatProviderDetails &&
161
- <React.Fragment>
162
- <h3>{__('Red Hat Provider Details')}</h3>
163
- <hr />
164
- <FormGroup>
165
- <Grid>
166
- <Row>
167
- <Col sm={5}>
168
- <ControlLabel htmlFor="cdnUrl">
169
- {__('Red Hat CDN URL')}
170
- </ControlLabel>
171
- </Col>
172
- <Col sm={7}>
173
- <FormControl
174
- id="cdnUrl"
175
- type="text"
176
- defaultValue={this.state.redhat_repository_url || organization.redhat_repository_url || ''}
177
- onBlur={this.updateRepositoryUrl}
178
- />
179
- </Col>
180
- </Row>
181
- </Grid>
182
- </FormGroup>
183
- <FormGroup>
184
- <Grid>
185
- <Row>
186
- <Col smOffset={5} sm={7}>
187
- <Button onClick={this.saveOrganization} disabled={organization.loading}>
188
- {organization.loading ? buttonLoading : __('Update')}
189
- </Button>
190
- </Col>
191
- </Row>
192
- </Grid>
193
- </FormGroup>
194
- <br />
195
- </React.Fragment>
196
- }
197
143
  {showSubscriptionManifest &&
198
144
  <React.Fragment>
199
-
200
- <FormGroup>
201
- <Grid>
202
- <h3>{__('Subscription Manifest')}</h3>
203
- <hr />
204
- { isManifestImported &&
205
- <Row>
206
- <SimpleContentAccess
207
- enableSimpleContentAccess={enableSimpleContentAccess}
208
- disableSimpleContentAccess={disableSimpleContentAccess}
209
- isSimpleContentAccessEnabled={simpleContentAccess}
210
- canToggleSimpleContentAccess={!disableSCASwitch}
211
- simpleContentAccessEligible={simpleContentAccessEligible}
212
- />
213
- </Row>
145
+ <Grid>
146
+ <h3>{__('Subscription Manifest')}</h3>
147
+ <hr />
148
+ { isManifestImported &&
149
+ <Row>
150
+ <SimpleContentAccess
151
+ enableSimpleContentAccess={enableSimpleContentAccess}
152
+ disableSimpleContentAccess={disableSimpleContentAccess}
153
+ isSimpleContentAccessEnabled={simpleContentAccess}
154
+ canToggleSimpleContentAccess={!disableSCASwitch}
155
+ simpleContentAccessEligible={simpleContentAccessEligible}
156
+ />
157
+ </Row>
214
158
  }
215
- <Row>
216
- <Col sm={5}>
217
- <strong>{__('Subscription Allocation')}</strong>
218
- </Col>
219
- <Col sm={7}>
220
- {getManifestName()}
221
- </Col>
222
- </Row>
223
- <Row>
224
- <Col sm={5}>
225
- {canImportManifest &&
226
- <ControlLabel
227
- style={{ paddingTop: '10px' }}
228
- >
229
- <div>{__('Import New Manifest')}</div>
230
- </ControlLabel>
159
+ <Row>
160
+ <Col sm={5}>
161
+ <strong>{__('Subscription Allocation')}</strong>
162
+ </Col>
163
+ <Col sm={7}>
164
+ {getManifestName()}
165
+ </Col>
166
+ </Row>
167
+ <Row>
168
+ <Col sm={5}>
169
+ {canImportManifest &&
170
+ <ControlLabel
171
+ style={{ paddingTop: '10px' }}
172
+ >
173
+ <div>{__('Import New Manifest')}</div>
174
+ </ControlLabel>
231
175
  }
232
- </Col>
233
- <Col sm={7} className="manifest-actions">
234
- <Spinner loading={actionInProgress} />
235
- {canImportManifest &&
236
- <FormControl
237
- id="usmaFile"
238
- type="file"
239
- accept=".zip"
240
- disabled={actionInProgress}
241
- onChange={e => this.uploadManifest(e.target.files)}
242
- />
176
+ </Col>
177
+ <Col sm={7} className="manifest-actions">
178
+ <Spinner loading={actionInProgress} />
179
+ {canImportManifest &&
180
+ <FormControl
181
+ id="usmaFile"
182
+ type="file"
183
+ accept=".zip"
184
+ disabled={actionInProgress}
185
+ onChange={e => this.uploadManifest(e.target.files)}
186
+ />
243
187
  }
244
- <div id="manifest-actions-row">
245
- {canImportManifest &&
246
- <TooltipButton
247
- onClick={this.refreshManifest}
248
- tooltipId="refresh-manifest-button-tooltip"
249
- tooltipText={disabledReason}
250
- tooltipPlacement="top"
251
- title={__('Refresh')}
252
- disabled={!isManifestImported ||
188
+ <div id="manifest-actions-row">
189
+ {canImportManifest &&
190
+ <TooltipButton
191
+ onClick={this.refreshManifest}
192
+ tooltipId="refresh-manifest-button-tooltip"
193
+ tooltipText={disabledReason}
194
+ tooltipPlacement="top"
195
+ title={__('Refresh')}
196
+ disabled={!isManifestImported ||
253
197
  actionInProgress || disableManifestActions}
254
- />
198
+ />
255
199
  }
256
- {canDeleteManifest &&
257
- <React.Fragment>
258
- <TooltipButton
259
- disabled={!isManifestImported || actionInProgress}
260
- bsStyle="danger"
261
- onClick={this.showDeleteManifestModal}
262
- title={__('Delete')}
263
- tooltipId="delete-manifest-button-tooltip"
264
- tooltipText={this.disabledTooltipText()}
265
- tooltipPlacement="top"
266
- />
267
- </React.Fragment>
200
+ {canDeleteManifest &&
201
+ <React.Fragment>
202
+ <TooltipButton
203
+ disabled={!isManifestImported || actionInProgress}
204
+ bsStyle="danger"
205
+ onClick={this.showDeleteManifestModal}
206
+ title={__('Delete')}
207
+ tooltipId="delete-manifest-button-tooltip"
208
+ tooltipText={this.disabledTooltipText()}
209
+ tooltipPlacement="top"
210
+ />
211
+ </React.Fragment>
268
212
  }
269
- </div>
270
- <ForemanModal title={__('Confirm delete manifest')} id={DELETE_MANIFEST_MODAL_ID}>
271
- <DeleteManifestModalText />
272
- <ForemanModal.Footer>
273
- <Button bsStyle="default" onClick={this.hideDeleteManifestModal}>
274
- {__('Cancel')}
275
- </Button>
276
- <Button bsStyle="danger" onClick={this.deleteManifest}>
277
- {__('Delete')}
278
- </Button>
279
- </ForemanModal.Footer>
280
- </ForemanModal>
281
- </Col>
282
- </Row>
283
- </Grid>
284
- </FormGroup>
213
+ </div>
214
+ <ForemanModal title={__('Confirm delete manifest')} id={DELETE_MANIFEST_MODAL_ID}>
215
+ <DeleteManifestModalText />
216
+ <ForemanModal.Footer>
217
+ <Button bsStyle="default" onClick={this.hideDeleteManifestModal}>
218
+ {__('Cancel')}
219
+ </Button>
220
+ <Button bsStyle="danger" onClick={this.deleteManifest}>
221
+ {__('Delete')}
222
+ </Button>
223
+ </ForemanModal.Footer>
224
+ </ForemanModal>
225
+ </Col>
226
+ </Row>
227
+ </Grid>
285
228
  </React.Fragment>
286
229
  }
287
- <Slot id="katello-manage-manifest-form" multi />
288
- </Form>
230
+ <Slot id="katello-manage-manifest-form" multi />
289
231
  </Tab>
290
232
  }
291
233
  <Tab eventKey={2} title={__('Manifest History')}>
@@ -297,6 +239,18 @@ class ManageManifestModal extends Component {
297
239
  />
298
240
  </LoadingState>
299
241
  </Tab>
242
+ {showCdnConfigurationTab &&
243
+ <Tab eventKey={3} title={__('CDN Configuration')}>
244
+ <Grid>
245
+ <h3>{__('CDN Configuration for Red Hat Content')}</h3>
246
+ <hr />
247
+ <CdnConfigurationForm
248
+ cdnConfiguration={organization.cdn_configuration}
249
+ contentCredentials={contentCredentials}
250
+ />
251
+ </Grid>
252
+ </Tab>
253
+ }
300
254
  </Tabs>
301
255
  <ForemanModal.Footer>
302
256
  <Button bsStyle="primary" onClick={this.hideModal}>
@@ -315,9 +269,17 @@ ManageManifestModal.propTypes = {
315
269
  enableSimpleContentAccess: PropTypes.func.isRequired,
316
270
  disableSimpleContentAccess: PropTypes.func.isRequired,
317
271
  loadManifestHistory: PropTypes.func.isRequired,
272
+ getContentCredentials: PropTypes.func.isRequired,
318
273
  organization: PropTypes.shape({
274
+ id: PropTypes.number,
319
275
  loading: PropTypes.bool,
320
- redhat_repository_url: PropTypes.string,
276
+ cdn_configuration: PropTypes.shape({
277
+ url: PropTypes.string,
278
+ username: PropTypes.string,
279
+ upstream_organization_label: PropTypes.string,
280
+ ssl_ca_credential_id: PropTypes.number,
281
+ password_exists: PropTypes.bool,
282
+ }),
321
283
  owner_details: PropTypes.shape({
322
284
  upstreamConsumer: PropTypes.shape({
323
285
  uuid: PropTypes.string,
@@ -334,7 +296,6 @@ ManageManifestModal.propTypes = {
334
296
  disableManifestActions: PropTypes.bool,
335
297
  disabledReason: PropTypes.string,
336
298
  loadOrganization: PropTypes.func.isRequired,
337
- saveOrganization: PropTypes.func.isRequired,
338
299
  taskInProgress: PropTypes.bool.isRequired,
339
300
  simpleContentAccess: PropTypes.bool,
340
301
  simpleContentAccessEligible: PropTypes.bool,
@@ -347,6 +308,10 @@ ManageManifestModal.propTypes = {
347
308
  setModalClosed: PropTypes.func.isRequired,
348
309
  setModalOpen: PropTypes.func.isRequired,
349
310
  manifestActionStarted: PropTypes.bool,
311
+ contentCredentials: PropTypes.arrayOf(PropTypes.shape({
312
+ id: PropTypes.number,
313
+ name: PropTypes.string,
314
+ })),
350
315
  };
351
316
 
352
317
  ManageManifestModal.defaultProps = {
@@ -360,6 +325,7 @@ ManageManifestModal.defaultProps = {
360
325
  simpleContentAccess: false,
361
326
  simpleContentAccessEligible: undefined,
362
327
  manifestActionStarted: false,
328
+ contentCredentials: [],
363
329
  };
364
330
 
365
331
  export default ManageManifestModal;
@@ -0,0 +1,114 @@
1
+ import React from 'react';
2
+ import { cleanup } from '@testing-library/react';
3
+ import { renderWithRedux, fireEvent, patientlyWaitFor } from 'react-testing-lib-wrapper';
4
+ import userEvent from '@testing-library/user-event';
5
+ import CdnConfigurationForm from '../CdnConfigurationForm';
6
+ import { nockInstance, assertNockRequest } from '../../../../test-utils/nockWrapper';
7
+ import { updateCdnConfigurationSuccessResponse } from '../../../Organizations/__tests__/organizations.fixtures';
8
+ import api from '../../../../services/api';
9
+
10
+ afterEach(cleanup);
11
+ const updateCdnConfigurationPath = api.getApiUrl('/organizations/1/cdn_configuration');
12
+
13
+ const cdnConfiguration = {
14
+ url: 'http://currentcdn.example.com',
15
+ username: 'CurrentUser',
16
+ password_exists: false,
17
+ upstream_organization_label: 'CurrentOrg',
18
+ ssl_ca_credential_id: 2,
19
+ };
20
+
21
+ const organization = {
22
+ id: 1,
23
+ };
24
+
25
+ const initialState = {
26
+ katello: {
27
+ organization,
28
+ },
29
+ };
30
+
31
+ const contentCredentials = [
32
+ {
33
+ name: 'Credential1',
34
+ id: 1,
35
+ },
36
+ {
37
+ name: 'Credential2',
38
+ id: 2,
39
+ },
40
+ ];
41
+
42
+ test('Can update the CDN configuration', async (done) => {
43
+ const { getByLabelText } = renderWithRedux(<CdnConfigurationForm
44
+ cdnConfiguration={cdnConfiguration}
45
+ contentCredentials={contentCredentials}
46
+ />, { initialState });
47
+
48
+ const updateCdnConfigurationRequest = nockInstance
49
+ .put(updateCdnConfigurationPath, {
50
+ url: 'http://cdn.example.com',
51
+ username: 'admin',
52
+ password: 'changeme',
53
+ upstream_organization_label: 'Default_Organization',
54
+ ssl_ca_credential_id: '1',
55
+ })
56
+ .reply(200, updateCdnConfigurationSuccessResponse);
57
+
58
+ const url = getByLabelText('cdn-url');
59
+ fireEvent.change(url, { target: { value: 'http://cdn.example.com' } });
60
+
61
+ const username = getByLabelText('cdn-username');
62
+ fireEvent.change(username, { target: { value: 'admin' } });
63
+
64
+ fireEvent.click(getByLabelText('edit cdn-password'));
65
+ fireEvent.change(getByLabelText('cdn-password text input'), { target: { value: 'changeme' } });
66
+ fireEvent.click(getByLabelText('submit cdn-password'));
67
+ await patientlyWaitFor(() => expect(getByLabelText('cdn-password text value')).toBeInTheDocument());
68
+
69
+ const orgLabel = getByLabelText('cdn-organization-label');
70
+ fireEvent.change(orgLabel, { target: { value: 'Default_Organization' } });
71
+
72
+ userEvent.selectOptions(
73
+ getByLabelText('cdn-ssl-ca-content-credential'),
74
+ '1',
75
+ );
76
+
77
+ const updateButton = getByLabelText('update-cdn-configuration');
78
+ fireEvent.click(updateButton);
79
+
80
+ assertNockRequest(updateCdnConfigurationRequest, done);
81
+ });
82
+
83
+ test('the form shall reflect the given cdnConfiguration', () => {
84
+ const { getAllByTestId, getByLabelText } = renderWithRedux(<CdnConfigurationForm
85
+ cdnConfiguration={cdnConfiguration}
86
+ contentCredentials={contentCredentials}
87
+ />, { initialState });
88
+
89
+ const username = getByLabelText('cdn-username');
90
+ expect(username).toHaveValue('CurrentUser');
91
+
92
+ const options = getAllByTestId('ssl-ca-content-credential-option');
93
+
94
+ expect(options).toHaveLength(contentCredentials.length);
95
+ expect(options[0].selected).toBeFalsy();
96
+ expect(options[1].selected).toBeTruthy();
97
+ });
98
+
99
+ test('resetting the password sends nothing to the API', async (done) => {
100
+ const { getByLabelText } = renderWithRedux(<CdnConfigurationForm />, { initialState });
101
+
102
+ const updateCdnConfigurationRequest = nockInstance
103
+ .put(updateCdnConfigurationPath, {}) // note the empty request body
104
+ .reply(200, updateCdnConfigurationSuccessResponse);
105
+
106
+ fireEvent.click(getByLabelText('edit cdn-password'));
107
+ fireEvent.change(getByLabelText('cdn-password text input'), { target: { value: 'changeme' } });
108
+ fireEvent.click(getByLabelText('clear cdn-password'));
109
+
110
+ const updateButton = getByLabelText('update-cdn-configuration');
111
+ fireEvent.click(updateButton);
112
+
113
+ assertNockRequest(updateCdnConfigurationRequest, done);
114
+ });
@@ -1,33 +1,123 @@
1
1
  import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import toJson from 'enzyme-to-json';
4
- import ManageManifestModal from '../ManageManifestModal';
5
- import { manifestHistorySuccessState } from './manifest.fixtures';
6
-
7
- jest.mock('foremanReact/components/Pagination/PaginationWrapper', () => (<div>Pagination Mock</div>));
8
- jest.mock('foremanReact/components/ForemanModal');
9
-
10
- describe('manage manifest modal', () => {
11
- const noop = jest.fn();
12
- const organization = { id: 1, redhat_repository_url: 'https://redhat.com' };
13
-
14
- it('should render', () => {
15
- const page = shallow(<ManageManifestModal
16
- setModalOpen={noop}
17
- setModalClosed={noop}
18
- upload={noop}
19
- refresh={noop}
20
- delete={noop}
21
- enableSimpleContentAccess={noop}
22
- disableSimpleContentAccess={noop}
23
- loadManifestHistory={noop}
24
- organization={organization}
25
- loadOrganization={noop}
26
- saveOrganization={noop}
27
- bulkSearch={noop}
28
- manifestHistory={manifestHistorySuccessState}
29
- taskInProgress={false}
30
- />);
31
- expect(toJson(page)).toMatchSnapshot();
32
- });
2
+ import { cleanup } from '@testing-library/react';
3
+ import { renderWithRedux, fireEvent, patientlyWaitFor } from 'react-testing-lib-wrapper';
4
+ import ManifestModal from '../../Manifest';
5
+ import { manifestHistorySuccessState, manifestHistorySuccessResponse } from './manifest.fixtures';
6
+ import { nockInstance, assertNockRequest } from '../../../../test-utils/nockWrapper';
7
+ import api from '../../../../services/api';
8
+
9
+ afterEach(cleanup);
10
+
11
+ const noop = jest.fn();
12
+ const organization = {
13
+ id: 1,
14
+ redhat_repository_url: 'https://redhat.com',
15
+ cdn_configuration: {
16
+
17
+ },
18
+ owner_details: {
19
+ upstreamConsumer: {
20
+ webUrl: 'https://example.com/',
21
+ },
22
+ },
23
+ };
24
+
25
+ const defaultProps = {
26
+ disableManifestActions: false,
27
+ disabledReason: '',
28
+ canImportManifest: true,
29
+ canDeleteManifest: true,
30
+ canEditOrganizations: true,
31
+ upload: noop,
32
+ refresh: noop,
33
+ delete: noop,
34
+ enableSimpleContentAccess: noop,
35
+ disableSimpleContentAccess: noop,
36
+ loadManifestHistory: noop,
37
+ organization,
38
+ loadOrganization: noop,
39
+ taskInProgress: false,
40
+ simpleContentAccess: true,
41
+ manifestHistory: manifestHistorySuccessState,
42
+ setModalClosed: noop,
43
+ setModalOpen: noop,
44
+ updateCdnConfiguration: noop,
45
+ getContentCredentials: noop,
46
+ };
47
+
48
+ const initialState = {
49
+ katello: {
50
+ organization: {
51
+ simple_content_access: false,
52
+ ...organization,
53
+ },
54
+ },
55
+ foremanModals: {
56
+ manageManifestModal: {
57
+ isOpen: true,
58
+ },
59
+ },
60
+ };
61
+
62
+ const enableSimpleContetAccessPath = api.getApiUrl('/organizations/1/simple_content_access/enable');
63
+ const disableSimpleContetAccessPath = api.getApiUrl('/organizations/1/simple_content_access/disable');
64
+ const manifestHistoryPath = api.getApiUrl('/organizations/1/subscriptions/manifest_history');
65
+ const getContentCredentialsPath = api.getApiUrl('/content_credentials?organization_id=1&content_type=cert');
66
+
67
+ test('Enable Simple Content Access after toggle switch value to true', async (done) => {
68
+ const { getByTestId } = renderWithRedux(<ManifestModal {...defaultProps} />, { initialState });
69
+
70
+ const updatescope = nockInstance
71
+ .put(enableSimpleContetAccessPath)
72
+ .reply(202, true);
73
+
74
+ const getscope = nockInstance
75
+ .get(manifestHistoryPath)
76
+ .query(true)
77
+ .reply(200, manifestHistorySuccessResponse);
78
+
79
+ const contentCredentialsRequest = nockInstance
80
+ .get(getContentCredentialsPath)
81
+ .reply(200, {});
82
+
83
+ const toggleButton = getByTestId('switch');
84
+
85
+ await patientlyWaitFor(() => { expect(toggleButton).toBeInTheDocument(); });
86
+ expect(toggleButton.checked).toEqual(false);
87
+
88
+ fireEvent.click(toggleButton);
89
+
90
+ assertNockRequest(contentCredentialsRequest);
91
+ assertNockRequest(getscope);
92
+ assertNockRequest(updatescope, done);
93
+ });
94
+
95
+ test('Disable Simple Content Access after toggle switch value to false', async (done) => {
96
+ initialState.katello.organization.simple_content_access = true;
97
+
98
+ const updatescope = nockInstance
99
+ .put(disableSimpleContetAccessPath)
100
+ .reply(202, true);
101
+
102
+ const getscope = nockInstance
103
+ .get(manifestHistoryPath)
104
+ .query(true)
105
+ .reply(200, manifestHistorySuccessResponse);
106
+
107
+ const contentCredentialsRequest = nockInstance
108
+ .get(getContentCredentialsPath)
109
+ .reply(200, {});
110
+
111
+ const { getByTestId } = renderWithRedux(<ManifestModal {...defaultProps} />, { initialState });
112
+
113
+ const toggleButton = getByTestId('switch');
114
+
115
+ await patientlyWaitFor(() => { expect(toggleButton).toBeInTheDocument(); });
116
+ expect(toggleButton.checked).toEqual(true);
117
+
118
+ fireEvent.click(toggleButton);
119
+
120
+ assertNockRequest(contentCredentialsRequest);
121
+ assertNockRequest(getscope);
122
+ assertNockRequest(updatescope, done);
33
123
  });
@@ -4,10 +4,16 @@ import { connect } from 'react-redux';
4
4
  import * as foremanModalActions from 'foremanReact/components/ForemanModal/ForemanModalActions';
5
5
  import * as manifestActions from './ManifestActions';
6
6
  import * as organizationActions from '../../Organizations/OrganizationActions';
7
+ import * as contentCredentialActions from '../../ContentCredentials/ContentCredentialActions';
7
8
  import * as tasksActions from '../../Tasks/TaskActions';
8
9
  import history from './ManifestHistoryReducer';
9
- import { selectSimpleContentAccessEnabled, selectIsManifestImported } from '../../Organizations/OrganizationSelectors';
10
+ import {
11
+ selectSimpleContentAccessEnabled,
12
+ selectIsManifestImported,
13
+ selectUpdatingCdnConfiguration,
14
+ } from '../../Organizations/OrganizationSelectors';
10
15
  import { selectManifestActionStarted, selectSimpleContentAccessEligible } from '../SubscriptionsSelectors';
16
+ import { selectContentCredentials } from '../../ContentCredentials/ContentCredentialSelectors';
11
17
 
12
18
  import ManifestModal from './ManageManifestModal';
13
19
 
@@ -19,15 +25,20 @@ const mapStateToProps = state => ({
19
25
  manifestHistory: state.katello.manifestHistory,
20
26
  simpleContentAccess: selectSimpleContentAccessEnabled(state),
21
27
  isManifestImported: selectIsManifestImported(state),
22
- modalOpenState: state.foremanModals.ManageManifestModal,
23
28
  deleteManifestModalExists: !!state.foremanModals.deleteManifestModal,
24
29
  manifestActionStarted: selectManifestActionStarted(state),
25
30
  simpleContentAccessEligible: selectSimpleContentAccessEligible(state),
31
+ updatingCdnConfiguration: selectUpdatingCdnConfiguration(state),
32
+ contentCredentials: selectContentCredentials(state),
26
33
  });
27
34
 
28
35
  // map action dispatchers to props
29
36
  const actions = {
30
- ...manifestActions, ...organizationActions, ...tasksActions, ...foremanModalActions,
37
+ ...manifestActions,
38
+ ...organizationActions,
39
+ ...tasksActions,
40
+ ...foremanModalActions,
41
+ ...contentCredentialActions,
31
42
  };
32
43
  const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
33
44