katello 3.7.1.1 → 3.8.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 (187) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -7
  3. data/app/assets/javascripts/katello/common/index.js +0 -1
  4. data/app/assets/javascripts/katello/sync_management/index.js +0 -1
  5. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +477 -0
  6. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
  7. data/app/controllers/katello/api/v2/activation_keys_controller.rb +2 -2
  8. data/app/controllers/katello/api/v2/api_controller.rb +3 -1
  9. data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -1
  10. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
  11. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +15 -1
  12. data/app/controllers/katello/api/v2/environments_controller.rb +5 -2
  13. data/app/controllers/katello/api/v2/errata_controller.rb +48 -34
  14. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +1 -1
  15. data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -1
  16. data/app/controllers/katello/api/v2/host_packages_controller.rb +5 -1
  17. data/app/controllers/katello/api/v2/organizations_controller.rb +1 -1
  18. data/app/controllers/katello/api/v2/packages_controller.rb +33 -22
  19. data/app/controllers/katello/api/v2/products_controller.rb +1 -1
  20. data/app/controllers/katello/api/v2/repositories_controller.rb +6 -5
  21. data/app/controllers/katello/api/v2/repository_sets_controller.rb +1 -10
  22. data/app/controllers/katello/api/v2/sync_plans_controller.rb +1 -1
  23. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +20 -12
  24. data/app/controllers/katello/remote_execution_controller.rb +6 -6
  25. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +9 -37
  26. data/app/lib/actions/katello/content_view/promote.rb +6 -2
  27. data/app/lib/actions/katello/content_view_version/after_promote_hook.rb +11 -0
  28. data/app/lib/actions/katello/content_view_version/before_promote_hook.rb +11 -0
  29. data/app/lib/actions/katello/host/remove_subscriptions.rb +1 -1
  30. data/app/lib/actions/pulp/consumer/abstract_content_action.rb +0 -12
  31. data/app/lib/actions/pulp/consumer/content_install.rb +1 -1
  32. data/app/lib/actions/pulp/consumer/content_uninstall.rb +1 -1
  33. data/app/lib/actions/pulp/consumer/content_update.rb +1 -1
  34. data/app/lib/katello/resources/registry.rb +40 -0
  35. data/app/lib/katello/util/package.rb +9 -4
  36. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -1
  37. data/app/models/katello/content_view.rb +4 -12
  38. data/app/models/katello/content_view_version.rb +26 -0
  39. data/app/models/katello/glue/candlepin/owner.rb +8 -0
  40. data/app/models/katello/glue/candlepin/pool.rb +11 -11
  41. data/app/models/katello/glue/candlepin/repository.rb +1 -1
  42. data/app/models/katello/glue/pulp/repos.rb +1 -0
  43. data/app/models/katello/host/content_facet.rb +1 -2
  44. data/app/models/katello/kt_environment.rb +6 -0
  45. data/app/models/katello/product_content.rb +1 -4
  46. data/app/models/katello/repository.rb +2 -0
  47. data/app/models/katello/rpm.rb +118 -14
  48. data/app/services/katello/puppet_class_importer_extensions.rb +17 -20
  49. data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -3
  50. data/app/views/katello/api/v2/common/copy.json.rabl +3 -0
  51. data/app/views/katello/api/v2/environments/show.json.rabl +1 -1
  52. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -0
  53. data/app/views/katello/api/v2/repositories/show.json.rabl +4 -2
  54. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +3 -2
  55. data/config/katello.yaml +89 -0
  56. data/config/routes.rb +0 -1
  57. data/config/routes/api/registry.rb +29 -0
  58. data/config/routes/api/v2.rb +1 -1
  59. data/db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb +0 -3
  60. data/db/migrate/20180614184822_add_unauthenticated_pull.rb +9 -0
  61. data/db/migrate/20180618195941_add_description_to_repository.rb +5 -0
  62. data/db/seeds.d/75-job_templates.rb +2 -5
  63. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +3 -4
  64. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +1 -4
  65. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-subscriptions-modal.html +1 -1
  66. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-register.controller.js +1 -1
  67. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages-installed.controller.js +1 -1
  68. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-add-subscriptions.controller.js +1 -1
  69. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +1 -0
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version.controller.js +32 -18
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-details.html +1 -1
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-docker.html +2 -0
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-details.html +32 -23
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +6 -0
  75. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +8 -0
  76. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/discovery.controller.js +1 -1
  77. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery-create.html +1 -1
  78. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +0 -5
  79. data/lib/katello/engine.rb +1 -0
  80. data/lib/katello/permission_creator.rb +2 -0
  81. data/lib/katello/permissions/registry_permissions.rb +20 -0
  82. data/lib/katello/plugin.rb +1 -0
  83. data/lib/katello/tasks/clean_backend_objects.rake +3 -12
  84. data/lib/katello/version.rb +1 -1
  85. data/package.json +7 -10
  86. data/webpack/components/Search/Search.test.js +1 -3
  87. data/webpack/containers/Application/config.js +2 -9
  88. data/webpack/containers/Application/index.js +2 -4
  89. data/webpack/mockRequest.js +3 -3
  90. data/webpack/move_to_foreman/common/helpers.js +8 -45
  91. data/webpack/move_to_foreman/components/common/{EmptyState → emptyState}/index.js +3 -16
  92. data/webpack/move_to_foreman/components/common/table/components/Table.js +1 -1
  93. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +2 -2
  94. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionCell.test.js.snap +1 -1
  95. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +1 -1
  96. data/webpack/move_to_pf/LoadingState/LoadingState.js +14 -27
  97. data/webpack/move_to_pf/LoadingState/LoadingState.test.js +4 -8
  98. data/webpack/move_to_pf/react-bootstrap-select/index.js +1 -12
  99. data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -0
  100. data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
  101. data/webpack/redux/actions/RedHatRepositories/sets.js +1 -1
  102. data/webpack/redux/consts.js +0 -6
  103. data/webpack/redux/reducers/index.js +0 -2
  104. data/webpack/scenes/RedHatRepositories/components/EnabledRepository.js +23 -14
  105. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository.js +1 -1
  106. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +0 -1
  107. data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RecommendedRepositorySetsToggler.test.js.snap +1 -3
  108. data/webpack/scenes/RedHatRepositories/index.js +3 -7
  109. data/webpack/scenes/RedHatRepositories/index.scss +0 -1
  110. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +8 -3
  111. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js +1 -30
  112. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +28 -111
  113. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailReducer.test.js +1 -3
  114. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +1 -6
  115. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +424 -519
  116. data/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js +4 -7
  117. data/webpack/scenes/Subscriptions/Details/index.js +3 -5
  118. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +34 -78
  119. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +24 -5
  120. data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryReducer.js +1 -9
  121. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +0 -3
  122. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +8 -20
  123. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestHistoryReducer.test.js +1 -3
  124. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +7 -34
  125. data/webpack/scenes/Subscriptions/Manifest/__tests__/manifest.fixtures.js +16 -9
  126. data/webpack/scenes/Subscriptions/Manifest/index.js +0 -1
  127. data/webpack/scenes/Subscriptions/SubscriptionActions.js +26 -5
  128. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +0 -1
  129. data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +0 -3
  130. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +4 -11
  131. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +36 -31
  132. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +12 -3
  133. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +27 -57
  134. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js +3 -2
  135. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +5 -10
  136. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsActions.test.js +5 -10
  137. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +4 -49
  138. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsReducer.test.js +3 -8
  139. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +11 -21
  140. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/upstreamSubscriptions.fixtures.js +8 -5
  141. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -2
  142. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +3 -9
  143. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -14
  144. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +17 -11
  145. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js +5 -8
  146. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +58 -45
  147. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +4 -11
  148. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +2 -2
  149. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +3 -16
  150. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +365 -392
  151. data/webpack/scenes/Subscriptions/index.js +0 -1
  152. data/webpack/services/api/fixtures.js +353 -0
  153. data/webpack/services/api/index.js +1 -17
  154. data/webpack/test_setup.js +0 -2
  155. metadata +16 -37
  156. data/config/katello.yml +0 -59
  157. data/webpack/__mocks__/foremanReact/components/BreadcrumbBar.js +0 -3
  158. data/webpack/__mocks__/foremanReact/redux.js +0 -3
  159. data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +0 -8
  160. data/webpack/components/SelectOrg/SelectOrg.scss +0 -3
  161. data/webpack/components/SelectOrg/SelectOrgAction.js +0 -41
  162. data/webpack/components/SelectOrg/SelectOrgReducer.js +0 -33
  163. data/webpack/components/SelectOrg/SetOrganization.js +0 -116
  164. data/webpack/components/WithOrganization/withOrganization.js +0 -28
  165. data/webpack/global_test_setup.js +0 -6
  166. data/webpack/helpers/caret.js +0 -6
  167. data/webpack/move_to_pf/Select/Select.js +0 -40
  168. data/webpack/scenes/Products/ProductActions.js +0 -24
  169. data/webpack/scenes/Products/ProductConstants.js +0 -3
  170. data/webpack/scenes/Products/__tests__/ProductActions.test.js +0 -40
  171. data/webpack/scenes/Products/__tests__/products.fixtures.js +0 -90
  172. data/webpack/scenes/RedHatRepositories/components/EnabledRepositoryContent.js +0 -34
  173. data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepository.test.js +0 -36
  174. data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepositoryContent.test.js +0 -27
  175. data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepository.test.js.snap +0 -25
  176. data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepositoryContent.test.js.snap +0 -47
  177. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailEnabledProducts.js +0 -54
  178. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js +0 -29
  179. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.scss +0 -9
  180. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailEnabledProducts.test.js +0 -18
  181. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailProduct.test.js +0 -13
  182. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailEnabledProducts.test.js.snap +0 -45
  183. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProduct.test.js.snap +0 -67
  184. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/EntitlementsInlineEditFormatter.test.js +0 -110
  185. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/EntitlementsInlineEditFormatter.test.js.snap +0 -228
  186. data/webpack/scenes/Tasks/helpers.js +0 -52
  187. data/webpack/services/api/testHelpers.js +0 -28
