foreman_scc_manager 1.8.20 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -10
  3. data/app/controllers/api/v2/scc_accounts_controller.rb +47 -4
  4. data/app/controllers/api/v2/scc_products_controller.rb +1 -1
  5. data/app/controllers/scc_accounts_controller.rb +47 -0
  6. data/app/lib/actions/scc_manager/subscribe_product.rb +51 -15
  7. data/app/models/scc_account.rb +1 -1
  8. data/app/views/scc_accounts/show.html.erb +7 -51
  9. data/config/routes.rb +1 -0
  10. data/db/migrate/20220429102717_populate_scc_katello_repositories.rb +5 -0
  11. data/db/migrate/20220531120722_add_product_category_to_scc_products.rb +5 -0
  12. data/lib/foreman_scc_manager/engine.rb +1 -1
  13. data/lib/foreman_scc_manager/version.rb +1 -1
  14. data/lib/tasks/republish_repositories.rake +13 -0
  15. data/package.json +54 -0
  16. data/test/controllers/scc_accounts_controller_test.rb +6 -0
  17. data/webpack/components/SCCProductPage/EmptySccProducts.js +46 -0
  18. data/webpack/components/SCCProductPage/SCCProductPage.js +96 -0
  19. data/webpack/components/SCCProductPage/SCCProductPageActions.js +27 -0
  20. data/webpack/components/SCCProductPage/SCCProductPageConstants.js +5 -0
  21. data/webpack/components/SCCProductPage/SCCProductPageReducer.js +34 -0
  22. data/webpack/components/SCCProductPage/SCCProductPageSelectors.js +7 -0
  23. data/webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCGenericPicker/index.js +80 -0
  24. data/webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCTreePicker/components/SCCRepoPicker/index.js +174 -0
  25. data/webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCTreePicker/components/SCCRepoPicker/styles.scss +3 -0
  26. data/webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCTreePicker/index.js +303 -0
  27. data/webpack/components/SCCProductPage/components/SCCProductPicker/index.js +235 -0
  28. data/webpack/components/SCCProductPage/components/SCCProductPicker/styles.scss +10 -0
  29. data/webpack/components/SCCProductPage/components/SCCProductPickerModal/index.js +81 -0
  30. data/webpack/components/SCCProductPage/components/SCCProductView/components/SCCRepoView/index.js +113 -0
  31. data/webpack/components/SCCProductPage/components/SCCProductView/components/SCCRepoView/styles.scss +14 -0
  32. data/webpack/components/SCCProductPage/components/SCCProductView/index.js +236 -0
  33. data/webpack/components/SCCProductPage/components/common/SCCGenericExpander/index.js +58 -0
  34. data/webpack/components/SCCProductPage/components/common/SCCProductTreeExpander/index.js +21 -0
  35. data/webpack/components/SCCProductPage/components/common/SCCSubscribedProductsExpander/index.js +21 -0
  36. data/webpack/components/SCCProductPage/index.js +18 -0
  37. data/webpack/components/SCCProductPage/sccProductPage.scss +8 -0
  38. data/webpack/index.js +11 -0
  39. data/webpack/reducer.js +7 -0
  40. metadata +40 -14
