katello 4.3.0 → 4.4.0.rc1

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 (337) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/common/vendor.js +0 -1
  3. data/app/controllers/katello/api/v2/api_controller.rb +13 -4
  4. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +3 -0
  5. data/app/controllers/katello/api/v2/content_views_controller.rb +46 -0
  6. data/app/controllers/katello/api/v2/host_packages_controller.rb +21 -1
  7. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +30 -1
  8. data/app/controllers/katello/api/v2/organizations_controller.rb +10 -6
  9. data/app/controllers/katello/api/v2/packages_controller.rb +4 -0
  10. data/app/controllers/katello/api/v2/repositories_controller.rb +17 -7
  11. data/app/controllers/katello/api/v2/repository_sets_controller.rb +7 -0
  12. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +3 -0
  13. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +32 -0
  14. data/app/controllers/katello/remote_execution_controller.rb +5 -4
  15. data/app/helpers/katello/content_source_helper.rb +43 -0
  16. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +4 -0
  17. data/app/lib/actions/katello/cdn_configuration/update.rb +5 -7
  18. data/app/lib/actions/katello/content_view/publish.rb +5 -0
  19. data/app/lib/actions/katello/content_view_version/incremental_update.rb +17 -3
  20. data/app/lib/actions/katello/repository/discover.rb +1 -14
  21. data/app/lib/actions/katello/repository/filtered_index_content.rb +1 -1
  22. data/app/lib/actions/pulp3/content_view_version/import.rb +7 -0
  23. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +7 -5
  24. data/app/lib/actions/pulp3/repository/copy_content.rb +1 -1
  25. data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -0
  26. data/app/lib/katello/concerns/base_template_scope_extensions.rb +11 -0
  27. data/app/lib/katello/errors.rb +3 -3
  28. data/app/lib/katello/logging.rb +6 -1
  29. data/app/lib/katello/repo_discovery.rb +27 -19
  30. data/app/lib/katello/resources/cdn/katello_cdn.rb +41 -3
  31. data/app/lib/katello/resources/cdn.rb +4 -2
  32. data/app/lib/katello/util/deduplication_migrator.rb +105 -0
  33. data/app/models/katello/candlepin/repository_mapper.rb +1 -1
  34. data/app/models/katello/cdn_configuration.rb +38 -6
  35. data/app/models/katello/concerns/host_managed_extensions.rb +23 -1
  36. data/app/models/katello/concerns/organization_extensions.rb +5 -1
  37. data/app/models/katello/concerns/pulp_database_unit.rb +59 -173
  38. data/app/models/katello/concerns/remote_execution_proxy_selector_extensions.rb +11 -0
  39. data/app/models/katello/concerns/smart_proxy_extensions.rb +1 -1
  40. data/app/models/katello/content_view.rb +4 -4
  41. data/app/models/katello/content_view_filter.rb +1 -1
  42. data/app/models/katello/content_view_history.rb +1 -1
  43. data/app/models/katello/content_view_version.rb +6 -2
  44. data/app/models/katello/content_view_version_export_history.rb +1 -1
  45. data/app/models/katello/deb.rb +1 -3
  46. data/app/models/katello/docker_meta_tag.rb +1 -1
  47. data/app/models/katello/erratum.rb +0 -15
  48. data/app/models/katello/glue/pulp/repos.rb +1 -1
  49. data/app/models/katello/host/content_facet.rb +2 -27
  50. data/app/models/katello/host/info_provider.rb +9 -0
  51. data/app/models/katello/host/subscription_facet.rb +2 -2
  52. data/app/models/katello/hostgroup/content_facet.rb +2 -2
  53. data/app/models/katello/product.rb +1 -1
  54. data/app/models/katello/product_content.rb +2 -2
  55. data/app/models/katello/repository.rb +10 -9
  56. data/app/models/katello/root_repository.rb +24 -13
  57. data/app/models/katello/rpm.rb +8 -2
  58. data/app/models/setting/content.rb +6 -3
  59. data/app/services/cert/rhsm_client.rb +1 -5
  60. data/app/services/katello/content_unit_indexer.rb +166 -0
  61. data/app/services/katello/organization_creator.rb +12 -4
  62. data/app/services/katello/pulp/repository/docker.rb +1 -1
  63. data/app/services/katello/pulp/repository/yum.rb +0 -54
  64. data/app/services/katello/pulp/repository.rb +0 -6
  65. data/app/services/katello/pulp3/ansible_collection.rb +26 -10
  66. data/app/services/katello/pulp3/api/apt.rb +7 -0
  67. data/app/services/katello/pulp3/content_view_version/import.rb +11 -2
  68. data/app/services/katello/pulp3/deb.rb +10 -9
  69. data/app/services/katello/pulp3/docker_manifest.rb +6 -5
  70. data/app/services/katello/pulp3/docker_manifest_list.rb +23 -6
  71. data/app/services/katello/pulp3/docker_tag.rb +16 -7
  72. data/app/services/katello/pulp3/erratum.rb +51 -56
  73. data/app/services/katello/pulp3/file_unit.rb +9 -6
  74. data/app/services/katello/pulp3/generic_content_unit.rb +11 -12
  75. data/app/services/katello/pulp3/module_stream.rb +76 -30
  76. data/app/services/katello/pulp3/package_group.rb +5 -5
  77. data/app/services/katello/pulp3/pulp_content_unit.rb +19 -11
  78. data/app/services/katello/pulp3/repository/apt.rb +5 -3
  79. data/app/services/katello/pulp3/repository/docker.rb +14 -7
  80. data/app/services/katello/pulp3/repository/generic.rb +1 -1
  81. data/app/services/katello/pulp3/repository/yum.rb +10 -12
  82. data/app/services/katello/pulp3/repository.rb +26 -7
  83. data/app/services/katello/pulp3/repository_mirror.rb +18 -5
  84. data/app/services/katello/pulp3/rpm.rb +13 -13
  85. data/app/services/katello/pulp3/srpm.rb +10 -9
  86. data/app/services/katello/repository_type.rb +15 -4
  87. data/app/services/katello/repository_type_manager.rb +1 -1
  88. data/app/services/katello/ui_notifications/subscriptions/manifest_expired_warning.rb +1 -1
  89. data/app/services/katello/upstream_connection_checker.rb +2 -2
  90. data/app/views/foreman/job_templates/change_content_source.erb +1 -31
  91. data/app/views/foreman/job_templates/install_errata.erb +6 -9
  92. data/app/views/foreman/job_templates/install_errata_by_search_query.erb +26 -0
  93. data/app/views/foreman/job_templates/install_packages_by_search_query.erb +19 -0
  94. data/app/views/katello/api/v2/cdn_configurations/show.json.rabl +1 -1
  95. data/app/views/katello/api/v2/environments/show.json.rabl +9 -0
  96. data/app/views/katello/api/v2/repositories/show.json.rabl +2 -0
  97. data/app/views/katello/layouts/react.html.erb +0 -1
  98. data/app/views/katello/sync_management/_repo.html.erb +36 -25
  99. data/config/initializers/monkeys.rb +0 -1
  100. data/config/routes/api/v2.rb +1 -0
  101. data/config/routes/overrides.rb +3 -0
  102. data/config/routes.rb +2 -0
  103. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  104. data/db/migrate/20180612164926_add_content_org_id.rb +2 -2
  105. data/db/migrate/20211201154845_add_unique_indexes.rb +20 -0
  106. data/db/migrate/20211208034230_add_content_view_and_lifecycle_environment.rb +6 -0
  107. data/db/migrate/20211220185935_clean_duplicate_content_units.rb +144 -0
  108. data/db/migrate/20220110223754_update_disconnected_settings.rb +20 -0
  109. data/db/migrate/20220120163252_fix_docker_download_policy.rb +11 -0
  110. data/db/migrate/20220124191056_add_type_to_cdn_configuration.rb +22 -0
  111. data/db/migrate/20220127120843_fix_debian_download_policy.rb +11 -0
  112. data/db/migrate/20220204171908_rename_docker_tags_whitelist_and_add_exclude_tags.rb +8 -0
  113. data/db/migrate/20220207140355_change_deb_attributes_size_limit.rb +7 -0
  114. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  115. data/engines/bastion/app/views/bastion/layouts/application.html.erb +0 -1
  116. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +0 -1
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/content-credentials.controller.js +1 -1
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/content-credential-products.controller.js +1 -1
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/content-credential-repositories.controller.js +1 -1
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-traces-modal.html +1 -1
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment.html +26 -1
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +212 -152
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/packages.controller.js +1 -0
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +20 -8
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-manage-content.controller.js +2 -3
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +8 -3
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +34 -30
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +16 -2
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +35 -15
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/discovery.controller.js +5 -4
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.routes.js +4 -3
  132. data/lib/katello/engine.rb +4 -0
  133. data/lib/katello/permission_creator.rb +1 -1
  134. data/lib/katello/permissions/host_permissions.rb +3 -1
  135. data/lib/katello/plugin.rb +4 -1
  136. data/lib/katello/repository_types/deb.rb +0 -1
  137. data/lib/katello/repository_types/docker.rb +4 -4
  138. data/lib/katello/repository_types/file.rb +0 -1
  139. data/lib/katello/repository_types/ostree.rb +4 -0
  140. data/lib/katello/repository_types/python.rb +5 -1
  141. data/lib/katello/repository_types/yum.rb +2 -9
  142. data/lib/katello/tasks/content_view_import_only.rake +34 -0
  143. data/lib/katello/tasks/import_applicability.rake +1 -1
  144. data/lib/katello/tasks/jenkins.rake +0 -2
  145. data/lib/katello/tasks/repository.rake +4 -1
  146. data/lib/katello/tasks/upgrades/4.4/publish_import_cvvs.rake +17 -0
  147. data/lib/katello/version.rb +1 -1
  148. data/locale/action_names.rb +8 -7
  149. data/locale/bn/katello.po +1402 -650
  150. data/locale/cs/katello.po +1217 -96
  151. data/locale/de/katello.po +2359 -1347
  152. data/locale/en/katello.po +1216 -94
  153. data/locale/es/katello.po +2201 -1172
  154. data/locale/fr/katello.po +2601 -1615
  155. data/locale/gu/katello.po +1564 -814
  156. data/locale/hi/katello.po +1563 -810
  157. data/locale/it/katello.po +1311 -282
  158. data/locale/ja/katello.po +2534 -1518
  159. data/locale/katello.pot +3430 -1326
  160. data/locale/kn/katello.po +1564 -812
  161. data/locale/ko/katello.po +1441 -409
  162. data/locale/mr/katello.po +1564 -776
  163. data/locale/or/katello.po +1565 -813
  164. data/locale/pa/katello.po +1559 -792
  165. data/locale/pt/katello.po +1314 -277
  166. data/locale/pt_BR/katello.po +2226 -1181
  167. data/locale/ru/katello.po +1587 -563
  168. data/locale/ta/katello.po +1373 -619
  169. data/locale/te/katello.po +1564 -810
  170. data/locale/zh_CN/katello.po +2936 -1890
  171. data/locale/zh_TW/katello.po +1508 -606
  172. data/webpack/__mocks__/foremanReact/{redux/actions/toasts.js → components/ToastsList/index.js} +3 -2
  173. data/webpack/components/ActionableDetail.js +35 -21
  174. data/webpack/components/Content/Details/__tests__/ContentDetailInfo.test.js +0 -2
  175. data/webpack/components/Content/Details/__tests__/ContentDetailRepositories.test.js +0 -2
  176. data/webpack/components/Content/Details/__tests__/ContentDetails.test.js +0 -2
  177. data/webpack/components/Content/__tests__/ContentPage.test.js +0 -2
  178. data/webpack/components/Content/__tests__/ContentTable.test.js +0 -2
  179. data/webpack/components/EditableSwitch.js +8 -2
  180. data/webpack/components/EditableTextInput/EditableTextInput.js +44 -86
  181. data/webpack/components/EditableTextInput/__tests__/editableTextInput.test.js +3 -3
  182. data/webpack/components/Errata/index.js +19 -11
  183. data/webpack/components/Packages/index.js +1 -1
  184. data/webpack/components/Search/Search.js +5 -2
  185. data/webpack/components/Search/__tests__/search.test.js +2 -3
  186. data/webpack/components/SelectOrg/SetOrganization.js +1 -1
  187. data/webpack/components/Table/PageControls.js +3 -6
  188. data/webpack/components/Table/TableHooks.js +46 -7
  189. data/webpack/components/Table/TableWrapper.js +14 -3
  190. data/webpack/components/TypeAhead/TypeAhead.js +5 -1
  191. data/webpack/components/TypeAhead/pf4Search/TypeAheadInput.js +4 -1
  192. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +2 -1
  193. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard.js +1 -1
  194. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +3 -4
  195. data/webpack/components/extensions/HostDetails/HostDetailsActions.js +2 -0
  196. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesActions.js +18 -2
  197. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesConstants.js +12 -0
  198. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/SecondaryTabsRoutes.js +1 -1
  199. data/webpack/components/extensions/HostDetails/Tabs/{ErrataTab.js → ErrataTab/ErrataTab.js} +30 -21
  200. data/webpack/components/extensions/HostDetails/Tabs/{ErrataTab.scss → ErrataTab/ErrataTab.scss} +0 -0
  201. data/webpack/components/extensions/HostDetails/Tabs/{ErratumExpansionContents.js → ErrataTab/ErratumExpansionContents.js} +0 -0
  202. data/webpack/components/extensions/HostDetails/Tabs/{ErratumExpansionDetail.js → ErrataTab/ErratumExpansionDetail.js} +0 -0
  203. data/webpack/components/extensions/HostDetails/{HostErrata → Tabs/ErrataTab}/HostErrataActions.js +3 -3
  204. data/webpack/components/extensions/HostDetails/{HostErrata → Tabs/ErrataTab}/HostErrataConstants.js +11 -0
  205. data/webpack/components/extensions/HostDetails/{HostErrata → Tabs/ErrataTab}/HostErrataSelectors.js +0 -0
  206. data/webpack/components/extensions/HostDetails/Tabs/PackageInstallModal.js +279 -0
  207. data/webpack/components/extensions/HostDetails/Tabs/PackageInstallModal.scss +3 -0
  208. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.js +125 -8
  209. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +27 -4
  210. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionConstants.js +2 -1
  211. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +6 -3
  212. data/webpack/components/extensions/HostDetails/Tabs/{EnableTracerEmptyState.js → TracesTab/EnableTracerEmptyState.js} +0 -0
  213. data/webpack/components/extensions/HostDetails/Tabs/{EnableTracerModal.js → TracesTab/EnableTracerModal.js} +3 -2
  214. data/webpack/components/extensions/HostDetails/Tabs/{HostTracesActions.js → TracesTab/HostTracesActions.js} +2 -2
  215. data/webpack/components/extensions/HostDetails/Tabs/{HostTracesConstants.js → TracesTab/HostTracesConstants.js} +0 -0
  216. data/webpack/components/extensions/HostDetails/Tabs/{HostTracesSelectors.js → TracesTab/HostTracesSelectors.js} +0 -0
  217. data/webpack/components/extensions/HostDetails/Tabs/{TracesTab.js → TracesTab/TracesTab.js} +8 -5
  218. data/webpack/components/extensions/HostDetails/Tabs/{TracesTab.scss → TracesTab/TracesTab.scss} +0 -0
  219. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +17 -18
  220. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +385 -0
  221. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packages.fixtures.json +1 -1
  222. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +58 -7
  223. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +2 -2
  224. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +4 -4
  225. data/webpack/components/extensions/HostDetails/Tabs/__tests__/yumInstallablePackages.fixtures.json +72 -0
  226. data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +12 -5
  227. data/webpack/components/extensions/HostDetails/YumInstallablePackages/YumInstallablePackagesActions.js +18 -0
  228. data/webpack/components/extensions/HostDetails/YumInstallablePackages/YumInstallablePackagesConstants.js +3 -0
  229. data/webpack/components/extensions/HostDetails/YumInstallablePackages/YumInstallablePackagesSelectors.js +16 -0
  230. data/webpack/components/extensions/HostDetails/hostDetailsHelpers.js +19 -0
  231. data/webpack/components/pf3Table/components/Table.js +2 -3
  232. data/webpack/components/pf3Table/components/Table.test.js +0 -3
  233. data/webpack/components/pf3Table/components/__snapshots__/Table.test.js.snap +9 -8
  234. data/webpack/containers/Application/config.js +5 -0
  235. data/webpack/global_index.js +1 -1
  236. data/webpack/global_test_setup.js +1 -1
  237. data/webpack/index.js +7 -0
  238. data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetails.test.js +0 -2
  239. data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionPage.test.js +0 -2
  240. data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsTable.test.js +0 -2
  241. data/webpack/scenes/Content/ContentConfig.js +55 -5
  242. data/webpack/scenes/Content/ContentPage.js +1 -1
  243. data/webpack/scenes/Content/Details/ContentDetails.js +1 -1
  244. data/webpack/scenes/Content/Details/ContentInfo.js +1 -1
  245. data/webpack/scenes/Content/Details/ContentRepositories.js +1 -1
  246. data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +4 -4
  247. data/webpack/scenes/Content/Table/ContentTable.js +1 -1
  248. data/webpack/scenes/Content/__tests__/contentTable.test.js +3 -3
  249. data/webpack/scenes/ContentViews/ContentViewsConstants.js +2 -1
  250. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +6 -6
  251. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +2 -2
  252. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +21 -27
  253. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +5 -5
  254. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +8 -3
  255. data/webpack/scenes/ContentViews/Details/DetailsContainer.js +11 -16
  256. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetails.js +2 -2
  257. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +14 -8
  258. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +2 -2
  259. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +2 -3
  260. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +2 -9
  261. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +3 -5
  262. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +2 -10
  263. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +2 -3
  264. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +2 -3
  265. data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +2 -2
  266. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +1 -1
  267. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +23 -2
  268. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +11 -5
  269. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionContent.js +16 -17
  270. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +1 -1
  271. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +6 -6
  272. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +30 -34
  273. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetails.js +9 -8
  274. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsHeader.js +13 -15
  275. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionRepositoryCell.js +1 -1
  276. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +4 -4
  277. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +3 -3
  278. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +5 -3
  279. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
  280. data/webpack/scenes/Hosts/ChangeContentSource/actions.js +43 -0
  281. data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js +87 -0
  282. data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceTemplate.js +90 -0
  283. data/webpack/scenes/Hosts/ChangeContentSource/components/FormField.js +43 -0
  284. data/webpack/scenes/Hosts/ChangeContentSource/constants.js +3 -0
  285. data/webpack/scenes/Hosts/ChangeContentSource/helpers.js +27 -0
  286. data/webpack/scenes/Hosts/ChangeContentSource/index.js +126 -0
  287. data/webpack/scenes/Hosts/ChangeContentSource/selectors.js +42 -0
  288. data/webpack/scenes/Hosts/ChangeContentSource/styles.scss +11 -0
  289. data/webpack/scenes/ModuleStreams/Details/Profiles/__tests__/ModuleStreamDetailProfiles.test.js +0 -1
  290. data/webpack/scenes/ModuleStreams/Details/__tests__/ModuleStreamDetails.test.js +0 -2
  291. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamPage.test.js +0 -2
  292. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamsTable.test.js +0 -2
  293. data/webpack/scenes/Organizations/OrganizationActions.js +5 -1
  294. data/webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js +31 -1
  295. data/webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js +16 -0
  296. data/webpack/scenes/RedHatRepositories/__tests__/__snapshots__/RedHatRepositoriesPage.test.js.snap +11 -2
  297. data/webpack/scenes/RedHatRepositories/helpers.js +5 -5
  298. data/webpack/scenes/RedHatRepositories/index.js +11 -3
  299. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/AirGappedTypeForm.js +81 -0
  300. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnConfigurationConstants.js +13 -0
  301. data/webpack/scenes/Subscriptions/Manifest/{CdnConfigurationForm.scss → CdnConfigurationTab/CdnConfigurationForm.scss} +0 -0
  302. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnTypeForm.js +106 -0
  303. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/UpstreamServerTypeForm.js +259 -0
  304. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/AirGappedTypeForm.test.js +44 -0
  305. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/CdnTypeForm.test.js +67 -0
  306. data/webpack/scenes/Subscriptions/Manifest/{__tests__/CdnConfigurationForm.test.js → CdnConfigurationTab/__tests__/UpstreamServerTypeForm.test.js} +46 -17
  307. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/index.js +97 -0
  308. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +6 -1
  309. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +0 -1
  310. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -1
  311. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +3 -2
  312. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +4 -0
  313. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +9 -0
  314. data/webpack/scenes/Tasks/TaskActions.js +1 -1
  315. data/webpack/scenes/Tasks/__tests__/__snapshots__/TaskActions.test.js.snap +3 -2
  316. data/webpack/services/api/testHelpers.js +5 -3
  317. data/webpack/utils/helpers.js +6 -3
  318. metadata +81 -58
  319. data/app/services/katello/pulp/deb.rb +0 -55
  320. data/app/services/katello/pulp/distribution.rb +0 -7
  321. data/app/services/katello/pulp/docker_blob.rb +0 -7
  322. data/app/services/katello/pulp/docker_manifest.rb +0 -13
  323. data/app/services/katello/pulp/docker_manifest_list.rb +0 -14
  324. data/app/services/katello/pulp/docker_tag.rb +0 -14
  325. data/app/services/katello/pulp/erratum.rb +0 -129
  326. data/app/services/katello/pulp/file_unit.rb +0 -21
  327. data/app/services/katello/pulp/module_stream.rb +0 -39
  328. data/app/services/katello/pulp/package_category.rb +0 -7
  329. data/app/services/katello/pulp/package_group.rb +0 -20
  330. data/app/services/katello/pulp/pulp_content_unit.rb +0 -156
  331. data/app/services/katello/pulp/rpm.rb +0 -57
  332. data/app/services/katello/pulp/srpm.rb +0 -29
  333. data/app/services/katello/pulp/yum_metadata_file.rb +0 -30
  334. data/lib/monkeys/pulp3_13_checksumfix.rb +0 -17
  335. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationHooks.js +0 -2
  336. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
  337. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationForm.js +0 -185
