katello 3.9.1 → 3.10.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 (229) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +28 -12
  3. data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +12 -3
  4. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +4 -13
  5. data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -1
  6. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
  7. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +6 -4
  8. data/app/controllers/katello/api/v2/content_views_controller.rb +8 -3
  9. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +2 -1
  10. data/app/controllers/katello/api/v2/host_module_streams_controller.rb +39 -0
  11. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +20 -11
  12. data/app/controllers/katello/api/v2/module_streams_controller.rb +2 -1
  13. data/app/controllers/katello/api/v2/repository_sets_controller.rb +17 -8
  14. data/app/controllers/katello/application_controller.rb +0 -2
  15. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +5 -2
  16. data/app/lib/actions/candlepin/consumer/attach_subscription.rb +0 -2
  17. data/app/lib/actions/candlepin/consumer/remove_subscription.rb +0 -2
  18. data/app/lib/actions/katello/capsule_content/create_repos.rb +1 -25
  19. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  20. data/app/lib/actions/katello/content_view/promote.rb +2 -5
  21. data/app/lib/actions/katello/content_view/promote_to_environment.rb +2 -5
  22. data/app/lib/actions/katello/content_view/publish.rb +1 -4
  23. data/app/lib/actions/katello/content_view_puppet_environment/create.rb +6 -10
  24. data/app/lib/actions/katello/content_view_version/export.rb +0 -2
  25. data/app/lib/actions/katello/content_view_version/incremental_update.rb +19 -1
  26. data/app/lib/actions/katello/environment/publish_repositories.rb +2 -1
  27. data/app/lib/actions/katello/gpg_key/update.rb +17 -0
  28. data/app/lib/actions/katello/host/attach_subscriptions.rb +0 -2
  29. data/app/lib/actions/katello/host/erratum/install.rb +6 -0
  30. data/app/lib/actions/katello/host/generate_applicability.rb +0 -2
  31. data/app/lib/actions/katello/host/hypervisors_update.rb +11 -6
  32. data/app/lib/actions/katello/host/package/install.rb +6 -0
  33. data/app/lib/actions/katello/host/package/remove.rb +6 -0
  34. data/app/lib/actions/katello/host/package/update.rb +7 -1
  35. data/app/lib/actions/katello/host/package_group/install.rb +6 -0
  36. data/app/lib/actions/katello/host/package_group/remove.rb +6 -0
  37. data/app/lib/actions/katello/host/recalculate_errata_status.rb +0 -2
  38. data/app/lib/actions/katello/host/remove_subscriptions.rb +0 -2
  39. data/app/lib/actions/katello/host/update.rb +1 -0
  40. data/app/lib/actions/katello/host/update_content_overrides.rb +0 -2
  41. data/app/lib/actions/katello/host/upload_package_profile.rb +13 -12
  42. data/app/lib/actions/katello/host/upload_profiles.rb +70 -0
  43. data/app/lib/actions/katello/product/reindex_subscriptions.rb +0 -2
  44. data/app/lib/actions/katello/product/repositories_certs_reset.rb +4 -4
  45. data/app/lib/actions/katello/product/repositories_gpg_reset.rb +2 -2
  46. data/app/lib/actions/katello/repository/check_matching_content.rb +18 -6
  47. data/app/lib/actions/katello/repository/clone_deb_content.rb +1 -1
  48. data/app/lib/actions/katello/repository/clone_to_environment.rb +3 -5
  49. data/app/lib/actions/katello/repository/clone_to_version.rb +2 -3
  50. data/app/lib/actions/katello/repository/clone_yum_content.rb +1 -2
  51. data/app/lib/actions/katello/repository/clone_yum_metadata.rb +2 -2
  52. data/app/lib/actions/katello/repository/create.rb +1 -31
  53. data/app/lib/actions/katello/repository/destroy.rb +1 -2
  54. data/app/lib/actions/katello/repository/export.rb +0 -2
  55. data/app/lib/actions/katello/repository/fetch_pxe_files.rb +0 -2
  56. data/app/lib/actions/katello/repository/filtered_index_content.rb +0 -2
  57. data/app/lib/actions/katello/repository/finish_upload.rb +0 -2
  58. data/app/lib/actions/katello/repository/import_upload.rb +0 -2
  59. data/app/lib/actions/katello/repository/index_content.rb +0 -1
  60. data/app/lib/actions/katello/repository/index_package_groups.rb +0 -2
  61. data/app/lib/actions/katello/repository/instance_update.rb +21 -0
  62. data/app/lib/actions/katello/repository/remove_content.rb +0 -2
  63. data/app/lib/actions/katello/repository/sync.rb +0 -1
  64. data/app/lib/actions/katello/repository/update.rb +0 -2
  65. data/app/lib/actions/katello/upstream_subscriptions/bind_entitlement.rb +0 -2
  66. data/app/lib/actions/katello/upstream_subscriptions/bind_entitlements.rb +0 -2
  67. data/app/lib/actions/katello/upstream_subscriptions/remove_entitlement.rb +0 -1
  68. data/app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb +0 -2
  69. data/app/lib/actions/katello/upstream_subscriptions/update_entitlement.rb +0 -1
  70. data/app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb +0 -2
  71. data/app/lib/actions/pulp/abstract.rb +13 -14
  72. data/app/lib/actions/pulp/repository/create.rb +13 -211
  73. data/app/lib/actions/pulp/repository/create_in_plan.rb +4 -18
  74. data/app/lib/actions/pulp/repository/refresh.rb +7 -70
  75. data/app/lib/actions/pulp/repository/sync.rb +1 -2
  76. data/app/lib/katello/capsule_content.rb +3 -3
  77. data/app/lib/katello/resources/candlepin/consumer.rb +1 -1
  78. data/app/lib/katello/resources/candlepin/product.rb +1 -1
  79. data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +1 -1
  80. data/app/models/katello/available_module_stream.rb +11 -0
  81. data/app/models/katello/concerns/content_facet_host_extensions.rb +1 -0
  82. data/app/models/katello/concerns/host_managed_extensions.rb +56 -0
  83. data/app/models/katello/concerns/hostgroup_extensions.rb +17 -0
  84. data/app/models/katello/concerns/redhat_extensions.rb +20 -6
  85. data/app/models/katello/concerns/search_by_repository_name.rb +0 -1
  86. data/app/models/katello/concerns/smart_proxy_extensions.rb +26 -12
  87. data/app/models/katello/content_facet_applicable_module_stream.rb +7 -0
  88. data/app/models/katello/content_view_puppet_environment.rb +14 -35
  89. data/app/models/katello/erratum.rb +54 -24
  90. data/app/models/katello/erratum_package.rb +6 -0
  91. data/app/models/katello/glue/pulp/repo.rb +5 -228
  92. data/app/models/katello/gpg_key.rb +1 -0
  93. data/app/models/katello/host/content_facet.rb +38 -83
  94. data/app/models/katello/host_available_module_stream.rb +47 -0
  95. data/app/models/katello/module_stream.rb +18 -0
  96. data/app/models/katello/module_stream_erratum_package.rb +6 -0
  97. data/app/models/katello/product.rb +0 -2
  98. data/app/models/katello/product_content.rb +1 -0
  99. data/app/models/katello/repository.rb +15 -6
  100. data/app/models/katello/root_repository.rb +1 -1
  101. data/app/models/katello/rpm.rb +5 -17
  102. data/app/services/katello/applicable_content_helper.rb +111 -0
  103. data/app/services/katello/managed_content_medium_provider.rb +7 -0
  104. data/app/services/katello/pulp/consumer.rb +13 -7
  105. data/app/services/katello/pulp/repository.rb +157 -4
  106. data/app/services/katello/pulp/repository/deb.rb +47 -0
  107. data/app/services/katello/pulp/repository/docker.rb +43 -0
  108. data/app/services/katello/pulp/repository/file.rb +31 -0
  109. data/app/services/katello/pulp/repository/ostree.rb +40 -0
  110. data/app/services/katello/pulp/repository/puppet.rb +43 -0
  111. data/app/services/katello/pulp/repository/yum.rb +61 -0
  112. data/app/services/katello/repository_type.rb +1 -1
  113. data/app/views/katello/api/v2/content_facet/base.json.rabl +1 -0
  114. data/app/views/katello/api/v2/content_view_versions/base.json.rabl +0 -1
  115. data/app/views/katello/api/v2/errata/_counts.json.rabl +0 -1
  116. data/app/views/katello/api/v2/errata/show.json.rabl +9 -3
  117. data/app/views/katello/api/v2/host_collections/delta_activation_keys.rabl +0 -1
  118. data/app/views/katello/api/v2/host_module_streams/base.json.rabl +8 -0
  119. data/app/views/katello/api/v2/host_module_streams/index.json.rabl +7 -0
  120. data/app/views/katello/api/v2/packages/backend.json.rabl +0 -1
  121. data/app/views/katello/api/v2/repositories/show.json.rabl +6 -6
  122. data/app/views/katello/layouts/react.html.erb +2 -2
  123. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +0 -1
  124. data/config/routes/api/rhsm.rb +1 -0
  125. data/config/routes/overrides.rb +4 -0
  126. data/db/migrate/20181008201422_add_modules_to_errata_packages.rb +29 -0
  127. data/db/migrate/20181017181806_available_module_streams.rb +34 -0
  128. data/db/migrate/20181027014323_add_applicable_modules.rb +24 -0
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/module-stream-actions.service.js +2 -1
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/views/content-credential-info.html +1 -1
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/new/views/new-content-credential.html +1 -0
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-host-bulk-module-streams-modal.html +2 -2
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +37 -22
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +4 -1
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-module-streams.controller.js +27 -7
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-module-streams.html +29 -0
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/errata-details.html +15 -1
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +1 -1
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-promotion.controller.js +0 -1
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-publish.controller.js +1 -2
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-versions.controller.js +3 -1
  142. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/content-view-history.controller.js +1 -1
  143. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-promotion.html +0 -15
  144. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +0 -14
  145. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/erratum.controller.js +19 -0
  146. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-info.html +0 -12
  147. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-packages.html +36 -0
  148. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum.html +7 -0
  149. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.routes.js +9 -0
  150. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-module-streams.factory.js +18 -0
  151. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +4 -2
  152. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +2 -2
  153. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +13 -0
  154. data/lib/katello/permissions/host_permissions.rb +3 -0
  155. data/lib/katello/repository_types/deb.rb +3 -1
  156. data/lib/katello/repository_types/docker.rb +3 -1
  157. data/lib/katello/repository_types/file.rb +1 -0
  158. data/lib/katello/repository_types/ostree.rb +3 -1
  159. data/lib/katello/repository_types/puppet.rb +3 -1
  160. data/lib/katello/repository_types/yum.rb +3 -1
  161. data/lib/katello/tasks/delete_orphaned_content.rake +1 -1
  162. data/lib/katello/tasks/reset.rake +1 -0
  163. data/lib/katello/tasks/test.rake +14 -0
  164. data/lib/katello/tasks/unify_hosts.rake +2 -0
  165. data/lib/katello/tasks/virt_who_report.rake +2 -1
  166. data/lib/katello/version.rb +1 -1
  167. data/locale/Makefile +52 -17
  168. data/locale/update-i18n +22 -0
  169. data/package.json +11 -1
  170. data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +8 -0
  171. data/webpack/move_to_foreman/components/common/table/components/Table.js +2 -1
  172. data/webpack/move_to_pf/react-bootstrap-select/index.js +4 -2
  173. data/webpack/move_to_pf/test-utils/testHelpers.js +9 -0
  174. data/webpack/redux/OrganizationProducts/OrganizationProductsActions.js +24 -0
  175. data/webpack/redux/OrganizationProducts/OrganizationProductsConstants.js +5 -0
  176. data/webpack/redux/OrganizationProducts/OrganizationProductsReducer.js +38 -0
  177. data/webpack/redux/OrganizationProducts/OrganizationProductsSelectors.js +7 -0
  178. data/webpack/redux/OrganizationProducts/__tests__/OrganizationProductsActions.test.js +47 -0
  179. data/webpack/redux/OrganizationProducts/__tests__/OrganizationProductsReducer.test.js +33 -0
  180. data/webpack/redux/OrganizationProducts/__tests__/OrganizationProductsSelectors.test.js +19 -0
  181. data/webpack/redux/OrganizationProducts/__tests__/__snapshots__/OrganizationProductsActions.test.js.snap +49 -0
  182. data/webpack/redux/OrganizationProducts/__tests__/__snapshots__/OrganizationProductsReducer.test.js.snap +36 -0
  183. data/webpack/redux/OrganizationProducts/__tests__/__snapshots__/OrganizationProductsSelectors.test.js.snap +9 -0
  184. data/webpack/redux/OrganizationProducts/index.js +13 -0
  185. data/webpack/redux/actions/RedHatRepositories/enabled.js +7 -1
  186. data/webpack/redux/actions/RedHatRepositories/helpers.js +4 -0
  187. data/webpack/redux/actions/RedHatRepositories/sets.js +2 -0
  188. data/webpack/redux/reducers/RedHatRepositories/enabled.fixtures.js +8 -2
  189. data/webpack/redux/reducers/RedHatRepositories/enabled.js +1 -1
  190. data/webpack/redux/reducers/RedHatRepositories/sets.fixtures.js +12 -3
  191. data/webpack/redux/reducers/index.js +2 -0
  192. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +68 -33
  193. data/webpack/scenes/RedHatRepositories/index.js +13 -2
  194. data/webpack/scenes/RedHatRepositories/index.scss +26 -0
  195. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +1 -1
  196. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +1 -1
  197. data/webpack/scenes/Subscriptions/SubscriptionActions.js +18 -2
  198. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +8 -0
  199. data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +15 -0
  200. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +22 -14
  201. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +39 -90
  202. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +14 -0
  203. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +1 -3
  204. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +0 -1
  205. data/webpack/scenes/Subscriptions/__tests__/SubscriptionHelpers.test.js +84 -0
  206. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsActions.test.js +26 -1
  207. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +5 -0
  208. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +177 -75
  209. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +29 -0
  210. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionHelpers.test.js.snap +31 -0
  211. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +32 -0
  212. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +18 -96
  213. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +511 -0
  214. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +26 -0
  215. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +6 -1
  216. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +3 -21
  217. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +113 -0
  218. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.test.js +47 -0
  219. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +504 -0
  220. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/index.js +1 -0
  221. data/webpack/scenes/Subscriptions/index.js +15 -4
  222. metadata +59 -14
  223. data/app/lib/actions/pulp/repository/associate_distributor.rb +0 -20
  224. data/app/lib/actions/pulp/repository/associate_importer.rb +0 -23
  225. data/app/lib/actions/pulp/repository/delete_distributor.rb +0 -18
  226. data/app/lib/actions/pulp/repository/refresh_distributor.rb +0 -19
  227. data/app/lib/actions/pulp/repository/update_importer.rb +0 -33
  228. data/app/lib/katello/bulk_actions.rb +0 -63
  229. data/webpack/move_to_foreman/components/common/EmptyState/index.js +0 -68