@@ -1,12 +1,7 @@
1
1
  import Immutable from 'seamless-immutable';
2
- import { toastErrorAction, failureAction } from '../../../../services/api/testHelpers';
3
2
 
4
3
  export const initialState = Immutable({
5
4
  loading: false,
6
- enabledProducts: {
7
- results: [],
8
- total: 0,
9
- },
10
5
  });
11
6
 
12
7
 
@@ -153,8 +148,10 @@ export const loadSubscriptionsDetailsFailureActions = [
153
148
  {
154
149
  type: 'SUBSCRIPTION_DETAILS_REQUEST',
155
150
  },
156
- failureAction('SUBSCRIPTION_DETAILS_FAILURE', 'Request failed with status code 500'),
157
- toastErrorAction('Request failed with status code 500'),
151
+ {
152
+ error: 'Request failed with status code 500',
153
+ type: 'SUBSCRIPTION_DETAILS_FAILURE',
154
+ },
158
155
  ];
159
156
 
160
157
  export const loadSubscriptionsDetailsSuccessActions = [
@@ -1,8 +1,7 @@
1
1
  import { bindActionCreators } from 'redux';
2
2
  import { connect } from 'react-redux';
3
- import { withRouter } from 'react-router';
3
+
4
4
  import reducer from './SubscriptionDetailReducer';
5
- import { loadProducts } from '../../Products/ProductActions';
6
5
  import * as subscriptionDetailActions from './SubscriptionDetailActions';
7
6
  import SubscriptionDetails from './SubscriptionDetails';
8
7
 
@@ -12,10 +11,9 @@ const mapStateToProps = state => ({
12
11
  });
13
12
 
14
13
  // map action dispatchers to props
15
- const actions = { ...subscriptionDetailActions, loadProducts };
16
- const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
14
+ const mapDispatchToProps = dispatch => bindActionCreators(subscriptionDetailActions, dispatch);
17
15
 
18
16
  export const subscriptionDetails = reducer;
19
17
 
20
18
  // export connected component
21
- export default connect(mapStateToProps, mapDispatchToProps)(withRouter(SubscriptionDetails));
19
+ export default connect(mapStateToProps, mapDispatchToProps)(SubscriptionDetails);
@@ -1,15 +1,13 @@
1
1
  import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Col, Tabs, Tab, Form, FormGroup, FormControl, ControlLabel, Row } from 'react-bootstrap';
