Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

upgrade foreman to rails 3.2.13

This commit updates from rails 3.0.x to 3.2.x, main changes include:

* Asset pipline support
* cleanup of existing assets (javascript, css, images)

Users who uses foreman in production, make sure that you now compile
your assets, e.g

rake assets:precompile

Paired-with: Joseph Mitchell Magen <jmagen@redhat.com>
Paired-with: Ohad Levy <ohadlevy@gmail.com>

Signed-off-by: Ohad Levy <ohadlevy@gmail.com>
  • Loading branch information...
commit feacea35f07f362d9e2c694a83516bbc902321a0 1 parent dbc1ee9
@abenari abenari authored ohadlevy committed
Showing with 954 additions and 3,391 deletions.
  1. +1 −0  .gitignore
  2. +2 −3 Gemfile
  3. 0  {public → app/assets}/images/Archlinux.png
  4. 0  {public → app/assets}/images/Centos.png
  5. 0  {public → app/assets}/images/Darwin.png
  6. 0  {public → app/assets}/images/Debian.png
  7. 0  {public → app/assets}/images/Fedora.png
  8. 0  {public → app/assets}/images/Redhat.png
  9. 0  {public → app/assets}/images/SLC.png
  10. 0  {public → app/assets}/images/Scientific.png
  11. 0  {public → app/assets}/images/Solaris.png
  12. 0  {public → app/assets}/images/Suse.png
  13. 0  {public → app/assets}/images/Ubuntu.png
  14. 0  {public → app/assets}/images/Windows.png
  15. 0  {public → app/assets}/images/bullet_toggle_plus.png
  16. 0  {public → app/assets}/images/false.png
  17. 0  {public → app/assets}/images/foreman.png
  18. 0  {public → app/assets}/images/foreman_background.png
  19. 0  {public → app/assets}/images/foreman_large.png
  20. 0  {public → app/assets}/images/pie_chart_icon.png
  21. 0  {public → app/assets}/images/spinner.gif
  22. 0  {public → app/assets}/images/switch.png
  23. 0  {public → app/assets}/images/toggle_check.png
  24. 0  {public → app/assets}/images/true.png
  25. 0  {public → app/assets}/images/user.jpg
  26. +37 −16 {public → app/assets}/javascripts/application.js
  27. +1 −4 {public → app/assets}/javascripts/charts.js
  28. +5 −11 {public → app/assets}/javascripts/compute_resource.js
  29. +1 −1  {public → app/assets}/javascripts/config_template.js
  30. +1 −1  {public → app/assets}/javascripts/host_checkbox.js
  31. +27 −47 {public → app/assets}/javascripts/host_edit.js
  32. 0  {public → app/assets}/javascripts/lookup_keys.js
  33. 0  {public → app/assets}/javascripts/nfs_visibility.js
  34. 0  {public → app/assets}/javascripts/noVNC.js
  35. 0  {public → app/assets}/javascripts/reports.js
  36. 0  {public → app/assets}/javascripts/spice.js
  37. 0  {public → app/assets}/javascripts/taxonomy.js
  38. 0  {public → app/assets}/javascripts/trends.js
  39. 0  {public → app/assets}/stylesheets/.gitkeep
  40. +105 −164 public/stylesheets/style.css → app/assets/stylesheets/application.scss
  41. +19 −0 app/assets/stylesheets/bootstrap_and_overrides.scss
  42. +60 −0 app/assets/stylesheets/wizard.scss
  43. +3 −5 app/controllers/concerns/api/taxonomy_scope.rb
  44. +64 −67 app/controllers/concerns/api/v2/taxonomies_controller.rb
  45. +1 −1  app/controllers/domains_controller.rb
  46. +1 −1  app/controllers/environments_controller.rb
  47. +2 −2 app/controllers/hostgroups_controller.rb
  48. +24 −40 app/controllers/hosts_controller.rb
  49. +1 −1  app/controllers/models_controller.rb
  50. +1 −1  app/controllers/operatingsystems_controller.rb
  51. +1 −1  app/controllers/puppetclasses_controller.rb
  52. +4 −12 app/controllers/subnets_controller.rb
  53. +1 −1  app/controllers/unattended_controller.rb
  54. +0 −10 app/controllers/users_controller.rb
  55. +11 −25 app/helpers/application_helper.rb
  56. +1 −1  app/helpers/layout_helper.rb
  57. +1 −12 app/helpers/users_helper.rb
  58. +2 −2 app/models/bookmark.rb
  59. +1 −1  app/models/config_template.rb
  60. +1 −3 app/models/host.rb
  61. +4 −2 app/models/host/base.rb
  62. +9 −26 app/models/host/managed.rb
  63. +5 −11 app/models/host_mailer.rb
  64. +1 −1  app/models/host_parameter.rb
  65. +1 −1  app/models/host_template_helpers.rb
  66. +1 −0  app/models/hostgroup_class.rb
  67. +1 −1  app/models/location.rb
  68. +4 −1 app/models/lookup_key.rb
  69. +2 −2 app/models/nic.rb
  70. +1 −1  app/models/organization.rb
  71. +2 −2 app/models/role.rb
  72. +0 −10 app/models/taxonomix.rb
  73. +7 −6 app/models/taxonomy.rb
  74. +1 −1  app/models/user.rb
  75. 0  app/views/common/{403.rhtml → 403.html.erb}
  76. 0  app/views/common/{404.rhtml → 404.html.erb}
  77. +2 −2 app/views/common/{500.rhtml → 500.html.erb}
  78. +2 −2 app/views/common/_domain.html.erb
  79. +2 −1  app/views/common/_domain_subnet.html.erb
  80. +2 −4 app/views/common/_searchbar.erb
  81. +1 −1  app/views/compute_resources/form/_ec2.html.erb
  82. +1 −1  app/views/compute_resources/form/_libvirt.html.erb
  83. +1 −1  app/views/compute_resources/form/_openstack.html.erb
  84. +1 −1  app/views/compute_resources/form/_ovirt.html.erb
  85. +1 −1  app/views/compute_resources/form/_rackspace.html.erb
  86. +1 −1  app/views/compute_resources/form/_vmware.html.erb
  87. +2 −2 app/views/compute_resources/show.html.erb
  88. +2 −2 app/views/compute_resources_vms/form/_ovirt.html.erb
  89. 0  app/views/home/{_location_dropdown.rhtml → _location_dropdown.html.erb}
  90. 0  app/views/home/{_organization_dropdown.rhtml → _organization_dropdown.html.erb}
  91. 0  app/views/home/{_topbar.rhtml → _topbar.html.erb}
  92. 0  app/views/home/{_user_dropdown.rhtml → _user_dropdown.html.erb}
  93. +1 −1  app/views/hostgroups/_form.html.erb
  94. +3 −3 app/views/hosts/_form.html.erb
  95. +2 −2 app/views/hosts/_interfaces.html.erb
  96. +1 −1  app/views/hosts/_list.html.erb
  97. +2 −1  app/views/hosts/_unattended.html.erb
  98. +4 −2 app/views/hosts/console/vnc.html.erb
  99. +4 −5 app/views/layouts/application.html.erb
  100. +2 −2 app/views/puppetclasses/_classes.html.erb
  101. 0  app/views/reports/{_metrics.rhtml → _metrics.html.erb}
  102. 0  app/views/reports/{show.rhtml → show.html.erb}
  103. +2 −2 app/views/roles/{_form.rhtml → _form.html.erb}
  104. 0  app/views/roles/{edit.rhtml → edit.html.erb}
  105. 0  app/views/roles/{new.rhtml → new.html.erb}
  106. 0  app/views/roles/{report.rhtml → report.html.erb}
  107. 0  app/views/tasks/{_list.rhtml → _list.html.erb}
  108. 0  app/views/tasks/{show.rhtml → show.html.erb}
  109. 0  app/views/unattended/{jumpstart.rhtml → jumpstart.html.erb}
  110. 0  app/views/unattended/{jumpstart_finish.rhtml → jumpstart_finish.html.erb}
  111. 0  app/views/unattended/{kickstart.rhtml → kickstart.html.erb}
  112. 0  app/views/unattended/{preseed.rhtml → preseed.html.erb}
  113. 0  app/views/unattended/{preseed_finish.rhtml → preseed_finish.html.erb}
  114. +2 −2 app/views/users/_filters.html.erb
  115. +1 −1  app/views/users/_form.html.erb
  116. +9 −0 bundler.d/assets.rb
  117. +1 −1  bundler.d/mysql2.rb
  118. +8 −3 bundler.d/test.rb
  119. +21 −11 config/application.rb
  120. +1 −2  config/boot.rb
  121. +12 −0 config/environments/development.rb
  122. +56 −1 config/environments/production.rb
  123. +7 −0 config/environments/test.rb
  124. +0 −19 config/initializers/procs_for_default_scope.rb
  125. +13 −0 config/initializers/wrap_parameters.rb
  126. +4 −4 config/routes.rb
  127. +1 −1  db/migrate/20090714132448_create_hosts.rb
  128. +1 −1  db/migrate/20110725142054_add_suse_templates.rb
  129. +0 −43 lib/core_extensions.rb
  130. +2 −1  lib/foreman/controller/auto_complete_search.rb
  131. +3 −3 lib/foreman/controller/host_details.rb
  132. +36 −38 lib/foreman/controller/smart_proxy_auth.rb
  133. +127 −130 lib/foreman/controller/taxonomies_controller.rb
  134. +34 −36 lib/foreman/controller/taxonomy_multiple.rb
  135. BIN  public/images/1downarrow.png
  136. BIN  public/images/1uparrow.png
  137. BIN  public/images/2downarrow.png
  138. BIN  public/images/2uparrow.png
  139. BIN  public/images/add.png
  140. BIN  public/images/application_cascade.png
  141. BIN  public/images/bookmark.png
  142. BIN  public/images/bullet_toggle_minus.png
  143. BIN  public/images/button_left.png
  144. BIN  public/images/button_right.png
  145. BIN  public/images/close_hl.png
  146. BIN  public/images/delete.png
  147. BIN  public/images/edit-hover.png
  148. BIN  public/images/edit.png
  149. BIN  public/images/glyphicons-halflings-white.png
  150. BIN  public/images/glyphicons-halflings.png
  151. BIN  public/images/grid.png
  152. BIN  public/images/header_bg.png
  153. BIN  public/images/hosts/Darwin.jpg
  154. BIN  public/images/hosts/Linux.jpg
  155. BIN  public/images/hosts/SunOS.jpg
  156. BIN  public/images/hosts/attention_required.png
  157. BIN  public/images/hosts/warning.png
  158. BIN  public/images/link.png
  159. BIN  public/images/message.png
  160. BIN  public/images/sort_asc.png
  161. BIN  public/images/sort_asc_disabled.png
  162. BIN  public/images/sort_both.png
  163. BIN  public/images/sort_desc.png
  164. BIN  public/images/sort_desc_disabled.png
  165. BIN  public/images/ui-bg_flat_0_aaaaaa_40x100.png
  166. BIN  public/images/ui-bg_glass_55_fbf9ee_1x400.png
  167. BIN  public/images/ui-bg_glass_65_ffffff_1x400.png
  168. BIN  public/images/ui-bg_glass_75_dadada_1x400.png
  169. BIN  public/images/ui-bg_glass_75_e6e6e6_1x400.png
  170. BIN  public/images/ui-bg_glass_75_ffffff_1x400.png
  171. BIN  public/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  172. BIN  public/images/ui-bg_inset-soft_95_fef1ec_1x100.png
  173. BIN  public/images/ui-icons_222222_256x240.png
  174. BIN  public/images/ui-icons_2e83ff_256x240.png
  175. BIN  public/images/ui-icons_454545_256x240.png
  176. BIN  public/images/ui-icons_888888_256x240.png
  177. BIN  public/images/ui-icons_cd0a0a_256x240.png
  178. BIN  public/images/ui-icons_f6cf3b_256x240.png
  179. BIN  public/images/warning.png
  180. +0 −6 public/javascripts/bootstrap.min.js
  181. +0 −781 public/javascripts/jquery-ui.js
  182. +0 −4 public/javascripts/jquery.js
  183. +0 −367 public/javascripts/jquery_ujs.js
  184. +0 −1  public/javascripts/jrails.js
  185. +0 −43 public/javascripts/noVNC/vnc.js
  186. +0 −19 public/javascripts/spice/setup.js
  187. +0 −9 public/stylesheets/bootstrap-responsive.min.css
  188. +0 −9 public/stylesheets/bootstrap.min.css
  189. +0 −1,151 public/stylesheets/jquery-ui.css
  190. +0 −59 public/stylesheets/wizard.css
  191. +0 −1  test/fixtures/config_templates.yml
  192. +0 −2  test/fixtures/nics.yml
  193. +3 −3 test/functional/api/v2/domains_controller_test.rb
  194. +21 −22 test/functional/hosts_controller_test.rb
  195. +5 −4 test/functional/unattended_controller_test.rb
  196. +1 −2  test/lib/proxy_api_bmc_test.rb
  197. +1 −1  test/test_helper.rb
  198. +2 −4 test/unit/domain_test.rb
  199. +1 −1  test/unit/host_mailer_test.rb
  200. +3 −3 test/unit/host_test.rb
  201. +8 −3 test/unit/hostgroup_test.rb
  202. +11 −11 test/unit/location_test.rb
  203. +2 −2 test/unit/orchestration/dhcp_test.rb
  204. +11 −11 test/unit/organization_test.rb
  205. +3 −3 test/unit/parameter_test.rb
  206. +14 −10 test/unit/subnet_test.rb
  207. 0  {public → vendor/assets}/javascripts/ace/ace.js
  208. 0  {public → vendor/assets}/javascripts/ace/cockpit.js
  209. 0  {public → vendor/assets}/javascripts/ace/ext-static_highlight.js
  210. 0  {public → vendor/assets}/javascripts/ace/ext-textarea.js
  211. 0  {public → vendor/assets}/javascripts/ace/keybinding-emacs.js
  212. 0  {public → vendor/assets}/javascripts/ace/keybinding-vim.js
  213. 0  {public → vendor/assets}/javascripts/ace/mode-diff.js
  214. 0  {public → vendor/assets}/javascripts/ace/mode-ruby.js
  215. 0  {public → vendor/assets}/javascripts/ace/mode-sh.js
  216. 0  {public → vendor/assets}/javascripts/ace/theme-clouds.js
  217. 0  {public → vendor/assets}/javascripts/ace/theme-dawn.js
  218. 0  {public → vendor/assets}/javascripts/ace/theme-textmate.js
  219. 0  {public → vendor/assets}/javascripts/ace/theme-twilight.js
  220. 0  {public → vendor/assets}/javascripts/ace/worker-coffee.js
  221. 0  {public → vendor/assets}/javascripts/ace/worker-css.js
  222. 0  {public → vendor/assets}/javascripts/ace/worker-javascript.js
  223. 0  {public → vendor/assets}/javascripts/ace/worker-json.js
  224. 0  {public → vendor/assets}/javascripts/ace/worker-xquery.js
  225. 0  {public → vendor/assets}/javascripts/diff.js
  226. 0  {public → vendor/assets}/javascripts/highcharts.js
  227. 0  {public → vendor/assets}/javascripts/jquery.cookie.js
  228. +1 −0  {public → vendor/assets}/javascripts/jquery.dataTables.bootstrap-paging.js
  229. 0  {public → vendor/assets}/javascripts/jquery.dataTables.min.js
  230. 0  {public → vendor/assets}/javascripts/jquery.jeditable.js
  231. 0  {public → vendor/assets}/javascripts/jquery.jnotify.js
  232. 0  {public → vendor/assets}/javascripts/jquery.multi-select.js
  233. 0  {public → vendor/assets}/javascripts/noVNC/base64.js
  234. 0  {public → vendor/assets}/javascripts/noVNC/des.js
  235. 0  {public → vendor/assets}/javascripts/noVNC/display.js
  236. 0  {public → vendor/assets}/javascripts/noVNC/input.js
  237. 0  {public → vendor/assets}/javascripts/noVNC/jsunzip.js
  238. 0  {public → vendor/assets}/javascripts/noVNC/logo.js
  239. 0  {public → vendor/assets}/javascripts/noVNC/playback.js
  240. 0  {public → vendor/assets}/javascripts/noVNC/rfb.js
  241. 0  {public → vendor/assets}/javascripts/noVNC/ui.js
  242. 0  {public → vendor/assets}/javascripts/noVNC/util.js
  243. 0  {public → vendor/assets}/javascripts/noVNC/web-socket-js/README.txt
  244. 0  {public → vendor/assets}/javascripts/noVNC/web-socket-js/swfobject.js
  245. 0  {public → vendor/assets}/javascripts/noVNC/web-socket-js/web_socket.js
  246. 0  {public → vendor/assets}/javascripts/noVNC/websock.js
  247. 0  {public → vendor/assets}/javascripts/noVNC/webutil.js
  248. 0  {public → vendor/assets}/javascripts/spice/atKeynames.js
  249. 0  {public → vendor/assets}/javascripts/spice/bitmap.js
  250. 0  {public → vendor/assets}/javascripts/spice/cursor.js
  251. 0  {public → vendor/assets}/javascripts/spice/display.js
  252. 0  {public → vendor/assets}/javascripts/spice/enums.js
  253. +13 −13 {public → vendor/assets}/javascripts/spice/inputs.js
  254. 0  {public → vendor/assets}/javascripts/spice/lz.js
  255. 0  {public → vendor/assets}/javascripts/spice/main.js
  256. 0  {public → vendor/assets}/javascripts/spice/png.js
  257. 0  {public → vendor/assets}/javascripts/spice/quic.js
  258. +25 −0 vendor/assets/javascripts/spice/setup.js
  259. 0  {public → vendor/assets}/javascripts/spice/spiceconn.js
  260. 0  {public → vendor/assets}/javascripts/spice/spicedataview.js
  261. 0  {public → vendor/assets}/javascripts/spice/spicemsg.js
  262. 0  {public → vendor/assets}/javascripts/spice/spicetype.js
  263. 0  {public → vendor/assets}/javascripts/spice/thirdparty/jsbn.js
  264. 0  {public → vendor/assets}/javascripts/spice/thirdparty/prng4.js
  265. 0  {public → vendor/assets}/javascripts/spice/thirdparty/rng.js
  266. 0  {public → vendor/assets}/javascripts/spice/thirdparty/rsa.js
  267. 0  {public → vendor/assets}/javascripts/spice/thirdparty/sha1.js
  268. 0  {public → vendor/assets}/javascripts/spice/ticket.js
  269. 0  {public → vendor/assets}/javascripts/spice/utils.js
  270. 0  {public → vendor/assets}/javascripts/spice/wire.js
  271. +6 −0 vendor/assets/javascripts/vendor.js
  272. 0  {public → vendor/assets}/stylesheets/jquery.jnotify.css
  273. +24 −13 public/stylesheets/multi-select.css → vendor/assets/stylesheets/multi-select.scss
  274. +3 −0  vendor/assets/stylesheets/vendor.css