@@ -0,0 +1,26 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Subscriptions selectors should select delete-modal-opened 1`] = `false`;
4
+
5
+ exports[`Subscriptions selectors should select manifest-modal-opened 1`] = `false`;
6
+
7
+ exports[`Subscriptions selectors should select search-query 1`] = `"some-query"`;
8
+
9
+ exports[`Subscriptions selectors should select subscriptions tasks 1`] = `
10
+ Array [
11
+ "task1",
12
+ "task2",
13
+ ]
14
+ `;
15
+
16
+ exports[`Subscriptions selectors should select the subscriptions state 1`] = `
17
+ Object {
18
+ "deleteModalOpened": false,
19
+ "manifestModalOpened": false,
20
+ "searchQuery": "some-query",
21
+ "tasks": Array [
22
+ "task1",
23
+ "task2",
24
+ ],
25
+ }
26
+ `;
@@ -3,6 +3,7 @@ import { toastErrorAction, failureAction } from '../../../services/api/testHelpe
3
3
 
4
4
  export const initialState = Immutable({
5
5
  loading: true,
6
+ manifestModalOpened: false,
6
7
  results: [],
7
8
  pagination: {
8
9
  page: 0,
@@ -184,6 +185,7 @@ export const quantitiesRequestSuccessResponse = Immutable({
184
185
 
185
186
  export const successState = Immutable({
186
187
  loading: false,
188
+ manifestModalOpened: false,
187
189
  results: [
188
190
  {
189
191
  id: 3,
@@ -270,6 +272,7 @@ export const settingsSuccessState = Immutable({
270
272
 
271
273
  export const errorState = Immutable({
272
274
  loading: false,
275
+ manifestModalOpened: false,
273
276
  pagination: {
274
277
  page: 0,
275
278
  perPage: 20,
@@ -373,13 +376,15 @@ export const loadQuantitiesFailureActions = [
373
376
  toastErrorAction('Request failed with status code 500'),
374
377
  ];
375
378
 
379
+ export const loadQuantitiesSuccessActionPayload = { 4: 100, 5: 100, 6: 40 };
380
+
376
381
  export const loadQuantitiesSuccessActions = [
377
382
  {
378
383
  type: 'SUBSCRIPTIONS_QUANTITIES_REQUEST',
379
384
  },
380
385
  {
381
386
  type: 'SUBSCRIPTIONS_QUANTITIES_SUCCESS',
382
- response: quantitiesRequestSuccessResponse,
387
+ payload: loadQuantitiesSuccessActionPayload,
383
388
  },
384
389
  ];
385
390
  export const tableColumns = [
@@ -12,6 +12,7 @@ exports[`subscriptions table should render a loading state 1`] = `
12
12
  "availableQuantities": null,