3
+ import { Col, Tabs, Tab, Form, FormGroup, FormControl, ControlLabel } from 'react-bootstrap';
4
4
  import { bindMethods, Button, Icon, Modal, Spinner, OverlayTrigger, Tooltip } from 'patternfly-react';
5
5
  import { isEqual } from 'lodash';
6
6
  import TooltipButton from 'react-bootstrap-tooltip-button';
7
7
  import { LoadingState } from '../../../move_to_pf/LoadingState';
8
8
  import { Table } from '../../../move_to_foreman/components/common/table';
9
- import ConfirmDialog from '../../../move_to_foreman/components/common/ConfirmDialog';
10
- import { manifestExists } from '../SubscriptionHelpers';
11
9
  import { columns } from './ManifestHistoryTableSchema';
12
- import { renderTaskStartedToast } from '../../Tasks/helpers';
10
+ import ConfirmDialog from '../../../move_to_foreman/components/common/ConfirmDialog';
13
11
  import DeleteManifestModalText from './DeleteManifestModalText';
14
12
  import {
15
13
  BLOCKING_FOREMAN_TASK_TYPES,
@@ -32,11 +30,15 @@ class ManageManifestModal extends Component {
32
30
  'uploadManifest',
33
31
  'refreshManifest',
34
32
  'deleteManifest',
33
+ 'manifestExists',
35
34
  'disabledTooltipText',
36
- 'updateRepositoryUrl',
37
35
  ]);
