katello 3.7.0 → 3.7.1

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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/common/index.js +1 -0
  3. data/app/assets/javascripts/katello/sync_management/index.js +1 -0
  4. data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -5
  5. data/app/controllers/katello/remote_execution_controller.rb +6 -6
  6. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +37 -9
  7. data/app/lib/actions/katello/host/hypervisors_update.rb +82 -22
  8. data/app/lib/actions/pulp/consumer/abstract_content_action.rb +12 -0
  9. data/app/lib/actions/pulp/consumer/content_install.rb +1 -1
  10. data/app/lib/actions/pulp/consumer/content_uninstall.rb +1 -1
  11. data/app/lib/actions/pulp/consumer/content_update.rb +1 -1
  12. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -1
  13. data/app/models/katello/content_view.rb +12 -4
  14. data/app/models/katello/glue/candlepin/pool.rb +11 -11
  15. data/app/models/katello/host/content_facet.rb +2 -1
  16. data/app/models/katello/rpm.rb +14 -6
  17. data/app/models/katello/subscription_status.rb +1 -1
  18. data/app/services/katello/candlepin/consumer.rb +8 -0
  19. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +2 -3
  20. data/config/routes.rb +1 -0
  21. data/db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb +3 -0
  22. data/db/seeds.d/75-job_templates.rb +5 -2
  23. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +4 -3
  24. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +4 -1
  25. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages-installed.controller.js +1 -1
  26. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery-create.html +1 -1
  27. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +5 -0
  28. data/lib/katello/tasks/clean_backend_objects.rake +12 -3
  29. data/lib/katello/version.rb +1 -1
  30. data/package.json +10 -7
  31. data/webpack/__mocks__/foremanReact/redux.js +3 -0
  32. data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +2 -0
  33. data/webpack/components/Search/Search.test.js +3 -1
  34. data/webpack/components/SelectOrg/SelectOrg.scss +3 -0
  35. data/webpack/components/SelectOrg/SelectOrgAction.js +41 -0
  36. data/webpack/components/SelectOrg/SelectOrgReducer.js +33 -0
  37. data/webpack/components/SelectOrg/SetOrganization.js +116 -0
  38. data/webpack/components/WithOrganization/withOrganization.js +28 -0
  39. data/webpack/containers/Application/config.js +9 -2
  40. data/webpack/containers/Application/index.js +4 -2
  41. data/webpack/global_test_setup.js +6 -0
  42. data/webpack/helpers/caret.js +6 -0
  43. data/webpack/move_to_foreman/components/common/{emptyState → EmptyState}/index.js +16 -3
  44. data/webpack/move_to_foreman/components/common/table/components/Table.js +1 -1
  45. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +2 -2
  46. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionCell.test.js.snap +1 -1
  47. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +1 -1
  48. data/webpack/move_to_pf/LoadingState/LoadingState.js +27 -14
  49. data/webpack/move_to_pf/LoadingState/LoadingState.test.js +8 -4
  50. data/webpack/move_to_pf/Select/Select.js +40 -0
  51. data/webpack/move_to_pf/react-bootstrap-select/index.js +12 -1
  52. data/webpack/redux/actions/RedHatRepositories/enabled.js +0 -1
  53. data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
  54. data/webpack/redux/consts.js +6 -0
  55. data/webpack/redux/reducers/index.js +2 -0
  56. data/webpack/scenes/Products/ProductActions.js +24 -0
  57. data/webpack/scenes/Products/ProductConstants.js +3 -0
  58. data/webpack/scenes/Products/__tests__/ProductActions.test.js +40 -0
  59. data/webpack/scenes/Products/__tests__/products.fixtures.js +90 -0
  60. data/webpack/scenes/RedHatRepositories/components/EnabledRepository.js +14 -23
  61. data/webpack/scenes/RedHatRepositories/components/EnabledRepositoryContent.js +34 -0
  62. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository.js +1 -1
  63. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +1 -0
  64. data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepository.test.js +36 -0
  65. data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepositoryContent.test.js +27 -0
  66. data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepository.test.js.snap +25 -0
  67. data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepositoryContent.test.js.snap +47 -0
  68. data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RecommendedRepositorySetsToggler.test.js.snap +3 -1
  69. data/webpack/scenes/RedHatRepositories/index.js +7 -3
  70. data/webpack/scenes/RedHatRepositories/index.scss +1 -0
  71. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +1 -1
  72. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailEnabledProducts.js +54 -0
  73. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js +29 -0
  74. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js +29 -0
  75. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +67 -22
  76. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.scss +9 -0
  77. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailEnabledProducts.test.js +18 -0
  78. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailProduct.test.js +13 -0
  79. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +6 -0
  80. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailEnabledProducts.test.js.snap +45 -0
  81. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProduct.test.js.snap +67 -0
  82. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +497 -410
  83. data/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js +4 -0
  84. data/webpack/scenes/Subscriptions/Details/index.js +3 -1
  85. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +78 -34
  86. data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryReducer.js +8 -0
  87. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +3 -0
  88. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +34 -7
  89. data/webpack/scenes/Subscriptions/Manifest/index.js +1 -0
  90. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +1 -0
  91. data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +3 -0
  92. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +6 -2
  93. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +31 -36
  94. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +2 -7
  95. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +1 -1
  96. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +3 -6
  97. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +2 -0
  98. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +14 -2
  99. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +4 -3
  100. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js +8 -5
  101. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +29 -19
  102. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +9 -2
  103. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +2 -2
  104. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/EntitlementsInlineEditFormatter.test.js +110 -0
  105. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +15 -3
  106. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/EntitlementsInlineEditFormatter.test.js.snap +228 -0
  107. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +54 -21
  108. data/webpack/scenes/Subscriptions/index.js +1 -0
  109. data/webpack/scenes/Tasks/helpers.js +52 -0
  110. data/webpack/services/api/index.js +17 -1
  111. data/webpack/test_setup.js +2 -0
  112. metadata +31 -4
  113. data/config/katello.yaml +0 -89
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
- import { render } from 'enzyme';
2
+ import { render, mount } from 'enzyme';
3
3
  import toJson from 'enzyme-to-json';
