katello 3.15.0.rc1.3 → 3.15.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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/api_controller.rb +5 -0
  3. data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -0
  4. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +1 -1
  5. data/app/lib/actions/katello/content_view/destroy.rb +1 -0
  6. data/app/lib/actions/katello/host/erratum/applicable_errata_install.rb +1 -1
  7. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +26 -0
  8. data/app/lib/actions/pulp3/orchestration/repository/delete.rb +8 -1
  9. data/app/lib/actions/pulp3/repository/delete_version.rb +20 -0
  10. data/app/lib/katello/concerns/base_template_scope_extensions.rb +23 -1
  11. data/app/lib/katello/errors.rb +2 -0
  12. data/app/models/katello/repository.rb +44 -9
  13. data/app/models/setting/content.rb +8 -2
  14. data/app/services/katello/pulp3/migration.rb +19 -4
  15. data/app/services/katello/pulp3/repository.rb +4 -0
  16. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +13 -0
  17. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-subscriptions.controller.js +4 -2
  18. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-subscriptions.html +11 -8
  19. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +8 -0
  20. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +2 -0
  21. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +2 -0
  22. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +2 -0
  23. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-actions.html +1 -0
  24. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-applicable.html +2 -1
  25. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-installed.html +4 -2
  26. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +10 -1
  27. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +6 -3
  28. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions.html +4 -2
  29. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +9 -1
  30. data/lib/katello/tasks/pulp3_content_switchover.rake +2 -1
  31. data/lib/katello/version.rb +1 -1
  32. data/webpack/__mocks__/foremanReact/redux/API.js +6 -0
  33. data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware/IntervalSelectors.js +6 -0
  34. data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware/index.js +11 -0
  35. data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryReducer.js +0 -12
  36. data/webpack/scenes/Subscriptions/Manifest/index.js +0 -1
  37. data/webpack/scenes/Subscriptions/SubscriptionActions.js +49 -10
  38. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +10 -5
  39. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +37 -43
  40. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +55 -131
  41. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +2 -5
  42. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +1 -1
  43. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsActions.test.js +75 -8
  44. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +35 -8
  45. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +58 -46
  46. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +3 -5
  47. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +85 -9
  48. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +0 -2
  49. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +111 -124
  50. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +2 -12
  51. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +2 -8
  52. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +1 -16
  53. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +1 -6
  54. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UpdateDialog.js +0 -25
  55. data/webpack/scenes/Subscriptions/index.js +2 -5
  56. data/webpack/scenes/Tasks/TaskActions.js +34 -104
  57. data/webpack/scenes/Tasks/TaskSelectors.js +7 -0
  58. data/webpack/scenes/Tasks/__tests__/TaskActions.test.js +17 -154
  59. data/webpack/scenes/Tasks/__tests__/TaskSelectors.test.js +21 -0
  60. data/webpack/scenes/Tasks/__tests__/__snapshots__/TaskActions.test.js.snap +57 -0
  61. data/webpack/scenes/Tasks/__tests__/__snapshots__/TaskSelectors.test.js.snap +9 -0
  62. data/webpack/scenes/Tasks/__tests__/task.fixtures.js +0 -82
  63. data/webpack/scenes/Tasks/helpers.js +13 -6
  64. metadata +12 -3
  65. data/webpack/scenes/Tasks/TaskConstants.js +0 -9
@@ -2,6 +2,7 @@
2
2
 
3
3
  <section ng-hide="denied('edit_hosts', host)" bst-feature-flag="remote_actions">
4
4
  <h4 translate>Package Actions</h4>
5
+ <div data-extend-template="common/views/katello-agent-notice.html"></div>
5
6
  <p bst-alert="info" ng-hide="host.content_facet_attributes.katello_agent_installed">
6
7
  <span translate>
7
8
  If you are not using Remote Execution to manage content on this host, ensure that it has the katello-agent package installed.
@@ -1,7 +1,8 @@
1
1
  <span page-title ng-model="host">{{ 'Packages for: ' | translate }} {{ host.name }}</span>