38
36
  }
39
37
 
38
+ componentDidMount() {
39
+ this.loadData();
40
+ }
41
+
40
42
  static getDerivedStateFromProps(newProps, prevState) {
41
43
  if (
42
44
  !isEqual(newProps.showModal, prevState.showModal) ||
@@ -50,10 +52,6 @@ class ManageManifestModal extends Component {
50
52
  return null;
51
53
  }
52
54
 
53
- componentDidMount() {
54
- this.loadData();
55
- }
56
-
57
55
  componentDidUpdate(prevProp, prevState) {
58
56
  const { actionInProgress } = this.state;
59
57
 
@@ -71,27 +69,14 @@ class ManageManifestModal extends Component {
71
69
  this.props.onClose();
72
70
  }
73
71
 
74
- updateRepositoryUrl(event) {
75
- this.setState({ redhat_repository_url: event.target.value });
76
- }
77
-
78
- saveOrganization() {
79
- this.props.saveOrganization({ redhat_repository_url: this.state.redhat_repository_url });
72
+ saveOrganization(event) {
73
+ this.props.saveOrganization({ redhat_repository_url: event.target.value });
80
74
  }
81
75
 
82
76
  uploadManifest(fileList) {
83
77
  this.setState({ actionInProgress: true });
84
78
  if (fileList.length > 0) {
85
- this.props
86
- .uploadManifest(fileList[0])
87
- .then(() =>
88
- this.props.bulkSearch({
89
- search_id: MANIFEST_TASKS_BULK_SEARCH_ID,
90
- type: 'all',
91
- active_only: true,
92
- action_types: BLOCKING_FOREMAN_TASK_TYPES,
93
- }))
94
- .then(() => renderTaskStartedToast(this.props.taskDetails));
79
+ this.props.uploadManifest(fileList[0]);
95
80
  }
96
81
  }
97
82
 
@@ -102,16 +87,14 @@ class ManageManifestModal extends Component {
102
87
 
103
88
  deleteManifest() {
104
89
  this.setState({ actionInProgress: true });
105
- this.props
106
- .deleteManifest()
90
+ this.props.deleteManifest()
107
91
  .then(() =>
108
92
  this.props.bulkSearch({
109
93
  search_id: MANIFEST_TASKS_BULK_SEARCH_ID,
110
94
  type: 'all',
111
95
  active_only: true,
112
96
  action_types: BLOCKING_FOREMAN_TASK_TYPES,
113
- }))
114
- .then(() => renderTaskStartedToast(this.props.taskDetails));
97
+ }));
115
98
  this.showDeleteManifestModal(false);
116
99
  }
117
100
 
@@ -128,12 +111,15 @@ class ManageManifestModal extends Component {
128
111
  return __('This is disabled because no manifest exists');
129
112
  }
130
113
 
114
+ manifestExists() {
115
+ const { organization } = this.props;
116
+
117
+ return organization.owner_details && organization.owner_details.upstreamConsumer;
118
+ }
119
+
131
120
  render() {
132
121
  const {
133
- manifestHistory,
134
- organization,
135
- disableManifestActions,
136
- disabledReason,
122
+ manifestHistory, organization, disableManifestActions, disabledReason,
137
123
  } = this.props;
138
124
 
139
125
  const { actionInProgress } = this.state;
@@ -146,23 +132,13 @@ class ManageManifestModal extends Component {
146
132
  url: 'http://redhat.com',
147
133
  },
148
134
  });
149
- const buttonLoading = (
150
- <span>
151
- {__('Updating...')}
152
- <span className="fa fa-spinner fa-spin" />
153
- </span>);
135
+
154
136
  const getManifestName = () => {
155
137
  let name = __('No Manifest Uploaded');
156
138
 
157
- if (
158
- organization.owner_details &&
159
- organization.owner_details.upstreamConsumer
160
- ) {
161
- const link = [
162
- 'https://',
163
- organization.owner_details.upstreamConsumer.webUrl,
164
- organization.owner_details.upstreamConsumer.uuid,
165
- ].join('/');
139
+ if (organization.owner_details && organization.owner_details.upstreamConsumer) {
140
+ const link = ['https://', organization.owner_details.upstreamConsumer.webUrl,
141
+ organization.owner_details.upstreamConsumer.uuid].join('/');
166
142
 
167
143
  name = (
168
144
  <a href={link}>{organization.owner_details.upstreamConsumer.name}</a>
@@ -175,11 +151,7 @@ class ManageManifestModal extends Component {
175
151
  return (
176
152
  <Modal show={this.state.showModal} onHide={this.hideModal}>
177
153
  <Modal.Header>
178
- <button
179
- className="close"
180
- onClick={this.hideModal}
181
- aria-label={__('Close')}
182
- >
154
+ <button className="close" onClick={this.hideModal} aria-label={__('Close')}>
183
155
  <Icon type="pf" name="close" />
184
156
  </button>
185
157
  <Modal.Title>{__('Manage Manifest')}</Modal.Title>
@@ -191,43 +163,29 @@ class ManageManifestModal extends Component {
191
163
  <h5>{__('Red Hat Provider Details')}</h5>
192
164
  <hr />
193
165
  <FormGroup>
194
- <Col sm={3}>
195
- <ControlLabel htmlFor="cdnUrl">
196
- {__('Red Hat CDN URL')}
197
- </ControlLabel>
198
- </Col>
166
+ <ControlLabel className="col-sm-3" htmlFor="cdnUrl">
167
+ {__('Red Hat CDN URL')}
168
+ </ControlLabel>
199
169
  <Col sm={9}>
200
170
  <FormControl
201
171
  id="cdnUrl"
202
172
  type="text"
203
- value={this.state.redhat_repository_url || organization.redhat_repository_url || ''}
204
- onChange={this.updateRepositoryUrl}
173
+ value={organization.redhat_repository_url || ''}
174
+ onChange={this.saveOrganization}
205
175
  />
206
176
  </Col>
207
177
  </FormGroup>
208
- <FormGroup>
209
- <Col smOffset={3} sm={3}>
210
- <Button onClick={this.saveOrganization} disabled={organization.loading}>
211
- {organization.loading ? buttonLoading : __('Update')}
212
- </Button>
213
- </Col>
214
- </FormGroup>
215
178
  <br />
216
179
 
217
180
  <h5>{__('Subscription Manifest')}</h5>
218
181
  <hr />
219
182
 
220
183
  <FormGroup>
221
- <ControlLabel
222
- className="col-sm-3 control-label"
223
- htmlFor="usmaFile"
224
- >
184
+ <ControlLabel className="col-sm-3 control-label" htmlFor="usmaFile">
225
185
  <OverlayTrigger
226
186
  overlay={
227
- <Tooltip id="usma-tooltip">
228
- {__('Upstream Subscription Management Application')}
229
- </Tooltip>
230
- }
187
+ <Tooltip id="usma-tooltip">{__('Upstream Subscription Management Application')}</Tooltip>
188
+ }
231
189
  placement="bottom"
232
190
  trigger={['hover', 'focus']}
233
191
  rootClose={false}
@@ -255,7 +213,7 @@ class ManageManifestModal extends Component {
255
213
  tooltipText={disabledReason}
256
214
  tooltipPlacement="top"
257
215
  title={__('Refresh')}
258
- disabled={!manifestExists(organization) ||
216
+ disabled={!this.manifestExists() ||
259
217
  actionInProgress || disableManifestActions}
260
218
  />
261
219
 
@@ -265,7 +223,7 @@ class ManageManifestModal extends Component {
265
223
  tooltipText={this.disabledTooltipText()}
266
224
  tooltipPlacement="top"
267
225
  title={__('Delete')}
268
- disabled={!manifestExists(organization) || actionInProgress}
226
+ disabled={!this.manifestExists() || actionInProgress}
269
227
  />
270
228
 
271
229
  <ConfirmDialog
@@ -320,11 +278,9 @@ ManageManifestModal.propTypes = {
320
278
  showModal: PropTypes.bool.isRequired,
321
279
  onClose: PropTypes.func,
322
280
  bulkSearch: PropTypes.func.isRequired,
323
- taskDetails: PropTypes.shape({}),
324
281
  };
325
282
 
326
283
  ManageManifestModal.defaultProps = {
327
- taskDetails: undefined,
328
284
  disableManifestActions: false,
329
285
  disabledReason: '',
330
286
  onClose() {},
@@ -1,6 +1,5 @@
1
1
  import api, { orgId } from '../../../services/api';
2
2
  import { propsToSnakeCase } from '../../../services/index';
3
- import { apiError } from '../../../move_to_foreman/common/helpers.js';
4
3
 
5
4
  import {
6
5
  UPLOAD_MANIFEST_REQUEST,
@@ -35,7 +34,12 @@ export const uploadManifest = file => (dispatch) => {
35
34
  response: data,
36
35
  });
37
36
  })
38
- .catch(result => dispatch(apiError(UPLOAD_MANIFEST_FAILURE, result)));
37
+ .catch((result) => {
38
+ dispatch({
39
+ type: UPLOAD_MANIFEST_FAILURE,
40
+ result,
41
+ });
42
+ });
39
43
  };
40
44
 
41
45
  export const refreshManifest = (extendedParams = {}) => (dispatch) => {
@@ -53,7 +57,12 @@ export const refreshManifest = (extendedParams = {}) => (dispatch) => {
53
57
  response: data,
54
58
  });
55
59
  })
56
- .catch(result => dispatch(apiError(REFRESH_MANIFEST_FAILURE, result)));
60
+ .catch((result) => {
61
+ dispatch({
62
+ type: REFRESH_MANIFEST_FAILURE,
63
+ result,
64
+ });
65
+ });
57
66
  };
58
67
 
59
68
  export const deleteManifest = (extendedParams = {}) => (dispatch) => {
@@ -71,7 +80,12 @@ export const deleteManifest = (extendedParams = {}) => (dispatch) => {
71
80
  response: data,
72
81
  });
73
82
  })
74
- .catch(result => dispatch(apiError(DELETE_MANIFEST_FAILURE, result)));
83
+ .catch((result) => {
84
+ dispatch({
85
+ type: DELETE_MANIFEST_FAILURE,
86
+ result,
87
+ });
88
+ });
75
89
  };
76
90
 
77
91
  export const loadManifestHistory = (extendedParams = {}) => (dispatch) => {
@@ -89,7 +103,12 @@ export const loadManifestHistory = (extendedParams = {}) => (dispatch) => {
89
103
  response: data,
90
104
  });
91
105
  })
