katello 4.1.4 → 4.2.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 (240) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
  3. data/app/controllers/katello/api/v2/content_credentials_controller.rb +3 -3
  4. data/app/controllers/katello/api/v2/content_uploads_controller.rb +3 -1
  5. data/app/controllers/katello/api/v2/content_view_components_controller.rb +33 -1
  6. data/app/controllers/katello/api/v2/content_views_controller.rb +12 -0
  7. data/app/controllers/katello/api/v2/host_errata_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +1 -2
  9. data/app/controllers/katello/api/v2/products_controller.rb +4 -4
  10. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +3 -11
  11. data/app/controllers/katello/api/v2/repositories_controller.rb +68 -47
  12. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +0 -28
  13. data/app/controllers/katello/concerns/api/v2/registration_commands_controller_extensions.rb +26 -5
  14. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +26 -1
  15. data/app/lib/actions/candlepin/environment/destroy.rb +2 -0
  16. data/app/lib/actions/katello/agent_action.rb +2 -2
  17. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +3 -2
  18. data/app/lib/actions/katello/{gpg_key → content_credential}/update.rb +1 -1
  19. data/app/lib/actions/katello/content_view/publish.rb +6 -1
  20. data/app/lib/actions/katello/content_view_version/create_repos.rb +1 -1
  21. data/app/lib/actions/katello/content_view_version/incremental_update.rb +0 -47
  22. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +1 -1
  23. data/app/lib/actions/katello/repository/clone_contents.rb +1 -7
  24. data/app/lib/actions/katello/repository/clone_to_environment.rb +1 -7
  25. data/app/lib/actions/katello/repository/create.rb +4 -8
  26. data/app/lib/actions/katello/repository/create_root.rb +1 -1
  27. data/app/lib/actions/katello/repository/destroy.rb +1 -3
  28. data/app/lib/actions/katello/repository/import_upload.rb +3 -2
  29. data/app/lib/actions/katello/repository/instance_update.rb +1 -1
  30. data/app/lib/actions/katello/repository/metadata_generate.rb +2 -8
  31. data/app/lib/actions/katello/repository/multi_clone_contents.rb +0 -1
  32. data/app/lib/actions/katello/repository/refresh_repository.rb +1 -4
  33. data/app/lib/actions/katello/repository/remove_content.rb +6 -4
  34. data/app/lib/actions/katello/repository/sync.rb +5 -25
  35. data/app/lib/actions/katello/repository/update.rb +1 -2
  36. data/app/lib/actions/katello/repository/update_http_proxy_details.rb +2 -5
  37. data/app/lib/actions/katello/repository/update_redhat_repository.rb +1 -1
  38. data/app/lib/actions/katello/repository/upload_files.rb +8 -3
  39. data/app/lib/actions/katello/repository/upload_package_group.rb +2 -11
  40. data/app/lib/actions/katello/repository/verify_checksum.rb +0 -1
  41. data/app/lib/actions/katello/repository_set/enable_repository.rb +1 -1
  42. data/app/lib/actions/pulp3/orchestration/repository/create.rb +2 -2
  43. data/app/lib/actions/pulp3/repository/create.rb +3 -4
  44. data/app/lib/actions/pulp3/repository/create_remote.rb +1 -6
  45. data/app/lib/actions/pulp3/repository/repair.rb +4 -0
  46. data/app/lib/katello/errors.rb +1 -0
  47. data/app/lib/katello/http_resource.rb +26 -73
  48. data/app/lib/katello/qpid/connection.rb +1 -3
  49. data/app/lib/katello/resources/candlepin/consumer.rb +1 -1
  50. data/app/lib/katello/resources/candlepin/environment.rb +2 -0
  51. data/app/lib/katello/resources/registry.rb +7 -20
  52. data/app/lib/katello/util/http_proxy.rb +0 -3
  53. data/app/lib/katello/validators/gpg_key_content_validator.rb +1 -1
  54. data/app/models/katello/authorization/{gpg_key.rb → content_credential.rb} +1 -1
  55. data/app/models/katello/authorization/product.rb +0 -4
  56. data/app/models/katello/concerns/host_managed_extensions.rb +2 -16
  57. data/app/models/katello/concerns/organization_extensions.rb +1 -1
  58. data/app/models/katello/concerns/pulp_database_unit.rb +13 -5
  59. data/app/models/katello/concerns/smart_proxy_extensions.rb +45 -41
  60. data/app/models/katello/{gpg_key.rb → content_credential.rb} +4 -4
  61. data/app/models/katello/content_view.rb +6 -1
  62. data/app/models/katello/generic_content_unit.rb +16 -0
  63. data/app/models/katello/glue/pulp/repos.rb +9 -25
  64. data/app/models/katello/kt_environment.rb +1 -1
  65. data/app/models/katello/product.rb +4 -4
  66. data/app/models/katello/repository.rb +13 -7
  67. data/app/models/katello/repository_generic_content_unit.rb +7 -0
  68. data/app/models/katello/root_repository.rb +38 -7
  69. data/app/models/setting/content.rb +5 -0
  70. data/app/services/cert/certs.rb +16 -8
  71. data/app/services/katello/applicability/applicable_content_helper.rb +1 -2
  72. data/app/services/katello/candlepin/consumer.rb +6 -0
  73. data/app/services/katello/component_view_presenter.rb +27 -0
  74. data/app/services/katello/pulp/repository.rb +1 -1
  75. data/app/services/katello/pulp/server.rb +2 -2
  76. data/app/services/katello/pulp3/api/core.rb +4 -0
  77. data/app/services/katello/pulp3/api/generic.rb +68 -0
  78. data/app/services/katello/pulp3/generic_content_unit.rb +29 -0
  79. data/app/services/katello/pulp3/pulp_content_unit.rb +5 -1
  80. data/app/services/katello/pulp3/repository/generic.rb +94 -0
  81. data/app/services/katello/pulp3/repository/yum.rb +4 -5
  82. data/app/services/katello/pulp3/repository.rb +27 -12
  83. data/app/services/katello/pulp3/repository_mirror.rb +2 -2
  84. data/app/services/katello/pulp3/smart_proxy_repository.rb +4 -4
  85. data/app/services/katello/registration_manager.rb +18 -7
  86. data/app/services/katello/repository_type.rb +59 -1
  87. data/app/services/katello/repository_type_manager.rb +116 -24
  88. data/app/views/katello/api/v2/content_views/base.json.rabl +4 -4
  89. data/app/views/katello/api/v2/repositories/show.json.rabl +1 -0
  90. data/app/views/smart_proxies/plugins/_pulpcore.html.erb +2 -5
  91. data/app/views/smart_proxies/pulp_status.html.erb +0 -7
  92. data/config/katello.yaml.example +0 -21
  93. data/config/routes/api/v2.rb +2 -1
  94. data/db/functions/deb_version_cmp_v01.sql +200 -0
  95. data/db/migrate/20171110082124_add_ssl_certs_to_products_and_repos.rb +5 -1
  96. data/db/migrate/20200402130013_add_repsoitory_docker_meta_tag_f_key.rb +3 -1
  97. data/db/migrate/20210624221630_katello_generic_content.rb +22 -0
  98. data/db/migrate/20210625095042_add_retain_package_versions_count.rb +9 -0
  99. data/db/migrate/20210628182553_add_generic_remote_options_to_root_repository.rb +5 -0
  100. data/db/migrate/20210714140440_remove_repo_export_permission.rb +5 -0
  101. data/db/migrate/20210721163730_change_gpg_keys_to_content_credentials.rb +8 -0
  102. data/db/migrate/20210728130748_create_function_deb_version_cmp.rb +12 -0
  103. data/db/seeds.d/111-upgrade_tasks.rb +1 -2
  104. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +1 -1
  105. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +7 -5
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +4 -1
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +1 -1
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +1 -1
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/apply-errata-confirm.html +2 -1
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +25 -33
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-advanced-sync-modal.html +1 -1
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-repositories.controller.js +1 -6
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +10 -2
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.filter.js +9 -0
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +0 -2
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-advanced-sync-options.html +1 -25
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +1 -1
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +31 -13
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +11 -3
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +0 -6
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/aggregate-task.factory.js +3 -3
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/task.factory.js +1 -1
  123. data/lib/katello/engine.rb +2 -4
  124. data/lib/katello/permission_creator.rb +6 -12
  125. data/lib/katello/plugin.rb +76 -80
  126. data/lib/katello/repository_types/python.rb +37 -0
  127. data/lib/katello/tasks/reimport.rake +0 -9
  128. data/lib/katello/tasks/repository.rake +3 -4
  129. data/lib/katello/version.rb +1 -1
  130. data/locale/action_names.rb +28 -29
  131. data/locale/bn/katello.po +699 -221
  132. data/locale/cs/katello.po +167 -59
  133. data/locale/de/katello.po +585 -352
  134. data/locale/en/katello.po +167 -59
  135. data/locale/es/katello.po +1388 -1189
  136. data/locale/fr/katello.po +1740 -1494
  137. data/locale/gu/katello.po +896 -416
  138. data/locale/hi/katello.po +892 -415
  139. data/locale/it/katello.po +371 -170
  140. data/locale/ja/katello.po +1657 -1439
  141. data/locale/katello.pot +933 -736
  142. data/locale/kn/katello.po +894 -416
  143. data/locale/ko/katello.po +515 -317
  144. data/locale/mr/katello.po +857 -415
  145. data/locale/or/katello.po +894 -416
  146. data/locale/pa/katello.po +874 -411
  147. data/locale/pt/katello.po +347 -154
  148. data/locale/pt_BR/katello.po +1398 -1215
  149. data/locale/ru/katello.po +671 -463
  150. data/locale/ta/katello.po +697 -221
  151. data/locale/te/katello.po +891 -415
  152. data/locale/zh_CN/katello.po +2029 -1845
  153. data/locale/zh_TW/katello.po +735 -407
  154. data/package.json +3 -1
  155. data/webpack/components/EditableTextInput/EditableTextInput.js +3 -3
  156. data/webpack/components/RoutedTabs/RoutedTabs.js +7 -8
  157. data/webpack/components/Table/TableWrapper.js +19 -11
  158. data/webpack/components/Table/helpers.js +1 -1
  159. data/webpack/components/extensions/HostDetails/Tabs/ContentTab.js +42 -0
  160. data/webpack/components/extensions/HostDetails/Tabs/SubscriptionTab.js +12 -0
  161. data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/ActivationKeys.test.js.snap +4 -0
  162. data/webpack/components/extensions/RegistrationCommands/fields/ActivationKeys.js +1 -1
  163. data/webpack/components/extensions/RegistrationCommands/index.js +1 -2
  164. data/webpack/components/pf3Table/formatters/selectionHeaderCellFormatter.js +2 -1
  165. data/webpack/fills_index.js +4 -1
  166. data/webpack/redux/actions/RedHatRepositories/helpers.js +2 -4
  167. data/webpack/redux/reducers/RedHatRepositories/enabled.js +4 -1
  168. data/webpack/scenes/ContentViews/ContentViewsActions.js +16 -1
  169. data/webpack/scenes/ContentViews/ContentViewsConstants.js +15 -0
  170. data/webpack/scenes/ContentViews/ContentViewsPage.js +12 -22
  171. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +4 -3
  172. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +25 -14
  173. data/webpack/scenes/ContentViews/Create/CreateContentViewModal.js +4 -2
  174. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +153 -0
  175. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentVersion.js +21 -10
  176. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +157 -19
  177. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.fixtures.json +100 -108
  178. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +140 -16
  179. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/publishedContentViewDetails.fixtures.json +367 -0
  180. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +59 -6
  181. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +43 -0
  182. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +44 -13
  183. data/webpack/scenes/ContentViews/Details/Filters/Add/CVFilterAddModal.js +161 -0
  184. data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterAdd.test.js +54 -0
  185. data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterCreateResult.fixtures.json +124 -0
  186. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +8 -6
  187. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +7 -6
  188. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetails.js +4 -3
  189. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +71 -12
  190. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +77 -0
  191. data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +13 -12
  192. data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +2 -2
  193. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +17 -14
  194. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +3 -3
  195. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +2 -2
  196. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +6 -2
  197. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +61 -20
  198. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewTaskInProgressResponse.fixtures.json +71 -0
  199. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewTaskResponse.fixtures.json +75 -0
  200. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +86 -1
  201. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersionsWithTask.fixtures.json +713 -0
  202. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
  203. data/webpack/scenes/ContentViews/Publish/CVPublishFinish.js +184 -0
  204. data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +104 -0
  205. data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +71 -0
  206. data/webpack/scenes/ContentViews/Publish/ContentViewPublishSelectors.js +17 -0
  207. data/webpack/scenes/ContentViews/Publish/PublishContentViewWizard.js +145 -0
  208. data/webpack/scenes/ContentViews/Publish/__tests__/environmentPaths.fixtures.json +352 -0
  209. data/webpack/scenes/ContentViews/Publish/__tests__/publishContentView.test.js +184 -0
  210. data/webpack/scenes/ContentViews/Publish/__tests__/publishResponse.fixture.json +69 -0
  211. data/webpack/scenes/ContentViews/Publish/cvPublishForm.scss +3 -0
  212. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +75 -48
  213. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +15 -2
  214. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +6 -10
  215. data/webpack/scenes/ContentViews/components/EnvironmentLabels.js +22 -10
  216. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathActions.js +12 -0
  217. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathConstants.js +2 -0
  218. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathSelectors.js +16 -0
  219. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.js +72 -0
  220. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.scss +8 -0
  221. data/webpack/scenes/ContentViews/components/TaskPresenter/TaskPresenter.js +85 -0
  222. data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +9 -8
  223. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +4 -25
  224. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -3
  225. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +3 -3
  226. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +4 -2
  227. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +24 -0
  228. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +4 -1
  229. data/webpack/scenes/Subscriptions/index.js +1 -4
  230. metadata +74 -39
  231. data/app/lib/actions/candlepin/environment/create.rb +0 -21
  232. data/app/lib/actions/foreman/environment/destroy.rb +0 -23
  233. data/app/lib/actions/katello/content_view/environment_create.rb +0 -21
  234. data/app/lib/actions/katello/repository/export.rb +0 -85
  235. data/app/lib/actions/katello/repository/purge_empty_content.rb +0 -16
  236. data/app/lib/actions/katello/repository/upload_errata.rb +0 -38
  237. data/app/lib/katello/util/proxy_uri.rb +0 -64
  238. data/app/models/katello/rhsm_fact_importer.rb +0 -20
  239. data/app/models/katello/rhsm_fact_name.rb +0 -17
  240. data/app/models/katello/rhsm_fact_parser.rb +0 -120