2
2
 
3
- <h3 translate>Applicable Packages</h3>
4
3
 
4
+ <h3 translate>Applicable Packages</h3>
5
+ <div data-extend-template="common/views/katello-agent-notice.html"></div>
5
6
  <div data-extend-template="layouts/partials/table.html">
6
7
 
7
8
  <span data-block="no-rows-message" translate>
@@ -1,5 +1,9 @@
1
1
  <span page-title ng-model="host">{{ 'Packages for: ' | translate }} {{ host.name }}</span>
2
2
 
3
+ <h3 translate>Installed Packages</h3>
4
+
5
+ <div data-extend-template="common/views/katello-agent-notice.html"></div>
6
+
3
7
  <section ng-hide="denied('edit_hosts', host)" bst-feature-flag="remote_actions">
4
8
  <p bst-alert="info" ng-hide="host.content_facet_attributes.katello_agent_installed">
5
9
  <span translate>
@@ -8,8 +12,6 @@
8
12
  </p>
9
13
  </section>
10
14
 
11
- <h3 translate>Installed Packages</h3>
12
-
13
15
  <div data-extend-template="layouts/partials/table.html">
14
16
  <span data-block="no-rows-message" translate>
15
17
  The host has not reported any installed packages, registering with subscription-manager should cause these to be reported.
@@ -142,7 +142,16 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
142
142
  };
143
143
 
144
144
  $scope.autoHealOptions = function () {
145
- return [{value: true, name: translate("Yes")}, {value: true, name: translate("No")}];
145
+ return [
146
+ {
147
+ id: true,
148
+ name: translate("Yes")
149
+ },
150
+ {
151
+ id: false,
152
+ name: translate("No")
153
+ }
154
+ ];
146
155
  };
147
156
 