92
- .catch(result => dispatch(apiError(MANIFEST_HISTORY_FAILURE, result)));
106
+ .catch((result) => {
107
+ dispatch({
108
+ type: MANIFEST_HISTORY_FAILURE,
109
+ result,
110
+ });
111
+ });
93
112
  };
94
113
 
95
114
  export default loadManifestHistory;
@@ -4,8 +4,6 @@ import {
4
4
  MANIFEST_HISTORY_REQUEST,
5
5
  MANIFEST_HISTORY_SUCCESS,
6
6
  MANIFEST_HISTORY_FAILURE,
7
- UPLOAD_MANIFEST_SUCCESS,
8
- DELETE_MANIFEST_SUCCESS,
9
7
  } from './ManifestConstants';
10
8
 
11
9
  const initialState = Immutable({ loading: true, results: [] });
@@ -26,16 +24,10 @@ export default (state = initialState, action) => {
26
24
 
27
25
  case MANIFEST_HISTORY_FAILURE:
28
26
  return state.merge({
29
- error: action.payload.message,
27
+ error: action.error,
30
28
  loading: false,
31
29
  });
32
30
 
33
- case UPLOAD_MANIFEST_SUCCESS:
34
- return state.set('taskDetails', action.response);
35
-
36
- case DELETE_MANIFEST_SUCCESS:
37
- return state.set('taskDetails', action.response);
38
-
39
31
  default:
40
32
  return state;
41
33
  }
