katello 4.3.0.rc1 → 4.3.0.rc2

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 (208) 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/host_errata_controller.rb +5 -0
  4. data/app/controllers/katello/api/v2/host_packages_controller.rb +2 -0
  5. data/app/controllers/katello/api/v2/host_tracer_controller.rb +4 -0
  6. data/app/controllers/katello/api/v2/repository_sets_controller.rb +2 -2
  7. data/app/controllers/katello/api/v2/root_controller.rb +10 -19
  8. data/app/controllers/katello/concerns/api/v2/bulk_extensions.rb +3 -13
  9. data/app/controllers/katello/remote_execution_controller.rb +1 -1
  10. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +7 -5
  11. data/app/lib/actions/katello/repository/destroy.rb +3 -3
  12. data/app/lib/actions/pulp/repository/sync.rb +0 -2
  13. data/app/lib/actions/pulp3/abstract_async_task.rb +16 -4
  14. data/app/lib/katello/resources/cdn.rb +10 -1
  15. data/app/models/katello/concerns/host_managed_extensions.rb +7 -4
  16. data/app/models/katello/concerns/smart_proxy_extensions.rb +6 -2
  17. data/app/models/katello/content_view_version.rb +1 -6
  18. data/app/models/katello/glue/pulp/repo.rb +1 -2
  19. data/app/models/katello/host_tracer.rb +2 -0
  20. data/app/models/katello/repository.rb +2 -30
  21. data/app/models/katello/root_repository.rb +3 -43
  22. data/app/presenters/katello/host_package_presenter.rb +21 -0
  23. data/app/services/katello/bulk_items_helper.rb +35 -0
  24. data/app/services/katello/smart_proxy_helper.rb +10 -1
  25. data/app/views/foreman/job_templates/install_errata.erb +8 -6
  26. data/app/views/foreman/job_templates/resolve_traces.erb +4 -5
  27. data/app/views/foreman/job_templates/resolve_traces_-_katello_ansible_default.erb +3 -5
  28. data/app/views/foreman/smart_proxies/_content_sync.html.erb +7 -0
  29. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +4 -0
  30. data/app/views/katello/api/v2/{organizations/cdn_configuration.rabl → cdn_configurations/show.json.rabl} +4 -0
  31. data/app/views/katello/api/v2/content_facet/show.json.rabl +8 -0
  32. data/app/views/katello/api/v2/content_view_filters/show.json.rabl +0 -1
  33. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -1
  34. data/app/views/katello/api/v2/host_packages/base.json.rabl +2 -0
  35. data/app/views/katello/api/v2/organizations/show.json.rabl +1 -1
  36. data/app/views/katello/api/v2/repositories/show.json.rabl +0 -3
  37. data/config/routes/api/v2.rb +0 -10
  38. data/db/migrate/20211115215210_drop_ostree_branches.rb +13 -0
  39. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +0 -2
  40. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +0 -3
  41. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +0 -10
  42. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-versions.html +0 -3
  43. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +0 -10
  44. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-versions.module.js +0 -1
  45. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version.html +0 -7
  46. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/content.service.js +0 -5
  47. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.module.js +0 -1
  48. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.routes.js +0 -11
  49. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js +1 -2
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +2 -4
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.filter.js +0 -10
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
  53. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +3 -6
  54. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +4 -1
  55. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +1 -0
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repositories.routes.js +0 -9
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +0 -8
  58. data/engines/bastion_katello/lib/bastion_katello/engine.rb +0 -1
  59. data/lib/katello/permission_creator.rb +0 -1
  60. data/lib/katello/plugin.rb +0 -10
  61. data/lib/katello/tasks/reset.rake +2 -2
  62. data/lib/katello/version.rb +1 -1
  63. data/webpack/components/Packages/index.js +63 -0
  64. data/webpack/components/Search/Search.js +7 -1
  65. data/webpack/components/SelectAllCheckbox/index.js +2 -2
  66. data/webpack/components/Table/MainTable.scss +7 -1
  67. data/webpack/components/Table/TableHooks.js +10 -19
  68. data/webpack/components/Table/TableWrapper.js +0 -2
  69. data/webpack/components/WithOrganization/__snapshots__/withOrganization.test.js.snap +3 -3
  70. data/webpack/components/extensions/HostDetails/HostDetailsConstants.js +1 -0
  71. data/webpack/components/extensions/HostDetails/HostDetailsSelectors.js +16 -0
  72. data/webpack/components/extensions/HostDetails/HostErrata/HostErrataConstants.js +2 -0
  73. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesActions.js +11 -0
  74. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesConstants.js +2 -0
  75. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesSelectors.js +16 -0
  76. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/SecondaryTabsRoutes.js +4 -0
  77. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/constants.js +1 -0
  78. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab.js +119 -25
  79. data/webpack/components/extensions/HostDetails/Tabs/HostTracesConstants.js +1 -0
  80. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.js +127 -0
  81. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.scss +11 -0
  82. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +30 -4
  83. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionConstants.js +1 -0
  84. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsActions.js +73 -0
  85. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsConstants.js +2 -0
  86. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsSelectors.js +16 -0
  87. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +347 -0
  88. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.scss +7 -0
  89. data/webpack/components/extensions/HostDetails/Tabs/TracesTab.js +38 -31
  90. data/webpack/components/extensions/HostDetails/Tabs/__tests__/bookmarks.fixtures.json +12 -0
  91. data/webpack/components/extensions/HostDetails/Tabs/__tests__/contentOverrides.fixtures.json +227 -0
  92. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +423 -2
  93. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packages.fixtures.json +28 -0
  94. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +91 -0
  95. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySets.fixtures.json +120 -0
  96. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +307 -0
  97. data/webpack/components/extensions/HostDetails/Tabs/__tests__/resolveErrata.fixtures.json +35 -0
  98. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +55 -9
  99. data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +28 -14
  100. data/webpack/containers/Application/overrides.scss +31 -9
  101. data/webpack/global_index.js +4 -2
  102. data/webpack/redux/reducers/RedHatRepositories/enabled.fixtures.js +0 -2
  103. data/webpack/scenes/Content/ContentConfig.js +23 -7
  104. data/webpack/scenes/ContentCredentials/ContentCredentialActions.js +18 -0
  105. data/webpack/scenes/ContentCredentials/ContentCredentialConstants.js +2 -0
  106. data/webpack/scenes/ContentCredentials/ContentCredentialSelectors.js +12 -0
  107. data/webpack/scenes/ContentCredentials/__tests__/contentCredentials.fixtures.js +73 -0
  108. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +1 -1
  109. data/webpack/scenes/ContentViews/Create/ContentViewFormComponents.js +3 -3
  110. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +7 -2
  111. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.scss +7 -0
  112. data/webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js +9 -9
  113. data/webpack/scenes/ContentViews/Delete/ContentViewDeleteWizard.js +6 -6
  114. data/webpack/scenes/ContentViews/Delete/Steps/CVDeleteEnvironmentsSelection.js +39 -37
  115. data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionReview.js +35 -33
  116. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +7 -5
  117. data/webpack/scenes/ContentViews/Delete/__tests__/cvVersionsData.fixtures.json +2 -6
  118. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentEnvironments.js +13 -14
  119. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +18 -9
  120. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +3 -2
  121. data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterCreateResult.fixtures.json +1 -2
  122. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +1 -1
  123. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewErrataByDateDetails.fixtures.json +1 -8
  124. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetail.fixtures.json +1 -2
  125. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +3 -8
  126. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvAllRepos.fixtures.json +0 -2
  127. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErratumFilterDetails.fixtures.json +1 -2
  128. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvFilterDetailModuleAffectedRepos.fixtures.json +1 -8
  129. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvFilterDetailWithAffectedRepos.fixtures.json +1 -8
  130. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilterDetails.fixtures.json +1 -2
  131. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvPackageFilterDetail.fixtures.json +1 -3
  132. data/webpack/scenes/ContentViews/Details/Promote/ContentViewVersionPromote.js +44 -28
  133. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +2 -1
  134. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +1 -1
  135. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +46 -8
  136. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +0 -2
  137. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionContent.js +19 -3
  138. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionEnvironments.js +2 -2
  139. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionErrata.js +5 -3
  140. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionErrata.scss +5 -2
  141. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +7 -4
  142. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVEnvironmentSelectionForm.js +59 -53
  143. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVVersionRemoveReview.js +24 -17
  144. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/versionsResponseData.fixtures.json +1 -4
  145. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionRepositoryCell.js +8 -3
  146. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionComponent.fixtures.json +1 -4
  147. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.fixtures.json +1 -2
  148. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetailsCounts.fixtures.json +1 -2
  149. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionRepositories.fixtures.json +1 -18
  150. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.fixtures.json +5 -5
  151. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +1 -0
  152. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersionsWithTask.fixtures.json +1 -3
  153. data/webpack/scenes/ContentViews/Details/contentViewInfo.scss +0 -4
  154. data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +66 -53
  155. data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +40 -28
  156. data/webpack/scenes/ContentViews/Publish/PublishContentViewWizard.js +3 -3
  157. data/webpack/scenes/ContentViews/Publish/__tests__/publishContentView.test.js +14 -14
  158. data/webpack/scenes/ContentViews/Publish/cvPublishForm.scss +6 -0
  159. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +53 -12
  160. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +12 -6
  161. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +6 -6
  162. data/webpack/scenes/ContentViews/components/ContentViewIcon.js +6 -5
  163. data/webpack/scenes/ContentViews/components/ContentViewsCounter.js +2 -2
  164. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.js +26 -27
  165. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.scss +18 -6
  166. data/webpack/scenes/ContentViews/components/WizardHeader.js +44 -0
  167. data/webpack/scenes/ContentViews/components/contentViewIcon.scss +13 -2
  168. data/webpack/scenes/Organizations/OrganizationActions.js +22 -24
  169. data/webpack/scenes/Organizations/OrganizationConstants.js +1 -3
  170. data/webpack/scenes/Organizations/OrganizationReducer.js +0 -7
  171. data/webpack/scenes/Organizations/OrganizationSelectors.js +16 -0
  172. data/webpack/scenes/Organizations/__tests__/OrganizationActions.test.js +1 -21
  173. data/webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js +0 -20
  174. data/webpack/scenes/Organizations/__tests__/organizations.fixtures.js +34 -23
  175. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +151 -14
  176. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +150 -31
  177. data/webpack/scenes/Subscriptions/Manifest/index.js +14 -3
  178. data/webpack/utils/dateTimeHelpers.js +7 -0
  179. data/webpack/utils/helpers.js +1 -1
  180. metadata +45 -43
  181. data/app/controllers/katello/api/v2/ostree_branches_controller.rb +0 -16
  182. data/app/lib/actions/pulp/repository/presenters/ostree_presenter.rb +0 -91
  183. data/app/models/katello/ostree_branch.rb +0 -12
  184. data/app/models/katello/repository_ostree_branch.rb +0 -7
  185. data/app/services/katello/pulp/ostree_branch.rb +0 -14
  186. data/app/services/katello/pulp/repository/ostree.rb +0 -48
  187. data/app/views/katello/api/v2/ostree_branches/compare.json.rabl +0 -10
  188. data/app/views/katello/api/v2/ostree_branches/index.json.rabl +0 -7
  189. data/app/views/katello/api/v2/ostree_branches/show.json.rabl +0 -5
  190. data/app/views/katello/api/v2/root/resource_list.json.rabl +0 -3
  191. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-ostree-branches.html +0 -26
  192. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-ostree.html +0 -27
  193. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branch-repositories.controller.js +0 -77
  194. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branch.controller.js +0 -31
  195. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch-info.html +0 -15
  196. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch-repositories.html +0 -72
  197. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch.html +0 -30
  198. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branch.factory.js +0 -27
  199. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.controller.js +0 -67
  200. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.module.js +0 -15
  201. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.routes.js +0 -50
  202. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches.html +0 -40
  203. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-manage-ostree-branches.html +0 -40
  204. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/ostree-upstream-sync-policy.service.js +0 -26
  205. data/webpack/components/extensions/HostDetails/Tabs/SubscriptionTab.js +0 -12
  206. data/webpack/scenes/Content/Details/ContentCounts.js +0 -42
  207. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +0 -108
  208. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +0 -158