@@ -0,0 +1,58 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Flex, FlexItem, Select, SelectOption } from '@patternfly/react-core';
4
+
5
+ const SCCGenericExpander = ({
6
+ setInParent,
7
+ selectOptionOpen,
8
+ selectOptionClose,
9
+ initLabel,
10
+ }) => {
11
+ const [label, setLabel] = useState(initLabel);
12
+ const [isOpen, setIsOpen] = useState(false);
13
+
14
+ const options = [
15
+ <SelectOption key={0} value={selectOptionOpen} />,
16
+ <SelectOption key={1} value={selectOptionClose} />,
17
+ ];
18
+
19
+ const onSelect = (evt, selection) => {
20
+ if (selection === selectOptionOpen) {
21
+ setInParent(true);
22
+ } else {
23
+ setInParent(false);
24
+ }
25
+ setLabel(selection);
26
+ setIsOpen(false);
27
+ };
28
+
29
+ const onToggle = (isOpenSelect) => {
30
+ setIsOpen(isOpenSelect);
31
+ };
32
+
33
+ return (
34
+ <Flex>
35
+ <FlexItem>
36
+ <Select
37
+ onToggle={onToggle}
38
+ onSelect={onSelect}
39
+ selections={label}
40
+ isOpen={isOpen}
41
+ >
42
+ {options}
43
+ </Select>
44
+ </FlexItem>
45
+ </Flex>
46
+ );
47
+ };
48
+
49
+ SCCGenericExpander.propTypes = {
50
+ setInParent: PropTypes.func.isRequired,
51
+ selectOptionOpen: PropTypes.string.isRequired,
52
+ selectOptionClose: PropTypes.string.isRequired,
53
+ initLabel: PropTypes.string.isRequired,
54
+ };
55
+
56
+ SCCGenericExpander.deaultProps = {};
57
+
58
+ export default SCCGenericExpander;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { translate as __ } from 'foremanReact/common/I18n';
4
+ import SCCGenericExpander from '../SCCGenericExpander';
5
+
6
+ const SCCProductTreeExpander = ({ setExpandAllInParent }) => (
7
+ <SCCGenericExpander
8
+ setInParent={setExpandAllInParent}
9
+ selectOptionOpen={__('Expand products')}
10
+ selectOptionClose={__('Collapse products')}
11
+ initLabel={__('Collapse/Expand')}
12
+ />
13
+ );
14
+
15
+ SCCProductTreeExpander.propTypes = {
16
+ setExpandAllInParent: PropTypes.func.isRequired,
17
+ };
18
+
19
+ SCCProductTreeExpander.defaultProps = {};
20
+
21
+ export default SCCProductTreeExpander;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { translate as __ } from 'foremanReact/common/I18n';
4
+ import SCCGenericExpander from '../SCCGenericExpander';
5
+
6
+ const SCCSubscribedProductsExpander = ({ setExpandAllInParent }) => (
7
+ <SCCGenericExpander
8
+ setInParent={setExpandAllInParent}
9
+ selectOptionOpen={__('Show all products')}
10
+ selectOptionClose={__('Show only subscribed products')}
11
+ initLabel={__('Show/Hide unsubscribed')}
12
+ />
13
+ );
14
+
15
+ SCCSubscribedProductsExpander.propTypes = {
16
+ setExpandAllInParent: PropTypes.func.isRequired,
17
+ };
18
+
19
+ SCCSubscribedProductsExpander.defaultProps = {};
20
+
21
+ export default SCCSubscribedProductsExpander;
@@ -0,0 +1,18 @@
1
+ import { bindActionCreators } from 'redux';
2
+ import { connect } from 'react-redux';
3
+
4
+ import * as actions from './SCCProductPageActions';
5
+ import SCCProductPage from './SCCProductPage';
6
+ import * as Selector from './SCCProductPageSelectors';
7
+
8
+ // map state to props
9
+ const mapStateToProps = (state) => ({
10
+ scc_products: Selector.selectSCCProducts(state),
11
+ scc_account_id: Selector.selectSCCAccountId(state),
12
+ });
13
+
14
+ // map action dispatchers to props
15
+ const mapDispatchToProps = (dispatch) => bindActionCreators(actions, dispatch);
16
+
17
+ // export connected component
18
+ export default connect(mapStateToProps, mapDispatchToProps)(SCCProductPage);
@@ -0,0 +1,8 @@
1
+ @import '~@theforeman/vendor/scss/variables';
2
+
3
+ .pf-c-tile {
4
+ --pf-c-tile--PaddingTop: var(--pf-global--spacer--xs);
5
+ --pf-c-tile--PaddingRight: var(--pf-global--spacer--xs);
6
+ --pf-c-tile--PaddingBottom: var(--pf-global--spacer--xs);
7
+ --pf-c-tile--PaddingLeft: var(--pf-global--spacer--xs);
8
+ }
data/webpack/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import componentRegistry from 'foremanReact/components/componentRegistry';
2
+ import injectReducer from 'foremanReact/redux/reducers/registerReducer';
3
+ import SCCProductPage from './components/SCCProductPage';
4
+ import reducer from './reducer';
5
+
6
+ componentRegistry.register({
7
+ name: 'SCCProductPage',
8
+ type: SCCProductPage,
9
+ });
10
+
11
+ injectReducer('foremanSccManager', reducer);
@@ -0,0 +1,7 @@
1
+ import { combineReducers } from 'redux';
2
+
3
+ import SCCProductPageReducer from './components/SCCProductPage/SCCProductPageReducer';
4
+
5
+ export default combineReducers({
6
+ SCCProductPageReducer,
7
+ });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_scc_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.20
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ATIX AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-02 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -170,9 +170,11 @@ files:
170
170
  - db/migrate/20220429100843_remove_root_repository_id_from_scc_repository.rb
171
171
  - db/migrate/20220429102717_populate_scc_katello_repositories.rb
172
172
  - db/migrate/20220513132652_populate_upstream_authentication_token.rb
173
+ - db/migrate/20220531120722_add_product_category_to_scc_products.rb
173
174
  - lib/foreman_scc_manager.rb
174
175
  - lib/foreman_scc_manager/engine.rb
175
176
  - lib/foreman_scc_manager/version.rb
177
+ - lib/tasks/republish_repositories.rake
176
178
  - lib/tasks/rubocop.rake
