katello 3.1.0.1 → 3.2.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 (390) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -47
  3. data/app/assets/javascripts/katello/common/index.js +0 -1
  4. data/app/assets/javascripts/katello/providers/redhat/index.js +0 -1
  5. data/app/assets/stylesheets/katello/_katello_colors.scss +0 -2
  6. data/app/assets/stylesheets/katello/katello.scss +0 -2
  7. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +45 -42
  8. data/app/controllers/katello/api/v2/activation_keys_controller.rb +7 -19
  9. data/app/controllers/katello/api/v2/api_controller.rb +3 -3
  10. data/app/controllers/katello/api/v2/capsule_content_controller.rb +3 -3
  11. data/app/controllers/katello/api/v2/content_uploads_controller.rb +2 -2
  12. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +29 -18
  13. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +2 -2
  14. data/app/controllers/katello/api/v2/content_view_histories_controller.rb +1 -1
  15. data/app/controllers/katello/api/v2/content_view_puppet_modules_controller.rb +2 -2
  16. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +10 -8
  17. data/app/controllers/katello/api/v2/content_views_controller.rb +5 -5
  18. data/app/controllers/katello/api/v2/environments_controller.rb +10 -9
  19. data/app/controllers/katello/api/v2/file_units_controller.rb +16 -0
  20. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +4 -4
  21. data/app/controllers/katello/api/v2/host_autocomplete_controller.rb +2 -2
  22. data/app/controllers/katello/api/v2/host_collections_controller.rb +41 -13
  23. data/app/controllers/katello/api/v2/host_errata_controller.rb +12 -5
  24. data/app/controllers/katello/api/v2/host_packages_controller.rb +4 -4
  25. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +9 -9
  26. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +52 -13
  27. data/app/controllers/katello/api/v2/organizations_controller.rb +3 -3
  28. data/app/controllers/katello/api/v2/packages_controller.rb +1 -1
  29. data/app/controllers/katello/api/v2/ping_controller.rb +2 -2
  30. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +2 -2
  31. data/app/controllers/katello/api/v2/products_controller.rb +6 -16
  32. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +1 -1
  33. data/app/controllers/katello/api/v2/repositories_controller.rb +60 -21
  34. data/app/controllers/katello/api/v2/repository_sets_controller.rb +3 -3
  35. data/app/controllers/katello/api/v2/root_controller.rb +2 -2
  36. data/app/controllers/katello/api/v2/subscriptions_controller.rb +19 -10
  37. data/app/controllers/katello/api/v2/sync_controller.rb +3 -3
  38. data/app/controllers/katello/api/v2/sync_plans_controller.rb +2 -2
  39. data/app/controllers/katello/api/v2/uebercerts_controller.rb +1 -1
  40. data/app/controllers/katello/application_controller.rb +7 -7
  41. data/app/controllers/katello/auto_complete_search_controller.rb +1 -1
  42. data/app/controllers/katello/concerns/api/api_controller.rb +1 -1
  43. data/app/controllers/katello/concerns/api/v2/hostgroups_controller_extensions.rb +19 -16
  44. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +8 -6
  45. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +10 -6
  46. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +1 -1
  47. data/app/controllers/katello/concerns/smart_proxies_controller_extensions.rb +1 -1
  48. data/app/controllers/katello/errors_controller.rb +2 -2
  49. data/app/controllers/katello/organizations_controller.rb +1 -1
  50. data/app/controllers/katello/products_controller.rb +4 -4
  51. data/app/controllers/katello/providers_controller.rb +2 -2
  52. data/app/helpers/katello/application_helper.rb +0 -240
  53. data/app/helpers/katello/concerns/hosts_and_hostgroups_helper_extensions.rb +19 -0
  54. data/app/lib/actions/candlepin/import_pool_handler.rb +11 -6
  55. data/app/lib/actions/katello/capsule_content/create_repos.rb +3 -3
  56. data/app/lib/actions/katello/capsule_content/sync.rb +23 -9
  57. data/app/lib/actions/katello/content_view/add_to_environment.rb +1 -1
  58. data/app/lib/actions/katello/content_view/errata_mail.rb +2 -2
  59. data/app/lib/actions/katello/content_view/incremental_updates.rb +60 -1
  60. data/app/lib/actions/katello/content_view/remove.rb +2 -2
  61. data/app/lib/actions/katello/content_view_environment/destroy.rb +1 -1
  62. data/app/lib/actions/katello/content_view_environment/reassign_objects.rb +2 -2
  63. data/app/lib/actions/katello/content_view_puppet_environment/create.rb +3 -1
  64. data/app/lib/actions/katello/host/attach_subscriptions.rb +13 -6
  65. data/app/lib/actions/katello/host/destroy.rb +0 -19
  66. data/app/lib/actions/katello/host/generate_applicability.rb +8 -3
  67. data/app/lib/actions/katello/host/hypervisors.rb +17 -9
  68. data/app/lib/actions/katello/host/hypervisors_update.rb +19 -44
  69. data/app/lib/actions/katello/host/reassign.rb +14 -0
  70. data/app/lib/actions/katello/host/register.rb +3 -22
  71. data/app/lib/actions/katello/host/remove_subscriptions.rb +15 -2
  72. data/app/lib/actions/katello/host/update.rb +0 -6
  73. data/app/lib/actions/katello/organization/destroy.rb +2 -2
  74. data/app/lib/actions/katello/product/content_destroy.rb +7 -9
  75. data/app/lib/actions/katello/product/destroy.rb +23 -7
  76. data/app/lib/actions/katello/repository/clear.rb +1 -0
  77. data/app/lib/actions/katello/repository/clone_file_content.rb +17 -0
  78. data/app/lib/actions/katello/repository/clone_to_environment.rb +2 -0
  79. data/app/lib/actions/katello/repository/clone_to_version.rb +2 -0
  80. data/app/lib/actions/katello/repository/create.rb +2 -1
  81. data/app/lib/actions/katello/repository/destroy.rb +20 -10
  82. data/app/lib/actions/katello/repository/errata_mail.rb +2 -2
  83. data/app/lib/actions/katello/repository/filtered_index_content.rb +2 -0
  84. data/app/lib/actions/katello/repository/import_upload.rb +6 -2
  85. data/app/lib/actions/katello/repository/{refresh_repostiory.rb → refresh_repository.rb} +0 -0
  86. data/app/lib/actions/katello/repository/remove_content.rb +2 -0
  87. data/app/lib/actions/katello/repository/sync.rb +8 -12
  88. data/app/lib/actions/katello/repository_set/disable_repository.rb +6 -5
  89. data/app/lib/actions/katello/repository_set/enable_repository.rb +1 -1
  90. data/app/lib/actions/katello/repository_set/scan_cdn.rb +1 -1
  91. data/app/lib/actions/pulp/abstract_async_task.rb +1 -1
  92. data/app/lib/actions/pulp/consumer/unassociate_units.rb +20 -0
  93. data/app/lib/actions/pulp/repository/copy_files.rb +11 -0
  94. data/app/lib/actions/pulp/repository/create.rb +5 -1
  95. data/app/lib/actions/pulp/repository/presenters/file_presenter.rb +1 -1
  96. data/app/lib/actions/pulp/repository/refresh.rb +4 -2
  97. data/app/lib/actions/pulp/repository/remove_file.rb +15 -0
  98. data/app/lib/actions/pulp/repository/sync.rb +3 -1
  99. data/app/lib/actions/pulp/repository_group/export.rb +1 -1
  100. data/app/lib/katello/errors.rb +1 -1
  101. data/app/lib/katello/lazy_accessor.rb +1 -1
  102. data/app/lib/katello/resources/candlepin.rb +14 -0
  103. data/app/lib/katello/util/cdn_var_substitutor.rb +5 -2
  104. data/app/lib/katello/util/model.rb +1 -2
  105. data/app/lib/katello/util/package.rb +2 -2
  106. data/app/models/katello/activation_key.rb +0 -49
  107. data/app/models/katello/authorization/content_view_version.rb +7 -0
  108. data/app/models/katello/candlepin/content.rb +15 -3
  109. data/app/models/katello/concerns/container_extensions.rb +1 -2
  110. data/app/models/katello/concerns/content_facet_host_extensions.rb +11 -1
  111. data/app/models/katello/concerns/host_managed_extensions.rb +4 -13
  112. data/app/models/katello/concerns/hostgroup_extensions.rb +0 -2
  113. data/app/models/katello/concerns/medium_extensions.rb +2 -2
  114. data/app/models/katello/concerns/organization_extensions.rb +0 -5
  115. data/app/models/katello/concerns/pulp_database_unit.rb +5 -1
  116. data/app/models/katello/concerns/smart_proxy_extensions.rb +21 -1
  117. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -2
  118. data/app/models/katello/content_view.rb +12 -6
  119. data/app/models/katello/content_view_component.rb +0 -3
  120. data/app/models/katello/content_view_environment.rb +2 -2
  121. data/app/models/katello/content_view_package_filter_rule.rb +13 -0
  122. data/app/models/katello/content_view_puppet_environment.rb +2 -2
  123. data/app/models/katello/content_view_repository.rb +2 -1
  124. data/app/models/katello/content_view_version.rb +9 -2
  125. data/app/models/katello/erratum.rb +1 -5
  126. data/app/models/katello/file_unit.rb +41 -0
  127. data/app/models/katello/glue/candlepin/activation_key.rb +2 -2
  128. data/app/models/katello/glue/candlepin/pool.rb +19 -14
  129. data/app/models/katello/glue/pulp/repo.rb +44 -10
  130. data/app/models/katello/host/content_facet.rb +6 -6
  131. data/app/models/katello/host/subscription_facet.rb +6 -8
  132. data/app/models/katello/kt_environment.rb +3 -5
  133. data/app/models/katello/package_group.rb +1 -3
  134. data/app/models/katello/pool.rb +7 -2
  135. data/app/models/katello/pool_with_quantities.rb +12 -0
  136. data/app/models/katello/product.rb +6 -0
  137. data/app/models/katello/provider.rb +1 -1
  138. data/app/models/katello/puppet_module.rb +1 -2
  139. data/app/models/katello/repository.rb +7 -3
  140. data/app/models/katello/repository_file.rb +9 -0
  141. data/app/models/katello/rpm.rb +1 -1
  142. data/app/models/katello/subscription_status.rb +1 -1
  143. data/app/models/katello/sync_plan.rb +2 -1
  144. data/app/models/katello/task_status.rb +3 -36
  145. data/app/models/setting/content.rb +4 -1
  146. data/app/overrides/add_activation_keys_input.rb +2 -2
  147. data/app/presenters/katello/activation_key_subscriptions_presenter.rb +10 -0
  148. data/app/services/katello/candlepin/consumer.rb +5 -1
  149. data/app/services/katello/pulp/file_unit.rb +13 -0
  150. data/app/views/dashboard/_errata_widget.html.erb +1 -1
  151. data/app/views/dashboard/_subscription_widget.html.erb +30 -8
  152. data/app/views/foreman/job_templates/install_errata.erb +1 -1
  153. data/app/views/katello/api/v2/activation_keys/product_content.json.rabl +1 -0
  154. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +2 -2
  155. data/app/views/katello/api/v2/content_facet/base.json.rabl +2 -4
  156. data/app/views/katello/api/v2/{systems → content_facet}/erratum.json.rabl +0 -0
  157. data/app/views/katello/api/v2/content_facet/show.json.rabl +1 -1
  158. data/app/views/katello/api/v2/content_view_versions/base.json.rabl +5 -4
  159. data/app/views/katello/api/v2/environments/show.json.rabl +1 -1
  160. data/app/views/katello/api/v2/file_units/base.json.rabl +7 -0
  161. data/app/views/katello/api/v2/{systems → file_units}/index.json.rabl +1 -1
  162. data/app/views/katello/api/v2/file_units/show.json.rabl +3 -0
  163. data/app/views/katello/api/v2/host_errata/index.json.rabl +1 -1
  164. data/app/views/katello/api/v2/host_errata/show.json.rabl +1 -1
  165. data/app/views/katello/api/v2/package_groups/base.json.rabl +1 -1
  166. data/app/views/katello/api/v2/ping/show.json.rabl +1 -1
  167. data/app/views/katello/api/v2/repositories/base.json.rabl +2 -1
  168. data/app/views/katello/api/v2/repositories/show.json.rabl +1 -1
  169. data/app/views/katello/api/v2/subscription_facet/base.json.rabl +1 -1
  170. data/app/views/katello/api/v2/subscription_facet/base_with_root.json.rabl +0 -4
  171. data/app/views/katello/api/v2/subscription_facet/show.json.rabl +1 -5
  172. data/app/views/katello/api/v2/subscriptions/base.json.rabl +3 -3
  173. data/app/views/katello/api/v2/subscriptions/index.json.rabl +1 -0
  174. data/app/views/katello/api/v2/tasks/task_status_show.json.rabl +0 -1
  175. data/app/views/katello/providers/redhat/show.html.erb +1 -1
  176. data/app/views/katello/sync_management/_products.html.erb +5 -1
  177. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +1 -9
  178. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +1 -0
  179. data/config/routes/api/v2.rb +9 -2
  180. data/config/routes/overrides.rb +9 -0
  181. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  182. data/db/migrate/20160617124149_remove_duplicate_view_filters.rb +38 -0
  183. data/db/migrate/20160627125310_delete_system.rb +7 -0
  184. data/db/migrate/20160722193256_add_verify_ssl_on_sync_to_repository.rb +9 -0
  185. data/db/migrate/20160727144242_add_registered_through_to_katello_subscription_facets.rb +5 -0
  186. data/db/migrate/20160808002834_add_files.rb +30 -0
  187. data/db/migrate/20160906181923_add_puppet_path_to_smart_proxy.rb +5 -0
  188. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activation-keys.module.js +1 -0
  189. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +7 -6
  190. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-add-subscriptions.html +6 -2
  191. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html +4 -0
  192. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +101 -102
  193. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-subscriptions-list.html +3 -0
  194. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/new/views/activation-key-new.html +82 -83
  195. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/views/activation-keys.html +4 -0
  196. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +1 -0
  197. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.module.js +3 -1
  198. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsules/capsules.module.js +4 -1
  199. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/common.module.js +2 -0
  200. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/registration.html +1 -0
  201. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-action-subscriptions.controller.js +46 -72
  202. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-action.controller.js +1 -2
  203. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/bulk-actions-errata.html +5 -0
  204. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/bulk-actions-host-collections.html +5 -0
  205. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/bulk-actions-subscriptions.html +79 -33
  206. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.module.js +1 -0
  207. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +10 -0
  208. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +27 -15
  209. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages.html +57 -45
  210. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-add-subscriptions.controller.js +5 -18
  211. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-base-subscriptions.controller.js +2 -3
  212. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +2 -1
  213. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-subscriptions.controller.js +3 -3
  214. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-add-subscriptions.html +4 -0
  215. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-details.html +117 -118
  216. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +13 -8
  217. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions-list.html +5 -0
  218. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +5 -0
  219. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.module.js +1 -0
  220. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +26 -0
  221. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-content-hosts.controller.js +11 -4
  222. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-environments.controller.js +1 -1
  223. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion.controller.js +1 -1
  224. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/content-view-deletion.html +3 -3
  225. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-content-hosts.html +2 -2
  226. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-environments.html +2 -2
  227. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-file-repositories.controller.js +47 -0
  228. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +8 -0
  229. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-file-repositories-list.controller.js +45 -0
  230. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/errata-filter-details.html +4 -0
  231. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filters.html +3 -0
  232. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter-details.html +6 -6
  233. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/views/content-view-puppet-module-names.html +6 -0
  234. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/views/content-view-puppet-modules.html +4 -0
  235. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-composite-available-content-views.html +2 -1
  236. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-composite-content-views-list.html +2 -1
  237. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +151 -140
  238. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-docker-repositories.html +1 -1
  239. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-file-repositories.html +118 -0
  240. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-ostree-repositories.html +1 -1
  241. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-repositories.html +1 -1
  242. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-versions.html +13 -2
  243. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +8 -0
  244. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-versions.module.js +1 -0
  245. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-details.html +8 -6
  246. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-file.html +22 -0
  247. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version.html +6 -16
  248. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +4 -0
  249. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-manifests/docker-manifests.module.js +6 -1
  250. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/views/docker-tags-details.html +59 -61
  251. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/docker-tags.module.js +3 -0
  252. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/views/docker-tags.html +4 -0
  253. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-content-views.html +5 -0
  254. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-docker.html +4 -0
  255. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-errata.html +4 -0
  256. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-ostree.html +4 -0
  257. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-packages.html +4 -0
  258. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-puppet-modules.html +4 -0
  259. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-repositories.html +4 -0
  260. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.module.js +1 -0
  261. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/errata-content-hosts.controller.js +1 -1
  262. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/errata-details-content-hosts.html +6 -2
  263. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/errata-details-repositories.html +4 -0
  264. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/errata-details.html +44 -45
  265. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.module.js +2 -0
  266. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/errata.html +5 -0
  267. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/gpg-key-details-info.controller.js +11 -0
  268. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/gpg-key-details.controller.js +1 -1
  269. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-details.html +52 -48
  270. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-info.html +1 -0
  271. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-products.html +1 -1
  272. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-repositories.html +1 -1
  273. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/gpg-keys.module.js +1 -0
  274. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/new/views/gpg-key-new.html +62 -63
  275. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/views/gpg-keys.html +6 -3
  276. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-add-hosts.html +4 -0
  277. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-details.html +85 -86
  278. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-hosts-list.html +4 -0
  279. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/host-collections.module.js +1 -0
  280. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/new/views/host-collection-new.html +16 -17
  281. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/views/host-collections.html +5 -0
  282. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +28 -0
  283. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-erratum.factory.js +1 -0
  284. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host.factory.js +1 -27
  285. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/hosts.module.js +3 -1
  286. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organization.factory.js +0 -1
  287. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organizations.module.js +4 -1
  288. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branches-details-repositories.controller.js +60 -0
  289. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branches-details.controller.js +31 -0
  290. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branches-details-info.html +23 -0
  291. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branches-details-repositories.html +83 -0
  292. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branches-details.html +43 -0
  293. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.controller.js +67 -0
  294. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.module.js +5 -1
  295. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.routes.js +53 -0
  296. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches-table-collapsed.html +19 -0
  297. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches-table-full.html +21 -0
  298. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches.html +19 -0
  299. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/package-groups/package-groups.module.js +7 -1
  300. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/package-details.controller.js +17 -2
  301. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/packages-details-info.html +10 -0
  302. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/packages-details-repositories.html +4 -0
  303. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/packages-details.html +51 -52
  304. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/packages.module.js +3 -0
  305. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/views/packages.html +5 -0
  306. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-details.html +72 -73
  307. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-repositories.html +19 -7
  308. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery-create.html +144 -145
  309. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/new/views/product-new.html +17 -18
  310. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.module.js +1 -0
  311. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +4 -0
  312. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/details/views/puppet-modules-details.html +44 -40
  313. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/puppet-modules.module.js +7 -1
  314. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/views/puppet-modules.html +4 -0
  315. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/details/repository-details-info.controller.js +11 -5
  316. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/details/views/repository-info.html +343 -324
  317. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/new/new-repository.controller.js +4 -4
  318. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/new/views/repository-new.html +10 -0
  319. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/repositories.module.js +1 -0
  320. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/settings/settings.module.js +2 -0
  321. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-associations-content-hosts.html +2 -2
  322. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-details.html +46 -47
  323. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js +10 -0
  324. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest-import.html +1 -0
  325. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest.html +41 -42
  326. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions-helper.service.js +15 -1
  327. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions.module.js +1 -0
  328. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/subscriptions.html +4 -0
  329. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +54 -55
  330. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plans.module.js +1 -0
  331. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/views/sync-plans.html +4 -0
  332. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/tasks.module.js +3 -1
  333. data/engines/bastion_katello/lib/bastion_katello/engine.rb +1 -0
  334. data/lib/katello/engine.rb +11 -1
  335. data/lib/katello/permissions/host_permissions.rb +13 -1
  336. data/lib/katello/plugin.rb +20 -1
  337. data/lib/katello/tasks/reimport.rake +1 -0
  338. data/lib/katello/tasks/test.rake +8 -0
  339. data/lib/katello/tasks/unify_hosts.rake +91 -0
  340. data/lib/katello/tasks/upgrade_check.rake +3 -2
  341. data/lib/katello/tasks/upgrades/3.0/update_subscription_facet_backend_data.rake +2 -4
  342. data/lib/katello/version.rb +1 -1
  343. data/lib/proxy_api/pulp.rb +7 -0
  344. data/lib/proxy_api/pulp_node.rb +7 -0
  345. metadata +79 -67
  346. data/app/assets/javascripts/katello/common/jquery.jeditable.custominputs.js +0 -180
  347. data/app/assets/javascripts/katello/widgets/jquery.jeditable.helpers.js +0 -247
  348. data/app/assets/stylesheets/katello/widgets/_scrollpane.scss +0 -66
  349. data/app/controllers/katello/api/v2/systems_controller.rb +0 -213
  350. data/app/helpers/katello/activation_keys_helper.rb +0 -4
  351. data/app/helpers/katello/host_collection_events_helper.rb +0 -7
  352. data/app/helpers/katello/katello_form_builder.rb +0 -150
  353. data/app/helpers/katello/packages_helper.rb +0 -67
  354. data/app/helpers/katello/subscriptions_helper.rb +0 -32
  355. data/app/helpers/katello/system_events_helper.rb +0 -4
  356. data/app/helpers/katello/system_packages_helper.rb +0 -42
  357. data/app/lib/actions/katello/repository/incremental_import.rb +0 -61
  358. data/app/lib/actions/katello/subscription/subscribe.rb +0 -26
  359. data/app/lib/actions/katello/system/destroy.rb +0 -17
  360. data/app/lib/actions/katello/system/reassign.rb +0 -14
  361. data/app/models/katello/authorization/system.rb +0 -53
  362. data/app/models/katello/glue/candlepin/consumer.rb +0 -386
  363. data/app/models/katello/glue/pulp/consumer.rb +0 -171
  364. data/app/models/katello/hypervisor.rb +0 -15
  365. data/app/models/katello/system.rb +0 -283
  366. data/app/models/katello/system_activation_key.rb +0 -8
  367. data/app/models/katello/system_repository.rb +0 -8
  368. data/app/presenters/katello/activation_key_subscription_presenter.rb +0 -10
  369. data/app/views/katello/api/v2/errata/_applicable_errata.json.rabl +0 -3
  370. data/app/views/katello/api/v2/subscriptions/create.json.rabl +0 -3
  371. data/app/views/katello/api/v2/systems/_pool.json.rabl +0 -6
  372. data/app/views/katello/api/v2/systems/activate.json.rabl +0 -3
  373. data/app/views/katello/api/v2/systems/add_host_collections.json.rabl +0 -3
  374. data/app/views/katello/api/v2/systems/available_host_collections.json.rabl +0 -5
  375. data/app/views/katello/api/v2/systems/base.json.rabl +0 -35
  376. data/app/views/katello/api/v2/systems/enabled_repos.json.rabl +0 -3
  377. data/app/views/katello/api/v2/systems/events.json.rabl +0 -3
  378. data/app/views/katello/api/v2/systems/package.json.rabl +0 -5
  379. data/app/views/katello/api/v2/systems/package_profile.json.rabl +0 -7
  380. data/app/views/katello/api/v2/systems/pools.json.rabl +0 -7
  381. data/app/views/katello/api/v2/systems/regenerate_identity_certificates.json.rabl +0 -3
  382. data/app/views/katello/api/v2/systems/remove_host_collections.json.rabl +0 -3
  383. data/app/views/katello/api/v2/systems/show.json.rabl +0 -64
  384. data/app/views/katello/api/v2/systems/subscriptions.json.rabl +0 -8
  385. data/app/views/katello/api/v2/systems/upload_package_profile.json.rabl +0 -3
  386. data/db/seeds.d/105-roles_permissions.rb +0 -71
  387. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host.factory.js +0 -25
  388. data/lib/katello/permissions/content_host_permissions.rb +0 -30
  389. data/lib/katello/tasks/yard.rake +0 -9
  390. data/vendor/assets/stylesheets/katello/jquery.jscrollpane.css +0 -120