@@ -4,8 +4,6 @@ import toJson from 'enzyme-to-json';
4
4
  import ManageManifestModal from '../ManageManifestModal';
5
5
  import { manifestHistorySuccessState } from './manifest.fixtures';
6
6
 
7
- jest.mock('../../../../move_to_foreman/foreman_toast_notifications');
8
-
9
7
  describe('manage manifest modal', () => {
10
8
  const noop = () => {};
11
9
  const organization = { id: 1, redhat_repository_url: 'https://redhat.com' };
@@ -19,7 +17,6 @@ describe('manage manifest modal', () => {
19
17
  organization={organization}
20
18
  loadOrganization={noop}
21
19
  saveOrganization={noop}
22
- bulkSearch={noop}
23
20
  manifestHistory={manifestHistorySuccessState}
24
21
  taskInProgress={false}
25
22
  showModal
@@ -1,3 +1,5 @@
1
+ import axios from 'axios';
2
+ import MockAdapter from 'axios-mock-adapter';
1
3
  import thunk from 'redux-thunk';
2
4
  import Immutable from 'seamless-immutable';
3
5
  import configureMockStore from 'redux-mock-store';
@@ -13,11 +15,12 @@ import {
13
15
  deleteManifestSuccessActions,
14
16
  deleteManifestFailureActions,
15
17
  } from './manifest.fixtures';
18
+
16
19
  import { loadManifestHistory, uploadManifest, refreshManifest, deleteManifest } from '../ManifestActions';
17
- import { mock as mockApi, mockErrorRequest } from '../../../../mockRequest';
18
20
 
19
21
  const mockStore = configureMockStore([thunk]);
20
22
  const store = mockStore({ manifest: Immutable({}) });
23
+ const mockApi = new MockAdapter(axios);
21
24
 
22
25
  beforeEach(() => {
23
26
  store.clearActions();
@@ -40,10 +43,7 @@ describe('manifest actions', () => {
40
43
  const url = '/katello/api/v2/organizations/1/subscriptions/manifest_history';
41
44
 
42
45
  it('and then fails with 422', () => {
43
- mockErrorRequest({
44
- url,
45
- status: 422,
46
- });
46
+ mockApi.onGet(url).reply(422);
47
47
 
48
48
  return store.dispatch(loadManifestHistory())
49
49
  .then(() => expect(store.getActions()).toEqual(manifestHistoryFailureActions));
@@ -61,11 +61,7 @@ describe('manifest actions', () => {
61
61
  const url = '/katello/api/v2/organizations/1/subscriptions/upload';
62
62
 
63
63
  it('and then fails with 422', () => {
64
- mockErrorRequest({
65
- url,
66
- status: 422,
67
- method: 'POST',
68
- });
64
+ mockApi.onPost(url).reply(422);
69
65
 
70
66
  return store.dispatch(uploadManifest())
71
67
  .then(() => expect(store.getActions()).toEqual(uploadManifestFailureActions));
@@ -83,11 +79,7 @@ describe('manifest actions', () => {
83
79
  const url = '/katello/api/v2/organizations/1/subscriptions/refresh_manifest';
84
80
 
85
81
  it('and then fails with 422', () => {
86
- mockErrorRequest({
87
- url,
88
- status: 422,
89
- method: 'PUT',
90
- });
82
+ mockApi.onPut(url).reply(422);
91
83
 
92
84
  return store.dispatch(refreshManifest())
93
85
  .then(() => expect(store.getActions()).toEqual(refreshManifestFailureActions));
@@ -105,11 +97,7 @@ describe('manifest actions', () => {
105
97
  const url = '/katello/api/v2/organizations/1/subscriptions/delete_manifest';
106
98
 
107
99
  it('and then fails with 422', () => {
108
- mockErrorRequest({
109
- url,
110
- status: 422,
111
- method: 'POST',
112
- });
100
+ mockApi.onPost(url).reply(422);
113
101
 
114
102
  return store.dispatch(deleteManifest())
115
103
  .then(() => expect(store.getActions()).toEqual(deleteManifestFailureActions));