@@ -0,0 +1,81 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+ import { FormattedMessage } from 'react-intl';
5
+ import {
6
+ ActionGroup,
7
+ Button,
8
+ Form,
9
+ } from '@patternfly/react-core';
10
+ import { translate as __ } from 'foremanReact/common/I18n';
11
+ import { noop } from 'foremanReact/common/helpers';
12
+
13
+ import { AIRGAPPED } from './CdnConfigurationConstants';
14
+ import { updateCdnConfiguration } from '../../../Organizations/OrganizationActions';
15
+ import {
16
+ selectUpdatingCdnConfiguration,
17
+ } from '../../../Organizations/OrganizationSelectors';
18
+
19
+ import './CdnConfigurationForm.scss';
20
+
21
+ const AirGappedTypeForm = ({ showUpdate, onUpdate }) => {
22
+ const [updateEnabled, setUpdateEnabled] = useState(showUpdate);
23
+ const updatingCdnConfiguration = useSelector(state => selectUpdatingCdnConfiguration(state));
24
+ const dispatch = useDispatch();
25
+ const performUpdate = () => {
26
+ setUpdateEnabled(false);
27
+ dispatch(updateCdnConfiguration({
28
+ type: AIRGAPPED,
29
+ }, onUpdate));
30
+ };
31
+
32
+ return (
33
+ <Form isHorizontal>
34
+ <div id="update-hint-cdn" className="margin-top-16">
35
+ <p>
36
+ <FormattedMessage
37
+ id="cdn-configuration-type"
38
+ defaultMessage={__('Red Hat content will be enabled and consumed via the {type} process.')}
39
+ values={{
40
+ type: <strong>{__('Import/Export')}</strong>,
41
+ }}
42
+ />
43
+ <br />
44
+ {showUpdate &&
45
+ <FormattedMessage
46
+ id="cdn-configuration-type-cdn"
47
+ defaultMessage={__('Click {update} below to save changes.')}
48
+ values={{
49
+ update: <strong>{__('Update')}</strong>,
50
+ }}
51
+ />
52
+ }
53
+ </p>
54
+ </div>
55
+
56
+ <ActionGroup>
57
+ <Button
58
+ aria-label="update-airgapped-configuration"
59
+ variant="secondary"
60
+ onClick={performUpdate}
61
+ isDisabled={updatingCdnConfiguration || !updateEnabled}
62
+ isLoading={updatingCdnConfiguration}
63
+ >
64
+ {__('Update')}
65
+ </Button>
66
+ </ActionGroup>
67
+ </Form>
68
+ );
69
+ };
70
+
71
+
72
+ AirGappedTypeForm.propTypes = {
73
+ showUpdate: PropTypes.bool.isRequired,
74
+ onUpdate: PropTypes.func,
75
+ };
76
+
77
+ AirGappedTypeForm.defaultProps = {
78
+ onUpdate: noop,
79
+ };
80
+
81
+ export default AirGappedTypeForm;
@@ -0,0 +1,13 @@
1
+ import { translate as __ } from 'foremanReact/common/I18n';
2
+
3
+ export const CDN_URL = 'https://cdn.redhat.com';
4
+
5
+ export const [CDN, UPSTREAM_SERVER, AIRGAPPED] = ['redhat_cdn', 'upstream_server', 'airgapped'];
6
+ export const CDN_CONFIGURATION_TYPES = {
7
+ redhat_cdn: __('Red Hat CDN'),
8
+ upstream_server: __('Upstream Foreman server'),
9
+ airgapped: __('Air-gapped'),
10
+ };
11
+
12
+ export const DEFAULT_CONTENT_VIEW_LABEL = 'Default_Organization_View';
13
+ export const DEFAULT_LIFECYCLE_ENVIRONMENT_LABEL = 'Library';
@@ -0,0 +1,106 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+ import { FormattedMessage } from 'react-intl';
5
+ import {
6
+ ActionGroup,
7
+ Button,
8
+ Form,
9
+ FormGroup,
10
+ TextInput,
11
+ Text,
12
+ } from '@patternfly/react-core';
13
+ import { translate as __ } from 'foremanReact/common/I18n';
14
+ import { noop } from 'foremanReact/common/helpers';
15
+
16
+ import { CDN_URL, CDN } from './CdnConfigurationConstants';
17
+ import { updateCdnConfiguration } from '../../../Organizations/OrganizationActions';
18
+ import {
19
+ selectUpdatingCdnConfiguration,
20
+ } from '../../../Organizations/OrganizationSelectors';
21
+ import './CdnConfigurationForm.scss';
22
+
23
+ const CdnTypeForm = ({ showUpdate, onUpdate, url }) => {
24
+ const dispatch = useDispatch();
25
+ const [cdnUrl, setCdnUrl] = useState(url);
26
+ const [updateEnabled, setUpdateEnabled] = useState(showUpdate);
27
+ const updatingCdnConfiguration = useSelector(state => selectUpdatingCdnConfiguration(state));
28
+ const firstUpdate = useRef(true);
29
+
30
+ useEffect(() => {
31
+ if (firstUpdate.current) {
32
+ firstUpdate.current = false;
33
+ return;
34
+ }
35
+ setUpdateEnabled(true);
36
+ }, [cdnUrl]);
37
+
38
+ const performUpdate = () => {
39
+ setUpdateEnabled(false);
40
+ dispatch(updateCdnConfiguration({
41
+ type: CDN,
42
+ url: cdnUrl,
43
+ }, onUpdate));
44
+ };
45
+
46
+ return (
47
+ <Form isHorizontal>
48
+ <div id="update-hint-cdn" className="margin-top-16">
49
+ <Text>
50
+ <FormattedMessage
51
+ id="cdn-configuration-type"
52
+ defaultMessage={__('Red Hat content will be consumed from the {type}.')}
53
+ values={{
54
+ type: <strong>{__('Red Hat CDN')}</strong>,
55
+ }}
56
+ />
57
+ <br />
58
+ {showUpdate &&
59
+ <FormattedMessage
60
+ id="cdn-configuration-type-cdn"
61
+ defaultMessage={__('Click {update} below to save changes.')}
62
+ values={{
63
+ update: <strong>{__('Update')}</strong>,
64
+ }}
65
+ />
66
+ }
67
+ </Text>
68
+ </div>
69
+ <FormGroup label={__('URL')} isRequired>
70
+ <TextInput
71
+ aria-label="cdn-url"
72
+ type="text"
73
+ value={cdnUrl}
74
+ onChange={setCdnUrl}
75
+ isDisabled={updatingCdnConfiguration}
76
+ />
77
+ </FormGroup>
78
+
79
+ <ActionGroup>
80
+ <Button
81
+ aria-label="update-cdn-configuration"
82
+ variant="secondary"
83
+ onClick={performUpdate}
84
+ isDisabled={updatingCdnConfiguration || !updateEnabled || !cdnUrl}
85
+ isLoading={updatingCdnConfiguration}
86
+ >
87
+ {__('Update')}
88
+ </Button>
89
+ </ActionGroup>
90
+ </Form>
91
+
92
+ );
93
+ };
94
+
95
+ CdnTypeForm.propTypes = {
96
+ showUpdate: PropTypes.bool.isRequired,
97
+ onUpdate: PropTypes.func,
98
+ url: PropTypes.string,
99
+ };
100
+
101
+ CdnTypeForm.defaultProps = {
102
+ url: CDN_URL,
103
+ onUpdate: noop,
104
+ };
105
+
106
+ export default CdnTypeForm;
@@ -0,0 +1,259 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+ import { FormattedMessage } from 'react-intl';
5
+ import {
6
+ ActionGroup,
7
+ Alert,
8
+ Button,
9
+ Form,
10
+ FormAlert,
11
+ FormGroup,
12
+ FormSelect,
13
+ FormSelectOption,
14
+ TextInput,
15
+ Text,
16
+ } from '@patternfly/react-core';
17
+
18
+ import { translate as __ } from 'foremanReact/common/I18n';
19
+ import { noop } from 'foremanReact/common/helpers';
20
+
21
+ import { UPSTREAM_SERVER, DEFAULT_CONTENT_VIEW_LABEL, DEFAULT_LIFECYCLE_ENVIRONMENT_LABEL } from './CdnConfigurationConstants';
22
+ import EditableTextInput from '../../../../components/EditableTextInput';
23
+
24
+ import {
25
+ selectUpdatingCdnConfiguration,
26
+ } from '../../../Organizations/OrganizationSelectors';
27
+
28
+ import { updateCdnConfiguration } from '../../../Organizations/OrganizationActions';
29
+ import './CdnConfigurationForm.scss';
30
+
31
+ const UpstreamServerTypeForm = ({
32
+ showUpdate, contentCredentials, cdnConfiguration, onUpdate,
33
+ }) => {
34
+ const dispatch = useDispatch();
35
+ const urlValue = cdnConfiguration.type === UPSTREAM_SERVER ? cdnConfiguration.url : '';
36
+ const [url, setUrl] = useState(urlValue);
37
+ const [username, setUsername] = useState(cdnConfiguration.username);
38
+ const [password, setPassword] = useState(null);
39
+ const [organizationLabel, setOrganizationLabel] =
40
+ useState(cdnConfiguration.upstream_organization_label);
41
+ const [sslCaCredentialId, setSslCaCredentialId] = useState(cdnConfiguration.ssl_ca_credential_id);
42
+ const updatingCdnConfiguration = useSelector(state => selectUpdatingCdnConfiguration(state));
43
+
44
+ const [contentViewLabel, setContentViewLabel] =
45
+ useState(cdnConfiguration.upstream_content_view_label);
46
+
47
+ const [lifecycleEnvironmentLabel, setLifecycleEnvironmentLabel] =
48
+ useState(cdnConfiguration.upstream_lifecycle_environment_label);
49
+
50
+ const [updateEnabled, setUpdateEnabled] = useState(false);
51
+
52
+ const firstUpdate = useRef(true);
53
+ useEffect(() => {
54
+ if (firstUpdate.current) {
55
+ firstUpdate.current = false;
56
+ return;
57
+ }
58
+ setUpdateEnabled(true);
59
+ }, [url, username, password, organizationLabel,
60
+ contentViewLabel, lifecycleEnvironmentLabel,
61
+ sslCaCredentialId, cdnConfiguration]);
62
+
63
+ const editPassword = (value) => {
64
+ if (value === null) {
65
+ setPassword('');
66
+ } else {
67
+ setPassword(value);
68
+ }
69
+ };
70
+ const hasPassword = (cdnConfiguration.password_exists && !password)
71
+ || password?.length > 0;
72
+
73
+ const requiredFields = [username, organizationLabel, sslCaCredentialId];
74
+
75
+ if (!hasPassword) {
76
+ requiredFields.push(password);
77
+ }
78
+
79
+ const validated = !requiredFields.some(field => !field);
80
+ const onError = () => setUpdateEnabled(true);
81
+
82
+ const performUpdate = () => {
83
+ setUpdateEnabled(false);
84
+ dispatch(updateCdnConfiguration({
85
+ url,
86
+ username,
87
+ password,
88
+ upstream_organization_label: organizationLabel,
89
+ ssl_ca_credential_id: sslCaCredentialId,
90
+ upstream_content_view_label: contentViewLabel,
91
+ upstream_lifecycle_environment_label: lifecycleEnvironmentLabel,
92
+ type: UPSTREAM_SERVER,
93
+ }, onUpdate, onError));
94
+ };
95
+
96
+ return (
97
+ <div id="cdn-configuration">
98
+ <Form isHorizontal>
99
+ { !validated && (
100
+ <FormAlert>
101
+ <Alert
102
+ variant="danger"
103
+ title={__('Username, Password, Organization Label, and SSL CA Content Credential must be provided together.')}
104
+ aria-live="polite"
105
+ isInline
106
+ />
107
+ </FormAlert>
108
+ )}
109
+
110
+ <div id="update-hint-upstream-server" className="margin-top-16">
111
+ <Text>
112
+ <FormattedMessage
113
+ id="cdn-configuration-type"
114
+ defaultMessage={__('Red Hat content will be consumed from an {type}.')}
115
+ values={{
116
+ type: <strong>{__('upstream Foreman server')}</strong>,
117
+ }}
118
+ />
119
+ <br />
120
+ {showUpdate &&
121
+ <FormattedMessage
122
+ id="cdn-configuration-type-upstream-server"
123
+ defaultMessage={__('Provide the required information and click {update} below to save changes.')}
124
+ values={{
125
+ update: <strong>{__('Update')}</strong>,
126
+ }}
127
+ />
128
+ }
129
+ </Text>
130
+ </div>
131
+ <FormGroup
132
+ label={__('URL')}
133
+ isRequired
134
+ >
135
+ <TextInput
136
+ aria-label="cdn-url"
137
+ type="text"
138
+ value={url || ''}
139
+ onChange={value => setUrl(value)}
140
+ isDisabled={updatingCdnConfiguration}
141
+ />
142
+ </FormGroup>
143
+ <FormGroup
144
+ label={__('Username')}
145
+ isRequired
146
+ >
147
+ <TextInput
148
+ aria-label="cdn-username"
149
+ type="text"
150
+ value={username || ''}
151
+ onChange={value => setUsername(value)}
152
+ isDisabled={updatingCdnConfiguration}
153
+ />
154
+ </FormGroup>
155
+ <FormGroup
156
+ label={__('Password')}
157
+ isRequired
158
+ >
159
+ <EditableTextInput
160
+ attribute="cdn-password"
161
+ value={password}
162
+ isPassword
163
+ hasPassword={hasPassword}
164
+ onEdit={editPassword}
165
+ isDisabled={updatingCdnConfiguration}
166
+ />
167
+ </FormGroup>
168
+ <FormGroup
169
+ label={__('Organization label')}
170
+ isRequired
171
+ >
172
+ <TextInput
173
+ aria-label="cdn-organization-label"
174
+ type="text"
175
+ value={organizationLabel || ''}
176
+ isDisabled={updatingCdnConfiguration}
177
+ onChange={setOrganizationLabel}
178
+ />
179
+ </FormGroup>
180
+ <FormGroup
181
+ label={__('Lifecycle Environment Label')}
182
+ >
183
+ <TextInput
184
+ aria-label="cdn-lifecycle-environment-label"
185
+ type="text"
186
+ value={lifecycleEnvironmentLabel || DEFAULT_LIFECYCLE_ENVIRONMENT_LABEL}
187
+ isDisabled={updatingCdnConfiguration}
188
+ onChange={setLifecycleEnvironmentLabel}
189
+ />
190
+ </FormGroup>
191
+ <FormGroup
192
+ label={__('Content view label')}
193
+ >
194
+ <TextInput
195
+ aria-label="cdn-content-view-label"
196
+ type="text"
197
+ value={contentViewLabel || DEFAULT_CONTENT_VIEW_LABEL}
198
+ isDisabled={updatingCdnConfiguration}
199
+ onChange={setContentViewLabel}
200
+ />
201
+ </FormGroup>
202
+ <FormGroup
203
+ label={__('SSL CA Content Credential')}
204
+ isRequired
205
+ >
206
+ <FormSelect
207
+ aria-label="cdn-ssl-ca-content-credential"
208
+ value={sslCaCredentialId || ''}
209
+ isDisabled={updatingCdnConfiguration}
210
+ onChange={value => setSslCaCredentialId(value)}
211
+ >
212
+ <FormSelectOption label={__('Select one')} isDisabled isPlaceholder />
213
+ {contentCredentials.map(cred =>
214
+ <FormSelectOption data-testid="ssl-ca-content-credential-option" key={cred.id} value={cred.id} label={cred.name} />)}
215
+ </FormSelect>
216
+ </FormGroup>
217
+
218
+ <ActionGroup>
219
+ <Button
220
+ aria-label="update-upstream-configuration"
221
+ variant="secondary"
222
+ onClick={performUpdate}
223
+ isDisabled={updatingCdnConfiguration || !validated || !updateEnabled}
224
+ isLoading={updatingCdnConfiguration}
225
+ >
226
+ {__('Update')}
227
+ </Button>
228
+ </ActionGroup>
229
+ </Form>
230
+ </div>
231
+ );
232
+ };
233
+
234
+ UpstreamServerTypeForm.propTypes = {
235
+ showUpdate: PropTypes.bool.isRequired,
236
+ contentCredentials: PropTypes.arrayOf(PropTypes.shape({
237
+ id: PropTypes.number,
238
+ name: PropTypes.string,
239
+ })),
240
+ cdnConfiguration: PropTypes.shape({
241
+ type: PropTypes.string.isRequired,
242
+ url: PropTypes.string,
243
+ username: PropTypes.string,
244
+ upstream_organization_label: PropTypes.string,
245
+ upstream_content_view_label: PropTypes.string,
246
+ upstream_lifecycle_environment_label: PropTypes.string,
247
+ ssl_ca_credential_id: PropTypes.number,
248
+ password_exists: PropTypes.bool,
249
+ }),
250
+ onUpdate: PropTypes.func,
251
+ };
252
+
253
+ UpstreamServerTypeForm.defaultProps = {
254
+ contentCredentials: [],
255
+ cdnConfiguration: {},
256
+ onUpdate: noop,
257
+ };
258
+
259
+ export default UpstreamServerTypeForm;
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { cleanup } from '@testing-library/react';
3
+ import { renderWithRedux, fireEvent } from 'react-testing-lib-wrapper';
4
+ import AirGappedTypeForm from '../AirGappedTypeForm';
5
+ import { nockInstance, assertNockRequest } from '../../../../../test-utils/nockWrapper';
6
+ import { updateCdnConfigurationSuccessResponse } from '../../../../Organizations/__tests__/organizations.fixtures';
7
+ import { AIRGAPPED } from '../CdnConfigurationConstants';
8
+
9
+ import api from '../../../../../services/api';
10
+
11
+ afterEach(cleanup);
12
+ const updateCdnConfigurationPath = api.getApiUrl('/organizations/1/cdn_configuration');
13
+
14
+ const updateButtonName = 'update-airgapped-configuration';
15
+
16
+ const organization = {
17
+ id: 1,
18
+ };
19
+
20
+ const initialState = {
21
+ katello: {
22
+ organization,
23
+ },
24
+ };
25
+
26
+
27
+ test('Can update to Airgapped type', async (done) => {
28
+ const { getByLabelText } = renderWithRedux(<AirGappedTypeForm
29
+ showUpdate
30
+ />, { initialState });
31
+
32
+ const updateCdnConfigurationRequest = nockInstance
33
+ .put(updateCdnConfigurationPath, {
34
+ type: AIRGAPPED,
35
+ })
36
+ .reply(200, updateCdnConfigurationSuccessResponse);
37
+
38
+ expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'false');
39
+
40
+ const updateButton = getByLabelText(updateButtonName);
41
+ fireEvent.click(updateButton);
42
+ assertNockRequest(updateCdnConfigurationRequest, done);
43
+ });
44
+
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { cleanup } from '@testing-library/react';
3
+ import { renderWithRedux, fireEvent } from 'react-testing-lib-wrapper';
4
+ import CdnTypeForm from '../CdnTypeForm';
5
+ import { nockInstance, assertNockRequest } from '../../../../../test-utils/nockWrapper';
6
+ import { updateCdnConfigurationSuccessResponse } from '../../../../Organizations/__tests__/organizations.fixtures';
7
+ import { CDN, CDN_URL } from '../CdnConfigurationConstants';
8
+
9
+ import api from '../../../../../services/api';
10
+
11
+ afterEach(cleanup);
12
+ const updateCdnConfigurationPath = api.getApiUrl('/organizations/1/cdn_configuration');
13
+
14
+ const updateButtonName = 'update-cdn-configuration';
15
+ const organization = {
16
+ id: 1,
17
+ };
18
+
19
+ const initialState = {
20
+ katello: {
21
+ organization,
22
+ },
23
+ };
24
+
25
+ test('Can update to cdn type', async (done) => {
26
+ const { getByLabelText } = renderWithRedux(<CdnTypeForm
27
+ showUpdate
28
+ url={CDN_URL}
29
+ />, { initialState });
30
+
31
+ const updateCdnConfigurationRequest = nockInstance
32
+ .put(updateCdnConfigurationPath, {
33
+ url: CDN_URL,
34
+ type: CDN,
35
+ })
36
+ .reply(200, updateCdnConfigurationSuccessResponse);
37
+
38
+ expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'false');
39
+
40
+ const updateButton = getByLabelText(updateButtonName);
41
+ fireEvent.click(updateButton);
42
+ assertNockRequest(updateCdnConfigurationRequest, done);
43
+ });
44
+
45
+ test('Can update the cdn url', async (done) => {
46
+ const { getByLabelText } = renderWithRedux(<CdnTypeForm
47
+ showUpdate={false}
48
+ url={CDN_URL}
49
+ />, { initialState });
50
+
51
+ const updateCdnConfigurationRequest = nockInstance
52
+ .put(updateCdnConfigurationPath, {
53
+ url: 'http://cdn.example.com',
54
+ type: CDN,
55
+ })
56
+ .reply(200, updateCdnConfigurationSuccessResponse);
57
+
58
+ expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'true');
59
+
60
+ const url = getByLabelText('cdn-url');
61
+ fireEvent.change(url, { target: { value: 'http://cdn.example.com' } });
62
+
63
+ const updateButton = getByLabelText(updateButtonName);
64
+ expect(updateButton).toHaveAttribute('aria-disabled', 'false');
65
+ fireEvent.click(updateButton);
66
+ assertNockRequest(updateCdnConfigurationRequest, done);
67
+ });
@@ -2,20 +2,27 @@ import React from 'react';
2
2
  import { cleanup } from '@testing-library/react';