@@ -0,0 +1,28 @@
1
+ {
2
+ "total": 3,
3
+ "subtotal": 3,
4
+ "page": 1,
5
+ "per_page": 20,
6
+ "error": null,
7
+ "search": null,
8
+ "results": [
9
+ {
10
+ "id": 738,
11
+ "name": "coreutils",
12
+ "nvra": "coreutils-8.30-6.el8.x86_64",
13
+ "upgradable_version": "coreutils-9.0-1.el8.x86_64"
14
+ },
15
+ {
16
+ "id": 646,
17
+ "name": "chrony",
18
+ "nvra": "chrony-3.3-3.el8.x86_64",
19
+ "upgradable_version": "chrony-4.0-1.el8.x86_64"
20
+ },
21
+ {
22
+ "id": 676,
23
+ "name": "acl",
24
+ "nvra": "acl-2.2.53-1.el8.x86_64",
25
+ "upgradable_version": "acl-2.5.3-1.el8.x86_64"
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,91 @@
1
+ import React from 'react';
2
+ import { renderWithRedux, patientlyWaitFor } from 'react-testing-lib-wrapper';
3
+ import { nockInstance, assertNockRequest, mockForemanAutocomplete, mockSetting } from '../../../../../test-utils/nockWrapper';
4
+ import { foremanApi } from '../../../../../services/api';
5
+ import { HOST_PACKAGES_KEY } from '../../HostPackages/HostPackagesConstants';
6
+ import { PackagesTab } from '../PackagesTab';
7
+ import mockPackagesData from './packages.fixtures.json';
8
+
9
+ const contentFacetAttributes = {
10
+ id: 11,
11
+ uuid: 'e5761ea3-4117-4ecf-83d0-b694f99b389e',
12
+ content_view_default: false,
13
+ lifecycle_environment_library: false,
14
+ };
15
+
16
+ const renderOptions = (facetAttributes = contentFacetAttributes) => ({
17
+ apiNamespace: HOST_PACKAGES_KEY,
18
+ initialState: {
19
+ API: {
20
+ HOST_DETAILS: {
21
+ response: {
22
+ id: 1,
23
+ content_facet_attributes: { ...facetAttributes },
24
+ },
25
+ status: 'RESOLVED',
26
+ },
27
+ },
28
+ },
29
+ });
30
+
31
+ const hostPackages = foremanApi.getApiUrl('/hosts/1/packages?include_latest_upgradable=true&per_page=20&page=1');
32
+ const autocompleteUrl = '/hosts/1/packages/auto_complete_search';
33
+
34
+ let firstPackages;
35
+ let searchDelayScope;
36
+ let autoSearchScope;
37
+
38
+ beforeEach(() => {
39
+ const { results } = mockPackagesData;
40
+ [firstPackages] = results;
41
+ searchDelayScope = mockSetting(nockInstance, 'autosearch_delay', 500);
42
+ autoSearchScope = mockSetting(nockInstance, 'autosearch_while_typing', true);
43
+ });
44
+
45
+ afterEach(() => {
46
+ assertNockRequest(searchDelayScope);
47
+ assertNockRequest(autoSearchScope);
48
+ });
49
+
50
+ test('Can call API for packages and show on screen on page load', async (done) => {
51
+ // Setup autocomplete with mockForemanAutoComplete since we aren't adding /katello
52
+ const autocompleteScope = mockForemanAutocomplete(nockInstance, autocompleteUrl);
53
+
54
+ // return tracedata results when we look for packages
55
+ const scope = nockInstance
56
+ .get(hostPackages)
57
+ .reply(200, mockPackagesData);
58
+
59
+ const { getAllByText } = renderWithRedux(<PackagesTab />, renderOptions());
60
+
61
+ // Assert that the packages are now showing on the screen, but wait for them to appear.
62
+ await patientlyWaitFor(() => expect(getAllByText(firstPackages.name)[0]).toBeInTheDocument());
63
+ // Assert request was made and completed, see helper function
64
+ assertNockRequest(autocompleteScope);
65
+ assertNockRequest(scope, done); // Pass jest callback to confirm test is done
66
+ });
67
+
68
+ test('Can handle no packags being present', async (done) => {
69
+ // Setup autocomplete with mockForemanAutoComplete since we aren't adding /katello
70
+ const autocompleteScope = mockForemanAutocomplete(nockInstance, autocompleteUrl);
71
+
72
+ const noResults = {
73
+ total: 0,
74
+ subtotal: 0,
75
+ page: 1,
76
+ per_page: 20,
77
+ results: [],
78
+ };
79
+
80
+ const scope = nockInstance
81
+ .get(hostPackages)
82
+ .reply(200, noResults);
83
+
84
+ const { queryByText } = renderWithRedux(<PackagesTab />, renderOptions());
85
+
86
+ // Assert that there are not any packages showing on the screen.
87
+ await patientlyWaitFor(() => expect(queryByText('This host does not have any packages.')).toBeInTheDocument());
88
+ // Assert request was made and completed, see helper function
89
+ assertNockRequest(autocompleteScope);
90
+ assertNockRequest(scope, done); // Pass jest callback to confirm test is done
91
+ });
@@ -0,0 +1,120 @@
1
+ {
2
+ "total": 3,
3
+ "subtotal": 3,
4
+ "selectable": 3,
5
+ "page": "1",
6
+ "per_page": "20",
7
+ "error": null,
8
+ "search": null,
9
+ "sort": {
10
+ "by": "name",
11
+ "order": "asc"
12
+ },
13
+ "results": [
14
+ {
15
+ "enabled": true,
16
+ "product": {
17
+ "id": 301,
18
+ "name": "ParthaProduct"
19
+ },
20
+ "content": {
21
+ "id": 7587,
22
+ "name": "empty repo",
23
+ "label": "Default_Organization_ParthaProduct_empty_repo",
24
+ "vendor": "Custom",
25
+ "content_type": "yum",
26
+ "content_url": "/custom/ParthaProduct/empty_repo",
27
+ "gpg_url": null
28
+ },
29
+ "repositories": [
30
+ {
31
+ "id": 3,
32
+ "name": "empty repo",
33
+ "arch": "noarch",
34
+ "releasever": null
35
+ }
36
+ ],
37
+ "name": "empty repo",
38
+ "vendor": "Custom",
39
+ "label": "Default_Organization_ParthaProduct_empty_repo",
40
+ "id": "1636469876198",
41
+ "type": "yum",
42
+ "gpgUrl": null,
43
+ "contentUrl": "/custom/ParthaProduct/empty_repo",
44
+ "override": "default",
45
+ "overrides": [],
46
+ "enabled_content_override": null
47
+ },
48
+ {
49
+ "enabled": true,
50
+ "product": {
51
+ "id": 301,
52
+ "name": "ParthaProduct"
53
+ },
54
+ "content": {
55
+ "id": 7586,
56
+ "name": "partha multi-errata",
57
+ "label": "Default_Organization_ParthaProduct_partha_multi-errata",
58
+ "vendor": "Custom",
59
+ "content_type": "yum",
60
+ "content_url": "/custom/ParthaProduct/partha_multi-errata",
61
+ "gpg_url": null
62
+ },
63
+ "repositories": [
64
+ {
65
+ "id": 2,
66
+ "name": "partha multi-errata",
67
+ "arch": "noarch",
68
+ "releasever": null
69
+ }
70
+ ],
71
+ "name": "partha multi-errata",
72
+ "vendor": "Custom",
73
+ "label": "Default_Organization_ParthaProduct_partha_multi-errata",
74
+ "id": "1636469778922",
75
+ "type": "yum",
76
+ "gpgUrl": null,
77
+ "contentUrl": "/custom/ParthaProduct/partha_multi-errata",
78
+ "override": "0",
79
+ "overrides": [
80
+ {
81
+ "name": "enabled",
82
+ "value": false
83
+ }
84
+ ],
85
+ "enabled_content_override": false
86
+ },
87
+ {
88
+ "enabled": true,
89
+ "product": {
90
+ "id": 302,
91
+ "name": "Pull Provider"
92
+ },
93
+ "content": {
94
+ "id": 7588,
95
+ "name": "yggdrasil",
96
+ "label": "Default_Organization_Pull_Provider_yggdrasil",
97
+ "vendor": "Custom",
98
+ "content_type": "yum",
99
+ "content_url": "/custom/Pull_Provider/yggdrasil",
100
+ "gpg_url": null
101
+ },
102
+ "repositories": [],
103
+ "name": "yggdrasil",
104
+ "vendor": "Custom",
105
+ "label": "Default_Organization_Pull_Provider_yggdrasil",
106
+ "id": "1636471500857",
107
+ "type": "yum",
108
+ "gpgUrl": null,
109
+ "contentUrl": "/custom/Pull_Provider/yggdrasil",
110
+ "override": "1",
111
+ "overrides": [
112
+ {
113
+ "name": "enabled",
114
+ "value": true
115
+ }
116
+ ],
117
+ "enabled_content_override": true
118
+ }
119
+ ]
120
+ }
@@ -0,0 +1,307 @@
1
+ import React from 'react';
2
+ import { renderWithRedux, patientlyWaitFor, fireEvent } from 'react-testing-lib-wrapper';
3
+ import { nockInstance, assertNockRequest, mockAutocomplete, mockSetting } from '../../../../../test-utils/nockWrapper';
4
+ import katelloApi, { foremanApi } from '../../../../../services/api';
5
+ import { REPOSITORY_SETS_KEY } from '../RepositorySetsTab/RepositorySetsConstants';
6
+ import RepositorySetsTab from '../RepositorySetsTab/RepositorySetsTab';
7
+ import mockRepoSetData from './repositorySets.fixtures.json';
8
+ import mockBookmarkData from './bookmarks.fixtures.json';
9
+ import mockContentOverride from './contentOverrides.fixtures.json';
10
+
11
+ const contentFacetAttributes = {
12
+ id: 11,
13
+ uuid: 'e5761ea3-4117-4ecf-83d0-b694f99b389e',
14
+ content_view_default: false,
15
+ lifecycle_environment_library: false,
16
+ };
17
+
18
+ const renderOptions = (facetAttributes = contentFacetAttributes) => ({
19
+ apiNamespace: REPOSITORY_SETS_KEY,
20
+ initialState: {
21
+ API: {
22
+ HOST_DETAILS: {
23
+ response: {
24
+ id: 1,
25
+ content_facet_attributes: { ...facetAttributes },
26
+ subscription_status: 5, // Simple Content Access
27
+ },
28
+ status: 'RESOLVED',
29
+ },
30
+ },
31
+ },
32
+ });
33
+
34
+ const hostRepositorySets = katelloApi.getApiUrl('/repository_sets');
35
+ const autocompleteUrl = '/repository_sets/auto_complete_search';
36
+ const repositorySetBookmarks = foremanApi.getApiUrl('/bookmarks?search=controller%3Dkatello_product_contents');
37
+ const contentOverride = foremanApi.getApiUrl('/hosts/1/subscriptions/content_override');
38
+
39
+ const defaultQuery = {
40
+ content_access_mode_env: true,
41
+ content_access_mode_all: true,
42
+ host_id: 1,
43
+ per_page: 20,
44
+ page: 1,
45
+ search: '',
46
+ };
47
+ const libraryQuery = {
48
+ ...defaultQuery,
49
+ content_access_mode_env: false,
50
+ };
51
+
52
+ let firstRepoSet;
53
+ let searchDelayScope;
54
+ let autoSearchScope;
55
+ let bookmarkScope;
56
+
57
+ beforeEach(() => {
58
+ // jest.resetModules();
59
+ const { results } = mockRepoSetData;
60
+ [firstRepoSet] = results;
61
+ bookmarkScope = nockInstance.get(repositorySetBookmarks).reply(200, mockBookmarkData);
62
+ searchDelayScope = mockSetting(nockInstance, 'autosearch_delay', 500);
63
+ autoSearchScope = mockSetting(nockInstance, 'autosearch_while_typing', true);
64
+ });
65
+
66
+ afterEach(() => {
67
+ assertNockRequest(searchDelayScope);
68
+ assertNockRequest(autoSearchScope);
69
+ assertNockRequest(bookmarkScope);
70
+ });
71
+
72
+ test('Can call API for repository sets and show basic table', async (done) => {
73
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
74
+ const scope = nockInstance
75
+ .get(hostRepositorySets)
76
+ .query(defaultQuery)
77
+ .reply(200, mockRepoSetData);
78
+
79
+ const { getByText } = renderWithRedux(<RepositorySetsTab />, renderOptions());
80
+
81
+ // Assert that the repository sets are now showing on the screen, but wait for them to appear.
82
+ await patientlyWaitFor(() => expect(getByText(firstRepoSet.contentUrl)).toBeInTheDocument());
83
+ assertNockRequest(autocompleteScope);
84
+ assertNockRequest(scope, done); // Pass jest callback to confirm test is done
85
+ });
86
+
87
+ test('Can handle no repository sets being present', async (done) => {
88
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
89
+
90
+ const noResults = {
91
+ total: 0,
92
+ subtotal: 0,
93
+ page: 1,
94
+ per_page: 20,
95
+ results: [],
96
+ };
97
+
98
+ const scope = nockInstance
99
+ .get(hostRepositorySets)
100
+ .query(defaultQuery)
101
+ .reply(200, noResults);
102
+
103
+ const { queryByText } = renderWithRedux(<RepositorySetsTab />, renderOptions());
104
+
105
+ // Assert that there are not any repository sets showing on the screen.
106
+ await patientlyWaitFor(() => expect(queryByText('No repository sets to show.')).toBeInTheDocument());
107
+ // Assert request was made and completed, see helper function
108
+ assertNockRequest(autocompleteScope);
109
+ assertNockRequest(scope, done); // Pass jest callback to confirm test is done
110
+ });
111
+
112
+ test('Toggle Group shows if it\'s not the default content view or library enviroment', async (done) => {
113
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
114
+ const scope = nockInstance
115
+ .get(hostRepositorySets)
116
+ .query(defaultQuery)
117
+ .reply(200, mockRepoSetData);
118
+
119
+ const {
120
+ queryByLabelText,
121
+ getByText,
122
+ } = renderWithRedux(<RepositorySetsTab />, renderOptions());
123
+
124
+ // Assert that the errata are now showing on the screen, but wait for them to appear.
125
+ await patientlyWaitFor(() => expect(getByText(firstRepoSet.contentUrl)).toBeInTheDocument());
126
+ expect(queryByLabelText('Limit to environment')).toBeInTheDocument();
127
+ assertNockRequest(autocompleteScope);
128
+ assertNockRequest(scope, done); // Pass jest callback to confirm test is done
129
+ });
130
+
131
+ test('Toggle Group does not show if it\'s the default content view ', async (done) => {
132
+ const options = renderOptions({
133
+ ...contentFacetAttributes,
134
+ content_view_default: true,
135
+ });
136
+ // Setup autocomplete with mockAutocomplete since we aren't adding /katello
137
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
138
+ const scope = nockInstance
139
+ .get(hostRepositorySets)
140
+ .query(libraryQuery)
141
+ .reply(200, mockRepoSetData);
142
+
143
+ const {
144
+ queryByLabelText,
145
+ getByText,
146
+ } = renderWithRedux(<RepositorySetsTab />, options);
147
+
148
+ // Assert that the errata are now showing on the screen, but wait for them to appear.
149
+ await patientlyWaitFor(() => expect(getByText(firstRepoSet.contentUrl)).toBeInTheDocument());
150
+ expect(queryByLabelText('Limit to environment')).not.toBeInTheDocument();
151
+ assertNockRequest(autocompleteScope);
152
+ assertNockRequest(scope, done); // Pass jest callback to confirm test is done
153
+ });
154
+
155
+ test('Toggle Group does not show if it\'s the library environment', async (done) => {
156
+ const options = renderOptions({
157
+ ...contentFacetAttributes,
158
+ lifecycle_environment_library: true,
159
+ });
160
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
161
+ // return errata data results when we look for errata
162
+ const scope = nockInstance
163
+ .get(hostRepositorySets)
164
+ .query(libraryQuery)
165
+ .reply(200, mockRepoSetData);
166
+
167
+ const {
168
+ queryByLabelText,
169
+ getByText,
170
+ } = renderWithRedux(<RepositorySetsTab />, options);
171
+
172
+ // Assert that the errata are now showing on the screen, but wait for them to appear.
173
+ await patientlyWaitFor(() => expect(getByText(firstRepoSet.contentUrl)).toBeInTheDocument());
174
+ expect(queryByLabelText('Limit to environment')).not.toBeInTheDocument();
175
+ assertNockRequest(autocompleteScope);
176
+ assertNockRequest(scope, done); // Pass jest callback to confirm test is done
177
+ });
178
+
179
+ test('Can toggle with the Toggle Group ', async (done) => {
180
+ // Setup autocomplete with mockAutocomplete since we aren't adding /katello
181
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
182
+ // return errata data results when we look for errata
183
+ const scope = nockInstance
184
+ .get(hostRepositorySets)
185
+ .query(defaultQuery)
186
+ .reply(200, mockRepoSetData);
187
+
188
+ const {
189
+ queryByLabelText,
190
+ getByText,
191
+ } = renderWithRedux(<RepositorySetsTab />, renderOptions());
192
+
193
+ await patientlyWaitFor(() => expect(getByText(firstRepoSet.contentUrl)).toBeInTheDocument());
194
+ expect(queryByLabelText('Limit to environment')).toBeInTheDocument();
195
+ expect(queryByLabelText('Limit to environment')).toHaveAttribute('aria-pressed', 'true');
196
+ expect(queryByLabelText('No limit')).toHaveAttribute('aria-pressed', 'false');
197
+ assertNockRequest(autocompleteScope);
198
+ assertNockRequest(scope, done); // Pass jest callback to confirm test is done
199
+ });
200
+
201
+ test('Can override to disabled', async (done) => {
202
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
203
+ const scope = nockInstance
204
+ .get(hostRepositorySets)
205
+ .query(defaultQuery)
206
+ .reply(200, mockRepoSetData);
207
+ const contentOverrideScope = nockInstance
208
+ .put(contentOverride)
209
+ .reply(200, mockContentOverride);
210
+
211
+ const { getByText, getAllByText, getAllByLabelText } =
212
+ renderWithRedux(<RepositorySetsTab />, renderOptions());
213
+
214
+ // Assert that the repository sets are now showing on the screen, but wait for them to appear.
215
+ await patientlyWaitFor(() => expect(getByText(firstRepoSet.contentUrl)).toBeInTheDocument());
216
+ expect(getAllByText('Enabled')).toHaveLength(2);
217
+ expect(getAllByText('Disabled')).toHaveLength(1);
218
+ // Find the first action menu and click it
219
+ const actionMenu = getAllByLabelText('Actions')[0].closest('button');
220
+ fireEvent.click(actionMenu);
221
+
222
+ const overrideMenuItem = getByText('Override to disabled');
223
+ expect(overrideMenuItem).toBeInTheDocument();
224
+ fireEvent.click(overrideMenuItem);
225
+
226
+ await patientlyWaitFor(() => {
227
+ expect(getAllByText('Enabled')).toHaveLength(1);
228
+ expect(getAllByText('Disabled')).toHaveLength(2);
229
+ });
230
+
231
+
232
+ assertNockRequest(autocompleteScope);
233
+ assertNockRequest(scope);
234
+ assertNockRequest(contentOverrideScope, done); // Pass jest callback to confirm test is done
235
+ });
236
+
237
+ test('Can override to enabled', async (done) => {
238
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
239
+ const scope = nockInstance
240
+ .get(hostRepositorySets)
241
+ .query(defaultQuery)
242
+ .reply(200, mockRepoSetData);
243
+ const contentOverrideScope = nockInstance
244
+ .put(contentOverride)
245
+ .reply(200, mockContentOverride);
246
+
247
+ const {
248
+ getByText, queryByText, getAllByText, getAllByLabelText,
249
+ } = renderWithRedux(<RepositorySetsTab />, renderOptions());
250
+
251
+ // Assert that the repository sets are now showing on the screen, but wait for them to appear.
252
+ await patientlyWaitFor(() => expect(getByText(firstRepoSet.contentUrl)).toBeInTheDocument());
253
+ expect(getAllByText('Enabled')).toHaveLength(2);
254
+ expect(getAllByText('Disabled')).toHaveLength(1);
255
+ // The second item is overridden to disabled; we're going to override to enabled
256
+ const actionMenu = getAllByLabelText('Actions')[1].closest('button');
257
+ fireEvent.click(actionMenu);
258
+
259
+ const overrideMenuItem = getByText('Override to enabled');
260
+ expect(overrideMenuItem).toBeInTheDocument();
261
+ fireEvent.click(overrideMenuItem);
262
+
263
+ await patientlyWaitFor(() => {
264
+ expect(getAllByText('Enabled')).toHaveLength(3);
265
+ expect(queryByText('Disabled')).not.toBeInTheDocument();
266
+ });
267
+
268
+ assertNockRequest(autocompleteScope);
269
+ assertNockRequest(scope);
270
+ assertNockRequest(contentOverrideScope, done); // Pass jest callback to confirm test is done
271
+ });
272
+
273
+ test('Can reset to default', async (done) => {
274
+ const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
275
+ const scope = nockInstance
276
+ .get(hostRepositorySets)
277
+ .query(defaultQuery)
278
+ .reply(200, mockRepoSetData);
279
+ const contentOverrideScope = nockInstance
280
+ .put(contentOverride)
281
+ .reply(200, mockContentOverride);
282
+
283
+ const {
284
+ getByText, queryByText, getAllByText, getAllByLabelText,
285
+ } = renderWithRedux(<RepositorySetsTab />, renderOptions());
286
+
287
+ // Assert that the repository sets are now showing on the screen, but wait for them to appear.
288
+ await patientlyWaitFor(() => expect(getByText(firstRepoSet.contentUrl)).toBeInTheDocument());
289
+ expect(getAllByText('Enabled')).toHaveLength(2);
290
+ expect(getAllByText('Disabled')).toHaveLength(1);
291
+ // The second item is overridden to disabled but would normally be enabled; we're going to reset
292
+ const actionMenu = getAllByLabelText('Actions')[1].closest('button');
293
+ fireEvent.click(actionMenu);
294
+
295
+ const overrideMenuItem = getByText('Reset to default');
296
+ expect(overrideMenuItem).toBeInTheDocument();
297
+ fireEvent.click(overrideMenuItem);
298
+
299
+ await patientlyWaitFor(() => {
300
+ expect(getAllByText('Enabled')).toHaveLength(3);
301
+ expect(queryByText('Disabled')).not.toBeInTheDocument();
302
+ });
303
+
304
+ assertNockRequest(autocompleteScope);
305
+ assertNockRequest(scope);
306
+ assertNockRequest(contentOverrideScope, done); // Pass jest callback to confirm test is done
307
+ });
@@ -0,0 +1,35 @@
1
+ {
2
+ "id": 67,
3
+ "description": "Install errata RHEA-2017:99143",
4
+ "job_category": "Katello",
5
+ "targeting_id": 66,
6
+ "status": 3,
7
+ "start_at": "2021-10-12 14:58:05 -0400",
8
+ "status_label": "running",
9
+ "dynflow_task": {
10
+ "id": "947e862c-773b-46ec-9735-78428e742356",
11
+ "state": "planned"
12
+ },
13
+ "succeeded": "N/A",
14
+ "failed": "N/A",
15
+ "pending": "N/A",
16
+ "total": 1,
17
+ "missing": 0,
18
+ "targeting": {
19
+ "bookmark_id": null,
20
+ "search_query": "name ^ (centos7-katello-client.fedora.example.com)",
21
+ "targeting_type": "static_query",
22
+ "user_id": 4,
23
+ "randomized_ordering": null,
24
+ "hosts": [
25
+ {
26
+ "name": "centos7-katello-client.fedora.example.com",
27
+ "id": 13
28
+ }
29
+ ]
30
+ },
31
+ "task": {
32
+ "id": "947e862c-773b-46ec-9735-78428e742356",
33
+ "state": "planned"
34
+ }
35
+ }