@@ -1,47 +1,97 @@
1
1
  {
2
- "total": 2,
3
- "subtotal": 2,
2
+ "total": 4,
3
+ "subtotal": 4,
4
4
  "page": "1",
5
5
  "per_page": "20",
6
6
  "error": null,
7
7
  "search": null,
8
8
  "sort": {
9
- "by": "label",
10
- "order": "asc"
9
+ "by": null,
10
+ "order": null
11
11
  },
12
12
  "results": [
13
13
  {
14
- "latest": false,
15
- "id": 5,
16
- "created_at": "2021-04-12 21:18:08 -0400",
17
- "updated_at": "2021-04-16 10:34:00 -0400",
14
+ "latest": true,
15
+ "id": 28,
16
+ "created_at": "2021-06-29 11:11:23 -0400",
17
+ "updated_at": "2021-06-29 11:11:23 -0400",
18
18
  "composite_content_view": {
19
- "id": 5,
20
- "name": "composite1",
21
- "label": "composite1",
22
- "description": null,
19
+ "id": 4,
20
+ "name": "ccv123",
21
+ "label": "ccv1",
22
+ "description": "blah",
23
+ "next_version": 2,
24
+ "latest_version": "1.0",
25
+ "version_count": 1
26
+ },
27
+ "content_view": {
28
+ "id": 14,
29
+ "name": "11",
30
+ "label": "11",
31
+ "description": "",
23
32
  "next_version": 1,
24
33
  "latest_version": null,
25
34
  "version_count": 0
26
35
  },
36
+ "content_view_version": null
37
+ },
38
+ {
39
+ "latest": true,
40
+ "id": 23,
41
+ "created_at": "2021-06-29 10:25:52 -0400",
42
+ "updated_at": "2021-06-29 10:25:52 -0400",
43
+ "composite_content_view": {
44
+ "id": 4,
45
+ "name": "ccv123",
46
+ "label": "ccv1",
47
+ "description": "blah",
48
+ "next_version": 2,
49
+ "latest_version": "1.0",
50
+ "version_count": 1
51
+ },
27
52
  "content_view": {
28
- "id": 3,
29
- "name": "component1",
30
- "label": "component1",
31
- "description": "Test Description",
32
- "next_version": 5,
33
- "latest_version": "4.0",
34
- "version_count": 4
53
+ "id": 10,
54
+ "name": "7",
55
+ "label": "7",
56
+ "description": "",
57
+ "next_version": 1,
58
+ "latest_version": null,
59
+ "version_count": 0
60
+ },
61
+ "content_view_version": null
62
+ },
63
+ {
64
+ "latest": true,
65
+ "id": null,
66
+ "created_at": null,
67
+ "updated_at": null,
68
+ "composite_content_view": {
69
+ "id": 4,
70
+ "name": "ccv123",
71
+ "label": "ccv1",
72
+ "description": "blah",
73
+ "next_version": 2,
74
+ "latest_version": "1.0",
75
+ "version_count": 1
76
+ },
77
+ "content_view": {
78
+ "id": 13,
79
+ "name": "10",
80
+ "label": "10",
81
+ "description": "",
82
+ "next_version": 34,
83
+ "latest_version": "33.0",
84
+ "version_count": 33
35
85
  },
36
86
  "content_view_version": {
37
- "id": 11,
38
- "name": "component1 4.0",
39
- "content_view_id": 3,
40
- "version": "4.0",
87
+ "id": 85,
88
+ "name": "10 33.0",
89
+ "content_view_id": 13,
90
+ "version": "33.0",
41
91
  "content_view": {
42
- "id": 3,
43
- "name": "component1",
44
- "label": "component1",
92
+ "id": 13,
93
+ "name": "10",
94
+ "label": "10",
45
95
  "description": ""
46
96
  },
47
97
  "environments": [
@@ -51,111 +101,53 @@
51
101
  "label": "Library"
52
102
  },
53
103
  {
54
- "id": 2,
55
- "name": "dev",
56
- "label": "dev"
57
- },
58
- {
59
- "id": 3,
104
+ "id": 5,
60
105
  "name": "dev1",
61
106
  "label": "dev1"
62
107
  },
63
- {
64
- "id": 4,
65
- "name": "dev2",
66
- "label": "dev2"
67
- },
68
- {
69
- "id": 5,
70
- "name": "dev3",
71
- "label": "dev3"
72
- },
73
108
  {
74
109
  "id": 6,
75
- "name": "test",
76
- "label": "test"
77
- },
78
- {
79
- "id": 7,
80
110
  "name": "test1",
81
111
  "label": "test1"
82
112
  },
83
113
  {
84
- "id": 9,
85
- "name": "test2",
86
- "label": "test2"
114
+ "id": 7,
115
+ "name": "prod1",
116
+ "label": "prod1"
87
117
  },
88
118
  {
89
- "id": 8,
90
- "name": "test3",
91
- "label": "test3"
119
+ "id": 9,
120
+ "name": "dev2",
121
+ "label": "dev2"
92
122
  }
93
123
  ],
94
- "repositories": [
95
- {
96
- "id": 25,
97
- "name": "test",
98
- "label": "test",
99
- "description": null
100
- },
101
- {
102
- "id": 27,
103
- "name": "fileRepo1",
104
- "label": "fileRepo1",
105
- "description": null
106
- },
107
- {
108
- "id": 26,
109
- "name": "fileRepo",
110
- "label": "fileRepo",
111
- "description": null
112
- }
113
- ]
124
+ "repositories": []
114
125
  }
115
126
  },
116
127
  {
117
128
  "latest": true,
118
- "id": 4,
119
- "created_at": "2021-04-12 21:14:48 -0400",
120
- "updated_at": "2021-04-12 21:14:48 -0400",
129
+ "id": null,
130
+ "created_at": null,
131
+ "updated_at": null,
121
132
  "composite_content_view": {
122
- "id": 5,
123
- "name": "composite1",
124
- "label": "composite1",
125
- "description": null,
126
- "next_version": 1,
127
- "latest_version": null,
128
- "version_count": 0
129
- },
130
- "content_view": {
131
133
  "id": 4,
132
- "name": "component2",
133
- "label": "component2",
134
- "description": null,
134
+ "name": "ccv123",
135
+ "label": "ccv1",
136
+ "description": "blah",
135
137
  "next_version": 2,
136
138
  "latest_version": "1.0",
137
139
  "version_count": 1
138
140
  },
139
- "content_view_version": {
140
- "id": 8,
141
- "name": "component2 1.0",
142
- "content_view_id": 4,
143
- "version": "1.0",
144
- "content_view": {
145
- "id": 4,
146
- "name": "component2",
147
- "label": "component2",
148
- "description": null
149
- },
150
- "environments": [
151
- {
152
- "id": 1,
153
- "name": "Library",
154
- "label": "Library"
155
- }
156
- ],
157
- "repositories": []
158
- }
141
+ "content_view": {
142
+ "id": 9,
143
+ "name": "6",
144
+ "label": "6",
145
+ "description": "",
146
+ "next_version": 1,
147
+ "latest_version": null,
148
+ "version_count": 0
149
+ },
150
+ "content_view_version": null
159
151
  }
160
152
  ]