View
1  .gitignore
@@ -14,6 +14,7 @@ bundler.d/Gemfile.local.rb
.idea
*.pyc
public/apipie-cache
+public/assets
.DS_Store
foreman_client
doc/apidoc*
View
5 Gemfile
@@ -2,14 +2,13 @@ require File.expand_path('../config/settings', __FILE__)
require File.expand_path('../lib/regexp_extensions', __FILE__)
source 'http://rubygems.org'
-gem 'rails', '3.0.20'
-gem "jquery-rails"
+gem 'rails', '3.2.13'
gem 'json'
gem 'rest-client', :require => 'rest_client'
gem "audited-activerecord", "3.0.0.rc1"
gem "will_paginate", "~> 3.0.2"
gem "ancestry", "~> 1.3"
-gem 'scoped_search', '>= 2.4'
+gem 'scoped_search', '>= 2.5'
gem 'net-ldap'
gem 'uuidtools'
gem "apipie-rails", '0.0.16'
View
0  public/images/Archlinux.png → app/assets/images/Archlinux.png
File renamed without changes
View
0  public/images/Centos.png → app/assets/images/Centos.png
File renamed without changes
View
0  public/images/Darwin.png → app/assets/images/Darwin.png
File renamed without changes
View
0  public/images/Debian.png → app/assets/images/Debian.png
File renamed without changes
View
0  public/images/Fedora.png → app/assets/images/Fedora.png
File renamed without changes
View
0  public/images/Redhat.png → app/assets/images/Redhat.png
File renamed without changes
View
0  public/images/SLC.png → app/assets/images/SLC.png
File renamed without changes
View
0  public/images/Scientific.png → app/assets/images/Scientific.png
File renamed without changes
View
0  public/images/Solaris.png → app/assets/images/Solaris.png
File renamed without changes
View
0  public/images/Suse.png → app/assets/images/Suse.png
File renamed without changes
View
0  public/images/Ubuntu.png → app/assets/images/Ubuntu.png
File renamed without changes
View
0  public/images/Windows.png → app/assets/images/Windows.png
File renamed without changes
View
0  public/images/bullet_toggle_plus.png → app/assets/images/bullet_toggle_plus.png
File renamed without changes
View
0  public/images/false.png → app/assets/images/false.png
File renamed without changes
View
0  public/images/foreman.png → app/assets/images/foreman.png
File renamed without changes
View
0  public/images/foreman_background.png → app/assets/images/foreman_background.png
File renamed without changes
View
0  public/images/foreman_large.png → app/assets/images/foreman_large.png
File renamed without changes
View
0  public/images/pie_chart_icon.png → app/assets/images/pie_chart_icon.png
File renamed without changes
View
0  public/images/spinner.gif → app/assets/images/spinner.gif
File renamed without changes
View
0  public/images/switch.png → app/assets/images/switch.png
File renamed without changes
View
0  public/images/toggle_check.png → app/assets/images/toggle_check.png
File renamed without changes
View
0  public/images/true.png → app/assets/images/true.png
File renamed without changes
View
0  public/images/user.jpg → app/assets/images/user.jpg
File renamed without changes
View
53 public/javascripts/application.js → app/assets/javascripts/application.js
@@ -1,8 +1,19 @@
+//= require jquery
+//= require jquery_ujs
+//= require jquery.ui.autocomplete
+//= require scoped_search
+//= require twitter/bootstrap
+//= require charts
+//= require vendor
+//= require_self
+
$(function() {
onContentLoad();
});
function onContentLoad(){
+ $('.autocomplete-input').scopedSearch();
+
$('.flash.error').hide().each(function(index, item) {
if ($('.alert-message.alert-error.base').length == 0) {
if ($('#host-conflicts-modal').length == 0) {
@@ -95,9 +106,19 @@ function add_fields(link, association, content) {
$(link).before(content.replace(regexp, new_id));
}
-function checkAll (id, checked) {
- $(id).attr('checked',checked);
-}
+$(document).ready(function() {
+ $("#check_all_roles").click(function(e) {
+ e.preventDefault();
+ $(".role_checkbox").prop('checked', true);
+
+ });
+
+ $("#uncheck_all_roles").click(function(e) {
+ e.preventDefault();
+ $(".role_checkbox").prop('checked', false);
+ });
+});
+
function toggleCheckboxesBySelector(selector) {
boxes = $(selector);
@@ -130,7 +151,7 @@ function template_info(div, url) {
hostgroup_id = $("#host_hostgroup_id :selected").attr("value");
build = $('input:radio[name$="[provision_method]"]:checked').val();
- $(div).html('<img src="/images/spinner.gif" alt="Wait" />');
+ $(div).html('<img src="/assets/spinner.gif" alt="Wait" />');
$(div).load(url + "?operatingsystem_id=" + os_id + "&hostgroup_id=" + hostgroup_id + "&environment_id=" + env_id+"&provisioning="+build,
function(response, status, xhr) {
if (status == "error") {
@@ -142,7 +163,7 @@ function template_info(div, url) {
$(document).ready(function() {
var common_settings = {
method : 'PUT',
- indicator : "<img src='../images/spinner.gif' />",
+ indicator : "<img src='/assets/spinner.gif' />",
tooltip : 'Click to edit..',
placeholder : 'Click to edit..',
submitdata : {authenticity_token: AUTH_TOKEN, format : "json"},
@@ -207,9 +228,9 @@ $(function() {
function magic_line(id, combo) {
var $el, leftPos, newWidth, $mainNav = $(id);
-
$mainNav.append("<li class='magic-line'></li>");
var $magicLine = $(id + " .magic-line");
+ if ($magicLine.size() == 0) return;
if ($('[data-toggle=collapse]:visible').length > 0){
$magicLine.hide();
}else{$magicLine.show();}
@@ -304,14 +325,14 @@ function filter_by_level(item){
}
function auth_source_selected(){
- var auth_source_id = $('#user_auth_source_id').attr('value');
- if (auth_source_id == '') return false;
- $.ajax({
- type:'get',
- url:'/users/auth_source_selected',
- data:'auth_source_id=' + auth_source_id
- })
+ var auth_source_id = $('#user_auth_source_id').val();
+ if (auth_source_id == '') {
+ $("#password").hide();
+ } else {
+ $("#password").show();
+ }
}
+
function show_release(element){
var os_family = $(element).val();
if (os_family == 'Debian' || os_family == 'Solaris') {
@@ -359,9 +380,9 @@ $(function() {
function update_puppetclasses(element) {
var host_id = $(element).attr('data-host-id');
- var env_id = $('*[id*=environment_id]').attr('value');
+ var env_id = $('*[id*=environment_id]').val();
var url = $(element).attr('data-url');
- var hostgroup_id = $('*[id*=hostgroup_id]').attr('value');
+ var hostgroup_id = $('*[id*=hostgroup_id]').val();
if (env_id == "") return;
$.ajax({
type: 'post',
@@ -370,10 +391,10 @@ function update_puppetclasses(element) {
success: function(request) {
$('#puppet_klasses').html(request);
reload_params();
+ $('[rel="twipsy"]').tooltip();
},
complete: function() {
$('#hostgroup_indicator').hide();
- $('[rel="twipsy"]').tooltip();
}
})
}
View
5 public/javascripts/charts.js → app/assets/javascripts/charts.js
@@ -3,12 +3,9 @@ $(function(){
var el = $(element);
var name = el.attr('chart-name');
var title = el.attr('chart-title');
- var border = $.parseJSON(el.attr('border'));
var expandable = el.attr('expandable');
- var show_title = $.parseJSON(el.attr('show_title'));
var data = $.parseJSON(el.attr('chart-data'));
-
- stat_pie(name, title, data, border, expandable, show_title);
+ stat_pie(name, title, data, false, expandable, false);
});
$(".statistics_bar").each(function(index, element){
View
16 public/javascripts/compute_resource.js → app/assets/javascripts/compute_resource.js
@@ -21,15 +21,8 @@ function providerSelected(item)
}
$("[type=submit]").attr("disabled",false);
var url = $(item).attr('data-url');
- $.ajax({
- type:'post',
- url: url,
- data:'provider=' + provider,
- success: function(result){
- $('#compute_connection').html($(result).find("#compute_connection"));
- $('#compute_connection').append($(result).find(".alert-message"));
- }
- });
+ var data = 'provider=' + provider;
+ $('#compute_connection').load(url + ' div#compute_connection', data);
}
function testConnection(item) {
@@ -40,8 +33,9 @@ function testConnection(item) {
url: $(item).attr('data-url'),
data: $('form').serialize(),
success:function (result) {
- $('#compute_connection').html($(result).find("#compute_connection"));
- $('#compute_connection').prepend($(result).find(".alert-message"));
+ var res = $('<div>' + result + '</div>');
+ $('#compute_connection').html(res.find("#compute_connection"));
+ $('#compute_connection').prepend(res.find(".alert-message"));
},
complete:function (result) {
$('#test_connection_indicator').hide();
View
2  public/javascripts/config_template.js → app/assets/javascripts/config_template.js
@@ -2,7 +2,7 @@ var $editor
$(function() {
var template_text = $(".template_text");
- if ($.browser.msie && $.browser.version.slice(0,1) < 10) {
+ if ($.browser && $.browser.msie && $.browser.version.slice(0,1) < 10) {
$('.subnav').hide();
if ($('.diffMode').size() >0) {
IE_diff_mode(template_text);
View
2  public/javascripts/host_checkbox.js → app/assets/javascripts/host_checkbox.js
@@ -107,7 +107,7 @@ $(function() {
var title = $(this).attr('data-original-title') + ' - The following hosts are about to be changed';
var url = $(this).attr('href') + "?" + $.param({host_ids: $.foremanSelectedHosts});
$('#confirmation-modal .modal-header h3').text(title);
- $('#confirmation-modal .modal-body').empty().append("<img class='modal-loading' src='/images/spinner.gif'>");
+ $('#confirmation-modal .modal-body').empty().append("<img class='modal-loading' src='/assets/spinner.gif'>");
$('#confirmation-modal').modal({show: "true", backdrop: "static"});
$("#confirmation-modal .modal-body").load(url + " #content",
function(response, status, xhr) {
View
74 public/javascripts/host_edit.js → app/assets/javascripts/host_edit.js
@@ -1,7 +1,6 @@
function computeResourceSelected(item){
var compute = $(item).val();
var attrs = attribute_hash(['architecture_id', 'compute_resource_id', 'operatingsystem_id']);
- var label = $(item).children(":selected").text();
if(compute=='') { //Bare Metal
$('#mac_address').show();
$("#model_name").show();
@@ -151,7 +150,7 @@ function add_puppet_class(item){
var link = content.children('a');
link.attr('onclick', 'remove_puppet_class(this)');
link.attr('data-original-title', 'Click to undo adding this class');
- link.removeClass('ui-icon-plus').addClass('ui-icon-minus').tooltip();
+ link.removeClass('icon-plus-sign').addClass('icon-remove-sign').tooltip();
$('#selected_classes').append(content);
@@ -185,7 +184,7 @@ function load_puppet_class_parameters(item) {
if (url == undefined) return; // no parameters
var placeholder = $('<tr id="puppetclass_'+id+'_params_loading">'+
- '<td colspan="5"><p><img src="/images/spinner.gif" alt="Wait" /> Loading parameters...</p></td>'+'</tr>');
+ '<td colspan="5"><p><img src="/assets/spinner.gif" alt="Wait" /> Loading parameters...</p></td>'+'</tr>');
$('#inherited_puppetclasses_parameters').append(placeholder);
$.ajax({
url: url,
@@ -201,64 +200,39 @@ function load_puppet_class_parameters(item) {
}
function hostgroup_changed(element) {
- var host_id = $(element).attr('data-host-id');
- var url = $(element).attr('data-url');
- var attrs = attribute_hash(['hostgroup_id', 'compute_resource_id', 'organization_id', 'location_id']);
- if (attrs["hostgroup_id"] == undefined) attrs["hostgroup_id"] = $('#hostgroup_parent_id').attr('value');
- $('#hostgroup_indicator').show();
+ var host_id = $(element).data('host-id');
if (!host_id){ // a new host
- $.ajax({
- type:'post',
- url: url,
- data:attrs,
- complete: function(){
- $('#hostgroup_indicator').hide();
- $('[rel="twipsy"]').tooltip();
- update_provisioning_image();
- reload_params();
- }
- })
+ update_form(element);
} else { // edit host
update_puppetclasses(element);
}
}
function organization_changed(element) {
- var url = $(element).attr('data-url');
- var data = $('form').serialize().replace('method=put', 'method=post');
- $('#organization_indicator').show();
- $.ajax({
- type: 'post',
- url: url,
- data: data,
- success: function(response) {
- $('#organization_indicator').hide();
- $('form').html(response);
- onContentLoad();
- },
- complete: function(){
- $('#organization_indicator').hide();
- $('[rel="twipsy"]').tooltip();
- }
- })
+ update_form(element);
}
function location_changed(element) {
- var url = $(element).attr('data-url');
+ update_form(element);
+}
+
+
+function update_form(element) {
+ var url = $(element).data('url');
var data = $('form').serialize().replace('method=put', 'method=post');
- $('#location_indicator').show();
+ var indicator = $(element).parent().find('img');
+ indicator.show();
$.ajax({
type: 'post',
url: url,
data: data,
success: function(response) {
- $('#location_indicator').hide();
$('form').html(response);
+ $("[id$='subnet_id']").first().change();
onContentLoad();
},
complete: function(){
- $('#location_indicator').hide();
- $('[rel="twipsy"]').tooltip();
+ indicator.hide();
}
})
}
@@ -276,11 +250,15 @@ function subnet_selected(element){
}
var attrs = attribute_hash(["subnet_id", "host_mac", 'organization_id', 'location_id']);
$('#subnet_indicator').show();
+ var url = $(element).data('url');
$.ajax({
data: attrs,
type:'post',
- url: foreman_url('/subnets/freeip'),
- complete: function(){$('#subnet_indicator').hide()}
+ url: url,
+ complete: function(){$('#subnet_indicator').hide()},
+ success: function(data){
+ $('#host_ip').val(data.ip);
+ }
})
}
@@ -302,11 +280,13 @@ function _to_int(str){
function domain_selected(element){
var attrs = attribute_hash(['domain_id', 'organization_id', 'location_id']);
- var url = $(element).attr('data-url');
+ var url = $(element).data('url');
+ $('#domain_indicator').show();
$.ajax({
data: attrs,
type:'post',
url: url,
+ complete: function(){$('#domain_indicator').hide()},
success: function(request) {
$('#subnet_select').html(request);
reload_params();
@@ -434,18 +414,18 @@ function override_class_param(item){
}
function reload_params(){
- var url = $('#params-tab').attr('data-url');
+ var url = $('#params-tab').data('url');
var data = $("[data-submit='progress_bar']").serialize().replace('method=put', 'method=post');
load_with_placeholder('inherited_parameters', url, data)
- var url2 = $('#params-tab').attr('data-url2');
+ var url2 = $('#params-tab').data('url2');
load_with_placeholder('inherited_puppetclasses_parameters', url2, data)
}
function load_with_placeholder(target, url, data){
if(url==undefined) return;
var placeholder = $('<tr id="' + target + '_loading" >'+
- '<td colspan="4"><p><img src="/images/spinner.gif" alt="Wait" /> Loading parameters...</p></td></tr>');
+ '<td colspan="4"><p><img src="/assets/spinner.gif" alt="Wait" /> Loading parameters...</p></td></tr>');
$('#' + target + ' tbody').replaceWith(placeholder);
$.ajax({
type:'post',
View
0  public/javascripts/lookup_keys.js → app/assets/javascripts/lookup_keys.js
File renamed without changes
View
0  public/javascripts/nfs_visibility.js → app/assets/javascripts/nfs_visibility.js
File renamed without changes
View
0  public/javascripts/noVNC.js → app/assets/javascripts/noVNC.js
File renamed without changes
View
0  public/javascripts/reports.js → app/assets/javascripts/reports.js
File renamed without changes
View
0  public/javascripts/spice.js → app/assets/javascripts/spice.js
File renamed without changes
View
0  public/javascripts/taxonomy.js → app/assets/javascripts/taxonomy.js
File renamed without changes
View
0  public/javascripts/trends.js → app/assets/javascripts/trends.js
File renamed without changes
View
0  public/stylesheets/.gitkeep → app/assets/stylesheets/.gitkeep
File renamed without changes
View
269 public/stylesheets/style.css → app/assets/stylesheets/application.scss
@@ -1,52 +1,16 @@
-.auto_complete_input {
- width: 98%;
- margin-right: -12px;
-}
-
-.ui-autocomplete-loading
-{
- background: white url('../images/spinner.gif') right center no-repeat;
-}
-
-.auto_complete_clear{
- background: url('../images/ui-icons_888888_256x240.png') center no-repeat;
- background-position: -80px -128px;
- display:inline-block;width:14px;height:14px;
- margin-left:-12px;margin-bottom: -5px;
-}
-.auto_complete_clear:hover{
- background: url('../images/ui-icons_454545_256x240.png');
- background-position: -80px -128px;
-}
-
-.ui-autocomplete-completed {
- color: #aaa;
- font-weight: lighter;
- padding: .2em .4em;
- margin: .8em 0 .2em;
- line-height: 1.5;
-}
-.ui-autocomplete-category {
- font-weight: bold;
- padding: .2em .4em;
- margin: .8em 0 .2em;
- line-height: 1.5;
-}
-.ui-autocomplete-error {
- color: red;
- padding: .2em .4em;
- margin: .8em 0 .2em;
- line-height: 1.5;
-}
-
+/*
+ *= require jquery.ui.autocomplete
+ *= require vendor
+ *= require scoped_search
+ *= require_self
+ *= require_tree .
+ */
html { height: 100%; overflow: auto;}
body { height: 100%; }
#wrap { min-height: 100%; }
#main {padding-bottom: 38px; padding-top:60px; }
-
-
#footer {
margin-top: -38px; /* negative value of footer height */
height: 30px;
@@ -56,17 +20,12 @@ body { height: 100%; }
text-align:center;
vertical-align: bottom;
clear:both;
-}
-#footer a { color: #000; text-decoration: none;}
-#footer span {position: relative; left: 240px;}
-
-
-th.underlined {
- text-decoration: underline
+ & a { color: #000; text-decoration: none;}
+ & span {position: relative; left: 240px;}
}
.half {
- width: 44%;
+ width: 44%;
}
.logo {
@@ -80,38 +39,36 @@ th.underlined {
}
.narrow-left {
- padding-left: 0px !important;
+ padding-left: 0px !important;
}
.narrow-right {
- padding-right: 0px !important;
+ padding-right: 0px !important;
}
-
-#login-form label {
- font-size: 1.23em !important;
- display: block;
- font-weight: bold; color: #507ea1;
+#login-form{
+ width: 390px;
+ margin-top:150px; padding:6em 2em; margin-left: auto; margin-right: auto; border: 2px solid #7f9bb1;
+ -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;
+ background: url(foreman_background.png) no-repeat right center;
+ & label {
+ font-size: 1.23em !important;
+ display: block;
+ font-weight: bold; color: #507ea1;
}
-
-#login-form input[type="password"], #login-form input[type="text"] {
+& input[type="password"],
+& input[type="text"] {
font-size: 20px;
height: 32px;
width: 380px;
}
-
-#login-form {
- width: 390px;
- margin-top:150px; padding:6em 2em; margin-left: auto; margin-right: auto; border: 2px solid #7f9bb1;
- -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;
- background: url(../images/foreman_background.png) no-repeat right center;
}
.login-large-logo{
- margin-left: -40px; margin-right: auto;
- display: block;
- margin-bottom: 50px;
- margin-top: -170px;
- padding-right: 170px;
+ margin-left: -40px; margin-right: auto;
+ display: block;
+ margin-bottom: 50px;
+ margin-top: -170px;
+ padding-right: 170px;
}
/***** Flash & error messages ****/
@@ -133,14 +90,14 @@ div.flash {
}
div.flash.error, #errorExplanation {
- background: url(../images/false.png) 8px 5px no-repeat;
+ background: url(false.png) 8px 5px no-repeat;
background-color: #ffe3e3;
border-color: #dd0000;
color: #550000;
}
div.flash.notice {
- background: url(../images/true.png) 8px 5px no-repeat;
+ background: url(true.png) 8px 5px no-repeat;
background-color: #dfffdf;
border-color: #9fcf9f;
color: #005f00;
@@ -170,9 +127,6 @@ div.flash.notice {
.field-with-errors input, .field-with-errors textarea, .field-with-errors select {border: 2px solid #BC1C3D;}
-.odd {background-color:#f6f7f8;}
-.even {background-color: #fff;}
-
.fieldWithErrors input,
.fieldWithErrors textarea,
.fieldWithErrors select {
@@ -219,15 +173,15 @@ div.flash.notice {
#actions_dropdown {
float: right;
- margin-left: 3px;
+ margin-left: 3px;
}
#settings li {
list-style-type:none;
padding:0 0 8px;
}
-tr span.expander {background-image: url(../images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;}
-tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png);}
+tr span.expander {background-image: url(bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;}
+tr.open span.expander {background-image: url(bullet_toggle_minus.png);}
/* text align left */
.la { text-align: left; }
@@ -276,12 +230,12 @@ tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png);
}
.editable {
- background: url("../images/edit.png") no-repeat scroll 98% 6px transparent;
+ background: url("edit.png") no-repeat scroll 98% 6px transparent;
cursor: pointer;
padding: 4px 26px 4px 0px;
}
.editable:hover {
- background: url("../images/edit-hover.png") no-repeat scroll 98% 6px #F2F2F2;
+ background: url("edit-hover.png") no-repeat scroll 98% 6px #F2F2F2;
}
.tab-error {
color: #b94a48 !important;
@@ -307,51 +261,43 @@ tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png);
select{padding: initial;}
-.gray{
- color:#808080 !important;
-}
-
.stats-grid{
- float:left;margin:0 0 20px 20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);
+ float:left;margin:0 0 20px 20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);
}
-.stats-grid:hover{
- border-color:#0069d6;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);
+.stats-grid:hover {
+ border-color:#0069d6;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);
}
-table .span0{float:none;width:20px;margin-left:0;}
-
.inputs-list{
-margin-left:0;margin-bottom:18px;list-style:none;display: inline;
+ margin-left:0;margin-bottom:18px;list-style:none;display: inline;
}
-.table th{background: rgba(0, 0, 0, 0.08);}
.delete{color: #b94a48 !important; cursor: auto;}
.setting_value form { margin: 0 !important;}
-.form-actions{background-color: #f5f5f5;}
.ignore-subnet{margin-right: 10px;margin-top: -25px;float: right;}
-.tabs-left .nav-tabs>li>a.btn:hover{background:inherit;background-color: #408140;}
+.tabs-left .nav-tabs>li>a.btn:hover {background:inherit;background-color: #408140;}
.ace_editor{border: 2px solid #eee;}
.audit-content{border-bottom: 1px solid #ccc; padding-bottom: 9px; margin-bottom: 9px; margin-top: 9px; }
.tab-pane{min-height: 420px;}
.subnav {
-height: 36px;
-background-color: #EEE;
-background-repeat: repeat-x;
-background-image: -moz-linear-gradient(top, whiteSmoke 0%, #EEE 100%);
-background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, whiteSmoke), color-stop(100%, #EEE));
-background-image: -webkit-linear-gradient(top, whiteSmoke 0%, #EEE 100%);
-background-image: -ms-linear-gradient(top, whiteSmoke 0%, #EEE 100%);
-background-image: -o-linear-gradient(top, whiteSmoke 0%, #EEE 100%);
-filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#eeeeee',GradientType=0 );
-background-image: linear-gradient(top, whiteSmoke 0%, #EEE 100%);
-border: 1px solid #E5E5E5;
--webkit-border-radius: 4px;
--moz-border-radius: 4px;
-border-radius: 4px;
+ height: 36px;
+ background-color: #EEE;
+ background-repeat: repeat-x;
+ background-image: -moz-linear-gradient(top, whiteSmoke 0%, #EEE 100%);
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, whiteSmoke), color-stop(100%, #EEE));
+ background-image: -webkit-linear-gradient(top, whiteSmoke 0%, #EEE 100%);
+ background-image: -ms-linear-gradient(top, whiteSmoke 0%, #EEE 100%);
+ background-image: -o-linear-gradient(top, whiteSmoke 0%, #EEE 100%);
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#eeeeee',GradientType=0 );
+ background-image: linear-gradient(top, whiteSmoke 0%, #EEE 100%);
+ border: 1px solid #E5E5E5;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
}
.subnav ul { margin-top: 7px;margin-bottom: 0;}
.subnav ul li { list-style-type: none; margin: 0; display: inline-block;}
@@ -375,21 +321,20 @@ border-radius: 4px;
.override-param{
text-decoration: line-through;
}
-.btn-toolbar-condensed{margin: 0;}
+.btn-toolbar-condensed{margin: 0 !important;}
-.grey{color: #d3d3d3 !important;}
+.grey, .gray{color: #808080 !important;}
.black{color: #000 !important;}
.control-group.condensed{margin-bottom: 0;}
.control-group.condensed textarea {
- border-color: #f5f5f5;
- background-color: #f5f5f5;
- box-shadow: none;
- -moz-box-shadow: none;
- -webkit-box-shadow: none;
- resize: none;
- cursor: text;
- autoResize()
+ border-color: #f5f5f5;
+ background-color: #f5f5f5;
+ box-shadow: none;
+ -moz-box-shadow: none;
+ -webkit-box-shadow: none;
+ resize: none;
+ cursor: text;
}
.control-group.condensed.error textarea{border-color: #b94a48;}
@@ -398,66 +343,62 @@ border-radius: 4px;
.gravatar{width: 30px; height: 30px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}
.text-label{font-weight: bold; color: #999}
.boxed-label{
- margin-right: 5px;
- display: inline-block;
- padding: 4px 12px;
- font-weight: bold;
- line-height: 20px;
- color: #999;
- text-align: center;
- vertical-align: middle;
- border: 1px solid #BBB;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-h1, h2, h3{line-height: 32px;}
-.btn-small .caret{margin-top: 8px;}
-.btn a {text-decoration: none; color: #000;}
+ margin-right: 5px;
+ display: inline-block;
+ padding: 4px 12px;
+ font-weight: bold;
+ line-height: 20px;
+ color: #999;
+ text-align: center;
+ vertical-align: middle;
+ border: 1px solid #BBB;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+}
/*table sorter bootstrap css*/
div.dataTables_length label {
- float: left;
- text-align: left;
+ float: left;
+ text-align: left;
}
div.dataTables_length select {
- width: 75px;
+ width: 75px;
}
div.dataTables_filter label {
- float: left;
+ float: left;
}
div.dataTables_info {
- padding-top: 8px;
+ padding-top: 8px;
}
div.dataTables_paginate {
- float: right;
- margin: 0;
+ float: right;
+ margin: 0;
}
table {
- margin-bottom: 6px !important;
- clear: both;
+ margin-bottom: 6px !important;
+ clear: both;
}
table.table thead .sorting,
table.table thead .sorting_asc,
table.table thead .sorting_desc,
table.table thead .sorting_asc_disabled,
table.table thead .sorting_desc_disabled {
- cursor: pointer;
- *cursor: hand;
+ cursor: pointer;
+ *cursor: hand;
}
-table.table thead .sorting { background: #f9f9f9 url('../images/sort_both.png') no-repeat center right; }
-table.table thead .sorting_asc { background: #f9f9f9 url('../images/sort_asc.png') no-repeat center right; }
-table.table thead .sorting_desc { background: #f9f9f9 url('../images/sort_desc.png') no-repeat center right; }
+table.table thead .sorting { background: #f9f9f9 url('sort_both.png') no-repeat center right; }
+table.table thead .sorting_asc { background: #f9f9f9 url('sort_asc.png') no-repeat center right; }
+table.table thead .sorting_desc { background: #f9f9f9 url('sort_desc.png') no-repeat center right; }
-table.table thead .sorting_asc_disabled { background: #f9f9f9 url('../images/sort_asc_disabled.png') no-repeat center right; }
-table.table thead .sorting_desc_disabled { background: #f9f9f9 url('../images/sort_desc_disabled.png') no-repeat center right; }
+table.table thead .sorting_asc_disabled { background: #f9f9f9 url('sort_asc_disabled.png') no-repeat center right; }
+table.table thead .sorting_desc_disabled { background: #f9f9f9 url('sort_desc_disabled.png') no-repeat center right; }
.diff-modal{width: 720px; height: 520px;}
.modal-body{max-height: 800px;}
@@ -466,16 +407,16 @@ table.table thead .sorting_desc_disabled { background: #f9f9f9 url('../images/so
.console-screen
{
- display: inline-block;
- padding: 10px;
- margin-top: 18px;
- min-width: 720px;
- min-height: 400px;
- border: solid #222222 1px;
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
- -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
- box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- border-radius: 10px;
-}
+ display: inline-block;
+ padding: 10px;
+ margin-top: 18px;
+ min-width: 720px;
+ min-height: 400px;
+ border: solid #222222 1px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
+ -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
+ -moz-border-radius: 10px;
+ -webkit-border-radius: 10px;
+ border-radius: 10px;
+}
View
19 app/assets/stylesheets/bootstrap_and_overrides.scss
@@ -0,0 +1,19 @@
+/*
+ =require twitter-bootstrap-static/bootstrap
+ =require twitter-bootstrap-static/sprites
+ */
+
+table .span0{
+ float:none;width:20px;margin-left:0;
+}
+
+.table th{
+ background: rgba(0, 0, 0, 0.08);
+ & a {
+ text-decoration: none;
+ color: #333333;
+ }
+}
+
+h1, h2, h3{line-height: 32px;}
+.btn a {text-decoration: none; color: #333333;}
View
60 app/assets/stylesheets/wizard.scss
@@ -0,0 +1,60 @@
+.wizard li {
+ padding: 10px 12px 10px;
+ margin-right: 5px;
+ margin-bottom: 30px;
+ background: #efefef;
+ position: relative;
+ display: inline-block;
+ &:before {
+ width: 0;
+ height: 0;
+ border-top: 20px inset transparent;
+ border-bottom: 20px inset transparent;
+ border-left: 20px solid #fff;
+ position: absolute;
+ content: "";
+ top: 0;
+ left: 0;
+ }
+ &:after {
+ width: 0;
+ height: 0;
+ border-top: 20px inset transparent;
+ border-bottom: 20px inset transparent;
+ border-left: 20px solid #efefef;
+ position: absolute;
+ content: "";
+ top: 0;
+ right: -20px;
+ z-index: 2;
+ }
+ &:first-child:before,
+ &:last-child:after {
+ border: none;
+ }
+ &:first-child {
+ -webkit-border-radius: 4px 0 0 4px;
+ -moz-border-radius: 4px 0 0 4px;
+ border-radius: 4px 0 0 4px;
+ }
+ &:last-child {
+ -webkit-border-radius: 0 4px 4px 0;
+ -moz-border-radius: 0 4px 4px 0;
+ border-radius: 0 4px 4px 0;
+ }
+}
+.wizard .badge {
+ margin: 0 5px 0 18px;
+ position: relative;
+ top: -1px;
+}
+.wizard a:first-child .badge {
+ margin-left: 0;
+}
+.wizard .active {
+ background: #007ACC;
+ color: #fff;
+ &:after {
+ border-left-color: #007ACC;
+ }
+}
View
8 app/controllers/concerns/api/taxonomy_scope.rb
@@ -6,11 +6,9 @@ module TaxonomyScope
before_filter :set_taxonomy_scope
end
- module InstanceMethods
- def set_taxonomy_scope
- Location.current ||= @location = Location.find_by_id(params[:location_id]) if SETTINGS[:locations_enabled]
- Organization.current ||= @organization = Organization.find_by_id(params[:organization_id]) if SETTINGS[:organizations_enabled]
- end
+ def set_taxonomy_scope
+ Location.current ||= @location = Location.find_by_id(params[:location_id]) if SETTINGS[:locations_enabled]
+ Organization.current ||= @organization = Organization.find_by_id(params[:organization_id]) if SETTINGS[:organizations_enabled]
end
end
View
131 app/controllers/concerns/api/v2/taxonomies_controller.rb
@@ -10,93 +10,90 @@ module Api::V2::TaxonomiesController
before_filter :params_match_database, :only => %w(create update)
end
- module InstanceMethods
-
- def index
- if @nested_obj
- #@taxonomies = @domain.locations.paginate(paginate_options)
- @taxonomies = @nested_obj.send(taxonomies_plural).search_for(*search_options).paginate(paginate_options)
- else
- @taxonomies = taxonomy_class.search_for(*search_options).paginate(paginate_options)
- end
- instance_variable_set("@#{taxonomies_plural}", @taxonomies)
- render 'api/v2/taxonomies/index'
+ def index
+ if @nested_obj
+ #@taxonomies = @domain.locations.paginate(paginate_options)
+ @taxonomies = @nested_obj.send(taxonomies_plural).search_for(*search_options).paginate(paginate_options)
+ else
+ @taxonomies = taxonomy_class.search_for(*search_options).paginate(paginate_options)
end
+ instance_variable_set("@#{taxonomies_plural}", @taxonomies)
+ render 'api/v2/taxonomies/index'
+ end
- def show
- render 'api/v2/taxonomies/show'
- end
+ def show
+ render 'api/v2/taxonomies/show'
+ end
- def create
- @taxonomy = taxonomy_class.new(params[taxonomy_single.to_sym])
- instance_variable_set("@#{taxonomy_single}", @taxonomy)
- process_response @taxonomy.save
- end
+ def create
+ @taxonomy = taxonomy_class.new(params[taxonomy_single.to_sym])
+ instance_variable_set("@#{taxonomy_single}", @taxonomy)
+ process_response @taxonomy.save
+ end
- def update
- # NOTE - if not ! and invalid, the error is undefined method `permission_failed?' for #<Location:0x7fe38c1d3ec8> (NoMethodError)
- # removed process_response & added explicit render 'api/v2/taxonomies/update'. Otherwise, *_ids are not returned
+ def update
+ # NOTE - if not ! and invalid, the error is undefined method `permission_failed?' for #<Location:0x7fe38c1d3ec8> (NoMethodError)
+ # removed process_response & added explicit render 'api/v2/taxonomies/update'. Otherwise, *_ids are not returned
- process_response @taxonomy.update_attributes(params[taxonomy_single.to_sym])
- end
+ process_response @taxonomy.update_attributes(params[taxonomy_single.to_sym])
+ end
- def destroy
- process_response @taxonomy.destroy
- end
+ def destroy
+ process_response @taxonomy.destroy
+ end
- private
+ private
- def params_match_database
- # change params[:select_all_types] to params[:ignore_types] to match database
- if params[taxonomy_single.to_sym][:select_all_types]
- params[taxonomy_single.to_sym][:ignore_types] = params[taxonomy_single.to_sym][:select_all_types]
- params[taxonomy_single.to_sym] = params[taxonomy_single.to_sym].reject { |k, v| k == "select_all_types" }
- return params[taxonomy_single.to_sym]
- end
+ def params_match_database
+ # change params[:select_all_types] to params[:ignore_types] to match database
+ if params[taxonomy_single.to_sym][:select_all_types]
+ params[taxonomy_single.to_sym][:ignore_types] = params[taxonomy_single.to_sym][:select_all_types]
+ params[taxonomy_single.to_sym] = params[taxonomy_single.to_sym].reject { |k, v| k == "select_all_types" }
+ return params[taxonomy_single.to_sym]
end
+ end
- def find_nested_object
- params.keys.each do |param|
- if param =~ /(\w+)_id$/
- resource_identifying_attributes.each do |key|
- find_method = "find_by_#{key}"
- @nested_obj ||= $1.classify.constantize.send(find_method, params[param])
- end
+ def find_nested_object
+ params.keys.each do |param|
+ if param =~ /(\w+)_id$/
+ resource_identifying_attributes.each do |key|
+ find_method = "find_by_#{key}"
+ @nested_obj ||= $1.classify.constantize.send(find_method, params[param])
end
end
- return @nested_obj
end
+ return @nested_obj
+ end
- def taxonomy_id
- case controller_name
- when 'organizations'
- :organization_id
- when 'locations'
- :location_id
- end
+ def taxonomy_id
+ case controller_name
+ when 'organizations'
+ :organization_id
+ when 'locations'
+ :location_id
end
+ end
- def taxonomy_single
- controller_name.singularize
- end
+ def taxonomy_single
+ controller_name.singularize
+ end
- def taxonomies_plural
- controller_name
- end
+ def taxonomies_plural
+ controller_name
+ end
- def taxonomy_class
- controller_name.classify.constantize
- end
+ def taxonomy_class
+ controller_name.classify.constantize
+ end
- def find_taxonomy
- case controller_name
- when 'organizations'
- @taxonomy = @organization = Organization.find(params[:id])
- when 'locations'
- @taxonomy = @location = Location.find(params[:id])
- end
+ def find_taxonomy
+ case controller_name
+ when 'organizations'
+ @taxonomy = @organization = Organization.find(params[:id])
+ when 'locations'
+ @taxonomy = @location = Location.find(params[:id])
end
-
end
+
end
View
2  app/controllers/domains_controller.rb
@@ -7,7 +7,7 @@ def index
respond_to do |format|
format.html do
@domains = values.paginate :page => params[:page]
- @counter = Host.count(:group => :domain_id, :conditions => {:domain_id => @domains})
+ @counter = Host.count(:group => :domain_id, :conditions => {:domain_id => @domains.all})
end
format.json { render :json => values }
end
View
2  app/controllers/environments_controller.rb
@@ -11,7 +11,7 @@ def index
respond_to do |format|
format.html do
@environments = values.paginate :page => params[:page]
- @counter = Host.count(:group => :environment_id, :conditions => {:environment_id => @environments})
+ @counter = Host.count(:group => :environment_id, :conditions => {:environment_id => @environments.all})
end
format.json { render :json => values.as_json }
end
View
4 app/controllers/hostgroups_controller.rb
@@ -34,11 +34,11 @@ def nest
# Clone the hostgroup
def clone
- new = @hostgroup.clone
+ new = @hostgroup.dup
load_vars_for_ajax
new.puppetclasses = @hostgroup.puppetclasses
# Clone any parameters as well
- @hostgroup.group_parameters.each{|param| new.group_parameters << param.clone}
+ @hostgroup.group_parameters.each{|param| new.group_parameters << param.dup}
new.name = ""
new.valid?
@hostgroup = new
View
64 app/controllers/hosts_controller.rb
@@ -34,9 +34,9 @@ def index (title = nil)
end
respond_to do |format|
format.html do
- @hosts = search.paginate :page => params[:page], :include => included_associations
+ @hosts = search.includes(included_associations).paginate(:page => params[:page])
# SQL optimizations queries
- @last_reports = Report.maximum(:id, :group => :host_id, :conditions => {:host_id => @hosts})
+ @last_reports = Report.where(:host_id => @hosts.map(&:id)).group(:host_id).maximum(:id)
# rendering index page for non index page requests (out of sync hosts etc)
render :index if title and (@title = title)
end
@@ -75,7 +75,7 @@ def new
# Clone the host
def clone
- new = @host.clone
+ new = @host.dup
load_vars_for_ajax
flash[:warning] = "The marked fields will need reviewing"
new.valid?
@@ -412,46 +412,25 @@ def disabled
end
def process_hostgroup
- @hostgroup = Hostgroup.find(params[:hostgroup_id]) if params[:hostgroup_id].to_i > 0
+ @hostgroup = Hostgroup.find(params[:host][:hostgroup_id]) if params[:host][:hostgroup_id].to_i > 0
return head(:not_found) unless @hostgroup
- Taxonomy.as_taxonomy @organization, @location do
- @architecture = @hostgroup.architecture
- @operatingsystem = @hostgroup.operatingsystem
- @environment = @hostgroup.environment
- @domain = @hostgroup.domain
- @subnet = @hostgroup.subnet
+ organization = Organization.find(params[:host][:organization_id]) unless params[:host][:organization_id].empty?
+ location = Location.find(params[:host][:location_id]) unless params[:host][:location_id].empty?
- @host = Host.new
- @host.hostgroup = @hostgroup
- @host.compute_resource_id = params[:compute_resource_id] if params[:compute_resource_id].present?
- @host.set_hostgroup_defaults
+ @architecture = @hostgroup.architecture
+ @operatingsystem = @hostgroup.operatingsystem
+ @environment = @hostgroup.environment
+ @domain = @hostgroup.domain
+ @subnet = @hostgroup.subnet
+ @host = Host.new(params[:host])
+ @host.set_hostgroup_defaults
- render :update do |page|
- [:environment_id, :puppet_ca_proxy_id, :puppet_proxy_id].each do |field|
- page["*[id*=#{field}]"].val(@hostgroup.send(field)) if @hostgroup.send(field).present?
- end
- page['#puppet_klasses'].html(render(:partial => 'puppetclasses/class_selection', :locals => {:obj => @host})) if @environment
-
- if SETTINGS[:unattended]
- if @architecture
- page['#os_select'].html(render(:partial => 'common/os_selection/architecture', :locals => {:item => @host}))
- page['#*[id*=architecture_id]'].val(@architecture.id)
- end
-
- page['#media_select'].html(render(:partial => 'common/os_selection/operatingsystem', :locals => {:item => @host})) if @operatingsystem
-
- if @domain
- page['*[id*=domain_id]'].val(@domain.id)
- if @domain.subnets.any?
- page['#subnet_select'].html(render(:partial => 'common/domain', :locals => {:item => @host}))
- page['#host_subnet_id'].val(@subnet.id).change if @subnet
- end
- end
- end
- end
+ Taxonomy.as_taxonomy organization, location do
+ render :partial => "form"
end
+
end
def process_taxonomy
@@ -490,9 +469,14 @@ def puppetclass_parameters
private
def set_host_type
- if params[:host] and params[:host][:type] and params[:host][:type].constantize.new.kind_of?(Host::Base)
- @host = @host.becomes(params[:host][:type].constantize)
- @host.type = params[:host][:type]
+ return unless params[:host] and params[:host][:type]
+ type = params[:host].delete(:type) #important, otherwise mass assignment will save the type.
+ if type.constantize.new.kind_of?(Host::Base)
+ @host = @host.becomes(type.constantize)
+ @host.type = type
+ else
+ error "invalid type: #{type} requested"
+ render :unprocessable_entity
end
rescue => e
error "Something went wrong while changing host type - #{e}"
View
2  app/controllers/models_controller.rb
@@ -6,7 +6,7 @@ def index
respond_to do |format|
format.html do
@models = values.paginate :page => params[:page]
- @counter = Host.count(:group => :model_id, :conditions => {:model_id => @models})
+ @counter = Host.count(:group => :model_id, :conditions => {:model_id => @models.all})
end
format.json { render :json => values }
end
View
2  app/controllers/operatingsystems_controller.rb
@@ -7,7 +7,7 @@ def index
respond_to do |format|
format.html do
@operatingsystems = values.paginate(:page => params[:page])
- @counter = Host.count(:group => :operatingsystem_id, :conditions => {:operatingsystem_id => @operatingsystems})
+ @counter = Host.count(:group => :operatingsystem_id, :conditions => {:operatingsystem_id => @operatingsystems.all})
end
format.json { render :json => values.all(:include => [:media, :architectures, :ptables]) }
end
View
2  app/controllers/puppetclasses_controller.rb
@@ -17,7 +17,7 @@ def index
respond_to do |format|
format.html do
@puppetclasses = values.paginate(:page => params[:page])
- @host_counter = Host.count(:group => :puppetclass_id, :joins => :puppetclasses, :conditions => {:puppetclasses => {:id => @puppetclasses}})
+ @host_counter = Host.count(:group => :puppetclass_id, :joins => :puppetclasses, :conditions => {:puppetclasses => {:id => @puppetclasses.all}})
@keys_counter = Puppetclass.joins(:class_params).select('distinct environment_classes.lookup_key_id').count(:group => 'name')
end
format.json { render :json => Puppetclass.classes2hash(values.all(:select => "name, id")) }
View
16 app/controllers/subnets_controller.rb
@@ -47,20 +47,12 @@ def destroy
# query our subnet dhcp proxy for an unused IP
def freeip
not_found and return unless (s=params[:subnet_id].to_i) > 0
- @organization = params[:organization_id].blank? ? nil : Organization.find(params[:organization_id])
- @location = params[:location_id].blank? ? nil : Location.find(params[:location_id])
- Taxonomy.as_taxonomy @organization, @location do
+ organization = params[:organization_id].blank? ? nil : Organization.find(params[:organization_id])
+ location = params[:location_id].blank? ? nil : Location.find(params[:location_id])
+ Taxonomy.as_taxonomy organization, location do
not_found and return unless (subnet = Subnet.find(s))
if (ip = subnet.unused_ip(params[:host_mac]))
- respond_to do |format|
- format.html do
- render :update do |page|
- page['#host_ip'].val(ip)
- page['#host_ip'].show('highlight', 5000)
- end
- end
- format.json { render :json => {:ip => ip} }
- end
+ render :json => {:ip => ip}
else
# we don't want any failures if we failed to query our proxy
head :status => 200
View
2  app/controllers/unattended_controller.rb
@@ -1,5 +1,5 @@
class UnattendedController < ApplicationController
- layout nil
+ layout false
# Methods which return configuration files for syslinux(pxe), pxegrub or g/ipxe
PXE_CONFIG_URLS = [:pxe_kickstart_config, :pxe_debian_config, :pxemenu] + TemplateKind.where("name LIKE ?","pxelinux").map(&:name)
View
10 app/controllers/users_controller.rb
@@ -117,16 +117,6 @@ def logout
redirect_to login_users_path
end
- def auth_source_selected
- render :update do |page|
- if params[:auth_source_id] and AuthSource.find(params[:auth_source_id]).can_set_password?
- page['#password'].show
- else
- page['#password'].hide
- end
- end
- end
-
private
def authorize(ctrl = params[:controller], action = params[:action])
View
36 app/helpers/application_helper.rb
@@ -38,21 +38,6 @@ def link_to_add_fields(name, f, association, partial = nil, options = {})
link_to_function(name, ("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")").html_safe, add_html_classes(options, "btn btn-success") )
end
- def toggle_div divs
- update_page do |page|
- (divs.is_a?(Array) ? divs : divs.to_s).each_line do |div|
- # add jquery '#div' to the div if its missing
- div = div.to_s
- div = "##{div}" if div[0] != "#"
- page << "if ($('#{div}').is(':visible')) {"
- page[div].hide()
- page << "} else {"
- page[div].show
- page << "}"
- end
- end
- end
-
def link_to_remove_puppetclass klass, host
options = klass.name.size > 28 ? {:'data-original-title'=>klass.name, :rel=>'twipsy'} : {}
content_tag(:span, truncate(klass.name, :length => 28), options).html_safe +
@@ -60,7 +45,8 @@ def link_to_remove_puppetclass klass, host
:'data-original-title'=>"Click to remove #{klass}", :rel=>'twipsy',
:'data-url' => parameters_puppetclass_path( :id => klass.id),
:'data-host-id' => host.id,
- :class=>"ui-icon ui-icon-minus")
+ :'data-animation' => "",
+ :class=>"icon-remove-sign")
end
def link_to_add_puppetclass klass, host, type
@@ -71,7 +57,8 @@ def link_to_add_puppetclass klass, host, type
:'data-url' => parameters_puppetclass_path( :id => klass.id),
:'data-host-id' => host.try(:id),
:'data-original-title' => "Click to add #{klass}", :rel => 'twipsy',
- :class => "ui-icon ui-icon-plus")
+ :'data-animation' => "",
+ :class => "icon-plus-sign")
end
def add_html_classes options, classes
@@ -85,9 +72,9 @@ def add_html_classes options, classes
options
end
- def check_all_links(form_name=':checkbox')
- link_to_function("Check all", "checkAll('#{form_name}', true)") +
- link_to_function("Uncheck all", "checkAll('#{form_name}', false)")
+ def check_all_roles_links
+ link_to("Check all", "#", :id => "check_all_roles", :remote => true) +
+ link_to("Uncheck all", "#", :id => "uncheck_all_roles", :remote => true)
end
# Return true if user is authorized for controller/action, otherwise false
@@ -166,11 +153,10 @@ def searchable?
end
end
- def auto_complete_search(method, val,tag_options = {}, completion_options = {})
+ def auto_complete_search(name, val, options = {})
path = eval("#{controller_name}_path")
- options = tag_options.merge(:class => "auto_complete_input")
- text_field_tag(method, val, options) + auto_complete_clear_value_button(method) +
- auto_complete_field_jquery(method, "#{path}/auto_complete_#{method}", completion_options)
+ options.merge!(:class => "autocomplete-input", :'data-url' => "#{path}/auto_complete_#{name}" )
+ text_field_tag(name, val, options)
end
def help_path
@@ -245,7 +231,7 @@ def toolbar_action_buttons(*args)
end
def gravatar_image_tag(email, html_options = {})
- default_image = "/images/user.jpg"
+ default_image = "user.jpg"
html_options.merge!(:onerror=>"this.src='#{default_image}'")
image_tag(gravatar_url(email, default_image), html_options)
end
View
2  app/helpers/layout_helper.rb
@@ -147,7 +147,7 @@ def base_errors_for obj
end
def popover title, msg, options = {}
- link_to_function icon_text("info-sign"), { :rel => "popover", "data-content" => msg, "data-original-title" => title}.merge(options)
+ link_to icon_text("info-sign"), {}, {:remote => true, :rel => "popover", :data => {"content" => msg, "original-title" => title} }.merge(options)
end
def will_paginate(collection = nil, options = {})
View
13 app/helpers/users_helper.rb
@@ -9,23 +9,12 @@ def auth_source_column record
def contracted_host_list user
content_tag(:span, :id => "contracted_host_list", :style => "display:inline;") do
- if user.hosts.size > 20
- link_to_function("#{user.hosts[0..20].join(", ")}...") do |page|
- page[:contracted_host_list].hide
- page[:expanded_host_list].show
- end
- else
- content_tag(:span, user.hosts.to_sentence)
- end
+ content_tag(:span, user.hosts.to_sentence)
end
end
def expanded_host_list user
content_tag(:span, :id => "expanded_host_list", :style => "display:none;") do
- link_to_function(user.hosts.to_sentence) do |page|
- page[:contracted_host_list].show
- page[:expanded_host_list].hide
- end
end
end
View
4 app/models/bookmark.rb
@@ -5,7 +5,7 @@ class Bookmark < ActiveRecord::Base
validates_uniqueness_of :name, :unless => Proc.new{|b| Bookmark.my_bookmarks.where(:name => b.name).empty?}
validates_presence_of :name, :controller, :query
validates_format_of :controller, :with => /\A(\S+)\Z/, :message => "can't be blank or contain white spaces."
- default_scope :order => :name
+ default_scope lambda { order(:name) }
before_validation :set_default_user
scope :my_bookmarks, lambda {
@@ -17,7 +17,7 @@ class Bookmark < ActiveRecord::Base
{:conditions => conditions}
}
- scope :controller, lambda{|*args| {:conditions => ["controller = ?", (args.first || '')]}}
+ scope :controller, lambda { |*args| where("controller = ?", (args.first || '')) }
def set_default_user
self.owner ||= User.current
View
2  app/models/config_template.rb
@@ -2,7 +2,7 @@ class ConfigTemplate < ActiveRecord::Base
include Authorization
include Taxonomix
audited
- self.auditing_enabled = !defined?(Rake)
+ self.auditing_enabled = !(File.basename($0) == "rake" && ARGV.include?("db:migrate"))
attr_accessible :name, :template, :template_kind_id, :snippet, :template_combinations_attributes, :operatingsystem_ids, :audit_comment
validates_presence_of :name, :template
validates_presence_of :template_kind_id, :unless => Proc.new {|t| t.snippet }
View
4 app/models/host.rb
@@ -4,15 +4,13 @@ def self.method_missing(method, *args, &block)
type = "Host::Managed"
case method.to_s
when /create/, 'new'
- if args.empty? or args[0].nil? # got no paramters
+ if args.empty? or args[0].nil? # got no parameters
#set the default type
args = [{:type => type}]
else # got some parameters
args[0][:type] ||= type # adds the type if it doesnt exists
type = args[0][:type] # stores the type for later usage.
end
- when /^find_by/
- type = "Host::Base"
end
type.constantize.send(method,*args, &block)
View
6 app/models/host/base.rb
@@ -3,7 +3,7 @@
module Host
class Base < ActiveRecord::Base
include Foreman::STI
- set_table_name :hosts
+ self.table_name = :hosts
belongs_to :model
has_many :fact_values, :dependent => :destroy, :foreign_key => :host_id
@@ -14,7 +14,9 @@ class Base < ActiveRecord::Base
validates_uniqueness_of :name
validate :is_name_downcased?
- include Hostext::Search
+ def self.attributes_protected_by_default
+ super - [ inheritance_column ]
+ end
def self.importHostAndFacts yaml
end
View
35 app/models/host/managed.rb
@@ -1,6 +1,8 @@
class Host::Managed < Host::Base
include Authorization
include ReportCommon
+ include Hostext::Search
+
has_many :host_classes, :dependent => :destroy, :foreign_key => :host_id
has_many :puppetclasses, :through => :host_classes
belongs_to :hostgroup
@@ -57,33 +59,14 @@ class Jail < ::Safemode::Jail
org = Organization.current
loc = Location.current
conditions = {}
- conditions[:organization_id] = org.id if org
- conditions[:location_id] = loc.id if loc
+ conditions[:organization_id] = Array.wrap(org).map(&:id) if org
+ conditions[:location_id] = Array.wrap(loc).map(&:id) if loc
where(conditions)
}
scope :recent, lambda { |*args| {:conditions => ["last_report > ?", (args.first || (Setting[:puppet_interval] + 5).minutes.ago)]} }
scope :out_of_sync, lambda { |*args| {:conditions => ["last_report < ? and enabled != ?", (args.first || (Setting[:puppet_interval] + 5).minutes.ago), false]} }