148
157
  $scope.serviceLevels = function () {
@@ -81,9 +81,12 @@
81
81
  </ul>
82
82
  </dd>
83
83
 
84
- <dt translate>Auto-Attach</dt>
85
- <dd ng-if= "simpleContentAccessEnabled" translate> Not Applicable </dd>
86
- <dd ng-if= "!simpleContentAccessEnabled" bst-edit-select="host.subscription_facet_attributes.autoheal"
84
+ <dt translate>Auto-Attach Details</dt>
85
+ <dd ng-if="simpleContentAccessEnabled" translate>Not Applicable</dd>
86
+ <dd ng-if="!simpleContentAccessEnabled"
87
+ bst-edit-select="host.subscription_facet_attributes.autoheal"
88
+ selector="host.subscription_facet_attributes.autoheal"
89
+ options="autoHealOptions()"
87
90
  readonly="denied('edit_hosts', host)"
88
91
  formatter="booleanToYesNo"
89
92
  on-save="saveSubscriptionFacet(host)">
@@ -29,11 +29,13 @@
29
29
  Not Applicable
30
30
  </span>
31
31
  <div ng-if="!simpleContentAccessEnabled">
32
- <div bst-edit-checkbox="host.subscription_facet_attributes.autoheal"
32
+ <div bst-edit-select="host.subscription_facet_attributes.autoheal"
33
+ options="autoHealOptions()"
34
+ selector="host.subscription_facet_attributes.autoheal"
33
35
  formatter="booleanToYesNo"
34
36
  readonly="denied('edit_hosts', host)"
35
37
  on-save="saveSubscriptionFacet(host)">
36
- </div>
38
+ </div>
37
39
  <a ng-hide="denied('edit_hosts', host)"
38
40
  ng-click="autoAttachSubscriptions()"
39
41
  class="btn btn-default"
@@ -7,7 +7,15 @@
7
7
  <p translate>To optionally report tracer information:</p>
8
8
  <pre><code>yum -y install katello-host-tools-tracer</code></pre>
9
9
 
10
- <p translate>For remote actions and reporting package & errata information:</p>
10
+ <p translate>For remote actions via katello-agent:</p>
11
11
  <pre><code>yum -y install katello-agent</code></pre>
12
+ <section>
13
+ <p bst-alert="warning" >
14
+ <span translate>
15
+ Katello-agent is deprecated and will be removed in Katello 4.0. Consider migrating to Remote Execution.
16
+ </span>
17
+ </p>
18
+ </section>
19
+
12
20
  <p translate>Learn more about these packages in the <a href="https://theforeman.org/plugins/katello/">Documentation</a> </p>
13
21
  </li>
@@ -3,7 +3,8 @@ require File.expand_path("../engine", File.dirname(__FILE__))
3
3
  namespace :katello do
4
4
  desc "Runs a Pulp 3 migration of pulp3 hrefs to pulp ids for supported content types."
5
5
  task :pulp3_content_switchover => :environment do
6
- content_types = Katello::Pulp3::Migration.content_types_for_migration
6
+ migration_service = Katello::Pulp3::Migration.new(SmartProxy.pulp_master)
7
+ content_types = migration_service.content_types_for_migration
7
8
 
8
9
  content_types.each do |content_type|
9
10
  if content_type.model_class.where(migrated_pulp3_href: nil).any?
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.15.0.rc1.3".freeze
2
+ VERSION = "3.15.0.rc2".freeze
3
3
  end
@@ -0,0 +1,6 @@
1
+ export const get = action => ({
2
+ ...action,
3
+ type: 'API_GET',
4
+ });
5
+
6
+ export default get;
@@ -0,0 +1,6 @@
1
+ export const selectDoesIntervalExist = (state, key) => {
2
+ const intervals = state.intervals || {};
3
+ return !!intervals[key];
4
+ };
5
+
6
+ export default selectDoesIntervalExist;
@@ -0,0 +1,11 @@
1
+ export const withInterval = (action, interval = 1000) => ({
2
+ ...action,
3
+ interval,
4
+ });
5
+
6
+ export const stopInterval = key => ({
7
+ type: 'STOP_INTERVAL',
8
+ key,
9
+ });
10
+
11
+ export default stopInterval;
@@ -4,9 +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
- REFRESH_MANIFEST_SUCCESS,
10
7
  } from './ManifestConstants';
11
8
 
12
9
  const initialState = Immutable({ loading: true, results: [] });
@@ -31,15 +28,6 @@ export default (state = initialState, action) => {
31
28
  loading: false,
32
29
  });
33
30
 
34
- case UPLOAD_MANIFEST_SUCCESS:
35
- return state.set('taskDetails', action.response);
36
-
37
- case DELETE_MANIFEST_SUCCESS:
38
- return state.set('taskDetails', action.response);
39
-
40
- case REFRESH_MANIFEST_SUCCESS:
41
- return state.set('taskDetails', action.response);
42
-
43
31
  default:
44
32
  return state;
45
33
  }