161
153
  }
@@ -7,9 +7,14 @@ import ContentViewComponents from '../ContentViewComponents';
7
7
 
8
8
  const cvComponentData = require('./contentViewComponents.fixtures.json');
9
9
  const cvUnpublishedComponentData = require('./unpublishedCVComponents.fixtures.json');
10
+ const cvPublishedComponentData = require('./publishedContentViewDetails.fixtures.json');
10
11
 
11
12
  const renderOptions = { apiNamespace: `${CONTENT_VIEWS_KEY}_1` };
12
- const cvComponents = api.getApiUrl('/content_views/5/content_view_components');
13
+ const cvComponents = api.getApiUrl('/content_views/4/content_view_components/show_all?per_page=20&page=1&status=All');
14
+ const addComponentURL = api.getApiUrl('/content_views/4/content_view_components/add');
15
+ const publishedComponentDetailsURL = api.getApiUrl('/content_views/13');
16
+ const removeComponentURL = api.getApiUrl('/content_views/4/content_view_components/remove');
17
+ const cvComponentsSearchURL = api.getApiUrl('/content_views/4/content_view_components/show_all?per_page=20&page=1&search=name+%3D+%227%22&status=All');
13
18
  const autocompleteUrl = '/content_views/auto_complete_search';
14
19
 