@@ -1,213 +0,0 @@
1
- module Katello
2
- class Api::V2::SystemsController < Api::V2::ApiController
3
- include Katello::Concerns::FilteredAutoCompleteSearch
4
- respond_to :json
5
-
6
- wrap_parameters :include => (System.attribute_names + %w(type autoheal facts guest_ids host_collection_ids installed_products content_view environment service_level release_ver last_checkin))
7
-
8
- skip_before_filter :set_default_response_format, :only => :report
9
-
10
- before_filter :find_system, :only => [:show, :update, :enabled_repos, :releases, :tasks,
11
- :content_override, :product_content]
12
- before_filter :find_environment, :only => [:index, :report]
13
- before_filter :find_optional_organization, :only => [:create, :index, :report]
14
- before_filter :find_host_collection, :only => [:index]
15
- before_filter :find_default_organization_and_or_environment, :only => [:create, :index]
16
-
17
- before_filter :find_environment_and_content_view, :only => [:create]
18
- before_filter :find_content_view, :only => [:create, :update]
19
- before_filter :authorize_environment, :only => [:create]
20
-
21
- def organization_id_keys
22
- [:organization_id, :owner]
23
- end
24
-
25
- def_param_group :system do
26
- param :facts, Hash, :desc => N_("Key-value hash of content host-specific facts"), :action_aware => true do
27
- param :fact, String, :desc => N_("Any number of facts about this content host")
28
- end
29
- param :installed_products, Array, :desc => N_("List of products installed on the content host"), :action_aware => true
30
- param :name, String, :desc => N_("Name of the content host"), :required => true, :action_aware => true
31
- param :type, String, :desc => N_("Type of the content host, it should always be 'content host'"), :required => true, :action_aware => true
32
- param :service_level, String, :allow_nil => true, :desc => N_("A service level for auto-healing process, e.g. SELF-SUPPORT"), :action_aware => true
33
- param :location, String, :desc => N_("Physical location of the content host")
34
- param :content_view_id, :identifier
35
- param :environment_id, :identifier
36
- end
37
-
38
- api :GET, "/systems", N_("List content hosts"), :deprecated => true
39
- api :POST, "/systems/post_index", N_("List content hosts when you have a query string parameter that will cause a 414."), :deprecated => true
40
- api :GET, "/organizations/:organization_id/systems", N_("List content hosts in an organization"), :deprecated => true
41
- api :GET, "/environments/:environment_id/systems", N_("List content hosts in environment"), :deprecated => true
42
- param :name, String, :desc => N_("Filter content host by name")
43
- param :pool_id, String, :desc => N_("Filter content host by subscribed pool")
44
- param :uuid, String, :desc => N_("Filter content host by uuid")
45
- param :organization_id, :number, :desc => N_("Specify the organization"), :required => true
46
- param :environment_id, String, :desc => N_("Filter by environment")
47
- param :content_view_id, String, :desc => N_("Filter by content view")
48
- param_group :search, Api::V2::ApiController
49
- def index
50
- respond(:collection => scoped_search(index_relation.uniq, :name, :asc))
51
- end
52
-
53
- def index_relation
54
- collection = System.readable
55
- collection = collection.where(:content_view_id => params[:content_view_id]) if params[:content_view_id]
56
- collection = collection.where(:id => Organization.find(params[:organization_id]).systems.map(&:id)) if params[:organization_id]
57
- collection = collection.where(:environment_id => params[:environment_id]) if params[:environment_id]
58
- collection = collection.where(:id => Pool.find(params['pool_id']).systems.map(&:id)) if params['pool_id']
59
- collection = collection.where(:uuid => params['uuid']) if params['uuid']
60
- collection = collection.where(:name => params['name']) if params['name']
61
- collection
62
- end
63
-
64
- api :PUT, "/systems/:id", N_("Update content host information"), :deprecated => true
65
- param :id, String, :desc => N_("UUID of the content host"), :required => true
66
- param :release_ver, String, :desc => N_("Release version of the content host")
67
- param :service_level, String, :allow_nil => true, :desc => N_("A service level for auto-healing process, e.g. SELF-SUPPORT"), :action_aware => true
68
- param :environment_id, String, :desc => N_("Specify the environment")
69
- param :content_view_id, String, :desc => N_("Specify the content view")
70
- param :host_collection_ids, Array, :desc => N_("Specify the host collections as an array")
71
- def update
72
- host_params = system_params_to_host_params(system_params(params))
73
- @system.foreman_host.update_attributes!(host_params)
74
- respond_for_update
75
- end
76
-
77
- api :GET, "/systems/:id", N_("Show a content host"), :deprecated => true
78
- param :id, String, :desc => N_("UUID of the content host"), :required => true
79
- def show
80
- respond
81
- end
82
-
83
- private
84
-
85
- def system_params_to_host_params(sys_params)
86
- content_facet = {}
87
- subscription_facet = {}
88
- host_params = {}
89
- host_params[:host_collection_ids] = sys_params[:host_collection_ids] unless sys_params[:host_collection_ids].blank?
90
-
91
- content_facet[:lifecycle_environment_id] = sys_params[:environment_id]
92
- content_facet[:content_view_id] = sys_params[:content_view_id]
93
- host_params[:content_facet_attributes] = content_facet.compact! unless content_facet.compact.empty?
94
-
95
- subscription_facet[:service_level] = params[:service_level]
96
- subscription_facet[:release_version] = params[:release_ver]
97
- host_params[:subscription_facet_attributes] = subscription_facet.compact! unless subscription_facet.compact.empty?
98
- host_params
99
- end
100
-
101
- def find_system
102
- @system = System.where(:uuid => params[:id]).first
103
- @host = ::Host.where(:id => params[:id]).first
104
- if @system.nil? && @host.nil?
105
- Resources::Candlepin::Consumer.get params[:id] # check with candlepin if system is Gone, raises RestClient::Gone
106
- fail HttpErrors::NotFound, _("Couldn't find content host '%s'") % params[:id]
107
- elsif @system.nil?
108
- @system = @host.content_host
109
- end
110
- end
111
-
112
- def find_environment
113
- return unless params.key?(:environment_id)
114
-
115
- @environment = KTEnvironment.find(params[:environment_id])
116
- fail HttpErrors::NotFound, _("Couldn't find environment '%s'") % params[:environment_id] if @environment.nil?
117
- @organization = @environment.organization
118
- @environment
119
- end
120
-
121
- def find_host_collection
122
- return unless params.key?(:host_collection_id)
123
-
124
- @host_collection = HostCollection.find(params[:host_collection_id])
125
- end
126
-
127
- def find_environment_and_content_view_by_env_id
128
- # There are some scenarios (primarily create) where a system may be
129
- # created using the content_view_environment.cp_id which is the
130
- # equivalent of "environment_id"-"content_view_id".
131
- if params[:environment_id].is_a? String
132
- if !params.key?(:content_view_id)
133
- cve = ContentViewEnvironment.find_by!(:cp_id => params[:environment_id])
134
- @environment = cve.environment
135
- @organization = @environment.organization
136
- @content_view = cve.content_view
137
- else
138
-
139
- # assumption here is :content_view_id is passed as a separate attrib
140
- @environment = KTEnvironment.find(params[:environment_id])
141
- @organization = @environment.organization
142
- fail HttpErrors::NotFound, _("Couldn't find environment '%s'") % params[:environment_id] if @environment.nil?
143
- end
144
- return @environment, @content_view
145
- else
146
- find_environment
147
- end
148
- end
149
-
150
- def find_environment_and_content_view
151
- if params.key?(:environment_id)
152
- find_environment_and_content_view_by_env_id
153
- else
154
- @environment = @organization.library if @organization
155
- end
156
- end
157
-
158
- def find_content_view
159
- if (content_view_id = (params[:content_view_id] || params[:system].try(:[], :content_view_id)))
160
- setup_content_view(content_view_id)
161
- end
162
- end
163
-
164
- def system_params(param_hash)
165
- system_params = param_hash.require(:system).permit(:name, :location, :owner, :type,
166
- :service_level, :autoheal,
167
- :guest_ids, :host_collection_ids => [])
168
-
169
- system_params[:facts] = param_hash[:system][:facts].permit! if param_hash[:system][:facts]
170
- system_params[:type] = param_hash[:type] ? param_hash[:type] : ::Katello::Host::SubscriptionFacet::DEFAULT_TYPE
171
-
172
- { :guest_ids => :guestIds,
173
- :installed_products => :installedProducts,
174
- :release_ver => :releaseVer,
175
- :service_level => :serviceLevel,
176
- :last_checkin => :lastCheckin }.each do |snake, camel|
177
- if param_hash[snake]
178
- system_params[camel] = param_hash[snake]
179
- elsif param_hash[camel]
180
- system_params[camel] = param_hash[camel]
181
- end
182
- end
183
- system_params[:installedProducts] = [] if system_params.key?(:installedProducts) && system_params[:installedProducts].nil?
184
-
185
- unless User.consumer?
186
- system_params.merge!(param_hash[:system].permit(:environment_id, :content_view_id))
187
- system_params[:content_view_id] = nil if system_params[:content_view_id] == false
188
- system_params[:content_view_id] = param_hash[:system][:content_view][:id] if param_hash[:system][:content_view]
189
- system_params[:environment_id] = param_hash[:system][:environment][:id] if param_hash[:system][:environment]
190
- end
191
-
192
- system_params
193
- end
194
-
195
- def setup_content_view(cv_id)
196
- return if @content_view
197
- organization = @organization
198
- organization ||= @system.organization if @system
199
- organization ||= @environment.organization if @environment
200
- if cv_id && organization
201
- @content_view = ContentView.readable.find_by(:id => cv_id)
202
- fail HttpErrors::NotFound, _("Couldn't find content view '%s'") % cv_id if @content_view.nil?
203
- else
204
- @content_view = nil
205
- end
206
- end
207
-
208
- def authorize_environment
209
- return deny_access unless @environment.readable?
210
- true
211
- end
212
- end
213
- end
@@ -1,4 +0,0 @@
1
- module Katello
2
- module ActivationKeysHelper
3
- end
4
- end
@@ -1,7 +0,0 @@
1
- module Katello
2
- module HostCollectionEventsHelper
3
- def format_description(description)
4
- description.is_a?(String) ? description.gsub("\n", "<br/>") : description
5
- end
6
- end
7
- end
@@ -1,150 +0,0 @@
1
- module Katello
2
- class KatelloFormBuilder < ActionView::Helpers::FormBuilder
3
- delegate :content_tag, :tag, :to => :@template
4
-
5
- %w(text_field text_area select file_field).each do |m|
6
- define_method m do |name, *args|
7
- base(name, *args) { super(name, *args) }
8
- end
9
- end
10
-
11
- def field(name, *args, &block)
12
- base(name, *args, &block)
13
- end
14
-
15
- # Support for rendering jquery.jeditable fields.
16
- # Instead of writing complete html code for the field and the label
17
- # it allows to use 'editable' form helper.
18
- #
19
- # @example usage
20
- # kt_form_for @record, :data_url => record_path(@record) do |form|
21
- # form.editable :name, :label => _("Name:")
22
- # end
23
- #
24
- # kt_form_for @record do |form|
25
- # form.editable :name, :data_url => record_path_1(@record)
26
- # form.editable :surname, :data_url => record_path_2(@record)
27
- # end
28
- #
29
- # kt_form_for @record, :data_url => record_path(@record) do |form|
30
- # form.editable :name do
31
- # # Some custom value
32
- # end
33
- # end
34
- #
35
- # @param [Hash] options
36
- # @option options [String] :label label text
37
- # @option options [true,false] :editable boolean flag, switches possibility to edit the field
38
- # @option options [String] :class additional css class
39
- # @option options [String] :help help string
40
- # @option options [String] :type editable type, eg. edit_textarea, edit_number. Default is edit_panel_element
41
- # @option options [Hash] :tag options passed directly to the element
42
- def editable(name, options)
43
- options.symbolize_keys!
44
- options[:editable] = true if options[:editable].nil?
45
- options[:type] ||= "edit_panel_element"
46
-
47
- tag_options = {}
48
- tag_options[:name] = "%s[%s]" % [@object_name, name.to_s]
49
- tag_options[:'data-url'] = options[:'data-url'] || options[:data_url] || @options[:data_url]
50
- tag_options.update(options[:tag]) if options.key? :tag
51
-
52
- css_class = "%s " % options[:class].to_s
53
- css_class += "editable %s" % options[:type].to_s if options[:editable]
54
- css_class.strip!
55
-
56
- field_options = {}
57
- field_options[:label] = options[:label]
58
- field_options[:help] = options[:help]
59
- field_options[:label_help] = options[:label_help]
60
- field_options[:input_wrapper] = {}
61
- field_options[:input_wrapper][:class] = css_class
62
- field_options[:input_wrapper][:tag_options] = tag_options
63
-
64
- base(name, field_options) do
65
- if block_given?
66
- yield
67
- else
68
- @object.send(name)
69
- end
70
- end
71
- end
72
-
73
- def submit(*args)
74
- options = args.extract_options!
75
- options.symbolize_keys!
76
- options[:tabindex] ||= tabindex
77
- args.push options
78
- content_tag :div, :class => "grid_5 la prefix_2" do
79
- super
80
- end
81
- end
82
-
83
- def tabindex
84
- @tabindex ||= @options[:tabindex] || 0
85
- @tabindex += 1
86
- end
87
-
88
- private
89
-
90
- def base(name, *args)
91
- options = args.extract_options!
92
- options.symbolize_keys!
93
- options[:grid] ||= [2, 5]
94
- unless options[:grid].is_a?(Array) && options[:grid].size == 2
95
- fail ArgumentError, "#{name}[grid]: expecting array of size 2"
96
- end
97
- # check if user added some class for wrappers and add grid and align classes
98
- [:label_wrapper, :input_wrapper].each_with_index do |wrapper, i|
99
- options[wrapper] ||= {}
100
- unless options[wrapper][:class].is_a?(Array)
101
- options[wrapper][:class] = (options[wrapper][:class] || '').split
102
- end
103
- options[wrapper][:class] ||= ["grid_#{options[:grid][i]}", (i == 0 ? "ra" : "la")]
104
- end
105
- options[:tabindex] ||= tabindex
106
- options[:wrapper] ||= {}
107
- options[:size] ||= '30'
108
-
109
- content_tag(:div, :class => "clearfix") do
110
- content_tag :div, :class => "form-group'}" do
111
- content_tag :fieldset, :id => options[:wrapper][:id] do
112
- @template.concat label_wrapper(options) { field_label(name, options) }
113
- @template.concat input_wrapper(options) { yield if block_given? }
114
- end
115
- end
116
- end
117
- end
118
-
119
- def label_wrapper(options)
120
- tag_options = options[:label_wrapper][:tag_options] || {}
121
- tag_options.merge!(:class => options[:label_wrapper][:class])
122
-
123
- content_tag(:div, tag_options) { yield }
124
- end
125
-
126
- def input_wrapper(options)
127
- tag_options = options[:input_wrapper][:tag_options] || {}
128
- tag_options.merge!(:class => options[:input_wrapper][:class])
129
-
130
- content_tag(:div, tag_options) { yield } +
131
- (content_tag(:i, '', :class => 'details-icon', 'data-help' => options[:help]) if options[:help])
132
- end
133
-
134
- def field_label(name, options)
135
- required = object.class.validators_on(name).any? do |v|
136
- v.is_a? ActiveModel::Validations::PresenceValidator
137
- end
138
-
139
- label_content = label(name, options[:label], :class => ("required" if required))
140
- return label_content if options[:label_help].nil?
141
-
142
- help_content = content_tag(:i, '', :class => 'details_icon-grey tipsify col-md-2 control-label', 'title' => options[:label_help])
143
- return help_content + label_content
144
- end
145
-
146
- def objectify_options(options)
147
- super.except(:label, :label_wrapper, :input_wrapper, :grid, :wrapper)
148
- end
149
- end
150
- end
@@ -1,67 +0,0 @@
1
- module Katello
2
- module PackagesHelper
3
- def format_changelog_changes(changes)
4
- h(changes).gsub(/\n/, "<br>").html_safe
5
- end
6
-
7
- def format_changelog_date(date)
8
- format_time(DateTime.strptime(date.to_s, "%s").to_date, format: :long)
9
- end
10
-
11
- # This method will format the package details provided using a format
12
- # similar to what is used in an rpm spec. For example:
13
- # package-a
14
- # package-b = 1.2.0
15
- # package-c = 9:1.2.0
16
- # package-d >= 9:1.2.0-3
17
- #
18
- # where, the operator, epoch (e.g. 9), version (e.g 1.2.0) and
19
- # release (e.g. 3) are optional
20
- def format_package_details(package)
21
- package_details = package[:name]
22
-
23
- unless package[:flags].blank?
24
- package_details = [package_details, package_operator(package[:flags]), ''].join(' ')
25
- package_details += package[:epoch] + ':' unless package[:epoch].blank?
26
- package_details += package[:version] unless package[:version].blank?
27
- package_details += '-' + package[:release] unless package[:release].blank?
28
- end
29
-
30
- package_details
31
- end
32
-
33
- def package_operator(flag)
34
- case flag
35
- when 'EQ'
36
- '='
37
- when 'LT'
38
- '<'
39
- when 'LE'
40
- '<='
41
- when 'GT'
42
- '>'
43
- when 'GE'
44
- '>='
45
- end
46
- end
47
-
48
- def changelog_changes(changes)
49
- if (lines = changes.split(/\n/)).length > 10
50
- previewed_changelog(lines)
51
- else
52
- format_changelog_changes(changes)
53
- end
54
- end
55
-
56
- def previewed_changelog(lines)
57
- html = format_changelog_changes(lines[0, 10].join("\n"))
58
- html += content_tag "p" do
59
- more_lines = number_with_delimiter(lines.length - 10)
60
- link_to((_("Show %s more line(s)") % more_lines), "", class: "show-more-changelog")
61
- end
62
- html + content_tag("div", :class => "more-changelog") do
63
- format_changelog_changes(lines[10..-1].join("\n"))
64
- end
65
- end
66
- end
67
- end
@@ -1,32 +0,0 @@
1
- module Katello
2
- module SubscriptionsHelper
3
- def subscriptions_product_helper(product_id)
4
- cp_product = Resources::Candlepin::Product.get(product_id).first
5
- product = OpenStruct.new cp_product
6
- product.cp_id = cp_product['id']
7
- product
8
- end
9
-
10
- def subscriptions_manifest_link_helper(status, label = nil)
11
- if status['webAppPrefix']
12
- if !status['webAppPrefix'].start_with? 'http'
13
- url = "http://#{status['webAppPrefix']}"
14
- else
15
- url = status['webAppPrefix']
16
- end
17
-
18
- url += '/' unless url.end_with? '/'
19
- url += status['upstreamId']
20
- link_to((label.nil? ? url : label), url, :target => '_blank')
21
- else
22
- label.nil? ? status['upstreamId'] : label
23
- end
24
- end
25
-
26
- def subscriptions_candlepin_status
27
- Resources::Candlepin::CandlepinPing.ping
28
- rescue
29
- {'rulesVersion' => '', 'rulesSource' => ''}
30
- end
31
- end
32
- end