Revision c80f3b10
Added by Tom Caspy over 7 years ago
app/controllers/api/v2/containers_controller.rb | ||
---|---|---|
20 | 20 |
if params[:compute_resource_id].present? |
21 | 21 |
scoped = Container.where(:compute_resource_id => params[:compute_resource_id]) |
22 | 22 |
else |
23 |
scoped = Container.scoped
|
|
23 |
scoped = Container.where(nil)
|
|
24 | 24 |
end |
25 | 25 |
@containers = scoped.search_for(params[:search], :order => params[:order]) |
26 | 26 |
.paginate(:page => params[:page]) |
app/controllers/image_search_controller.rb | ||
---|---|---|
1 | 1 |
class ImageSearchController < ::ApplicationController |
2 | 2 |
before_filter :find_resource |
3 | 3 |
|
4 |
# this is incredibly odd. for some reason, rails sees the |
|
5 |
# requests ImageSearchControllerTest makes as requests from another host |
|
6 |
# thus, violating CSRF. |
|
7 |
protect_from_forgery :only => :nothing if Rails.env.test? |
|
8 |
|
|
4 | 9 |
def auto_complete_repository_name |
5 | 10 |
catch_network_errors do |
6 | 11 |
text = if use_hub? |
app/helpers/containers_helper.rb | ||
---|---|---|
77 | 77 |
text_field_tag(name, val, options) |
78 | 78 |
end |
79 | 79 |
|
80 |
# Compatibility fixes - to be removed once 1.7 compatibility is no longer required |
|
81 |
if SETTINGS[:version].to_s.to_f <= 1.7 |
|
82 |
def trunc_with_tooltip(text, length = 32) |
|
83 |
trunc(text, length) |
|
84 |
end |
|
85 |
end |
|
86 |
|
|
87 | 80 |
def processes(container) |
88 | 81 |
ForemanDocker::Docker.get_container(container).top |
89 | 82 |
end |
app/models/docker_registry.rb | ||
---|---|---|
3 | 3 |
include Taxonomix |
4 | 4 |
include Encryptable |
5 | 5 |
|
6 |
attr_accessible :name, :url, :username, :password, :locations, :organizations |
|
7 |
|
|
6 | 8 |
has_many :containers, :foreign_key => "registry_id", :dependent => :destroy |
7 | 9 |
encrypts :password |
8 | 10 |
|
db/migrate/20141024163003_create_docker_registries.rb | ||
---|---|---|
3 | 3 |
create_table :docker_registries do |t| |
4 | 4 |
t.string :url |
5 | 5 |
t.string :name |
6 |
t.integer :id |
|
7 | 6 |
t.string :description |
8 | 7 |
t.timestamps |
9 | 8 |
end |
10 | 9 |
|
11 | 10 |
create_table :docker_image_docker_registries do |t| |
12 |
t.integer :id |
|
13 | 11 |
t.integer :docker_registry_id |
14 | 12 |
t.integer :docker_image_id |
15 | 13 |
end |
lib/foreman_docker/engine.rb | ||
---|---|---|
14 | 14 |
config.autoload_paths += Dir["#{config.root}/app/models/concerns"] |
15 | 15 |
|
16 | 16 |
initializer 'foreman_docker.load_app_instance_data' do |app| |
17 |
app.config.paths['db/migrate'] += ForemanDocker::Engine.paths['db/migrate'].existent |
|
17 |
ForemanDocker::Engine.paths['db/migrate'].existent.each do |path| |
|
18 |
app.config.paths['db/migrate'] << path |
|
19 |
end |
|
18 | 20 |
end |
19 | 21 |
|
20 | 22 |
initializer "foreman_docker.assets.precompile" do |app| |
Also available in: Unified diff
fixes #7230 - rails 4 compatibility