4
4
  import { MemoryRouter } from 'react-router-dom';
5
5
  import SubscriptionsTable from '../SubscriptionsTable';
6
6
  import { successState, loadingState, emptyState } from '../../../__tests__/subscriptions.fixtures';
7
7
  import { loadSubscriptions, updateQuantity } from '../../../SubscriptionActions';
8
8
 
9
+ jest.mock('../../../../../move_to_foreman/foreman_toast_notifications');
10
+ jest.useFakeTimers();
9
11
  describe('subscriptions table', () => {
10
12
  it('should render a table', async () => {
11
13
  // Wrapping SubscriptionTable in MemoryRouter here since it contains
@@ -20,17 +22,23 @@ describe('subscriptions table', () => {
20
22
  onSubscriptionDeleteModalClose={() => { }}
21
23
  onDeleteSubscriptions={() => {}}
22
24
  toggleDeleteButton={() => {}}
25
+ emptyState={{}}
23
26
  />
24
27
  </MemoryRouter>);
25
28
  expect(toJson(page)).toMatchSnapshot();
26
29
  });
27
- /* eslint-enable react/jsx-indent */
28
30
 
29
31
  it('should render an empty state', async () => {
32
+ const emptyStateData = {
33
+ header: __('Yay empty state'),
34
+ description: __('There is nothing to see here'),
35
+ };
36
+
30
37
  /* eslint-disable react/jsx-indent */
31
38
  const page = render(<MemoryRouter>
32
39
  <SubscriptionsTable
33
40
  subscriptions={emptyState}
41
+ emptyState={emptyStateData}
34
42
  loadSubscriptions={loadSubscriptions}
35
43
  updateQuantity={updateQuantity}
36
44
  subscriptionDeleteModalOpen={false}
@@ -41,9 +49,10 @@ describe('subscriptions table', () => {
41
49
  </MemoryRouter>);
42
50
  expect(toJson(page)).toMatchSnapshot();
43
51
  });
52
+ /* eslint-enable react/jsx-indent */
44
53
 
45
54
  it('should render a loading state', async () => {
46
- const page = render(<SubscriptionsTable
55
+ const page = mount(<SubscriptionsTable
47
56
  subscriptions={loadingState}
48
57
  loadSubscriptions={loadSubscriptions}
49
58
  updateQuantity={updateQuantity}
@@ -51,7 +60,10 @@ describe('subscriptions table', () => {
51
60
  onSubscriptionDeleteModalClose={() => { }}
52
61
  onDeleteSubscriptions={() => {}}
53
62
  toggleDeleteButton={() => {}}
63
+ emptyState={{}}
54
64
  />);
65
+ jest.runAllTimers();
66
+ page.update();
55
67
  expect(toJson(page)).toMatchSnapshot();
56
68
  });
57
69
  });
@@ -0,0 +1,228 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`EntitlementsInlineEditFormatter edit mode when available quantities are being loaded renders spinner 1`] = `
4
+ <td
5
+ className="editable editing"
6
+ >
7
+ <Spinner
8
+ className=""
9
+ inline={false}
10
+ inverse={false}
11
+ loading={true}
12
+ size="xs"
13
+ >
14
+ <FormGroup
15
+ bsClass="form-group"
16
+ >
17
+ <FormControl
18
+ bsClass="form-control"
19
+ componentClass="input"
20
+ defaultValue={100}
21
+ onBlur={[Function]}
22
+ type="text"
23
+ />
24
+ <HelpBlock
25
+ bsClass="help-block"
26
+ >
27
+ <div
28
+ className="validationMessages"
29
+ />
30
+ </HelpBlock>
31
+ </FormGroup>
32
+ </Spinner>
33
+ </td>
34
+ `;
35
+
36
+ exports[`EntitlementsInlineEditFormatter edit mode when available quantities are loaded renders changed values 1`] = `
37
+ <td
38
+ className="editable editing changed"
39
+ >
40
+ <Spinner
41
+ className=""
42
+ inline={false}
43
+ inverse={false}
44
+ loading={false}
45
+ size="xs"
46
+ >
47
+ <FormGroup
48
+ bsClass="form-group"
49
+ >
50
+ <FormControl
51
+ bsClass="form-control"
52
+ componentClass="input"
53
+ defaultValue={100}
54
+ onBlur={[Function]}
55
+ type="text"
56
+ />
57
+ <HelpBlock
58
+ bsClass="help-block"
59
+ >
60
+ Max 200
61
+ <div
62
+ className="validationMessages"
63
+ />
64
+ </HelpBlock>
65
+ </FormGroup>
66
+ </Spinner>
67
+ </td>
68
+ `;
69
+
70
+ exports[`EntitlementsInlineEditFormatter edit mode when available quantities are loaded renders edit field and max available 1`] = `
71
+ <td
72
+ className="editable editing"
73
+ >
74
+ <Spinner
75
+ className=""
76
+ inline={false}
77
+ inverse={false}
78
+ loading={false}
79
+ size="xs"
80
+ >
81
+ <FormGroup
82
+ bsClass="form-group"
83
+ >
84
+ <FormControl
85
+ bsClass="form-control"
86
+ componentClass="input"
87
+ defaultValue={100}
88
+ onBlur={[Function]}
89
+ type="text"
90
+ />
91
+ <HelpBlock
92
+ bsClass="help-block"
93
+ >
94
+ Max 500
95
+ <div
96
+ className="validationMessages"
97
+ />
98
+ </HelpBlock>
99
+ </FormGroup>
100
+ </Spinner>
101
+ </td>
102
+ `;
103
+
104
+ exports[`EntitlementsInlineEditFormatter edit mode when available quantities are loaded renders edit field and unlimited message 1`] = `
105
+ <td
106
+ className="editable editing"
107
+ >
108
+ <Spinner
109
+ className=""
110
+ inline={false}
111
+ inverse={false}
112
+ loading={false}
113
+ size="xs"
114
+ >
115
+ <FormGroup
116
+ bsClass="form-group"
117
+ >
118
+ <FormControl
119
+ bsClass="form-control"
120
+ componentClass="input"
121
+ defaultValue={100}
122
+ onBlur={[Function]}
123
+ type="text"
124
+ />
125
+ <HelpBlock
126
+ bsClass="help-block"
127
+ >
128
+ Unlimited
129
+ <div
130
+ className="validationMessages"
131
+ />
132
+ </HelpBlock>
133
+ </FormGroup>
134
+ </Spinner>
135
+ </td>
136
+ `;
137
+
138
+ exports[`EntitlementsInlineEditFormatter edit mode when available quantities are loaded renders validation message 1`] = `
139
+ <td
140
+ className="editable editing"
141
+ >
142
+ <Spinner
143
+ className=""
144
+ inline={false}
145
+ inverse={false}
146
+ loading={false}
147
+ size="xs"
148
+ >
149
+ <FormGroup
150
+ bsClass="form-group"
151
+ validationState="error"
152
+ >
153
+ <FormControl
154
+ bsClass="form-control"
155
+ componentClass="input"
156
+ defaultValue={200}
157
+ onBlur={[Function]}
158
+ type="text"
159
+ />
160
+ <HelpBlock
161
+ bsClass="help-block"
162
+ >
163
+ Max 100
164
+ <div
165
+ className="validationMessages"
166
+ >
167
+ Exceeds available quantity
168
+ </div>
169
+ </HelpBlock>
170
+ </FormGroup>
171
+ </Spinner>
172
+ </td>
173
+ `;
174
+
175
+ exports[`EntitlementsInlineEditFormatter edit mode when available quantities failed to load renders just the edit field 1`] = `
176
+ <td
177
+ className="editable editing"
178
+ >
179
+ <Spinner
180
+ className=""
181
+ inline={false}
182
+ inverse={false}
183
+ loading={false}
184
+ size="xs"
185
+ >
186
+ <FormGroup
187
+ bsClass="form-group"
188
+ >
189
+ <FormControl
190
+ bsClass="form-control"
191
+ componentClass="input"
192
+ defaultValue={200}
193
+ onBlur={[Function]}
194
+ type="text"
195
+ />
196
+ <HelpBlock
197
+ bsClass="help-block"
198
+ >
199
+ <div
200
+ className="validationMessages"
201
+ />
202
+ </HelpBlock>
203
+ </FormGroup>
204
+ </Spinner>
205
+ </td>
206
+ `;
207
+
208
+ exports[`EntitlementsInlineEditFormatter value mode renders the value 1`] = `
209
+ <td
210
+ className="editable"
211
+ >
212
+ <div
213
+ className="input"
214
+ onClick={[Function]}
215
+ onKeyPress={[Function]}
216
+ role="textbox"
217
+ tabIndex={0}
218
+ >
219
+ 200
220
+ </div>
221
+ </td>
222
+ `;
223
+
224
+ exports[`EntitlementsInlineEditFormatter value mode renders unlimited for -1 1`] = `
225
+ <td>
226
+ Unlimited
227
+ </td>
228
+ `;
@@ -1,16 +1,59 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`subscriptions table should render a loading state 1`] = `
4
- <div
5
- class="loading-state"
4
+ <SubscriptionsTable
5
+ emptyState={Object {}}
6
+ loadSubscriptions={[Function]}
7
+ onDeleteSubscriptions={[Function]}
8
+ onSubscriptionDeleteModalClose={[Function]}
9
+ subscriptionDeleteModalOpen={false}
10
+ subscriptions={
11
+ Object {
12
+ "availableQuantities": null,
13
+ "itemCount": 0,
14
+ "loading": true,
15
+ "pagination": Object {
16
+ "page": 0,
17
+ "perPage": 20,
18
+ },
19
+ "quantitiesLoading": false,
20
+ "results": Array [],
21
+ "tasks": Array [],
22
+ }
23
+ }
24
+ task={
25
+ Object {
26
+ "humanized": Object {},
27
+ }
28
+ }
29
+ toggleDeleteButton={[Function]}
30
+ updateQuantity={[Function]}
6
31
  >
7
- <div
8
- class="spinner spinner-lg"
9
- />
10
- <p>
11
- Loading
12
- </p>
13
- </div>
32
+ <LoadingState
33
+ loading={true}
34
+ loadingText="Loading"
35
+ timeout={300}
36
+ >
37
+ <div
38
+ className="loading-state"
39
+ >
40
+ <Spinner
41
+ className=""
42
+ inline={false}
43
+ inverse={false}
44
+ loading={true}
45
+ size="lg"
46
+ >
47
+ <div
48
+ className="spinner spinner-lg"
49
+ />
50
+ </Spinner>
51
+ <p>
52
+ Loading
53
+ </p>
54
+ </div>
55
+ </LoadingState>
56
+ </SubscriptionsTable>
14
57
  `;
15
58
 
16
59
  exports[`subscriptions table should render a table 1`] = `
@@ -403,22 +446,12 @@ exports[`subscriptions table should render an empty state 1`] = `
403
446
  <h4
404
447
  class="h1 blank-slate-pf-title"
405
448
  >
406
- There are no Subscriptions to display
449
+ Yay empty state
407
450
  </h4>
408
451
  <p
409
452
  class="blank-slate-pf-info"
410
453
  >
411
- Add Subscriptions to this Allocation to manage your Entitlements.
454
+ There is nothing to see here
412
455
  </p>
413
- <div
414
- class="blank-slate-pf-main-action"
415
- >
416
- <a
417
- class="btn btn-lg btn-primary"
418
- href="subscriptions/add"
419
- >
420
- Add Subscriptions
421
- </a>
422
- </div>
423
456
  </div>
424
457
  `;
@@ -11,6 +11,7 @@ import SubscriptionsPage from './SubscriptionsPage';
11
11
 
12
12
  // map state to props
13
13
  const mapStateToProps = state => ({
14
+ organization: state.katello.organization,
14
15
  subscriptions: state.katello.subscriptions,
15
16
  tasks: state.katello.subscriptions.tasks,
16
17
  });
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import ReactDOMServer from 'react-dom/server';
3
+ import { sprintf } from 'jed';
4
+ import helpers from '../../move_to_foreman/common/helpers';
5
+ import { notify } from '../../move_to_foreman/foreman_toast_notifications';
6
+
7
+ const getErrors = task => (
8
+ <ul>
9
+ {task.humanized.errors.map(error => (
10
+ <li key={error}> {error} </li>
11
+ ))}
12
+ </ul>
13
+ );
14
+
15
+ export const renderTaskStartedToast = (task) => {
16
+ const message = (
17
+ <span>
18
+ <span>
19
+ {sprintf('Task %s has started.', task.humanized.action)}
20
+ {' '}
21
+ </span>
22
+ <a href={helpers.urlBuilder('foreman_tasks/tasks', '', task.id)}>
23
+ {__('Click here to go to the tasks page for the task.')}
24
+ </a>
25
+ </span>
26
+ );
27
+
28
+ notify({
29
+ message: ReactDOMServer.renderToStaticMarkup(message),
30
+ type: 'info',
31
+ });
32
+ };
33
+
34
+ export const renderTaskFinishedToast = (task) => {
35
+ const message = (
36
+ <span>
37
+ <span>
38
+ {`${__(`Task ${task.humanized.action} completed with a result of ${task.result}.`)}`}
39
+ {' '}
40
+ </span>
41
+ {task.errors ? getErrors(task) : ''}
42
+ <a href={helpers.urlBuilder('foreman_tasks/tasks', '', task.id)}>
43
+ {__('Click here to go to the tasks page for the task.')}
44
+ </a>
45
+ </span>
46
+ );
47
+
48
+ notify({
49
+ message: ReactDOMServer.renderToStaticMarkup(message),
50
+ type: task.result,
51
+ });
52
+ };
@@ -1,5 +1,6 @@
1
1
  import axios from 'axios';
2
2
  import Immutable from 'seamless-immutable';
3
+ import store from 'foremanReact/redux';
3
4
 
4
5
  const getcsrfToken = () => {
5
6
  const token = document.querySelector('meta[name="csrf-token"]');
@@ -99,7 +100,22 @@ class ForemanTasksApi extends Api {
99
100
 
100
101
  export const foremanTasksApi = new ForemanTasksApi();
101
102
 
103
+ class ForemanEndpoint extends Api {
104
+ constructor() {
105
+ super();
106
+ this.baseApiPath = '/';
107
+ }
108
+ }
109
+
110
+ export const foremanEndpoint = new ForemanEndpoint();
111
+
102
112
  // eslint-disable-next-line import/prefer-default-export
103
113
  const orgNode = () => document.getElementById('organization-id');
104
114
  // This node does not exist while testing
105
- export const orgId = () => (orgNode() ? orgNode().dataset.id : '1');
115
+ export const orgId = () => {
116
+ const node = orgNode();
117
+ const id = node && node.dataset.id;
118
+ const { katello: { setOrganization: { currentId } } } = store.getState();
119
+
120
+ return id === '' ? currentId : id;
121
+ };