katello 3.7.0.rc1 → 3.7.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 (189) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/content_views_controller.rb +5 -2
  3. data/app/controllers/katello/api/v2/environments_controller.rb +8 -3
  4. data/app/controllers/katello/api/v2/host_tracer_controller.rb +1 -1
  5. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +4 -4
  6. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +5 -22
  7. data/app/lib/actions/katello/host/update_content_overrides.rb +1 -0
  8. data/app/lib/actions/katello/product/content_create.rb +1 -0
  9. data/app/lib/actions/katello/product/repositories_certs_reset.rb +25 -0
  10. data/app/lib/actions/katello/product/update.rb +6 -0
  11. data/app/lib/katello/resources/candlepin/activation_key.rb +8 -4
  12. data/app/lib/katello/resources/candlepin/product.rb +2 -1
  13. data/app/lib/katello/util/cdn_var_substitutor.rb +5 -3
  14. data/app/lib/katello/util/package.rb +21 -13
  15. data/app/lib/katello/util/package_filter.rb +33 -31
  16. data/app/lib/katello/validators/prior_validator.rb +6 -10
  17. data/app/models/katello/concerns/host_managed_extensions.rb +2 -0
  18. data/app/models/katello/concerns/organization_extensions.rb +1 -0
  19. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +10 -6
  20. data/app/models/katello/content.rb +23 -2
  21. data/app/models/katello/content_view_docker_filter.rb +1 -1
  22. data/app/models/katello/content_view_puppet_module.rb +3 -3
  23. data/app/models/katello/content_view_version.rb +4 -0
  24. data/app/models/katello/environment_prior.rb +7 -0
  25. data/app/models/katello/glue/candlepin/candlepin_object.rb +2 -2
  26. data/app/models/katello/glue/candlepin/pool.rb +10 -13
  27. data/app/models/katello/glue/candlepin/product.rb +19 -9
  28. data/app/models/katello/glue/candlepin/repository.rb +16 -0
  29. data/app/models/katello/glue/candlepin/subscription.rb +1 -1
  30. data/app/models/katello/glue/provider.rb +15 -81
  31. data/app/models/katello/host/subscription_facet.rb +1 -1
  32. data/app/models/katello/kt_environment.rb +39 -8
  33. data/app/models/katello/pool.rb +2 -1
  34. data/app/models/katello/rpm.rb +144 -2
  35. data/app/models/katello/upstream_pool.rb +7 -10
  36. data/app/services/katello/candlepin/pool_service.rb +18 -3
  37. data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +13 -16
  38. data/app/views/dashboard/_content_views_widget.html.erb +3 -3
  39. data/app/views/dashboard/_errata_widget.html.erb +2 -2
  40. data/app/views/dashboard/_host_collection_widget.html.erb +3 -3
  41. data/app/views/dashboard/_subscription_status_widget.html.erb +2 -2
  42. data/app/views/dashboard/_subscription_widget.html.erb +1 -1
  43. data/app/views/dashboard/_sync_widget.html.erb +3 -3
  44. data/app/views/katello/api/v2/subscriptions/base.json.rabl +1 -1
  45. data/app/views/katello/api/v2/upstream_subscriptions/base.json.rabl +2 -6
  46. data/app/views/katello/layouts/react.html.erb +3 -3
  47. data/config/katello.yaml +89 -0
  48. data/config/routes.rb +3 -0
  49. data/db/migrate/20160302091113_change_environment_prior.rb +9 -0
  50. data/db/migrate/20180410140909_add_organization_id_to_pool.rb +2 -1
  51. data/db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb +10 -0
  52. data/db/migrate/20180612164926_add_content_org_id.rb +39 -0
  53. data/db/migrate/20180612165011_remove_content_fields_from_host.rb +7 -0
  54. data/db/migrate/20180626160422_add_upstream_pool_id_to_katello_pool.rb +9 -0
  55. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +1 -1
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register.html +1 -1
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/environment-content.controller.js +2 -3
  58. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment.html +4 -2
  59. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.controller.js +19 -14
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js +18 -5
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js +51 -0
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/views/new-environment.html +16 -3
  63. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +1 -1
  64. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +2 -2
  65. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions.routes.js +3 -3
  66. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/tasks.module.js +1 -6
  67. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +4 -0
  68. data/engines/bastion_katello/lib/bastion_katello/engine.rb +1 -1
  69. data/lib/katello/plugin.rb +2 -11
  70. data/lib/katello/scheduled_jobs.rb +2 -14
  71. data/lib/katello/tasks/clean_backend_objects.rake +2 -0
  72. data/lib/katello/tasks/repository.rake +11 -2
  73. data/lib/katello/tasks/upgrades/3.7/import_pools.rake +12 -0
  74. data/lib/katello/version.rb +1 -1
  75. data/package.json +4 -3
  76. data/webpack/components/PaginationRow/index.js +6 -2
  77. data/webpack/containers/Application/config.js +7 -2
  78. data/webpack/index.js +3 -5
  79. data/webpack/move_to_foreman/common/helpers.js +5 -24
  80. data/webpack/move_to_foreman/components/common/emptyState/index.js +12 -7
  81. data/webpack/move_to_foreman/components/common/table/components/CollapseSubscriptionGroupButton.js +31 -0
  82. data/webpack/move_to_foreman/components/common/table/components/CollapseSubscriptionGroupButton.test.js +16 -0
  83. data/webpack/move_to_foreman/components/common/table/components/Table.js +76 -0
  84. data/webpack/move_to_foreman/components/common/table/components/Table.test.js +31 -0
  85. data/webpack/move_to_foreman/components/common/table/components/TableBody.js +27 -0
  86. data/webpack/move_to_foreman/components/common/table/components/TableBody.test.js +18 -0
  87. data/webpack/move_to_foreman/components/common/table/components/TableBodyMessage.js +18 -0
  88. data/webpack/move_to_foreman/components/common/table/components/TableBodyMessage.test.js +12 -0
  89. data/webpack/move_to_foreman/components/common/table/components/TableFixtures.js +14 -0
  90. data/webpack/move_to_foreman/components/common/table/components/TableSelectionCell.js +39 -0
  91. data/webpack/move_to_foreman/components/common/table/components/TableSelectionCell.test.js +16 -0
  92. data/webpack/move_to_foreman/components/common/table/components/TableSelectionHeaderCell.js +34 -0
  93. data/webpack/move_to_foreman/components/common/table/components/TableSelectionHeaderCell.test.js +14 -0
  94. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +19 -0
  95. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/Table.test.js.snap +167 -0
  96. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableBody.test.js.snap +28 -0
  97. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableBodyMessage.test.js.snap +13 -0
  98. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionCell.test.js.snap +16 -0
  99. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +15 -0
  100. data/webpack/move_to_foreman/components/common/table/components/index.js +6 -0
  101. data/webpack/move_to_foreman/components/common/table/formatters/cellFormatter.js +4 -0
  102. data/webpack/move_to_foreman/components/common/table/formatters/collapseableAndSelectionCellFormatter.js +18 -0
  103. data/webpack/move_to_foreman/components/common/table/formatters/ellipsisCellFormatter.js +5 -0
  104. data/webpack/move_to_foreman/components/common/table/formatters/headerFormatter.js +4 -0
  105. data/webpack/move_to_foreman/components/common/table/formatters/index.js +6 -0
  106. data/webpack/move_to_foreman/components/common/table/formatters/selectionCellFormatter.js +17 -0
  107. data/webpack/move_to_foreman/components/common/table/formatters/selectionHeaderCellFormatter.js +10 -0
  108. data/webpack/move_to_foreman/components/common/table/index.js +2 -88
  109. data/webpack/move_to_pf/LoadingState/LoadingState.js +35 -0
  110. data/webpack/move_to_pf/LoadingState/LoadingState.scss +12 -0
  111. data/webpack/move_to_pf/LoadingState/LoadingState.test.js +28 -0
  112. data/webpack/move_to_pf/LoadingState/__snapshots__/LoadingState.test.js.snap +20 -0
  113. data/webpack/move_to_pf/LoadingState/index.js +3 -0
  114. data/webpack/move_to_pf/test-utils/testHelpers.js +71 -0
  115. data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -1
  116. data/webpack/redux/actions/RedHatRepositories/helpers.js +34 -9
  117. data/webpack/redux/actions/RedHatRepositories/sets.js +28 -6
  118. data/webpack/redux/consts.js +1 -0
  119. data/webpack/redux/reducers/RedHatRepositories/sets.fixtures.js +12 -2
  120. data/webpack/redux/reducers/RedHatRepositories/sets.js +34 -27
  121. data/webpack/redux/reducers/RedHatRepositories/sets.test.js +10 -2
  122. data/webpack/redux/reducers/index.js +2 -0
  123. data/webpack/scenes/Organizations/OrganizationActions.js +3 -3
  124. data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.js +44 -0
  125. data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.scss +16 -0
  126. data/webpack/scenes/RedHatRepositories/components/RepositorySet.js +8 -2
  127. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepositories.js +5 -3
  128. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository.js +4 -2
  129. data/webpack/scenes/RedHatRepositories/components/Search.js +1 -1
  130. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +1 -1
  131. data/webpack/scenes/RedHatRepositories/components/__tests__/RecommendedRepositorySetsToggler.test.js +17 -0
  132. data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RecommendedRepositorySetsToggler.test.js.snap +37 -0
  133. data/webpack/scenes/RedHatRepositories/helpers.js +1 -1
  134. data/webpack/scenes/RedHatRepositories/index.js +17 -7
  135. data/webpack/scenes/RedHatRepositories/index.scss +16 -4
  136. data/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js +17 -0
  137. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +28 -0
  138. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js +47 -0
  139. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailConstants.js +3 -0
  140. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailInfo.js +65 -0
  141. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProducts.js +20 -0
  142. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js +37 -0
  143. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +58 -0
  144. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js +47 -0
  145. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailAssociations.test.js +16 -0
  146. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailInfo.test.js +15 -0
  147. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailProducts.test.js +16 -0
  148. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailReducer.test.js +39 -0
  149. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +28 -0
  150. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailAssociations.test.js.snap +53 -0
  151. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap +185 -0
  152. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProducts.test.js.snap +77 -0
  153. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +432 -0
  154. data/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js +167 -0
  155. data/webpack/scenes/Subscriptions/Details/index.js +19 -0
  156. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +58 -12
  157. data/webpack/scenes/Subscriptions/Manifest/Manifest.scss +6 -1
  158. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +4 -4
  159. data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js +7 -7
  160. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +6 -9
  161. data/webpack/scenes/Subscriptions/Manifest/index.js +2 -2
  162. data/webpack/scenes/Subscriptions/SubscriptionActions.js +5 -6
  163. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +2 -3
  164. data/webpack/scenes/Subscriptions/SubscriptionValidations.js +1 -1
  165. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +46 -30
  166. data/webpack/scenes/Subscriptions/SubscriptionsPage.scss +38 -0
  167. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +3 -3
  168. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +7 -6
  169. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +17 -14
  170. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +12 -15
  171. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/upstreamSubscriptions.fixtures.js +4 -4
  172. data/webpack/scenes/Subscriptions/__tests__/SubscriptionValidations.test.js +5 -0
  173. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +2 -2
  174. data/webpack/scenes/Subscriptions/{EntitlementsInlineEditFormatter.js → components/SubscriptionsTable/EntitlementsInlineEditFormatter.js} +7 -7
  175. data/webpack/scenes/Subscriptions/{SubscriptionsTable.js → components/SubscriptionsTable/SubscriptionsTable.js} +75 -47
  176. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +60 -0
  177. data/webpack/scenes/Subscriptions/{SubscriptionsTableSchema.js → components/SubscriptionsTable/SubscriptionsTableSchema.js} +37 -26
  178. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +56 -0
  179. data/webpack/scenes/Subscriptions/{__tests__ → components/SubscriptionsTable/__tests__}/__snapshots__/SubscriptionsTable.test.js.snap +16 -5
  180. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/index.js +2 -0
  181. data/webpack/scenes/Subscriptions/index.js +2 -2
  182. data/webpack/scenes/Tasks/TaskActions.js +18 -11
  183. data/webpack/scenes/Tasks/__tests__/TaskActions.test.js +92 -9
  184. data/webpack/scenes/Tasks/__tests__/task.fixtures.js +19 -9
  185. data/webpack/services/api/index.js +2 -2
  186. data/webpack/test_setup.js +1 -0
  187. metadata +79 -10
  188. data/webpack/scenes/Subscriptions/Subscriptions.scss +0 -14
  189. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsTable.test.js +0 -47