3
3
  import { renderWithRedux, fireEvent, patientlyWaitFor } from 'react-testing-lib-wrapper';
4
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';
5
+ import UpstreamServerTypeForm from '../UpstreamServerTypeForm';
6
+ import { nockInstance, assertNockRequest } from '../../../../../test-utils/nockWrapper';
7
+ import { updateCdnConfigurationSuccessResponse } from '../../../../Organizations/__tests__/organizations.fixtures';
8
+ import { UPSTREAM_SERVER } from '../CdnConfigurationConstants';
9
+
10
+ import api from '../../../../../services/api';
9
11
 
10
12
  afterEach(cleanup);
11
13
  const updateCdnConfigurationPath = api.getApiUrl('/organizations/1/cdn_configuration');
12
14
 
15
+ const updateButtonName = 'update-upstream-configuration';
16
+
13
17
  const cdnConfiguration = {
14
18
  url: 'http://currentcdn.example.com',
15
19
  username: 'CurrentUser',
16
20
  password_exists: false,
17
21
  upstream_organization_label: 'CurrentOrg',
18
22
  ssl_ca_credential_id: 2,
23
+ type: UPSTREAM_SERVER,
24
+ upstream_lifecycle_environment_label: 'Library',
25
+ upstream_content_view_label: 'CV',
19
26
  };
