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
@@ -43,7 +43,7 @@ class RepositorySearch extends Component {
43
43
 
44
44
  getAutoCompleteParams(search) {
45
45
  const params = {
46
- organization_id: orgId,
46
+ organization_id: orgId(),
47
47
  search,
48
48
  };
49
49
 
@@ -17,7 +17,7 @@ const filterOptions = [
17
17
  { value: 'rpm', label: __('RPM') },
18
18
  { value: 'sourceRpm', label: __('Source RPM') },
19
19
  { value: 'debugRpm', label: __('Debug RPM') },
20
- { value: 'kickstarter', label: __('Kickstarter') },
20
+ { value: 'kickstart', label: __('Kickstart') },
21
21
  { value: 'ostree', label: __('OSTree') },
22
22
  { value: 'beta', label: __('Beta') },
23
23
  { value: 'other', label: __('Other') },
@@ -0,0 +1,17 @@
1
+ import { testComponentSnapshotsWithFixtures } from '../../../../move_to_pf/test-utils/testHelpers';
2
+
3
+ import RecommendedRepositorySetsToggler from '../RecommendedRepositorySetsToggler';
4
+
5
+ const fixtures = {
6
+ 'renders recommended-repository-sets-toggler': {
7
+ enabled: true,
8
+ className: 'some-class-name',
9
+ children: 'some-children',
10
+ help: 'some-help',
11
+ onChange: () => null,
12
+ },
13
+ };
14
+
15
+ describe('RecommendedRepositorySetsToggler', () => {
16
+ describe('rendering', () => testComponentSnapshotsWithFixtures(RecommendedRepositorySetsToggler, fixtures));
17
+ });
@@ -0,0 +1,37 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`RecommendedRepositorySetsToggler rendering renders recommended-repository-sets-toggler 1`] = `
4
+ <div
5
+ className="recommended-repositories-toggler-container some-class-name"
6
+ >
7
+ <Switch
8
+ animate={true}
9
+ baseClass="bootstrap-switch"
10
+ bsSize="mini"
11
+ defaultValue={true}
12
+ disabled={false}
13
+ handleWidth="auto"
14
+ inverse={false}
15
+ labelText=" "
16
+ labelWidth="auto"
17
+ offColor="default"
18
+ offText="OFF"
19
+ onChange={[Function]}
20
+ onColor="primary"
21
+ onText="ON"
22
+ readonly={false}
23
+ tristate={false}
24
+ value={true}
25
+ wrapperClass="wrapper"
26
+ />
27
+ <Icon
28
+ name="star"
29
+ type="fa"
30
+ />
31
+ some-children
32
+ <FieldLevelHelp
33
+ close="true"
34
+ content="some-help"
35
+ />
36
+ </div>
37
+ `;
@@ -22,7 +22,7 @@ export const getSetsComponent = (repoSetsState, onPaginationChange) => {
22
22
  sprintf(
23
23
  __('No Red Hat products currently exist, please import a manifest %(anchorBegin)s here %(anchorEnd)s to receive Red Hat content. No repository sets available.'),
24
24
  {
25
- anchorBegin: '<a href="/subscriptions/manifest/import">',
25
+ anchorBegin: '<a href="/subscriptions/">',
26
26
  anchorEnd: '</a>',
27
27
  },
28
28
  );
@@ -6,11 +6,12 @@ import React, { Component } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { connect } from 'react-redux';
8
8
  import { Grid, Row, Col } from 'react-bootstrap';
9
- import { Spinner } from 'patternfly-react';
9
+ import { LoadingState } from '../../move_to_pf/LoadingState';
10
10
 
11
11
  import { createEnabledRepoParams, loadEnabledRepos } from '../../redux/actions/RedHatRepositories/enabled';
12
- import { loadRepositorySets } from '../../redux/actions/RedHatRepositories/sets';
12
+ import { loadRepositorySets, updateRecommendedRepositorySets } from '../../redux/actions/RedHatRepositories/sets';
13
13
  import SearchBar from './components/SearchBar';
14
+ import RecommendedRepositorySetsToggler from './components/RecommendedRepositorySetsToggler';
14
15
  import { getSetsComponent, getEnabledComponent } from './helpers';
15
16
 
16
17
  class RedHatRepositoriesPage extends Component {
@@ -39,8 +40,15 @@ class RedHatRepositoriesPage extends Component {
39
40
 
40
41
  <Row className="row-eq-height">
41
42
  <Col sm={6} className="available-repositories-container">
42
- <h2>{__('Available Repositories')}</h2>
43
- <Spinner loading={repositorySets.loading}>
43
+ <div className="available-repositories-header">
44
+ <h2>{__('Available Repositories')}</h2>
45
+ <RecommendedRepositorySetsToggler
46
+ enabled={repositorySets.recommended}
47
+ onChange={value => this.props.updateRecommendedRepositorySets(value)}
48
+ className="recommended-repositories-toggler"
49
+ />
50
+ </div>
51
+ <LoadingState loading={repositorySets.loading} loadingText={__('Loading')}>
44
52
  {getSetsComponent(
45
53
  repositorySets,
46
54
  (pagination) => {
@@ -50,12 +58,12 @@ class RedHatRepositoriesPage extends Component {
50
58
  });
51
59
  },
52
60
  )}
53
- </Spinner>
61
+ </LoadingState>
54
62
  </Col>
55
63
 
56
64
  <Col sm={6} className="enabled-repositories-container">
57
65
  <h2>{__('Enabled Repositories')}</h2>
58
- <Spinner loading={enabledRepositories.loading} className="small-spacer">
66
+ <LoadingState loading={enabledRepositories.loading} loadingText={__('Loading')}>
59
67
  {getEnabledComponent(
60
68
  enabledRepositories,
61
69
  (pagination) => {
@@ -65,7 +73,7 @@ class RedHatRepositoriesPage extends Component {
65
73
  });
66
74
  },
67
75
  )}
68
- </Spinner>
76
+ </LoadingState>
69
77
  </Col>
70
78
  </Row>
71
79
  </Grid>
@@ -76,6 +84,7 @@ class RedHatRepositoriesPage extends Component {
76
84
  RedHatRepositoriesPage.propTypes = {
77
85
  loadEnabledRepos: PropTypes.func.isRequired,
78
86
  loadRepositorySets: PropTypes.func.isRequired,
87
+ updateRecommendedRepositorySets: PropTypes.func.isRequired,
79
88
  enabledRepositories: PropTypes.shape({}).isRequired,
80
89
  repositorySets: PropTypes.shape({}).isRequired,
81
90
  };
@@ -88,4 +97,5 @@ const mapStateToProps = ({ katello: { redHatRepositories: { enabled, sets } } })
88
97
  export default connect(mapStateToProps, {
89
98
  loadEnabledRepos,
90
99
  loadRepositorySets,
100
+ updateRecommendedRepositorySets,
91
101
  })(RedHatRepositoriesPage);
@@ -15,10 +15,6 @@
15
15
  color: $color-pf-red-200;
16
16
  }
17
17
 
18
- .small-spacer {
19
- margin: 10px 0;
20
- }
21
-
22
18
  #redhatRepositoriesPage {
23
19
  .list-group-item-header .list-view-pf-description,
24
20
  .enabled-repositories-container .list-view-pf-description {
@@ -33,9 +29,25 @@
33
29
  background-color: inherit;
34
30
  }
35
31
 
32
+ .recommended-repository-set-icon {
33
+ color: $color-pf-gold-300;
34
+ font-size: 2em;
35
+ }
36
+
36
37
  .available-repositories-container {
37
38
  background-color: $color-pf-white;
38
39
  border-right: $color-pf-black-300 2px solid;
40
+
41
+ .available-repositories-header {
42
+ display: flex;
43
+ flex-wrap: wrap;
44
+ justify-content: space-between;
45
+ padding-top: 20px;
46
+
47
+ h2 {
48
+ margin: 0;
49
+ }
50
+ }
39
51
  }
40
52
 
41
53
  .content-view-pf-pagination {
@@ -0,0 +1,17 @@
1
+ export default {
2
+ name: __('Name'),
3
+ description: __('Description'),
4
+ virt_who: __('Requires Virt-Who'),
5
+ consumed: __('Consumed'),
6
+ start_date: __('Starts'),
7
+ end_date: __('Ends'),
8
+ product_id: __('Product ID'),
9
+ contract_number: __('Contract Number'),
10
+ account_number: __('Account Number'),
11
+ support_level: __('Support Level'),
12
+ support_type: __('Support Type'),
13
+ arch: __('Architecture(s)'),
14
+ type: __('Type'),
15
+ mutli_entitlement: __('Multi-entitlement'),
16
+ stacking_id: __('Stacking ID'),
17
+ };
@@ -0,0 +1,28 @@
1
+ import api, { orgId } from '../../../services/api';
2
+ import {
3
+ SUBSCRIPTION_DETAILS_REQUEST,
4
+ SUBSCRIPTION_DETAILS_SUCCESS,
5
+ SUBSCRIPTION_DETAILS_FAILURE,
6
+ } from './SubscriptionDetailConstants';
7
+ import { getResponseError } from '../../../move_to_foreman/common/helpers.js';
8
+
9
+ export const loadSubscriptionDetails = subscriptionId => (dispatch) => {
10
+ dispatch({ type: SUBSCRIPTION_DETAILS_REQUEST });
11
+
12
+ return api
13
+ .get(`/organizations/${orgId()}/subscriptions/${subscriptionId}`)
14
+ .then(({ data }) => {
15
+ dispatch({
16
+ type: SUBSCRIPTION_DETAILS_SUCCESS,
17
+ response: data,
18
+ });
19
+ })
20
+ .catch((result) => {
21
+ dispatch({
22
+ type: SUBSCRIPTION_DETAILS_FAILURE,
23
+ error: getResponseError(result.response),
24
+ });
25
+ });
26
+ };
27
+
28
+ export default loadSubscriptionDetails;
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Table } from 'react-bootstrap';
4
+ import helpers from '../../../move_to_foreman/common/helpers.js';
5
+
6
+ const SubscriptionDetailAssociations = ({ subscriptionDetails }) => {
7
+ const searchQuery = 'subscription_id="%s"'.replace('%s', subscriptionDetails.id);
8
+
9
+ return (
10
+ <div>
11
+ <h2>{__('Associations')}</h2>
12
+ <Table striped bordered condensed hover>
13
+ <thead>
14
+ <tr>
15
+ <td><b>{__('Resource')}</b></td>
16
+ <td><b>{__('Quantity')}</b></td>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <tr>
21
+ <td>{__('Content Hosts')}</td>
22
+ <td>
23
+ <a href={helpers.urlWithSearch('content_hosts', searchQuery)}>
24
+ {subscriptionDetails.host_count}
25
+ </a>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <td>{__('Activation Keys')}</td>
30
+ <td>
31
+ <a href={helpers.urlWithSearch('activation_keys', searchQuery)}>
32
+ {subscriptionDetails.activation_keys &&
33
+ subscriptionDetails.activation_keys.length}
34
+ </a>
35
+ </td>
36
+ </tr>
37
+ </tbody>
38
+ </Table>
39
+ </div>
40
+ );
41
+ };
42
+
43
+ SubscriptionDetailAssociations.propTypes = {
44
+ subscriptionDetails: PropTypes.shape({}).isRequired,
45
+ };
46
+
47
+ export default SubscriptionDetailAssociations;
@@ -0,0 +1,3 @@
1
+ export const SUBSCRIPTION_DETAILS_REQUEST = 'SUBSCRIPTION_DETAILS_REQUEST';
2
+ export const SUBSCRIPTION_DETAILS_SUCCESS = 'SUBSCRIPTION_DETAILS_SUCCESS';
3
+ export const SUBSCRIPTION_DETAILS_FAILURE = 'SUBSCRIPTION_DETAILS_FAILURE';
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Table } from 'react-bootstrap';
4
+ import subscriptionAttributes from './SubscriptionAttributes';
5
+
6
+ const SubscriptionDetailInfo = ({ subscriptionDetails }) => {
7
+ const subscriptionLimits = (subDetails) => {
8
+ const limits = [];
9
+ if (subDetails.sockets) {
10
+ limits.push(__('Sockets: %s').replace('%s', subDetails.sockets));
11
+ }
12
+ if (subDetails.cores) {
13
+ limits.push(__('Cores: %s').replace('%s', subDetails.cores));
14
+ }
15
+ if (subDetails.ram) {
16
+ limits.push(__('RAM: %s GB').replace('%s', subDetails.ram));
17
+ }
18
+ if (limits.length > 0) {
19
+ return limits.join(', ');
20
+ }
21
+ return '';
22
+ };
23
+
24
+ const subscriptionDetailValue = (subDetails, key) => (subDetails[key] == null ? '' : String(subDetails[key]));
25
+
26
+ const formatInstanceBased = (subDetails) => {
27
+ if (subDetails.instance_multiplier == null ||
28
+ subDetails.instance_multiplier === '' ||
29
+ subDetails.instance_multiplier === 0) {
30
+ return __('No');
31
+ }
32
+ return __('Yes');
33
+ };
34
+
35
+ return (
36
+ <div>
37
+ <h2>{__('Subscription Info')}</h2>
38
+ <Table>
39
+ <tbody>
40
+ {Object.keys(subscriptionAttributes).map(key => (
41
+ <tr key={key}>
42
+ <td><b>{__(subscriptionAttributes[key])}</b></td>
43
+ <td>{subscriptionDetailValue(subscriptionDetails, key)}</td>
44
+ </tr>
45
+ ))}
46
+ <tr>
47
+ <td><b>{__('Limits')}</b></td>
48
+ <td>{subscriptionLimits(subscriptionDetails)}</td>
49
+ </tr>
50
+ <tr>
51
+ <td><b>{__('Instance-based')}</b></td>
52
+ <td>{formatInstanceBased(subscriptionDetails)}</td>
53
+ </tr>
54
+ </tbody>
55
+ </Table>
56
+
57
+ </div>
58
+ );
59
+ };
60
+
61
+ SubscriptionDetailInfo.propTypes = {
62
+ subscriptionDetails: PropTypes.shape({}).isRequired,
63
+ };
64
+
65
+ export default SubscriptionDetailInfo;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const SubscriptionDetailProducts = ({ subscriptionDetails }) => (
5
+ <div>
6
+ <h2>{__('Provided Products')}</h2>
7
+ <ul>
8
+ {subscriptionDetails.provided_products &&
9
+ subscriptionDetails.provided_products.map(prod => (
10
+ <li key={prod.id}>{prod.name}</li>
11
+ ))}
12
+ </ul>
13
+ </div>
14
+ );
15
+
16
+ SubscriptionDetailProducts.propTypes = {
17
+ subscriptionDetails: PropTypes.shape({}).isRequired,
18
+ };
19
+
20
+ export default SubscriptionDetailProducts;
@@ -0,0 +1,37 @@
1
+ import Immutable from 'seamless-immutable';
2
+ import {
3
+ SUBSCRIPTION_DETAILS_REQUEST,
4
+ SUBSCRIPTION_DETAILS_SUCCESS,
5
+ SUBSCRIPTION_DETAILS_FAILURE,
6
+ } from './SubscriptionDetailConstants';
7
+
8
+ const initialState = Immutable({
9
+ loading: false,
10
+ });
11
+
12
+ export default (state = initialState, action) => {
13
+ switch (action.type) {
14
+ case SUBSCRIPTION_DETAILS_REQUEST: {
15
+ return state.set('loading', true);
16
+ }
17
+
18
+ case SUBSCRIPTION_DETAILS_SUCCESS: {
19
+ const subscriptionDetails = action.response;
20
+
21
+ return state.merge({
22
+ ...subscriptionDetails,
23
+ loading: false,
24
+ });
25
+ }
26
+
27
+ case SUBSCRIPTION_DETAILS_FAILURE: {
28
+ return state.merge({
29
+ error: action.error,
30
+ loading: false,
31
+ });
32
+ }
33
+
34
+ default:
35
+ return state;
36
+ }
37
+ };
@@ -0,0 +1,58 @@
1
+ import React, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Grid, Row, Col } from 'patternfly-react';
4
+ import SubscriptionDetailInfo from './SubscriptionDetailInfo';
5
+ import SubscriptionDetailAssociations from './SubscriptionDetailAssociations';
6
+ import SubscriptionDetailProducts from './SubscriptionDetailProducts';
7
+ import { LoadingState } from '../../../move_to_pf/LoadingState';
8
+ import { notify } from '../../../move_to_foreman/foreman_toast_notifications';
9
+
10
+ class SubscriptionDetails extends Component {
11
+ componentDidMount() {
12
+ // eslint-disable-next-line react/prop-types
13
+ const routerParams = this.props.match.params;
14
+ this.props.loadSubscriptionDetails(parseInt(routerParams.id, 10));
15
+ }
16
+
17
+ render() {
18
+ const { subscriptionDetails } = this.props;
19
+
20
+ if (subscriptionDetails.error) { notify({ message: subscriptionDetails.error }); }
21
+
22
+ return (
23
+ <Grid bsClass="container-fluid">
24
+ <div>
25
+ <LoadingState loading={subscriptionDetails.loading} loadingText={__('Loading')}>
26
+ <Row>
27
+ <Col sm={12}>
28
+ <h1>{subscriptionDetails.name}</h1>
29
+ </Col>
30
+ </Row>
31
+ <Row>
32
+ <Col sm={6}>
33
+ <SubscriptionDetailInfo
34
+ subscriptionDetails={subscriptionDetails}
35
+ />
36
+ </Col>
37
+ <Col sm={6}>
38
+ <SubscriptionDetailAssociations
39
+ subscriptionDetails={subscriptionDetails}
40
+ />
41
+ <SubscriptionDetailProducts
42
+ subscriptionDetails={subscriptionDetails}
43
+ />
44
+ </Col>
45
+ </Row>
46
+ </LoadingState>
47
+ </div>
48
+ </Grid>
49
+ );
50
+ }
51
+ }
52
+
53
+ SubscriptionDetails.propTypes = {
54
+ loadSubscriptionDetails: PropTypes.func.isRequired,
55
+ subscriptionDetails: PropTypes.shape({}).isRequired,
56
+ };
57
+
58
+ export default SubscriptionDetails;