@@ -0,0 +1,16 @@
1
+ import { testComponentSnapshotsWithFixtures } from '../../../../../move_to_pf/test-utils/testHelpers';
2
+
3
+ import CollapseSubscriptionGroupButton from './CollapseSubscriptionGroupButton';
4
+
5
+ const fixtures = {
6
+ 'renders CollapseSubscriptionGroupButton collapsed': {
7
+ collapsed: true,
8
+ onClick: jest.fn(),
9
+ },
10
+ 'renders CollapseSubscriptionGroupButton opened': {
11
+ collapsed: false,
12
+ onClick: jest.fn(),
13
+ },
14
+ };
15
+
16
+ describe('CollapseSubscriptionGroupButton', () => testComponentSnapshotsWithFixtures(CollapseSubscriptionGroupButton, fixtures));
@@ -0,0 +1,76 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Table as PfTable } from 'patternfly-react';
4
+ import { noop } from 'foremanReact/common/helpers';
5
+ import EmptyState from '../../emptyState';
6
+ import PaginationRow from '../../../../../components/PaginationRow/index';
7
+
8
+ import TableBody from './TableBody';
9
+
10
+ const Table = ({
11
+ columns,
12
+ rows,
13
+ emptyState,
14
+ bodyMessage,
15
+ children,
16
+ itemCount,
17
+ pagination,
18
+ onPaginationChange,
19
+ ...props
20
+ }) => {
21
+ if (rows.length === 0 && bodyMessage === undefined) {
22
+ return <EmptyState {...emptyState} />;
23
+ }
24
+
25
+ const shouldRenderPagination = itemCount && pagination;
26
+
27
+ const body = children || [
28
+ <PfTable.Header key="header" />,
29
+ <TableBody key="body" columns={columns} rows={rows} message={bodyMessage} rowKey="id" />,
30
+ ];
31
+
32
+ return (
33
+ <div>
34
+ <PfTable.PfProvider
35
+ columns={columns}
36
+ className="table-fixed"
37
+ striped
38
+ bordered
39
+ hover
40
+ {...props}
41
+ >
42
+ {body}
43
+ </PfTable.PfProvider>
44
+ {shouldRenderPagination && (
45
+ <PaginationRow
46
+ viewType="table"
47
+ itemCount={itemCount}
48
+ pagination={pagination}
49
+ onChange={onPaginationChange}
50
+ />
51
+ )}
52
+ </div>
53
+ );
54
+ };
55
+
56
+ Table.propTypes = {
57
+ columns: PropTypes.arrayOf(PropTypes.object).isRequired,
58
+ rows: PropTypes.arrayOf(PropTypes.object).isRequired,
59
+ emptyState: PropTypes.object, // eslint-disable-line react/forbid-prop-types
60
+ pagination: PropTypes.object, // eslint-disable-line react/forbid-prop-types
61
+ bodyMessage: PropTypes.node,
62
+ children: PropTypes.node,
63
+ itemCount: PropTypes.number,
64
+ onPaginationChange: PropTypes.func,
65
+ };
66
+
67
+ Table.defaultProps = {
68
+ emptyState: undefined,
69
+ pagination: undefined,
70
+ bodyMessage: undefined,
71
+ children: undefined,
72
+ itemCount: undefined,
73
+ onPaginationChange: noop,
74
+ };
75
+
76
+ export default Table;
@@ -0,0 +1,31 @@
1
+ import { testComponentSnapshotsWithFixtures } from '../../../../../move_to_pf/test-utils/testHelpers';
2
+
3
+ import Table from './Table';
4
+ import { columnsFixtures, rowsFixtures } from './TableFixtures';
5
+
6
+ const fixtures = {
7
+ 'renders Table with emptyState': {
8
+ columns: columnsFixtures,
9
+ rows: [],
10
+ emptyState: { empty: 'state' },
11
+ },
12
+ 'renders Table with children': {
13
+ columns: columnsFixtures,
14
+ rows: rowsFixtures,
15
+ children: 'some children',
16
+ },
17
+ 'renders Table with body': {
18
+ columns: columnsFixtures,
19
+ rows: rowsFixtures,
20
+ bodyMessage: 'some body message',
21
+ },
22
+ 'renders Table with pagination': {
23
+ columns: columnsFixtures,
24
+ rows: rowsFixtures,
25
+ children: 'some children',
26
+ itemCount: 2,
27
+ pagination: { page: 1, perPage: 20 },
28
+ },
29
+ };
30
+
31
+ describe('Table', () => testComponentSnapshotsWithFixtures(Table, fixtures));
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Table as PfTable } from 'patternfly-react';
4
+
5
+ import TableBodyMessage from './TableBodyMessage';
6
+
7
+ const TableBody = ({
8
+ columns, rows, message, ...props
9
+ }) => {
10
+ if (message) {
11
+ return <TableBodyMessage colSpan={columns.length}>{message}</TableBodyMessage>;
12
+ }
13
+
14
+ return <PfTable.Body rows={rows} rowKey={({ rowIndex }) => rowIndex} {...props} />;
15
+ };
16
+
17
+ TableBody.propTypes = {
18
+ columns: PropTypes.arrayOf(PropTypes.object).isRequired,
19
+ rows: PropTypes.arrayOf(PropTypes.object).isRequired,
20
+ message: PropTypes.string,
21
+ };
22
+
23
+ TableBody.defaultProps = {
24
+ message: '',
25
+ };
26
+
27
+ export default TableBody;
@@ -0,0 +1,18 @@
1
+ import { testComponentSnapshotsWithFixtures } from '../../../../../move_to_pf/test-utils/testHelpers';
2
+
3
+ import TableBody from './TableBody';
4
+ import { columnsFixtures, rowsFixtures } from './TableFixtures';
5
+
6
+ const fixtures = {
7
+ 'renders TableBody': {
8
+ columns: columnsFixtures,
9
+ rows: rowsFixtures,
10
+ },
11
+ 'renders TableBody with message': {
12
+ columns: columnsFixtures,
13
+ rows: rowsFixtures,
14
+ message: 'some message',
15
+ },
16
+ };
17
+
18
+ describe('TableBody', () => testComponentSnapshotsWithFixtures(TableBody, fixtures));
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const TableBodyMessage = ({ colSpan, children }) => (
5
+ <tbody>
6
+ <tr>
7
+ <td colSpan={colSpan}>{children}</td>
8
+ </tr>
9
+ </tbody>
10
+ );
11
+
12
+ TableBodyMessage.propTypes = {
13
+ colSpan: PropTypes.number.isRequired,
14
+ children: PropTypes.node.isRequired,
15
+ };
16
+
17
+
18
+ export default TableBodyMessage;
@@ -0,0 +1,12 @@
1
+ import { testComponentSnapshotsWithFixtures } from '../../../../../move_to_pf/test-utils/testHelpers';
2
+
3
+ import TableBodyMessage from './TableBodyMessage';
4
+
5
+ const fixtures = {
6
+ 'renders TableBodyMessage': {
7
+ colSpan: 2,
8
+ children: 'some children',
9
+ },
10
+ };
11
+
12
+ describe('TableBodyMessage', () => testComponentSnapshotsWithFixtures(TableBodyMessage, fixtures));
@@ -0,0 +1,14 @@
1
+ // see: https://reactabular.js.org/#/column-definition
2
+ export const columnsFixtures = [{
3
+ property: 'id',
4
+ header: {
5
+ label: 'ID',
6
+ },
7
+ }, {
8
+ property: 'data',
9
+ header: {
10
+ label: 'Data',
11
+ },
12
+ }];
13
+
14
+ export const rowsFixtures = [{ id: 1, data: 'data-1' }, { id: 2, data: 'data-2' }];
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Table } from 'patternfly-react';
4
+ import { noop } from 'foremanReact/common/helpers';
5
+
6
+ const TableSelectionCell = ({
7
+ id, before, after, label, checked, onChange, ...props
8
+ }) => (
9
+ <Table.SelectionCell>
10
+ {before}
11
+ <Table.Checkbox
12
+ id={id}
13
+ label={label}
14
+ checked={checked}
15
+ onChange={onChange}
16
+ {...props}
17
+ />
18
+ {after}
19
+ </Table.SelectionCell>
20
+ );
21
+
22
+ TableSelectionCell.propTypes = {
23
+ id: PropTypes.string.isRequired,
24
+ before: PropTypes.node,
25
+ after: PropTypes.node,
26
+ label: PropTypes.string,
27
+ checked: PropTypes.bool,
28
+ onChange: PropTypes.func,
29
+ };
30
+
31
+ TableSelectionCell.defaultProps = {
32
+ before: null,
33
+ after: null,
34
+ label: __('Select row'),
35
+ checked: false,
36
+ onChange: noop,
37
+ };
38
+
39
+ export default TableSelectionCell;
@@ -0,0 +1,16 @@
1
+ import { testComponentSnapshotsWithFixtures } from '../../../../../move_to_pf/test-utils/testHelpers';
2
+
3
+ import TableSelectionCell from './TableSelectionCell';
4
+
5
+ const fixtures = {
6
+ 'renders TableSelectionCell': {
7
+ id: 'some id',
8
+ before: 'some before',
9
+ after: 'some after',
10
+ label: 'some label',
11
+ checked: true,
12
+ onChange: jest.fn(),
13
+ },
14
+ };
15
+
16
+ describe('TableSelectionCell', () => testComponentSnapshotsWithFixtures(TableSelectionCell, fixtures));
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Table } from 'patternfly-react';
4
+ import { noop } from 'foremanReact/common/helpers';
5
+
6
+ const TableSelectionHeaderCell = ({
7
+ id, label, checked, onChange, ...props
8
+ }) => (
9
+ <Table.SelectionHeading aria-label={label}>
10
+ <Table.Checkbox
11
+ id={id}
12
+ label={label}
13
+ checked={checked}
14
+ onChange={onChange}
15
+ {...props}
16
+ />
17
+ </Table.SelectionHeading>
18
+ );
19
+
20
+ TableSelectionHeaderCell.propTypes = {
21
+ id: PropTypes.string,
22
+ label: PropTypes.string,
23
+ checked: PropTypes.bool,
24
+ onChange: PropTypes.func,
25
+ };
26
+
27
+ TableSelectionHeaderCell.defaultProps = {
28
+ id: 'selectAll',
29
+ label: '',
30
+ checked: false,
31
+ onChange: noop,
32
+ };
33
+
34
+ export default TableSelectionHeaderCell;
@@ -0,0 +1,14 @@
1
+ import { testComponentSnapshotsWithFixtures } from '../../../../../move_to_pf/test-utils/testHelpers';
2
+
3
+ import TableSelectionHeaderCell from './TableSelectionHeaderCell';
4
+
5
+ const fixtures = {
6
+ 'renders TableSelectionHeaderCell': {
7
+ id: 'some id',
8
+ label: 'some label',
9
+ checked: true,
10
+ onChange: jest.fn(),
11
+ },
12
+ };
13
+
14
+ describe('TableSelectionHeaderCell', () => testComponentSnapshotsWithFixtures(TableSelectionHeaderCell, fixtures));
@@ -0,0 +1,19 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CollapseSubscriptionGroupButton renders CollapseSubscriptionGroupButton collapsed 1`] = `
4
+ <Icon
5
+ className="collapse-subscription-group-button"
6
+ name="angle-right"
7
+ onClick={[Function]}
8
+ type="fa"
9
+ />
10
+ `;
11
+
12
+ exports[`CollapseSubscriptionGroupButton renders CollapseSubscriptionGroupButton opened 1`] = `
13
+ <Icon
14
+ className="collapse-subscription-group-button"
15
+ name="angle-down"
16
+ onClick={[Function]}
17
+ type="fa"
18
+ />
19
+ `;
@@ -0,0 +1,167 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Table renders Table with body 1`] = `
4
+ <div>
5
+ <TablePfProvider
6
+ bordered={true}
7
+ className="table-fixed"
8
+ columns={
9
+ Array [
10
+ Object {
11
+ "header": Object {
12
+ "label": "ID",
13
+ },
14
+ "property": "id",
15
+ },
16
+ Object {
17
+ "header": Object {
18
+ "label": "Data",
19
+ },
20
+ "property": "data",
21
+ },
22
+ ]
23
+ }
24
+ components={Object {}}
25
+ condensed={false}
26
+ dataTable={false}
27
+ hover={true}
28
+ inlineEdit={false}
29
+ striped={true}
30
+ >
31
+ <Header
32
+ key="header"
33
+ />
34
+ <TableBody
35
+ columns={
36
+ Array [
37
+ Object {
38
+ "header": Object {
39
+ "label": "ID",
40
+ },
41
+ "property": "id",
42
+ },
43
+ Object {
44
+ "header": Object {
45
+ "label": "Data",
46
+ },
47
+ "property": "data",
48
+ },
49
+ ]
50
+ }
51
+ key="body"
52
+ message="some body message"
53
+ rowKey="id"
54
+ rows={
55
+ Array [
56
+ Object {
57
+ "data": "data-1",
58
+ "id": 1,
59
+ },
60
+ Object {
61
+ "data": "data-2",
62
+ "id": 2,
63
+ },
64
+ ]
65
+ }
66
+ />
67
+ </TablePfProvider>
68
+ </div>
69
+ `;
70
+
71
+ exports[`Table renders Table with children 1`] = `
72
+ <div>
73
+ <TablePfProvider
74
+ bordered={true}
75
+ className="table-fixed"
76
+ columns={
77
+ Array [
78
+ Object {
79
+ "header": Object {
80
+ "label": "ID",
81
+ },
82
+ "property": "id",
83
+ },
84
+ Object {
85
+ "header": Object {
86
+ "label": "Data",
87
+ },
88
+ "property": "data",
89
+ },
90
+ ]
91
+ }
92
+ components={Object {}}
93
+ condensed={false}
94
+ dataTable={false}
95
+ hover={true}
96
+ inlineEdit={false}
97
+ striped={true}
98
+ >
99
+ some children
100
+ </TablePfProvider>
101
+ </div>
102
+ `;
103
+
104
+ exports[`Table renders Table with emptyState 1`] = `
105
+ <EmptyState
106
+ empty="state"
107
+ />
108
+ `;
109
+
110
+ exports[`Table renders Table with pagination 1`] = `
111
+ <div>
112
+ <TablePfProvider
113
+ bordered={true}
114
+ className="table-fixed"
115
+ columns={
116
+ Array [
117
+ Object {
118
+ "header": Object {
119
+ "label": "ID",
120
+ },
121
+ "property": "id",
122
+ },
123
+ Object {
124
+ "header": Object {
125
+ "label": "Data",
126
+ },
127
+ "property": "data",
128
+ },
129
+ ]
130
+ }
131
+ components={Object {}}
132
+ condensed={false}
133
+ dataTable={false}
134
+ hover={true}
135
+ inlineEdit={false}
136
+ striped={true}
137
+ >
138
+ some children
139
+ </TablePfProvider>
140
+ <PaginationRow
141
+ className=""
142
+ dropdownButtonId="pagination-row-dropdown"
143
+ itemCount={2}
144
+ messages={
145
+ Object {
146
+ "currentPage": "Current Page",
147
+ "firstPage": "First Page",
148
+ "lastPage": "Last Page",
149
+ "nextPage": "Next Page",
150
+ "of": "of",
151
+ "perPage": "per page",
152
+ "previousPage": "Previous Page",
153
+ }
154
+ }
155
+ onChange={[Function]}
156
+ onPageSet={[Function]}
157
+ onPerPageSelect={[Function]}
158
+ pagination={
159
+ Object {
160
+ "page": 1,
161
+ "perPage": 20,
162
+ }
163
+ }
164
+ viewType="table"
165
+ />
166
+ </div>
167
+ `;