20
27
 
21
28
  const organization = {
@@ -39,8 +46,9 @@ const contentCredentials = [
39
46
  },
40
47
  ];
41
48
 
42
- test('Can update the CDN configuration', async (done) => {
43
- const { getByLabelText } = renderWithRedux(<CdnConfigurationForm
49
+ test('Can update the upstream server configuration', async (done) => {
50
+ const { getByLabelText } = renderWithRedux(<UpstreamServerTypeForm
51
+ showUpdate
44
52
  cdnConfiguration={cdnConfiguration}
45
53
  contentCredentials={contentCredentials}
46
54
  />, { initialState });
@@ -52,6 +60,9 @@ test('Can update the CDN configuration', async (done) => {
52
60
  password: 'changeme',
53
61
  upstream_organization_label: 'Default_Organization',
54
62
  ssl_ca_credential_id: '1',
63
+ type: UPSTREAM_SERVER,
64
+ upstream_lifecycle_environment_label: 'Library',
65
+ upstream_content_view_label: 'CV',
55
66
  })
56
67
  .reply(200, updateCdnConfigurationSuccessResponse);
57
68
 
@@ -74,14 +85,15 @@ test('Can update the CDN configuration', async (done) => {
74
85
  '1',
75
86
  );
76
87
 
77
- const updateButton = getByLabelText('update-cdn-configuration');
88
+ const updateButton = getByLabelText(updateButtonName);
78
89
  fireEvent.click(updateButton);
79
90
 
80
91
  assertNockRequest(updateCdnConfigurationRequest, done);
81
92
  });
82
93
 
83
94
  test('the form shall reflect the given cdnConfiguration', () => {
84
- const { getAllByTestId, getByLabelText } = renderWithRedux(<CdnConfigurationForm
95
+ const { getAllByTestId, getByLabelText } = renderWithRedux(<UpstreamServerTypeForm
96
+ showUpdate
85
97
  cdnConfiguration={cdnConfiguration}
86
98
  contentCredentials={contentCredentials}
87
99
  />, { initialState });
@@ -96,19 +108,36 @@ test('the form shall reflect the given cdnConfiguration', () => {
96
108
  expect(options[1].selected).toBeTruthy();
97
109
  });
98
110
 
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);
111
+ test('resetting the password enables/disables appropriately', async (done) => {
112
+ const { getByLabelText } = renderWithRedux(<UpstreamServerTypeForm
113
+ showUpdate
114
+ cdnConfiguration={{ ...cdnConfiguration, password_exists: true }}
115
+ />, { initialState });
105
116
 
117
+ expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'true');
106
118
  fireEvent.click(getByLabelText('edit cdn-password'));
107
119
  fireEvent.change(getByLabelText('cdn-password text input'), { target: { value: 'changeme' } });
108
120
  fireEvent.click(getByLabelText('clear cdn-password'));
121
+ expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'true');
109
122
 
110
- const updateButton = getByLabelText('update-cdn-configuration');
111
- fireEvent.click(updateButton);
123
+ fireEvent.click(getByLabelText('edit cdn-password'));
124
+ fireEvent.change(getByLabelText('cdn-password text input'), { target: { value: 'changeme' } });
125
+ fireEvent.click(getByLabelText('submit cdn-password'));
112
126
 
113
- assertNockRequest(updateCdnConfigurationRequest, done);
127
+ await patientlyWaitFor(() => expect(getByLabelText('cdn-password text value')).toBeInTheDocument());
128
+ expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'false');
129
+ done();
130
+ });
131
+
132
+ test('update button disabled on incomplete information', async (done) => {
133
+ const { getByLabelText } = renderWithRedux(<UpstreamServerTypeForm
134
+ showUpdate
135
+ cdnConfiguration={{ ...cdnConfiguration, password_exists: true }}
136
+ contentCredentials={contentCredentials}
137
+ />, { initialState });
138
+
139
+ expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'true');
140
+ fireEvent.change(getByLabelText('cdn-username'), { target: { value: 'user' } });
141
+ expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'false');
142
+ done();
114
143
  });