15
20
  let firstComponent;
@@ -33,18 +38,18 @@ test('Can call API and show components on page load', async (done) => {
33
38
  const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
34
39
  const scope = nockInstance
35
40
  .get(cvComponents)
36
- .query(true)
37
41
  .reply(200, cvComponentData);
38
42
 
39
43
  const { getByText, queryByText } = renderWithRedux(
40
- <ContentViewComponents cvId={5} />,
44
+ <ContentViewComponents cvId={4} />,
41
45
  renderOptions,
42
46
  );
43
47
 
44
48
  // Nothing will show at first, page is loading
45
49
  expect(queryByText(firstComponent.content_view.label)).toBeNull();
46
50
  // Assert that the repo name is now showing on the screen, but wait for it to appear.
47
- await patientlyWaitFor(() => expect(getByText(firstComponent.content_view.label)).toBeTruthy());
51
+ await patientlyWaitFor(() => expect(getByText(firstComponent.content_view.label))
52
+ .toBeInTheDocument());
48
53
  assertNockRequest(autocompleteScope);
49
54
  assertNockRequest(scope, done);
50
55
  });
@@ -53,13 +58,12 @@ test('Can call API and show unpublished components', async (done) => {
53
58
  const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
54
59
  const scope = nockInstance
55
60
  .get(cvComponents)
56
- .query(true)
57
61
  .reply(200, cvUnpublishedComponentData);
58
62
 
59
63
  const unpublishedComponent = cvUnpublishedComponentData.results[1];
60
64
 
61
65
  const { getByText, queryByText, getAllByText } = renderWithRedux(
62
- <ContentViewComponents cvId={5} />,
66
+ <ContentViewComponents cvId={4} />,
63
67
  renderOptions,
64
68
  );
65
69
 
@@ -78,11 +82,10 @@ test('Can link to view environment', async () => {
78
82
  const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
79
83
  const scope = nockInstance
80
84
  .get(cvComponents)
81
- .query(true)
82
85
  .reply(200, cvComponentData);
83
86
 
84
87
  const { getAllByText } = renderWithRedux(
85
- <ContentViewComponents cvId={5} />,
88
+ <ContentViewComponents cvId={4} />,
86
89
  renderOptions,
87
90
  );
88
91
 
@@ -95,7 +98,7 @@ test('Can link to view environment', async () => {
95
98
  assertNockRequest(scope);
96
99
  });
97
100
 
98
- test('Can search for component content views in component view', async (done) => {
101
+ test('Can search for component content views in composite view', async (done) => {
99
102
  const lastComponent = cvComponentData.results[1];
100
103
  const { name: firstComponentName } = firstComponent.content_view;
101
104
  const { name: lastComponentName } = lastComponent.content_view;
@@ -103,17 +106,15 @@ test('Can search for component content views in component view', async (done) =>
103
106
 
104
107
  const cvComponentsScope = nockInstance
105
108
  .get(cvComponents)
106
- .query(true)
107
109
  .reply(200, cvComponentData);
108
110
  const cvComponentsSearchScope = nockInstance
109
- .get(cvComponents)
110
- .query(searchQueryMatcher)
111
+ .get(cvComponentsSearchURL)
111
112
  .reply(200, { results: [lastComponent] });
112
113
 
113
114
  const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
114
115
  const withSearchScope = mockAutocomplete(nockInstance, autocompleteUrl, searchQueryMatcher);
115
116
  const { getByText, queryByText, getByLabelText } =
116
- renderWithRedux(<ContentViewComponents cvId={5} />, renderOptions);
117
+ renderWithRedux(<ContentViewComponents cvId={4} />, renderOptions);
117
118
 
118
119
  // Basic results showing
119
120
  await patientlyWaitFor(() => {
@@ -149,15 +150,138 @@ test('Can handle no components being present', async (done) => {
149
150
  };
150
151
  const scope = nockInstance
151
152
  .get(cvComponents)
152
- .query(true)
153
153
  .reply(200, noResults);
154
154
 
155
155
  const mockDetails = { label: 'test_empty' };
156
156
  const { queryByText } =
157
- renderWithRedux(<ContentViewComponents cvId={5} details={mockDetails} />, renderOptions);
157
+ renderWithRedux(<ContentViewComponents cvId={4} details={mockDetails} />, renderOptions);
158
158
 
159
159
  expect(queryByText(firstComponent.content_view.label)).toBeNull();
160
- await patientlyWaitFor(() => expect(queryByText('No content views belong to test_empty')).toBeTruthy());
160
+ await patientlyWaitFor(() => expect(queryByText('No content views belong to test_empty')).toBeInTheDocument());
161
161
  assertNockRequest(autocompleteScope);
162
162
  assertNockRequest(scope, done);
163
163
  });
164
+
165
+ test('Can add published component views to content view with modal', async (done) => {
166
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
167
+ const scope = nockInstance
168
+ .get(cvComponents)
169
+ .reply(200, cvComponentData);
170
+
171
+ const returnScope = nockInstance
172
+ .get(cvComponents)
173
+ .reply(200, cvComponentData);
174
+
175
+ const publishedComponentVersionsScope = nockInstance
176
+ .get(publishedComponentDetailsURL)
177
+ .reply(200, cvPublishedComponentData);
178
+
179
+ const addComponentParams = {
180
+ compositeContentViewId: 4,
181
+ components: [{ content_view_version_id: 85 }],
182
+ };
183
+
184
+ const addComponentScope = nockInstance
185
+ .put(addComponentURL, addComponentParams)
186
+ .reply(200, {});
187
+
188
+ const {
189
+ getByText, getByLabelText, queryByLabelText, getAllByLabelText,
190
+ } = renderWithRedux(
191
+ <ContentViewComponents cvId={4} />,
192
+ renderOptions,
193
+ );
194
+ await patientlyWaitFor(() => {
195
+ expect(getAllByLabelText('Actions')[2]).toHaveAttribute('aria-expanded', 'false');
196
+ });
197
+ fireEvent.click(getAllByLabelText('Actions')[2]);
198
+ expect(getAllByLabelText('Actions')[2]).toHaveAttribute('aria-expanded', 'true');
199
+ await patientlyWaitFor(() => {
200
+ expect(getByText('Add')).toBeInTheDocument();
201
+ });
202
+ fireEvent.click(getByText('Add'));
203
+ await patientlyWaitFor(() => {
204
+ expect(getByText('Add component')).toBeInTheDocument();
205
+ });
206
+ fireEvent.click(getByLabelText('add_component'));
207
+ await patientlyWaitFor(() => {
208
+ expect(queryByLabelText('add_component')).not.toBeInTheDocument();
209
+ });
210
+ assertNockRequest(autocompleteScope);
211
+ assertNockRequest(scope);
212
+ assertNockRequest(publishedComponentVersionsScope);
213
+ assertNockRequest(addComponentScope);
214
+ assertNockRequest(returnScope, done);
215
+ });
216
+
217
+ test('Can add unpublished component views to content view', async (done) => {
218
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
219
+ const scope = nockInstance
220
+ .get(cvComponents)
221
+ .reply(200, cvComponentData);
222
+
223
+ const returnScope = nockInstance
224
+ .get(cvComponents)
225
+ .reply(200, cvComponentData);
226
+
227
+ const addComponentParams = {
228
+ compositeContentViewId: 4,
229
+ components: [{ latest: true, content_view_id: 9 }],
230
+ };
231
+
232
+ const addComponentScope = nockInstance
233
+ .put(addComponentURL, addComponentParams)
234
+ .reply(200, {});
235
+
236
+ const { getByText, getAllByLabelText } = renderWithRedux(
237
+ <ContentViewComponents cvId={4} />,
238
+ renderOptions,
239
+ );
240
+ await patientlyWaitFor(() => {
241
+ expect(getAllByLabelText('Actions').slice(-1)[0]).toHaveAttribute('aria-expanded', 'false');
242
+ });
243
+ fireEvent.click(getAllByLabelText('Actions').slice(-1)[0]);
244
+ expect(getAllByLabelText('Actions').slice(-1)[0]).toHaveAttribute('aria-expanded', 'true');
245
+ await patientlyWaitFor(() => expect(getByText('Add')).toBeInTheDocument());
246
+ fireEvent.click(getByText('Add'));
247
+ assertNockRequest(autocompleteScope);
248
+ assertNockRequest(scope);
249
+ assertNockRequest(addComponentScope);
250
+ assertNockRequest(returnScope, done);
251
+ });
252
+
253
+ test('Can remove component views from content view', async (done) => {
254
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
255
+ const scope = nockInstance
256
+ .get(cvComponents)
257
+ .reply(200, cvComponentData);
258
+
259
+ const returnScope = nockInstance
260
+ .get(cvComponents)
261
+ .reply(200, cvComponentData);
262
+
263
+ const removeComponentParams = {
264
+ compositeContentViewId: 4,
265
+ component_ids: [28],
266
+ };
267
+
268
+ const removeComponentScope = nockInstance
269
+ .put(removeComponentURL, removeComponentParams)
270
+ .reply(200, {});
271
+
272
+ const { getByText, getAllByLabelText } = renderWithRedux(
273
+ <ContentViewComponents cvId={4} />,
274
+ renderOptions,
275
+ );
276
+ await patientlyWaitFor(() => {
277
+ expect(getAllByLabelText('Actions')[0]).toHaveAttribute('aria-expanded', 'false');
278
+ });
279
+ fireEvent.click(getAllByLabelText('Actions')[0]);
280
+ expect(getAllByLabelText('Actions')[0]).toHaveAttribute('aria-expanded', 'true');
281
+ await patientlyWaitFor(() => expect(getByText('Remove')).toBeInTheDocument());
282
+ fireEvent.click(getByText('Remove'));
283
+ assertNockRequest(autocompleteScope);
284
+ assertNockRequest(scope);
285
+ assertNockRequest(removeComponentScope);
286
+ assertNockRequest(returnScope, done);
287
+ });