13
13
  "itemCount": 0,
14
14
  "loading": true,
15
+ "manifestModalOpened": false,
15
16
  "pagination": Object {
16
17
  "page": 0,
17
18
  "perPage": 20,
@@ -413,26 +414,7 @@ exports[`subscriptions table should render a table 1`] = `
413
414
  `;
414
415
 
415
416
  exports[`subscriptions table should render an empty state 1`] = `
416
- <div
417
- class="blank-slate-pf"
418
- >
419
- <div
420
- class="blank-slate-pf-icon"
421
- >
422
- <span
423
- aria-hidden="true"
424
- class="pficon pficon-add-circle-o"
425
- />
426
- </div>
427
- <h4
428
- class="h1 blank-slate-pf-title"
429
- >
430
- Yay empty state
431
- </h4>
432
- <p
433
- class="blank-slate-pf-info"
434
- >
435
- There is nothing to see here
436
- </p>
417
+ <div>
418
+ EmptyState: {"header":"Yay empty state","description":"There is nothing to see here"}
437
419
  </div>
438
420
  `;
@@ -0,0 +1,113 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Row, Col, Form, FormGroup, Button } from 'patternfly-react';
4
+ import { LinkContainer } from 'react-router-bootstrap';
5
+ import TooltipButton from 'react-bootstrap-tooltip-button';
6
+ import { noop } from 'foremanReact/common/helpers';
7
+
8
+ import Search from '../../../../components/Search/index';
9
+ import OptionTooltip from '../../../../move_to_pf/OptionTooltip';
10
+
11
+ const SubscriptionsToolbar = ({
12
+ disableManifestActions,
13
+ disableManifestReason,
14
+ disableDeleteButton,
15
+ disableDeleteReason,
16
+ disableAddButton,
17
+ getAutoCompleteParams,
18
+ updateSearchQuery,
19
+ onDeleteButtonClick,
20
+ onSearch,
21
+ onManageManifestButtonClick,
22
+ onExportCsvButtonClick,
23
+ tableColumns,
24
+ toolTipOnChange,
25
+ toolTipOnclose,
26
+ }) => (
27
+ <Row className="toolbar-pf table-view-pf-toolbar-external">
28
+ <Col sm={12}>
29
+ <Form className="toolbar-pf-actions">
30
+ <FormGroup className="toolbar-pf-filter">
31
+ <Search
32
+ onSearch={onSearch}
33
+ getAutoCompleteParams={getAutoCompleteParams}
34
+ updateSearchQuery={updateSearchQuery}
35
+ />
36
+ </FormGroup>
37
+ <div className="option-tooltip-container">
38
+ <OptionTooltip options={tableColumns} icon="fa-columns" id="subscriptionTableTooltip" onChange={toolTipOnChange} onClose={toolTipOnclose} />
39
+ </div>
40
+ <div className="toolbar-pf-action-right">
41
+ <FormGroup>
42
+ <LinkContainer
43
+ to="subscriptions/add"
44
+ disabled={disableManifestActions || disableAddButton}
45
+ >
46
+ <TooltipButton
47
+ tooltipId="add-subscriptions-button-tooltip"
48
+ tooltipText={disableManifestReason}
49
+ tooltipPlacement="top"
50
+ title={__('Add Subscriptions')}
51
+ disabled={disableManifestActions}
52
+ bsStyle="primary"
53
+ />
54
+ </LinkContainer>
55
+
56
+ <Button onClick={onManageManifestButtonClick}>
57
+ {__('Manage Manifest')}
58
+ </Button>
59
+
60
+ <Button
61
+ onClick={onExportCsvButtonClick}
62
+ >
63
+ {__('Export CSV')}
64
+ </Button>
65
+
66
+ <TooltipButton
67
+ bsStyle="danger"
68
+ onClick={onDeleteButtonClick}
69
+ tooltipId="delete-subscriptions-button-tooltip"
70
+ tooltipText={disableDeleteReason}
71
+ tooltipPlacement="top"
72
+ title={__('Delete')}
73
+ disabled={disableManifestActions || disableDeleteButton}
74
+ />
75
+
76
+ </FormGroup>
77
+ </div>
78
+ </Form>
79
+ </Col>
80
+ </Row>
81
+ );
82
+
83
+ SubscriptionsToolbar.propTypes = {
84
+ ...Search.propTypes,
85
+ tableColumns: OptionTooltip.propTypes.options,
86
+ disableManifestActions: PropTypes.bool,
87
+ disableManifestReason: PropTypes.string,
88
+ disableDeleteButton: PropTypes.bool,
89
+ disableDeleteReason: PropTypes.string,
90
+ disableAddButton: PropTypes.bool,
91
+ onDeleteButtonClick: PropTypes.func,
92
+ onManageManifestButtonClick: PropTypes.func,
93
+ onExportCsvButtonClick: PropTypes.func,
94
+ toolTipOnChange: PropTypes.func,
95
+ toolTipOnclose: PropTypes.func,
96
+ };
97
+
98
+ SubscriptionsToolbar.defaultProps = {
99
+ ...Search.defaultProps,
100
+ tableColumns: [],
101
+ disableManifestActions: false,
102
+ disableManifestReason: '',
103
+ disableDeleteButton: false,
104
+ disableDeleteReason: '',
105
+ disableAddButton: false,
106
+ onDeleteButtonClick: noop,
107
+ onManageManifestButtonClick: noop,
108
+ onExportCsvButtonClick: noop,
109
+ toolTipOnChange: noop,
110
+ toolTipOnclose: noop,
111
+ };
112
+
113
+ export default SubscriptionsToolbar;
@@ -0,0 +1,47 @@
1
+ import { testComponentSnapshotsWithFixtures } from '../../../../move_to_pf/test-utils/testHelpers';
2
+ import SubscriptionsToolbar from './SubscriptionsToolbar';
3
+
4
+ const createRequiredProps = () => ({
5
+ onSearch: jest.fn(),
6
+ getAutoCompleteParams: jest.fn(),
7
+ updateSearchQuery: jest.fn(),
8
+ });
9
+ const fixtures = {
10
+ 'renders SubscriptionsToolbar': {
11
+ ...createRequiredProps(),
12
+ },
13
+ 'renders SubscriptionsToolbar with disabled manifest actions': {
14
+ ...createRequiredProps(),
15
+ disableManifestActions: true,
16
+ disableManifestReason: 'some reason for manifest',
17
+ },
18
+ 'renders SubscriptionsToolbar with disabled delete button': {
19
+ ...createRequiredProps(),
20
+ disableDeleteButton: true,
21
+ disableDeleteReason: 'some reason for delete',
22
+ },
23
+ 'renders SubscriptionsToolbar with disabled add button': {
24
+ ...createRequiredProps(),
25
+ disableAddButton: true,
26
+ disableManifestReason: 'some reason for manifest',
27
+ },
28
+ 'renders SubscriptionsToolbar with table columns': {
29
+ ...createRequiredProps(),
30
+ tableColumns: [{
31
+ key: 'col1',
32
+ label: 'Col 1',
33
+ value: true,
34
+ }, {
35
+ key: 'col2',
36
+ label: 'Col 2',
37
+ value: false,
38
+ }, {
39
+ key: 'col2',
40
+ label: 'Col 2',
41
+ value: false,
42
+ }],
43
+ },
44
+ };
45
+
46
+ describe('SubscriptionsToolbar', () =>
47
+ testComponentSnapshotsWithFixtures(SubscriptionsToolbar, fixtures));
@@ -0,0 +1,504 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`SubscriptionsToolbar renders SubscriptionsToolbar 1`] = `
4
+ <Row
5
+ bsClass="row"
6
+ className="toolbar-pf table-view-pf-toolbar-external"
7
+ componentClass="div"
8
+ >
9
+ <Col
10
+ bsClass="col"
11
+ componentClass="div"
12
+ sm={12}
13
+ >
14
+ <Form
15
+ bsClass="form"
16
+ className="toolbar-pf-actions"
17
+ componentClass="form"
18
+ horizontal={false}
19
+ inline={false}
20
+ >
21
+ <FormGroup
22
+ bsClass="form-group"
23
+ className="toolbar-pf-filter"
24
+ >
25
+ <Search
26
+ getAutoCompleteParams={[MockFunction]}
27
+ initialInputValue=""
28
+ onSearch={[MockFunction]}
29
+ updateSearchQuery={[MockFunction]}
30
+ />
31
+ </FormGroup>
32
+ <div
33
+ className="option-tooltip-container"
34
+ >
35
+ <OptionTooltip
36
+ icon="fa-columns"
37
+ id="subscriptionTableTooltip"
38
+ onChange={[Function]}
39
+ onClose={[Function]}
40
+ options={Array []}
41
+ rootClose={true}
42
+ />
43
+ </div>
44
+ <div
45
+ className="toolbar-pf-action-right"
46
+ >
47
+ <FormGroup
48
+ bsClass="form-group"
49
+ >
50
+ <LinkContainer
51
+ activeClassName="active"
52
+ disabled={false}
53
+ exact={false}
54
+ replace={false}
55
+ strict={false}
56
+ to="subscriptions/add"
57
+ >
58
+ <TooltipButton
59
+ bsStyle="primary"
60
+ disabled={false}
61
+ title="Add Subscriptions"
62
+ tooltipId="add-subscriptions-button-tooltip"
63
+ tooltipPlacement="top"
64
+ tooltipText=""
65
+ />
66
+ </LinkContainer>
67
+ <Button
68
+ active={false}
69
+ block={false}
70
+ bsClass="btn"
71
+ bsStyle="default"
72
+ disabled={false}
73
+ >
74
+ Manage Manifest
75
+ </Button>
76
+ <Button
77
+ active={false}
78
+ block={false}
79
+ bsClass="btn"
80
+ bsStyle="default"
81
+ disabled={false}
82
+ >
83
+ Export CSV
84
+ </Button>
85
+ <TooltipButton
86
+ bsStyle="danger"
87
+ disabled={false}
88
+ title="Delete"
89
+ tooltipId="delete-subscriptions-button-tooltip"
90
+ tooltipPlacement="top"
91
+ tooltipText=""
92
+ />
93
+ </FormGroup>
94
+ </div>
95
+ </Form>
96
+ </Col>
97
+ </Row>
98
+ `;
99
+
100
+ exports[`SubscriptionsToolbar renders SubscriptionsToolbar with disabled add button 1`] = `
101
+ <Row
102
+ bsClass="row"
103
+ className="toolbar-pf table-view-pf-toolbar-external"
104
+ componentClass="div"
105
+ >
106
+ <Col
107
+ bsClass="col"
108
+ componentClass="div"
109
+ sm={12}
110
+ >
111
+ <Form
112
+ bsClass="form"
113
+ className="toolbar-pf-actions"
114
+ componentClass="form"
115
+ horizontal={false}
116
+ inline={false}
117
+ >
118
+ <FormGroup
119
+ bsClass="form-group"
120
+ className="toolbar-pf-filter"
121
+ >
122
+ <Search
123
+ getAutoCompleteParams={[MockFunction]}
124
+ initialInputValue=""
125
+ onSearch={[MockFunction]}
126
+ updateSearchQuery={[MockFunction]}
127
+ />
128
+ </FormGroup>
129
+ <div
130
+ className="option-tooltip-container"
131
+ >
132
+ <OptionTooltip
133
+ icon="fa-columns"
134
+ id="subscriptionTableTooltip"
135
+ onChange={[Function]}
136
+ onClose={[Function]}
137
+ options={Array []}
138
+ rootClose={true}
139
+ />
140
+ </div>
141
+ <div
142
+ className="toolbar-pf-action-right"
143
+ >
144
+ <FormGroup
145
+ bsClass="form-group"
146
+ >
147
+ <LinkContainer
148
+ activeClassName="active"
149
+ disabled={true}
150
+ exact={false}
151
+ replace={false}
152
+ strict={false}
153
+ to="subscriptions/add"
154
+ >
155
+ <TooltipButton
156
+ bsStyle="primary"
157
+ disabled={false}
158
+ title="Add Subscriptions"
159
+ tooltipId="add-subscriptions-button-tooltip"
160
+ tooltipPlacement="top"
161
+ tooltipText="some reason for manifest"
162
+ />
163
+ </LinkContainer>
164
+ <Button
165
+ active={false}
166
+ block={false}
167
+ bsClass="btn"
168
+ bsStyle="default"
169
+ disabled={false}
170
+ >
171
+ Manage Manifest
172
+ </Button>
173
+ <Button
174
+ active={false}
175
+ block={false}
176
+ bsClass="btn"
177
+ bsStyle="default"
178
+ disabled={false}
179
+ >
180
+ Export CSV
181
+ </Button>
182
+ <TooltipButton
183
+ bsStyle="danger"
184
+ disabled={false}
185
+ title="Delete"
186
+ tooltipId="delete-subscriptions-button-tooltip"
187
+ tooltipPlacement="top"
188
+ tooltipText=""
189
+ />
190
+ </FormGroup>
191
+ </div>
192
+ </Form>
193
+ </Col>
194
+ </Row>
195
+ `;
196
+
197
+ exports[`SubscriptionsToolbar renders SubscriptionsToolbar with disabled delete button 1`] = `
198
+ <Row
199
+ bsClass="row"
200
+ className="toolbar-pf table-view-pf-toolbar-external"
201
+ componentClass="div"
202
+ >
203
+ <Col
204
+ bsClass="col"
205
+ componentClass="div"
206
+ sm={12}
207
+ >
208
+ <Form
209
+ bsClass="form"
210
+ className="toolbar-pf-actions"
211
+ componentClass="form"
212
+ horizontal={false}
213
+ inline={false}
214
+ >
215
+ <FormGroup
216
+ bsClass="form-group"
217
+ className="toolbar-pf-filter"
218
+ >
219
+ <Search
220
+ getAutoCompleteParams={[MockFunction]}
221
+ initialInputValue=""
222
+ onSearch={[MockFunction]}
223
+ updateSearchQuery={[MockFunction]}
224
+ />
225
+ </FormGroup>
226
+ <div
227
+ className="option-tooltip-container"
228
+ >
229
+ <OptionTooltip
230
+ icon="fa-columns"
231
+ id="subscriptionTableTooltip"
232
+ onChange={[Function]}
233
+ onClose={[Function]}
234
+ options={Array []}
235
+ rootClose={true}
236
+ />
237
+ </div>
238
+ <div
239
+ className="toolbar-pf-action-right"
240
+ >
241
+ <FormGroup
242
+ bsClass="form-group"
243
+ >
244
+ <LinkContainer
245
+ activeClassName="active"
246
+ disabled={false}
247
+ exact={false}
248
+ replace={false}
249
+ strict={false}
250
+ to="subscriptions/add"
251
+ >
252
+ <TooltipButton
253
+ bsStyle="primary"
254
+ disabled={false}
255
+ title="Add Subscriptions"
256
+ tooltipId="add-subscriptions-button-tooltip"
257
+ tooltipPlacement="top"
258
+ tooltipText=""
259
+ />
260
+ </LinkContainer>
261
+ <Button
262
+ active={false}
263
+ block={false}
264
+ bsClass="btn"
265
+ bsStyle="default"
266
+ disabled={false}
267
+ >
268
+ Manage Manifest
269
+ </Button>
270
+ <Button
271
+ active={false}
272
+ block={false}
273
+ bsClass="btn"
274
+ bsStyle="default"
275
+ disabled={false}
276
+ >
277
+ Export CSV
278
+ </Button>
279
+ <TooltipButton
280
+ bsStyle="danger"
281
+ disabled={true}
282
+ title="Delete"
283
+ tooltipId="delete-subscriptions-button-tooltip"
284
+ tooltipPlacement="top"
285
+ tooltipText="some reason for delete"
286
+ />
287
+ </FormGroup>
288
+ </div>
289
+ </Form>
290
+ </Col>
291
+ </Row>
292
+ `;
293
+
294
+ exports[`SubscriptionsToolbar renders SubscriptionsToolbar with disabled manifest actions 1`] = `
295
+ <Row
296
+ bsClass="row"
297
+ className="toolbar-pf table-view-pf-toolbar-external"
298
+ componentClass="div"
299
+ >
300
+ <Col
301
+ bsClass="col"
302
+ componentClass="div"
303
+ sm={12}
304
+ >
305
+ <Form
306
+ bsClass="form"
307
+ className="toolbar-pf-actions"
308
+ componentClass="form"
309
+ horizontal={false}
310
+ inline={false}
311
+ >
312
+ <FormGroup
313
+ bsClass="form-group"
314
+ className="toolbar-pf-filter"
315
+ >
316
+ <Search
317
+ getAutoCompleteParams={[MockFunction]}
318
+ initialInputValue=""
319
+ onSearch={[MockFunction]}
320
+ updateSearchQuery={[MockFunction]}
321
+ />
322
+ </FormGroup>
323
+ <div
324
+ className="option-tooltip-container"
325
+ >
326
+ <OptionTooltip
327
+ icon="fa-columns"
328
+ id="subscriptionTableTooltip"
329
+ onChange={[Function]}
330
+ onClose={[Function]}
331
+ options={Array []}
332
+ rootClose={true}
333
+ />
334
+ </div>
335
+ <div
336
+ className="toolbar-pf-action-right"
337
+ >
338
+ <FormGroup
339
+ bsClass="form-group"
340
+ >
341
+ <LinkContainer
342
+ activeClassName="active"
343
+ disabled={true}
344
+ exact={false}
345
+ replace={false}
346
+ strict={false}
347
+ to="subscriptions/add"
348
+ >
349
+ <TooltipButton
350
+ bsStyle="primary"
351
+ disabled={true}
352
+ title="Add Subscriptions"
353
+ tooltipId="add-subscriptions-button-tooltip"
354
+ tooltipPlacement="top"
355
+ tooltipText="some reason for manifest"
356
+ />
357
+ </LinkContainer>
358
+ <Button
359
+ active={false}
360
+ block={false}
361
+ bsClass="btn"
362
+ bsStyle="default"
363
+ disabled={false}
364
+ >
365
+ Manage Manifest
366
+ </Button>
367
+ <Button
368
+ active={false}
369
+ block={false}
370
+ bsClass="btn"
371
+ bsStyle="default"
372
+ disabled={false}
373
+ >
374
+ Export CSV
375
+ </Button>
376
+ <TooltipButton
377
+ bsStyle="danger"
378
+ disabled={true}
379
+ title="Delete"
380
+ tooltipId="delete-subscriptions-button-tooltip"
381
+ tooltipPlacement="top"
382
+ tooltipText=""
383
+ />
384
+ </FormGroup>
385
+ </div>
386
+ </Form>
387
+ </Col>
388
+ </Row>
389
+ `;
390
+
391
+ exports[`SubscriptionsToolbar renders SubscriptionsToolbar with table columns 1`] = `
392
+ <Row
393
+ bsClass="row"
394
+ className="toolbar-pf table-view-pf-toolbar-external"
395
+ componentClass="div"
396
+ >
397
+ <Col
398
+ bsClass="col"
399
+ componentClass="div"
400
+ sm={12}
401
+ >
402
+ <Form
403
+ bsClass="form"
404
+ className="toolbar-pf-actions"
405
+ componentClass="form"
406
+ horizontal={false}
407
+ inline={false}
408
+ >
409
+ <FormGroup
410
+ bsClass="form-group"
411
+ className="toolbar-pf-filter"
412
+ >
413
+ <Search
414
+ getAutoCompleteParams={[MockFunction]}
415
+ initialInputValue=""
416
+ onSearch={[MockFunction]}
417
+ updateSearchQuery={[MockFunction]}
418
+ />
419
+ </FormGroup>
420
+ <div
421
+ className="option-tooltip-container"
422
+ >
423
+ <OptionTooltip
424
+ icon="fa-columns"
425
+ id="subscriptionTableTooltip"
426
+ onChange={[Function]}
427
+ onClose={[Function]}
428
+ options={
429
+ Array [
430
+ Object {
431
+ "key": "col1",
432
+ "label": "Col 1",
433
+ "value": true,
434
+ },
435
+ Object {
436
+ "key": "col2",
437
+ "label": "Col 2",
438
+ "value": false,
439
+ },
440
+ Object {
441
+ "key": "col2",
442
+ "label": "Col 2",
443
+ "value": false,
444
+ },
445
+ ]
446
+ }
447
+ rootClose={true}
448
+ />
449
+ </div>
450
+ <div
451
+ className="toolbar-pf-action-right"
452
+ >
453
+ <FormGroup
454
+ bsClass="form-group"
455
+ >
456
+ <LinkContainer
457
+ activeClassName="active"
458
+ disabled={false}
459
+ exact={false}
460
+ replace={false}
461
+ strict={false}
462
+ to="subscriptions/add"
463
+ >
464
+ <TooltipButton
465
+ bsStyle="primary"
466
+ disabled={false}
467
+ title="Add Subscriptions"
468
+ tooltipId="add-subscriptions-button-tooltip"
469
+ tooltipPlacement="top"
470
+ tooltipText=""
471
+ />
472
+ </LinkContainer>
473
+ <Button
474
+ active={false}
475
+ block={false}
476
+ bsClass="btn"
477
+ bsStyle="default"
478
+ disabled={false}
479
+ >
480
+ Manage Manifest
481
+ </Button>
482
+ <Button
483
+ active={false}
484
+ block={false}
485
+ bsClass="btn"
486
+ bsStyle="default"
487
+ disabled={false}
488
+ >
489
+ Export CSV
490
+ </Button>
491
+ <TooltipButton
492
+ bsStyle="danger"
493
+ disabled={false}
494
+ title="Delete"
495
+ tooltipId="delete-subscriptions-button-tooltip"
496
+ tooltipPlacement="top"
497
+ tooltipText=""
498
+ />
499
+ </FormGroup>
500
+ </div>
501
+ </Form>
502
+ </Col>
503
+ </Row>
504
+ `;