177
179
  - lib/tasks/setup_authentication_token.rake
178
180
  - lib/tasks/test.rake
@@ -184,6 +186,7 @@ files:
184
186
  - locale/en/foreman_scc_manager.po
185
187
  - locale/foreman_scc_manager.pot
186
188
  - locale/gemspec.rb
189
+ - package.json
187
190
  - test/actions/sync_test.rb
188
191
  - test/controllers/api/v2/scc_accounts_test.rb
189
192
  - test/controllers/api/v2/scc_products_test.rb
@@ -203,6 +206,29 @@ files:
203
206
  - test/support/fixtures_support.rb
204
207
  - test/test_plugin_helper.rb
205
208
  - test/unit/foreman_scc_manager_test.rb
209
+ - webpack/components/SCCProductPage/EmptySccProducts.js
210
+ - webpack/components/SCCProductPage/SCCProductPage.js
211
+ - webpack/components/SCCProductPage/SCCProductPageActions.js
212
+ - webpack/components/SCCProductPage/SCCProductPageConstants.js
213
+ - webpack/components/SCCProductPage/SCCProductPageReducer.js
214
+ - webpack/components/SCCProductPage/SCCProductPageSelectors.js
215
+ - webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCGenericPicker/index.js
216
+ - webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCTreePicker/components/SCCRepoPicker/index.js
217
+ - webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCTreePicker/components/SCCRepoPicker/styles.scss
218
+ - webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCTreePicker/index.js
219
+ - webpack/components/SCCProductPage/components/SCCProductPicker/index.js
220
+ - webpack/components/SCCProductPage/components/SCCProductPicker/styles.scss
221
+ - webpack/components/SCCProductPage/components/SCCProductPickerModal/index.js
222
+ - webpack/components/SCCProductPage/components/SCCProductView/components/SCCRepoView/index.js
223
+ - webpack/components/SCCProductPage/components/SCCProductView/components/SCCRepoView/styles.scss
224
+ - webpack/components/SCCProductPage/components/SCCProductView/index.js
225
+ - webpack/components/SCCProductPage/components/common/SCCGenericExpander/index.js
226
+ - webpack/components/SCCProductPage/components/common/SCCProductTreeExpander/index.js
227
+ - webpack/components/SCCProductPage/components/common/SCCSubscribedProductsExpander/index.js
228
+ - webpack/components/SCCProductPage/index.js
229
+ - webpack/components/SCCProductPage/sccProductPage.scss
230
+ - webpack/index.js
231
+ - webpack/reducer.js
206
232
  homepage: https://www.orcharhino.com/
207
233
  licenses:
208
234
  - GPL-3.0
@@ -222,27 +248,27 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
248
  - !ruby/object:Gem::Version
223
249
  version: '0'
224
250
  requirements: []
225
- rubygems_version: 3.1.2
251
+ rubygems_version: 3.2.5
226
252
  signing_key:
227
253
  specification_version: 4
228
254
  summary: Suse Customer Center plugin for Foreman
229
255
  test_files:
230
- - test/support/fixtures_support.rb
231
- - test/unit/foreman_scc_manager_test.rb
232
- - test/actions/sync_test.rb
233
- - test/test_plugin_helper.rb
234
- - test/factories/foreman_scc_manager_factories.rb
235
256
  - test/models/scc_product_test.rb
236
257
  - test/models/scc_account_test.rb
237
- - test/features/sync_test.rb
238
- - test/fixtures/models/scc_repositories.yml
258
+ - test/controllers/scc_accounts_controller_test.rb
259
+ - test/controllers/api/v2/scc_accounts_test.rb
260
+ - test/controllers/api/v2/scc_products_test.rb
239
261
  - test/fixtures/models/katello_root_repositories.yml
240
262
  - test/fixtures/models/scc_accounts.yml
241
263
  - test/fixtures/models/scc_products.yml
264
+ - test/fixtures/models/scc_repositories.yml
265
+ - test/fixtures/files/data_products_page2.json
242
266
  - test/fixtures/files/data_products_page1.json
243
267
  - test/fixtures/files/data_subscriptions.json
244
- - test/fixtures/files/data_products_page2.json
245
268
  - test/fixtures/files/data_repositories.json
246
- - test/controllers/scc_accounts_controller_test.rb
247
- - test/controllers/api/v2/scc_products_test.rb
248
- - test/controllers/api/v2/scc_accounts_test.rb
269
+ - test/features/sync_test.rb
270
+ - test/unit/foreman_scc_manager_test.rb
271
+ - test/actions/sync_test.rb
272
+ - test/support/fixtures_support.rb
273
+ - test/factories/foreman_scc_manager_factories.rb
274
+ - test/test_plugin_helper.rb