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.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/app/assets/javascripts/katello/common/index.js +0 -1
- data/app/assets/javascripts/katello/sync_management/index.js +0 -1
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +477 -0
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +2 -2
- data/app/controllers/katello/api/v2/api_controller.rb +3 -1
- data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +15 -1
- data/app/controllers/katello/api/v2/environments_controller.rb +5 -2
- data/app/controllers/katello/api/v2/errata_controller.rb +48 -34
- data/app/controllers/katello/api/v2/gpg_keys_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_packages_controller.rb +5 -1
- data/app/controllers/katello/api/v2/organizations_controller.rb +1 -1
- data/app/controllers/katello/api/v2/packages_controller.rb +33 -22
- data/app/controllers/katello/api/v2/products_controller.rb +1 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +6 -5
- data/app/controllers/katello/api/v2/repository_sets_controller.rb +1 -10
- data/app/controllers/katello/api/v2/sync_plans_controller.rb +1 -1
- data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +20 -12
- data/app/controllers/katello/remote_execution_controller.rb +6 -6
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +9 -37
- data/app/lib/actions/katello/content_view/promote.rb +6 -2
- data/app/lib/actions/katello/content_view_version/after_promote_hook.rb +11 -0
- data/app/lib/actions/katello/content_view_version/before_promote_hook.rb +11 -0
- data/app/lib/actions/katello/host/remove_subscriptions.rb +1 -1
- data/app/lib/actions/pulp/consumer/abstract_content_action.rb +0 -12
- data/app/lib/actions/pulp/consumer/content_install.rb +1 -1
- data/app/lib/actions/pulp/consumer/content_uninstall.rb +1 -1
- data/app/lib/actions/pulp/consumer/content_update.rb +1 -1
- data/app/lib/katello/resources/registry.rb +40 -0
- data/app/lib/katello/util/package.rb +9 -4
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -1
- data/app/models/katello/content_view.rb +4 -12
- data/app/models/katello/content_view_version.rb +26 -0
- data/app/models/katello/glue/candlepin/owner.rb +8 -0
- data/app/models/katello/glue/candlepin/pool.rb +11 -11
- data/app/models/katello/glue/candlepin/repository.rb +1 -1
- data/app/models/katello/glue/pulp/repos.rb +1 -0
- data/app/models/katello/host/content_facet.rb +1 -2
- data/app/models/katello/kt_environment.rb +6 -0
- data/app/models/katello/product_content.rb +1 -4
- data/app/models/katello/repository.rb +2 -0
- data/app/models/katello/rpm.rb +118 -14
- data/app/services/katello/puppet_class_importer_extensions.rb +17 -20
- data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -3
- data/app/views/katello/api/v2/common/copy.json.rabl +3 -0
- data/app/views/katello/api/v2/environments/show.json.rabl +1 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +1 -0
- data/app/views/katello/api/v2/repositories/show.json.rabl +4 -2
- data/app/views/overrides/activation_keys/_host_environment_select.html.erb +3 -2
- data/config/katello.yaml +89 -0
- data/config/routes.rb +0 -1
- data/config/routes/api/registry.rb +29 -0
- data/config/routes/api/v2.rb +1 -1
- data/db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb +0 -3
- data/db/migrate/20180614184822_add_unauthenticated_pull.rb +9 -0
- data/db/migrate/20180618195941_add_description_to_repository.rb +5 -0
- data/db/seeds.d/75-job_templates.rb +2 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +3 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +1 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-subscriptions-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-register.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages-installed.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-add-subscriptions.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version.controller.js +32 -18
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-docker.html +2 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-details.html +32 -23
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +6 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +8 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/discovery.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery-create.html +1 -1
- data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +0 -5
- data/lib/katello/engine.rb +1 -0
- data/lib/katello/permission_creator.rb +2 -0
- data/lib/katello/permissions/registry_permissions.rb +20 -0
- data/lib/katello/plugin.rb +1 -0
- data/lib/katello/tasks/clean_backend_objects.rake +3 -12
- data/lib/katello/version.rb +1 -1
- data/package.json +7 -10
- data/webpack/components/Search/Search.test.js +1 -3
- data/webpack/containers/Application/config.js +2 -9
- data/webpack/containers/Application/index.js +2 -4
- data/webpack/mockRequest.js +3 -3
- data/webpack/move_to_foreman/common/helpers.js +8 -45
- data/webpack/move_to_foreman/components/common/{EmptyState → emptyState}/index.js +3 -16
- data/webpack/move_to_foreman/components/common/table/components/Table.js +1 -1
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +2 -2
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionCell.test.js.snap +1 -1
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +1 -1
- data/webpack/move_to_pf/LoadingState/LoadingState.js +14 -27
- data/webpack/move_to_pf/LoadingState/LoadingState.test.js +4 -8
- data/webpack/move_to_pf/react-bootstrap-select/index.js +1 -12
- data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -0
- data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
- data/webpack/redux/actions/RedHatRepositories/sets.js +1 -1
- data/webpack/redux/consts.js +0 -6
- data/webpack/redux/reducers/index.js +0 -2
- data/webpack/scenes/RedHatRepositories/components/EnabledRepository.js +23 -14
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository.js +1 -1
- data/webpack/scenes/RedHatRepositories/components/SearchBar.js +0 -1
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RecommendedRepositorySetsToggler.test.js.snap +1 -3
- data/webpack/scenes/RedHatRepositories/index.js +3 -7
- data/webpack/scenes/RedHatRepositories/index.scss +0 -1
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +8 -3
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js +1 -30
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +28 -111
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailReducer.test.js +1 -3
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +1 -6
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +424 -519
- data/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js +4 -7
- data/webpack/scenes/Subscriptions/Details/index.js +3 -5
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +34 -78
- data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +24 -5
- data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryReducer.js +1 -9
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +0 -3
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +8 -20
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestHistoryReducer.test.js +1 -3
- data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +7 -34
- data/webpack/scenes/Subscriptions/Manifest/__tests__/manifest.fixtures.js +16 -9
- data/webpack/scenes/Subscriptions/Manifest/index.js +0 -1
- data/webpack/scenes/Subscriptions/SubscriptionActions.js +26 -5
- data/webpack/scenes/Subscriptions/SubscriptionConstants.js +0 -1
- data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +0 -3
- data/webpack/scenes/Subscriptions/SubscriptionReducer.js +4 -11
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +36 -31
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +12 -3
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +27 -57
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js +3 -2
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +5 -10
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsActions.test.js +5 -10
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +4 -49
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsReducer.test.js +3 -8
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +11 -21
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/upstreamSubscriptions.fixtures.js +8 -5
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -2
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +3 -9
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -14
- data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +17 -11
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js +5 -8
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +58 -45
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +4 -11
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +2 -2
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +3 -16
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +365 -392
- data/webpack/scenes/Subscriptions/index.js +0 -1
- data/webpack/services/api/fixtures.js +353 -0
- data/webpack/services/api/index.js +1 -17
- data/webpack/test_setup.js +0 -2
- metadata +16 -37
- data/config/katello.yml +0 -59
- data/webpack/__mocks__/foremanReact/components/BreadcrumbBar.js +0 -3
- data/webpack/__mocks__/foremanReact/redux.js +0 -3
- data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +0 -8
- data/webpack/components/SelectOrg/SelectOrg.scss +0 -3
- data/webpack/components/SelectOrg/SelectOrgAction.js +0 -41
- data/webpack/components/SelectOrg/SelectOrgReducer.js +0 -33
- data/webpack/components/SelectOrg/SetOrganization.js +0 -116
- data/webpack/components/WithOrganization/withOrganization.js +0 -28
- data/webpack/global_test_setup.js +0 -6
- data/webpack/helpers/caret.js +0 -6
- data/webpack/move_to_pf/Select/Select.js +0 -40
- data/webpack/scenes/Products/ProductActions.js +0 -24
- data/webpack/scenes/Products/ProductConstants.js +0 -3
- data/webpack/scenes/Products/__tests__/ProductActions.test.js +0 -40
- data/webpack/scenes/Products/__tests__/products.fixtures.js +0 -90
- data/webpack/scenes/RedHatRepositories/components/EnabledRepositoryContent.js +0 -34
- data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepository.test.js +0 -36
- data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepositoryContent.test.js +0 -27
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepository.test.js.snap +0 -25
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepositoryContent.test.js.snap +0 -47
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailEnabledProducts.js +0 -54
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js +0 -29
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.scss +0 -9
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailEnabledProducts.test.js +0 -18
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailProduct.test.js +0 -13
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailEnabledProducts.test.js.snap +0 -45
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProduct.test.js.snap +0 -67
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/EntitlementsInlineEditFormatter.test.js +0 -110
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/EntitlementsInlineEditFormatter.test.js.snap +0 -228
- data/webpack/scenes/Tasks/helpers.js +0 -52
- data/webpack/services/api/testHelpers.js +0 -28
@@ -30,9 +30,7 @@ describe('manifest history reducer', () => {
|
|
30
30
|
it('should have error on MANIFEST_HISTORY_FAILURE', () => {
|
31
31
|
expect(reducer(manifestHistoryInitialState, {
|
32
32
|
type: types.MANIFEST_HISTORY_FAILURE,
|
33
|
-
|
34
|
-
message: 'Unable to process request.',
|
35
|
-
},
|
33
|
+
error: 'Unable to process request.',
|
36
34
|
})).toEqual(manifestHistoryErrorState);
|
37
35
|
});
|
38
36
|
});
|
data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap
CHANGED
@@ -73,19 +73,14 @@ exports[`manage manifest modal should render 1`] = `
|
|
73
73
|
<FormGroup
|
74
74
|
bsClass="form-group"
|
75
75
|
>
|
76
|
-
<
|
77
|
-
bsClass="
|
78
|
-
|
79
|
-
|
76
|
+
<ControlLabel
|
77
|
+
bsClass="control-label"
|
78
|
+
className="col-sm-3"
|
79
|
+
htmlFor="cdnUrl"
|
80
|
+
srOnly={false}
|
80
81
|
>
|
81
|
-
|
82
|
-
|
83
|
-
htmlFor="cdnUrl"
|
84
|
-
srOnly={false}
|
85
|
-
>
|
86
|
-
Red Hat CDN URL
|
87
|
-
</ControlLabel>
|
88
|
-
</Col>
|
82
|
+
Red Hat CDN URL
|
83
|
+
</ControlLabel>
|
89
84
|
<Col
|
90
85
|
bsClass="col"
|
91
86
|
componentClass="div"
|
@@ -101,27 +96,6 @@ exports[`manage manifest modal should render 1`] = `
|
|
101
96
|
/>
|
102
97
|
</Col>
|
103
98
|
</FormGroup>
|
104
|
-
<FormGroup
|
105
|
-
bsClass="form-group"
|
106
|
-
>
|
107
|
-
<Col
|
108
|
-
bsClass="col"
|
109
|
-
componentClass="div"
|
110
|
-
sm={3}
|
111
|
-
smOffset={3}
|
112
|
-
>
|
113
|
-
<Button
|
114
|
-
active={false}
|
115
|
-
block={false}
|
116
|
-
bsClass="btn"
|
117
|
-
bsStyle="default"
|
118
|
-
disabled={false}
|
119
|
-
onClick={[Function]}
|
120
|
-
>
|
121
|
-
Update
|
122
|
-
</Button>
|
123
|
-
</Col>
|
124
|
-
</FormGroup>
|
125
99
|
<br />
|
126
100
|
<h5>
|
127
101
|
Subscription Manifest
|
@@ -241,7 +215,6 @@ exports[`manage manifest modal should render 1`] = `
|
|
241
215
|
<LoadingState
|
242
216
|
loading={false}
|
243
217
|
loadingText="Loading"
|
244
|
-
timeout={300}
|
245
218
|
>
|
246
219
|
<Table
|
247
220
|
columns={
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import Immutable from 'seamless-immutable';
|
2
|
-
import { toastErrorAction, failureAction } from '../../../../services/api/testHelpers';
|
3
2
|
|
4
3
|
export const manifestHistoryInitialState = Immutable({
|
5
4
|
loading: true,
|
@@ -150,8 +149,10 @@ export const manifestHistoryFailureActions = [
|
|
150
149
|
{
|
151
150
|
type: 'MANIFEST_HISTORY_REQUEST',
|
152
151
|
},
|
153
|
-
|
154
|
-
|
152
|
+
{
|
153
|
+
result: new Error('Request failed with status code 422'),
|
154
|
+
type: 'MANIFEST_HISTORY_FAILURE',
|
155
|
+
},
|
155
156
|
];
|
156
157
|
|
157
158
|
export const uploadManifestSuccessActions = [
|
@@ -168,8 +169,10 @@ export const uploadManifestFailureActions = [
|
|
168
169
|
{
|
169
170
|
type: 'UPLOAD_MANIFEST_REQUEST',
|
170
171
|
},
|
171
|
-
|
172
|
-
|
172
|
+
{
|
173
|
+
result: new Error('Request failed with status code 422'),
|
174
|
+
type: 'UPLOAD_MANIFEST_FAILURE',
|
175
|
+
},
|
173
176
|
];
|
174
177
|
|
175
178
|
export const refreshManifestSuccessActions = [
|
@@ -186,8 +189,10 @@ export const refreshManifestFailureActions = [
|
|
186
189
|
{
|
187
190
|
type: 'REFRESH_MANIFEST_REQUEST',
|
188
191
|
},
|
189
|
-
|
190
|
-
|
192
|
+
{
|
193
|
+
result: new Error('Request failed with status code 422'),
|
194
|
+
type: 'REFRESH_MANIFEST_FAILURE',
|
195
|
+
},
|
191
196
|
];
|
192
197
|
|
193
198
|
export const deleteManifestSuccessActions = [
|
@@ -204,6 +209,8 @@ export const deleteManifestFailureActions = [
|
|
204
209
|
{
|
205
210
|
type: 'DELETE_MANIFEST_REQUEST',
|
206
211
|
},
|
207
|
-
|
208
|
-
|
212
|
+
{
|
213
|
+
result: new Error('Request failed with status code 422'),
|
214
|
+
type: 'DELETE_MANIFEST_FAILURE',
|
215
|
+
},
|
209
216
|
];
|
@@ -15,7 +15,6 @@ import './Manifest.scss';
|
|
15
15
|
const mapStateToProps = state => ({
|
16
16
|
organization: state.katello.organization,
|
17
17
|
manifestHistory: state.katello.manifestHistory,
|
18
|
-
taskDetails: state.katello.manifestHistory.taskDetails,
|
19
18
|
});
|
20
19
|
|
21
20
|
// map action dispatchers to props
|
@@ -16,7 +16,7 @@ import {
|
|
16
16
|
DELETE_SUBSCRIPTIONS_FAILURE,
|
17
17
|
} from './SubscriptionConstants';
|
18
18
|
import { filterRHSubscriptions } from './SubscriptionHelpers.js';
|
19
|
-
import {
|
19
|
+
import { getResponseError } from '../../move_to_foreman/common/helpers.js';
|
20
20
|
|
21
21
|
export const createSubscriptionParams = (extendedParams = {}) => ({
|
22
22
|
...{ organization_id: orgId() },
|
@@ -35,7 +35,12 @@ export const loadAvailableQuantities = (extendedParams = {}) => (dispatch) => {
|
|
35
35
|
response: data,
|
36
36
|
});
|
37
37
|
})
|
38
|
-
.catch(result =>
|
38
|
+
.catch((result) => {
|
39
|
+
dispatch({
|
40
|
+
type: SUBSCRIPTIONS_QUANTITIES_FAILURE,
|
41
|
+
error: getResponseError(result.response),
|
42
|
+
});
|
43
|
+
});
|
39
44
|
};
|
40
45
|
|
41
46
|
export const loadSubscriptions = (extendedParams = {}) => (dispatch) => {
|
@@ -55,7 +60,12 @@ export const loadSubscriptions = (extendedParams = {}) => (dispatch) => {
|
|
55
60
|
dispatch(loadAvailableQuantities({ poolIds }));
|
56
61
|
}
|
57
62
|
})
|
58
|
-
.catch(result =>
|
63
|
+
.catch((result) => {
|
64
|
+
dispatch({
|
65
|
+
type: SUBSCRIPTIONS_FAILURE,
|
66
|
+
error: getResponseError(result.response),
|
67
|
+
});
|
68
|
+
});
|
59
69
|
};
|
60
70
|
|
61
71
|
export const updateQuantity = (quantities = {}) => (dispatch) => {
|
@@ -73,7 +83,12 @@ export const updateQuantity = (quantities = {}) => (dispatch) => {
|
|
73
83
|
response: data,
|
74
84
|
});
|
75
85
|
})
|
76
|
-
.catch(result =>
|
86
|
+
.catch((result) => {
|
87
|
+
dispatch({
|
88
|
+
type: UPDATE_QUANTITY_FAILURE,
|
89
|
+
error: getResponseError(result.response),
|
90
|
+
});
|
91
|
+
});
|
77
92
|
};
|
78
93
|
|
79
94
|
export const deleteSubscriptions = poolIds => (dispatch) => {
|
@@ -91,7 +106,13 @@ export const deleteSubscriptions = poolIds => (dispatch) => {
|
|
91
106
|
response: data,
|
92
107
|
});
|
93
108
|
})
|
94
|
-
.catch(result =>
|
109
|
+
.catch((result) => {
|
110
|
+
dispatch({
|
111
|
+
type: DELETE_SUBSCRIPTIONS_FAILURE,
|
112
|
+
result,
|
113
|
+
});
|
114
|
+
});
|
95
115
|
};
|
96
116
|
|
117
|
+
|
97
118
|
export default loadSubscriptions;
|
@@ -21,7 +21,6 @@ export const BLOCKING_FOREMAN_TASK_TYPES = [
|
|
21
21
|
'Actions::Katello::UpstreamSubscriptions::BindEntitlements',
|
22
22
|
'Actions::Katello::UpstreamSubscriptions::UpdateEntitlement',
|
23
23
|
'Actions::Katello::UpstreamSubscriptions::RemoveEntitlements',
|
24
|
-
'Actions::Katello::UpstreamSubscriptions::UpdateEntitlements',
|
25
24
|
];
|
26
25
|
|
27
26
|
export const MANIFEST_TASKS_BULK_SEARCH_ID = 'activeManifestTasksSearch';
|
@@ -1,6 +1,3 @@
|
|
1
1
|
// eslint-disable-next-line import/prefer-default-export
|
2
2
|
export const filterRHSubscriptions = subscriptions =>
|
3
3
|
subscriptions.filter(sub => sub.available >= 0);
|
4
|
-
|
5
|
-
export const manifestExists = organization =>
|
6
|
-
organization.owner_details && organization.owner_details.upstreamConsumer;
|
@@ -23,7 +23,7 @@ import { GET_SETTING_SUCCESS } from '../../move_to_foreman/Settings/SettingsCons
|
|
23
23
|
const initialState = Immutable({
|
24
24
|
...initialApiState,
|
25
25
|
quantitiesLoading: false,
|
26
|
-
availableQuantities:
|
26
|
+
availableQuantities: {},
|
27
27
|
tasks: [],
|
28
28
|
});
|
29
29
|
|
@@ -73,22 +73,15 @@ export default (state = initialState, action) => {
|
|
73
73
|
return state.set('loading', false);
|
74
74
|
|
75
75
|
case SUBSCRIPTIONS_FAILURE:
|
76
|
-
return state
|
77
|
-
.set('loading', false)
|
78
|
-
.set('results', [])
|
79
|
-
.set('itemCount', 0);
|
80
|
-
|
81
76
|
case UPDATE_QUANTITY_FAILURE:
|
82
77
|
case DELETE_SUBSCRIPTIONS_FAILURE:
|
83
78
|
return state.merge({
|
79
|
+
error: action.error,
|
84
80
|
loading: false,
|
85
81
|
});
|
86
82
|
|
87
83
|
case SUBSCRIPTIONS_QUANTITIES_REQUEST:
|
88
|
-
return state.
|
89
|
-
quantitiesLoading: true,
|
90
|
-
availableQuantities: null,
|
91
|
-
});
|
84
|
+
return state.set('quantitiesLoading', true);
|
92
85
|
|
93
86
|
case SUBSCRIPTIONS_QUANTITIES_SUCCESS: {
|
94
87
|
return state.merge({
|
@@ -100,7 +93,7 @@ export default (state = initialState, action) => {
|
|
100
93
|
case SUBSCRIPTIONS_QUANTITIES_FAILURE: {
|
101
94
|
return state.merge({
|
102
95
|
quantitiesLoading: false,
|
103
|
-
|
96
|
+
quantitiesError: action.error,
|
104
97
|
});
|
105
98
|
}
|
106
99
|
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import React, { Component } from 'react';
|
2
|
+
import ReactDOMServer from 'react-dom/server';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
import { LinkContainer } from 'react-router-bootstrap';
|
4
5
|
import { Grid, Row, Col, Form, FormGroup } from 'react-bootstrap';
|
5
6
|
import { Button } from 'patternfly-react';
|
6
7
|
import TooltipButton from 'react-bootstrap-tooltip-button';
|
7
|
-
import {
|
8
|
+
import { notify } from '../../move_to_foreman/foreman_toast_notifications';
|
9
|
+
import helpers from '../../move_to_foreman/common/helpers';
|
8
10
|
import ModalProgressBar from '../../move_to_foreman/components/common/ModalProgressBar';
|
9
11
|
import ManageManifestModal from './Manifest/';
|
10
12
|
import { SubscriptionsTable } from './components/SubscriptionsTable';
|
11
|
-
import { manifestExists } from './SubscriptionHelpers';
|
12
13
|
import Search from '../../components/Search/index';
|
13
14
|
import api, { orgId } from '../../services/api';
|
14
15
|
import { createSubscriptionParams } from './SubscriptionActions.js';
|
@@ -69,7 +70,7 @@ class SubscriptionsPage extends Component {
|
|
69
70
|
}
|
70
71
|
|
71
72
|
getDisabledReason(deleteButton) {
|
72
|
-
const { tasks = [], subscriptions
|
73
|
+
const { tasks = [], subscriptions } = this.props;
|
73
74
|
const { disconnected } = subscriptions;
|
74
75
|
let disabledReason = null;
|
75
76
|
|
@@ -78,9 +79,7 @@ class SubscriptionsPage extends Component {
|
|
78
79
|
} else if (tasks.length > 0) {
|
79
80
|
disabledReason = __('This is disabled because a manifest related task is in progress.');
|
80
81
|
} else if (deleteButton && !disabledReason) {
|
81
|
-
disabledReason = __('This is disabled because no subscriptions are selected
|
82
|
-
} else if (!manifestExists(organization)) {
|
83
|
-
disabledReason = __('This is disabled because no manifest has been uploaded.');
|
82
|
+
disabledReason = __('This is disabled because no subscriptions are selected');
|
84
83
|
}
|
85
84
|
|
86
85
|
return disabledReason;
|
@@ -104,14 +103,39 @@ class SubscriptionsPage extends Component {
|
|
104
103
|
|
105
104
|
pollTaskUntilDone(taskToPoll.id, {}, POLL_TASK_INTERVAL)
|
106
105
|
.then((task) => {
|
107
|
-
|
106
|
+
function getErrors() {
|
107
|
+
return (
|
108
|
+
<ul>
|
109
|
+
{task.humanized.errors.map(error => (
|
110
|
+
<li key={error}> {error} </li>
|
111
|
+
))}
|
112
|
+
</ul>
|
113
|
+
);
|
114
|
+
}
|
115
|
+
|
116
|
+
const message = (
|
117
|
+
<span>
|
118
|
+
<span>
|
119
|
+
{`${__(`Task ${task.humanized.action} completed with a result of ${task.result}.`)} `}
|
120
|
+
</span>
|
121
|
+
{task.errors ? getErrors() : ''}
|
122
|
+
<a href={helpers.urlBuilder('foreman_tasks/tasks', '', task.id)}>
|
123
|
+
{__('Click here to go to the tasks page for the task.')}
|
124
|
+
</a>
|
125
|
+
</span>
|
126
|
+
);
|
127
|
+
|
128
|
+
notify({
|
129
|
+
message: ReactDOMServer.renderToStaticMarkup(message),
|
130
|
+
type: task.result,
|
131
|
+
});
|
132
|
+
|
108
133
|
loadSubscriptions();
|
109
134
|
});
|
110
135
|
}
|
111
136
|
|
112
137
|
render() {
|
113
|
-
const { tasks = [], subscriptions
|
114
|
-
const currentOrg = orgId();
|
138
|
+
const { tasks = [], subscriptions } = this.props;
|
115
139
|
const { disconnected } = subscriptions;
|
116
140
|
const taskInProgress = tasks.length > 0;
|
117
141
|
const disableManifestActions = taskInProgress || disconnected;
|
@@ -129,7 +153,7 @@ class SubscriptionsPage extends Component {
|
|
129
153
|
const getAutoCompleteParams = search => ({
|
130
154
|
endpoint: '/subscriptions/auto_complete_search',
|
131
155
|
params: {
|
132
|
-
organization_id:
|
156
|
+
organization_id: orgId(),
|
133
157
|
search,
|
134
158
|
},
|
135
159
|
});
|
@@ -163,18 +187,8 @@ class SubscriptionsPage extends Component {
|
|
163
187
|
this.setState({ disableDeleteButton: !rowsSelected });
|
164
188
|
};
|
165
189
|
|
166
|
-
|
167
190
|
const csvParams = createSubscriptionParams({ search: this.state.searchQuery });
|
168
191
|
|
169
|
-
const emptyStateData = {
|
170
|
-
header: __('There are no Subscriptions to display'),
|
171
|
-
description: __('Import a Manifest to manage your Entitlements.'),
|
172
|
-
action: {
|
173
|
-
onClick: showManageManifestModal,
|
174
|
-
title: __('Import a Manifest'),
|
175
|
-
},
|
176
|
-
};
|
177
|
-
|
178
192
|
return (
|
179
193
|
<Grid bsClass="container-fluid">
|
180
194
|
<Row>
|
@@ -194,10 +208,7 @@ class SubscriptionsPage extends Component {
|
|
194
208
|
|
195
209
|
<div className="toolbar-pf-action-right">
|
196
210
|
<FormGroup>
|
197
|
-
<LinkContainer
|
198
|
-
to="subscriptions/add"
|
199
|
-
disabled={disableManifestActions || !manifestExists(organization)}
|
200
|
-
>
|
211
|
+
<LinkContainer to="subscriptions/add" disabled={disableManifestActions}>
|
201
212
|
<TooltipButton
|
202
213
|
tooltipId="add-subscriptions-button-tooltip"
|
203
214
|
tooltipText={this.getDisabledReason()}
|
@@ -246,14 +257,11 @@ class SubscriptionsPage extends Component {
|
|
246
257
|
<SubscriptionsTable
|
247
258
|
loadSubscriptions={this.props.loadSubscriptions}
|
248
259
|
updateQuantity={this.props.updateQuantity}
|
249
|
-
emptyState={emptyStateData}
|
250
260
|
subscriptions={this.props.subscriptions}
|
251
261
|
subscriptionDeleteModalOpen={this.state.subscriptionDeleteModalOpen}
|
252
262
|
onSubscriptionDeleteModalClose={onSubscriptionDeleteModalClose}
|
253
263
|
onDeleteSubscriptions={onDeleteSubscriptions}
|
254
264
|
toggleDeleteButton={toggleDeleteButton}
|
255
|
-
task={task}
|
256
|
-
bulkSearch={this.props.bulkSearch}
|
257
265
|
/>
|
258
266
|
<ModalProgressBar
|
259
267
|
show={this.state.showTaskModal}
|
@@ -271,10 +279,8 @@ class SubscriptionsPage extends Component {
|
|
271
279
|
SubscriptionsPage.propTypes = {
|
272
280
|
loadSubscriptions: PropTypes.func.isRequired,
|
273
281
|
updateQuantity: PropTypes.func.isRequired,
|
274
|
-
subscriptions: PropTypes.shape(
|
275
|
-
organization: PropTypes.shape({}).isRequired,
|
282
|
+
subscriptions: PropTypes.shape().isRequired,
|
276
283
|
pollBulkSearch: PropTypes.func.isRequired,
|
277
|
-
bulkSearch: PropTypes.func,
|
278
284
|
pollTaskUntilDone: PropTypes.func.isRequired,
|
279
285
|
loadSetting: PropTypes.func.isRequired,
|
280
286
|
tasks: PropTypes.arrayOf(PropTypes.shape({})),
|
@@ -283,7 +289,6 @@ SubscriptionsPage.propTypes = {
|
|
283
289
|
|
284
290
|
SubscriptionsPage.defaultProps = {
|
285
291
|
tasks: [],
|
286
|
-
bulkSearch: undefined,
|
287
292
|
};
|
288
293
|
|
289
294
|
export default SubscriptionsPage;
|
@@ -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
|
UPSTREAM_SUBSCRIPTIONS_REQUEST,
|
@@ -28,7 +27,12 @@ export const loadUpstreamSubscriptions = (extendedParams = {}) => (dispatch) =>
|
|
28
27
|
search: extendedParams.search,
|
29
28
|
});
|
30
29
|
})
|
31
|
-
.catch(result =>
|
30
|
+
.catch((result) => {
|
31
|
+
dispatch({
|
32
|
+
type: UPSTREAM_SUBSCRIPTIONS_FAILURE,
|
33
|
+
result,
|
34
|
+
});
|
35
|
+
});
|
32
36
|
};
|
33
37
|
|
34
38
|
export const saveUpstreamSubscriptions = upstreamSubscriptions => (dispatch) => {
|
@@ -46,7 +50,12 @@ export const saveUpstreamSubscriptions = upstreamSubscriptions => (dispatch) =>
|
|
46
50
|
response: data,
|
47
51
|
});
|
48
52
|
})
|
49
|
-
.catch(result =>
|
53
|
+
.catch((result) => {
|
54
|
+
dispatch({
|
55
|
+
type: SAVE_UPSTREAM_SUBSCRIPTIONS_FAILURE,
|
56
|
+
result,
|
57
|
+
});
|
58
|
+
});
|
50
59
|
};
|
51
60
|
|
52
61
|
export default loadUpstreamSubscriptions;
|