@@ -19,7 +19,6 @@ import './Manifest.scss';
19
19
  const mapStateToProps = state => ({
20
20
  organization: state.katello.organization,
21
21
  manifestHistory: state.katello.manifestHistory,
22
- taskDetails: state.katello.manifestHistory.taskDetails,
23
22
  simpleContentAccess: selectSimpleContentAccessEnabled(state),
24
23
  modalOpenState: state.foremanModals.ManageManifestModal,
25
24
  deleteManifestModalIsOpen: selectIsModalOpen(state, DELETE_MANIFEST_MODAL_ID),
@@ -4,6 +4,7 @@ import { isEmpty } from 'lodash';
4
4
  import api, { orgId } from '../../services/api';
5
5
 
6
6
  import {
7
+ SUBSCRIPTIONS,
7
8
  SUBSCRIPTIONS_REQUEST,
8
9
  SUBSCRIPTIONS_SUCCESS,
9
10
  SUBSCRIPTIONS_FAILURE,
@@ -23,15 +24,21 @@ import {
23
24
  SUBSCRIPTIONS_UPDATE_SEARCH_QUERY,
24
25
  SUBSCRIPTIONS_OPEN_DELETE_MODAL,
25
26
  SUBSCRIPTIONS_CLOSE_DELETE_MODAL,
26
- SUBSCRIPTIONS_OPEN_TASK_MODAL,
27
- SUBSCRIPTIONS_CLOSE_TASK_MODAL,
28
27
  SUBSCRIPTIONS_DISABLE_DELETE_BUTTON,
29
28
  SUBSCRIPTIONS_ENABLE_DELETE_BUTTON,
29
+ BLOCKING_FOREMAN_TASK_TYPES,
30
+ SUBSCRIPTIONS_RESET_TASKS,
30
31
  } from './SubscriptionConstants';
31
32
  import { filterRHSubscriptions, selectSubscriptionsQuantitiesFromResponse } from './SubscriptionHelpers.js';
32
33
  import { apiError } from '../../move_to_foreman/common/helpers.js';
33
- import { pollTaskUntilDone } from '../Tasks/TaskActions';
34
- import { POLL_TASK_INTERVAL } from '../Tasks/TaskConstants';
34
+ import {
35
+ startPollingTask,
36
+ stopPollingTask,
37
+ startPollingTasks,
38
+ stopPollingTasks,
39
+ toastTaskFinished,
40
+ } from '../Tasks/TaskActions';
41
+ import { selectIsPollingTasks, selectIsPollingTask } from '../Tasks/TaskSelectors';
35
42
 
36
43
  export const createSubscriptionParams = (extendedParams = {}) => ({
37
44
  ...{
@@ -79,8 +86,41 @@ export const loadSubscriptions = (extendedParams = {}) => async (dispatch) => {
79
86
  }
80
87
  };
81
88
 
89
+ export const cancelPollTasks = () => (dispatch, getState) => {
90
+ if (selectIsPollingTasks(getState(), SUBSCRIPTIONS)) {
91
+ dispatch(stopPollingTasks(SUBSCRIPTIONS));
92
+ }
93
+ };
94
+
95
+ export const pollTasks = () => dispatch => dispatch(startPollingTasks(SUBSCRIPTIONS, {
96
+ organization_id: orgId(),
97
+ result: 'pending',
98
+ label: BLOCKING_FOREMAN_TASK_TYPES.join(' or '),
99
+ }));
100
+
101
+ export const resetTasks = () => (dispatch) => {
102
+ dispatch({
103
+ type: SUBSCRIPTIONS_RESET_TASKS,
104
+ });
105
+ };
106
+
107
+ export const handleTask = task => async (dispatch, getState) => {
108
+ if (selectIsPollingTask(getState(), SUBSCRIPTIONS)) {
109
+ if (!task.pending) {
110
+ dispatch(stopPollingTask(SUBSCRIPTIONS));
111
+ dispatch(toastTaskFinished(task));
112
+ dispatch(resetTasks());
113
+ dispatch(pollTasks());
114
+ dispatch(loadSubscriptions());
115
+ }
116
+ } else {
117
+ dispatch(cancelPollTasks());
118
+ dispatch(startPollingTask(SUBSCRIPTIONS, task));
119
+ }
120
+ };
121
+
82
122
  export const updateQuantity = (quantities = {}) => async (dispatch) => {
83
- dispatch({ type: UPDATE_QUANTITY_REQUEST, quantities });
123
+ dispatch({ type: UPDATE_QUANTITY_REQUEST });
84
124
 
85
125
  const params = {
86
126
  pools: quantities,
@@ -127,8 +167,10 @@ export const deleteSubscriptions = poolIds => async (dispatch) => {
127
167
 
128
168
  try {
129
169
  const { data } = await api.delete(`/organizations/${(orgId())}/upstream_subscriptions`, {}, params);
130
- dispatch(pollTaskUntilDone(data.id, {}, POLL_TASK_INTERVAL, Number(orgId())));
131
- return dispatch({ type: DELETE_SUBSCRIPTIONS_SUCCESS });
170
+ return dispatch({
171
+ type: DELETE_SUBSCRIPTIONS_SUCCESS,
172
+ response: data,
173
+ });
132
174
  } catch (error) {
133
175
  return dispatch(apiError(DELETE_SUBSCRIPTIONS_FAILURE, error));
134
176
  }
@@ -142,9 +184,6 @@ export const updateSearchQuery = query => ({
142
184
  export const openDeleteModal = () => ({ type: SUBSCRIPTIONS_OPEN_DELETE_MODAL });
143
185
  export const closeDeleteModal = () => ({ type: SUBSCRIPTIONS_CLOSE_DELETE_MODAL });
144
186
 
145
- export const openTaskModal = () => ({ type: SUBSCRIPTIONS_OPEN_TASK_MODAL });
146
- export const closeTaskModal = () => ({ type: SUBSCRIPTIONS_CLOSE_TASK_MODAL });
147
-
148
187
  export const disableDeleteButton = () => ({ type: SUBSCRIPTIONS_DISABLE_DELETE_BUTTON });
149
188
  export const enableDeleteButton = () => ({ type: SUBSCRIPTIONS_ENABLE_DELETE_BUTTON });
150
189
 
@@ -1,5 +1,15 @@
1
1
  import { translate as __ } from 'foremanReact/common/I18n';
2
2
 
3
+ export const SUBSCRIPTIONS = 'SUBSCRIPTIONS';
4
+
5
+ export const SUBSCRIPTIONS_RESET_TASKS = 'SUBSCRIPTIONS_RESET_TASKS';
6
+
7
+ export const SUBSCRIPTIONS_TASK_SEARCH_SUCCESS = 'SUBSCRIPTIONS_TASK_SEARCH_SUCCESS';
8
+ export const SUBSCRIPTIONS_TASK_SEARCH_FAILURE = 'SUBSCRIPTIONS_TASK_SEARCH_FAILURE';
9
+
10
+ export const SUBSCRIPTIONS_POLL_TASK_SUCCESS = 'SUBSCRIPTIONS_POLL_TASK_SUCCESS';
11
+ export const SUBSCRIPTIONS_POLL_TASK_FAILURE = 'SUBSCRIPTIONS_POLL_TASK_FAILURE';
12
+
3
13
  export const SUBSCRIPTIONS_REQUEST = 'SUBSCRIPTIONS_REQUEST';
4
14
  export const SUBSCRIPTIONS_SUCCESS = 'SUBSCRIPTIONS_SUCCESS';
5
15
  export const SUBSCRIPTIONS_FAILURE = 'SUBSCRIPTIONS_FAILURE';
@@ -24,9 +34,6 @@ export const SUBSCRIPTIONS_UPDATE_SEARCH_QUERY = 'SUBSCRIPTIONS_UPDATE_SEARCH_QU
24
34
  export const SUBSCRIPTIONS_OPEN_DELETE_MODAL = 'SUBSCRIPTIONS_OPEN_DELETE_MODAL';
25
35
  export const SUBSCRIPTIONS_CLOSE_DELETE_MODAL = 'SUBSCRIPTIONS_CLOSE_DELETE_MODAL';
26
36
 
27
- export const SUBSCRIPTIONS_OPEN_TASK_MODAL = 'SUBSCRIPTIONS_OPEN_TASK_MODAL';
28
- export const SUBSCRIPTIONS_CLOSE_TASK_MODAL = 'SUBSCRIPTIONS_CLOSE_TASK_MODAL';
29
-
30
37
  export const SUBSCRIPTIONS_DISABLE_DELETE_BUTTON = 'SUBSCRIPTIONS_DISABLE_DELETE_BUTTON';
31
38
  export const SUBSCRIPTIONS_ENABLE_DELETE_BUTTON = 'SUBSCRIPTIONS_ENABLE_DELETE_BUTTON';
32
39
 
@@ -40,8 +47,6 @@ export const BLOCKING_FOREMAN_TASK_TYPES = [
40
47
  'Actions::Katello::UpstreamSubscriptions::UpdateEntitlements',
41
48
  ];
42
49
 
43
- export const MANIFEST_TASKS_BULK_SEARCH_ID = 'activeManifestTasksSearch';
44
- export const BULK_TASK_SEARCH_INTERVAL = 10000;
45
50
  export const SUBSCRIPTION_TABLE_NAME = 'Katello::Subscriptions';
46
51
  export const SUBSCRIPTION_TABLE_COLUMNS = [
47
52
  {
@@ -3,8 +3,6 @@ import { get } from 'lodash';
3
3
  import { GET_SETTING_SUCCESS } from 'foremanReact/components/Settings/SettingsConstants';
4
4
  import { initialApiState } from '../../services/api';
5
5
 
6
- import { TASK_BULK_SEARCH_SUCCESS, RESET_TASKS, GET_TASK_SUCCESS } from '../Tasks/TaskConstants';
7
-
8
6
  import {
9
7
  SUBSCRIPTIONS_REQUEST,
10
8
  SUBSCRIPTIONS_SUCCESS,
@@ -14,30 +12,35 @@ import {
14
12
  SUBSCRIPTIONS_QUANTITIES_FAILURE,
15
13
  SUBSCRIPTIONS_COLUMNS_REQUEST,
16
14
  UPDATE_SUBSCRIPTION_COLUMNS,
17
- UPDATE_QUANTITY_REQUEST,
18
15
  UPDATE_QUANTITY_SUCCESS,
19
- UPDATE_QUANTITY_FAILURE,
20
16
  DELETE_SUBSCRIPTIONS_SUCCESS,
21
- DELETE_SUBSCRIPTIONS_FAILURE,
22
17
  SUBSCRIPTIONS_UPDATE_SEARCH_QUERY,
23
18
  SUBSCRIPTIONS_OPEN_DELETE_MODAL,
24
19
  SUBSCRIPTIONS_CLOSE_DELETE_MODAL,
25
- SUBSCRIPTIONS_OPEN_TASK_MODAL,
26
- SUBSCRIPTIONS_CLOSE_TASK_MODAL,
27
20
  SUBSCRIPTIONS_DISABLE_DELETE_BUTTON,
28
21
  SUBSCRIPTIONS_ENABLE_DELETE_BUTTON,
22
+ SUBSCRIPTIONS_RESET_TASKS,
23
+ SUBSCRIPTIONS_TASK_SEARCH_SUCCESS,
24
+ SUBSCRIPTIONS_TASK_SEARCH_FAILURE,
25
+ SUBSCRIPTIONS_POLL_TASK_SUCCESS,
26
+ SUBSCRIPTIONS_POLL_TASK_FAILURE,
29
27
  } from './SubscriptionConstants';
30
28
 
29
+ import {
30
+ DELETE_MANIFEST_SUCCESS,
31
+ UPLOAD_MANIFEST_SUCCESS,
32
+ REFRESH_MANIFEST_SUCCESS,
33
+ } from './Manifest/ManifestConstants';
34
+
31
35
  const initialState = Immutable({
32
36
  ...initialApiState,
33
37
  disconnected: false,
34
38
  searchQuery: '',
35
39
  deleteModalOpened: false,
36
- taskModalOpened: false,
37
40
  deleteButtonDisabled: true,
38
41
  quantitiesLoading: false,
39
42
  availableQuantities: null,
40
- tasks: [],
43
+ task: null,
41
44
  tableColumns: [],
42
45
  selectedTableColumns: [],
43
46
  });
@@ -45,7 +48,6 @@ const initialState = Immutable({
45
48
  export default (state = initialState, action) => {
46
49
  switch (action.type) {
47
50
  case SUBSCRIPTIONS_REQUEST:
48
- case UPDATE_QUANTITY_REQUEST:
49
51
  return state.set('loading', true);
50
52
  case SUBSCRIPTIONS_COLUMNS_REQUEST:
51
53
  return state
@@ -85,14 +87,6 @@ export default (state = initialState, action) => {
85
87
  });
86
88
  }
87
89
 
88
- case DELETE_SUBSCRIPTIONS_SUCCESS:
89
- return state
90
- .set('deleteButtonDisabled', true)
91
- .set('loading', false);
92
-
93
- case UPDATE_QUANTITY_SUCCESS:
94
- return state.set('loading', false);
95
-
96
90
  case SUBSCRIPTIONS_FAILURE:
97
91
  return state
98
92
  .set('loading', false)
@@ -103,12 +97,6 @@ export default (state = initialState, action) => {
103
97
  get(action, ['payload', 'messages', 0, 'missing_permissions']),
104
98
  );
105
99
 
106
- case UPDATE_QUANTITY_FAILURE:
107
- case DELETE_SUBSCRIPTIONS_FAILURE:
108
- return state.merge({
109
- loading: false,
110
- });
111
-
112
100
  case SUBSCRIPTIONS_QUANTITIES_REQUEST:
113
101
  return state.merge({
114
102
  quantitiesLoading: true,
@@ -129,25 +117,36 @@ export default (state = initialState, action) => {
129
117
  });
130
118
  }
131
119
 
132
- case TASK_BULK_SEARCH_SUCCESS: {
133
- const tasks = action.response.results;
134
- const prevTasksSize = state.tasks.length;
135
- const shouldInitTasks = prevTasksSize === 0 && tasks.length > 0;
136
- const isTaskFinished = prevTasksSize > 0 && !state.tasks[0].pending;
137
-
138
- if (shouldInitTasks || isTaskFinished) {
139
- return state.set('tasks', tasks);
120
+ case SUBSCRIPTIONS_TASK_SEARCH_SUCCESS: {
121
+ if (!state.task) {
122
+ const tasks = action.response.results;
123
+ if (tasks.length > 0) {
124
+ return state
125
+ .set('task', tasks[0]); // this will be the oldest pending task
126
+ }
140
127
  }
128
+
141
129
  return state;
142
130
  }
143
131
 
144
- case GET_TASK_SUCCESS: {
145
- return state.set('tasks', [action.response]);
146
- }
132
+ case DELETE_MANIFEST_SUCCESS:
133
+ case UPLOAD_MANIFEST_SUCCESS:
134
+ case REFRESH_MANIFEST_SUCCESS:
135
+ case UPDATE_QUANTITY_SUCCESS:
136
+ case SUBSCRIPTIONS_POLL_TASK_SUCCESS:
137
+ return state
138
+ .set('task', action.response);
147
139
 
148
- case RESET_TASKS: {
149
- return state.set('tasks', []);
150
- }
140
+ case DELETE_SUBSCRIPTIONS_SUCCESS:
141
+ return state
142
+ .set('task', action.response)
143
+ .set('deleteButtonDisabled', true);
144
+
145
+ case SUBSCRIPTIONS_RESET_TASKS:
146
+ case SUBSCRIPTIONS_TASK_SEARCH_FAILURE:
147
+ case SUBSCRIPTIONS_POLL_TASK_FAILURE:
148
+ return state
149
+ .set('task', null);
151
150
 
152
151
  case GET_SETTING_SUCCESS: {
153
152
  if (action.response.name === 'content_disconnected') {
@@ -165,11 +164,6 @@ export default (state = initialState, action) => {
165
164
  case SUBSCRIPTIONS_CLOSE_DELETE_MODAL:
166
165
  return state.set('deleteModalOpened', false);
167
166
 
168
- case SUBSCRIPTIONS_OPEN_TASK_MODAL:
169
- return state.set('taskModalOpened', true);
170
- case SUBSCRIPTIONS_CLOSE_TASK_MODAL:
171
- return state.set('taskModalOpened', false);
172
-
173
167
  case SUBSCRIPTIONS_DISABLE_DELETE_BUTTON:
174
168
  return state.set('deleteButtonDisabled', true);
175
169
  case SUBSCRIPTIONS_ENABLE_DELETE_BUTTON: