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
@@ -42,17 +42,17 @@ namespace :katello do
42
42
  def cleanup_hosts(cleaner)
43
43
  cleaner.hosts_with_nil_facets.each do |host|
44
44
  print "Host #{host.id} #{host.name} is partially missing subscription information. Un-registering\n"
45
- execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host, host_unregister_options(host)) }
45
+ execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host) }
46
46
  end
47
47
 
48
48
  cleaner.hosts_with_no_subscriptions.each do |host|
49
49
  print "Host #{host.id} #{host.name} #{host.subscription_facet.try(:uuid)} is partially missing subscription information. Un-registering\n"
50
- execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host, host_unregister_options(host)) }
50
+ execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host) }
51
51
  end
52
52
 
53
53
  cleaner.hosts_with_no_content.each do |host|
54
54
  print "Host #{host.id} #{host.name} #{host.content_facet.try(:uuid)} is partially missing content information. Un-registering\n"
55
- execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host, host_unregister_options(host)) }
55
+ execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host) }
56
56
  end
57
57
  end
58
58
 
@@ -72,15 +72,6 @@ namespace :katello do
72
72
  end
73
73
  end
74
74
 
75
- def host_unregister_options(host)
76
- if host.managed? || host.compute_resource
77
- print "Leaving provisioning record for #{host.name} in place, it is either managed or assigned to a compute resource."
78
- {:unregistering => true}
79
- else
80
- {}
81
- end
82
- end
83
-
84
75
  # rubocop:disable HandleExceptions
85
76
  def execute(error_msg)
86
77
  if ENV['COMMIT'] == 'true'
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.7.1.1".freeze
2
+ VERSION = "3.8.0.rc1".freeze
3
3
  end
data/package.json CHANGED
@@ -9,9 +9,7 @@
9
9
  "test:current": "jest webpack --watch",
10
10
  "format": "prettier --single-quote --trailing-comma es5 --write 'webpack/**/*.js'",
11
11
  "build": "npm run format && npm run lint",
12
- "lint": "eslint webpack/ || exit 0",
13
- "lint:fix": "eslint --fix webpack/ || exit 0",
14
- "lint:test": "npm run lint && npm test"
12
+ "lint": "eslint --fix webpack/ || exit 0"
15
13
  },
16
14
  "repository": {
17
15
  "type": "git",
@@ -24,11 +22,11 @@
24
22
  "@storybook/react": "^3.2.17",
25
23
  "@storybook/storybook-deployer": "^2.0.0",
26
24
  "babel-core": "^6.26.3",
27
- "babel-jest": "^23.4.0",
25
+ "babel-jest": "^21.2.0",
28
26
  "babel-plugin-transform-class-properties": "^6.24.1",
29
27
  "babel-plugin-transform-object-rest-spread": "^6.26.0",
30
- "babel-polyfill": "^6.26.0",
31
28
  "babel-preset-env": "^1.6.0",
29
+ "babel-polyfill": "^6.26.0",
32
30
  "babel-preset-react": "^6.24.1",
33
31
  "enzyme": "^3.2.0",
34
32
  "enzyme-adapter-react-16": "^1.1.0",
@@ -36,11 +34,11 @@
36
34
  "eslint": "^4.8.0",
37
35
  "eslint-config-airbnb": "^16.0.0",
38
36
  "eslint-plugin-import": "^2.7.0",
39
- "eslint-plugin-jest": "^21.18.0",
37
+ "eslint-plugin-jest": "^21.2.0",
40
38
  "eslint-plugin-jsx-a11y": "^6.0.2",
41
39
  "eslint-plugin-react": "^7.4.0",
42
40
  "identity-obj-proxy": "^3.0.0",
43
- "jest": "^23.4.1",
41
+ "jest": "^21.2.1",
44
42
  "prettier": "^1.7.4",
45
43
  "react-test-renderer": "^16.0.0",
46
44
  "redux-mock-store": "^1.3.0",
@@ -55,10 +53,10 @@
55
53
  "jed": "^1.1.1",
56
54
  "lodash": "^4.17.5",
57
55
  "patternfly": "^3.41.1",
58
- "patternfly-react": "^2.5.1",
56
+ "patternfly-react": "2.5.1",
59
57
  "prop-types": "^15.6.0",
60
58
  "react": "^16.3.1",
61
- "react-bootstrap": "^0.32.1",
59
+ "react-bootstrap": "^0.31.5",
62
60
  "react-bootstrap-tooltip-button": "^1.0.6",
63
61
  "react-dom": "^16.3.1",
64
62
  "react-ellipsis-with-tooltip": "^1.0.7",
@@ -74,7 +72,6 @@
74
72
  "raf/polyfill",
75
73
  "./webpack/test_setup.js"
76
74
  ],
77
- "setupTestFrameworkScriptFile": "./webpack/global_test_setup.js",
78
75
  "testPathIgnorePatterns": [
79
76
  "/node_modules/",
80
77
  "<rootDir>/foreman/",
@@ -1,19 +1,17 @@
1
1
  import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import toJson from 'enzyme-to-json';
4
- import { mock as mockApi } from '../../mockRequest';
5
4
 
6
5
  import Search from '../Search';
7
6
 
8
7
  describe('Search component', () => {
9
8
  const getBaseProps = () => ({
10
9
  onSearch: () => {},
11
- getAutoCompleteParams: () => ({ endpoint: '/fake' }),
10
+ getAutoCompleteParams: () => ({}),
12
11
  });
13
12
 
14
13
  describe('rendering', () => {
15
14
  it('renders correctly', () => {
16
- mockApi.onGet('/katello/api/v2/fake').reply(200, []);
17
15
  const component = shallow(<Search {...getBaseProps()} />);
18
16
 
19
17
  expect(toJson(component)).toMatchSnapshot();
@@ -2,32 +2,25 @@ import Repos from '../../scenes/RedHatRepositories';
2
2
  import Subscriptions from '../../scenes/Subscriptions';
3
3
  import UpstreamSubscriptions from '../../scenes/Subscriptions/UpstreamSubscriptions/index';
4
4
  import SubscriptionDetails from '../../scenes/Subscriptions/Details';
5
- import SetOrganization from '../../components/SelectOrg/SetOrganization';
6
- import WithOrganization from '../../components/WithOrganization/withOrganization';
7
5
 
8
6
  // eslint-disable-next-line import/prefer-default-export
9
7
  export const links = [
10
8
  {
11
9
  text: 'RH Repos',
12
10
  path: 'redhat_repositories',
13
- component: WithOrganization(Repos, '/redhat_repositories'),
11
+ component: Repos,
14
12
  },
15
13
  {
16
14
  text: 'RH Subscriptions',
17
15
  path: 'subscriptions',
18
- component: WithOrganization(Subscriptions, '/subscriptions'),
16
+ component: Subscriptions,
19
17
  },
20
18
  {
21
19
  path: 'subscriptions/add',
22
20
  component: UpstreamSubscriptions,
23
21
  },
24
22
  {
25
- // eslint-disable-next-line no-useless-escape
26
23
  path: 'subscriptions/:id(\[0-9]*$\)',
27
24
  component: SubscriptionDetails,
28
25
  },
29
- {
30
- path: 'organization_select',
31
- component: SetOrganization,
32
- },
33
26
  ];
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { BrowserRouter as Router } from 'react-router-dom';
4
4
  import { bindActionCreators } from 'redux';
5
5
  import { connect } from 'react-redux';
6
- import { orgId } from '../../services/api';
6
+
7
7
  import * as actions from '../../scenes/Organizations/OrganizationActions';
8
8
  import reducer from '../../scenes/Organizations/OrganizationReducer';
9
9
  import Routes from './Routes';
@@ -20,9 +20,7 @@ class Application extends Component {
20
20
  }
21
21
 
22
22
  loadData() {
23
- if (orgId()) {
24
- this.props.loadOrganization();
25
- }
23
+ this.props.loadOrganization();
26
24
  }
27
25
 
28
26
  render() {
@@ -2,7 +2,7 @@ import axios from 'axios';
2
2
  import MockAdapter from 'axios-mock-adapter';
3
3
 
4
4
  // TODO: figure out way to reuse this from foreman
5
- export const mock = new MockAdapter(axios);
5
+ const mock = new MockAdapter(axios);
6
6
  const methods = {
7
7
  GET: 'onGet',
8
8
  POST: 'onPost',
@@ -15,10 +15,10 @@ const errorResponse = msg => ({ displayMessage: msg });
15
15
  export const mockRequest = ({
16
16
  method = 'GET',
17
17
  url,
18
- data,
18
+ data = null,
19
19
  status = 200,
20
20
  response = null,
21
- }) => mock[methods[method.toUpperCase()]](url, data).reply(status, response);
21
+ }) => mock[methods[method]](url, data).reply(status, response);
22
22
 
23
23
  export const mockErrorRequest = ({
24
24
  status = 500,
@@ -1,41 +1,11 @@
1
- import { addToast } from 'foremanReact/redux/actions/toasts';
2
-
3
- const urlBuilder = (controller, action, id = undefined) =>
4
- `/${controller}/${id ? `${id}/` : ''}${action}`;
5
-
6
- const urlWithSearch = (base, searchQuery) =>
7
- `/${base}?search=${searchQuery}`;
8
-
9
- const stringIsInteger = (value) => {
10
- // checking for positive integers only
11
- const reg = new RegExp('^[0-9]+$');
12
- return reg.test(value);
13
- };
14
-
15
- export const getResponseErrorMsgs = ({ data }) => {
16
- if (data) {
17
- const messages = (data.errors || data.displayMessage || data.message || data.error);
18
- return (Array.isArray(messages) ? messages : [messages]);
19
- }
20
- return [];
21
- };
1
+ export default {
2
+ urlBuilder(controller, action, id = undefined) {
3
+ return `/${controller}/${id ? `${id}/` : ''}${action}`;
4
+ },
22
5
 
23
- export const apiError = (actionType, result) => (dispatch) => {
24
- const messages = getResponseErrorMsgs(result.response);
25
- dispatch({
26
- type: actionType,
27
- payload: {
28
- result,
29
- messages,
30
- },
31
- });
32
- messages.forEach((msg) => {
33
- dispatch(addToast({
34
- type: 'error',
35
- message: msg,
36
- sticky: true,
37
- }));
38
- });
6
+ urlWithSearch(base, searchQuery) {
7
+ return `/${base}?search=${searchQuery}`;
8
+ },
39
9
  };
40
10
 
41
11
  export const KEY_CODES = {
@@ -44,11 +14,4 @@ export const KEY_CODES = {
44
14
  ESCAPE_KEY: 27,
45
15
  };
46
16
 
47
- export default {
48
- urlBuilder,
49
- urlWithSearch,
50
- getResponseErrorMsgs,
51
- apiError,
52
- KEY_CODES,
53
- stringIsInteger,
54
- };
17
+ export const getResponseError = ({ data }) => data && (data.displayMessage || data.error);
@@ -13,7 +13,6 @@ const EmptyState = (props) => {
13
13
  documentationButton = __('Documentation'),
14
14
  docUrl,
15
15
  action,
16
- actionButton,
17
16
  secondayActions,
18
17
  } = props;
19
18
  const defaultDocumantion = `${documentationLabel} <a href=${docUrl}>${documentationButton}</a>`;
@@ -31,23 +30,11 @@ const EmptyState = (props) => {
31
30
  )}
32
31
  {action && (
33
32
  <PfEmptyState.Action>
34
- {action.url && (
35
- <LinkContainer to={action.url}>
36
- <Button href={action.url} bsStyle="primary" bsSize="large">
37
- {action.title}
38
- </Button>
39
- </LinkContainer>
40
- )}
41
- {action.onClick && (
42
- <Button onClick={action.onClick} bsStyle="primary" bsSize="large">
33
+ <LinkContainer to={action.url}>
34
+ <Button href={action.url} bsStyle="primary" bsSize="large">
43
35
  {action.title}
44
36
  </Button>
45
- )}
46
- </PfEmptyState.Action>
47
- )}
48
- {actionButton && (
49
- <PfEmptyState.Action>
50
- {actionButton}
37
+ </LinkContainer>
51
38
  </PfEmptyState.Action>
52
39
  )}
53
40
  {secondayActions && (
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Table as PfTable } from 'patternfly-react';
4
4
  import { noop } from 'foremanReact/common/helpers';
5
- import EmptyState from '../../EmptyState';
5
+ import EmptyState from '../../emptyState';
6
6
  import PaginationRow from '../../../../../components/PaginationRow/index';
7
7
 
8
8
  import TableBody from './TableBody';
@@ -4,7 +4,7 @@ exports[`CollapseSubscriptionGroupButton renders CollapseSubscriptionGroupButton
4
4
  <Icon
5
5
  className="collapse-subscription-group-button"
6
6
  name="angle-right"
7
- onClick={[MockFunction]}
7
+ onClick={[Function]}
8
8
  type="fa"
9
9
  />
10
10
  `;
@@ -13,7 +13,7 @@ exports[`CollapseSubscriptionGroupButton renders CollapseSubscriptionGroupButton
13
13
  <Icon
14
14
  className="collapse-subscription-group-button"
15
15
  name="angle-down"
16
- onClick={[MockFunction]}
16
+ onClick={[Function]}
17
17
  type="fa"
18
18
  />
19
19
  `;
@@ -9,7 +9,7 @@ exports[`TableSelectionCell renders TableSelectionCell 1`] = `
9
9
  checked={true}
10
10
  id="some id"
11
11
  label="some label"
12
- onChange={[MockFunction]}
12
+ onChange={[Function]}
13
13
  />
14
14
  some after
15
15
  </TableSelectionCell>
@@ -9,7 +9,7 @@ exports[`TableSelectionHeaderCell renders TableSelectionHeaderCell 1`] = `
9
9
  checked={true}
10
10
  id="some id"
11
11
  label="some label"
12
- onChange={[MockFunction]}
12
+ onChange={[Function]}
13
13
  />
14
14
  </TableSelectionHeading>
15
15
  `;
@@ -1,48 +1,35 @@
1
- import React, { Component } from 'react';
1
+ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Spinner } from 'patternfly-react';
4
4
  import './LoadingState.scss';
5
5
 
6
- class LoadingState extends Component {
7
- constructor(props) {
8
- super(props);
9
- this.state = {
10
- render: false,
11
- };
12
- }
13
-
14
- componentDidMount() {
15
- setTimeout(() => {
16
- this.setState({ render: true });
17
- }, this.props.timeout);
18
- }
19
-
20
- render() {
21
- const { loading, loadingText, children } = this.props;
22
- const spinner = (
6
+ const LoadingState = ({
7
+ loading,
8
+ loadingText,
9
+ children,
10
+ }) => {
11
+ if (loading) {
12
+ return (
23
13
  <div className="loading-state">
24
14
  <Spinner loading={loading} size="lg" />
25
15
  <p>{loadingText}</p>
26
- </div>);
27
-
28
- if (loading) {
29
- return this.state.render ? spinner : null;
30
- }
31
- return children;
16
+ </div>
17
+ );
32
18
  }
33
- }
19
+
20
+ return children;
21
+ };
22
+
34
23
  LoadingState.propTypes = {
35
24
  loading: PropTypes.bool,
36
25
  loadingText: PropTypes.string,
37
26
  children: PropTypes.node,
38
- timeout: PropTypes.number,
39
27
  };
40
28
 
41
29
  LoadingState.defaultProps = {
42
30
  loading: false,
43
31
  loadingText: __('Loading'),
44
32
  children: null,
45
- timeout: 300,
46
33
  };
47
34
 
48
35
  export default LoadingState;
@@ -6,7 +6,6 @@ import { shallow } from 'enzyme';
6
6
  import toJson from 'enzyme-to-json';
7
7
 
8
8
  import { LoadingState } from './index';
9
- jest.useFakeTimers();
10
9
 
11
10
  test('Loading State renders properly while loading', () => {
12
11
  const component = shallow(
@@ -14,10 +13,8 @@ test('Loading State renders properly while loading', () => {
14
13
  <p>Loading Complete</p>
15
14
  </LoadingState>
16
15
  );
17
- jest.runAllTimers();
18
- component.update();
19
- expect(component.state('render')).toEqual(true);
20
- expect(toJson(component.render())).toMatchSnapshot();
16
+
17
+ expect(toJson(component.render())).toMatchSnapshot();
21
18
  });
22
19
 
23
20
  test('Loading State renders properly while not loading', () => {
@@ -26,7 +23,6 @@ test('Loading State renders properly while not loading', () => {
26
23
  <p>Loading Complete</p>
27
24
  </LoadingState>
28
25
  );
29
- jest.runAllTimers();
30
- component.update();
31
- expect(toJson(component.render())).toMatchSnapshot();
26
+
27
+ expect(toJson(component.render())).toMatchSnapshot();
32
28
  });
@@ -3,7 +3,6 @@
3
3
  import React from 'react';
4
4
  import ReactDOM from 'react-dom';
5
5
  import { FormControl } from 'react-bootstrap';
6
- import PropTypes from 'prop-types';
7
6
 
8
7
  require('jquery');
9
8
  require('bootstrap-select');
@@ -53,10 +52,8 @@ class BootstrapSelect extends React.Component {
53
52
  render() {
54
53
  // TODO: these classes are required because foreman assumes that all selects should use select2 and jquery multiselect
55
54
  // TODO: see also http://projects.theforeman.org/issues/21952
56
- const { noneSelectedText } = this.props;
57
-
58
55
  return <FormControl {...this.props}
59
- data-none-selected-text={noneSelectedText}
56
+ data-none-selected-text={__('Nothing selected')}
60
57
  data-selected-text-format="count>3"
61
58
  data-count-selected-text={__('{0} items selected')}
62
59
  componentClass="select"
@@ -65,12 +62,4 @@ class BootstrapSelect extends React.Component {
65
62
  }
66
63
  }
67
64
 
68
- BootstrapSelect.propTypes = {
69
- noneSelectedText: PropTypes.string,
70
- }
71
-
72
- BootstrapSelect.defaultProps = {
73
- noneSelectedText: __('Nothing selected'),
74
- }
75
-
76
65
  export default BootstrapSelect;